about summary refs log tree commit diff stats
path: root/src/ui/console.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-05-30 21:26:11 +0100
committerJames Booth <boothj5@gmail.com>2013-05-30 21:26:11 +0100
commitae350dc5fbb7562c26694ff2a17ab2bf092790a9 (patch)
tree90faca645490ce993bfef015f35b2501d32393dd /src/ui/console.c
parentd02e6a82fafd0b674a59226d9091696dd8b26cc6 (diff)
downloadprofani-tty-ae350dc5fbb7562c26694ff2a17ab2bf092790a9.tar.gz
Show nickname rather than jid in room invites
Diffstat (limited to 'src/ui/console.c')
-rw-r--r--src/ui/console.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/ui/console.c b/src/ui/console.c
index 16c5cb11..96c011b1 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -729,9 +729,21 @@ void
 cons_show_room_invite(const char * const invitor, const char * const room,
     const char * const reason)
 {
+    char *display_from = NULL;
+    PContact contact = roster_get_contact(invitor);
+    if (contact != NULL) {
+        if (p_contact_name(contact) != NULL) {
+            display_from = strdup(p_contact_name(contact));
+        } else {
+            display_from = strdup(invitor);
+        }
+    } else {
+        display_from = strdup(invitor);
+    }
+
     cons_show("");
     cons_show("Chat room invite received:");
-    cons_show("  From   : %s", invitor);
+    cons_show("  From   : %s", display_from);
     cons_show("  Room   : %s", room);
 
     if (reason != NULL) {
@@ -741,9 +753,11 @@ cons_show_room_invite(const char * const invitor, const char * const room,
     cons_show("Use /join or /decline");
 
     if (prefs_get_boolean(PREF_NOTIFY_INVITE)) {
-        notify_invite(invitor, room, reason);
+        notify_invite(display_from, room, reason);
     }
 
+    FREE_SET_NULL(display_from);
+
     ui_console_dirty();
     _cons_alert();
 }