1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Merge branch 'master' into otr

This commit is contained in:
James Booth 2013-09-01 03:31:32 +01:00
commit 00f216ac95
4 changed files with 27 additions and 19 deletions

View File

@ -156,6 +156,16 @@ p_contact_name(const PContact contact)
return contact->name; 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 * static Resource *
_highest_presence(Resource *first, Resource *second) _highest_presence(Resource *first, Resource *second)
{ {

View File

@ -35,6 +35,7 @@ gboolean p_contact_remove_resource(PContact contact, const char * const resource
void p_contact_free(PContact contact); void p_contact_free(PContact contact);
const char* p_contact_barejid(PContact contact); const char* p_contact_barejid(PContact contact);
const char* p_contact_name(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_presence(PContact contact);
const char* p_contact_status(PContact contact); const char* p_contact_status(PContact contact);
const char* p_contact_subscription(const PContact contact); const char* p_contact_subscription(const PContact contact);

View File

@ -1525,25 +1525,25 @@ static void
_win_handle_switch(const wint_t * const ch) _win_handle_switch(const wint_t * const ch)
{ {
if (*ch == KEY_F(1)) { if (*ch == KEY_F(1)) {
ui_switch_win(0);
} else if (*ch == KEY_F(2)) {
ui_switch_win(1); ui_switch_win(1);
} else if (*ch == KEY_F(3)) { } else if (*ch == KEY_F(2)) {
ui_switch_win(2); ui_switch_win(2);
} else if (*ch == KEY_F(4)) { } else if (*ch == KEY_F(3)) {
ui_switch_win(3); ui_switch_win(3);
} else if (*ch == KEY_F(5)) { } else if (*ch == KEY_F(4)) {
ui_switch_win(4); ui_switch_win(4);
} else if (*ch == KEY_F(6)) { } else if (*ch == KEY_F(5)) {
ui_switch_win(5); ui_switch_win(5);
} else if (*ch == KEY_F(7)) { } else if (*ch == KEY_F(6)) {
ui_switch_win(6); ui_switch_win(6);
} else if (*ch == KEY_F(8)) { } else if (*ch == KEY_F(7)) {
ui_switch_win(7); ui_switch_win(7);
} else if (*ch == KEY_F(9)) { } else if (*ch == KEY_F(8)) {
ui_switch_win(8); ui_switch_win(8);
} else if (*ch == KEY_F(10)) { } else if (*ch == KEY_F(9)) {
ui_switch_win(9); ui_switch_win(9);
} else if (*ch == KEY_F(10)) {
ui_switch_win(0);
} }
} }

View File

@ -391,16 +391,13 @@ wins_create_summary(void)
break; break;
case WIN_CHAT: case WIN_CHAT:
chat_string = g_string_new(""); 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) { PContact contact = roster_get_contact(window->from);
if (p_contact_name(contact) != NULL) { if (contact == NULL) {
GString *chat_name = g_string_new(""); g_string_printf(chat_string, "%d: Chat %s", ui_index, window->from);
g_string_printf(chat_name, " (%s)", p_contact_name(contact)); } else {
g_string_append(chat_string, chat_name->str); const char *display_name = p_contact_name_or_jid(contact);
g_string_free(chat_name, TRUE); g_string_printf(chat_string, "%d: Chat %s", ui_index, display_name);
}
GString *chat_presence = g_string_new(""); GString *chat_presence = g_string_new("");
g_string_printf(chat_presence, " - %s", p_contact_presence(contact)); g_string_printf(chat_presence, " - %s", p_contact_presence(contact));
g_string_append(chat_string, chat_presence->str); g_string_append(chat_string, chat_presence->str);