From fdd4c3464bad72ca3b18b013fea6300b3233be2b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 22 Aug 2024 15:06:54 +0300 Subject: =?UTF-8?q?fixes=20#4580=20(Skypeweb:=20=D0=B4=D0=B0=D0=B1=D0=BB-?= =?UTF-8?q?=D0=BA=D0=BB=D0=B8=D0=BA=20=D0=B2=20=D0=BA=D0=BB=D0=B8=D1=81?= =?UTF-8?q?=D1=82=D0=B5=20=D0=BD=D0=B0=20=D0=B3=D1=80=D1=83=D0=BF=D1=87?= =?UTF-8?q?=D0=B0=D1=82,=20=D0=BA=D0=BE=D1=82=D0=BE=D1=80=D1=8B=D0=B9=20?= =?UTF-8?q?=D0=B2=20=D0=BE=D1=84=D1=84=D0=BB=D0=B0=D0=B9=D0=BD=D0=B5,=20?= =?UTF-8?q?=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=D0=B5=D1=82=20=D0=BD=D0=B5?= =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB=D1=8C=D0=BD=D0=BE)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/SkypeWeb/src/skype_chatrooms.cpp | 15 ++++++++++++--- protocols/SkypeWeb/src/skype_history_sync.cpp | 4 ++-- protocols/SkypeWeb/src/skype_proto.h | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) (limited to 'protocols') diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index e3249b18e3..0f04ba1793 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -33,15 +33,22 @@ void CSkypeProto::InitGroupChatModule() CreateProtoService(PS_LEAVECHAT, &CSkypeProto::OnLeaveChatRoom); } -SESSION_INFO* CSkypeProto::StartChatRoom(const wchar_t *tid, const wchar_t *tname) +SESSION_INFO* CSkypeProto::StartChatRoom(const wchar_t *tid, const wchar_t *tname, const char *pszVersion) { // Create the group chat session SESSION_INFO *si = Chat_NewSession(GCW_CHATROOM, m_szModuleName, tid, tname); if (!si) return nullptr; - if (si->arUsers.getCount() == 0) { - // Create a user statuses + bool bFetchInfo = si->arUsers.getCount() == 0; + if (pszVersion) { + CMStringA oldVersion(getMStringA(si->hContact, "Version")); + if (oldVersion != pszVersion) + bFetchInfo = true; + } + + if (bFetchInfo) { + // Create user statuses Chat_AddGroup(si, TranslateT("Admin")); Chat_AddGroup(si, TranslateT("User")); @@ -368,6 +375,8 @@ void CSkypeProto::OnGetChatInfo(MHttpResponse *response, AsyncHttpRequest*) if (si == nullptr) return; + setString(si->hContact, "Version", root["version"].as_string().c_str()); + OBJLIST arIds(1); for (auto &member : root["members"]) { CMStringW username(UrlToSkypeId(member["userLink"].as_mstring())); diff --git a/protocols/SkypeWeb/src/skype_history_sync.cpp b/protocols/SkypeWeb/src/skype_history_sync.cpp index e535374d2e..86616362e1 100644 --- a/protocols/SkypeWeb/src/skype_history_sync.cpp +++ b/protocols/SkypeWeb/src/skype_history_sync.cpp @@ -116,8 +116,8 @@ void CSkypeProto::OnSyncConversations(MHttpResponse *response, AsyncHttpRequest* case 19: { auto &props = it["threadProperties"]; - if (props["members"] && !props["lastleaveat"]) - StartChatRoom(it["id"].as_mstring(), props["topic"].as_mstring()); + if (props["membercount"].as_int() && !props["lastleaveat"]) + StartChatRoom(it["id"].as_mstring(), props["topic"].as_mstring(), props["version"].as_string().c_str()); } __fallthrough; diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index a22705c211..3d890f2eca 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -270,7 +270,7 @@ private: INT_PTR __cdecl OnJoinChatRoom(WPARAM hContact, LPARAM); INT_PTR __cdecl OnLeaveChatRoom(WPARAM hContact, LPARAM); - SESSION_INFO* StartChatRoom(const wchar_t *tid, const wchar_t *tname); + SESSION_INFO* StartChatRoom(const wchar_t *tid, const wchar_t *tname, const char *pszVersion = nullptr); bool OnChatEvent(const JSONNode &node); wchar_t* GetChatContactNick(MCONTACT hContact, const wchar_t *id, const wchar_t *name = nullptr, bool *isQualified = nullptr); -- cgit v1.2.3