summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/WhatsApp/src')
-rw-r--r--protocols/WhatsApp/src/appsync.cpp6
-rw-r--r--protocols/WhatsApp/src/chats.cpp10
-rw-r--r--protocols/WhatsApp/src/proto.h1
-rw-r--r--protocols/WhatsApp/src/server.cpp6
4 files changed, 18 insertions, 5 deletions
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<WhatsAppProto>
// 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)