From abe9d0be8881fe59c0d55ecaa50446ae784e4f44 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 21 Jan 2014 13:35:02 +0000 Subject: chat init must be done inside ME_SYSTEM_MODULESLOADED git-svn-id: http://svn.miranda-ng.org/main/trunk@7810 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/WhatsApp/src/proto.cpp | 27 +++++++++++++++------------ protocols/WhatsApp/src/proto.h | 1 + 2 files changed, 16 insertions(+), 12 deletions(-) (limited to 'protocols/WhatsApp') diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp index 892ad9e373..6b61cca21c 100644 --- a/protocols/WhatsApp/src/proto.cpp +++ b/protocols/WhatsApp/src/proto.cpp @@ -14,9 +14,9 @@ WhatsAppProto::WhatsAppProto(const char* proto_name, const TCHAR* username) : CreateProtoService(PS_JOINCHAT, &WhatsAppProto::OnJoinChat); CreateProtoService(PS_LEAVECHAT, &WhatsAppProto::OnLeaveChat); - HookProtoEvent(ME_GC_EVENT, &WhatsAppProto::OnChatOutgoing); - HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &WhatsAppProto::OnBuildStatusMenu); HookProtoEvent(ME_OPT_INITIALISE, &WhatsAppProto::OnOptionsInit); + HookProtoEvent(ME_SYSTEM_MODULESLOADED, &WhatsAppProto::OnModulesLoaded); + HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &WhatsAppProto::OnBuildStatusMenu); this->InitContactMenus(); @@ -37,16 +37,6 @@ WhatsAppProto::WhatsAppProto(const char* proto_name, const TCHAR* username) : def_avatar_folder_ = std::tstring( VARST( _T("%miranda_avatarcache%"))) + _T("\\") + m_tszUserName; - // Register group chat - GCREGISTER gcr = { sizeof(gcr) }; - gcr.dwFlags = GC_TYPNOTIF | GC_CHANMGR; - gcr.ptszDispName = m_tszUserName; - gcr.pszModule = m_szModuleName; - CallServiceSync(MS_GC_REGISTER, 0, (LPARAM)&gcr); - - //HookProtoEvent(ME_GC_EVENT, &CMsnProto::MSN_GCEventHook); - //HookProtoEvent(ME_GC_BUILDMENU, &CMsnProto::MSN_GCMenuHook); - SetAllContactStatuses(ID_STATUS_OFFLINE, true); } @@ -58,6 +48,19 @@ WhatsAppProto::~WhatsAppProto() delete this->challenge; } +int WhatsAppProto::OnModulesLoaded(WPARAM wParam, LPARAM lParam) +{ + // Register group chat + GCREGISTER gcr = { sizeof(gcr) }; + gcr.dwFlags = GC_TYPNOTIF | GC_CHANMGR; + gcr.ptszDispName = m_tszUserName; + gcr.pszModule = m_szModuleName; + CallServiceSync(MS_GC_REGISTER, 0, (LPARAM)&gcr); + + HookProtoEvent(ME_GC_EVENT, &WhatsAppProto::OnChatOutgoing); + return 0; +} + DWORD_PTR WhatsAppProto::GetCaps( int type, HANDLE hContact ) { switch(type) diff --git a/protocols/WhatsApp/src/proto.h b/protocols/WhatsApp/src/proto.h index 0afa3e3a55..d8bdab70a6 100644 --- a/protocols/WhatsApp/src/proto.h +++ b/protocols/WhatsApp/src/proto.h @@ -86,6 +86,7 @@ public: INT_PTR __cdecl OnLeaveChat(WPARAM, LPARAM); INT_PTR __cdecl OnCreateGroup(WPARAM,LPARAM); int __cdecl OnOptionsInit(WPARAM, LPARAM); + int __cdecl OnModulesLoaded(WPARAM, LPARAM); int __cdecl RefreshBuddyList(WPARAM, LPARAM); int __cdecl RequestFriendship(WPARAM, LPARAM); -- cgit v1.2.3