diff --git a/src/command/command.c b/src/command/command.c index b6935daa..5f2f64fb 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -286,6 +286,7 @@ static struct cmd_t command_defs[] = "/roster order name|presence", "/roster unread before|after|off", "/roster room char |none", + "/roster room private 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 ", "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 ", "Prefix rooms with specified character." }, + { "room char none", "Remove room character prefix." }, + { "room private 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 ", "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 ", "Prefix private room chats with specified character when displayed in separate group." }, + { "private char none", "Remove private room chat character prefix." }, { "header char ", "Prefix roster headers with specified character." }, { "header char none", "Remove roster header character prefix." }, { "contact 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; diff --git a/src/command/commands.c b/src/command/commands.c index cdbce0f8..0a88d2bb 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -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; diff --git a/src/config/preferences.c b/src/config/preferences.c index 8a15cccd..0a2ae3cc 100644 --- a/src/config/preferences.c +++ b/src/config/preferences.c @@ -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) diff --git a/src/config/preferences.h b/src/config/preferences.h index 32a924ba..ff8b687d 100644 --- a/src/config/preferences.h +++ b/src/config/preferences.h @@ -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); diff --git a/src/config/theme.c b/src/config/theme.c index b886f9e2..40bf3539 100644 --- a/src/config/theme.c +++ b/src/config/theme.c @@ -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) { diff --git a/src/ui/console.c b/src/ui/console.c index 7f80a227..5c05c5dc 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -1056,9 +1056,9 @@ cons_theme_setting(void) { char *theme = prefs_get_string(PREF_THEME); if (theme == NULL) { - cons_show("Theme (/theme) : default"); + cons_show("Theme (/theme) : default"); } else { - cons_show("Theme (/theme) : %s", theme); + cons_show("Theme (/theme) : %s", theme); } prefs_free_string(theme); } @@ -1067,58 +1067,58 @@ void cons_privileges_setting(void) { if (prefs_get_boolean(PREF_MUC_PRIVILEGES)) - cons_show("MUC privileges (/privileges) : ON"); + cons_show("MUC privileges (/privileges) : ON"); else - cons_show("MUC privileges (/privileges) : OFF"); + cons_show("MUC privileges (/privileges) : OFF"); } void cons_beep_setting(void) { if (prefs_get_boolean(PREF_BEEP)) - cons_show("Terminal beep (/beep) : ON"); + cons_show("Terminal beep (/beep) : ON"); else - cons_show("Terminal beep (/beep) : OFF"); + cons_show("Terminal beep (/beep) : OFF"); } void cons_resource_setting(void) { if (prefs_get_boolean(PREF_RESOURCE_TITLE)) - cons_show("Resource title (/resource) : ON"); + cons_show("Resource title (/resource) : ON"); else - cons_show("Resource title (/resource) : OFF"); + cons_show("Resource title (/resource) : OFF"); if (prefs_get_boolean(PREF_RESOURCE_MESSAGE)) - cons_show("Resource message (/resource) : ON"); + cons_show("Resource message (/resource) : ON"); else - cons_show("Resource message (/resource) : OFF"); + cons_show("Resource message (/resource) : OFF"); } void cons_wrap_setting(void) { if (prefs_get_boolean(PREF_WRAP)) - cons_show("Word wrap (/wrap) : ON"); + cons_show("Word wrap (/wrap) : ON"); else - cons_show("Word wrap (/wrap) : OFF"); + cons_show("Word wrap (/wrap) : OFF"); } void cons_winstidy_setting(void) { if (prefs_get_boolean(PREF_WINS_AUTO_TIDY)) - cons_show("Window Auto Tidy (/wins) : ON"); + cons_show("Window Auto Tidy (/wins) : ON"); else - cons_show("Window Auto Tidy (/wins) : OFF"); + cons_show("Window Auto Tidy (/wins) : OFF"); } void cons_encwarn_setting(void) { if (prefs_get_boolean(PREF_ENC_WARN)) { - cons_show("Warn unencrypted (/encwarn) : ON"); + cons_show("Warn unencrypted (/encwarn) : ON"); } else { - cons_show("Warn unencrypted (/encwarn) : OFF"); + cons_show("Warn unencrypted (/encwarn) : OFF"); } } @@ -1126,7 +1126,7 @@ void cons_console_setting(void) { char *setting = prefs_get_string(PREF_CONSOLE_MUC); - cons_show("Console MUC messages (/console) : %s", setting); + cons_show("Console MUC messages (/console) : %s", setting); prefs_free_string(setting); } @@ -1134,9 +1134,9 @@ void cons_tlsshow_setting(void) { if (prefs_get_boolean(PREF_TLS_SHOW)) { - cons_show("TLS show (/tls) : ON"); + cons_show("TLS show (/tls) : ON"); } else { - cons_show("TLS show (/tls) : OFF"); + cons_show("TLS show (/tls) : OFF"); } } @@ -1144,44 +1144,44 @@ void cons_presence_setting(void) { if (prefs_get_boolean(PREF_PRESENCE)) - cons_show("Contact presence (/presence) : ON"); + cons_show("Contact presence (/presence) : ON"); else - cons_show("Contact presence (/presence) : OFF"); + cons_show("Contact presence (/presence) : OFF"); } void cons_flash_setting(void) { if (prefs_get_boolean(PREF_FLASH)) - cons_show("Terminal flash (/flash) : ON"); + cons_show("Terminal flash (/flash) : ON"); else - cons_show("Terminal flash (/flash) : OFF"); + cons_show("Terminal flash (/flash) : OFF"); } void cons_splash_setting(void) { if (prefs_get_boolean(PREF_SPLASH)) - cons_show("Splash screen (/splash) : ON"); + cons_show("Splash screen (/splash) : ON"); else - cons_show("Splash screen (/splash) : OFF"); + cons_show("Splash screen (/splash) : OFF"); } void cons_occupants_setting(void) { if (prefs_get_boolean(PREF_OCCUPANTS)) - cons_show("Occupants (/occupants) : show"); + cons_show("Occupants (/occupants) : show"); else - cons_show("Occupants (/occupants) : hide"); + cons_show("Occupants (/occupants) : hide"); if (prefs_get_boolean(PREF_OCCUPANTS_JID)) - cons_show("Occupant jids (/occupants) : show"); + cons_show("Occupant jids (/occupants) : show"); else - cons_show("Occupant jids (/occupants) : hide"); + cons_show("Occupant jids (/occupants) : hide"); int size = prefs_get_occupants_size(); - cons_show("Occupants size (/occupants) : %d", size); + cons_show("Occupants size (/occupants) : %d", size); } void @@ -1201,55 +1201,55 @@ cons_time_setting(void) { char *pref_time_console = prefs_get_string(PREF_TIME_CONSOLE); if (g_strcmp0(pref_time_console, "off") == 0) - cons_show("Time console (/time) : OFF"); + cons_show("Time console (/time) : OFF"); else - cons_show("Time console (/time) : %s", pref_time_console); + cons_show("Time console (/time) : %s", pref_time_console); prefs_free_string(pref_time_console); char *pref_time_chat = prefs_get_string(PREF_TIME_CHAT); if (g_strcmp0(pref_time_chat, "off") == 0) - cons_show("Time chat (/time) : OFF"); + cons_show("Time chat (/time) : OFF"); else - cons_show("Time chat (/time) : %s", pref_time_chat); + cons_show("Time chat (/time) : %s", pref_time_chat); prefs_free_string(pref_time_chat); char *pref_time_muc = prefs_get_string(PREF_TIME_MUC); if (g_strcmp0(pref_time_muc, "off") == 0) - cons_show("Time MUC (/time) : OFF"); + cons_show("Time MUC (/time) : OFF"); else - cons_show("Time MUC (/time) : %s", pref_time_muc); + cons_show("Time MUC (/time) : %s", pref_time_muc); prefs_free_string(pref_time_muc); char *pref_time_mucconf = prefs_get_string(PREF_TIME_MUCCONFIG); if (g_strcmp0(pref_time_mucconf, "off") == 0) - cons_show("Time MUC config (/time) : OFF"); + cons_show("Time MUC config (/time) : OFF"); else - cons_show("Time MUC config (/time) : %s", pref_time_mucconf); + cons_show("Time MUC config (/time) : %s", pref_time_mucconf); prefs_free_string(pref_time_mucconf); char *pref_time_private = prefs_get_string(PREF_TIME_PRIVATE); if (g_strcmp0(pref_time_private, "off") == 0) - cons_show("Time private (/time) : OFF"); + cons_show("Time private (/time) : OFF"); else - cons_show("Time private (/time) : %s", pref_time_private); + cons_show("Time private (/time) : %s", pref_time_private); prefs_free_string(pref_time_private); char *pref_time_xml = prefs_get_string(PREF_TIME_XMLCONSOLE); if (g_strcmp0(pref_time_xml, "off") == 0) - cons_show("Time XML Console (/time) : OFF"); + cons_show("Time XML Console (/time) : OFF"); else - cons_show("Time XML Console (/time) : %s", pref_time_xml); + cons_show("Time XML Console (/time) : %s", pref_time_xml); prefs_free_string(pref_time_xml); char *pref_time_statusbar = prefs_get_string(PREF_TIME_STATUSBAR); if (g_strcmp0(pref_time_statusbar, "off") == 0) - cons_show("Time statusbar (/time) : OFF"); + cons_show("Time statusbar (/time) : OFF"); else - cons_show("Time statusbar (/time) : %s", pref_time_statusbar); + cons_show("Time statusbar (/time) : %s", pref_time_statusbar); prefs_free_string(pref_time_statusbar); char *pref_time_lastactivity = prefs_get_string(PREF_TIME_LASTACTIVITY); - cons_show("Time last activity (/time) : %s", pref_time_lastactivity); + cons_show("Time last activity (/time) : %s", pref_time_lastactivity); prefs_free_string(pref_time_lastactivity); } @@ -1257,9 +1257,9 @@ void cons_vercheck_setting(void) { if (prefs_get_boolean(PREF_VERCHECK)) - cons_show("Version checking (/vercheck) : ON"); + cons_show("Version checking (/vercheck) : ON"); else - cons_show("Version checking (/vercheck) : OFF"); + cons_show("Version checking (/vercheck) : OFF"); } void @@ -1269,9 +1269,9 @@ cons_statuses_setting(void) char *chat = prefs_get_string(PREF_STATUSES_CHAT); char *muc = prefs_get_string(PREF_STATUSES_MUC); - cons_show("Console statuses (/statuses) : %s", console); - cons_show("Chat statuses (/statuses) : %s", chat); - cons_show("MUC statuses (/statuses) : %s", muc); + cons_show("Console statuses (/statuses) : %s", console); + cons_show("Chat statuses (/statuses) : %s", chat); + cons_show("MUC statuses (/statuses) : %s", muc); prefs_free_string(console); prefs_free_string(chat); @@ -1282,14 +1282,14 @@ void cons_titlebar_setting(void) { if (prefs_get_boolean(PREF_TITLEBAR_SHOW)) { - cons_show("Titlebar show (/titlebar) : ON"); + cons_show("Titlebar show (/titlebar) : ON"); } else { - cons_show("Titlebar show (/titlebar) : OFF"); + cons_show("Titlebar show (/titlebar) : OFF"); } if (prefs_get_boolean(PREF_TITLEBAR_GOODBYE)) { - cons_show("Titlebar goodbye (/titlebar) : ON"); + cons_show("Titlebar goodbye (/titlebar) : ON"); } else { - cons_show("Titlebar goodbye (/titlebar) : OFF"); + cons_show("Titlebar goodbye (/titlebar) : OFF"); } } @@ -1297,157 +1297,163 @@ void cons_roster_setting(void) { if (prefs_get_boolean(PREF_ROSTER)) - cons_show("Roster (/roster) : show"); + cons_show("Roster (/roster) : show"); else - cons_show("Roster (/roster) : hide"); + cons_show("Roster (/roster) : hide"); if (prefs_get_boolean(PREF_ROSTER_OFFLINE)) - cons_show("Roster offline (/roster) : show"); + cons_show("Roster offline (/roster) : show"); else - cons_show("Roster offline (/roster) : hide"); + cons_show("Roster offline (/roster) : hide"); char header_ch = prefs_get_roster_header_char(); if (header_ch) - cons_show("Roster header char (/roster) : %c", header_ch); + cons_show("Roster header char (/roster) : %c", header_ch); else - cons_show("Roster header char (/roster) : none"); + cons_show("Roster header char (/roster) : none"); char contact_ch = prefs_get_roster_contact_char(); if (contact_ch) - cons_show("Roster contact char (/roster) : %c", contact_ch); + cons_show("Roster contact char (/roster) : %c", contact_ch); else - cons_show("Roster contact char (/roster) : none"); + cons_show("Roster contact char (/roster) : none"); char resource_ch = prefs_get_roster_resource_char(); if (resource_ch) - cons_show("Roster resource char (/roster) : %c", resource_ch); + cons_show("Roster resource char (/roster) : %c", resource_ch); else - cons_show("Roster resource char (/roster) : none"); + cons_show("Roster resource char (/roster) : none"); char room_ch = prefs_get_roster_room_char(); if (room_ch) - cons_show("Roster room char (/roster) : %c", room_ch); + cons_show("Roster room char (/roster) : %c", room_ch); else - cons_show("Roster room char (/roster) : none"); + 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); + cons_show("Roster private char (/roster) : %c", private_ch); else - cons_show("Roster private char (/roster) : none"); + cons_show("Roster private char (/roster) : none"); gint contact_indent = prefs_get_roster_contact_indent(); - cons_show("Roster contact indent (/roster) : %d", contact_indent); + cons_show("Roster contact indent (/roster) : %d", contact_indent); if (prefs_get_boolean(PREF_ROSTER_RESOURCE)) - cons_show("Roster resource (/roster) : show"); + cons_show("Roster resource (/roster) : show"); else - cons_show("Roster resource (/roster) : hide"); + cons_show("Roster resource (/roster) : hide"); gint resource_indent = prefs_get_roster_resource_indent(); - cons_show("Roster resource indent (/roster) : %d", resource_indent); + cons_show("Roster resource indent (/roster) : %d", resource_indent); if (prefs_get_boolean(PREF_ROSTER_RESOURCE_JOIN)) - cons_show("Roster resource join (/roster) : on"); + cons_show("Roster resource join (/roster) : on"); else - cons_show("Roster resource join (/roster) : off"); + cons_show("Roster resource join (/roster) : off"); if (prefs_get_boolean(PREF_ROSTER_PRESENCE)) - cons_show("Roster presence (/roster) : show"); + cons_show("Roster presence (/roster) : show"); else - cons_show("Roster presence (/roster) : hide"); + cons_show("Roster presence (/roster) : hide"); gint presence_indent = prefs_get_roster_presence_indent(); - cons_show("Roster presence indent (/roster) : %d", presence_indent); + cons_show("Roster presence indent (/roster) : %d", presence_indent); if (prefs_get_boolean(PREF_ROSTER_STATUS)) - cons_show("Roster status (/roster) : show"); + cons_show("Roster status (/roster) : show"); else - cons_show("Roster status (/roster) : hide"); + cons_show("Roster status (/roster) : hide"); if (prefs_get_boolean(PREF_ROSTER_EMPTY)) - cons_show("Roster empty (/roster) : show"); + cons_show("Roster empty (/roster) : show"); else - cons_show("Roster empty (/roster) : hide"); + cons_show("Roster empty (/roster) : hide"); if (prefs_get_boolean(PREF_ROSTER_PRIORITY)) - cons_show("Roster priority (/roster) : show"); + cons_show("Roster priority (/roster) : show"); else - cons_show("Roster priority (/roster) : hide"); + cons_show("Roster priority (/roster) : hide"); if (prefs_get_boolean(PREF_ROSTER_CONTACTS)) - cons_show("Roster contacts (/roster) : show"); + cons_show("Roster contacts (/roster) : show"); else - cons_show("Roster contacts (/roster) : hide"); + cons_show("Roster contacts (/roster) : hide"); char *count = prefs_get_string(PREF_ROSTER_COUNT); if (g_strcmp0(count, "off") == 0) { - cons_show("Roster count (/roster) : OFF"); + cons_show("Roster count (/roster) : OFF"); } else { - cons_show("Roster count (/roster) : %s", count); + cons_show("Roster count (/roster) : %s", count); } prefs_free_string(count); if (prefs_get_boolean(PREF_ROSTER_COUNT_ZERO)) - cons_show("Roster count zero (/roster) : ON"); + cons_show("Roster count zero (/roster) : ON"); else - cons_show("Roster count zero (/roster) : OFF"); + cons_show("Roster count zero (/roster) : OFF"); 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); char *order = prefs_get_string(PREF_ROSTER_ORDER); - cons_show("Roster order (/roster) : %s", order); + cons_show("Roster order (/roster) : %s", order); prefs_free_string(order); char *unread = prefs_get_string(PREF_ROSTER_UNREAD); if (g_strcmp0(unread, "before") == 0) { - cons_show("Roster unread (/roster) : before"); + cons_show("Roster unread (/roster) : before"); } else if (g_strcmp0(unread, "after") == 0) { - cons_show("Roster unread (/roster) : after"); + cons_show("Roster unread (/roster) : after"); } else { - cons_show("Roster unread (/roster) : OFF"); + cons_show("Roster unread (/roster) : OFF"); } if (prefs_get_boolean(PREF_ROSTER_ROOMS)) - cons_show("Roster rooms (/roster) : show"); + cons_show("Roster rooms (/roster) : show"); else - cons_show("Roster rooms (/roster) : hide"); + cons_show("Roster rooms (/roster) : hide"); char *priv = prefs_get_string(PREF_ROSTER_PRIVATE); if (g_strcmp0(priv, "room") == 0) { - cons_show("Roster private (/roster) : room"); + cons_show("Roster private (/roster) : room"); } else if (g_strcmp0(priv, "group") == 0) { - cons_show("Roster private (/roster) : group"); + cons_show("Roster private (/roster) : group"); } else { - cons_show("Roster private (/roster) : OFF"); + cons_show("Roster private (/roster) : OFF"); } char *rooms_pos = prefs_get_string(PREF_ROSTER_ROOMS_POS); - cons_show("Roster rooms position (/roster) : %s", rooms_pos); + cons_show("Roster rooms position (/roster) : %s", rooms_pos); prefs_free_string(rooms_pos); char *rooms_order = prefs_get_string(PREF_ROSTER_ROOMS_ORDER); - cons_show("Roster rooms order (/roster) : %s", rooms_order); + cons_show("Roster rooms order (/roster) : %s", rooms_order); prefs_free_string(rooms_order); char *roomsunread = prefs_get_string(PREF_ROSTER_ROOMS_UNREAD); if (g_strcmp0(roomsunread, "before") == 0) { - cons_show("Roster rooms unread (/roster) : before"); + cons_show("Roster rooms unread (/roster) : before"); } else if (g_strcmp0(roomsunread, "after") == 0) { - cons_show("Roster rooms unread (/roster) : after"); + cons_show("Roster rooms unread (/roster) : after"); } else { - cons_show("Roster rooms unread (/roster) : OFF"); + cons_show("Roster rooms unread (/roster) : OFF"); } int size = prefs_get_roster_size(); - cons_show("Roster size (/roster) : %d", size); + cons_show("Roster size (/roster) : %d", size); if (prefs_get_boolean(PREF_ROSTER_WRAP)) - cons_show("Roster wrap (/roster) : ON"); + cons_show("Roster wrap (/roster) : ON"); else - cons_show("Roster wrap (/roster) : OFF"); + cons_show("Roster wrap (/roster) : OFF"); } void @@ -1658,11 +1664,11 @@ cons_show_chat_prefs(void) void cons_inpblock_setting(void) { - cons_show("Input timeout (/inpblock) : %d milliseconds", prefs_get_inpblock()); + cons_show("Input timeout (/inpblock) : %d milliseconds", prefs_get_inpblock()); if (prefs_get_boolean(PREF_INPBLOCK_DYNAMIC)) { - cons_show("Dynamic timeout (/inpblock) : ON"); + cons_show("Dynamic timeout (/inpblock) : ON"); } else { - cons_show("Dynamic timeout (/inpblock) : OFF"); + cons_show("Dynamic timeout (/inpblock) : OFF"); } } diff --git a/src/ui/rosterwin.c b/src/ui/rosterwin.c index 971c6fd3..cf7709b0 100644 --- a/src/ui/rosterwin.c +++ b/src/ui/rosterwin.c @@ -65,7 +65,7 @@ static void _rosterwin_rooms(ProfLayoutSplit *layout, gboolean newline); static void _rosterwin_rooms_header(ProfLayoutSplit *layout, gboolean newline, GList *rooms); static void _rosterwin_room(ProfLayoutSplit *layout, ProfMucWin *mucwin); -static void _rosterwin_private_chats(ProfLayoutSplit *layout); +static void _rosterwin_private_chats(ProfLayoutSplit *layout, GList *orphaned_privchats); static void _rosterwin_private_header(ProfLayoutSplit *layout, GList *privs); static GSList* _filter_contacts(GSList *contacts); @@ -541,11 +541,25 @@ _rosterwin_rooms(ProfLayoutSplit *layout, gboolean newline) g_list_free(rooms_sorted); + GList *orphaned_privchats = NULL; + GList *privchats = wins_get_private_chats(NULL); + GList *curr = privchats; + while (curr) { + ProfPrivateWin *privwin = curr->data; + Jid *jidp = jid_create(privwin->fulljid); + if (!muc_active(jidp->barejid)) { + orphaned_privchats = g_list_append(orphaned_privchats, privwin); + } + jid_destroy(jidp); + curr = g_list_next(curr); + } + char *privpref = prefs_get_string(PREF_ROSTER_PRIVATE); - if (g_strcmp0(privpref, "group") == 0) { - _rosterwin_private_chats(layout); + if (g_strcmp0(privpref, "group") == 0 || orphaned_privchats) { + _rosterwin_private_chats(layout, orphaned_privchats); } prefs_free_string(privpref); + g_list_free(orphaned_privchats); } static void @@ -636,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); } @@ -673,9 +687,21 @@ _rosterwin_room(ProfLayoutSplit *layout, ProfMucWin *mucwin) } static void -_rosterwin_private_chats(ProfLayoutSplit *layout) +_rosterwin_private_chats(ProfLayoutSplit *layout, GList *orphaned_privchats) { - GList *privs = wins_get_private_chats(NULL); + GList *privs = NULL; + + char *privpref = prefs_get_string(PREF_ROSTER_PRIVATE); + if (g_strcmp0(privpref, "group") == 0) { + privs = wins_get_private_chats(NULL); + } else { + GList *curr = orphaned_privchats; + while (curr) { + privs = g_list_append(privs, curr->data); + curr = g_list_next(curr); + } + } + if (privs || prefs_get_boolean(PREF_ROSTER_EMPTY)) { _rosterwin_private_header(layout, privs); @@ -843,21 +869,24 @@ _rosterwin_rooms_header(ProfLayoutSplit *layout, gboolean newline, GList *rooms) while (curr) { ProfMucWin *mucwin = curr->data; unread += mucwin->unread; + + // include private chats + char *prefpriv = prefs_get_string(PREF_ROSTER_PRIVATE); + if (g_strcmp0(prefpriv, "room") == 0) { + GList *privwins = wins_get_private_chats(mucwin->roomjid); + GList *curr_priv = privwins; + while (curr_priv) { + ProfPrivateWin *privwin = curr_priv->data; + unread += privwin->unread; + curr_priv = g_list_next(curr_priv); + } + g_list_free(privwins); + } + prefs_free_string(prefpriv); + curr = g_list_next(curr); } - char *prefpriv = prefs_get_string(PREF_ROSTER_PRIVATE); - if (g_strcmp0(prefpriv, "room") == 0) { - GList *privwins = wins_get_private_chats(NULL); - GList *curr = privwins; - while (curr) { - ProfPrivateWin *privwin = curr->data; - unread += privwin->unread; - curr = g_list_next(curr); - } - g_list_free(privwins); - } - prefs_free_string(prefpriv); if (unread == 0 && prefs_get_boolean(PREF_ROSTER_COUNT_ZERO)) { g_string_append_printf(header, " (%d)", unread); } else if (unread > 0) { diff --git a/theme_template b/theme_template index eb5a0fe8..49288cab 100644 --- a/theme_template +++ b/theme_template @@ -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= diff --git a/themes/boothj5 b/themes/boothj5 index ce3ceb8e..c4efb529 100644 --- a/themes/boothj5 +++ b/themes/boothj5 @@ -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 diff --git a/themes/complex b/themes/complex index db98ee8d..677427e1 100644 --- a/themes/complex +++ b/themes/complex @@ -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