mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
Show only nick or jid in /wins output
This commit is contained in:
parent
4ae817cd82
commit
694e332384
@ -156,6 +156,16 @@ p_contact_name(const PContact contact)
|
||||
return contact->name;
|
||||
}
|
||||
|
||||
const char *
|
||||
p_contact_name_or_jid(const PContact contact)
|
||||
{
|
||||
if (contact->name != NULL) {
|
||||
return contact->name;
|
||||
} else {
|
||||
return contact->barejid;
|
||||
}
|
||||
}
|
||||
|
||||
static Resource *
|
||||
_highest_presence(Resource *first, Resource *second)
|
||||
{
|
||||
|
@ -35,6 +35,7 @@ gboolean p_contact_remove_resource(PContact contact, const char * const resource
|
||||
void p_contact_free(PContact contact);
|
||||
const char* p_contact_barejid(PContact contact);
|
||||
const char* p_contact_name(PContact contact);
|
||||
const char * p_contact_name_or_jid(const PContact contact);
|
||||
const char* p_contact_presence(PContact contact);
|
||||
const char* p_contact_status(PContact contact);
|
||||
const char* p_contact_subscription(const PContact contact);
|
||||
|
@ -391,16 +391,13 @@ wins_create_summary(void)
|
||||
break;
|
||||
case WIN_CHAT:
|
||||
chat_string = g_string_new("");
|
||||
g_string_printf(chat_string, "%d: Chat %s", ui_index, window->from);
|
||||
PContact contact = roster_get_contact(window->from);
|
||||
|
||||
if (contact != NULL) {
|
||||
if (p_contact_name(contact) != NULL) {
|
||||
GString *chat_name = g_string_new("");
|
||||
g_string_printf(chat_name, " (%s)", p_contact_name(contact));
|
||||
g_string_append(chat_string, chat_name->str);
|
||||
g_string_free(chat_name, TRUE);
|
||||
}
|
||||
PContact contact = roster_get_contact(window->from);
|
||||
if (contact == NULL) {
|
||||
g_string_printf(chat_string, "%d: Chat %s", ui_index, window->from);
|
||||
} else {
|
||||
const char *display_name = p_contact_name_or_jid(contact);
|
||||
g_string_printf(chat_string, "%d: Chat %s", ui_index, display_name);
|
||||
GString *chat_presence = g_string_new("");
|
||||
g_string_printf(chat_presence, " - %s", p_contact_presence(contact));
|
||||
g_string_append(chat_string, chat_presence->str);
|
||||
|
Loading…
x
Reference in New Issue
Block a user