NIM PC Cross Platform SDK
载入中...
搜索中...
未找到
nim_cpp_talk.h
浏览该文件的文档.
1
7#ifndef _NIM_SDK_CPP_TALK_H_
8#define _NIM_SDK_CPP_TALK_H_
9
10#include <functional>
11#include <list>
12#include <string>
20namespace nim {
21
26public:
28 typedef std::function<void(const SendMessageArc&)> SendMsgAckCallback;
30 typedef std::function<void(const IMMessage&)> ReceiveMsgCallback;
32 typedef std::function<void(const std::list<IMMessage>&)> ReceiveMsgsCallback;
34 typedef std::function<void(int64_t, int64_t)> FileUpPrgCallback;
36 typedef std::function<bool(const IMMessage&)> TeamNotificationFilter;
38 typedef std::function<void(const NIMResCode, const std::list<RecallMsgNotify>&)> RecallMsgsCallback;
40 typedef std::function<void(const BroadcastMessage&)> ReceiveBroadcastMsgCallback;
42 typedef std::function<void(const std::list<BroadcastMessage>&)> ReceiveBroadcastMsgsCallback;
44 typedef std::function<bool(const IMMessage&)> MessageFilter;
45
46
74 static void RegSendMsgCb(const SendMsgAckCallback& cb, const std::string& json_extension = "");
75
100 static void SendMsg(const std::string& json_msg, const std::string& json_extension = "", FileUpPrgCallback* pcb = nullptr);
101
127 static void SendMsg(const IMMessage& message, const std::string& json_extension = "", FileUpPrgCallback* pcb = nullptr);
128 static void SendMsg(const IMMessage& message, const std::string& json_extension = "", FileUpPrgCallback pcb = nullptr);
129
140 static bool StopSendMsg(const std::string& client_msg_id, const NIMMessageType& type, const std::string& json_extension = "");
141
159 static void RegReceiveCb(const ReceiveMsgCallback& cb, const std::string& json_extension = "");
160
176 static void RegReceiveMessagesCb(const ReceiveMsgsCallback& cb, const std::string& json_extension = "");
177
200 static std::string CreateTextMessage(const std::string& receiver_id,
201 const NIMSessionType session_type,
202 const std::string& client_msg_id,
203 const std::string& content,
204 const MessageSetting& msg_setting,
205 int64_t timetag = 0,
206 int32_t sub_type = 0);
207
236 static std::string CreateImageMessage(const std::string& receiver_id,
237 const NIMSessionType session_type,
238 const std::string& client_msg_id,
239 const IMImage& image,
240 const std::string& file_path,
241 const MessageSetting& msg_setting,
242 int64_t timetag = 0,
243 int32_t sub_type = 0);
244
273 static std::string CreateFileMessage(const std::string& receiver_id,
274 const NIMSessionType session_type,
275 const std::string& client_msg_id,
276 const IMFile& file,
277 const std::string& file_path,
278 const MessageSetting& msg_setting,
279 int64_t timetag = 0,
280 int32_t sub_type = 0);
281
310 static std::string CreateAudioMessage(const std::string& receiver_id,
311 const NIMSessionType session_type,
312 const std::string& client_msg_id,
313 const IMAudio& audio,
314 const std::string& file_path,
315 const MessageSetting& msg_setting,
316 int64_t timetag = 0,
317 int32_t sub_type = 0);
318
347 static std::string CreateVideoMessage(const std::string& receiver_id,
348 const NIMSessionType session_type,
349 const std::string& client_msg_id,
350 const IMVideo& video,
351 const std::string& file_path,
352 const MessageSetting& msg_setting,
353 int64_t timetag = 0,
354 int32_t sub_type = 0);
355
382 static std::string CreateLocationMessage(const std::string& receiver_id,
383 const NIMSessionType session_type,
384 const std::string& client_msg_id,
385 const IMLocation& location,
386 const MessageSetting& msg_setting,
387 int64_t timetag = 0,
388 int32_t sub_type = 0);
389
412 static std::string CreateTipMessage(const std::string& receiver_id,
413 const NIMSessionType session_type,
414 const std::string& client_msg_id,
415 const std::string& tip,
416 const MessageSetting& msg_setting,
417 int64_t timetag = 0,
418 int32_t sub_type = 0);
419
441 static std::string CreateBotRobotMessage(const std::string& receiver_id,
442 const NIMSessionType session_type,
443 const std::string& client_msg_id,
444 const std::string& content,
445 const IMBotRobot& bot_msg,
446 const MessageSetting& msg_setting,
447 int64_t timetag = 0,
448 int32_t sub_type = 0);
449
472 static std::string CreateG2NetCallMessage(const std::string& receiver_id,
473 const NIMSessionType session_type,
474 const std::string& client_msg_id,
475 const std::string& msg_attach,
476 const MessageSetting& msg_setting,
477 int64_t timetag = 0,
478 int32_t sub_type = 0);
479
500 static std::string CreateRetweetMessage(const std::string& src_msg_json,
501 const std::string& client_msg_id,
502 const NIMSessionType retweet_to_session_type,
503 const std::string& retweet_to_session_id,
504 const MessageSetting& msg_setting,
505 int64_t timetag = 0);
506
513 static bool ParseIMMessage(const std::string& json_msg, IMMessage& msg);
514
521 static bool ParseImageMessageAttach(const IMMessage& msg, IMImage& image);
522
529 static bool ParseFileMessageAttach(const IMMessage& msg, IMFile& file);
530
537 static bool ParseAudioMessageAttach(const IMMessage& msg, IMAudio& audio);
538
545 static bool ParseVideoMessageAttach(const IMMessage& msg, IMVideo& video);
546
553 static bool ParseLocationMessageAttach(const IMMessage& msg, IMLocation& location);
554
563 static bool ParseBotRobotMessageAttach(const IMMessage& msg, IMBotRobot& robot_msg);
564
569 static void UnregTalkCb();
570
584 static void RegTeamNotificationFilter(const TeamNotificationFilter& filter, const std::string& json_extension = "");
585
598 static void RegMessageFilter(const MessageFilter& filter, const std::string& json_extension = "");
599
613 static void RegRecallMsgsCallback(const RecallMsgsCallback& cb, const std::string& json_extension = "");
614
654 static void RecallMsg(const IMMessage& msg, const std::string& notify, const RecallMsgsCallback& cb, const std::string& json_extension = "");
655
699 static void RecallMsg2(const IMMessage& msg,
700 const std::string& notify,
701 const RecallMsgsCallback& cb,
702 const std::string& apnstext = "",
703 const std::string& pushpayloadconst = "",
704 const std::string& json_extension = "");
705
752 static void RecallMsgEx(const IMMessage& msg, const std::string& notify, const RecallMsgsCallback& cb, nim_talk_recall_extra_params& extra_param);
753
764 static std::string GetAttachmentPathFromMsg(const IMMessage& msg);
765
783 static void RegReceiveBroadcastMsgCb(const ReceiveBroadcastMsgCallback& cb, const std::string& json_extension = "");
784
799 static void RegReceiveBroadcastMsgsCb(const ReceiveBroadcastMsgsCallback& cb, const std::string& json_extension = "");
800
824 static void ReplyMessage(const IMMessage& msg, const std::string& json_reply_msg, FileUpPrgCallback* prg_cb = nullptr);
825 static void ReplyMessage(const IMMessage& former_msg, const IMMessage& reply_msg, FileUpPrgCallback* prg_cb = nullptr);
826};
827
828} // namespace nim
829
830#endif //_NIM_SDK_CPP_TALK_H_
聊天功能,主要包括消息收发、消息撤回、消息回复(Thread 场景)等功能
Definition: nim_cpp_talk.h:25
std::function< void(const std::list< BroadcastMessage > &)> ReceiveBroadcastMsgsCallback
批量接收广播消息通知回调
Definition: nim_cpp_talk.h:42
std::function< void(const IMMessage &)> ReceiveMsgCallback
接收消息通知回调
Definition: nim_cpp_talk.h:30
std::function< bool(const IMMessage &)> MessageFilter
消息过滤器
Definition: nim_cpp_talk.h:44
std::function< void(int64_t, int64_t)> FileUpPrgCallback
发送多媒体消息文件上传过程回调
Definition: nim_cpp_talk.h:34
std::function< void(const SendMessageArc &)> SendMsgAckCallback
发送消息回执通知回调
Definition: nim_cpp_talk.h:28
std::function< void(const std::list< IMMessage > &)> ReceiveMsgsCallback
批量接收消息通知回调
Definition: nim_cpp_talk.h:32
std::function< void(const BroadcastMessage &)> ReceiveBroadcastMsgCallback
接收广播消息通知回调
Definition: nim_cpp_talk.h:40
std::function< void(const NIMResCode, const std::list< RecallMsgNotify > &)> RecallMsgsCallback
消息撤回通知回调
Definition: nim_cpp_talk.h:38
std::function< bool(const IMMessage &)> TeamNotificationFilter
群通知过滤器
Definition: nim_cpp_talk.h:36
namespace nim
Message 通用辅助方法和数据结构定义
NIMMessageType
Definition: nim_msglog_def.h:270
定义导出宏
#define NIM_SDK_CPPWRAPPER_DLL_API
Definition: nim_sdk_cpp_wrapper.h:38
NIMSessionType
Definition: nim_session_def.h:16
Talk 辅助方法和数据结构定义
NIMResCode
Definition: public_defines.h:21
unsigned char bool
Definition: stdbool.h:25
Definition: nim_talk_def.h:72
Definition: nim_talk_helper.h:708
语音消息附件
Definition: nim_talk_helper.h:610
波特机器人消息附件
Definition: nim_talk_helper.h:666
文件消息附件
Definition: nim_talk_helper.h:494
图片消息附件
Definition: nim_talk_helper.h:551
位置消息附件
Definition: nim_talk_helper.h:578
Definition: nim_talk_helper.h:305
小视频消息附件
Definition: nim_talk_helper.h:633
消息属性设置
Definition: nim_talk_helper.h:24
发送消息回执
Definition: nim_msg_helper.h:24