diff options
author | James Booth <boothj5@gmail.com> | 2018-01-21 18:49:07 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2018-01-21 18:56:20 +0000 |
commit | 4c7396e77d94a1b5d2f25ed38d2dbc82dc79623d (patch) | |
tree | 9c1eb72d36090931bf3a37d0b960fcea1c22aca9 /src/command | |
parent | 250e972b7a6b4df1e77a073d85c29dd0ccf8adb8 (diff) | |
download | profani-tty-4c7396e77d94a1b5d2f25ed38d2dbc82dc79623d.tar.gz |
Allow hiding room server in roster
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/cmd_ac.c | 16 | ||||
-rw-r--r-- | src/command/cmd_defs.c | 4 | ||||
-rw-r--r-- | src/command/cmd_funcs.c | 24 |
3 files changed, 44 insertions, 0 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c index 5eabd026..8e53bb10 100644 --- a/src/command/cmd_ac.c +++ b/src/command/cmd_ac.c @@ -143,6 +143,7 @@ static Autocomplete roster_presence_ac; static Autocomplete roster_char_ac; static Autocomplete roster_remove_all_ac; static Autocomplete roster_room_ac; +static Autocomplete roster_room_show_ac; static Autocomplete roster_room_position_ac; static Autocomplete roster_room_by_ac; static Autocomplete roster_room_order_ac; @@ -469,6 +470,11 @@ cmd_ac_init(void) autocomplete_add(roster_room_ac, "order"); autocomplete_add(roster_room_ac, "unread"); autocomplete_add(roster_room_ac, "private"); + autocomplete_add(roster_room_ac, "show"); + autocomplete_add(roster_room_ac, "hide"); + + roster_room_show_ac = autocomplete_new(); + autocomplete_add(roster_room_show_ac, "server"); roster_room_by_ac = autocomplete_new(); autocomplete_add(roster_room_by_ac, "service"); @@ -979,6 +985,7 @@ cmd_ac_reset(ProfWin *window) autocomplete_reset(roster_count_ac); autocomplete_reset(roster_order_ac); autocomplete_reset(roster_room_ac); + autocomplete_reset(roster_room_show_ac); autocomplete_reset(roster_room_by_ac); autocomplete_reset(roster_unread_ac); autocomplete_reset(roster_room_position_ac); @@ -1098,6 +1105,7 @@ cmd_ac_uninit(void) autocomplete_free(roster_count_ac); autocomplete_free(roster_order_ac); autocomplete_free(roster_room_ac); + autocomplete_free(roster_room_show_ac); autocomplete_free(roster_room_by_ac); autocomplete_free(roster_unread_ac); autocomplete_free(roster_room_position_ac); @@ -1550,6 +1558,14 @@ _roster_autocomplete(ProfWin *window, const char *const input, gboolean previous if (result) { return result; } + result = autocomplete_param_with_ac(input, "/roster room show", roster_room_show_ac, TRUE, previous); + if (result) { + return result; + } + result = autocomplete_param_with_ac(input, "/roster room hide", roster_room_show_ac, TRUE, previous); + if (result) { + return result; + } result = autocomplete_param_with_func(input, "/roster count zero", prefs_autocomplete_boolean_choice, previous); if (result) { return result; diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c index 7685dfb9..fa7e50d0 100644 --- a/src/command/cmd_defs.c +++ b/src/command/cmd_defs.c @@ -287,6 +287,8 @@ static struct cmd_t command_defs[] = "/roster room by service|none", "/roster room order name|unread", "/roster room unread before|after|off", + "/roster room show server", + "/roster room hide server", "/roster private room|group|off", "/roster private char <char>|none", "/roster header char <char>|none", @@ -352,6 +354,8 @@ static struct cmd_t command_defs[] = { "room unread before", "Show unread message count before room." }, { "room unread after", "Show unread message count after room." }, { "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." }, { "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 e211cc24..509e19ee 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -2869,6 +2869,30 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args) cons_bad_cmd_usage(command); return TRUE; } + } else if (g_strcmp0(args[1], "show") == 0) { + if (g_strcmp0(args[2], "server") == 0) { + cons_show("Roster room server enabled."); + prefs_set_boolean(PREF_ROSTER_ROOMS_SERVER, TRUE); + if (conn_status == JABBER_CONNECTED) { + rosterwin_roster(); + } + return TRUE; + } else { + cons_bad_cmd_usage(command); + return TRUE; + } + } else if (g_strcmp0(args[1], "hide") == 0) { + if (g_strcmp0(args[2], "server") == 0) { + cons_show("Roster room server disabled."); + prefs_set_boolean(PREF_ROSTER_ROOMS_SERVER, FALSE); + 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; |