cn.3tee.avd_SDK-C  3.2.0
mchat_c.h
浏览该文件的文档.
1 #ifndef RT_Chat_C_H_
2 #define RT_Chat_C_H_
3 
4 #include "common_c.h"
5 
11 struct AVDMessage {
12  uint32 timestamp;
13  char fromId[Max_UserId];
14  char fromName[Max_UserName];
15  char message[4*Max_Message];
17  memset(fromId, 0, sizeof(fromId));
18  memset(fromName, 0, sizeof(fromName));
19  memset(message, 0, sizeof(message));
20  }
21  void clear(){
22  memset(this, 0, sizeof(AVDMessage));
23  }
24 };
25 
31 typedef struct Chat_Callback {
33 
41  void(*chat_onPublicMessage) (AVDHandle chatHandle, const AVDMessage& message);
50  void(*chat_onPrivateMessage)(AVDHandle chatHandle, const AVDMessage& message);
52  chat_onPublicMessage = NULL;
53  chat_onPublicMessage = NULL;
54  }
56 
58 extern "C" {
67  RT_API_EXPORT Result avd_chat_init(AVDHandle roomHandle, LPChat_Callback cb, AVDHandle& chatHandle);
73  RT_API_EXPORT Result avd_chat_uninit(AVDHandle chatHandle);
82  RT_API_EXPORT Result avd_chat_sendPublicMessage(AVDHandle chatHandle, const char* msg, uint32 len);
92  RT_API_EXPORT Result avd_chat_sendPrivateMessage(AVDHandle chatHandle, const char* msg, uint32 len, const char* toUserId);
93  //
104  RT_API_EXPORT Result avd_chat_getPublicHistoryMessage(AVDHandle chatHandle, AVDBool latest, uint32 begindex, uint32& ncount, AVDMessage*& messages);
116  RT_API_EXPORT Result avd_chat_getPrivateHistoryMessage(AVDHandle chatHandle, const char* userId, AVDBool latest, uint32 begindex, uint32& ncount, AVDMessage*& messages);
117 }
118 
119 #endif//RT_Chat_C_H_
void(* chat_onPublicMessage)(AVDHandle chatHandle, const AVDMessage &message)
通知
Definition: mchat_c.h:41
RT_API_EXPORT Result avd_chat_uninit(AVDHandle chatHandle)
反初始化聊天模块接口
RT_API_EXPORT Result avd_chat_sendPublicMessage(AVDHandle chatHandle, const char *msg, uint32 len)
发送公聊消息
char message[4 *Max_Message]
消息内容
Definition: mchat_c.h:15
AVDMessage()
Definition: mchat_c.h:16
RT_API_EXPORT Result avd_chat_getPrivateHistoryMessage(AVDHandle chatHandle, const char *userId, AVDBool latest, uint32 begindex, uint32 &ncount, AVDMessage *&messages)
获取私聊历史消息记录
struct Chat_Callback * LPChat_Callback
房间中聊天模块回调接口.
void clear()
Definition: mchat_c.h:21
RT_API_EXPORT Result avd_chat_getPublicHistoryMessage(AVDHandle chatHandle, AVDBool latest, uint32 begindex, uint32 &ncount, AVDMessage *&messages)
获取公聊历史消息记录
void(* chat_onPrivateMessage)(AVDHandle chatHandle, const AVDMessage &message)
接收到私聊消息通知
Definition: mchat_c.h:50
聊天消息结构.
Definition: mchat_c.h:11
int AVDBool
C语言自定义Bool类型.
Definition: common_c.h:20
RT_API_EXPORT Result avd_chat_init(AVDHandle roomHandle, LPChat_Callback cb, AVDHandle &chatHandle)
初始化聊天模块接口
Chat_Callback()
Definition: mchat_c.h:51
char fromId[Max_UserId]
消息发送者Id
Definition: mchat_c.h:13
RT_API_EXPORT Result avd_chat_sendPrivateMessage(AVDHandle chatHandle, const char *msg, uint32 len, const char *toUserId)
发送私聊消息
char fromName[Max_UserName]
消息发送者名
Definition: mchat_c.h:14
uint32 timestamp
消息时间戳,对应用层是本地时间,传输中用GMT时间
Definition: mchat_c.h:12
房间中聊天模块回调接口.
Definition: mchat_c.h:31