summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/WhatsApp/src/message.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/protocols/WhatsApp/src/message.cpp b/protocols/WhatsApp/src/message.cpp
index 3d1bf5e872..ab9da0102a 100644
--- a/protocols/WhatsApp/src/message.cpp
+++ b/protocols/WhatsApp/src/message.cpp
@@ -192,10 +192,14 @@ void WhatsAppProto::ProcessMessage(WAMSG type, const Wa__WebMessageInfo &msg)
debugLogA("Got a message: %s", protobuf_c_text_to_string(&msg).c_str());
uint32_t timestamp = msg.messagetimestamp;
- auto *participant = key->participant;
- auto *chatId = key->remotejid;
+ char *participant = key->participant, *chatId;
auto *msgId = key->id;
+ if (type.bPrivateChat || type.bGroupChat)
+ chatId = key->remotejid;
+ else
+ chatId = (participant) ? participant : key->remotejid;
+
WAUser *pUser = AddUser(chatId, false);
if (!key->fromme && msg.pushname && pUser && !pUser->bIsGroupChat)