summaryrefslogtreecommitdiff
path: root/src/windows.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2013-03-11 02:04:20 +0100
committermathieui <mathieui@mathieui.net>2013-03-11 02:04:20 +0100
commit71c35eb279b2271b89896dcff551ba762f66b3a5 (patch)
tree280bc7e66b453310851dcb4e9793e9f4083561eb /src/windows.py
parenteb2e5825bceec1171f0e154cb72f5870576a94f2 (diff)
downloadpoezio-71c35eb279b2271b89896dcff551ba762f66b3a5.tar.gz
poezio-71c35eb279b2271b89896dcff551ba762f66b3a5.tar.bz2
poezio-71c35eb279b2271b89896dcff551ba762f66b3a5.tar.xz
poezio-71c35eb279b2271b89896dcff551ba762f66b3a5.zip
Implement XEP-0118 (Fix #1840)
- Add new theming options - Show the tune in the roster (both in contact line and infowin) - add an option to show tunes as info messages
Diffstat (limited to 'src/windows.py')
-rw-r--r--src/windows.py25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/windows.py b/src/windows.py
index 6aa458ba..78b3c5e5 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -31,6 +31,7 @@ from poopt import cut_text
from sleekxmpp import JID
from common import safeJID
+import common
import core
import wcwidth
@@ -1935,6 +1936,8 @@ class RosterWin(Win):
added += len(get_theme().CHAR_ROSTER_ASKED)
if config.get('show_s2s_errors', 'true').lower() == 'true' and contact.error:
added += len(get_theme().CHAR_ROSTER_ERROR)
+ if contact.tune:
+ added += len(get_theme().CHAR_ROSTER_TUNE)
if config.getl('show_roster_jids', 'true') == 'false' and contact.name:
display_name = '%s' % contact.name
@@ -1953,6 +1956,8 @@ class RosterWin(Win):
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:
self.addstr(get_theme().CHAR_ROSTER_ERROR, to_curses_attr(get_theme().COLOR_ROSTER_ERROR))
+ if contact.tune:
+ self.addstr(get_theme().CHAR_ROSTER_TUNE, to_curses_attr(get_theme().COLOR_ROSTER_TUNE))
self.finish_line()
@@ -1995,23 +2000,33 @@ class ContactInfoWin(Win):
presence = resource.presence
else:
presence = 'unavailable'
+ i = 0
self.addstr(0, 0, '%s (%s)'%(jid, presence,), to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
self.finish_line(get_theme().COLOR_INFORMATION_BAR)
- self.addstr(1, 0, 'Subscription: %s' % (contact.subscription,))
+ i += 1
+ self.addstr(i, 0, 'Subscription: %s' % (contact.subscription,))
self.finish_line()
+ i += 1
if contact.ask:
if contact.ask == 'asked':
- self.addstr('Ask: %s' % (contact.ask,), to_curses_attr(get_theme().COLOR_IMPORTANT_TEXT))
+ self.addstr(i, 0, 'Ask: %s' % (contact.ask,), to_curses_attr(get_theme().COLOR_IMPORTANT_TEXT))
else:
- self.addstr('Ask: %s' % (contact.ask,))
+ self.addstr(i, 0, 'Ask: %s' % (contact.ask,))
self.finish_line()
+ i += 1
if resource:
- self.addstr(2, 0, 'Status: %s' % (resource.status))
+ self.addstr(i, 0, 'Status: %s' % (resource.status))
self.finish_line()
+ i += 1
if contact.error:
- self.addstr('Error: %s' % contact.error, to_curses_attr(get_theme().COLOR_ROSTER_ERROR))
+ self.addstr(i, 0, 'Error: %s' % contact.error, to_curses_attr(get_theme().COLOR_ROSTER_ERROR))
+ self.finish_line()
+ i += 1
+ if contact.tune:
+ self.addstr(i, 0, 'Current Tune: %s' % common.format_tune_string(contact.tune), to_curses_attr(get_theme().COLOR_NORMAL_TEXT))
+ i += 1
def draw_group_info(self, group):
"""