Twitch SDK (Internal)
channelchatroommanager.h
Go to the documentation of this file.
1 /********************************************************************************************
2  * Twitch Broadcasting SDK
3  *
4  * This software is supplied under the terms of a license agreement with Twitch Interactive, Inc. and
5  * may not be copied or used except in accordance with the terms of that agreement
6  * Copyright (c) 2017 Twitch Interactive, Inc.
7  *********************************************************************************************/
8 
9 #pragma once
10 
15 
16 namespace ttv
17 {
18  namespace chat
19  {
20  class ChannelChatRoomManager;
21  }
22 }
23 
24 
25 class ttv::chat::ChannelChatRoomManager: public IChannelChatRoomManager, public PubSubComponent<IChannelChatRoomManagerListener>
26 {
27 public:
28  using DisposerFunc = std::function<void()>;
29 
30 public:
31  ChannelChatRoomManager(const std::shared_ptr<User>& user, ChannelId channelId);
32 
33  // Component Overrides
34  static std::string GetComponentName() { return "ttv::chat::ChannelChatRoomManager"; }
35  virtual std::string GetLoggerName() const override;
36 
37  //IChannelChatRoomManager implementation
38  virtual TTV_ErrorCode Dispose() override;
39  virtual TTV_ErrorCode AddNewChatRoom(const std::string& roomName, const std::string& topic, bool isPreviewable, RoomRole minimumAllowedRole, const AddRoomCallback& callback) override;
40  virtual TTV_ErrorCode JoinChatRooms(const JoinCallback& callback) override;
41  virtual TTV_ErrorCode LeaveChatRooms(const LeaveCallback& callback) override;
42  virtual TTV_ErrorCode FetchChatRoomsInfo(const FetchRoomsInfoCallback& callback) override;
43 
44  void OnTopicSubscribeStateChanged(const std::string& topic, PubSubClient::SubscribeState::Enum state, TTV_ErrorCode ec) override;
45  void OnTopicMessageReceived(const std::string& topic, const ttv::json::Value& jVal) override;
46 
47 private:
48  std::string mPubSubTopic;
51 };
uint32_t UserId
Definition: coretypes.h:22
void OnTopicSubscribeStateChanged(const std::string &topic, PubSubClient::SubscribeState::Enum state, TTV_ErrorCode ec) override
static std::string GetComponentName()
Definition: channelchatroommanager.h:34
RoomRole
Definition: chattypes.h:775
ChannelChatRoomManager(const std::shared_ptr< User > &user, ChannelId channelId)
UserId mUserId
Definition: channelchatroommanager.h:49
Enum
Definition: pubsubclient.h:91
Definition: ichannelchatroommanager.h:25
std::function< void(TTV_ErrorCode ec)> LeaveCallback
Definition: ichannelchatroommanager.h:45
JSON (JavaScript Object Notation).
Definition: adsapi.h:16
ChannelId mChannelId
Definition: channelchatroommanager.h:50
Represents a JSON value.
Definition: value.h:114
virtual std::string GetLoggerName() const override
virtual TTV_ErrorCode JoinChatRooms(const JoinCallback &callback) override
std::function< void(TTV_ErrorCode ec, CreateRoomError &&error, ChatRoomInfo &&info)> AddRoomCallback
Definition: ichannelchatroommanager.h:57
virtual TTV_ErrorCode AddNewChatRoom(const std::string &roomName, const std::string &topic, bool isPreviewable, RoomRole minimumAllowedRole, const AddRoomCallback &callback) override
uint32_t TTV_ErrorCode
Definition: errortypes.h:30
Definition: channelchatroommanager.h:25
virtual TTV_ErrorCode FetchChatRoomsInfo(const FetchRoomsInfoCallback &callback) override
std::function< void(TTV_ErrorCode ec, std::vector< ChatRoomInfo > &&infos)> FetchRoomsInfoCallback
Definition: ichannelchatroommanager.h:67
virtual TTV_ErrorCode LeaveChatRooms(const LeaveCallback &callback) override
std::function< void()> DisposerFunc
Definition: channelchatroommanager.h:28
uint32_t ChannelId
Definition: coretypes.h:23
virtual TTV_ErrorCode Dispose() override
std::string mPubSubTopic
Definition: channelchatroommanager.h:48
Definition: pubsubcomponent.h:21
std::function< void(TTV_ErrorCode ec)> JoinCallback
Definition: ichannelchatroommanager.h:36
void OnTopicMessageReceived(const std::string &topic, const ttv::json::Value &jVal) override