From 2736fc87cc5fb5329f7d5b3a100560da1fd84a1b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 27 Nov 2022 14:54:40 +0300 Subject: WhatsApp: status changes to be translated into Miranda's status messages --- protocols/WhatsApp/src/message.cpp | 45 ++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 19 deletions(-) (limited to 'protocols/WhatsApp') 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); } } } -- cgit v1.2.3