Added /privileges command to set UI option for showing roles/affiliations in rooms

This commit is contained in:
James Booth
2014-10-18 20:22:34 +01:00
parent 0cc25e1b76
commit fc049c9eef
10 changed files with 160 additions and 75 deletions

View File

@@ -547,6 +547,17 @@ static struct cmd_t command_defs[] =
"Logout of any current session, and quit Profanity.",
NULL } } },
{ "/privileges",
cmd_privileges, parse_args, 1, 1, &cons_privileges_setting,
{ "/privileges on|off", "Show occupant privileges in chat rooms.",
{ "/privileges on|off",
"---------------------------",
"If enabled:",
"The room roster will be broken down my role.",
"An occupants role and affiliation will be shown when they join a room.",
"Changes to occupant privileges will be shown in the chat room.",
NULL } } },
{ "/beep",
cmd_beep, parse_args, 1, 1, &cons_beep_setting,
{ "/beep on|off", "Terminal beep on new messages.",
@@ -1697,7 +1708,7 @@ _cmd_complete_parameters(char *input, int *size)
// autocomplete boolean settings
gchar *boolean_choices[] = { "/beep", "/intype", "/states", "/outtype",
"/flash", "/splash", "/chlog", "/grlog", "/mouse", "/history", "/titlebar",
"/vercheck" };
"/vercheck", "/privileges" };
for (i = 0; i < ARRAY_SIZE(boolean_choices); i++) {
result = autocomplete_param_with_func(input, size, boolean_choices[i],

View File

@@ -590,7 +590,7 @@ cmd_help(gchar **args, struct cmd_help_t help)
} else if (strcmp(args[0], "groupchat") == 0) {
gchar *filter[] = { "/close", "/clear", "/decline", "/grlog",
"/invite", "/invites", "/join", "/leave", "/notify", "/msg",
"/rooms", "/tiny", "/who", "/nick" };
"/rooms", "/tiny", "/who", "/nick", "/privileges" };
_cmd_show_filtered_help("Groupchat commands", filter, ARRAY_SIZE(filter));
} else if (strcmp(args[0], "presence") == 0) {
@@ -612,7 +612,7 @@ cmd_help(gchar **args, struct cmd_help_t help)
"/chlog", "/flash", "/gone", "/grlog", "/history", "/intype",
"/log", "/mouse", "/notify", "/outtype", "/prefs", "/priority",
"/reconnect", "/roster", "/splash", "/states", "/statuses", "/theme",
"/titlebar", "/vercheck" };
"/titlebar", "/vercheck", "/privileges" };
_cmd_show_filtered_help("Settings commands", filter, ARRAY_SIZE(filter));
} else if (strcmp(args[0], "navigation") == 0) {
@@ -2878,6 +2878,16 @@ cmd_leave(gchar **args, struct cmd_help_t help)
return TRUE;
}
gboolean
cmd_privileges(gchar **args, struct cmd_help_t help)
{
gboolean result = _cmd_set_boolean_preference(args[0], help, "MUC privileges", PREF_MUC_PRIVILEGES);
ui_redraw_all_room_rosters();
return result;
}
gboolean
cmd_beep(gchar **args, struct cmd_help_t help)
{

View File

@@ -131,5 +131,6 @@ gboolean cmd_ban(gchar **args, struct cmd_help_t help);
gboolean cmd_subject(gchar **args, struct cmd_help_t help);
gboolean cmd_affiliation(gchar **args, struct cmd_help_t help);
gboolean cmd_role(gchar **args, struct cmd_help_t help);
gboolean cmd_privileges(gchar **args, struct cmd_help_t help);
#endif