From b78e769632abed8e8d56f34a7b1bf95258ddba72 Mon Sep 17 00:00:00 2001 From: Sergey Bolhovskoy Date: Thu, 11 Aug 2016 17:30:58 +0000 Subject: VKontakte: fix vkLang list default item index fix creating left chats git-svn-id: http://svn.miranda-ng.org/main/trunk@17178 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/src/vk_chats.cpp | 9 ++++++++- protocols/VKontakte/src/vk_messages.cpp | 2 +- protocols/VKontakte/src/vk_options.cpp | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'protocols/VKontakte') diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index fbfbca0e3c..f26d1ae631 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -33,6 +33,13 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg) debugLogW(L"CVkProto::AppendChat"); if (id == 0) return NULL; + + if (jnDlg) { + CMStringW action_chat = jnDlg["action"].as_mstring(); + int action_mid = _wtoi(jnDlg["action_mid"].as_mstring()); + if ((action_chat == L"chat_kick_user") && (action_mid == m_myUserId)) + return NULL; + } MCONTACT chatContact = FindChat(id); if (chatContact && getBool(chatContact, "kicked")) @@ -84,7 +91,7 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg) db_unset(gci.hContact, m_szModuleName, "off"); - if (jnDlg["left"].as_bool()) { + if (jnDlg && jnDlg["left"].as_bool()) { setByte(gci.hContact, "off", 1); m_chats.remove(c); return NULL; diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp index 48b4be85f8..917d8aa98b 100644 --- a/protocols/VKontakte/src/vk_messages.cpp +++ b/protocols/VKontakte/src/vk_messages.cpp @@ -282,7 +282,7 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe debugLogA("CVkProto::OnReceiveMessages chat_id != 0"); CMStringW action_chat = jnMsg["action"].as_mstring(); int action_mid = _wtoi(jnMsg["action_mid"].as_mstring()); - if ((action_chat == "chat_kick_user") && (action_mid == m_myUserId)) + if ((action_chat == L"chat_kick_user") && (action_mid == m_myUserId)) KickFromChat(chat_id, uid, jnMsg, jnFUsers); else { MCONTACT chatContact = FindChat(chat_id); diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp index 0f6d9067c1..01629da714 100644 --- a/protocols/VKontakte/src/vk_options.cpp +++ b/protocols/VKontakte/src/vk_options.cpp @@ -186,9 +186,9 @@ void CVkOptionAccountForm::OnInitDialog() iListIndex = 0; for (size_t i = 0; i < _countof(vkLangCodes); i++) { - int cur = m_cbxVKLang.AddString(TranslateW(vkLangCodes[i].szDescription), (LPARAM)vkLangCodes[i].szCode); + m_cbxVKLang.InsertString(TranslateW(vkLangCodes[i].szDescription), i, (LPARAM)vkLangCodes[i].szCode); if (!mir_wstrcmpi(vkLangCodes[i].szCode, m_proto->m_vkOptions.pwszVKLang)) - iListIndex = cur; + iListIndex = i; } m_cbxVKLang.SetCurSel(iListIndex); -- cgit v1.2.3