about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-10-18 20:22:34 +0100
committerJames Booth <boothj5@gmail.com>2014-10-18 20:22:34 +0100
commitfc049c9eefd740fdc2a9a271150cbcca5d7b2022 (patch)
tree4a559b577322f819ae626aeea966fd778400dbd2 /src/command
parent0cc25e1b763cbf396a0bb397183761fc7399b4fe (diff)
downloadprofani-tty-fc049c9eefd740fdc2a9a271150cbcca5d7b2022.tar.gz
Added /privileges command to set UI option for showing roles/affiliations in rooms
Diffstat (limited to 'src/command')
-rw-r--r--src/command/command.c13
-rw-r--r--src/command/commands.c14
-rw-r--r--src/command/commands.h1
3 files changed, 25 insertions, 3 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 1954e927..03dc6e01 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -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],
diff --git a/src/command/commands.c b/src/command/commands.c
index ecd8a7de..ea789192 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -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) {
@@ -2879,6 +2879,16 @@ cmd_leave(gchar **args, struct cmd_help_t help)
 }
 
 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)
 {
     return _cmd_set_boolean_preference(args[0], help, "Sound", PREF_BEEP);
diff --git a/src/command/commands.h b/src/command/commands.h
index 757a09cc..ed393f8a 100644
--- a/src/command/commands.h
+++ b/src/command/commands.h
@@ -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
\ No newline at end of file