about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2022-06-11 12:33:56 +0200
committerGitHub <noreply@github.com>2022-06-11 12:33:56 +0200
commit4d6bc1adf8301dc5dc1986cc868171e2dd9179e1 (patch)
tree185e2fa3c6395c2e46ec1a9223d47335f936ccd7 /src/ui
parent8c313011c0dd1e69db8fec22282fefdbc25b089e (diff)
parent91e8a89b591caf93a5c3b3533f2a538806b181a3 (diff)
downloadprofani-tty-4d6bc1adf8301dc5dc1986cc868171e2dd9179e1.tar.gz
Merge pull request #1717 from MarcoPolo-PasTonMolo/fix/chat-with-self-duplicate-msgs
Fix duplicate messages in chat with oneself.
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/window.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ui/window.c b/src/ui/window.c
index d5578b2a..7bd403da 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -60,6 +60,7 @@
 #include "ui/screen.h"
 #include "xmpp/xmpp.h"
 #include "xmpp/roster_list.h"
+#include "xmpp/connection.h"
 
 #define CONS_WIN_TITLE "Profanity. Type /help for help information."
 #define XML_WIN_TITLE  "XML Console"
@@ -1192,7 +1193,10 @@ win_print_incoming(ProfWin* window, const char* const display_name_from, ProfMes
         if (prefs_get_boolean(PREF_CORRECTION_ALLOW) && message->replace_id) {
             _win_correct(window, message->plain, message->id, message->replace_id, message->from_jid->barejid);
         } else {
-            _win_printf(window, enc_char, 0, message->timestamp, flags, THEME_TEXT_THEM, display_name_from, message->from_jid->barejid, message->id, "%s", message->plain);
+            // Prevent duplicate messages when current client is sending a message
+            if (g_strcmp0(message->from_jid->fulljid, connection_get_fulljid()) != 0) {
+                _win_printf(window, enc_char, 0, message->timestamp, flags, THEME_TEXT_THEM, display_name_from, message->from_jid->barejid, message->id, "%s", message->plain);
+            }
         }
 
         free(enc_char);