|
Stream Chat Unreal SDK
|
A store for a list of messages. More...
#include <MessageStore.h>
Public Member Functions | |
| void | Append (const FMessageStore &) |
| Locally upsert a list of messages to this store. | |
| void | Append (const TArray< FMessageDto >, UUserManager *) |
| bool | AddMessage (const FMessage &) |
| Locally upsert a message to this store. | |
| bool | AddMessage (const FMessageDto &, UUserManager *) |
| void | AppendReplies (const FString &ParentId, const TArray< FMessageDto > &, UUserManager *) |
| Locally upsert the replies of a thread, oldest first. | |
| bool | IsEmpty () const |
| const FMessage & | First () |
| const FMessage & | Last () |
| TSharedPtr< FMessage > | Next (const FMessage &) const |
| Get message following the given message. Looks within the thread if given a thread reply. | |
| FMessages | FilterRecent (const FTimespan &Since) const |
| const FMessages & | GetMessages () const |
| Get all the messages of this channel. Excludes thread replies not sent with bShowInChannel. | |
| const FMessages & | GetReplies (const FString &ParentId) const |
| Get the replies held locally for the given thread, oldest first. Empty if none are held. | |
A store for a list of messages.
Holds the channel's own message list, plus the replies of any thread that has been fetched or observed. A thread reply is not part of the channel message list unless it was sent with bShowInChannel, which is how the backend reports it too: querying channel state returns the channel's history, not its threads. Storing them separately is what stops a thread's replies from appearing interleaved with the channel history.
| bool FMessageStore::AddMessage | ( | const FMessage & | NewMessage | ) |
Locally upsert a message to this store.
A thread reply goes into its thread, and additionally into the channel message list if it was sent with bShowInChannel. Adding a reply which wasn't held yet also bumps the reply count of its parent, if the parent is held here.
| void FMessageStore::AppendReplies | ( | const FString & | ParentId, |
| const TArray< FMessageDto > & | Dtos, | ||
| UUserManager * | UserManager ) |
Locally upsert the replies of a thread, oldest first.
Replies already held for the thread are kept, and are ordered after the given ones, so paginating backwards through a thread keeps the list oldest-first.