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

#include <chatuserblocklist.h>

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

Classes

struct  ChangeRequest
 

Public Types

using BlockChangeCallback = std::function< void(TTV_ErrorCode ec)>
 
using FetchBlockedUsersCallback = std::function< void(TTV_ErrorCode ec, const std::vector< UserInfo > &blockedUsers)>
 
enum  State { State::Uninitialized, State::Initialized, State::ShuttingDown, State::Inert }
 

Public Member Functions

 ChatUserBlockList (std::shared_ptr< User > user)
 
virtual ~ChatUserBlockList ()
 
TTV_ErrorCode UpdateList ()
 
TTV_ErrorCode BlockUser (UserId userId, const std::string &reason, bool whisper, const BlockChangeCallback &=nullptr)
 
TTV_ErrorCode BlockUser (const std::string &userName, const std::string &reason, bool whisper, const BlockChangeCallback &=nullptr)
 
TTV_ErrorCode UnblockUser (UserId userId, const BlockChangeCallback &=nullptr)
 
TTV_ErrorCode UnblockUser (const std::string &userName, const BlockChangeCallback &=nullptr)
 
TTV_ErrorCode FetchBlockedUsers (const FetchBlockedUsersCallback &callback=nullptr)
 
bool IsUserBlocked (UserId userId)
 
void GetBlockedUsers (std::unordered_set< UserId > &result) const
 
void SetRefreshInterval (uint64_t milliseconds)
 
uint64_t GetRefreshInterval () const
 
std::shared_ptr< UserGetUser ()
 
virtual void Update () override
 
virtual TTV_ErrorCode Shutdown () override
 
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 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)
 
virtual void CompleteShutdown () override
 
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 Types

typedef std::shared_ptr< std::unordered_set< UserId > > SetReference
 

Private Member Functions

virtual bool CheckShutdown () override
 
bool IsRefreshInProgress () const
 
void FetchPage (uint offset, uint limit)
 
void RefreshComplete (TTV_ErrorCode ec)
 
void CancelRequestsForUser (UserId blockUserId)
 
void ScheduleRequest (UserId blockUserId, bool block, const std::string &reason, bool whisper, const BlockChangeCallback &callback)
 
void ProcessNextRequest ()
 
void SetLocalValue (SetReference set, UserId blockUserId, bool block)
 

Private Attributes

std::weak_ptr< UserRepositorymUserRepository
 
SetReference mBlockedUsers
 The current set of users. More...
 
SetReference mRefreshUsers
 The set of users incrementally built during a refresh. More...
 
std::vector< UserInfomUserInfoList
 List of UserInfos fetched. More...
 
std::vector< ChangeRequestmQueuedChanges
 The set of server changes that are queued while a refresh is in progress. More...
 
CallbackQueue< FetchBlockedUsersCallbackmBlockedUsersCallbacks
 
std::shared_ptr< ChatChangeUserBlockTaskmRunningChangeTask
 
std::shared_ptr< ChatGetBlockListTaskmRunningGetListTask
 
std::shared_ptr< ChatGetBlockListTask::ResultmRefreshResult
 
WaitForExpiry mRefreshTimer
 
uint64_t mRefreshIntervalMilliseconds
 

Class Documentation

◆ ttv::chat::ChatUserBlockList::ChangeRequest

struct ttv::chat::ChatUserBlockList::ChangeRequest
Class Members
bool block
BlockChangeCallback callback
string reason
UserId userId
bool whisper

Member Typedef Documentation

◆ BlockChangeCallback

◆ FetchBlockedUsersCallback

using ttv::chat::ChatUserBlockList::FetchBlockedUsersCallback = std::function<void(TTV_ErrorCode ec, const std::vector<UserInfo>& blockedUsers)>

◆ SetReference

typedef std::shared_ptr< std::unordered_set<UserId> > ttv::chat::ChatUserBlockList::SetReference
private

Member Enumeration Documentation

◆ State

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

The component doesn't require shutting down.

Constructor & Destructor Documentation

◆ ChatUserBlockList()

ttv::chat::ChatUserBlockList::ChatUserBlockList ( std::shared_ptr< User user)

◆ ~ChatUserBlockList()

virtual ttv::chat::ChatUserBlockList::~ChatUserBlockList ( )
virtual

Member Function Documentation

◆ BlockUser() [1/2]

TTV_ErrorCode ttv::chat::ChatUserBlockList::BlockUser ( UserId  userId,
const std::string &  reason,
bool  whisper,
const BlockChangeCallback = nullptr 
)

◆ BlockUser() [2/2]

TTV_ErrorCode ttv::chat::ChatUserBlockList::BlockUser ( const std::string &  userName,
const std::string &  reason,
bool  whisper,
const BlockChangeCallback = nullptr 
)

◆ CancelRequestsForUser()

void ttv::chat::ChatUserBlockList::CancelRequestsForUser ( UserId  blockUserId)
private

◆ CheckShutdown()

virtual bool ttv::chat::ChatUserBlockList::CheckShutdown ( )
overrideprivatevirtual

Reimplemented from ttv::Component.

◆ CompleteShutdown()

virtual void ttv::UserComponent::CompleteShutdown ( )
overrideprotectedvirtualinherited

◆ CompleteTask()

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

◆ FetchBlockedUsers()

TTV_ErrorCode ttv::chat::ChatUserBlockList::FetchBlockedUsers ( const FetchBlockedUsersCallback callback = nullptr)

◆ FetchPage()

void ttv::chat::ChatUserBlockList::FetchPage ( uint  offset,
uint  limit 
)
private

◆ GetBlockedUsers()

void ttv::chat::ChatUserBlockList::GetBlockedUsers ( std::unordered_set< UserId > &  result) const

◆ GetComponentName()

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

◆ GetLoggerName()

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

Implements ttv::Component.

◆ GetRefreshInterval()

uint64_t ttv::chat::ChatUserBlockList::GetRefreshInterval ( ) const
inline

◆ GetState()

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

Implements ttv::IComponent.

◆ GetTaskRunner()

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

◆ GetUser()

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

◆ Initialize()

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

◆ IsRefreshInProgress()

bool ttv::chat::ChatUserBlockList::IsRefreshInProgress ( ) const
private

◆ IsTaskRunning()

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

◆ IsUserBlocked()

bool ttv::chat::ChatUserBlockList::IsUserBlocked ( UserId  userId)

◆ Log()

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

◆ 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

◆ ProcessNextRequest()

void ttv::chat::ChatUserBlockList::ProcessNextRequest ( )
private

◆ RefreshComplete()

void ttv::chat::ChatUserBlockList::RefreshComplete ( TTV_ErrorCode  ec)
private

◆ ScheduleRequest()

void ttv::chat::ChatUserBlockList::ScheduleRequest ( UserId  blockUserId,
bool  block,
const std::string &  reason,
bool  whisper,
const BlockChangeCallback callback 
)
private

◆ SetClientState()

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

◆ SetLocalValue()

void ttv::chat::ChatUserBlockList::SetLocalValue ( SetReference  set,
UserId  blockUserId,
bool  block 
)
private

◆ SetRefreshInterval()

void ttv::chat::ChatUserBlockList::SetRefreshInterval ( uint64_t  milliseconds)

◆ SetServerState()

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

◆ SetState()

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

◆ SetTaskRunner()

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

◆ Shutdown()

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

Reimplemented from ttv::Component.

◆ StartTask()

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

◆ UnblockUser() [1/2]

TTV_ErrorCode ttv::chat::ChatUserBlockList::UnblockUser ( UserId  userId,
const BlockChangeCallback = nullptr 
)

◆ UnblockUser() [2/2]

TTV_ErrorCode ttv::chat::ChatUserBlockList::UnblockUser ( const std::string &  userName,
const BlockChangeCallback = nullptr 
)

◆ Update()

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

Reimplemented from ttv::Component.

◆ UpdateList()

TTV_ErrorCode ttv::chat::ChatUserBlockList::UpdateList ( )

Member Data Documentation

◆ mBlockedUsers

SetReference ttv::chat::ChatUserBlockList::mBlockedUsers
private

The current set of users.

◆ mBlockedUsersCallbacks

CallbackQueue<FetchBlockedUsersCallback> ttv::chat::ChatUserBlockList::mBlockedUsersCallbacks
private

◆ 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.

◆ mQueuedChanges

std::vector<ChangeRequest> ttv::chat::ChatUserBlockList::mQueuedChanges
private

The set of server changes that are queued while a refresh is in progress.

◆ mRefreshIntervalMilliseconds

uint64_t ttv::chat::ChatUserBlockList::mRefreshIntervalMilliseconds
private

◆ mRefreshResult

std::shared_ptr<ChatGetBlockListTask::Result> ttv::chat::ChatUserBlockList::mRefreshResult
private

◆ mRefreshTimer

WaitForExpiry ttv::chat::ChatUserBlockList::mRefreshTimer
private

◆ mRefreshUsers

SetReference ttv::chat::ChatUserBlockList::mRefreshUsers
private

The set of users incrementally built during a refresh.

◆ mRunningChangeTask

std::shared_ptr<ChatChangeUserBlockTask> ttv::chat::ChatUserBlockList::mRunningChangeTask
private

◆ mRunningGetListTask

std::shared_ptr<ChatGetBlockListTask> ttv::chat::ChatUserBlockList::mRunningGetListTask
private

◆ mRunningTasks

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

◆ 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

◆ mUser

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

◆ mUserInfoList

std::vector<UserInfo> ttv::chat::ChatUserBlockList::mUserInfoList
private

List of UserInfos fetched.

◆ mUserRepository

std::weak_ptr<UserRepository> ttv::chat::ChatUserBlockList::mUserRepository
private

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