49 lines
1.4 KiB
C++
49 lines
1.4 KiB
C++
#pragma once
|
|
|
|
namespace ss
|
|
{
|
|
class MFIMMsgConext;
|
|
class SS_IM_ForwardGuildCMMsg;
|
|
class SS_IM_ForwardGuildSMMsg;
|
|
}
|
|
|
|
class Guild;
|
|
class AsyncGuildTask;
|
|
class GuildMgr : public a8::Singleton<GuildMgr>
|
|
{
|
|
public:
|
|
enum { HID = HID_GuildMgr };
|
|
private:
|
|
GuildMgr() {};
|
|
friend class a8::Singleton<GuildMgr>;
|
|
|
|
public:
|
|
void Init();
|
|
void UnInit();
|
|
|
|
Guild* GetGuild(long long guild_id);
|
|
|
|
template <typename T>
|
|
void ForwardGuildSMMsg(int socket_handle, const ss::MFIMMsgConext& context, T& smmsg)
|
|
{
|
|
static int msgid = f8::Net_GetMessageId(smmsg);
|
|
ForwardGuildSMMsg(socket_handle, context, msgid, smmsg);
|
|
}
|
|
void ForwardGuildSMMsg(int socket_handle,
|
|
const ss::MFIMMsgConext& context,
|
|
int msgid,
|
|
const ::google::protobuf::Message& smmsg);
|
|
void _SS_IM_ForwardGuildCMMsg(f8::MsgHdr& hdr, const ss::SS_IM_ForwardGuildCMMsg& msg);
|
|
void _SS_IM_ForwardGuildSMMsg(f8::MsgHdr& hdr, const ss::SS_IM_ForwardGuildSMMsg& msg);
|
|
|
|
private:
|
|
void CreateAsyncTask(int socket_handle, long long guild_id, AsyncGuildTask* task);
|
|
void LoadGuild(long long guild_id);
|
|
bool IsValidGuildId(long long guild_id);
|
|
|
|
private:
|
|
std::map<long long, Guild*> id_hash_;
|
|
std::set<long long> pending_guild_hash_;
|
|
std::map<long long, std::list<AsyncGuildTask*>> task_hash_;
|
|
};
|