Ring Daemon 16.0.0
Loading...
Searching...
No Matches
jami::ConversationModule Class Reference

#include <conversation_module.h>

Collaboration diagram for jami::ConversationModule:
Collaboration graph

Classes

class  Impl
 

Public Member Functions

void acceptConversationRequest (const std::string &conversationId, const std::string &deviceId="")
 Accept a conversation's request.
 
void addCallHistoryMessage (const std::string &uri, uint64_t duration_ms, const std::string &reason)
 Add to the related conversation the call history message.
 
void addConversationMember (const std::string &conversationId, const dht::InfoHash &contactUri, bool sendRequest=true)
 Adds a new member to a conversation (this will triggers a member event + new message on success)
 
void addConvInfo (const ConvInfo &info)
 
void addGitSocket (std::string_view deviceId, std::string_view convId, const std::shared_ptr< dhtnet::ChannelSocket > &channel)
 
void addSwarmChannel (const std::string &conversationId, std::shared_ptr< dhtnet::ChannelSocket > socket)
 Add a swarm connection.
 
void bootstrap (const std::string &convId="")
 Bootstrap swarm managers to other peers.
 
std::shared_ptr< SIPCallcall (const std::string &url, const std::vector< libjami::MediaMap > &mediaList, std::function< void(const std::string &, const DeviceId &, const std::shared_ptr< SIPCall > &)> &&cb)
 Call the conversation.
 
void clearCache (const std::string &conversationId)
 Clear loaded interactions.
 
void clearPendingFetch ()
 Clear not removed fetch.
 
void cloneConversationFrom (const std::string &conversationId, const std::string &uri, const std::string &oldConvId="")
 Clone conversation from a member.
 
void connectivityChanged ()
 Triggers a bucket maintainance for DRTs.
 
std::map< std::string, std::string > conversationInfos (const std::string &conversationId) const
 
 ConversationModule (std::shared_ptr< JamiAccount > account, std::shared_ptr< AccountManager > accountManager, NeedsSyncingCb &&needsSyncingCb, SengMsgCb &&sendMsgCb, NeedSocketCb &&onNeedSocket, NeedSocketCb &&onNeedSwarmSocket, OneToOneRecvCb &&oneToOneRecvCb, bool autoLoadConversations=true)
 
std::vector< uint8_tconversationVCard (const std::string &conversationId) const
 
std::map< std::string, std::map< std::string, std::map< std::string, std::string > > > convMessageStatus () const
 
std::map< std::string, std::map< std::string, std::string > > convPreferences () const
 Retrieve all conversation preferences to sync with other devices.
 
uint32_t countInteractions (const std::string &convId, const std::string &toId, const std::string &fromId, const std::string &authorUri) const
 Retrieve the number of interactions from interactionId to HEAD.
 
std::shared_ptr< TransferManagerdataTransfer (const std::string &id) const
 Returns related transfer manager.
 
void declineConversationRequest (const std::string &conversationId)
 Decline a conversation's request.
 
bool downloadFile (const std::string &conversationId, const std::string &interactionId, const std::string &fileId, const std::string &path)
 Ask conversation's members to send a file to this device.
 
void editMessage (const std::string &conversationId, const std::string &newBody, const std::string &editedId)
 
void fetchNewCommits (const std::string &peer, const std::string &deviceId, const std::string &conversationId, const std::string &commitId)
 Launch fetch on new commit.
 
std::vector< std::map< std::string, std::string > > getActiveCalls (const std::string &conversationId) const
 Return active calls.
 
std::shared_ptr< ConversationgetConversation (const std::string &convId)
 Get a conversation.
 
std::vector< std::map< std::string, std::string > > getConversationMembers (const std::string &conversationId, bool includeBanned=false) const
 Get members.
 
std::map< std::string, std::string > getConversationPreferences (const std::string &conversationId, bool includeCreated=false) const
 
std::vector< std::map< std::string, std::string > > getConversationRequests () const
 Return conversation's requests.
 
std::vector< std::string > getConversations () const
 Return all conversation's id (including syncing ones)
 
std::string getOneToOneConversation (const std::string &uri) const noexcept
 Get related conversation with member.
 
std::shared_ptr< TypersgetTypers (const std::string &convId)
 Get Typers object for a conversation.
 
std::shared_ptr< dhtnet::ChannelSocket > gitSocket (std::string_view deviceId, std::string_view convId) const
 Return current git socket used for a conversation.
 
void hostConference (const std::string &conversationId, const std::string &confId, const std::string &callId, const std::vector< libjami::MediaMap > &mediaList={})
 
void initReplay (const std::string &oldConvId, const std::string &newConvId)
 
bool isBanned (const std::string &convId, const std::string &uri) const
 Return if a device or member is banned from a conversation.
 
bool isHosting (const std::string &conversationId, const std::string &confId) const
 Check if we're hosting a specific conference.
 
uint32_t loadConversation (const std::string &conversationId, const std::string &fromMessage="", size_t n=0)
 
uint32_t loadConversationMessages (const std::string &conversationId, const std::string &fromMessage="", size_t n=0)
 Load conversation's messages.
 
void loadConversations ()
 Refresh information about conversations.
 
uint32_t loadConversationUntil (const std::string &conversationId, const std::string &fromMessage, const std::string &to)
 
void loadSingleConversation (const std::string &convId)
 
uint32_t loadSwarmUntil (const std::string &conversationId, const std::string &fromMessage, const std::string &toMessage)
 
void monitor ()
 
bool needsSyncingWith (const std::string &memberUri, const std::string &deviceId) const
 Check if we need to share infos with a contact.
 
void onConversationRequest (const std::string &from, const Json::Value &value)
 Called when receiving a new conversation's request.
 
bool onFileChannelRequest (const std::string &conversationId, const std::string &member, const std::string &fileId, bool verifyShaSum=true) const
 Choose if we can accept channel request.
 
bool onMessageDisplayed (const std::string &peer, const std::string &conversationId, const std::string &interactionId)
 
void onNeedConversationRequest (const std::string &from, const std::string &conversationId)
 Called when a peer needs an invite for a conversation (generally after that they received a commit notification for a conversation they don't have yet)
 
void onSyncData (const SyncMsg &msg, const std::string &peerId, const std::string &deviceId)
 Detect new conversations and request from other devices.
 
void onTrustRequest (const std::string &uri, const std::string &conversationId, const std::vector< uint8_t > &payload, time_t received)
 Called when detecting a new trust request with linked one to one.
 
std::string peerFromConversationRequest (const std::string &convId) const
 Retrieve author of a conversation request.
 
void reactToMessage (const std::string &conversationId, const std::string &newBody, const std::string &reactToId)
 
void reloadRequests ()
 Reload requests from file.
 
void removeContact (const std::string &uri, bool ban)
 Remove one to one conversations related to a contact.
 
bool removeConversation (const std::string &conversationId)
 Remove a conversation, but not the contact.
 
void removeConversationMember (const std::string &conversationId, const dht::InfoHash &contactUri, bool isDevice=false)
 Remove a member from a conversation (this will trigger a member event + new message on success)
 
void removeGitSocket (std::string_view deviceId, std::string_view convId)
 
void search (uint32_t req, const std::string &convId, const Filter &filter) const
 Search in conversations via a filter.
 
void sendMessage (const std::string &conversationId, Json::Value &&value, const std::string &replyTo="", bool announce=true, OnCommitCb &&onCommit={}, OnDoneCb &&cb={})
 
void sendMessage (const std::string &conversationId, std::string message, const std::string &replyTo="", const std::string &type="text/plain", bool announce=true, OnCommitCb &&onCommit={}, OnDoneCb &&cb={})
 
void setAccountManager (std::shared_ptr< AccountManager > accountManager)
 
void setConversationPreferences (const std::string &conversationId, const std::map< std::string, std::string > &prefs)
 Update user's preferences (like color, notifications, etc) to be synced across devices.
 
void setFetched (const std::string &conversationId, const std::string &deviceId, const std::string &commit)
 Notify that a peer fetched a commit.
 
void shutdownConnections ()
 Clear all connection (swarm channels)
 
std::string startConversation (ConversationMode mode=ConversationMode::INVITES_ONLY, const dht::InfoHash &otherMember={})
 Starts a new conversation.
 
void syncConversations (const std::string &peer, const std::string &deviceId)
 Sync conversations with detected peer.
 
void updateConversationInfos (const std::string &conversationId, const std::map< std::string, std::string > &infos, bool sync=true)
 Update metadatas from conversations (like title, avatar, etc)
 
bool updateConvForContact (const std::string &uri, const std::string &oldConv, const std::string &newConv)
 Replace linked conversation in contact's details.
 
 ~ConversationModule ()=default
 

Static Public Member Functions

static std::map< std::string, ConvInfoconvInfos (const std::string &accountId)
 
static std::map< std::string, ConvInfoconvInfosFromPath (const std::filesystem::path &path)
 
static std::map< std::string, ConversationRequestconvRequests (const std::string &accountId)
 
static std::map< std::string, ConversationRequestconvRequestsFromPath (const std::filesystem::path &path)
 
static void saveConvInfos (const std::string &accountId, const std::map< std::string, ConvInfo > &conversations)
 
static void saveConvInfosToPath (const std::filesystem::path &path, const std::map< std::string, ConvInfo > &conversations)
 
static void saveConvRequests (const std::string &accountId, const std::map< std::string, ConversationRequest > &conversationsRequests)
 
static void saveConvRequestsToPath (const std::filesystem::path &path, const std::map< std::string, ConversationRequest > &conversationsRequests)
 

Detailed Description

Definition at line 68 of file conversation_module.h.

Constructor & Destructor Documentation

◆ ConversationModule()

jami::ConversationModule::ConversationModule ( std::shared_ptr< JamiAccount account,
std::shared_ptr< AccountManager accountManager,
NeedsSyncingCb &&  needsSyncingCb,
SengMsgCb &&  sendMsgCb,
NeedSocketCb &&  onNeedSocket,
NeedSocketCb &&  onNeedSwarmSocket,
OneToOneRecvCb &&  oneToOneRecvCb,
bool  autoLoadConversations = true 
)

Definition at line 1512 of file conversation_module.cpp.

References jami::emitSignal(), and loadConversations().

Here is the call graph for this function:

◆ ~ConversationModule()

jami::ConversationModule::~ConversationModule ( )
default

Member Function Documentation

◆ acceptConversationRequest()

void jami::ConversationModule::acceptConversationRequest ( const std::string &  conversationId,
const std::string &  deviceId = "" 
)

Accept a conversation's request.

Parameters
convId
deviceIdIf a trust request is accepted from a device (can help to sync)

Definition at line 2021 of file conversation_module.cpp.

References cloneConversationFrom(), jami::emitSignal(), and JAMI_WARNING.

Here is the call graph for this function:

◆ addCallHistoryMessage()

void jami::ConversationModule::addCallHistoryMessage ( const std::string &  uri,
uint64_t  duration_ms,
const std::string &  reason 
)

Add to the related conversation the call history message.

Parameters
uriPeer number
duration_msThe call duration in ms
reason

Definition at line 2185 of file conversation_module.cpp.

References jami::emitSignal(), getOneToOneConversation(), and sendMessage().

Here is the call graph for this function:

◆ addConversationMember()

void jami::ConversationModule::addConversationMember ( const std::string &  conversationId,
const dht::InfoHash &  contactUri,
bool  sendRequest = true 
)

Adds a new member to a conversation (this will triggers a member event + new message on success)

Parameters
conversationId
contactUri
sendRequestIf we need to inform the peer (used for tests)

Definition at line 2625 of file conversation_module.cpp.

References jami::emitSignal(), JAMI_DEBUG, and JAMI_ERROR.

Here is the call graph for this function:

◆ addConvInfo()

◆ addGitSocket()

void jami::ConversationModule::addGitSocket ( std::string_view  deviceId,
std::string_view  convId,
const std::shared_ptr< dhtnet::ChannelSocket > &  channel 
)

Definition at line 3305 of file conversation_module.cpp.

References JAMI_WARNING.

◆ addSwarmChannel()

void jami::ConversationModule::addSwarmChannel ( const std::string &  conversationId,
std::shared_ptr< dhtnet::ChannelSocket >  socket 
)

Add a swarm connection.

Parameters
conversationId
socket

Definition at line 3334 of file conversation_module.cpp.

◆ bootstrap()

void jami::ConversationModule::bootstrap ( const std::string &  convId = "")

Bootstrap swarm managers to other peers.

Definition at line 1821 of file conversation_module.cpp.

References jami::emitSignal().

Referenced by jami::ConversationModule::Impl::bootstrap().

Here is the call graph for this function:

◆ call()

std::shared_ptr< SIPCall > jami::ConversationModule::call ( const std::string &  url,
const std::vector< libjami::MediaMap > &  mediaList,
std::function< void(const std::string &, const DeviceId &, const std::shared_ptr< SIPCall > &)> &&  cb 
)

Call the conversation.

Parameters
urlUrl to call (swarm:conversation or swarm:conv/account/device/conf to join)
mediaListThe media list
cbCallback to pass which device to call (called in the same thread)
Returns
call if a call is started, else nullptr

Definition at line 2989 of file conversation_module.cpp.

References call(), jami::Manager::callFactory, jami::Call::DISCONNECTED, jami::emitSignal(), jami::CallFactory::getNewCallID(), hostConference(), jami::Manager::instance(), JAMI_DEBUG, JAMI_ERROR, jami::MediaAttribute::mediaAttributesToMediaMaps(), jami::Call::MERROR, jami::Call::OUTGOING, jami::split_string(), and jami::Call::TRYING.

Referenced by call().

Here is the call graph for this function:

◆ clearCache()

void jami::ConversationModule::clearCache ( const std::string &  conversationId)

Clear loaded interactions.

Parameters
conversationId

Definition at line 2258 of file conversation_module.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ clearPendingFetch()

void jami::ConversationModule::clearPendingFetch ( )

Clear not removed fetch.

Definition at line 1834 of file conversation_module.cpp.

References jami::emitSignal(), and JAMI_ERR.

Here is the call graph for this function:

◆ cloneConversationFrom()

void jami::ConversationModule::cloneConversationFrom ( const std::string &  conversationId,
const std::string &  uri,
const std::string &  oldConvId = "" 
)

Clone conversation from a member.

Note
used to clone an old conversation after deleting/re-adding a contact
Parameters
conversationId
uri
oldConvId

Definition at line 2121 of file conversation_module.cpp.

References jami::emitSignal().

Referenced by acceptConversationRequest(), jami::ConversationModule::Impl::bootstrap(), jami::ConversationModule::Impl::fallbackClone(), and onSyncData().

Here is the call graph for this function:

◆ connectivityChanged()

void jami::ConversationModule::connectivityChanged ( )

Triggers a bucket maintainance for DRTs.

Definition at line 3342 of file conversation_module.cpp.

◆ conversationInfos()

std::map< std::string, std::string > jami::ConversationModule::conversationInfos ( const std::string &  conversationId) const

Definition at line 2753 of file conversation_module.cpp.

References jami::emitSignal(), and JAMI_ERROR.

Here is the call graph for this function:

◆ conversationVCard()

std::vector< uint8_t > jami::ConversationModule::conversationVCard ( const std::string &  conversationId) const

Definition at line 2828 of file conversation_module.cpp.

References jami::emitSignal(), and JAMI_ERROR.

Here is the call graph for this function:

◆ convInfos()

std::map< std::string, ConvInfo > jami::ConversationModule::convInfos ( const std::string &  accountId)
static

◆ convInfosFromPath()

std::map< std::string, ConvInfo > jami::ConversationModule::convInfosFromPath ( const std::filesystem::path &  path)
static

Definition at line 3222 of file conversation_module.cpp.

References JAMI_WARN.

◆ convMessageStatus()

std::map< std::string, std::map< std::string, std::map< std::string, std::string > > > jami::ConversationModule::convMessageStatus ( ) const

Definition at line 2219 of file conversation_module.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ convPreferences()

std::map< std::string, std::map< std::string, std::string > > jami::ConversationModule::convPreferences ( ) const

Retrieve all conversation preferences to sync with other devices.

Definition at line 2816 of file conversation_module.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ convRequests()

std::map< std::string, ConversationRequest > jami::ConversationModule::convRequests ( const std::string &  accountId)
static

◆ convRequestsFromPath()

std::map< std::string, ConversationRequest > jami::ConversationModule::convRequestsFromPath ( const std::filesystem::path &  path)
static

Definition at line 3247 of file conversation_module.cpp.

References JAMI_WARN.

◆ countInteractions()

uint32_t jami::ConversationModule::countInteractions ( const std::string &  convId,
const std::string &  toId,
const std::string &  fromId,
const std::string &  authorUri 
) const

Retrieve the number of interactions from interactionId to HEAD.

Parameters
convId
interactionId"" for getting the whole history
authorUriStop when detect author
Returns
number of interactions since interactionId

Definition at line 2695 of file conversation_module.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ dataTransfer()

std::shared_ptr< TransferManager > jami::ConversationModule::dataTransfer ( const std::string &  id) const

Returns related transfer manager.

Parameters
idConversation's id
Returns
nullptr if not found, else the manager

Definition at line 2352 of file conversation_module.cpp.

◆ declineConversationRequest()

void jami::ConversationModule::declineConversationRequest ( const std::string &  conversationId)

Decline a conversation's request.

Parameters
convId

Definition at line 2048 of file conversation_module.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ downloadFile()

bool jami::ConversationModule::downloadFile ( const std::string &  conversationId,
const std::string &  interactionId,
const std::string &  fileId,
const std::string &  path 
)

Ask conversation's members to send a file to this device.

Parameters
conversationIdRelated conversation
interactionIdRelated interaction
fileIdRelated fileId
pathwhere to download the file

Definition at line 2399 of file conversation_module.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ editMessage()

void jami::ConversationModule::editMessage ( const std::string &  conversationId,
const std::string &  newBody,
const std::string &  editedId 
)

Definition at line 2164 of file conversation_module.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ fetchNewCommits()

void jami::ConversationModule::fetchNewCommits ( const std::string &  peer,
const std::string &  deviceId,
const std::string &  conversationId,
const std::string &  commitId 
)

Launch fetch on new commit.

Parameters
peerWho sent the notification
deviceIdWho sent the notification
conversationIdRelated conversation
commitIdCommit to retrieve

Definition at line 2616 of file conversation_module.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ getActiveCalls()

std::vector< std::map< std::string, std::string > > jami::ConversationModule::getActiveCalls ( const std::string &  conversationId) const

Return active calls.

Parameters
convIdWhich conversation to choose
Returns
{{"id":id}, {"uri":uri}, {"device":device}}

Definition at line 2981 of file conversation_module.cpp.

◆ getConversation()

◆ getConversationMembers()

std::vector< std::map< std::string, std::string > > jami::ConversationModule::getConversationMembers ( const std::string &  conversationId,
bool  includeBanned = false 
) const

Get members.

Parameters
conversationId
includeBanned
Returns
a map of members with their role and details

Definition at line 2688 of file conversation_module.cpp.

References jami::emitSignal().

Referenced by jami::ConversationModule::Impl::bootstrap(), jami::ConversationModule::Impl::fallbackClone(), and onSyncData().

Here is the call graph for this function:

◆ getConversationPreferences()

std::map< std::string, std::string > jami::ConversationModule::getConversationPreferences ( const std::string &  conversationId,
bool  includeCreated = false 
) const

Definition at line 2804 of file conversation_module.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ getConversationRequests()

std::vector< std::map< std::string, std::string > > jami::ConversationModule::getConversationRequests ( ) const

Return conversation's requests.

Definition at line 1887 of file conversation_module.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ getConversations()

std::vector< std::string > jami::ConversationModule::getConversations ( ) const

Return all conversation's id (including syncing ones)

Definition at line 1859 of file conversation_module.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ getOneToOneConversation()

std::string jami::ConversationModule::getOneToOneConversation ( const std::string &  uri) const
noexcept

Get related conversation with member.

Parameters
uriThe member to search for
Returns
the conversation id if found else empty

Definition at line 1873 of file conversation_module.cpp.

Referenced by addCallHistoryMessage(), onTrustRequest(), removeContact(), jami::ConversationModule::Impl::removeRepositoryImpl(), and jami::ConversationModule::Impl::updateConvForContact().

◆ getTypers()

std::shared_ptr< Typers > jami::ConversationModule::getTypers ( const std::string &  convId)

Get Typers object for a conversation.

Parameters
convId
Returns
the Typer object

Definition at line 3349 of file conversation_module.cpp.

◆ gitSocket()

std::shared_ptr< dhtnet::ChannelSocket > jami::ConversationModule::gitSocket ( std::string_view  deviceId,
std::string_view  convId 
) const

Return current git socket used for a conversation.

Parameters
deviceIdRelated device
conversationIdRelated conversation
Returns
the related socket

Definition at line 3292 of file conversation_module.cpp.

◆ hostConference()

void jami::ConversationModule::hostConference ( const std::string &  conversationId,
const std::string &  confId,
const std::string &  callId,
const std::vector< libjami::MediaMap > &  mediaList = {} 
)

Definition at line 3110 of file conversation_module.cpp.

References JAMI_ERROR, and JAMI_WARNING.

Referenced by call().

◆ initReplay()

void jami::ConversationModule::initReplay ( const std::string &  oldConvId,
const std::string &  newConvId 
)

Definition at line 2938 of file conversation_module.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ isBanned()

bool jami::ConversationModule::isBanned ( const std::string &  convId,
const std::string &  uri 
) const

Return if a device or member is banned from a conversation.

Parameters
convId
uri

Definition at line 2840 of file conversation_module.cpp.

References jami::emitSignal(), and jami::ONE_TO_ONE.

Here is the call graph for this function:

◆ isHosting()

bool jami::ConversationModule::isHosting ( const std::string &  conversationId,
const std::string &  confId 
) const

Check if we're hosting a specific conference.

Parameters
conversationId(empty to search all conv)
confId
Returns
true if hosting this conference

Definition at line 2961 of file conversation_module.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ loadConversation()

uint32_t jami::ConversationModule::loadConversation ( const std::string &  conversationId,
const std::string &  fromMessage = "",
size_t  n = 0 
)

Definition at line 2269 of file conversation_module.cpp.

References jami::emitSignal(), and jami::LogOptions::from.

Here is the call graph for this function:

◆ loadConversationMessages()

uint32_t jami::ConversationModule::loadConversationMessages ( const std::string &  conversationId,
const std::string &  fromMessage = "",
size_t  n = 0 
)

Load conversation's messages.

Parameters
conversationIdConversation to load
fromMessage
nMax interactions to load
Returns
id of the operation

Definition at line 2231 of file conversation_module.cpp.

References jami::emitSignal(), and jami::LogOptions::from.

Here is the call graph for this function:

◆ loadConversations()

void jami::ConversationModule::loadConversations ( )

Refresh information about conversations.

Definition at line 1552 of file conversation_module.cpp.

References convInfos(), jami::emitSignal(), jami::fileutils::get_data_dir(), JAMI_ERROR, JAMI_LOG, JAMI_WARNING, jami::ConversationMapKeys::LAST_DISPLAYED, and jami::ONE_TO_ONE.

Referenced by ConversationModule().

Here is the call graph for this function:

◆ loadConversationUntil()

uint32_t jami::ConversationModule::loadConversationUntil ( const std::string &  conversationId,
const std::string &  fromMessage,
const std::string &  to 
)

Definition at line 2296 of file conversation_module.cpp.

References jami::emitSignal(), and jami::LogOptions::from.

Here is the call graph for this function:

◆ loadSingleConversation()

void jami::ConversationModule::loadSingleConversation ( const std::string &  convId)

Definition at line 1762 of file conversation_module.cpp.

References convInfos(), jami::emitSignal(), jami::fileutils::get_data_dir(), JAMI_LOG, and JAMI_WARNING.

Here is the call graph for this function:

◆ loadSwarmUntil()

uint32_t jami::ConversationModule::loadSwarmUntil ( const std::string &  conversationId,
const std::string &  fromMessage,
const std::string &  toMessage 
)

Definition at line 2324 of file conversation_module.cpp.

References jami::emitSignal(), and jami::LogOptions::from.

Here is the call graph for this function:

◆ monitor()

void jami::ConversationModule::monitor ( )

Definition at line 1827 of file conversation_module.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ needsSyncingWith()

bool jami::ConversationModule::needsSyncingWith ( const std::string &  memberUri,
const std::string &  deviceId 
) const

Check if we need to share infos with a contact.

Parameters
memberUri
deviceId

Definition at line 2580 of file conversation_module.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ onConversationRequest()

void jami::ConversationModule::onConversationRequest ( const std::string &  from,
const Json::Value &  value 
)

Called when receiving a new conversation's request.

Parameters
fromSender
valueConversation's request

Definition at line 1942 of file conversation_module.cpp.

References jami::ConversationRequest::conversationId, jami::emitSignal(), jami::ConversationRequest::from, jami::ConversationRequest::isOneToOne(), JAMI_DEBUG, JAMI_WARNING, jami::ConversationRequest::received, and jami::ConversationRequest::toMap().

Here is the call graph for this function:

◆ onFileChannelRequest()

bool jami::ConversationModule::onFileChannelRequest ( const std::string &  conversationId,
const std::string &  member,
const std::string &  fileId,
bool  verifyShaSum = true 
) const

Choose if we can accept channel request.

Parameters
memberMember to check
fileIdFile transfer to check (needs to be waiting)
verifyShaSumFor debug only
Returns
if we accept the channel request

Definition at line 2359 of file conversation_module.cpp.

References jami::emitSignal(), JAMI_WARNING, and jami::fileutils::sha3File().

Here is the call graph for this function:

◆ onMessageDisplayed()

bool jami::ConversationModule::onMessageDisplayed ( const std::string &  peer,
const std::string &  conversationId,
const std::string &  interactionId 
)

Definition at line 2204 of file conversation_module.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ onNeedConversationRequest()

void jami::ConversationModule::onNeedConversationRequest ( const std::string &  from,
const std::string &  conversationId 
)

Called when a peer needs an invite for a conversation (generally after that they received a commit notification for a conversation they don't have yet)

Parameters
from
conversationId

Definition at line 2007 of file conversation_module.cpp.

References JAMI_LOG.

◆ onSyncData()

void jami::ConversationModule::onSyncData ( const SyncMsg msg,
const std::string &  peerId,
const std::string &  deviceId 
)

Detect new conversations and request from other devices.

Parameters
msgReceived data
peerIdSender
deviceId

Definition at line 2440 of file conversation_module.cpp.

References addConvInfo(), cloneConversationFrom(), jami::emitSignal(), getConversationMembers(), JAMI_DEBUG, JAMI_LOG, and JAMI_WARNING.

Here is the call graph for this function:

◆ onTrustRequest()

void jami::ConversationModule::onTrustRequest ( const std::string &  uri,
const std::string &  conversationId,
const std::vector< uint8_t > &  payload,
time_t  received 
)

Called when detecting a new trust request with linked one to one.

Parameters
uriSender's URI
conversationIdRelated conversation's id
payloadVCard
receivedReceived time

Definition at line 1901 of file conversation_module.cpp.

References jami::ConversationRequest::conversationId, jami::emitSignal(), jami::ConversationRequest::from, getOneToOneConversation(), jami::ConversationRepository::infosFromVCard(), JAMI_DEBUG, JAMI_WARNING, jami::ConversationRequest::metadatas, jami::ConversationRequest::received, jami::ConversationRequest::toMap(), and vCard::utils::toMap().

Here is the call graph for this function:

◆ peerFromConversationRequest()

std::string jami::ConversationModule::peerFromConversationRequest ( const std::string &  convId) const

Retrieve author of a conversation request.

Parameters
convIdConversation's id
Returns
the author of the conversation request

Definition at line 1996 of file conversation_module.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ reactToMessage()

void jami::ConversationModule::reactToMessage ( const std::string &  conversationId,
const std::string &  newBody,
const std::string &  reactToId 
)

Definition at line 2172 of file conversation_module.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ reloadRequests()

void jami::ConversationModule::reloadRequests ( )

Reload requests from file.

Definition at line 1853 of file conversation_module.cpp.

References convRequests().

Here is the call graph for this function:

◆ removeContact()

void jami::ConversationModule::removeContact ( const std::string &  uri,
bool  ban 
)

Remove one to one conversations related to a contact.

Parameters
uriOf the contact
banIf banned

Definition at line 2856 of file conversation_module.cpp.

References jami::emitSignal(), getOneToOneConversation(), JAMI_DEBUG, JAMI_WARN, and jami::ONE_TO_ONE.

Here is the call graph for this function:

◆ removeConversation()

bool jami::ConversationModule::removeConversation ( const std::string &  conversationId)

Remove a conversation, but not the contact.

Parameters
conversationId
Returns
if successfully removed

Definition at line 2932 of file conversation_module.cpp.

Referenced by jami::ConversationModule::Impl::fixStructures(), and jami::ConversationModule::Impl::handlePendingConversation().

◆ removeConversationMember()

void jami::ConversationModule::removeConversationMember ( const std::string &  conversationId,
const dht::InfoHash &  contactUri,
bool  isDevice = false 
)

Remove a member from a conversation (this will trigger a member event + new message on success)

Parameters
conversationId
contactUri
isDevice

Definition at line 2666 of file conversation_module.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ removeGitSocket()

void jami::ConversationModule::removeGitSocket ( std::string_view  deviceId,
std::string_view  convId 
)

Definition at line 3317 of file conversation_module.cpp.

◆ saveConvInfos()

void jami::ConversationModule::saveConvInfos ( const std::string &  accountId,
const std::map< std::string, ConvInfo > &  conversations 
)
static

Definition at line 1496 of file conversation_module.cpp.

References jami::fileutils::get_data_dir(), and saveConvInfosToPath().

Referenced by jami::ConversationModule::Impl::saveConvInfos().

Here is the call graph for this function:

◆ saveConvInfosToPath()

void jami::ConversationModule::saveConvInfosToPath ( const std::filesystem::path &  path,
const std::map< std::string, ConvInfo > &  conversations 
)
static

Definition at line 1503 of file conversation_module.cpp.

References jami::emitSignal().

Referenced by saveConvInfos().

Here is the call graph for this function:

◆ saveConvRequests()

void jami::ConversationModule::saveConvRequests ( const std::string &  accountId,
const std::map< std::string, ConversationRequest > &  conversationsRequests 
)
static

◆ saveConvRequestsToPath()

void jami::ConversationModule::saveConvRequestsToPath ( const std::filesystem::path &  path,
const std::map< std::string, ConversationRequest > &  conversationsRequests 
)
static

Definition at line 1485 of file conversation_module.cpp.

References jami::emitSignal().

Referenced by saveConvRequests().

Here is the call graph for this function:

◆ search()

void jami::ConversationModule::search ( uint32_t  req,
const std::string &  convId,
const Filter filter 
) const

Search in conversations via a filter.

Parameters
reqId of the request
convIdLeave empty to search in all conversation, else add the conversation's id
filterParameters for the search
Note
triggers messagesFound

Definition at line 2709 of file conversation_module.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ sendMessage() [1/2]

void jami::ConversationModule::sendMessage ( const std::string &  conversationId,
Json::Value &&  value,
const std::string &  replyTo = "",
bool  announce = true,
OnCommitCb &&  onCommit = {},
OnDoneCb &&  cb = {} 
)

Definition at line 2148 of file conversation_module.cpp.

References jami::emitSignal().

Referenced by addCallHistoryMessage(), jami::ConversationModule::Impl::editMessage(), and jami::ConversationModule::Impl::sendMessage().

Here is the call graph for this function:

◆ sendMessage() [2/2]

void jami::ConversationModule::sendMessage ( const std::string &  conversationId,
std::string  message,
const std::string &  replyTo = "",
const std::string &  type = "text/plain",
bool  announce = true,
OnCommitCb &&  onCommit = {},
OnDoneCb &&  cb = {} 
)

Definition at line 2130 of file conversation_module.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ setAccountManager()

void jami::ConversationModule::setAccountManager ( std::shared_ptr< AccountManager accountManager)

Definition at line 1534 of file conversation_module.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ setConversationPreferences()

void jami::ConversationModule::setConversationPreferences ( const std::string &  conversationId,
const std::map< std::string, std::string > &  prefs 
)

Update user's preferences (like color, notifications, etc) to be synced across devices.

Parameters
conversationId
preferences

Definition at line 2785 of file conversation_module.cpp.

References jami::emitSignal(), and JAMI_ERROR.

Here is the call graph for this function:

◆ setFetched()

void jami::ConversationModule::setFetched ( const std::string &  conversationId,
const std::string &  deviceId,
const std::string &  commit 
)

Notify that a peer fetched a commit.

Note
: this definitely remove the repository when needed (when we left and someone fetched the information)
Parameters
conversationIdRelated conv
deviceIdDevice who synced
commitHEAD synced

Definition at line 2600 of file conversation_module.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ shutdownConnections()

void jami::ConversationModule::shutdownConnections ( )

Clear all connection (swarm channels)

Definition at line 3323 of file conversation_module.cpp.

◆ startConversation()

std::string jami::ConversationModule::startConversation ( ConversationMode  mode = ConversationMode::INVITES_ONLY,
const dht::InfoHash &  otherMember = {} 
)

Starts a new conversation.

Parameters
modeWanted mode
otherMemberIf needed (one to one)
Returns
conversation's id

Definition at line 2064 of file conversation_module.cpp.

References _, addConvInfo(), jami::ConversationModule::Impl::bootstrapCb(), jami::emitSignal(), JAMI_ERROR, and jami::kd.

Referenced by jami::ConversationModule::Impl::cloneConversation(), and jami::ConversationModule::Impl::cloneConversationFrom().

Here is the call graph for this function:

◆ syncConversations()

void jami::ConversationModule::syncConversations ( const std::string &  peer,
const std::string &  deviceId 
)

Sync conversations with detected peer.

Definition at line 2413 of file conversation_module.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ updateConversationInfos()

void jami::ConversationModule::updateConversationInfos ( const std::string &  conversationId,
const std::map< std::string, std::string > &  infos,
bool  sync = true 
)

Update metadatas from conversations (like title, avatar, etc)

Parameters
conversationId
infos
syncIf we need to sync with others (used for tests)

Definition at line 2733 of file conversation_module.cpp.

References jami::emitSignal(), JAMI_ERROR, and JAMI_WARNING.

Here is the call graph for this function:

◆ updateConvForContact()

bool jami::ConversationModule::updateConvForContact ( const std::string &  uri,
const std::string &  oldConv,
const std::string &  newConv 
)

Replace linked conversation in contact's details.

Parameters
uriOf the contact
oldConvCurrent conversation
newConv
Returns
if replaced

Definition at line 1879 of file conversation_module.cpp.

References jami::emitSignal().

Referenced by jami::ConversationModule::Impl::fixStructures(), and jami::ConversationModule::Impl::removeConversationImpl().

Here is the call graph for this function:

The documentation for this class was generated from the following files: