summaryrefslogtreecommitdiff
path: root/src/windows.py
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2011-11-12 16:51:24 +0100
committerFlorent Le Coz <louiz@louiz.org>2011-11-12 16:51:24 +0100
commite67e22766f0da948ee9f310d29278371ef9b0563 (patch)
tree736b13f2f7f217ef94bec95404d7fa8a87c16d87 /src/windows.py
parent75ae1772e49a59b373c26d1c942f25edd473921c (diff)
parent05ef3594894e0bcbe80b98e81c2a2659ea01855f (diff)
downloadpoezio-e67e22766f0da948ee9f310d29278371ef9b0563.tar.gz
poezio-e67e22766f0da948ee9f310d29278371ef9b0563.tar.bz2
poezio-e67e22766f0da948ee9f310d29278371ef9b0563.tar.xz
poezio-e67e22766f0da948ee9f310d29278371ef9b0563.zip
Merge branch 'master' of http://git.louiz.org/poezio
Diffstat (limited to 'src/windows.py')
-rw-r--r--src/windows.py64
1 files changed, 36 insertions, 28 deletions
diff --git a/src/windows.py b/src/windows.py
index 2253b871..d7471d40 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -368,19 +368,19 @@ class ConversationInfoWin(InfoWin):
about the user we are talking to
"""
color_show = {'xa': lambda: get_theme().COLOR_STATUS_XA,
- 'none': lambda: get_theme().COLOR_STATUS_ONLINE,
- '': lambda: get_theme().COLOR_STATUS_ONLINE,
- 'available': lambda: get_theme().COLOR_STATUS_ONLINE,
- 'dnd': lambda: get_theme().COLOR_STATUS_DND,
- 'away': lambda: get_theme().COLOR_STATUS_AWAY,
- 'chat': lambda: get_theme().COLOR_STATUS_CHAT,
- 'unavailable': lambda: get_theme().COLOR_STATUS_UNAVAILABLE
+ 'none': lambda: get_theme().COLOR_STATUS_ONLINE,
+ '': lambda: get_theme().COLOR_STATUS_ONLINE,
+ 'available': lambda: get_theme().COLOR_STATUS_ONLINE,
+ 'dnd': lambda: get_theme().COLOR_STATUS_DND,
+ 'away': lambda: get_theme().COLOR_STATUS_AWAY,
+ 'chat': lambda: get_theme().COLOR_STATUS_CHAT,
+ 'unavailable': lambda: get_theme().COLOR_STATUS_UNAVAILABLE
}
def __init__(self):
InfoWin.__init__(self)
- def refresh(self, jid, contact, window, chatstate):
+ def refresh(self, jid, contact, window, chatstate, informations):
# contact can be None, if we receive a message
# from someone not in our roster. In this case, we display
# only the maximum information from the message we can get.
@@ -405,9 +405,17 @@ class ConversationInfoWin(InfoWin):
self.write_resource_information(resource)
self.print_scroll_position(window)
self.write_chatstate(chatstate)
+ self.write_additional_informations(informations, jid)
self.finish_line(get_theme().COLOR_INFORMATION_BAR)
self._refresh()
+ def write_additional_informations(self, informations, jid):
+ """
+ Write all informations added by plugins by getting the
+ value returned by the callbacks.
+ """
+ for key in informations:
+ self.addstr(informations[key](jid), to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
def write_resource_information(self, resource):
"""
Write the informations about the resource
@@ -415,7 +423,7 @@ class ConversationInfoWin(InfoWin):
if not resource:
presence = "unavailable"
else:
- presence = resource.get_presence()
+ presence = resource.presence
color = RosterWin.color_show[presence]()
self.addstr('[', to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
self.addstr(" ", to_curses_attr(color))
@@ -428,7 +436,7 @@ class ConversationInfoWin(InfoWin):
if not contact:
self.addstr("(contact not in roster)", to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
return
- display_name = contact.get_name() or contact.get_bare_jid()
+ display_name = contact.name or contact.bare_jid
self.addstr('%s '%(display_name), to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
def write_contact_jid(self, jid):
@@ -468,7 +476,7 @@ class ConversationStatusMessageWin(InfoWin):
self._refresh()
def write_status_message(self, resource):
- self.addstr(resource.get_status(), to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
+ self.addstr(resource.status, to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
class MucInfoWin(InfoWin):
"""
@@ -1471,14 +1479,14 @@ class RosterWin(Win):
presence = 'unavailable'
nb = ''
else:
- presence = resource.get_presence()
+ presence = resource.presence
nb = ' (%s)' % (contact.get_nb_resources(),)
color = RosterWin.color_show[presence]()
- if contact.get_name():
- display_name = '%s (%s)%s' % (contact.get_name(),
- contact.get_bare_jid(), nb,)
+ if contact.name:
+ display_name = '%s (%s)%s' % (contact.name,
+ contact.bare_jid, nb,)
else:
- display_name = '%s%s' % (contact.get_bare_jid(), nb,)
+ display_name = '%s%s' % (contact.bare_jid, nb,)
self.addstr(y, 0, ' ')
self.addstr(" ", to_curses_attr(color))
if resource:
@@ -1488,7 +1496,7 @@ class RosterWin(Win):
self.addstr(display_name, to_curses_attr(get_theme().COLOR_SELECTED_ROW))
else:
self.addstr(display_name)
- if contact.get_ask() == 'asked':
+ if contact.ask == 'asked':
self.addstr('?', to_curses_attr(get_theme().COLOR_HIGHLIGHT_NICK))
self.finish_line()
@@ -1496,12 +1504,12 @@ class RosterWin(Win):
"""
Draw a specific resource line
"""
- color = RosterWin.color_show[resource.get_presence()]()
+ color = RosterWin.color_show[resource.presence]()
self.addstr(y, 4, " ", to_curses_attr(color))
if colored:
- self.addstr(y, 6, resource.get_jid().full, to_curses_attr(get_theme().COLOR_SELECTED_ROW))
+ self.addstr(y, 6, resource.jid.full, to_curses_attr(get_theme().COLOR_SELECTED_ROW))
else:
- self.addstr(y, 6, resource.get_jid().full)
+ self.addstr(y, 6, resource.jid.full)
self.finish_line()
def get_selected_row(self):
@@ -1517,22 +1525,22 @@ class ContactInfoWin(Win):
"""
resource = contact.get_highest_priority_resource()
if contact:
- jid = contact.get_bare_jid()
+ jid = contact.bare_jid
else:
- jid = jid or resource.get_jid().full
+ jid = jid or resource.jid.full
if resource:
- presence = resource.get_presence()
+ presence = resource.presence
else:
presence = 'unavailable'
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.get_subscription(),))
- if contact.get_ask():
+ self.addstr(1, 0, 'Subscription: %s' % (contact.subscription,))
+ if contact.ask:
self.addstr(' ')
- if contact.get_ask() == 'asked':
- self.addstr('Ask: %s' % (contact.get_ask(),), to_curses_attr(get_theme().COLOR_HIGHLIGHT_NICK))
+ if contact.ask == 'asked':
+ self.addstr('Ask: %s' % (contact.ask,), to_curses_attr(get_theme().COLOR_HIGHLIGHT_NICK))
else:
- self.addstr('Ask: %s' % (contact.get_ask(),))
+ self.addstr('Ask: %s' % (contact.ask,))
self.finish_line()