diff options
author | George Hazan <ghazan@miranda.im> | 2022-11-03 21:22:06 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-11-03 21:22:06 +0300 |
commit | 19188a13f7bfc07d453df5fe9d42a75a1b4dbe83 (patch) | |
tree | 3e8b6462dbcd52a550389f54e9c679eb3dcded3f /protocols/WhatsApp/src/appsync.cpp | |
parent | 182c8806c47e927f8267e21a45242cb8e8d4f75b (diff) |
WhatsApp: receiving group chats messages
Diffstat (limited to 'protocols/WhatsApp/src/appsync.cpp')
-rw-r--r-- | protocols/WhatsApp/src/appsync.cpp | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/protocols/WhatsApp/src/appsync.cpp b/protocols/WhatsApp/src/appsync.cpp index 36531a5179..8ab4416fc3 100644 --- a/protocols/WhatsApp/src/appsync.cpp +++ b/protocols/WhatsApp/src/appsync.cpp @@ -272,14 +272,27 @@ void WhatsAppProto::ProcessHistorySync(const Wa__HistorySync *pSync) CMStringA szMessageText(GetMessageText(pMessage->message->message)); if (!szMessageText.IsEmpty()) { - PROTORECVEVENT pre = {}; - pre.timestamp = pMessage->message->messagetimestamp; - pre.szMessage = szMessageText.GetBuffer(); - pre.szMsgId = pMessage->message->key->id; - pre.flags = PREF_CREATEREAD; - if (pMessage->message->key->fromme) - pre.flags |= PREF_SENT; - ProtoChainRecvMsg(pUser->hContact, &pre); + auto *key = pMessage->message->key; + if (pUser->bIsGroupChat) { + GCEVENT gce = {m_szModuleName, 0, GC_EVENT_MESSAGE}; + gce.dwFlags = GCEF_UTF8; + gce.pszID.a = pUser->szId; + gce.pszUID.a = key->participant; + gce.bIsMe = key->fromme; + gce.pszText.a = szMessageText.GetBuffer(); + gce.time = pMessage->message->messagetimestamp; + Chat_Event(&gce); + } + else { + PROTORECVEVENT pre = {}; + pre.timestamp = pMessage->message->messagetimestamp; + pre.szMessage = szMessageText.GetBuffer(); + pre.szMsgId = key->id; + pre.flags = PREF_CREATEREAD; + if (key->fromme) + pre.flags |= PREF_SENT; + ProtoChainRecvMsg(pUser->hContact, &pre); + } } } } |