From 9e358610015b039cc47939d41cd22b33f6292529 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Thu, 23 Jan 2020 16:50:43 +0100 Subject: 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. --- src/command/cmd_defs.c | 4 ++++ src/command/cmd_funcs.c | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) (limited to 'src/command') diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c index 17b9d6cb..5e3e556a 100644 --- a/src/command/cmd_defs.c +++ b/src/command/cmd_defs.c @@ -291,6 +291,8 @@ static struct cmd_t command_defs[] = "/roster room unread before|after|off", "/roster room show server", "/roster room hide server", + "/roster room use name", + "/roster room use jid", "/roster private room|group|off", "/roster private char |none", "/roster header char |none", @@ -364,6 +366,8 @@ static struct cmd_t command_defs[] = { "room unread off", "Do not show unread message count for rooms." }, { "room show server", "Show the conference server with room JIDs." }, { "room hide server", "Do not show the conference server with room JIDs." }, + { "room use name", "Use the MUC name as room name." }, + { "room use jid", "Use the JID as room name." }, { "private room", "Show room private chats with the room." }, { "private group", "Show room private chats as a separate roster group." }, { "private off", "Do not show room private chats." }, 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; -- cgit 1.4.1-2-gfad0