From ae350dc5fbb7562c26694ff2a17ab2bf092790a9 Mon Sep 17 00:00:00 2001 From: James Booth Date: Thu, 30 May 2013 21:26:11 +0100 Subject: Show nickname rather than jid in room invites --- src/ui/console.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src') 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(); } -- cgit 1.4.1-2-gfad0