1
0
Fork 0

Updated /info command for chat and private chat

This commit is contained in:
James Booth 2013-01-20 23:30:15 +00:00
parent 5c04adde2b
commit 97a497c355
4 changed files with 34 additions and 6 deletions

View File

@ -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) {

View File

@ -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);

View File

@ -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)
{

View File

@ -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));