From f0f2375b09f0016dd38776f40a6745b4b0de1987 Mon Sep 17 00:00:00 2001 From: Jaidyn Ann Date: Tue, 6 Jul 2021 14:27:14 -0500 Subject: [PATCH] (purple) Senderless messages are system messages --- protocols/purple/PurpleApp.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/protocols/purple/PurpleApp.cpp b/protocols/purple/PurpleApp.cpp index 32e29a9..508a842 100644 --- a/protocols/purple/PurpleApp.cpp +++ b/protocols/purple/PurpleApp.cpp @@ -1057,12 +1057,15 @@ signal_received_chat_msg(PurpleAccount* account, char* sender, char* message, if (chat_id.IsEmpty() == true) chat_id = sender; - BMessage chat(IM_MESSAGE); - chat.AddInt32("im_what", IM_MESSAGE_RECEIVED); - chat.AddString("chat_id", chat_id); - chat.AddString("user_id", sender); - chat.AddString("body", purple_unescape_text(message)); - ((PurpleApp*)be_app)->SendMessage(account, chat); + PurpleConvChat* chat = purple_conversation_get_chat_data(conv); + + BMessage msg(IM_MESSAGE); + msg.AddInt32("im_what", IM_MESSAGE_RECEIVED); + msg.AddString("chat_id", chat_id); + if (chat == NULL || purple_conv_chat_find_user(chat, sender) == true) + msg.AddString("user_id", sender); + msg.AddString("body", purple_unescape_text(message)); + ((PurpleApp*)be_app)->SendMessage(account, msg); }