From c5232695a2c245390904e8a9cd05df2e507f985c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 25 Jan 2014 21:57:38 +0000 Subject: VKontakte: chats don't go offline when a protocol does git-svn-id: http://svn.miranda-ng.org/main/trunk@7895 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/src/misc.cpp | 5 ++--- protocols/VKontakte/src/version.h | 2 +- protocols/VKontakte/src/vk_chats.cpp | 17 +++++++++++++++++ protocols/VKontakte/src/vk_proto.h | 1 + protocols/VKontakte/src/vk_thread.cpp | 1 + 5 files changed, 22 insertions(+), 4 deletions(-) (limited to 'protocols/VKontakte/src') diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 2de4e27248..a0d8a7abc8 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -27,9 +27,8 @@ void CVkProto::SetAllContactStatuses(int iStatus) { for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { if (isChatRoom(hContact)) - continue; - - if (getWord(hContact, "Status", 0) != iStatus) + SetChatStatus(hContact, iStatus); + else if (getWord(hContact, "Status", 0) != iStatus) setWord(hContact, "Status", iStatus); } } diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h index bd40c52852..babbb11507 100644 --- a/protocols/VKontakte/src/version.h +++ b/protocols/VKontakte/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 1 #define __RELEASE_NUM 0 -#define __BUILD_NUM 8 +#define __BUILD_NUM 9 #include diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index 6d12db1153..686c3f667c 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -287,6 +287,23 @@ CVkChatUser* CVkChatInfo::GetUserById(LPCTSTR ptszId) ///////////////////////////////////////////////////////////////////////////////////////// +void CVkProto::SetChatStatus(HANDLE hContact, int iStatus) +{ + ptrT tszChatID(getTStringA(hContact, "ChatRoomID")); + if (tszChatID == NULL) + return; + + CVkChatInfo *cc = GetChatById(tszChatID); + if (cc == NULL) + return; + + GCDEST gcd = { m_szModuleName, tszChatID, GC_EVENT_CONTROL }; + GCEVENT gce = { sizeof(gce), &gcd }; + CallServiceSync(MS_GC_EVENT, (iStatus == ID_STATUS_OFFLINE) ? SESSION_OFFLINE : SESSION_ONLINE, (LPARAM)&gce); +} + +///////////////////////////////////////////////////////////////////////////////////////// + TCHAR* UnEscapeChatTags(TCHAR* str_in) { TCHAR *s = str_in, *d = str_in; diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index af3bddfa5a..9d104387e2 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -296,6 +296,7 @@ private: void LogMenuHook(CVkChatInfo*, GCHOOK*); void NickMenuHook(CVkChatInfo*, GCHOOK*); LPTSTR ChangeChatTopic(CVkChatInfo*); + void SetChatStatus(HANDLE hContact, int iStatus); CVkChatInfo* GetChatById(LPCTSTR ptszId); INT_PTR __cdecl SvcCreateChat(WPARAM, LPARAM); diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 4030fdad68..384fee7270 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -65,6 +65,7 @@ void CVkProto::OnLoggedOut() KillTimer(NULL, m_timer); SetAllContactStatuses(ID_STATUS_OFFLINE); + m_chats.destroy(); } void CVkProto::SetServerStatus(int iNewStatus) -- cgit v1.2.3