Simplify usage of roster_get_display_name()
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
This commit is contained in:
@@ -295,19 +295,7 @@ chatwin_recipient_gone(ProfChatWin* chatwin)
|
||||
{
|
||||
assert(chatwin != NULL);
|
||||
|
||||
const char* display_usr = NULL;
|
||||
PContact contact = roster_get_contact(chatwin->barejid);
|
||||
if (contact) {
|
||||
if (p_contact_name(contact)) {
|
||||
display_usr = p_contact_name(contact);
|
||||
} else {
|
||||
display_usr = chatwin->barejid;
|
||||
}
|
||||
} else {
|
||||
display_usr = chatwin->barejid;
|
||||
}
|
||||
|
||||
win_println((ProfWin*)chatwin, THEME_GONE, "!", "<- %s has left the conversation.", display_usr);
|
||||
win_println((ProfWin*)chatwin, THEME_GONE, "!", "<- %s has left the conversation.", roster_get_display_name(chatwin->barejid));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -267,20 +267,7 @@ cons_show_tlscert(const TLSCertificate* cert)
|
||||
void
|
||||
cons_show_typing(const char* const barejid)
|
||||
{
|
||||
ProfWin* console = wins_get_console();
|
||||
const char* display_usr = NULL;
|
||||
PContact contact = roster_get_contact(barejid);
|
||||
if (contact) {
|
||||
if (p_contact_name(contact)) {
|
||||
display_usr = p_contact_name(contact);
|
||||
} else {
|
||||
display_usr = barejid;
|
||||
}
|
||||
} else {
|
||||
display_usr = barejid;
|
||||
}
|
||||
|
||||
win_println(console, THEME_TYPING, "-", "!! %s is typing a message…", display_usr);
|
||||
win_println(wins_get_console(), THEME_TYPING, "-", "!! %s is typing a message…", roster_get_display_name(barejid));
|
||||
cons_alert(NULL);
|
||||
}
|
||||
|
||||
@@ -925,17 +912,7 @@ cons_show_status(const char* const barejid)
|
||||
void
|
||||
cons_show_room_invite(const char* const invitor, const char* const room, const char* const reason)
|
||||
{
|
||||
auto_char char* display_from = NULL;
|
||||
PContact contact = roster_get_contact(invitor);
|
||||
if (contact) {
|
||||
if (p_contact_name(contact)) {
|
||||
display_from = strdup(p_contact_name(contact));
|
||||
} else {
|
||||
display_from = strdup(invitor);
|
||||
}
|
||||
} else {
|
||||
display_from = strdup(invitor);
|
||||
}
|
||||
const char* display_from = roster_get_display_name(invitor);
|
||||
|
||||
cons_show("");
|
||||
cons_show("Chat room invite received:");
|
||||
|
||||
@@ -299,18 +299,7 @@ ui_contact_typing(const char* const barejid, const char* const resource)
|
||||
is_current = wins_is_current(window);
|
||||
}
|
||||
if (!is_current || (is_current && prefs_get_boolean(PREF_NOTIFY_TYPING_CURRENT))) {
|
||||
PContact contact = roster_get_contact(barejid);
|
||||
char const* display_usr = NULL;
|
||||
if (contact) {
|
||||
if (p_contact_name(contact)) {
|
||||
display_usr = p_contact_name(contact);
|
||||
} else {
|
||||
display_usr = barejid;
|
||||
}
|
||||
} else {
|
||||
display_usr = barejid;
|
||||
}
|
||||
notify_typing(display_usr);
|
||||
notify_typing(roster_get_display_name(barejid));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user