1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Added /roster show|hide rooms

This commit is contained in:
James Booth 2016-01-02 01:37:03 +00:00
parent cf80fdc329
commit 254c83d2d1
4 changed files with 25 additions and 3 deletions

View File

@ -276,8 +276,8 @@ static struct cmd_t command_defs[] =
CMD_SYN( CMD_SYN(
"/roster", "/roster",
"/roster online", "/roster online",
"/roster show [offline|resource|presence|status|empty|count|priority]", "/roster show [offline|resource|presence|status|empty|count|priority|rooms]",
"/roster hide [offline|resource|presence|status|empty|count|priority]", "/roster hide [offline|resource|presence|status|empty|count|priority|rooms]",
"/roster by group|presence|none", "/roster by group|presence|none",
"/roster order name|presence", "/roster order name|presence",
"/roster header char <char>|none", "/roster header char <char>|none",
@ -307,6 +307,7 @@ static struct cmd_t command_defs[] =
{ "show empty", "When grouping by presence, show empty presence groups." }, { "show empty", "When grouping by presence, show empty presence groups." },
{ "show count", "Show number of contacts in group/presence." }, { "show count", "Show number of contacts in group/presence." },
{ "show priority", "Show resource priority." }, { "show priority", "Show resource priority." },
{ "show rooms", "Show chat rooms in roster panel." },
{ "hide", "Hide the roster panel." }, { "hide", "Hide the roster panel." },
{ "hide offline", "Hide offline contacts in the roster panel." }, { "hide offline", "Hide offline contacts in the roster panel." },
{ "hide resource", "Hide contact's connected resources in the roster panel." }, { "hide resource", "Hide contact's connected resources in the roster panel." },
@ -315,6 +316,7 @@ static struct cmd_t command_defs[] =
{ "hide empty", "When grouping by presence, hide empty presence groups." }, { "hide empty", "When grouping by presence, hide empty presence groups." },
{ "hide count", "Hide number of contacts in group/presence." }, { "hide count", "Hide number of contacts in group/presence." },
{ "hide priority", "Hide resource priority." }, { "hide priority", "Hide resource priority." },
{ "hide rooms", "Hide chat rooms in roster panel." },
{ "by group", "Group contacts in the roster panel by roster group." }, { "by group", "Group contacts in the roster panel by roster group." },
{ "by presence", "Group contacts in the roster panel by presence." }, { "by presence", "Group contacts in the roster panel by presence." },
{ "by none", "No grouping in the roster panel." }, { "by none", "No grouping in the roster panel." },
@ -2167,6 +2169,7 @@ cmd_init(void)
autocomplete_add(roster_show_ac, "empty"); autocomplete_add(roster_show_ac, "empty");
autocomplete_add(roster_show_ac, "count"); autocomplete_add(roster_show_ac, "count");
autocomplete_add(roster_show_ac, "priority"); autocomplete_add(roster_show_ac, "priority");
autocomplete_add(roster_show_ac, "rooms");
roster_by_ac = autocomplete_new(); roster_by_ac = autocomplete_new();
autocomplete_add(roster_by_ac, "group"); autocomplete_add(roster_by_ac, "group");

View File

@ -2046,6 +2046,13 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
rosterwin_roster(); rosterwin_roster();
} }
return TRUE; return TRUE;
} else if (g_strcmp0(args[1], "rooms") == 0) {
cons_show("Roster rooms enabled");
prefs_set_boolean(PREF_ROSTER_ROOMS, TRUE);
if (conn_status == JABBER_CONNECTED) {
rosterwin_roster();
}
return TRUE;
} else { } else {
cons_bad_cmd_usage(command); cons_bad_cmd_usage(command);
return TRUE; return TRUE;
@ -2107,6 +2114,13 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
rosterwin_roster(); rosterwin_roster();
} }
return TRUE; return TRUE;
} else if (g_strcmp0(args[1], "rooms") == 0) {
cons_show("Roster rooms disabled");
prefs_set_boolean(PREF_ROSTER_ROOMS, FALSE);
if (conn_status == JABBER_CONNECTED) {
rosterwin_roster();
}
return TRUE;
} else { } else {
cons_bad_cmd_usage(command); cons_bad_cmd_usage(command);
return TRUE; return TRUE;

View File

@ -1325,6 +1325,11 @@ cons_roster_setting(void)
else else
cons_show("Roster priority (/roster) : hide"); cons_show("Roster priority (/roster) : hide");
if (prefs_get_boolean(PREF_ROSTER_ROOMS))
cons_show("Roster rooms (/roster) : show");
else
cons_show("Roster rooms (/roster) : hide");
char *by = prefs_get_string(PREF_ROSTER_BY); char *by = prefs_get_string(PREF_ROSTER_BY);
cons_show("Roster by (/roster) : %s", by); cons_show("Roster by (/roster) : %s", by);
prefs_free_string(by); prefs_free_string(by);

View File

@ -417,7 +417,7 @@ _rosterwin_rooms(ProfLayoutSplit *layout, gboolean newline)
if (ch) { if (ch) {
g_string_append_printf(title_str, "%c", ch); g_string_append_printf(title_str, "%c", ch);
} }
g_string_append(title_str, "rooms"); g_string_append(title_str, "Rooms");
if (prefs_get_boolean(PREF_ROSTER_COUNT)) { if (prefs_get_boolean(PREF_ROSTER_COUNT)) {
g_string_append_printf(title_str, " (%d)", g_list_length(rooms)); g_string_append_printf(title_str, " (%d)", g_list_length(rooms));
} }