diff options
author | ElzorFox <elzorfox@ya.ru> | 2023-06-14 09:02:18 +0500 |
---|---|---|
committer | ElzorFox <elzorfox@ya.ru> | 2023-06-14 09:02:18 +0500 |
commit | de65c80f387918d775301b58f83b9cc9a8e0084a (patch) | |
tree | 949333a188c92a78c588c38b1f6ad7379360fe68 /protocols/VKontakte | |
parent | 4e4e3037567a09543ad1a26d5586d3cb28e3ef83 (diff) |
VKontakte:
avatar support for groupchats
version bump
Diffstat (limited to 'protocols/VKontakte')
-rw-r--r-- | protocols/VKontakte/src/version.h | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_chats.cpp | 15 |
2 files changed, 15 insertions, 2 deletions
diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h index f7b1af5c5a..f242dce88d 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 14
-#define __BUILD_NUM 6
+#define __BUILD_NUM 7
#include <stdver.h>
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index e0e5d09d51..b8894afead 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -131,12 +131,13 @@ CVkChatInfo* CVkProto::AppendConversationChat(int iChatId, const JSONNode& jnIte if (vkChatInfo != nullptr)
return vkChatInfo;
- CMStringW wszTitle, wszState;
+ CMStringW wszTitle, wszState, wszAvatar;
vkChatInfo = new CVkChatInfo(iChatId);
if (jnChatSettings) {
wszTitle = jnChatSettings["title"].as_mstring();
vkChatInfo->m_wszTopic = mir_wstrdup(!wszTitle.IsEmpty() ? wszTitle : L"");
wszState = jnChatSettings["state"].as_mstring();
+ wszAvatar = jnChatSettings["photo"] ? jnChatSettings["photo"]["photo_100"].as_mstring() : "";
}
CMStringW sid;
@@ -160,6 +161,11 @@ CVkChatInfo* CVkProto::AppendConversationChat(int iChatId, const JSONNode& jnIte CMStringW wszHomepage(FORMAT, L"https://vk.com/im?sel=c%d", iChatId);
setWString(si->hContact, "Homepage", wszHomepage);
+ if (!wszAvatar.IsEmpty()) {
+ SetAvatarUrl(si->hContact, wszAvatar);
+ ReloadAvatarInfo(si->hContact);
+ }
+
db_unset(si->hContact, m_szModuleName, "off");
if (jnChatSettings && wszState != L"in") {
@@ -209,6 +215,13 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe if (jnInfo["title"])
SetChatTitle(cc, jnInfo["title"].as_mstring());
+
+ CMStringW wszValue = jnInfo["photo_100"].as_mstring();
+ if (!wszValue.IsEmpty()) {
+ SetAvatarUrl(cc->m_si->hContact, wszValue);
+ ReloadAvatarInfo(cc->m_si->hContact);
+ }
+
if (jnInfo["left"].as_bool() || jnInfo["kicked"].as_bool()) {
setByte(cc->m_si->hContact, "kicked", jnInfo["kicked"].as_bool());
LeaveChat(cc->m_iChatId);
|