about summary refs log tree commit diff stats
path: root/src/command/cmd_funcs.c
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-01-23 16:50:43 +0100
committerMichael Vetter <jubalh@iodoru.org>2020-01-23 16:50:43 +0100
commit9e358610015b039cc47939d41cd22b33f6292529 (patch)
tree9080fdc9bea4be78ef10aed726878565ccc6389b /src/command/cmd_funcs.c
parent3066fd77fcc08eb1d54173e28fd6899618b83605 (diff)
downloadprofani-tty-9e358610015b039cc47939d41cd22b33f6292529.tar.gz
Add `/roster room use` command
`/roster room use name` to use the name of the MUC in the roster list.
`/roster room use jid` to use the jid of the MUC in the roster list.

Display it only in case `/roster room by none` is set so far.
Diffstat (limited to 'src/command/cmd_funcs.c')
-rw-r--r--src/command/cmd_funcs.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index fbb5e581..2c85251e 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -2861,6 +2861,25 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
                 cons_bad_cmd_usage(command);
                 return TRUE;
             }
+        } else if (g_strcmp0(args[1], "use") == 0) {
+            if (g_strcmp0(args[2], "jid") == 0) {
+                cons_show("Roster room display jid as name.");
+                prefs_set_string(PREF_ROSTER_ROOMS_USE_AS_NAME, "jid");
+                if (conn_status == JABBER_CONNECTED) {
+                    rosterwin_roster();
+                }
+                return TRUE;
+            } else if (g_strcmp0(args[2], "name") == 0) {
+                cons_show("Roster room display room name as name.");
+                prefs_set_string(PREF_ROSTER_ROOMS_USE_AS_NAME, "name");
+                if (conn_status == JABBER_CONNECTED) {
+                    rosterwin_roster();
+                }
+                return TRUE;
+            } else {
+                cons_bad_cmd_usage(command);
+                return TRUE;
+            }
         } else {
             cons_bad_cmd_usage(command);
             return TRUE;