Twitch SDK (Internal)
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ttv::chat::ChatChannel Class Reference

#include <chatchannel.h>

Inheritance diagram for ttv::chat::ChatChannel:
ttv::chat::ChatConnection::Listener

Classes

struct  State
 

Public Types

using FetchUserListCallback = std::function< void(TTV_ErrorCode ec, UserList &&userList)>
 
using SetBroadcasterLanguageChatCallback = std::function< void(TTV_ErrorCode ec)>
 
using LookupId = uint64_t
 

Public Member Functions

 ChatChannel (const std::shared_ptr< User > &user, ChannelId channelId, std::shared_ptr< IChatChannelListener > chatCallbacks, std::shared_ptr< TaskRunner > taskRunner)
 
virtual ~ChatChannel ()
 
void SetTokenizationOptions (const TokenizationOptions &options)
 
void SetChannelRepository (const std::shared_ptr< ChannelRepository > &channelRepository)
 
void SetBitsConfigRepository (const std::shared_ptr< BitsConfigRepository > &repository)
 
void SetChatObjectFactory (std::shared_ptr< IChatObjectFactory > factory)
 
void SetSettingRepository (std::shared_ptr< SettingRepository > settings)
 
TTV_ErrorCode Connect ()
 
TTV_ErrorCode Disconnect ()
 
TTV_ErrorCode FlushClientEvents ()
 
bool IsShutdown () const
 
TTV_ErrorCode SendChatMessage (const std::string &message)
 
TTV_ErrorCode FetchUserList (const FetchUserListCallback &callback)
 
TTV_ErrorCode SetBroadcasterLanguageChatEnabled (bool enabled, const SetBroadcasterLanguageChatCallback &callback)
 
TTV_ErrorCode OptInToBroadcasterLanguageChat (const std::string &language)
 
TTV_ErrorCode SetLocalLanguage (const std::string &language)
 
UserId GetChannelId () const
 
void SetMessageFlushInterval (uint64_t milliseconds)
 
uint64_t GetMessageFlushInterval () const
 
ChatChannelState GetState () const
 
std::shared_ptr< IChatChannelListenerGetChannelListener ()
 
std::shared_ptr< UserGetUser ()
 
virtual void OnConnected (ChatConnection *source) override
 
virtual void OnConnectionFailed (ChatConnection *source, TTV_ErrorCode ec) override
 
virtual void OnConnectionLost (ChatConnection *source, TTV_ErrorCode ec) override
 
virtual void OnCleared (ChatConnection *source, const std::string &username, const std::map< std::string, std::string > &messageTags) override
 
virtual void OnPrivateMessageReceived (ChatConnection *source, const std::string &username, const std::string &message, const std::map< std::string, std::string > &messageTags, bool action) override
 
virtual void OnUserNoticeReceived (ChatConnection *source, const std::string &message, const std::map< std::string, std::string > &messageTags) override
 
virtual void OnUserStateChanged (ChatConnection *source, const std::map< std::string, std::string > &messageTags) override
 
virtual void OnChatRestrictionsChanged (ChatConnection *source, const ChatChannelRestrictions &restrictions) override
 
virtual void OnPermanentBanChanged (ChatConnection *source, bool banned) override
 
virtual void OnTemporaryBanChanged (ChatConnection *source, bool temporarilyBanned, uint32_t timeout) override
 
virtual void OnBadgesChanged (ChatConnection *source, const std::string &username, const std::string &badgesMessageTag) override
 
virtual void OnHostTargetChanged (ChatConnection *source, const std::string &targetChannel, uint32_t numViewers) override
 
virtual void OnNoticeReceived (ChatConnection *source, const std::string &id, const std::map< std::string, std::string > &params) override
 
virtual void OnIgnoreChanged (ChatConnection *source, const std::string &blockUserName, bool ignore) override
 

Private Types

using ThreadEvent = std::function< void()>
 

Private Member Functions

void FlushUserMessages (bool force)
 
void ForceShutdown ()
 
TTV_ErrorCode ProcessClientRequestQueue ()
 
TTV_ErrorCode ProcessClientChatMessage (const std::string &msg)
 
TTV_ErrorCode FetchChannelInfo ()
 
TTV_ErrorCode FetchChatProperties ()
 
TTV_ErrorCode FetchBitsConfiguration ()
 
TTV_ErrorCode ProcessDisconnectRequest ()
 
TTV_ErrorCode ProcessOptInToBroadcasterLanguageChatRequest (const std::string &language)
 
TTV_ErrorCode ProcessSetLocalLanguageRequest (const std::string &language)
 
TTV_ErrorCode ProcessChannelInfoFetchResult (const ChannelInfo &channelInfo)
 
TTV_ErrorCode ProcessChatPropertyFetchResult (TTV_ErrorCode ec, std::shared_ptr< ChatPropertiesTask::Result > result)
 
TTV_ErrorCode ProcessBitsConfigFetchResult (TTV_ErrorCode ec, const std::shared_ptr< BitsConfiguration > &config)
 
void SetClientChannelInfo (const ChatChannelInfo &channelInfo)
 
void SetClientChatRestrictions (const ChatChannelRestrictions &restrictions)
 
void HandleMessageReceived (const std::string &username, const std::string &message, const std::map< std::string, std::string > &messageTags, const MessageInfo::Flags &flags)
 
void HandleUserNotice (const std::string &message, const std::map< std::string, std::string > &messageTags)
 
void HandleSubscriptionNotice (SubscriptionNotice::Type type, const std::string &message, const std::map< std::string, std::string > &messageTags)
 
void HandleFirstTimeChatterNotice (const std::string &message, const std::map< std::string, std::string > &messageTags)
 
void HandleRaidNotice (const std::string &message, const std::map< std::string, std::string > &messageTags)
 
void HandleUnraidNotice (const std::string &message, const std::map< std::string, std::string > &messageTags)
 
void GenerateUserInfo (const std::string &username, const std::map< std::string, std::string > &messageTags, ChatUserInfo &userInfo)
 
void GenerateMessage (MessageInfo &msg, const TokenizationOptions &tokenizationOptions, const ChatUserInfo &userInfo, const std::string &message, const std::map< std::string, std::string > &messageTags, const MessageInfo::Flags &flags)
 
void GenerateLiveMessage (LiveChatMessage &msg, const TokenizationOptions &tokenizationOptions, const ChatUserInfo &userInfo, const std::string &message, const std::map< std::string, std::string > &messageTags, const MessageInfo::Flags &flags)
 
void ThreadProc ()
 
void CompleteShutdown ()
 
bool UpdateRestriction ()
 
void UpdateBroadcasterLanguageChatState ()
 
TTV_ErrorCode AttemptConnection ()
 
void CloseConnection ()
 
void SetState (State::Enum state)
 
void HandleConnectionIssue (bool recoverableError)
 

Private Attributes

std::string mBroadcasterName
 
std::shared_ptr< IChatChannelListenermChatCallbacks
 Client-configured callbacks for chat notifications for this channel. More...
 
std::shared_ptr< ChatPropertiesTask::ResultmChatProperties
 The chat properties for the channel. More...
 
std::vector< std::string > mHosts
 The hosts to use to connect to the channel. More...
 
std::shared_ptr< IChatObjectFactorymChatObjectFactory
 The internal chat object factory. More...
 
std::shared_ptr< IThreadmChatThread
 The thread managing the socket. More...
 
std::shared_ptr< ChatConnectionmChatConnection
 The active connection. More...
 
std::shared_ptr< ChannelRepositorymChannelRepository
 
std::shared_ptr< SettingRepositorymSettingRepository
 
std::shared_ptr< BitsConfigRepositorymBitsConfigRepository
 
std::shared_ptr< TaskRunnermTaskRunner
 
std::shared_ptr< TaskRunnermBackgroundTaskRunner
 
WaitForExpiry mFetchChatPropertiesTimer
 The timer to use for fetching chat properties. More...
 
WaitForExpiry mFetchBitsConfigTimer
 The timer to use for fetching the channel's bit configuration. More...
 
RetryTimer mConnectionRetryTimer
 The master timer to use for connection retries. More...
 
int mNextChatHostIndex
 The next chat host to connect to. More...
 
ConcurrentQueue< ThreadEventmToMainQ
 The queue for messages from the chat thread to main thread. More...
 
ConcurrentQueue< ThreadEventmToChatQ
 The queue for messages from the main thread to chat thread. More...
 
std::vector< LiveChatMessagemUserMessageBatch
 A batch of messages to be sent together to the client instead of one at a time (for performance). More...
 
uint64_t mUserMessageFlushInterval
 The max amount of time between user message flushes to the main thread. More...
 
WaitForExpiry mNextUserMessageFlush
 The next time in which to automatically flush all user messages to the main thread. More...
 
ChatMessagePacer mMessagePacer
 Prevents the local user from sending too many messages too close together in time and getting banned. More...
 
WaitForExpiry mSlowModeTimer
 When the channel is in slow mode this will mark the time when the next message is allowed. More...
 
WaitForExpiry mTimeoutTimer
 When the user has been banned for a temporary amount of time this will mark the time when the next message is allowed. More...
 
TTV_ErrorCode mConnectionError
 
State::Enum mChannelState
 The current state, accessed only through the chat thread. More...
 
ChatChannelState mReportedClientState
 The last reported state. More...
 
ChatUserInfo mSystemUserInfo
 The display information for messages from JTV or TwitchNotify. More...
 
ChatUserInfo mClientLocalUserInfo
 The info for the local user on the client thread. More...
 
ChatUserInfo mServerLocalUserInfo
 The info for the local user on the chat thread. More...
 
ChatChannelInfo mClientChannelInfo
 The current channel information as the client sees it. More...
 
ChatChannelInfo mServerChannelInfo
 The current channel information on the chat thread. More...
 
ChatChannelRestrictions mClientChatRestrictions
 The chat restrictions that are active for the channel as the client sees it. More...
 
ChatChannelRestrictions mServerChatRestrictions
 The chat restrictions that are active for the channel on the chat thread. More...
 
std::weak_ptr< UsermUser
 
std::vector< std::string > mQueuedChatMessages
 

The local user connecting to the channel.

More...
 
std::shared_ptr< BitsConfigurationmBitsConfiguration
 
std::string mLocalLanguage
 The language used by the local user. More...
 
TokenizationOptions mTokenizationOptions
 Marks what to tokenize in a message. More...
 
LookupId mBitsConfigFetchToken
 The cancellation token for fetching the BitsConfiguration. More...
 
ChannelId mChannelId
 The ID of the channel. More...
 
std::atomic< uint32_t > mNumOutstandingTasks
 
bool mApplySlowMode
 
bool mAnonymous
 Whether or not connecting anonymously to the channel. More...
 
bool mDisconnectionRequested
 Whether or not the request to disconnect has been satisfied (callback fired to client). More...
 
bool mBroadcasterLanguageMatch
 Whether or not the local language matches the active native chat language. More...
 
bool mBroadcasterLanguageOptedIn
 Whether or not the user opted in to native language chat. More...
 

Detailed Description

Provides the functionality for accessing a chat channel.

Member Typedef Documentation

◆ FetchUserListCallback

using ttv::chat::ChatChannel::FetchUserListCallback = std::function<void(TTV_ErrorCode ec, UserList&& userList)>

◆ LookupId

◆ SetBroadcasterLanguageChatCallback

◆ ThreadEvent

using ttv::chat::ChatChannel::ThreadEvent = std::function<void()>
private

Constructor & Destructor Documentation

◆ ChatChannel()

ttv::chat::ChatChannel::ChatChannel ( const std::shared_ptr< User > &  user,
ChannelId  channelId,
std::shared_ptr< IChatChannelListener chatCallbacks,
std::shared_ptr< TaskRunner taskRunner 
)

◆ ~ChatChannel()

virtual ttv::chat::ChatChannel::~ChatChannel ( )
virtual

Member Function Documentation

◆ AttemptConnection()

TTV_ErrorCode ttv::chat::ChatChannel::AttemptConnection ( )
private

◆ CloseConnection()

void ttv::chat::ChatChannel::CloseConnection ( )
private

◆ CompleteShutdown()

void ttv::chat::ChatChannel::CompleteShutdown ( )
private

Free the resources used by the chat thread.

◆ Connect()

TTV_ErrorCode ttv::chat::ChatChannel::Connect ( )

Connect to the channel.

◆ Disconnect()

TTV_ErrorCode ttv::chat::ChatChannel::Disconnect ( )

Disconnect from the channel.

◆ FetchBitsConfiguration()

TTV_ErrorCode ttv::chat::ChatChannel::FetchBitsConfiguration ( )
private

◆ FetchChannelInfo()

TTV_ErrorCode ttv::chat::ChatChannel::FetchChannelInfo ( )
private

◆ FetchChatProperties()

TTV_ErrorCode ttv::chat::ChatChannel::FetchChatProperties ( )
private

◆ FetchUserList()

TTV_ErrorCode ttv::chat::ChatChannel::FetchUserList ( const FetchUserListCallback callback)

◆ FlushClientEvents()

TTV_ErrorCode ttv::chat::ChatChannel::FlushClientEvents ( )

Flushes events to the main thread for the game to process. This should only be called on the main thread.

◆ FlushUserMessages()

void ttv::chat::ChatChannel::FlushUserMessages ( bool  force)
private

◆ ForceShutdown()

void ttv::chat::ChatChannel::ForceShutdown ( )
private

This waits for the chat thread to close and blocks until it is safe to free the Channel instance.

◆ GenerateLiveMessage()

void ttv::chat::ChatChannel::GenerateLiveMessage ( LiveChatMessage msg,
const TokenizationOptions tokenizationOptions,
const ChatUserInfo userInfo,
const std::string &  message,
const std::map< std::string, std::string > &  messageTags,
const MessageInfo::Flags flags 
)
private

◆ GenerateMessage()

void ttv::chat::ChatChannel::GenerateMessage ( MessageInfo msg,
const TokenizationOptions tokenizationOptions,
const ChatUserInfo userInfo,
const std::string &  message,
const std::map< std::string, std::string > &  messageTags,
const MessageInfo::Flags flags 
)
private

◆ GenerateUserInfo()

void ttv::chat::ChatChannel::GenerateUserInfo ( const std::string &  username,
const std::map< std::string, std::string > &  messageTags,
ChatUserInfo userInfo 
)
private

◆ GetChannelId()

UserId ttv::chat::ChatChannel::GetChannelId ( ) const
inline

Retrieves the channel ID.

◆ GetChannelListener()

std::shared_ptr<IChatChannelListener> ttv::chat::ChatChannel::GetChannelListener ( )
inline

◆ GetMessageFlushInterval()

uint64_t ttv::chat::ChatChannel::GetMessageFlushInterval ( ) const
inline

◆ GetState()

ChatChannelState ttv::chat::ChatChannel::GetState ( ) const
inline

◆ GetUser()

std::shared_ptr<User> ttv::chat::ChatChannel::GetUser ( )
inline

◆ HandleConnectionIssue()

void ttv::chat::ChatChannel::HandleConnectionIssue ( bool  recoverableError)
private

◆ HandleFirstTimeChatterNotice()

void ttv::chat::ChatChannel::HandleFirstTimeChatterNotice ( const std::string &  message,
const std::map< std::string, std::string > &  messageTags 
)
private

◆ HandleMessageReceived()

void ttv::chat::ChatChannel::HandleMessageReceived ( const std::string &  username,
const std::string &  message,
const std::map< std::string, std::string > &  messageTags,
const MessageInfo::Flags flags 
)
private

◆ HandleRaidNotice()

void ttv::chat::ChatChannel::HandleRaidNotice ( const std::string &  message,
const std::map< std::string, std::string > &  messageTags 
)
private

◆ HandleSubscriptionNotice()

void ttv::chat::ChatChannel::HandleSubscriptionNotice ( SubscriptionNotice::Type  type,
const std::string &  message,
const std::map< std::string, std::string > &  messageTags 
)
private

◆ HandleUnraidNotice()

void ttv::chat::ChatChannel::HandleUnraidNotice ( const std::string &  message,
const std::map< std::string, std::string > &  messageTags 
)
private

◆ HandleUserNotice()

void ttv::chat::ChatChannel::HandleUserNotice ( const std::string &  message,
const std::map< std::string, std::string > &  messageTags 
)
private

◆ IsShutdown()

bool ttv::chat::ChatChannel::IsShutdown ( ) const
inline

Determines whether the channel is disconnected and ready to be destroyed.

◆ OnBadgesChanged()

virtual void ttv::chat::ChatChannel::OnBadgesChanged ( ChatConnection source,
const std::string &  username,
const std::string &  badgesMessageTag 
)
overridevirtual

◆ OnChatRestrictionsChanged()

virtual void ttv::chat::ChatChannel::OnChatRestrictionsChanged ( ChatConnection source,
const ChatChannelRestrictions restrictions 
)
overridevirtual

◆ OnCleared()

virtual void ttv::chat::ChatChannel::OnCleared ( ChatConnection source,
const std::string &  username,
const std::map< std::string, std::string > &  messageTags 
)
overridevirtual

◆ OnConnected()

virtual void ttv::chat::ChatChannel::OnConnected ( ChatConnection source)
overridevirtual

◆ OnConnectionFailed()

virtual void ttv::chat::ChatChannel::OnConnectionFailed ( ChatConnection source,
TTV_ErrorCode  ec 
)
overridevirtual

◆ OnConnectionLost()

virtual void ttv::chat::ChatChannel::OnConnectionLost ( ChatConnection source,
TTV_ErrorCode  ec 
)
overridevirtual

◆ OnHostTargetChanged()

virtual void ttv::chat::ChatChannel::OnHostTargetChanged ( ChatConnection source,
const std::string &  targetChannel,
uint32_t  numViewers 
)
overridevirtual

◆ OnIgnoreChanged()

virtual void ttv::chat::ChatChannel::OnIgnoreChanged ( ChatConnection source,
const std::string &  blockUserName,
bool  ignore 
)
overridevirtual

◆ OnNoticeReceived()

virtual void ttv::chat::ChatChannel::OnNoticeReceived ( ChatConnection source,
const std::string &  id,
const std::map< std::string, std::string > &  params 
)
overridevirtual

◆ OnPermanentBanChanged()

virtual void ttv::chat::ChatChannel::OnPermanentBanChanged ( ChatConnection source,
bool  banned 
)
overridevirtual

◆ OnPrivateMessageReceived()

virtual void ttv::chat::ChatChannel::OnPrivateMessageReceived ( ChatConnection source,
const std::string &  username,
const std::string &  message,
const std::map< std::string, std::string > &  messageTags,
bool  action 
)
overridevirtual

◆ OnTemporaryBanChanged()

virtual void ttv::chat::ChatChannel::OnTemporaryBanChanged ( ChatConnection source,
bool  temporarilyBanned,
uint32_t  timeout 
)
overridevirtual

◆ OnUserNoticeReceived()

virtual void ttv::chat::ChatChannel::OnUserNoticeReceived ( ChatConnection source,
const std::string &  message,
const std::map< std::string, std::string > &  messageTags 
)
overridevirtual

◆ OnUserStateChanged()

virtual void ttv::chat::ChatChannel::OnUserStateChanged ( ChatConnection source,
const std::map< std::string, std::string > &  messageTags 
)
overridevirtual

◆ OptInToBroadcasterLanguageChat()

TTV_ErrorCode ttv::chat::ChatChannel::OptInToBroadcasterLanguageChat ( const std::string &  language)

◆ ProcessBitsConfigFetchResult()

TTV_ErrorCode ttv::chat::ChatChannel::ProcessBitsConfigFetchResult ( TTV_ErrorCode  ec,
const std::shared_ptr< BitsConfiguration > &  config 
)
private

◆ ProcessChannelInfoFetchResult()

TTV_ErrorCode ttv::chat::ChatChannel::ProcessChannelInfoFetchResult ( const ChannelInfo channelInfo)
private

◆ ProcessChatPropertyFetchResult()

TTV_ErrorCode ttv::chat::ChatChannel::ProcessChatPropertyFetchResult ( TTV_ErrorCode  ec,
std::shared_ptr< ChatPropertiesTask::Result result 
)
private

◆ ProcessClientChatMessage()

TTV_ErrorCode ttv::chat::ChatChannel::ProcessClientChatMessage ( const std::string &  msg)
private

◆ ProcessClientRequestQueue()

TTV_ErrorCode ttv::chat::ChatChannel::ProcessClientRequestQueue ( )
private

Handle requests from the main thread in the chat thread. This will create internal events and may initiate messages to the chat server. This should only be called on the chat thread.

◆ ProcessDisconnectRequest()

TTV_ErrorCode ttv::chat::ChatChannel::ProcessDisconnectRequest ( )
private

◆ ProcessOptInToBroadcasterLanguageChatRequest()

TTV_ErrorCode ttv::chat::ChatChannel::ProcessOptInToBroadcasterLanguageChatRequest ( const std::string &  language)
private

◆ ProcessSetLocalLanguageRequest()

TTV_ErrorCode ttv::chat::ChatChannel::ProcessSetLocalLanguageRequest ( const std::string &  language)
private

◆ SendChatMessage()

TTV_ErrorCode ttv::chat::ChatChannel::SendChatMessage ( const std::string &  message)

Sends a message from the current user.

◆ SetBitsConfigRepository()

void ttv::chat::ChatChannel::SetBitsConfigRepository ( const std::shared_ptr< BitsConfigRepository > &  repository)
inline

◆ SetBroadcasterLanguageChatEnabled()

TTV_ErrorCode ttv::chat::ChatChannel::SetBroadcasterLanguageChatEnabled ( bool  enabled,
const SetBroadcasterLanguageChatCallback callback 
)

◆ SetChannelRepository()

void ttv::chat::ChatChannel::SetChannelRepository ( const std::shared_ptr< ChannelRepository > &  channelRepository)
inline

◆ SetChatObjectFactory()

void ttv::chat::ChatChannel::SetChatObjectFactory ( std::shared_ptr< IChatObjectFactory factory)

Sets the factory for creating custom implementation of chat components.

◆ SetClientChannelInfo()

void ttv::chat::ChatChannel::SetClientChannelInfo ( const ChatChannelInfo channelInfo)
private

◆ SetClientChatRestrictions()

void ttv::chat::ChatChannel::SetClientChatRestrictions ( const ChatChannelRestrictions restrictions)
private

◆ SetLocalLanguage()

TTV_ErrorCode ttv::chat::ChatChannel::SetLocalLanguage ( const std::string &  language)

◆ SetMessageFlushInterval()

void ttv::chat::ChatChannel::SetMessageFlushInterval ( uint64_t  milliseconds)
inline

◆ SetSettingRepository()

void ttv::chat::ChatChannel::SetSettingRepository ( std::shared_ptr< SettingRepository settings)

◆ SetState()

void ttv::chat::ChatChannel::SetState ( State::Enum  state)
private

◆ SetTokenizationOptions()

void ttv::chat::ChatChannel::SetTokenizationOptions ( const TokenizationOptions options)
inline

◆ ThreadProc()

void ttv::chat::ChatChannel::ThreadProc ( )
private

The thread which listens for incoming messages from the chat server.

◆ UpdateBroadcasterLanguageChatState()

void ttv::chat::ChatChannel::UpdateBroadcasterLanguageChatState ( )
private

◆ UpdateRestriction()

bool ttv::chat::ChatChannel::UpdateRestriction ( )
private

Member Data Documentation

◆ mAnonymous

bool ttv::chat::ChatChannel::mAnonymous
private

Whether or not connecting anonymously to the channel.

◆ mApplySlowMode

bool ttv::chat::ChatChannel::mApplySlowMode
private

◆ mBackgroundTaskRunner

std::shared_ptr<TaskRunner> ttv::chat::ChatChannel::mBackgroundTaskRunner
private

◆ mBitsConfigFetchToken

LookupId ttv::chat::ChatChannel::mBitsConfigFetchToken
private

The cancellation token for fetching the BitsConfiguration.

◆ mBitsConfigRepository

std::shared_ptr<BitsConfigRepository> ttv::chat::ChatChannel::mBitsConfigRepository
private

◆ mBitsConfiguration

std::shared_ptr<BitsConfiguration> ttv::chat::ChatChannel::mBitsConfiguration
private

◆ mBroadcasterLanguageMatch

bool ttv::chat::ChatChannel::mBroadcasterLanguageMatch
private

Whether or not the local language matches the active native chat language.

◆ mBroadcasterLanguageOptedIn

bool ttv::chat::ChatChannel::mBroadcasterLanguageOptedIn
private

Whether or not the user opted in to native language chat.

◆ mBroadcasterName

std::string ttv::chat::ChatChannel::mBroadcasterName
private

◆ mChannelId

ChannelId ttv::chat::ChatChannel::mChannelId
private

The ID of the channel.

◆ mChannelRepository

std::shared_ptr<ChannelRepository> ttv::chat::ChatChannel::mChannelRepository
private

◆ mChannelState

State::Enum ttv::chat::ChatChannel::mChannelState
private

The current state, accessed only through the chat thread.

◆ mChatCallbacks

std::shared_ptr<IChatChannelListener> ttv::chat::ChatChannel::mChatCallbacks
private

Client-configured callbacks for chat notifications for this channel.

◆ mChatConnection

std::shared_ptr<ChatConnection> ttv::chat::ChatChannel::mChatConnection
private

The active connection.

◆ mChatObjectFactory

std::shared_ptr<IChatObjectFactory> ttv::chat::ChatChannel::mChatObjectFactory
private

The internal chat object factory.

◆ mChatProperties

std::shared_ptr<ChatPropertiesTask::Result> ttv::chat::ChatChannel::mChatProperties
private

The chat properties for the channel.

◆ mChatThread

std::shared_ptr<IThread> ttv::chat::ChatChannel::mChatThread
private

The thread managing the socket.

◆ mClientChannelInfo

ChatChannelInfo ttv::chat::ChatChannel::mClientChannelInfo
private

The current channel information as the client sees it.

◆ mClientChatRestrictions

ChatChannelRestrictions ttv::chat::ChatChannel::mClientChatRestrictions
private

The chat restrictions that are active for the channel as the client sees it.

◆ mClientLocalUserInfo

ChatUserInfo ttv::chat::ChatChannel::mClientLocalUserInfo
private

The info for the local user on the client thread.

◆ mConnectionError

TTV_ErrorCode ttv::chat::ChatChannel::mConnectionError
private

◆ mConnectionRetryTimer

RetryTimer ttv::chat::ChatChannel::mConnectionRetryTimer
private

The master timer to use for connection retries.

◆ mDisconnectionRequested

bool ttv::chat::ChatChannel::mDisconnectionRequested
private

Whether or not the request to disconnect has been satisfied (callback fired to client).

◆ mFetchBitsConfigTimer

WaitForExpiry ttv::chat::ChatChannel::mFetchBitsConfigTimer
private

The timer to use for fetching the channel's bit configuration.

◆ mFetchChatPropertiesTimer

WaitForExpiry ttv::chat::ChatChannel::mFetchChatPropertiesTimer
private

The timer to use for fetching chat properties.

◆ mHosts

std::vector<std::string> ttv::chat::ChatChannel::mHosts
private

The hosts to use to connect to the channel.

◆ mLocalLanguage

std::string ttv::chat::ChatChannel::mLocalLanguage
private

The language used by the local user.

◆ mMessagePacer

ChatMessagePacer ttv::chat::ChatChannel::mMessagePacer
private

Prevents the local user from sending too many messages too close together in time and getting banned.

◆ mNextChatHostIndex

int ttv::chat::ChatChannel::mNextChatHostIndex
private

The next chat host to connect to.

◆ mNextUserMessageFlush

WaitForExpiry ttv::chat::ChatChannel::mNextUserMessageFlush
private

The next time in which to automatically flush all user messages to the main thread.

◆ mNumOutstandingTasks

std::atomic<uint32_t> ttv::chat::ChatChannel::mNumOutstandingTasks
private

◆ mQueuedChatMessages

std::vector< std::string > ttv::chat::ChatChannel::mQueuedChatMessages
private

The local user connecting to the channel.

◆ mReportedClientState

ChatChannelState ttv::chat::ChatChannel::mReportedClientState
private

The last reported state.

◆ mServerChannelInfo

ChatChannelInfo ttv::chat::ChatChannel::mServerChannelInfo
private

The current channel information on the chat thread.

◆ mServerChatRestrictions

ChatChannelRestrictions ttv::chat::ChatChannel::mServerChatRestrictions
private

The chat restrictions that are active for the channel on the chat thread.

◆ mServerLocalUserInfo

ChatUserInfo ttv::chat::ChatChannel::mServerLocalUserInfo
private

The info for the local user on the chat thread.

◆ mSettingRepository

std::shared_ptr<SettingRepository> ttv::chat::ChatChannel::mSettingRepository
private

◆ mSlowModeTimer

WaitForExpiry ttv::chat::ChatChannel::mSlowModeTimer
private

When the channel is in slow mode this will mark the time when the next message is allowed.

◆ mSystemUserInfo

ChatUserInfo ttv::chat::ChatChannel::mSystemUserInfo
private

The display information for messages from JTV or TwitchNotify.

◆ mTaskRunner

std::shared_ptr<TaskRunner> ttv::chat::ChatChannel::mTaskRunner
private

◆ mTimeoutTimer

WaitForExpiry ttv::chat::ChatChannel::mTimeoutTimer
private

When the user has been banned for a temporary amount of time this will mark the time when the next message is allowed.

◆ mToChatQ

ConcurrentQueue<ThreadEvent> ttv::chat::ChatChannel::mToChatQ
private

The queue for messages from the main thread to chat thread.

◆ mTokenizationOptions

TokenizationOptions ttv::chat::ChatChannel::mTokenizationOptions
private

Marks what to tokenize in a message.

◆ mToMainQ

ConcurrentQueue<ThreadEvent> ttv::chat::ChatChannel::mToMainQ
private

The queue for messages from the chat thread to main thread.

◆ mUser

std::weak_ptr<User> ttv::chat::ChatChannel::mUser
private

◆ mUserMessageBatch

std::vector<LiveChatMessage> ttv::chat::ChatChannel::mUserMessageBatch
private

A batch of messages to be sent together to the client instead of one at a time (for performance).

◆ mUserMessageFlushInterval

uint64_t ttv::chat::ChatChannel::mUserMessageFlushInterval
private

The max amount of time between user message flushes to the main thread.


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