diff --git a/src/command.c b/src/command.c index c4fe9353..229d0145 100644 --- a/src/command.c +++ b/src/command.c @@ -1682,13 +1682,13 @@ _cmd_info(gchar **args, struct cmd_help_t help) if (usr != NULL) { win_current_show("No parameter required when in chat."); } else { - win_show_status(); + win_show_info(); } } else if (win_current_is_private()) { if (usr != NULL) { win_current_show("No parameter required when in chat."); } else { - win_private_show_status(); + win_private_show_info(); } } else { if (usr != NULL) { diff --git a/src/ui.h b/src/ui.h index 9dc9cb4e..1f8b81d5 100644 --- a/src/ui.h +++ b/src/ui.h @@ -136,6 +136,8 @@ void win_room_show_status(const char * const contact); void win_room_show_info(const char * const contact); void win_show_status(void); void win_private_show_status(void); +void win_show_info(void); +void win_private_show_info(void); // console window actions void cons_about(void); diff --git a/src/windows.c b/src/windows.c index 46bac6ea..06fab840 100644 --- a/src/windows.c +++ b/src/windows.c @@ -1174,6 +1174,32 @@ cons_show_info(const char * const contact) } } +void +win_show_info(void) +{ + PContact pcontact = contact_list_get_contact(win_current_get_recipient()); + + if (pcontact != NULL) { + _win_show_info(current->win, pcontact); + } else { + win_current_show("No such contact \"%s\" in roster.", win_current_get_recipient()); + } +} + +void +win_private_show_info(void) +{ + Jid *jid = jid_create(win_current_get_recipient()); + + PContact pcontact = muc_get_participant(jid->barejid, jid->resourcepart); + + if (pcontact != NULL) { + _win_show_info(current->win, pcontact); + } else { + win_current_show("No such participant \"%s\" in room.", jid->resourcepart); + } +} + void cons_show_status(const char * const contact) { diff --git a/tests/test_contact_list.c b/tests/test_contact_list.c index f04e80d5..0f6d48bf 100644 --- a/tests/test_contact_list.c +++ b/tests/test_contact_list.c @@ -191,7 +191,7 @@ static void test_status_when_no_value(void) static void update_show(void) { contact_list_add("James", NULL, "away", NULL, NULL, FALSE); - contact_list_update_contact("James", "dnd", NULL, NULL); + contact_list_update_contact("James", "dnd", NULL, NULL, NULL); GSList *list = get_contact_list(); assert_int_equals(1, g_slist_length(list)); @@ -203,7 +203,7 @@ static void update_show(void) static void set_show_to_null(void) { contact_list_add("James", NULL, "away", NULL, NULL, FALSE); - contact_list_update_contact("James", NULL, NULL, NULL); + contact_list_update_contact("James", NULL, NULL, NULL, NULL); GSList *list = get_contact_list(); assert_int_equals(1, g_slist_length(list)); @@ -215,7 +215,7 @@ static void set_show_to_null(void) static void update_status(void) { contact_list_add("James", NULL, NULL, "I'm not here right now", NULL, FALSE); - contact_list_update_contact("James", NULL, "Gone to lunch", NULL); + contact_list_update_contact("James", NULL, "Gone to lunch", NULL, NULL); GSList *list = get_contact_list(); assert_int_equals(1, g_slist_length(list)); @@ -227,7 +227,7 @@ static void update_status(void) static void set_status_to_null(void) { contact_list_add("James", NULL, NULL, "Gone to lunch", NULL, FALSE); - contact_list_update_contact("James", NULL, NULL, NULL); + contact_list_update_contact("James", NULL, NULL, NULL, NULL); GSList *list = get_contact_list(); assert_int_equals(1, g_slist_length(list));