mirror of
https://github.com/profanity-im/profanity.git
synced 2024-09-29 19:56:07 -04:00
Added /roster show|hide resource
This commit is contained in:
parent
f715c0580c
commit
eace543da5
@ -169,15 +169,17 @@ static struct cmd_t command_defs[] =
|
|||||||
|
|
||||||
{ "/roster",
|
{ "/roster",
|
||||||
cmd_roster, parse_args_with_freetext, 0, 3, NULL,
|
cmd_roster, parse_args_with_freetext, 0, 3, NULL,
|
||||||
{ "/roster [show|hide|add|remove|nick|clearnick] [offline] [jid] [nickname]", "Manage your roster.",
|
{ "/roster [show|hide|add|remove|nick|clearnick] [offline|resource] [jid] [nickname]", "Manage your roster.",
|
||||||
{ "/roster [show|hide|add|remove|nick|clearnick] [offline] [jid] [nickname]",
|
{ "/roster [show|hide|add|remove|nick|clearnick] [offline|resource] [jid] [nickname]",
|
||||||
"------------------------------------------------------------------------",
|
"---------------------------------------------------------------------------------",
|
||||||
"View, add to, and remove from your roster.",
|
"View, add to, and remove from your roster.",
|
||||||
"Passing no arguments lists all contacts in your roster.",
|
"Passing no arguments lists all contacts in your roster.",
|
||||||
"show - Show the roster panel in the console window.",
|
"show - Show the roster panel in the console window.",
|
||||||
"hide - Hide the roster panel.",
|
"hide - Hide the roster panel.",
|
||||||
"show offline - Show offline contacts in the roster panel.",
|
"show offline - Show offline contacts in the roster panel.",
|
||||||
"hide offline - Hide offline contacts in the roster panel.",
|
"hide offline - Hide offline contacts in the roster panel.",
|
||||||
|
"show resource - Show contact's connected resources in the roster panel.",
|
||||||
|
"hide resource - Hide contact's connected resources in the roster panel.",
|
||||||
"add - Add a new item, jid is required, nickname is optional.",
|
"add - Add a new item, jid is required, nickname is optional.",
|
||||||
"remove - Removes a contact, jid is required.",
|
"remove - Removes a contact, jid is required.",
|
||||||
"nick - Changes a contacts nickname, both jid and nickname are required,",
|
"nick - Changes a contacts nickname, both jid and nickname are required,",
|
||||||
@ -1240,6 +1242,7 @@ cmd_init(void)
|
|||||||
|
|
||||||
roster_option_ac = autocomplete_new();
|
roster_option_ac = autocomplete_new();
|
||||||
autocomplete_add(roster_option_ac, "offline");
|
autocomplete_add(roster_option_ac, "offline");
|
||||||
|
autocomplete_add(roster_option_ac, "resource");
|
||||||
|
|
||||||
group_ac = autocomplete_new();
|
group_ac = autocomplete_new();
|
||||||
autocomplete_add(group_ac, "show");
|
autocomplete_add(group_ac, "show");
|
||||||
|
@ -1342,6 +1342,11 @@ cmd_roster(gchar **args, struct cmd_help_t help)
|
|||||||
prefs_set_boolean(PREF_ROSTER_OFFLINE, TRUE);
|
prefs_set_boolean(PREF_ROSTER_OFFLINE, TRUE);
|
||||||
ui_roster();
|
ui_roster();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
} else if (g_strcmp0(args[1], "resource") == 0) {
|
||||||
|
cons_show("Roster resource enabled");
|
||||||
|
prefs_set_boolean(PREF_ROSTER_RESOURCE, TRUE);
|
||||||
|
ui_roster();
|
||||||
|
return TRUE;
|
||||||
} else {
|
} else {
|
||||||
cons_show("Usage: %s", help.usage);
|
cons_show("Usage: %s", help.usage);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -1357,6 +1362,11 @@ cmd_roster(gchar **args, struct cmd_help_t help)
|
|||||||
prefs_set_boolean(PREF_ROSTER_OFFLINE, FALSE);
|
prefs_set_boolean(PREF_ROSTER_OFFLINE, FALSE);
|
||||||
ui_roster();
|
ui_roster();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
} else if (g_strcmp0(args[1], "resource") == 0) {
|
||||||
|
cons_show("Roster resource disabled");
|
||||||
|
prefs_set_boolean(PREF_ROSTER_RESOURCE, FALSE);
|
||||||
|
ui_roster();
|
||||||
|
return TRUE;
|
||||||
} else {
|
} else {
|
||||||
cons_show("Usage: %s", help.usage);
|
cons_show("Usage: %s", help.usage);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -948,6 +948,16 @@ _cons_roster_setting(void)
|
|||||||
cons_show("Roster (/roster) : show");
|
cons_show("Roster (/roster) : show");
|
||||||
else
|
else
|
||||||
cons_show("Roster (/roster) : hide");
|
cons_show("Roster (/roster) : hide");
|
||||||
|
|
||||||
|
if (prefs_get_boolean(PREF_ROSTER_OFFLINE))
|
||||||
|
cons_show("Roster offline (/roster) : show");
|
||||||
|
else
|
||||||
|
cons_show("Roster offline (/roster) : hide");
|
||||||
|
|
||||||
|
if (prefs_get_boolean(PREF_ROSTER_RESOURCE))
|
||||||
|
cons_show("Roster resource (/roster) : show");
|
||||||
|
else
|
||||||
|
cons_show("Roster resource (/roster) : hide");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2835,6 +2835,7 @@ _ui_roster(void)
|
|||||||
|
|
||||||
wattroff(window->subwin, presence_colour);
|
wattroff(window->subwin, presence_colour);
|
||||||
|
|
||||||
|
if (prefs_get_boolean(PREF_ROSTER_RESOURCE)) {
|
||||||
GList *resources = p_contact_get_available_resources(contact);
|
GList *resources = p_contact_get_available_resources(contact);
|
||||||
GList *ordered_resources = NULL;
|
GList *ordered_resources = NULL;
|
||||||
|
|
||||||
@ -2865,6 +2866,7 @@ _ui_roster(void)
|
|||||||
g_list_free(ordered_resources);
|
g_list_free(ordered_resources);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
curr_contact = g_slist_next(curr_contact);
|
curr_contact = g_slist_next(curr_contact);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user