summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-11-27 14:54:40 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-11-27 14:54:40 +0300
commit2736fc87cc5fb5329f7d5b3a100560da1fd84a1b (patch)
tree26f0733c906cf6c9645b9032d9844e9cc35486ec /protocols/WhatsApp/src
parent719d49ba7d2484e2ff569c2e6a6203fe52dc40ee (diff)
WhatsApp: status changes to be translated into Miranda's status messages
Diffstat (limited to 'protocols/WhatsApp/src')
-rw-r--r--protocols/WhatsApp/src/message.cpp45
1 files changed, 26 insertions, 19 deletions
diff --git a/protocols/WhatsApp/src/message.cpp b/protocols/WhatsApp/src/message.cpp
index 2903d40f49..e8d2b775ec 100644
--- a/protocols/WhatsApp/src/message.cpp
+++ b/protocols/WhatsApp/src/message.cpp
@@ -210,25 +210,32 @@ void WhatsAppProto::ProcessMessage(WAMSG type, const Wa__WebMessageInfo &msg)
if (pUser) {
CMStringA szMessageText(GetMessageText(body));
if (!szMessageText.IsEmpty()) {
- PROTORECVEVENT pre = {};
- pre.timestamp = timestamp;
- pre.szMessage = szMessageText.GetBuffer();
- pre.szMsgId = msgId;
- if (type.bOffline)
- pre.flags |= PREF_CREATEREAD;
- if (key->fromme)
- pre.flags |= PREF_SENT;
- ProtoChainRecvMsg(pUser->hContact, &pre);
-
- if (pUser->bIsGroupChat) {
- GCEVENT gce = {m_szModuleName, 0, GC_EVENT_MESSAGE};
- gce.dwFlags = GCEF_UTF8;
- gce.pszID.a = pUser->szId;
- gce.pszUID.a = participant;
- gce.bIsMe = key->fromme;
- gce.pszText.a = szMessageText.GetBuffer();
- gce.time = timestamp;
- Chat_Event(&gce);
+ // for chats & group chats store message in profile
+ if (type.bPrivateChat || type.bGroupChat) {
+ PROTORECVEVENT pre = {};
+ pre.timestamp = timestamp;
+ pre.szMessage = szMessageText.GetBuffer();
+ pre.szMsgId = msgId;
+ if (type.bOffline)
+ pre.flags |= PREF_CREATEREAD;
+ if (key->fromme)
+ pre.flags |= PREF_SENT;
+ ProtoChainRecvMsg(pUser->hContact, &pre);
+
+ if (pUser->bIsGroupChat) {
+ GCEVENT gce = {m_szModuleName, 0, GC_EVENT_MESSAGE};
+ gce.dwFlags = GCEF_UTF8;
+ gce.pszID.a = pUser->szId;
+ gce.pszUID.a = participant;
+ gce.bIsMe = key->fromme;
+ gce.pszText.a = szMessageText.GetBuffer();
+ gce.time = timestamp;
+ Chat_Event(&gce);
+ }
+ }
+ // translate statuses into status messages
+ else if (type.bOtherStatus || type.bDirectStatus || type.bPeerBroadcast || type.bOtherBroadcast) {
+ setUString(pUser->hContact, "StatusMsg", szMessageText);
}
}
}