114 lines
4.2 KiB
C++
114 lines
4.2 KiB
C++
#pragma once
|
|
|
|
#include "jsondatamgr.h"
|
|
|
|
namespace ss
|
|
{
|
|
class SS_IM_FriendAgreeRequest;
|
|
class SS_IM_FriendAgreeResponse;
|
|
class SS_IM_FriendDeleteRequest;
|
|
class SS_IM_FriendDeleteResponse;
|
|
class SS_IM_GuildMemberQuitRequest;
|
|
class SS_IM_GuildMemberQuitResponse;
|
|
class SS_IM_GuildMemberUpdateRequest;
|
|
class SS_IM_GuildMemberUpdateResponse;
|
|
class SS_GS_ApplyChangeRequest;
|
|
class SS_IM_ApplyChangeResponse;
|
|
}
|
|
|
|
class Guild;
|
|
struct GuildMember;
|
|
class Player;
|
|
struct timer_list;
|
|
class SyncHelper : public a8::Singleton<SyncHelper>
|
|
{
|
|
public:
|
|
enum { HID = HID_SyncHelper };
|
|
|
|
private:
|
|
SyncHelper() {};
|
|
friend class a8::Singleton<SyncHelper>;
|
|
|
|
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 SyncGuildMemberUpdateOnlyOnline(Guild* guild,
|
|
GuildMember* member,
|
|
int reason);
|
|
|
|
void SyncGuildMemberQuit(Guild* guild,
|
|
const std::string& sender_id,
|
|
const std::string& target_id,
|
|
int reason);
|
|
void SyncGuildMemberQuitOnlyOnline(Guild* guild,
|
|
const std::string& sender_id,
|
|
const std::string& target_id,
|
|
int reason);
|
|
|
|
void SyncGuildApplyed(Guild* guild,
|
|
const std::string& target_id
|
|
);
|
|
void SyncGuildRefuse(Guild* guild,
|
|
const std::string& target_id
|
|
);
|
|
|
|
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);
|
|
void _SS_IM_GuildMemberQuitResponse(f8::MsgHdr& hdr, const ss::SS_IM_GuildMemberQuitResponse& msg);
|
|
void _SS_IM_GuildMemberUpdateResponse(f8::MsgHdr& hdr, const ss::SS_IM_GuildMemberUpdateResponse& msg);
|
|
void _SS_IM_ApplyChangeResponse(f8::MsgHdr& hdr, const ss::SS_IM_ApplyChangeResponse& 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);
|
|
void SS_IM_GuildMemberQuitRequest_TimeOut(ss::SS_IM_GuildMemberQuitRequest* msg);
|
|
void SS_IM_GuildMemberUpdateRequest_TimeOut(ss::SS_IM_GuildMemberUpdateRequest* msg);
|
|
void SS_GS_ApplyChangeRequest_TimeOut(ss::SS_GS_ApplyChangeRequest* msg);
|
|
|
|
void InternalSyncGuildMemberUpdate(Guild* guild,
|
|
GuildMember* member,
|
|
int reason,
|
|
bool only_online);
|
|
|
|
void InternalSyncGuildMemberQuit(Guild* guild,
|
|
const std::string& sender_id,
|
|
const std::string& target_id,
|
|
int reason,
|
|
bool only_online);
|
|
void InternalSyncGuildApplyState(Guild* guild,
|
|
const std::string& target_id,
|
|
int is_refuse);
|
|
|
|
public:
|
|
template <typename T>
|
|
void BroadcastIMConnMsg(T& msg)
|
|
{
|
|
static int msgid = f8::Net_GetMessageId(msg);
|
|
BroadcastIMConnMsg(msgid, msg);
|
|
}
|
|
|
|
void BroadcastIMConnMsg(int msgid, ::google::protobuf::Message& msg);
|
|
|
|
template <typename T>
|
|
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<long long, timer_list*> pending_request_hash_;
|
|
};
|