1
0
Fork 0

Added roster.rooms.private.char setting

This commit is contained in:
James Booth 2016-01-31 20:17:20 +00:00
parent dd250c6799
commit a00095c8a9
10 changed files with 119 additions and 42 deletions

View File

@ -286,6 +286,7 @@ static struct cmd_t command_defs[] =
"/roster order name|presence",
"/roster unread before|after|off",
"/roster room char <char>|none",
"/roster room private char <char>|none",
"/roster room position first|last",
"/roster room order name|unread",
"/roster room unread before|after|off",
@ -309,54 +310,54 @@ static struct cmd_t command_defs[] =
"Manage your roster, and roster display settings. "
"Passing no arguments lists all contacts in your roster.")
CMD_ARGS(
{ "online", "Show all online contacts in your roster." },
{ "online", "Show all online contacts in console." },
{ "show", "Show the roster panel." },
{ "show offline", "Show offline contacts in the roster panel." },
{ "show resource", "Show contact's connected resources in the roster panel." },
{ "show presence", "Show contact's presence in the roster panel." },
{ "show status", "Show contact's status message in the roster panel." },
{ "show empty", "When grouping by presence, show empty presence groups." },
{ "show count", "Show number of contacts in group/presence." },
{ "show priority", "Show resource priority." },
{ "show offline", "Show offline contacts in roster panel." },
{ "show resource", "Show contact's connected resources in roster panel." },
{ "show presence", "Show contact's presence in roster panel." },
{ "show status", "Show contact's status message in roster panel." },
{ "show empty", "Show empty groups in roster panel." },
{ "show priority", "Show resource priority in roster panel." },
{ "show contacts", "Show contacts in roster panel." },
{ "show rooms", "Show chat rooms in roster panel." },
{ "hide", "Hide the roster panel." },
{ "hide offline", "Hide offline contacts in the roster panel." },
{ "hide resource", "Hide contact's connected resources in the roster panel." },
{ "hide presence", "Hide contact's presence in the roster panel." },
{ "hide status", "Hide contact's status message in the roster panel." },
{ "hide empty", "When grouping by presence, hide empty presence groups." },
{ "hide count", "Hide number of contacts in group/presence." },
{ "hide priority", "Hide resource priority." },
{ "hide offline", "Hide offline contacts in roster panel." },
{ "hide resource", "Hide contact's connected resources in roster panel." },
{ "hide presence", "Hide contact's presence in roster panel." },
{ "hide status", "Hide contact's status message in roster panel." },
{ "hide empty", "Hide empty groups in roster panel." },
{ "hide priority", "Hide resource priority in roster panel." },
{ "hide contacts", "Hide contacts in roster panel." },
{ "hide rooms", "Hide chat rooms in roster panel." },
{ "by group", "Group contacts in the roster panel by roster group." },
{ "by presence", "Group contacts in the roster panel by presence." },
{ "by none", "No grouping in the roster panel." },
{ "count unread", "Show total unread message count with roster headers." },
{ "by group", "Group contacts in roster panel by roster group." },
{ "by presence", "Group contacts in roster panel by presence." },
{ "by none", "No grouping in roster panel." },
{ "count unread", "Show unread message count with roster headers." },
{ "count items", "Show item count with roster headers." },
{ "count off", "Do not show any count with roster headers." },
{ "count zero on", "Show roster count when 0." },
{ "count zero off", "Hide roster count when 0." },
{ "order name", "Order roster items by name only." },
{ "order presence", "Order roster items by presence, and then by name." },
{ "unread before", "Show unread message count before contact in roster." },
{ "unread after", "Show unread message count after contact in roster." },
{ "unread off", "Do not show unread message count for contacts in roster." },
{ "room char <char>", "Prefix roster rooms with specified character." },
{ "room char none", "Remove roster room character prefix." },
{ "count zero on", "Show roster header count when 0." },
{ "count zero off", "Hide roster header count when 0." },
{ "order name", "Order roster contacts by name only." },
{ "order presence", "Order roster contacts by presence, and then by name." },
{ "unread before", "Show unread message count before contact." },
{ "unread after", "Show unread message count after contact." },
{ "unread off", "Do not show unread message count for contacts." },
{ "room char <char>", "Prefix rooms with specified character." },
{ "room char none", "Remove room character prefix." },
{ "room private char <char>", "Prefix private room chat with specified character when displayed with room." },
{ "room private char none", "Remove private room chat character prefix when displayed with room." },
{ "room position first", "Show rooms first in roster." },
{ "room position last", "Show rooms last in roster." },
{ "room order name", "Order roster rooms by name." },
{ "room order unread", "Order roster rooms by unread messages, and then by name." },
{ "room unread before", "Show unread message count before room in roster." },
{ "room unread after", "Show unread message count after room in roster." },
{ "room unread off", "Do not show unread message count for rooms in roster." },
{ "private room", "Show room private chats below the room in the roster." },
{ "room order name", "Order rooms by name." },
{ "room order unread", "Order rooms by unread messages, and then by name." },
{ "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." },
{ "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 in the roster." },
{ "private char <char>", "Prefix roster private room chats with specified character." },
{ "private char none", "Remove roster private room chat character prefix." },
{ "private off", "Do not show room private chats." },
{ "private char <char>", "Prefix private room chats with specified character when displayed in separate group." },
{ "private char none", "Remove private room chat character prefix." },
{ "header char <char>", "Prefix roster headers with specified character." },
{ "header char none", "Remove roster header character prefix." },
{ "contact char <char>", "Prefix roster contacts with specified character." },
@ -2279,6 +2280,7 @@ cmd_init(void)
autocomplete_add(roster_room_ac, "position");
autocomplete_add(roster_room_ac, "order");
autocomplete_add(roster_room_ac, "unread");
autocomplete_add(roster_room_ac, "private");
roster_room_order_ac = autocomplete_new();
autocomplete_add(roster_room_order_ac, "name");
@ -3172,6 +3174,14 @@ static char*
_roster_autocomplete(ProfWin *window, const char *const input)
{
char *result = NULL;
result = autocomplete_param_with_ac(input, "/roster room private char", roster_char_ac, TRUE);
if (result) {
return result;
}
result = autocomplete_param_with_ac(input, "/roster room private", roster_header_ac, TRUE);
if (result) {
return result;
}
result = autocomplete_param_with_ac(input, "/roster header char", roster_char_ac, TRUE);
if (result) {
return result;

View File

@ -2547,6 +2547,24 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
cons_bad_cmd_usage(command);
return TRUE;
}
} else if (g_strcmp0(args[1], "private") == 0) {
if (g_strcmp0(args[2], "char") == 0) {
if (!args[3]) {
cons_bad_cmd_usage(command);
} else if (g_strcmp0(args[3], "none") == 0) {
prefs_clear_roster_room_private_char();
cons_show("Roster room private char removed.");
rosterwin_roster();
} else {
prefs_set_roster_room_private_char(args[3][0]);
cons_show("Roster room private char set to %c.", args[3][0]);
rosterwin_roster();
}
return TRUE;
} else {
cons_bad_cmd_usage(command);
return TRUE;
}
} else {
cons_bad_cmd_usage(command);
return TRUE;

View File

@ -784,8 +784,6 @@ prefs_clear_roster_private_char(void)
_save_prefs();
}
char
prefs_get_roster_room_char(void)
{
@ -820,9 +818,39 @@ prefs_clear_roster_room_char(void)
_save_prefs();
}
char
prefs_get_roster_room_private_char(void)
{
char result = 0;
char *resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.rooms.private.char", NULL);
if (!resultstr) {
result = 0;
} else {
result = resultstr[0];
}
free(resultstr);
return result;
}
void
prefs_set_roster_room_private_char(char ch)
{
char str[2];
str[0] = ch;
str[1] = '\0';
g_key_file_set_string(prefs, PREF_GROUP_UI, "roster.rooms.private.char", str);
_save_prefs();
}
void
prefs_clear_roster_room_private_char(void)
{
g_key_file_remove_key(prefs, PREF_GROUP_UI, "roster.rooms.pruvate.char", NULL);
_save_prefs();
}
gint
prefs_get_roster_contact_indent(void)

View File

@ -199,6 +199,9 @@ void prefs_clear_roster_private_char(void);
char prefs_get_roster_room_char(void);
void prefs_set_roster_room_char(char ch);
void prefs_clear_roster_room_char(void);
char prefs_get_roster_room_private_char(void);
void prefs_set_roster_room_private_char(char ch);
void prefs_clear_roster_room_private_char(void);
gint prefs_get_roster_contact_indent(void);
void prefs_set_roster_contact_indent(gint value);

View File

@ -470,6 +470,16 @@ _load_preferences(void)
prefs_clear_roster_room_char();
}
if (g_key_file_has_key(theme, "ui", "roster.rooms.private.char", NULL)) {
gchar *ch = g_key_file_get_string(theme, "ui", "roster.rooms.private.char", NULL);
if (ch && strlen(ch) > 0) {
prefs_set_roster_room_private_char(ch[0]);
g_free(ch);
}
} else {
prefs_clear_roster_room_private_char();
}
if (g_key_file_has_key(theme, "ui", "roster.private.char", NULL)) {
gchar *ch = g_key_file_get_string(theme, "ui", "roster.private.char", NULL);
if (ch && strlen(ch) > 0) {

View File

@ -1330,6 +1330,12 @@ cons_roster_setting(void)
else
cons_show("Roster room char (/roster) : none");
char room_priv_ch = prefs_get_roster_room_private_char();
if (room_priv_ch)
cons_show("Roster room private char (/roster) : %c", room_priv_ch);
else
cons_show("Roster room private char (/roster) : none");
char private_ch = prefs_get_roster_private_char();
if (private_ch)
cons_show("Roster private char (/roster) : %c", private_ch);

View File

@ -650,7 +650,7 @@ _rosterwin_room(ProfLayoutSplit *layout, ProfMucWin *mucwin)
g_string_append_printf(privmsg, "(%d) ", privwin->unread);
}
ch = prefs_get_roster_private_char();
ch = prefs_get_roster_room_private_char();
if (ch) {
g_string_append_printf(privmsg, "%c", ch);
}

View File

@ -120,6 +120,7 @@ roster.rooms.order=
roster.rooms.unread=
roster.rooms.pos=
roster.rooms.char=
roster.rooms.private.char=
roster.private=
roster.private.char=
occupants=

View File

@ -118,8 +118,8 @@ roster.rooms=true
roster.rooms.order=name
roster.rooms.unread=after
roster.rooms.pos=last
roster.rooms.private.char=/
roster.private=room
roster.private.char=/
roster.count=unread
roster.count.zero=false
occupants=true

View File

@ -44,8 +44,9 @@ roster.rooms.order=unread
roster.rooms.unread=after
roster.rooms.pos=last
roster.rooms.char=#
roster.rooms.private.char=/
roster.private=room
roster.private.char=/
roster.private.char=+
roster.count=unread
roster.count.zero=true
privileges=true