rtc.avd_SDK-C++  3.2.0
mchat.h
浏览该文件的文档.
1 #ifndef RT_Chat_H_
2 #define RT_Chat_H_
3 
4 #include "common.h"
5 #include "room.h"
6 
7 namespace rtc {
8  class IRoom;
9 
15  struct AvdMessage {
20  };
24  typedef std::vector<AvdMessage> MessagesType;
25 
31  class RT_API_EXPORT IMChat : public IModule {
32  public:
38  class IListener {
39  public:
41 
48  virtual void onPublicMessage(const AvdMessage& message) = 0;
56  virtual void onPrivateMessage(const AvdMessage& message) = 0;
57  protected:
58  virtual ~IListener() {
59  }
60  };
61 
68  static IMChat* getChat(IRoom* room);
69 
76  virtual Result setListener(IListener* listener) = 0;
83  virtual Result sendPublicMessage(const String& message) = 0;
91  virtual Result sendPrivateMessage(const String& message, const UserId& toId) = 0;
92 
102  virtual Result getPublicHistoryMessage(bool latest, uint32 begindex, uint32& ncount, MessagesType& msgs) = 0;
113  virtual Result getPrivateHistoryMessage(const UserId& userId, bool latest, uint32 begindex, uint32& ncount, MessagesType& msgs) = 0;
114 
115  protected:
116  virtual ~IMChat() {
117  }
118  };
119 
120 } // namespace rtc
121 #endif//RT_Chat_H_
virtual ~IListener()
Definition: mchat.h:58
Definition: annotationobject.h:71
String UserId
用户号类型,唯一标识房间内一个用户,长度不大于Max_UserId定义;由应用层定义传递给AVD SDK,要求保证房间内唯一
Definition: common.h:13
int Result
返回值类型
Definition: combase.h:13
房间模块接口类
Definition: room.h:382
#define RT_API_EXPORT
Definition: defines.h:216
房间中聊天模块回调接口.
Definition: mchat.h:38
unsigned int uint32
Definition: defines.h:387
std::string String
定义的String类型
Definition: common.h:10
房间中聊天模块接口.
Definition: mchat.h:31
聊天消息结构.
Definition: mchat.h:15
String message
消息内容
Definition: mchat.h:19
房间接口类
Definition: room.h:16
UserId fromId
消息发送者Id
Definition: mchat.h:17
std::vector< AvdMessage > MessagesType
聊天消息列表类型.
Definition: mchat.h:24
String fromName
消息发送者名
Definition: mchat.h:18
virtual ~IMChat()
Definition: mchat.h:116
uint32 timestamp
消息时间戳,对应用层是本地时间,传输中用GMT时间
Definition: mchat.h:16