summaryrefslogtreecommitdiff
path: root/protocols/VKontakte
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-01-25 21:57:38 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-01-25 21:57:38 +0000
commitc5232695a2c245390904e8a9cd05df2e507f985c (patch)
tree313d78f55cbaa32a20b50e491e0b2b5abd0c511c /protocols/VKontakte
parentb7dc2813cd35d4a8a613b3fb6ef1a1408d86550a (diff)
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
Diffstat (limited to 'protocols/VKontakte')
-rw-r--r--protocols/VKontakte/src/misc.cpp5
-rw-r--r--protocols/VKontakte/src/version.h2
-rw-r--r--protocols/VKontakte/src/vk_chats.cpp17
-rw-r--r--protocols/VKontakte/src/vk_proto.h1
-rw-r--r--protocols/VKontakte/src/vk_thread.cpp1
5 files changed, 22 insertions, 4 deletions
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 <stdver.h>
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)