From bc47c9bd4f83f19501b49404eea6a17326b5d4cb Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 8 Dec 2022 19:43:11 +0300 Subject: =?UTF-8?q?fixes=20#3252=20(WhatsApp:=20=D0=BF=D1=80=D0=B8=20?= =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B2=D0=BE=D0=BC=20=D0=B2=D1=8B=D1=85=D0=BE?= =?UTF-8?q?=D0=B4=D0=B5=20=D0=B2=20=D1=81=D0=B5=D1=82=D1=8C=20=D0=B3=D1=80?= =?UTF-8?q?=D1=83=D0=BF=D1=87=D0=B0=D1=82=D1=8B=20=D0=BF=D1=80=D0=B8=D0=BB?= =?UTF-8?q?=D0=B5=D1=82=D0=B0=D1=8E=D1=82=20=D0=BA=D0=B0=D0=BA=20"=D0=9D?= =?UTF-8?q?=D0=B5=D0=B8=D0=B7=D0=B2=D0=B5=D1=81=D1=82=D0=BD=D1=8B=D0=B9=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BD=D1=82=D0=B0=D0=BA=D1=82")?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/WhatsApp/src/appsync.cpp | 6 ++++++ protocols/WhatsApp/src/chats.cpp | 10 ++++++++++ protocols/WhatsApp/src/proto.h | 1 + protocols/WhatsApp/src/server.cpp | 6 +----- 4 files changed, 18 insertions(+), 5 deletions(-) (limited to 'protocols/WhatsApp') diff --git a/protocols/WhatsApp/src/appsync.cpp b/protocols/WhatsApp/src/appsync.cpp index 4209160b79..42e911a3b7 100644 --- a/protocols/WhatsApp/src/appsync.cpp +++ b/protocols/WhatsApp/src/appsync.cpp @@ -284,6 +284,9 @@ void WhatsAppProto::ProcessHistorySync(const Wa__HistorySync *pSync) ProtoChainRecvMsg(pUser->hContact, &pre); if (pUser->bIsGroupChat) { + if (pChat->name) + setUString(pUser->hContact, "Nick", pChat->name); + GCEVENT gce = {m_szModuleName, 0, GC_EVENT_MESSAGE}; gce.dwFlags = GCEF_UTF8; gce.pszID.a = pUser->szId; @@ -296,6 +299,9 @@ void WhatsAppProto::ProcessHistorySync(const Wa__HistorySync *pSync) } } } + + if (pSync->synctype == WA__HISTORY_SYNC__HISTORY_SYNC_TYPE__INITIAL_BOOTSTRAP) + GC_RefreshMetadata(); break; case WA__HISTORY_SYNC__HISTORY_SYNC_TYPE__PUSH_NAME: diff --git a/protocols/WhatsApp/src/chats.cpp b/protocols/WhatsApp/src/chats.cpp index 774df86db9..5fbe0cf1ef 100644 --- a/protocols/WhatsApp/src/chats.cpp +++ b/protocols/WhatsApp/src/chats.cpp @@ -7,6 +7,16 @@ Copyright © 2019-22 George Hazan #include "stdafx.h" +void WhatsAppProto::GC_RefreshMetadata() +{ + for (auto &it : m_arUsers) { + if (it->bIsGroupChat) { + GC_GetAllMetadata(); + break; + } + } +} + void WhatsAppProto::GC_GetAllMetadata() { WANodeIq iq(IQ::GET, "w:g2", "@g.us"); diff --git a/protocols/WhatsApp/src/proto.h b/protocols/WhatsApp/src/proto.h index 29f198e298..e6088cd4b8 100644 --- a/protocols/WhatsApp/src/proto.h +++ b/protocols/WhatsApp/src/proto.h @@ -323,6 +323,7 @@ class WhatsAppProto : public PROTO // Group chats ///////////////////////////////////////////////////////////////////////// + void GC_RefreshMetadata(); void GC_GetAllMetadata(); void GC_ParseMetadata(const WANode *pGroup); diff --git a/protocols/WhatsApp/src/server.cpp b/protocols/WhatsApp/src/server.cpp index 0745c08aad..0afe96662d 100644 --- a/protocols/WhatsApp/src/server.cpp +++ b/protocols/WhatsApp/src/server.cpp @@ -292,11 +292,7 @@ void WhatsAppProto::OnLoggedIn() WANodeIq(IQ::GET, "privacy") << XCHILD("privacy"), &WhatsAppProto::OnIqDoNothing); - for (auto &it : m_arUsers) - if (it->bIsGroupChat) { - GC_GetAllMetadata(); - return; - } + GC_RefreshMetadata(); } void WhatsAppProto::OnLoggedOut(void) -- cgit v1.2.3