summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2013-07-31 23:43:19 +0200
committermathieui <mathieui@mathieui.net>2013-07-31 23:43:19 +0200
commit19135d4a76790c0675529eaa7591b326e631d8e6 (patch)
treeac3af0a5871886a15b655a3b5a089e60b20eb609
parentb249dad73d2e7c6dde05855ccfbc4d2541cf10d8 (diff)
downloadpoezio-19135d4a76790c0675529eaa7591b326e631d8e6.tar.gz
poezio-19135d4a76790c0675529eaa7591b326e631d8e6.tar.bz2
poezio-19135d4a76790c0675529eaa7591b326e631d8e6.tar.xz
poezio-19135d4a76790c0675529eaa7591b326e631d8e6.zip
Fix #2306 (none, to, and from subscriptions should be more visible)
Added a configuration option and some theme variables.
-rw-r--r--doc/source/configuration.rst11
-rw-r--r--src/theming.py20
-rw-r--r--src/windows.py7
3 files changed, 38 insertions, 0 deletions
diff --git a/doc/source/configuration.rst b/doc/source/configuration.rst
index 587d5fd2..9f568200 100644
--- a/doc/source/configuration.rst
+++ b/doc/source/configuration.rst
@@ -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``
diff --git a/src/theming.py b/src/theming.py
index c999ef2c..975da92a 100644
--- a/src/theming.py
+++ b/src/theming.py
@@ -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)
diff --git a/src/windows.py b/src/windows.py
index 0a31deed..6ee9fbfb 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -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: