Commit 19135d4a authored by mathieui's avatar mathieui

Fix #2306 (none, to, and from subscriptions should be more visible)

Added a configuration option and some theme variables.
parent b249dad7
......@@ -606,6 +606,17 @@ section of this documentation.
Show s2s errors in the roster or not.
show_roster_subscriptions
**Defalt value:** ``[empty]``
Select the level of display of subscriptions with a char the roster
- ``all`` to display all subscriptions
- ``incomplete`` to display *from*, *to* and *none*
- one of ``from``, ``to``, ``none`` and ``both`` to display only that one
- no value or any other value to disable it
show_tab_names
**Default value:** ``false``
......
......@@ -112,6 +112,20 @@ class Theme(object):
}
return show_mapping.get(show, cls.COLOR_STATUS_NONE)
@classmethod
def char_subscription(cls, sub, keep='incomplete'):
sub_mapping = {
'from': cls.CHAR_ROSTER_FROM,
'both': cls.CHAR_ROSTER_BOTH,
'none': cls.CHAR_ROSTER_NONE,
'to': cls.CHAR_ROSTER_TO,
}
if keep == 'incomplete' and sub == 'both':
return ''
if keep in ('both', 'none', 'to', 'from'):
return sub_mapping[sub] if sub == keep else ''
return sub_mapping.get(sub, '')
# Message text color
COLOR_NORMAL_TEXT = (-1, -1)
COLOR_INFORMATION_TEXT = (5, -1) # TODO
......@@ -243,12 +257,18 @@ class Theme(object):
CHAR_ROSTER_ACTIVITY = '☃'
CHAR_ROSTER_MOOD = '☺'
CHAR_ROSTER_GAMING = '♠'
CHAR_ROSTER_FROM = '←'
CHAR_ROSTER_BOTH = '↔'
CHAR_ROSTER_TO = '→'
CHAR_ROSTER_NONE = '⇹'
COLOR_ROSTER_GAMING = (6, -1)
COLOR_ROSTER_MOOD = (2, -1)
COLOR_ROSTER_ACTIVITY = (3, -1)
COLOR_ROSTER_TUNE = (6, -1)
COLOR_ROSTER_ERROR = (1, -1)
COLOR_ROSTER_SUBSCRIPTION = (-1, -1)
COLOR_JOIN_CHAR = (4, -1)
COLOR_QUIT_CHAR = (1, -1)
COLOR_KICK_CHAR = (1, -1)
......
......@@ -1974,6 +1974,8 @@ class RosterWin(Win):
self.addstr(y, 0, ' ')
self.addstr(theme.CHAR_STATUS, to_curses_attr(color))
show_roster_sub = config.getl('show_roster_subscriptions', '')
self.addstr(' ')
if resource:
self.addstr('[+] ' if contact.folded(group) else '[-] ')
......@@ -1990,6 +1992,8 @@ class RosterWin(Win):
added += len(get_theme().CHAR_ROSTER_ACTIVITY)
if contact.gaming:
added += len(get_theme().CHAR_ROSTER_GAMING)
if show_roster_sub in ('all', 'incomplete', 'to', 'from', 'both', 'none'):
added += len(theme.char_subscription(contact.subscription, keep=show_roster_sub))
if config.getl('show_roster_jids', 'true') == 'false' and contact.name:
display_name = '%s' % contact.name
......@@ -2004,6 +2008,9 @@ class RosterWin(Win):
self.addstr(display_name, to_curses_attr(get_theme().COLOR_SELECTED_ROW))
else:
self.addstr(display_name)
if show_roster_sub in ('all', 'incomplete', 'to', 'from', 'both', 'none'):
self.addstr(theme.char_subscription(contact.subscription, keep=show_roster_sub), to_curses_attr(theme.COLOR_ROSTER_SUBSCRIPTION))
if contact.ask:
self.addstr(get_theme().CHAR_ROSTER_ASKED, to_curses_attr(get_theme().COLOR_IMPORTANT_TEXT))
if config.get('show_s2s_errors', 'true').lower() == 'true' and contact.error:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment