mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Updated /info command for chat and private chat
This commit is contained in:
parent
5c04adde2b
commit
97a497c355
@ -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) {
|
||||
|
2
src/ui.h
2
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);
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user