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

#include <chatconnection.h>

Inheritance diagram for ttv::chat::ChatConnection:
ttv::chat::IChatReceiveNetworkEvent

Classes

class  Listener
 

Public Member Functions

 ChatConnection (ChannelId channelId, const std::shared_ptr< User > &user)
 
virtual ~ChatConnection ()
 
void SetListener (Listener *listener)
 
void SetChatObjectFactory (std::shared_ptr< IChatObjectFactory > factory)
 
void SetChannelName (const std::string &channelName)
 
TTV_ErrorCode Connect (const std::string &uri)
 
TTV_ErrorCode Disconnect ()
 
TTV_ErrorCode SendChatMessage (const std::string &message, const ChatUserInfo &localUserInfo)
 
TTV_ErrorCode Update ()
 
std::string GetLocalUserName () const
 
virtual void ReceiveEvent (const ChatNetworkEvent &evt)
 

Static Public Member Functions

static TTV_ErrorCode CheckFactoryAvailability (const std::string &uri)
 

Private Types

enum  ConnectionState {
  CONNECTIONSTATE_DISCONNECTED, CONNECTIONSTATE_CONNECTING, CONNECTIONSTATE_WELCOMING, CONNECTIONSTATE_WELCOMED,
  CONNECTIONSTATE_JOINING, CONNECTIONSTATE_CONNECTED, CONNECTIONSTATE_CONNECTION_FAILED, CONNECTIONSTATE_CONNECTION_LOST
}
 

Private Member Functions

void SetState (ConnectionState state)
 
void Join ()
 
void HandleCapMessage (const ChatNetworkEvent &evt)
 
void HandlePrivateMessage (const ChatNetworkEvent &evt)
 
void HandleUserState (const ChatNetworkEvent &evt)
 
void HandleNotice (const ChatNetworkEvent &evt)
 
void HandleClearChatMessage (const ChatNetworkEvent &evt)
 
void HandleHostTargetMessage (const ChatNetworkEvent &evt)
 
void HandleUserNotice (const ChatNetworkEvent &evt)
 
void HandleMessageTags (const ChatNetworkEvent &evt)
 
void HandleRoomState (const ChatNetworkEvent &evt)
 
void CreateObjects ()
 
void ReleaseObjects ()
 
std::string CreateAnonymousUserName ()
 

Private Attributes

std::shared_ptr< ChatReadermReader
 The socket reader. More...
 
std::shared_ptr< ChatWritermWriter
 The socket writer. More...
 
std::shared_ptr< ChatSessionmSession
 The message interpreter. More...
 
std::shared_ptr< IChatObjectFactorymChatObjectFactory
 The internal chat object factory. More...
 
std::shared_ptr< IChatTransportmTransport
 The transport for sending and receiving chat messages. More...
 
WaitForEventWithTimeout mWelcomeMessageTimeout
 
WaitForEventWithTimeout mJoinAttemptTimeout
 
std::string mIrcChannelName
 
std::string mUserName
 The cached username. More...
 
ConnectionState mConnectionState
 
ListenermListener
 
TTV_ErrorCode mConnectionError
 
std::shared_ptr< UsermUser
 
ChannelId mChannelId
 
ChatChannelRestrictions mChatRestrictions
 Stores the state of chat restrictions received by ROOMSTATE. More...
 
bool mAnonymous
 Whether or not connecting anonymously to the channel. More...
 
bool mDisconnectionRequested
 Whether or not expecting a disconnect. More...
 
bool mFireConnectionErrorEvents
 Whether or not to fire a connection error event. More...
 

Detailed Description

Wraps an instance of an IRC connection.

Member Enumeration Documentation

◆ ConnectionState

Enumerator
CONNECTIONSTATE_DISCONNECTED 
CONNECTIONSTATE_CONNECTING 
CONNECTIONSTATE_WELCOMING 
CONNECTIONSTATE_WELCOMED 
CONNECTIONSTATE_JOINING 
CONNECTIONSTATE_CONNECTED 
CONNECTIONSTATE_CONNECTION_FAILED 
CONNECTIONSTATE_CONNECTION_LOST 

Constructor & Destructor Documentation

◆ ChatConnection()

ttv::chat::ChatConnection::ChatConnection ( ChannelId  channelId,
const std::shared_ptr< User > &  user 
)

◆ ~ChatConnection()

virtual ttv::chat::ChatConnection::~ChatConnection ( )
virtual

Member Function Documentation

◆ CheckFactoryAvailability()

static TTV_ErrorCode ttv::chat::ChatConnection::CheckFactoryAvailability ( const std::string &  uri)
static

◆ Connect()

TTV_ErrorCode ttv::chat::ChatConnection::Connect ( const std::string &  uri)

Connect to the channel.

◆ CreateAnonymousUserName()

std::string ttv::chat::ChatConnection::CreateAnonymousUserName ( )
private

◆ CreateObjects()

void ttv::chat::ChatConnection::CreateObjects ( )
private

◆ Disconnect()

TTV_ErrorCode ttv::chat::ChatConnection::Disconnect ( )

Disconnect from the channel.

◆ GetLocalUserName()

std::string ttv::chat::ChatConnection::GetLocalUserName ( ) const
inline

◆ HandleCapMessage()

void ttv::chat::ChatConnection::HandleCapMessage ( const ChatNetworkEvent evt)
private

◆ HandleClearChatMessage()

void ttv::chat::ChatConnection::HandleClearChatMessage ( const ChatNetworkEvent evt)
private

◆ HandleHostTargetMessage()

void ttv::chat::ChatConnection::HandleHostTargetMessage ( const ChatNetworkEvent evt)
private

◆ HandleMessageTags()

void ttv::chat::ChatConnection::HandleMessageTags ( const ChatNetworkEvent evt)
private

◆ HandleNotice()

void ttv::chat::ChatConnection::HandleNotice ( const ChatNetworkEvent evt)
private

◆ HandlePrivateMessage()

void ttv::chat::ChatConnection::HandlePrivateMessage ( const ChatNetworkEvent evt)
private

Handles PRIVMSG.

◆ HandleRoomState()

void ttv::chat::ChatConnection::HandleRoomState ( const ChatNetworkEvent evt)
private

◆ HandleUserNotice()

void ttv::chat::ChatConnection::HandleUserNotice ( const ChatNetworkEvent evt)
private

◆ HandleUserState()

void ttv::chat::ChatConnection::HandleUserState ( const ChatNetworkEvent evt)
private

◆ Join()

void ttv::chat::ChatConnection::Join ( )
private

◆ ReceiveEvent()

virtual void ttv::chat::ChatConnection::ReceiveEvent ( const ChatNetworkEvent evt)
virtual

◆ ReleaseObjects()

void ttv::chat::ChatConnection::ReleaseObjects ( )
private

◆ SendChatMessage()

TTV_ErrorCode ttv::chat::ChatConnection::SendChatMessage ( const std::string &  message,
const ChatUserInfo localUserInfo 
)

Sends a message from the current user.

◆ SetChannelName()

void ttv::chat::ChatConnection::SetChannelName ( const std::string &  channelName)

◆ SetChatObjectFactory()

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

◆ SetListener()

void ttv::chat::ChatConnection::SetListener ( Listener listener)
inline

◆ SetState()

void ttv::chat::ChatConnection::SetState ( ConnectionState  state)
private

◆ Update()

TTV_ErrorCode ttv::chat::ChatConnection::Update ( )

Member Data Documentation

◆ mAnonymous

bool ttv::chat::ChatConnection::mAnonymous
private

Whether or not connecting anonymously to the channel.

◆ mChannelId

ChannelId ttv::chat::ChatConnection::mChannelId
private

◆ mChatObjectFactory

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

The internal chat object factory.

◆ mChatRestrictions

ChatChannelRestrictions ttv::chat::ChatConnection::mChatRestrictions
private

Stores the state of chat restrictions received by ROOMSTATE.

◆ mConnectionError

TTV_ErrorCode ttv::chat::ChatConnection::mConnectionError
private

◆ mConnectionState

ConnectionState ttv::chat::ChatConnection::mConnectionState
private

◆ mDisconnectionRequested

bool ttv::chat::ChatConnection::mDisconnectionRequested
private

Whether or not expecting a disconnect.

◆ mFireConnectionErrorEvents

bool ttv::chat::ChatConnection::mFireConnectionErrorEvents
private

Whether or not to fire a connection error event.

◆ mIrcChannelName

std::string ttv::chat::ChatConnection::mIrcChannelName
private

◆ mJoinAttemptTimeout

WaitForEventWithTimeout ttv::chat::ChatConnection::mJoinAttemptTimeout
private

◆ mListener

Listener* ttv::chat::ChatConnection::mListener
private

◆ mReader

std::shared_ptr<ChatReader> ttv::chat::ChatConnection::mReader
private

The socket reader.

◆ mSession

std::shared_ptr<ChatSession> ttv::chat::ChatConnection::mSession
private

The message interpreter.

◆ mTransport

std::shared_ptr<IChatTransport> ttv::chat::ChatConnection::mTransport
private

The transport for sending and receiving chat messages.

◆ mUser

std::shared_ptr<User> ttv::chat::ChatConnection::mUser
private

◆ mUserName

std::string ttv::chat::ChatConnection::mUserName
private

The cached username.

◆ mWelcomeMessageTimeout

WaitForEventWithTimeout ttv::chat::ChatConnection::mWelcomeMessageTimeout
private

◆ mWriter

std::shared_ptr<ChatWriter> ttv::chat::ChatConnection::mWriter
private

The socket writer.


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