diff options
author | George Hazan <george.hazan@gmail.com> | 2014-01-19 09:45:39 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-01-19 09:45:39 +0000 |
commit | 4d6a4771d90af0056e15ed14c3655b19023359ca (patch) | |
tree | 4eafc6ea875f50f35bca781aee9bcdb2a1d607ed | |
parent | 4c228715064267be315d0c5104c33543f0cd7ff8 (diff) |
chat must be initialized inside ME_SYSTEM_MODULESLOADED
git-svn-id: http://svn.miranda-ng.org/main/trunk@7745 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | protocols/MRA/src/MraChat.cpp | 8 | ||||
-rw-r--r-- | protocols/MRA/src/MraProto.cpp | 6 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.cpp | 24 |
3 files changed, 16 insertions, 22 deletions
diff --git a/protocols/MRA/src/MraChat.cpp b/protocols/MRA/src/MraChat.cpp index ac645e11a7..27573e70eb 100644 --- a/protocols/MRA/src/MraChat.cpp +++ b/protocols/MRA/src/MraChat.cpp @@ -65,17 +65,15 @@ INT_PTR CMraProto::MraChatSessionNew(HANDLE hContact) void CMraProto::MraChatSessionDestroy(HANDLE hContact)
{
- if ( !bChatExists)
+ if (!bChatExists || hContact == NULL)
return;
GCDEST gcd = { m_szModuleName, NULL, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
CMStringW wszEMail;
- if (hContact) {
- mraGetStringW(hContact, "e-mail", wszEMail);
- gcd.ptszID = (LPWSTR)wszEMail.c_str();
- }
+ mraGetStringW(hContact, "e-mail", wszEMail);
+ gcd.ptszID = (LPWSTR)wszEMail.c_str();
CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce);
CallServiceSync(MS_GC_EVENT, WINDOW_CLEARLOG, (LPARAM)&gce);
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index e050882e99..4cab8e9a78 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -60,8 +60,6 @@ CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) : m_iXStatus = getByte(DBSETTING_XSTATUSID, MRA_MIR_XSTATUS_NONE);
if ( !IsXStatusValid(m_iXStatus))
m_iXStatus = MRA_MIR_XSTATUS_NONE;
-
- bChatExists = MraChatRegister();
}
CMraProto::~CMraProto()
@@ -115,9 +113,7 @@ int CMraProto::OnModulesLoaded(WPARAM, LPARAM) db_set_resident(m_szModuleName, DBSETTING_BLOGSTATUSMUSIC);
// destroy all chat sessions
- if (bChatExists)
- MraChatSessionDestroy(NULL);
-
+ bChatExists = MraChatRegister();
return 0;
}
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 102ca3b24e..8c1baa072c 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -55,6 +55,18 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) : m_bServerDelivery = getBool("ServerDelivery", true);
m_bHideChats = getBool("HideChats", true);
+ // Set all contacts offline -- in case we crashed
+ SetAllContactStatuses(ID_STATUS_OFFLINE);
+}
+
+CVkProto::~CVkProto()
+{
+ Netlib_CloseHandle(m_hNetlibUser); m_hNetlibUser = NULL;
+ UninitQueue();
+}
+
+int CVkProto::OnModulesLoaded(WPARAM wParam, LPARAM lParam)
+{
// Chats
GCREGISTER gcr = { sizeof(gcr) };
gcr.ptszDispName = m_tszUserName;
@@ -68,18 +80,6 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) : HookProtoEvent(ME_GC_EVENT, &CVkProto::OnChatEvent);
HookProtoEvent(ME_GC_BUILDMENU, &CVkProto::OnGcMenuHook);
- // Set all contacts offline -- in case we crashed
- SetAllContactStatuses(ID_STATUS_OFFLINE);
-}
-
-CVkProto::~CVkProto()
-{
- Netlib_CloseHandle(m_hNetlibUser); m_hNetlibUser = NULL;
- UninitQueue();
-}
-
-int CVkProto::OnModulesLoaded(WPARAM wParam, LPARAM lParam)
-{
char szService[100];
mir_snprintf(szService, sizeof(szService), "%s%s", m_szModuleName, PS_CREATECHAT);
|