about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-04-06 15:48:23 +0200
committerMichael Vetter <jubalh@iodoru.org>2020-04-06 15:48:23 +0200
commitbd116e6ad9d8beaae14de12668c71ea736f43324 (patch)
tree44bd675cd10b5da33f30ce46c0eaa5147d6e146d
parent067bc690f28f32b59714579608a5f1469b1f5212 (diff)
downloadprofani-tty-bd116e6ad9d8beaae14de12668c71ea736f43324.tar.gz
win_print_history() print 'me' on regular chats if we wrote the message
Same behaviour like when we used to get it from the text files.
-rw-r--r--src/ui/window.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ui/window.c b/src/ui/window.c
index 21f0f724..5b0aec8b 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -1235,7 +1235,15 @@ win_print_history(ProfWin *window, const ProfMessage *const message, gboolean is
         }
         g_free(muc_history_color);
     } else {
-        display_name = roster_get_msg_display_name(message->jid->barejid, message->jid->resourcepart);
+        const char *jid = connection_get_fulljid();
+        Jid *jidp = jid_create(jid);
+
+        if (g_strcmp0(jidp->barejid, message->jid->barejid) == 0) {
+            display_name = strdup("me");
+        } else {
+            display_name = roster_get_msg_display_name(message->jid->barejid, message->jid->resourcepart);
+        }
+        jid_destroy(jidp);
     }
 
     buffer_append(window->layout->buffer, "-", 0, message->timestamp, flags, THEME_TEXT_HISTORY, display_name, NULL, message->plain, NULL, NULL);