qTox  Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
Classes | Public Types | Public Slots | Public Member Functions | Private Attributes | List of all members
OfflineMsgEngine Class Reference

#include <offlinemsgengine.h>

Inheritance diagram for OfflineMsgEngine:
Inheritance graph
Collaboration diagram for OfflineMsgEngine:
Collaboration graph

Classes

struct  OfflineMessage
 
class  ReceiptResolver
 
struct  RemovedMessage
 

Public Types

using CompletionFn = std::function< void(bool)>
 

Public Slots

void onReceiptReceived (ReceiptNum receipt)
 Notification that the message is now delivered. More...
 
void onExtendedReceiptReceived (ExtendedReceiptNum receipt)
 

Public Member Functions

 OfflineMsgEngine ()=default
 
void addUnsentMessage (Message const &message, CompletionFn completionCallback)
 Add a message which has been saved to history, but not sent yet to the peer. More...
 
void addSentCoreMessage (ReceiptNum receipt, Message const &message, CompletionFn completionCallback)
 Add a message which has been saved to history, and which has been sent to the peer. More...
 
void addSentExtendedMessage (ExtendedReceiptNum receipt, Message const &message, CompletionFn completionCallback)
 
std::vector< RemovedMessageremoveAllMessages ()
 Removes all messages which are being tracked. More...
 

Private Attributes

CompatibleRecursiveMutex mutex
 
ReceiptResolver< ReceiptNumreceiptResolver
 
ReceiptResolver< ExtendedReceiptNumextendedReceiptResolver
 
std::vector< OfflineMessageunsentMessages
 

Detailed Description

Definition at line 37 of file offlinemsgengine.h.

Member Typedef Documentation

◆ CompletionFn

using OfflineMsgEngine::CompletionFn = std::function<void(bool)>

Definition at line 41 of file offlinemsgengine.h.

Constructor & Destructor Documentation

◆ OfflineMsgEngine()

OfflineMsgEngine::OfflineMsgEngine ( )
default

Member Function Documentation

◆ addSentCoreMessage()

void OfflineMsgEngine::addSentCoreMessage ( ReceiptNum  receipt,
Message const &  message,
CompletionFn  completionCallback 
)

Add a message which has been saved to history, and which has been sent to the peer.

OfflineMsgEngine will track this message's receipt. If the friend goes offline then comes back before the receipt is received, OfflineMsgEngine will also resend the message, updating history and chatlog once received.

Parameters
[in]receiptthe toxcore message ID, corresponding to expected receipt ID
[in]messageIDdatabase RowId of the message, used to eventually mark messages as received in history
[in]msgchat message line in the chatlog, used to eventually set the message's receieved timestamp

Definition at line 74 of file offlinemsgengine.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addSentExtendedMessage()

void OfflineMsgEngine::addSentExtendedMessage ( ExtendedReceiptNum  receipt,
Message const &  message,
CompletionFn  completionCallback 
)

Definition at line 81 of file offlinemsgengine.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addUnsentMessage()

void OfflineMsgEngine::addUnsentMessage ( Message const &  message,
CompletionFn  completionCallback 
)

Add a message which has been saved to history, but not sent yet to the peer.

OfflineMsgEngine will send this message once the friend becomes online again, then track its receipt, updating history and chatlog once received.

Parameters
[in]messageIDdatabase RowId of the message, used to eventually mark messages as received in history
[in]msgchat message line in the chatlog, used to eventually set the message's receieved timestamp

Definition at line 58 of file offlinemsgengine.cpp.

Here is the caller graph for this function:

◆ onExtendedReceiptReceived

void OfflineMsgEngine::onExtendedReceiptReceived ( ExtendedReceiptNum  receipt)
slot

Definition at line 43 of file offlinemsgengine.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ onReceiptReceived

void OfflineMsgEngine::onReceiptReceived ( ReceiptNum  receipt)
slot

Notification that the message is now delivered.

Parameters
[in]receiptToxcore message ID which the receipt is for.

Definition at line 37 of file offlinemsgengine.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeAllMessages()

std::vector< OfflineMsgEngine::RemovedMessage > OfflineMsgEngine::removeAllMessages ( )

Removes all messages which are being tracked.

Definition at line 91 of file offlinemsgengine.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ extendedReceiptResolver

ReceiptResolver<ExtendedReceiptNum> OfflineMsgEngine::extendedReceiptResolver
private

Definition at line 118 of file offlinemsgengine.h.

◆ mutex

CompatibleRecursiveMutex OfflineMsgEngine::mutex
private

Definition at line 66 of file offlinemsgengine.h.

◆ receiptResolver

ReceiptResolver<ReceiptNum> OfflineMsgEngine::receiptResolver
private

Definition at line 117 of file offlinemsgengine.h.

◆ unsentMessages

std::vector<OfflineMessage> OfflineMsgEngine::unsentMessages
private

Definition at line 119 of file offlinemsgengine.h.


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