summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-01-21 13:35:02 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-01-21 13:35:02 +0000
commitabe9d0be8881fe59c0d55ecaa50446ae784e4f44 (patch)
treedb4dc6e57e3d824df55ab03052f0b27bb2e23344
parentdc16fa8c5fa2e477b6ce896b8eb237462735baae (diff)
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
-rw-r--r--protocols/WhatsApp/src/proto.cpp27
-rw-r--r--protocols/WhatsApp/src/proto.h1
2 files changed, 16 insertions, 12 deletions
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);