|
Twitch SDK (Internal)
|
#include <chatroom.h>
Public Types | |
| using | DisposerFunc = std::function< void()> |
| using | DeleteRoomCallback = std::function< void(TTV_ErrorCode ec)> |
| using | SendMessageCallback = std::function< void(TTV_ErrorCode ec, SendRoomMessageError &&error, ChatRoomMessage &&message)> |
| using | EditMessageCallback = std::function< void(TTV_ErrorCode ec, ChatRoomMessage &&message)> |
| using | DeleteMessageCallback = std::function< void(TTV_ErrorCode ec)> |
| using | FetchMessagesCallback = std::function< void(TTV_ErrorCode ec, std::vector< ChatRoomMessage > &&messages, std::string &&nextCursor, bool moreMessages)> |
| using | UpdateRoomInfoCallback = std::function< void(TTV_ErrorCode ec, UpdateRoomError &&error, ChatRoomInfo &&info)> |
| using | UpdateRoomModesCallback = std::function< void(TTV_ErrorCode ec, UpdateRoomModesError &&error, ChatRoomInfo &&info)> |
| using | UpdateRoomViewCallback = std::function< void(TTV_ErrorCode ec, ChatRoomInfo &&info)> |
| using | FetchRoomInfoCallback = std::function< void(TTV_ErrorCode ec, ChatRoomInfo &&info)> |
| enum | State { State::Uninitialized, State::Initialized, State::ShuttingDown, State::Inert } |
Public Member Functions | |
| ChatRoom (const std::shared_ptr< User > &user, const std::string &roomId, ChannelId channelId) | |
| virtual std::string | GetLoggerName () const override |
| virtual void | Update () override |
| virtual TTV_ErrorCode | Dispose () override |
| virtual TTV_ErrorCode | DeleteRoom (const DeleteRoomCallback &callback) override |
| virtual TTV_ErrorCode | SendMessage (const std::string &message, ChatRoomMessage &placeholderMessage, const SendMessageCallback &callback) override |
| virtual TTV_ErrorCode | EditMessage (const std::string &messageId, const std::string &message, ChatRoomMessage &placeholderMessage, const EditMessageCallback &callback) override |
| virtual TTV_ErrorCode | DeleteMessage (const std::string &messageId, const DeleteMessageCallback &callback) override |
| virtual TTV_ErrorCode | FetchMessagesBeforeCursor (const std::string &cursor, uint32_t limit, const FetchMessagesCallback &callback) override |
| virtual TTV_ErrorCode | FetchMessagesAfterCursor (const std::string &cursor, uint32_t limit, const FetchMessagesCallback &callback) override |
| virtual TTV_ErrorCode | FetchMessagesBeforeTimestamp (Timestamp timestamp, uint32_t limit, const FetchMessagesCallback &callback) override |
| virtual TTV_ErrorCode | FetchMessagesAfterTimestamp (Timestamp timestamp, uint32_t limit, const FetchMessagesCallback &callback) override |
| virtual TTV_ErrorCode | FetchRoomInfo (const FetchRoomInfoCallback &callback) override |
| virtual TTV_ErrorCode | SetRoomName (const std::string &name, const UpdateRoomInfoCallback &callback) override |
| virtual TTV_ErrorCode | SetTopic (const std::string &topic, const UpdateRoomInfoCallback &callback) override |
| virtual TTV_ErrorCode | SetPreviewable (bool isPreviewable, const UpdateRoomInfoCallback &callback) override |
| virtual TTV_ErrorCode | SetMinimumAllowedRole (RoomRole minimumAllowedRole, const UpdateRoomInfoCallback &callback) override |
| virtual TTV_ErrorCode | EnableSlowMode (uint32_t durationSeconds, const UpdateRoomModesCallback &callback) override |
| virtual TTV_ErrorCode | DisableSlowMode (const UpdateRoomModesCallback &callback) override |
| virtual TTV_ErrorCode | EnableR9kMode (const UpdateRoomModesCallback &callback) override |
| virtual TTV_ErrorCode | DisableR9kMode (const UpdateRoomModesCallback &callback) override |
| virtual TTV_ErrorCode | EnableEmotesOnlyMode (const UpdateRoomModesCallback &callback) override |
| virtual TTV_ErrorCode | DisableEmotesOnlyMode (const UpdateRoomModesCallback &callback) override |
| virtual TTV_ErrorCode | SetLastReadAt (Timestamp lastReadAt, const UpdateRoomViewCallback &callback) override |
| virtual TTV_ErrorCode | SetMuted (bool isMuted, const UpdateRoomViewCallback &callback) override |
| virtual TTV_ErrorCode | SetArchived (bool isArchived, const UpdateRoomViewCallback &callback) override |
| void | SetTokenizationOptions (const TokenizationOptions &options) |
| void | OnTopicSubscribeStateChanged (const std::string &topic, PubSubClient::SubscribeState::Enum state, TTV_ErrorCode ec) override |
| void | OnTopicMessageReceived (const std::string &topic, const ttv::json::Value &jVal) override |
| virtual void | CompleteShutdown () override |
| void | SetListener (const std::shared_ptr< IChatRoomListener > &listener) |
| void | SetDisposer (DisposerFunc &&func) |
| virtual TTV_ErrorCode | Initialize () override |
| virtual TTV_ErrorCode | Shutdown () override |
| virtual void | OnTopicListenerRemoved (const std::string &topic, TTV_ErrorCode ec) |
| virtual void | SetTaskRunner (std::shared_ptr< TaskRunner > taskRunner) |
| std::shared_ptr< TaskRunner > | GetTaskRunner () |
| virtual State | GetState () const override |
Static Public Member Functions | |
| static std::string | GetComponentName () |
Protected Member Functions | |
| virtual bool | CheckShutdown () override |
| virtual void | AddTopic (const std::string &topic) |
| virtual TTV_ErrorCode | SubscribeTopics () |
| virtual void | OnUserLogInComplete (TTV_ErrorCode ec) |
| virtual void | OnUserLogOutComplete (TTV_ErrorCode ec) |
| virtual void | OnUserInfoFetchComplete (TTV_ErrorCode ec) |
| virtual void | OnUserAuthenticationIssue (std::shared_ptr< const OAuthToken > oauthToken, TTV_ErrorCode ec) |
| void | Log (TTV_MessageLevel level, const char *format,...) |
| TTV_ErrorCode | StartTask (std::shared_ptr< Task > task) |
| void | CompleteTask (Task *task) |
| bool | IsTaskRunning (Task *task) const |
| virtual void | SetState (State state) |
| virtual void | SetClientState (State state) |
| virtual void | SetServerState (State state) |
Protected Attributes | |
| std::shared_ptr< IChatRoomListener > | mListener |
| std::shared_ptr< PubSubClient > | mPubSub |
| std::shared_ptr< PubSubTopicListener > | mPubSubTopicListener |
| std::shared_ptr< PubSubTopicListenerHelper > | mPubSubTopicListenerHelper |
| DisposerFunc | mDisposerFunc |
| std::vector< std::string > | mPubSubTopics |
| std::weak_ptr< User > | mUser |
| bool | mOAuthIssue |
| Whether or not the internal updates of the component are on hold because of an issue with the OAuth token. More... | |
| ClientServerValue< State > | mState |
| std::shared_ptr< TaskRunner > | mTaskRunner |
| std::vector< std::shared_ptr< Task > > | mRunningTasks |
| std::mutex | mTaskMutex |
| uint64_t | mShutdownTimeMilliseconds |
Private Member Functions | |
| TTV_ErrorCode | TokenizeLocalMessage (const std::shared_ptr< User > &user, const std::string &message, ChatRoomMessage &chatMessage) |
| TTV_ErrorCode | SetChatMode (ChatMode mode, bool turnOn, uint32_t slowModeDurationSeconds, const UpdateRoomModesCallback &callback) |
| void | FlagIgnoredMessages (std::vector< ChatRoomMessage > &messages) |
Private Attributes | |
| std::unordered_map< std::string, uint64_t > | mMessageNonces |
| Keeps track of sent message nonces to prevent duplicates from pubsub. More... | |
| std::vector< MessageBadge > | mCachedUserBadges |
| Cache the user's badges received from the last API callback to use for the next placeholder message's badges. More... | |
| std::string | mPubSubTopic |
| std::string | mRoomId |
| TokenizationOptions | mTokenizationOptions |
| ChannelId | mChannelId |
| Color | mCachedUserColor |
| Cache the user's chat color received from the last API callback to use for the next placeholder message's chat color. More... | |
|
inherited |
Used with DeleteMessage().
| [in] | ec |
|
| [in] | message | The message received back from the server. |
|
inherited |
Used with DeleteRoom().
| [in] | ec |
|
| using ttv::chat::ChatRoom::DisposerFunc = std::function<void()> |
|
inherited |
Used with EditMessage().
| [in] | ec |
|
| [in] | message | The message received back from the server. |
|
inherited |
Used with FetchMessages functions.
| [in] | ec |
|
| [in] | messages | The list of messages received back from the server. If fetching before a time/cursor, listed from newest to oldest. Else if fetching after a time/cursor, listed from oldest to newest. |
| [in] | nextCursor | The cursor to use next time to fetch messages from where we left off, in the same pagination direction. |
| [in] | moreMessages | True if there are more messages to be fetched at the cursor, else false. |
|
inherited |
Used with FetchRoomInfo().
| [in] | ec |
|
| [in] | info | The updated information of the room. |
|
inherited |
Used with SendMessage().
| [in] | ec |
|
| [in] | error | Error object received from GraphQL describing reason why sending message failed. |
| [in] | message | The message received back from the server. |
|
inherited |
Used when updating the information of a room.
| [in] | ec |
|
| [in] | error | Error object received from GraphQL describing the reason why updating room info failed. |
| [in] | info | The updated information of the room. |
|
inherited |
Used when updating a room's chat mode.
| [in] | ec |
|
| [in] | error | Error object received from GraphQL describing the reason why updating room mode failed. |
| [in] | info | The updated information of the room. |
|
inherited |
Used when updating a room's view.
| [in] | ec |
|
| [in] | info | The updated information of the room. |
|
stronginherited |
| ttv::chat::ChatRoom::ChatRoom | ( | const std::shared_ptr< User > & | user, |
| const std::string & | roomId, | ||
| ChannelId | channelId | ||
| ) |
|
protectedvirtualinherited |
|
overrideprotectedvirtualinherited |
Reimplemented from ttv::Component.
Reimplemented in ttv::ChannelStatus, and ttv::ProfileImageStatus.
|
inlineoverridevirtualinherited |
Reimplemented from ttv::PubSubComponentBase.
|
protectedinherited |
|
overridevirtual |
Deletes a message in the chat room.
| [in] | messageId | The id of the message we want to delete. |
| [in] | callback | Callback when API call returns, receives an error code. |
Implements ttv::chat::IChatRoom.
|
overridevirtual |
Deletes the chat room from the channel. User must be the owner of the chat room.
| [in] | callback | Callback when API call returns, receives an error code. |
Implements ttv::chat::IChatRoom.
|
overridevirtual |
Turns off emotes-only mode for the chat room.
| [in] | callback | Callback when the API call returns, receives an error code and the new room info. |
Implements ttv::chat::IChatRoom.
|
overridevirtual |
Turns off r9k mode for the chat room.
| [in] | callback | Callback when the API call returns, receives an error code and the new room info. |
Implements ttv::chat::IChatRoom.
|
overridevirtual |
Turns off slow mode for the chat room.
| [in] | callback | Callback when the API call returns, receives an error code and the new room info. |
Implements ttv::chat::IChatRoom.
|
overridevirtual |
This should be called when the application is done with the instance.
Implements ttv::chat::IChatRoom.
|
overridevirtual |
Edits a message's content in the chat room. User must have written the message.
| [in] | messageId | The id of the message we want to edit. |
| [in] | message | The content that we want to set the message to. |
| [out] | placeholderMessage | A ChatRoomMessage created client-side to be displayed until we receive the actual message result from the backend. |
| [in] | callback | Callback when API call returns, receives an error code and the edited message. |
Implements ttv::chat::IChatRoom.
|
overridevirtual |
Turns on emotes-only mode for the chat room.
| [in] | callback | Callback when the API call returns, receives an error code and the new room info. |
Implements ttv::chat::IChatRoom.
|
overridevirtual |
Turns on r9k mode for the chat room.
| [in] | callback | Callback when the API call returns, receives an error code and the new room info. |
Implements ttv::chat::IChatRoom.
|
overridevirtual |
Turns on slow mode for the chat room.
| [in] | durationSeconds | The number of seconds a user must wait between sending messages. Cannot be 0. |
| [in] | callback | Callback when the API call returns, receives an error code and the new room info. |
Implements ttv::chat::IChatRoom.
|
overridevirtual |
Fetches newer messages from the chat room starting at the cursor, from oldest to newest.
| [in] | cursor | The cursor that we want to start fetching messages from. If the empty string is passed in, we fetch the oldest messages in the room. |
| [in] | limit | The max number of messages to fetch. Can be a number from 1-100. |
| [in] | callback | Callback when API call returns, receives an error code and the list of messages. |
Implements ttv::chat::IChatRoom.
|
overridevirtual |
Fetches messages from the chat room and after the timestamp (inclusive), from oldest to newest.
| [in] | timestamp | The timestamp that we want to start fetching messages from. |
| [in] | limit | The max number of messages to fetch. Can be a number from 1-100. |
| [in] | callback | Callback when API call returns, receives an error code and the list of messages. |
Implements ttv::chat::IChatRoom.
|
overridevirtual |
Fetches older messages from the chat room starting at the cursor, from newest to oldest.
| [in] | cursor | The cursor that we want to start fetching messages from. If the empty string is passed in, we fetch the most recent messages in the room. |
| [in] | limit | The max number of messages to fetch. Can be a number from 1-100. |
| [in] | callback | Callback when API call returns, receives an error code and the list of messages. |
Implements ttv::chat::IChatRoom.
|
overridevirtual |
Fetches messages from the chat room before the timestamp, from newest to oldest.
| [in] | timestamp | The timestamp that we want to start fetching messages from. |
| [in] | limit | The max number of messages to fetch. Can be a number from 1-100. |
| [in] | callback | Callback when API call returns, receives an error code and the list of messages. |
Implements ttv::chat::IChatRoom.
|
overridevirtual |
Fetches the information of the chat room and returns it in the callback.
| [in] | callback | Callback when API call returns, receives an error code and the room info. |
Implements ttv::chat::IChatRoom.
|
private |
|
inlinestatic |
|
overridevirtual |
Implements ttv::PubSubComponentBase.
|
overridevirtualinherited |
Implements ttv::IComponent.
|
inlineinherited |
|
overridevirtualinherited |
Reimplemented from ttv::UserComponent.
Reimplemented in ttv::chat::BitsStatus, ttv::chat::UserEmoticonSets, and ttv::ChannelStatus.
|
protectedinherited |
|
protectedinherited |
|
virtualinherited |
|
overridevirtual |
Implements ttv::PubSubComponentBase.
|
overridevirtual |
Implements ttv::PubSubComponentBase.
|
protectedvirtualinherited |
|
protectedvirtualinherited |
Reimplemented in ttv::social::FriendList, ttv::social::Presence, and ttv::chat::ChatUserThreads.
|
protectedvirtualinherited |
|
protectedvirtualinherited |
|
overridevirtual |
Send a message to the chat room. User must be joined to the chat room.
| [in] | message | Content of the message we want to send to the chat room. |
| [out] | placeholderMessage | A ChatRoomMessage created client-side to be displayed until we receive the actual message result from the backend. |
| [in] | callback | Callback when API call returns, receives an error code and the sent message. |
Implements ttv::chat::IChatRoom.
|
overridevirtual |
Update if the user has archived the chat room.
| [in] | isArchived | Whether the user has archived the room. |
| [in] | callback | Callback when API call returns, receives an error code and the new room info. |
Implements ttv::chat::IChatRoom.
|
private |
|
protectedvirtualinherited |
|
inlineinherited |
|
overridevirtual |
Update when the user last read a message in the chat room.
| [in] | lastReadAt | The time the user last read a message. |
| [in] | callback | Callback when API call returns, receives an error code and the new room info. |
Implements ttv::chat::IChatRoom.
|
inlineinherited |
|
overridevirtual |
Update the minimum role required to join the chat room.
| [in] | minimumAllowedRole | The new minimum required role for the room. |
| [in] | callback | Callback when API call returns, receives an error code and the new room info. |
Implements ttv::chat::IChatRoom.
|
overridevirtual |
Update if the user has muted the chat room.
| [in] | isMuted | Whether the user has muted the room. |
| [in] | callback | Callback when API call returns, receives an error code and the new room info. |
Implements ttv::chat::IChatRoom.
|
overridevirtual |
Update whether the chat room is previewable to non-joined users.
| [in] | isPreviewable | Whether the chat room will be previewable. |
| [in] | callback | Callback when API call returns, receives an error code and the new room info. |
Implements ttv::chat::IChatRoom.
|
overridevirtual |
Update the name of the chat room.
| [in] | name | The new name of the room. |
| [in] | callback | Callback when API call returns, receives an error code and the new room info. |
Implements ttv::chat::IChatRoom.
|
protectedvirtualinherited |
|
protectedvirtualinherited |
|
virtualinherited |
Reimplemented in ttv::broadcast::Streamer, and ttv::social::FriendList.
|
inline |
|
overridevirtual |
Update the topic of the chat room.
| [in] | name | The new topic of the room. |
| [in] | callback | Callback when API call returns, receives an error code and the new room info. |
Implements ttv::chat::IChatRoom.
|
overridevirtualinherited |
Reimplemented from ttv::Component.
Reimplemented in ttv::chat::BitsStatus, and ttv::chat::UserEmoticonSets.
|
protectedinherited |
|
protectedvirtualinherited |
|
private |
|
overridevirtual |
Reimplemented from ttv::Component.
|
private |
Cache the user's badges received from the last API callback to use for the next placeholder message's badges.
|
private |
Cache the user's chat color received from the last API callback to use for the next placeholder message's chat color.
|
private |
|
protectedinherited |
|
protectedinherited |
|
private |
Keeps track of sent message nonces to prevent duplicates from pubsub.
|
protectedinherited |
Whether or not the internal updates of the component are on hold because of an issue with the OAuth token.
|
protectedinherited |
|
private |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
private |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
mutableprotectedinherited |
|
protectedinherited |
|
private |
|
protectedinherited |
1.8.13