Show nickname rather than jid in room invites

This commit is contained in:
James Booth
2013-05-30 21:26:11 +01:00
parent d02e6a82fa
commit ae350dc5fb

View File

@@ -729,9 +729,21 @@ void
cons_show_room_invite(const char * const invitor, const char * const room, cons_show_room_invite(const char * const invitor, const char * const room,
const char * const reason) 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("");
cons_show("Chat room invite received:"); cons_show("Chat room invite received:");
cons_show(" From : %s", invitor); cons_show(" From : %s", display_from);
cons_show(" Room : %s", room); cons_show(" Room : %s", room);
if (reason != NULL) { 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"); cons_show("Use /join or /decline");
if (prefs_get_boolean(PREF_NOTIFY_INVITE)) { 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(); ui_console_dirty();
_cons_alert(); _cons_alert();
} }