static void CallbackMediaDownloadResult(int res_code, const char *file_path, const char *call_id, const char *res_id, const char *json_extension, const void *user_data) { if (user_data) { NOS::DownloadMediaCallback* cb = (NOS::DownloadMediaCallback*)user_data; if (*cb) { (*cb)((NIMResCode)res_code, PCharToString(file_path), PCharToString(call_id), PCharToString(res_id)); } } }
static void CallbackDownload(int res_code, const char *file_path, const char *call_id, const char *res_id, const char *json_extension, const void *user_data) { if (user_data) { NOS::DownloadMediaCallback cb = ((DownloadCallbackUserData*)user_data)->callback_result; if (cb) { cb((NIMResCode)res_code, PCharToString(file_path), PCharToString(call_id), PCharToString(res_id)); } delete ((DownloadCallbackUserData*)user_data)->callback_progress_pointer; delete ((DownloadCallbackUserData*)user_data)->callback_speed_pointer; delete ((DownloadCallbackUserData*)user_data)->callback_transfer_pointer; delete (DownloadCallbackUserData*)user_data; } }
static void CallbackGetAudioText(int res_code, const char *text, const char *json_extension, const void *callback) { if (callback) { Tool::GetAudioTextCallback* cb = (Tool::GetAudioTextCallback*)callback; (*cb)(res_code, PCharToString(text)); delete cb; cb = nullptr; } }
static void CallbackSyncComplete(nim::NIMDataSyncType sync_type, nim::NIMDataSyncStatus status, const char *json_attachment, const void *user_data) { if (user_data) { DataSync::DataSyncCallback* cb_pointer = (DataSync::DataSyncCallback*)user_data; if (*cb_pointer) { PostTaskToUIThread(std::bind((*cb_pointer), sync_type, status, PCharToString(json_attachment))); // (*cb_pointer)(sync_type, status); } } }
static void CallbackReceiveMsg(const char *content, const char *json_extension, const void *callback) { if (callback) { Talk::ReceiveMsgCallback* cb_pointer = (Talk::ReceiveMsgCallback*)callback; if (*cb_pointer) { IMMessage msg; ParseReceiveMessage(PCharToString(content), msg); (*cb_pointer)(msg); } } }
static void mp4_record_opt_cb(bool ret, int code, const char *file, __int64 time, const char *json_extension, const void *user_data) { if (user_data) { VChat::Mp4OptCallback* cb_pointer = (VChat::Mp4OptCallback*)user_data; if (*cb_pointer) { (*cb_pointer)(ret, code, PCharToString(file), time); //PostTaskToUIThread(std::bind((*cb_pointer), ret, code, PCharToString(file), time)); } delete user_data; } }
static void OnOptCallback(bool ret, int code, const char *json_extension, const void *user_data) { if (user_data) { VChat::OptCallback* cb_pointer = (VChat::OptCallback*)user_data; if (*cb_pointer) { (*cb_pointer)(ret, code, PCharToString(json_extension)); //PostTaskToUIThread(std::bind((*cb_pointer), ret, code, PCharToString(json_extension))); } delete user_data; } }
static void OnOpt2Callback(int code, __int64 cannel_id, const char *json_extension, const void *user_data) { if (user_data) { VChat::Opt2Callback* cb_pointer = (VChat::Opt2Callback*)user_data; if (*cb_pointer) { (*cb_pointer)(code, cannel_id, PCharToString(json_extension)); //PostTaskToUIThread(std::bind((*cb_pointer), code, cannel_id, PCharToString(json_extension))); } delete user_data; } }
static void CallbackSetRelation(int res_code, const char *accid, bool opt, const char *json_extension, const void *callback) { if (callback) { User::SetRelationCallback* cb_pointer = (User::SetRelationCallback*)callback; if (*cb_pointer) { PostTaskToUIThread(std::bind((*cb_pointer), (NIMResCode)res_code, PCharToString(accid), opt)); //(*cb_pointer)((NIMResCode)res_code, PCharToString(accid), opt); } delete cb_pointer; } }
static void CallbackGetMembersOnline(__int64 room_id, int error_code, const char *result, const char *json_extension, const void *user_data) { if (user_data) { ChatRoom::GetMembersCallback *cb = (ChatRoom::GetMembersCallback*)user_data; if (*cb) { std::list<ChatRoomMemberInfo> infos; ParseChatRoomMemberInfos(PCharToString(result), infos); (*cb)(room_id, error_code, infos); } } }
static void CallbackGetMsgHistoryOnline(__int64 room_id, int error_code, const char *result, const char *json_extension, const void *user_data) { if (user_data) { ChatRoom::GetMsgHistoryCallback *cb = (ChatRoom::GetMsgHistoryCallback*)user_data; if (*cb) { std::list<ChatRoomMessage> msgs; ParseChatRoomMsgs(PCharToString(result), msgs); (*cb)(room_id, error_code, msgs); } } }
static void CallbackSendMsgAck(const char *result, const void *callback) { if (callback) { Talk::SendMsgAckCallback* cb_pointer = (Talk::SendMsgAckCallback*)callback; if (*cb_pointer) { SendMessageArc arc; ParseSendMessageAck(PCharToString(result), arc); (*cb_pointer)(arc); } } }
static void CallbackReceiveMsg(const char *content, const char *json_extension, const void *callback) { if (callback) { Talk::ReveiveMsgCallback* cb_pointer = (Talk::ReveiveMsgCallback*)callback; if (*cb_pointer) { IMMessage msg; ParseReceiveMessage(PCharToString(content), msg); PostTaskToUIThread(std::bind((*cb_pointer), msg)); //(*cb_pointer)(msg); } } }
static void CallbackSendMsgArc(const char *result, const void *callback) { if (callback) { Talk::SendMsgArcCallback* cb_pointer = (Talk::SendMsgArcCallback*)callback; if (*cb_pointer) { SendMessageArc arc; ParseSendMessageArc(PCharToString(result), arc); PostTaskToUIThread(std::bind((*cb_pointer), arc)); //(*cb_pointer)(arc); } } }
static void CallbackEnter(__int64 room_id, int step, int error_code, const char *result, const char *json_extension, const void *user_data) { if (user_data) { ChatRoom::EnterCallback* cb_pointer = (ChatRoom::EnterCallback* )user_data; if (*cb_pointer) { ChatRoomInfo info; ChatRoomMemberInfo my_info; ParseChatRoomEnterCallbackResultInfo(PCharToString(result), info, my_info); (*cb_pointer)(room_id, (NIMChatRoomEnterStep)step, error_code, info, my_info); } } }
static void CallbackSessionChange(int rescode, const char *result, int total_unread_counts, const char *json_extension, const void *user_data) { if (user_data) { Session::DeleteRecentSessionCallabck* cb_pointer = (Session::DeleteRecentSessionCallabck*)user_data; if (*cb_pointer) { SessionData session; ParseSession(PCharToString(result), session); PostTaskToUIThread(std::bind((*cb_pointer), (nim::NIMResCode)rescode, session, total_unread_counts)); //(*cb_pointer)((nim::NIMResCode)rescode, session, total_unread_counts); } } }
static bool FilterTeamNotification(const char *content, const char *json_extension, const void *callback) { if (callback) { Talk::TeamNotificationFilter* cb_point = (Talk::TeamNotificationFilter *)callback; if (*cb_point) { IMMessage msg; ParseReceiveMessage(PCharToString(content), msg); return (*cb_point)(msg); } } return false; }
static void CallbackUserNameCardChange(const char *result_json, const char *json_extension, const void *callback) { if (callback) { User::UserNameCardChangedCallback* cb_pointer = (User::UserNameCardChangedCallback*)callback; if (*cb_pointer) { std::list<UserNameCard> users_info; ParseNameCards(PCharToString(result_json), users_info); PostTaskToUIThread(std::bind((*cb_pointer), users_info)); //(*cb_pointer)(users_info); } } }
// 好友信息变化执行回调函数,不销毁该回调函数 static void CallbackFriendChange(NIMFriendChangeType type, const char *result_json, const char *json_extension, const void *user_data) { if (user_data) { Friend::FriendChangeCallback* cb_pointer = (Friend::FriendChangeCallback*)user_data; if (*cb_pointer) { FriendChangeEvent change_event; change_event.type_ = type; change_event.content_ = PCharToString(result_json); PostTaskToUIThread(std::bind((*cb_pointer), change_event)); //(*cb_pointer)(change_event); } } }
// 获取好友信息后执行回调函数,然后销毁该回调函数 static void CallbackGetFriendProfile(const char *accid, const char *result_json, const char *json_extension, const void *user_data) { if (user_data) { Friend::GetFriendProfileCallback* cb_pointer = (Friend::GetFriendProfileCallback*)user_data; if (*cb_pointer) { FriendProfile friend_profile; ParseFriendProfile(PCharToString(result_json), friend_profile); PostTaskToUIThread(std::bind((*cb_pointer), accid, friend_profile)); //(*cb_pointer)(accid, friend_profile); } delete cb_pointer; } }
static void CallbackQuerySession(int total_unread_count, const char *result, const char *json_extension, const void *user_data) { if (user_data) { Session::QuerySessionListCallabck* cb_pointer = (Session::QuerySessionListCallabck*)user_data; if (*cb_pointer) { SessionDataList sl; ParseSessionList(PCharToString(result), sl); PostTaskToUIThread(std::bind((*cb_pointer), total_unread_count, sl)); //(*cb_pointer)(total_unread_count, sl); } delete cb_pointer; } }
static void CallbackSpecialRelationChange(NIMUserSpecialRelationshipChangeType type, const char *result_json, const char *json_extension, const void *callback) { if (callback) { User::SpecialRelationshipChangedCallback* cb_pointer = (User::SpecialRelationshipChangedCallback*)callback; if (*cb_pointer) { SpecialRelationshipChangeEvent change_event; change_event.type_ = type; change_event.content_ = PCharToString(result_json); PostTaskToUIThread(std::bind((*cb_pointer), change_event)); //(*cb_pointer)(change_event); } } }
static void CallbackUpload(int res_code, const char *url, const char *json_extension, const void *user_data) { if (user_data) { NOS::UploadMediaCallback cb = ((UploadCallbackUserData*)user_data)->callback_result; if (cb) { cb((NIMResCode)res_code, PCharToString(url)); } delete ((UploadCallbackUserData*)user_data)->callback_progress_pointer; delete ((UploadCallbackUserData*)user_data)->callback_speed_pointer; delete ((UploadCallbackUserData*)user_data)->callback_transfer_pointer; delete (UploadCallbackUserData*)user_data; } }
// 获取好友列表后执行回调函数,然后销毁该回调函数 static void CallbackGetFriendsList(int res_code, const char *result_json, const char *json_extension, const void *user_data) { if (user_data) { Friend::GetFriendsListCallback* cb_pointer = (Friend::GetFriendsListCallback*)user_data; if (*cb_pointer) { std::list<FriendProfile> friends_profile; ParseFriendsProfile(PCharToString(result_json), friends_profile); PostTaskToUIThread(std::bind((*cb_pointer), (NIMResCode)res_code, friends_profile)); //(*cb_pointer)((NIMResCode)res_code, friends_profile); } delete cb_pointer; } }
static void CallbackKickother(const char* json_res, const void* callback) { if (callback != nullptr) { KickOtherRes res; Json::Reader reader; Json::Value values; if (reader.parse(PCharToString(json_res), values) && values.isObject()) { res.res_code_ = (NIMResCode)values[kNIMKickoutOtherResErrorCode].asInt(); JsonStrArrayToList(values[kNIMKickoutOtherResDeviceIDs], res.device_ids_); } Client::KickOtherCallback *cb = (Client::KickOtherCallback *)callback; (*cb)(res); } }
static void CallbackGetMuteList(int res_code, const char *mute_black_list_json, const char *json_extension, const void *callback) { if (callback) { User::GetMuteListCallback* cb_pointer = (User::GetMuteListCallback*)callback; if (*cb_pointer) { std::list<BlackListInfo> black_list; std::list<MuteListInfo> mute_list; ParseSpecialListInfo(PCharToString(mute_black_list_json), black_list, mute_list); PostTaskToUIThread(std::bind((*cb_pointer), (NIMResCode)res_code, mute_list)); //(*cb_pointer)((NIMResCode)res_code, mute_list); } delete cb_pointer; } }
static void CallbackKickout(const char* json_res, const void *callback) { if (callback != nullptr) { KickoutRes res; Json::Reader reader; Json::Value values; if (reader.parse(PCharToString(json_res), values) && values.isObject()) { res.client_type_ = (NIMClientType)values[kNIMKickoutClientType].asUInt(); res.kick_reason_ = (NIMKickReason)values[kNIMKickoutReasonCode].asUInt(); } Client::KickoutCallback *cb = (Client::KickoutCallback *)callback; (*cb)(res); } }
static void CallbackMutliSpotLogin(const char* json_res, const void* callback) { if (callback != nullptr) { MultiSpotLoginRes res; Json::Reader reader; Json::Value values; if (reader.parse(PCharToString(json_res), values) && values.isObject()) { res.notify_type_ = (NIMMultiSpotNotifyType)values[kNIMMultiSpotNotifyType].asUInt(); ParseOtherClientsPres(values[kNIMOtherClientsPres], res.other_clients_); } Client::MultiSpotLoginCallback *cb = (Client::MultiSpotLoginCallback *)callback; (*cb)(res); } }
static void CallbackSysmsgChange(const char *result, const char *json_extension, const void *callback) { if (callback) { SystemMsg::ReceiveSysmsgCallback* cb_pointer = (SystemMsg::ReceiveSysmsgCallback*)callback; if (*cb_pointer) { SysMessage msg; if (ParseSysMessage(PCharToString(result), msg)) { PostTaskToUIThread(std::bind((*cb_pointer), msg)); //(*cb_pointer)(msg); } } } }
static void CallbackSendCustomSysmsg(const char *result, const void *callback) { if (callback) { SystemMsg::SendCustomSysmsgCallback* cb_pointer = (SystemMsg::SendCustomSysmsgCallback*)callback; if (*cb_pointer) { SendMessageArc arc; if (ParseSendMessageArc(PCharToString(result), arc)) { PostTaskToUIThread(std::bind((*cb_pointer), arc)); //(*cb_pointer)(arc); } } } }