summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/contact.py1
-rw-r--r--src/core.py9
-rw-r--r--src/theming.py3
-rw-r--r--src/windows.py18
4 files changed, 27 insertions, 4 deletions
diff --git a/src/contact.py b/src/contact.py
index d235fae2..4c570a54 100644
--- a/src/contact.py
+++ b/src/contact.py
@@ -65,6 +65,7 @@ class Contact(object):
"""
self.__item = item
self.folded_states = defaultdict(lambda: True)
+ self.error = None
@property
def groups(self):
diff --git a/src/core.py b/src/core.py
index b2f5a398..b8aaf18e 100644
--- a/src/core.py
+++ b/src/core.py
@@ -245,6 +245,7 @@ class Core(object):
self.xmpp.add_event_handler("got_offline" , self.on_got_offline)
self.xmpp.add_event_handler("roster_update", self.on_roster_update)
self.xmpp.add_event_handler("changed_status", self.on_presence)
+ self.xmpp.add_event_handler("presence_error", self.on_presence_error)
self.xmpp.add_event_handler("roster_subscription_request", self.on_subscription_request)
self.xmpp.add_event_handler("roster_subscription_authorized", self.on_subscription_authorized)
self.xmpp.add_event_handler("roster_subscription_remove", self.on_subscription_remove)
@@ -2850,6 +2851,7 @@ class Core(object):
tab.unlock()
if contact is None:
return
+ contact.error = None
self.events.trigger('normal_presence', presence, contact[jid.full])
tab = self.get_conversation_by_jid(jid, create=False)
if isinstance(self.current_tab(), tabs.RosterInfoTab):
@@ -2858,6 +2860,13 @@ class Core(object):
tab.refresh()
self.doupdate()
+ def on_presence_error(self, presence):
+ jid = presence['from']
+ contact = roster[jid.bare]
+ if not contact:
+ return
+ contact.error = presence['error']['type'] + ': ' + presence['error']['condition']
+
def on_got_offline(self, presence):
"""
A JID got offline
diff --git a/src/theming.py b/src/theming.py
index 41fabaf0..27397fe2 100644
--- a/src/theming.py
+++ b/src/theming.py
@@ -196,7 +196,10 @@ class Theme(object):
CHAR_KICK = '-!-'
CHAR_COLUMN_ASC = ' ▲'
CHAR_COLUMN_DESC =' ▼'
+ CHAR_ROSTER_ERROR = '✖'
+ CHAR_ROSTER_ASKED = '?'
+ COLOR_ROSTER_ERROR = (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 2d32da30..3919ea8f 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -1894,7 +1894,9 @@ class RosterWin(Win):
self.addstr('[+] ' if contact.folded(group) else '[-] ')
added += 4
if contact.ask:
- added += 1
+ added += len(get_theme().CHAR_ROSTER_ASKED)
+ if contact.error:
+ added += len(get_theme().CHAR_ROSTER_ERROR)
if config.getl('show_roster_jids', 'true') == 'false' and contact.name:
display_name = '%s' % contact.name
@@ -1902,6 +1904,7 @@ class RosterWin(Win):
display_name = '%s (%s)' % (contact.name, contact.bare_jid)
else:
display_name = '%s' % (contact.bare_jid,)
+
display_name = self.truncate_name(display_name, added) + nb
if colored:
@@ -1909,7 +1912,10 @@ class RosterWin(Win):
else:
self.addstr(display_name)
if contact.ask:
- self.addstr('?', to_curses_attr(get_theme().COLOR_IMPORTANT_TEXT))
+ self.addstr(get_theme().CHAR_ROSTER_ASKED, to_curses_attr(get_theme().COLOR_IMPORTANT_TEXT))
+ if contact.error:
+ self.addstr(get_theme().CHAR_ROSTER_ERROR, to_curses_attr(get_theme().COLOR_ROSTER_ERROR))
+
self.finish_line()
def draw_resource_line(self, y, resource, colored):
@@ -1954,15 +1960,19 @@ class ContactInfoWin(Win):
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,))
+ self.finish_line()
if contact.ask:
- self.addstr(' ')
if contact.ask == 'asked':
self.addstr('Ask: %s' % (contact.ask,), to_curses_attr(get_theme().COLOR_IMPORTANT_TEXT))
else:
self.addstr('Ask: %s' % (contact.ask,))
- self.finish_line()
+ self.finish_line()
if resource:
self.addstr(2, 0, 'Status: %s' % (resource.status))
+ self.finish_line()
+
+ if contact.error:
+ self.addstr('Error: %s' % contact.error, to_curses_attr(get_theme().COLOR_ROSTER_ERROR))
def draw_group_info(self, group):