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

#include <chatchannelset.h>

Inheritance diagram for ttv::chat::ChatChannelSet:
ttv::UserComponent ttv::Component ttv::IComponent

Classes

struct  ChannelEntry
 
class  InternalChannelListener
 

Public Types

using FetchUserListCallback = std::function< void(TTV_ErrorCode ec, UserList &&userList)>
 
using SetBroadcasterLanguageChatCallback = std::function< void(TTV_ErrorCode ec)>
 
enum  State { State::Uninitialized, State::Initialized, State::ShuttingDown, State::Inert }
 

Public Member Functions

 ChatChannelSet (const std::shared_ptr< User > &user)
 
virtual ~ChatChannelSet () override
 
void SetTokenizationOptions (const TokenizationOptions &tokenizationOptions)
 
void SetChatObjectFactory (std::shared_ptr< IChatObjectFactory > factory)
 
void SetSettingRepository (std::shared_ptr< SettingRepository > settings)
 
void SetChannelRepository (const std::shared_ptr< ChannelRepository > &channelRepository)
 
void SetBitsConfigRepository (std::shared_ptr< BitsConfigRepository > repository)
 
virtual void Update () override
 
virtual TTV_ErrorCode Shutdown () override
 
TTV_ErrorCode Connect (ChannelId channelId, const std::shared_ptr< IChatChannelListener > &listener)
 
TTV_ErrorCode Disconnect (ChannelId channelId)
 
TTV_ErrorCode SendChatMessage (ChannelId channelId, const std::string &message)
 
TTV_ErrorCode FetchUserList (ChannelId channelId, const FetchUserListCallback &callback)
 
TTV_ErrorCode SetBroadcasterLanguageChatEnabled (ChannelId channelId, bool enabled, const SetBroadcasterLanguageChatCallback &callback)
 
TTV_ErrorCode OptInToBroadcasterLanguageChat (ChannelId channelId, const std::string &language)
 
TTV_ErrorCode SetLocalLanguage (const std::string &language)
 
void SetMessageFlushInterval (uint64_t milliseconds)
 
uint64_t GetMessageFlushInterval () const
 
virtual std::string GetLoggerName () const override
 
virtual TTV_ErrorCode Initialize () override
 
virtual void SetTaskRunner (std::shared_ptr< TaskRunner > taskRunner)
 
std::shared_ptr< TaskRunnerGetTaskRunner ()
 
virtual State GetState () const override
 

Static Public Member Functions

static std::string GetComponentName ()
 

Protected Member Functions

virtual bool CheckShutdown () override
 
virtual void CompleteShutdown () override
 
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::weak_ptr< UsermUser
 
bool mOAuthIssue
 Whether or not the internal updates of the component are on hold because of an issue with the OAuth token. More...
 
ClientServerValue< StatemState
 
std::shared_ptr< TaskRunnermTaskRunner
 
std::vector< std::shared_ptr< Task > > mRunningTasks
 
std::mutex mTaskMutex
 
uint64_t mShutdownTimeMilliseconds
 

Private Member Functions

void ChatChannelStateChanged (UserId userId, ChannelId channelId, ChatChannelState state, TTV_ErrorCode ec)
 
void ChatChannelInfoChanged (UserId userId, ChannelId channelId, const ChatChannelInfo &channelInfo)
 
void ChatChannelRestrictionsChanged (UserId userId, ChannelId channelId, const ChatChannelRestrictions &restrictions)
 
void ChatChannelLocalUserChanged (UserId userId, ChannelId channelId, const ChatUserInfo &userInfo)
 
void ChatChannelMessagesReceived (UserId userId, ChannelId channelId, const std::vector< LiveChatMessage > &messageList)
 
void ChatChannelSubscriptionNoticeReceived (UserId userId, ChannelId channelId, const SubscriptionNotice &notice)
 
void ChatChannelFirstTimeChatterNoticeReceived (UserId userId, ChannelId channelId, const FirstTimeChatterNotice &notice)
 
void ChatChannelRaidNoticeReceived (UserId userId, ChannelId channelId, const RaidNotice &notice)
 
void ChatChannelUnraidNoticeReceived (UserId userId, ChannelId channelId, const UnraidNotice &notice)
 
void ChatChannelMessagesCleared (UserId userId, ChannelId channelId)
 
void ChatChannelUserMessagesCleared (UserId userId, ChannelId channelId, UserId clearUserId)
 
void ChatChannelHostTargetChanged (UserId userId, ChannelId channelId, const std::string &targetChannelName, uint32_t numViewers)
 
void ChatChannelNoticeReceived (UserId userId, ChannelId channelId, const std::string &id, const std::map< std::string, std::string > &params)
 
TTV_ErrorCode LookupChannel (ChannelId channelId, std::shared_ptr< ChatChannel > &channel)
 
TTV_ErrorCode FlushChannelEvents ()
 
std::shared_ptr< ChannelEntryCreateChannel (ChannelId channelId)
 

Private Attributes

std::shared_ptr< IChatObjectFactorymChatObjectFactory
 
std::shared_ptr< IChatChannelListenermInternalChannelListener
 

The internal chat object factory.

More...
 
std::shared_ptr< SettingRepositorymSettingRepository
 

The listener for channel events.

More...
 
std::shared_ptr< ChannelRepositorymChannelRepository
 
std::shared_ptr< BitsConfigRepositorymBitsConfigRepository
 
std::map< ChannelId, std::shared_ptr< ChannelEntry > > mChannels
 The mapping of lower case channel name to channel. More...
 
std::vector< std::shared_ptr< ChannelEntry > > mCleanupChannels
 The channels that should be released after all events have been flushed. More...
 
std::string mLocalLanguage
 The local user's language. More...
 
TokenizationOptions mTokenizationOptions
 
uint64_t mUserMessageFlushInterval
 The max amount of time between user message flushes to the main thread. More...
 

Class Documentation

◆ ttv::chat::ChatChannelSet::ChannelEntry

struct ttv::chat::ChatChannelSet::ChannelEntry
Class Members
shared_ptr< ChatChannel > channel
shared_ptr< IChatChannelListener > channelListener

Member Typedef Documentation

◆ FetchUserListCallback

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

◆ SetBroadcasterLanguageChatCallback

Member Enumeration Documentation

◆ State

enum ttv::IComponent::State
stronginherited
Enumerator
Uninitialized 
Initialized 
ShuttingDown 
Inert 

The component doesn't require shutting down.

Constructor & Destructor Documentation

◆ ChatChannelSet()

ttv::chat::ChatChannelSet::ChatChannelSet ( const std::shared_ptr< User > &  user)

◆ ~ChatChannelSet()

virtual ttv::chat::ChatChannelSet::~ChatChannelSet ( )
overridevirtual

Member Function Documentation

◆ ChatChannelFirstTimeChatterNoticeReceived()

void ttv::chat::ChatChannelSet::ChatChannelFirstTimeChatterNoticeReceived ( UserId  userId,
ChannelId  channelId,
const FirstTimeChatterNotice notice 
)
private

◆ ChatChannelHostTargetChanged()

void ttv::chat::ChatChannelSet::ChatChannelHostTargetChanged ( UserId  userId,
ChannelId  channelId,
const std::string &  targetChannelName,
uint32_t  numViewers 
)
private

◆ ChatChannelInfoChanged()

void ttv::chat::ChatChannelSet::ChatChannelInfoChanged ( UserId  userId,
ChannelId  channelId,
const ChatChannelInfo channelInfo 
)
private

◆ ChatChannelLocalUserChanged()

void ttv::chat::ChatChannelSet::ChatChannelLocalUserChanged ( UserId  userId,
ChannelId  channelId,
const ChatUserInfo userInfo 
)
private

◆ ChatChannelMessagesCleared()

void ttv::chat::ChatChannelSet::ChatChannelMessagesCleared ( UserId  userId,
ChannelId  channelId 
)
private

◆ ChatChannelMessagesReceived()

void ttv::chat::ChatChannelSet::ChatChannelMessagesReceived ( UserId  userId,
ChannelId  channelId,
const std::vector< LiveChatMessage > &  messageList 
)
private

◆ ChatChannelNoticeReceived()

void ttv::chat::ChatChannelSet::ChatChannelNoticeReceived ( UserId  userId,
ChannelId  channelId,
const std::string &  id,
const std::map< std::string, std::string > &  params 
)
private

◆ ChatChannelRaidNoticeReceived()

void ttv::chat::ChatChannelSet::ChatChannelRaidNoticeReceived ( UserId  userId,
ChannelId  channelId,
const RaidNotice notice 
)
private

◆ ChatChannelRestrictionsChanged()

void ttv::chat::ChatChannelSet::ChatChannelRestrictionsChanged ( UserId  userId,
ChannelId  channelId,
const ChatChannelRestrictions restrictions 
)
private

◆ ChatChannelStateChanged()

void ttv::chat::ChatChannelSet::ChatChannelStateChanged ( UserId  userId,
ChannelId  channelId,
ChatChannelState  state,
TTV_ErrorCode  ec 
)
private

◆ ChatChannelSubscriptionNoticeReceived()

void ttv::chat::ChatChannelSet::ChatChannelSubscriptionNoticeReceived ( UserId  userId,
ChannelId  channelId,
const SubscriptionNotice notice 
)
private

◆ ChatChannelUnraidNoticeReceived()

void ttv::chat::ChatChannelSet::ChatChannelUnraidNoticeReceived ( UserId  userId,
ChannelId  channelId,
const UnraidNotice notice 
)
private

◆ ChatChannelUserMessagesCleared()

void ttv::chat::ChatChannelSet::ChatChannelUserMessagesCleared ( UserId  userId,
ChannelId  channelId,
UserId  clearUserId 
)
private

◆ CheckShutdown()

virtual bool ttv::chat::ChatChannelSet::CheckShutdown ( )
overrideprotectedvirtual

Reimplemented from ttv::Component.

◆ CompleteShutdown()

virtual void ttv::chat::ChatChannelSet::CompleteShutdown ( )
overrideprotectedvirtual

Reimplemented from ttv::UserComponent.

◆ CompleteTask()

void ttv::Component::CompleteTask ( Task task)
protectedinherited

◆ Connect()

TTV_ErrorCode ttv::chat::ChatChannelSet::Connect ( ChannelId  channelId,
const std::shared_ptr< IChatChannelListener > &  listener 
)

◆ CreateChannel()

std::shared_ptr<ChannelEntry> ttv::chat::ChatChannelSet::CreateChannel ( ChannelId  channelId)
private

◆ Disconnect()

TTV_ErrorCode ttv::chat::ChatChannelSet::Disconnect ( ChannelId  channelId)

◆ FetchUserList()

TTV_ErrorCode ttv::chat::ChatChannelSet::FetchUserList ( ChannelId  channelId,
const FetchUserListCallback callback 
)

◆ FlushChannelEvents()

TTV_ErrorCode ttv::chat::ChatChannelSet::FlushChannelEvents ( )
private

◆ GetComponentName()

static std::string ttv::chat::ChatChannelSet::GetComponentName ( )
inlinestatic

◆ GetLoggerName()

virtual std::string ttv::chat::ChatChannelSet::GetLoggerName ( ) const
overridevirtual

Implements ttv::Component.

◆ GetMessageFlushInterval()

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

◆ GetState()

virtual State ttv::Component::GetState ( ) const
overridevirtualinherited

Implements ttv::IComponent.

◆ GetTaskRunner()

std::shared_ptr<TaskRunner> ttv::Component::GetTaskRunner ( )
inlineinherited

◆ Initialize()

virtual TTV_ErrorCode ttv::UserComponent::Initialize ( )
overridevirtualinherited

◆ IsTaskRunning()

bool ttv::Component::IsTaskRunning ( Task task) const
protectedinherited

◆ Log()

void ttv::UserComponent::Log ( TTV_MessageLevel  level,
const char *  format,
  ... 
)
protectedinherited

◆ LookupChannel()

TTV_ErrorCode ttv::chat::ChatChannelSet::LookupChannel ( ChannelId  channelId,
std::shared_ptr< ChatChannel > &  channel 
)
private

◆ OnUserAuthenticationIssue()

virtual void ttv::UserComponent::OnUserAuthenticationIssue ( std::shared_ptr< const OAuthToken oauthToken,
TTV_ErrorCode  ec 
)
protectedvirtualinherited

◆ OnUserInfoFetchComplete()

virtual void ttv::UserComponent::OnUserInfoFetchComplete ( TTV_ErrorCode  ec)
protectedvirtualinherited

◆ OnUserLogInComplete()

virtual void ttv::UserComponent::OnUserLogInComplete ( TTV_ErrorCode  ec)
protectedvirtualinherited

◆ OnUserLogOutComplete()

virtual void ttv::UserComponent::OnUserLogOutComplete ( TTV_ErrorCode  ec)
protectedvirtualinherited

◆ OptInToBroadcasterLanguageChat()

TTV_ErrorCode ttv::chat::ChatChannelSet::OptInToBroadcasterLanguageChat ( ChannelId  channelId,
const std::string &  language 
)

◆ SendChatMessage()

TTV_ErrorCode ttv::chat::ChatChannelSet::SendChatMessage ( ChannelId  channelId,
const std::string &  message 
)

◆ SetBitsConfigRepository()

void ttv::chat::ChatChannelSet::SetBitsConfigRepository ( std::shared_ptr< BitsConfigRepository repository)
inline

◆ SetBroadcasterLanguageChatEnabled()

TTV_ErrorCode ttv::chat::ChatChannelSet::SetBroadcasterLanguageChatEnabled ( ChannelId  channelId,
bool  enabled,
const SetBroadcasterLanguageChatCallback callback 
)

◆ SetChannelRepository()

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

◆ SetChatObjectFactory()

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

◆ SetClientState()

virtual void ttv::Component::SetClientState ( State  state)
protectedvirtualinherited

◆ SetLocalLanguage()

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

◆ SetMessageFlushInterval()

void ttv::chat::ChatChannelSet::SetMessageFlushInterval ( uint64_t  milliseconds)

◆ SetServerState()

virtual void ttv::Component::SetServerState ( State  state)
protectedvirtualinherited

◆ SetSettingRepository()

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

◆ SetState()

virtual void ttv::Component::SetState ( State  state)
protectedvirtualinherited

◆ SetTaskRunner()

virtual void ttv::Component::SetTaskRunner ( std::shared_ptr< TaskRunner taskRunner)
virtualinherited

◆ SetTokenizationOptions()

void ttv::chat::ChatChannelSet::SetTokenizationOptions ( const TokenizationOptions tokenizationOptions)
inline

◆ Shutdown()

virtual TTV_ErrorCode ttv::chat::ChatChannelSet::Shutdown ( )
overridevirtual

Reimplemented from ttv::Component.

◆ StartTask()

TTV_ErrorCode ttv::Component::StartTask ( std::shared_ptr< Task task)
protectedinherited

◆ Update()

virtual void ttv::chat::ChatChannelSet::Update ( )
overridevirtual

Reimplemented from ttv::Component.

Member Data Documentation

◆ mBitsConfigRepository

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

◆ mChannelRepository

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

◆ mChannels

std::map<ChannelId, std::shared_ptr<ChannelEntry> > ttv::chat::ChatChannelSet::mChannels
private

The mapping of lower case channel name to channel.

◆ mChatObjectFactory

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

◆ mCleanupChannels

std::vector<std::shared_ptr<ChannelEntry> > ttv::chat::ChatChannelSet::mCleanupChannels
private

The channels that should be released after all events have been flushed.

◆ mInternalChannelListener

std::shared_ptr<IChatChannelListener> ttv::chat::ChatChannelSet::mInternalChannelListener
private

The internal chat object factory.

◆ mLocalLanguage

std::string ttv::chat::ChatChannelSet::mLocalLanguage
private

The local user's language.

◆ mOAuthIssue

bool ttv::UserComponent::mOAuthIssue
protectedinherited

Whether or not the internal updates of the component are on hold because of an issue with the OAuth token.

◆ mRunningTasks

std::vector<std::shared_ptr<Task> > ttv::Component::mRunningTasks
protectedinherited

◆ mSettingRepository

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

The listener for channel events.

◆ mShutdownTimeMilliseconds

uint64_t ttv::Component::mShutdownTimeMilliseconds
protectedinherited

◆ mState

ClientServerValue<State> ttv::Component::mState
protectedinherited

◆ mTaskMutex

std::mutex ttv::Component::mTaskMutex
mutableprotectedinherited

◆ mTaskRunner

std::shared_ptr<TaskRunner> ttv::Component::mTaskRunner
protectedinherited

◆ mTokenizationOptions

TokenizationOptions ttv::chat::ChatChannelSet::mTokenizationOptions
private

◆ mUser

std::weak_ptr<User> ttv::UserComponent::mUser
protectedinherited

◆ mUserMessageFlushInterval

uint64_t ttv::chat::ChatChannelSet::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: