#pragma once #include "jsondatamgr.h" namespace ss { class SS_IM_FriendAgreeRequest; class SS_IM_FriendAgreeResponse; class SS_IM_FriendDeleteRequest; class SS_IM_FriendDeleteResponse; } class Guild; struct GuildMember; class Player; struct timer_list; class SyncHelper : public a8::Singleton { public: enum { HID = HID_SyncHelper }; private: SyncHelper() {}; friend class a8::Singleton; public: void Init(); void UnInit(); void SyncNewFriend(Player* hum, const std::string& target_id); void SyncDeleteFriend(Player* hum, const std::string& target_id, int reason); void SyncUpdateFriend(Player* hum, const std::string& target_id); void SyncApplyFriend(Player* hum, const std::string& target_id); void SyncGuildMemberUpdate(Guild* guild, GuildMember* member, int reason); void SyncGuildMemberQuit(Guild* guild, const std::string& sender_id, const std::string& target_id, int reason); void _SS_IM_FriendAgreeResponse(f8::MsgHdr& hdr, const ss::SS_IM_FriendAgreeResponse& msg); void _SS_IM_FriendDeleteResponse(f8::MsgHdr& hdr, const ss::SS_IM_FriendDeleteResponse& msg); private: void RemovePendingRequest(long long seqid); void SS_IM_FriendAgreeRequest_TimeOut(ss::SS_IM_FriendAgreeRequest* msg); void SS_IM_FriendDeleteRequest_TimeOut(ss::SS_IM_FriendDeleteRequest* msg); public: template void BroadcastIMConnMsg(T& msg) { static int msgid = f8::Net_GetMessageId(msg); BroadcastIMConnMsg(msgid, msg); } void BroadcastIMConnMsg(int msgid, ::google::protobuf::Message& msg); template void SendIMConnMsg(int instance_id, const T& msg) { static int msgid = f8::Net_GetMessageId(msg); SendIMConnMsg(instance_id, msgid, msg); } void SendIMConnMsg(int instance_id, int msgid, const ::google::protobuf::Message& msg); std::map pending_request_hash_; };