diff options
author | Florent Le Coz <louiz@louiz.org> | 2011-01-11 03:41:06 +0100 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2011-01-11 03:41:06 +0100 |
commit | 6bb94cdf0b88671b2ac12eb67f70555da565f238 (patch) | |
tree | 6fb43bdcc79ba075c4d63963d7517761a4f4933f /src | |
parent | f7102ae33d0ab2cec6b414b61f39c4c2d9bae1b0 (diff) | |
download | poezio-6bb94cdf0b88671b2ac12eb67f70555da565f238.tar.gz poezio-6bb94cdf0b88671b2ac12eb67f70555da565f238.tar.bz2 poezio-6bb94cdf0b88671b2ac12eb67f70555da565f238.tar.xz poezio-6bb94cdf0b88671b2ac12eb67f70555da565f238.zip |
Displays the subscription and Ask states in the roster
Diffstat (limited to 'src')
-rw-r--r-- | src/contact.py | 2 | ||||
-rw-r--r-- | src/tabs.py | 6 | ||||
-rw-r--r-- | src/windows.py | 24 |
3 files changed, 23 insertions, 9 deletions
diff --git a/src/contact.py b/src/contact.py index 7bde7a4f..804a7068 100644 --- a/src/contact.py +++ b/src/contact.py @@ -147,7 +147,7 @@ class Contact(object): def set_subscription(self, sub): self._subscription = sub - def get_subscription(self, sub): + def get_subscription(self): return self._subscription def get_nb_resources(self): diff --git a/src/tabs.py b/src/tabs.py index 04227573..c5c7d791 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -757,6 +757,7 @@ class RosterInfoTab(Tab): self.key_func["o"] = self.toggle_offline_show self.key_func["s"] = self.start_search self.key_func["S"] = self.start_search_slow + self.commands['deny'] = (self.command_deny, _("Usage: /deny [jid]\nDeny: Use this command to remove and deny your presence to the provided JID (or the selected contact in your roster), who is asking you to be in his/here roster"), self.completion_deny) self.resize() def resize(self): @@ -776,6 +777,11 @@ class RosterInfoTab(Tab): not self.input.help_message: self.complete_commands(self.input) + def command_deny(self, args): + """ + Denies a JID from our roster + """ + def refresh(self, tabs, informations, roster): if not self.visible: return diff --git a/src/windows.py b/src/windows.py index 0268bef0..4020e72b 100644 --- a/src/windows.py +++ b/src/windows.py @@ -1268,13 +1268,13 @@ class RosterWin(Win): else: presence = resource.get_presence() folder = '[+]' if contact._folded else '[-]' - nb = '(%s)' % (contact.get_nb_resources(),) + nb = ' (%s)' % (contact.get_nb_resources(),) color = RosterWin.color_show[presence] if contact.get_name(): - display_name = '%s (%s) %s' % (contact.get_name(), + display_name = '%s (%s)%s' % (contact.get_name(), contact.get_bare_jid(), nb,) else: - display_name = '%s %s' % (contact.get_bare_jid(), nb,) + display_name = '%s%s' % (contact.get_bare_jid(), nb,) self.addstr(y, 1, " ", curses.color_pair(color)) if resource: self.addstr(y, 2, ' [+]' if contact._folded else ' [-]') @@ -1283,6 +1283,8 @@ class RosterWin(Win): self.addstr(display_name, curses.color_pair(14)) else: self.addstr(display_name) + if contact.get_ask(): + self.addstr('?', curses.color_pair(1)) def draw_resource_line(self, y, resource, colored): """ @@ -1305,17 +1307,24 @@ class ContactInfoWin(Win): def resize(self, height, width, y, x, stdscr): self._resize(height, width, y, x, stdscr) - def draw_contact_info(self, resource, jid=None): + def draw_contact_info(self, contact): """ draw the contact information """ - jid = jid or resource.get_jid().full + if contact: + jid = contact.get_bare_jid() + else: + jid = jid or resource.get_jid().full + resource = contact.get_highest_priority_resource() if resource: presence = resource.get_presence() else: presence = 'unavailable' self.addstr(0, 0, '%s (%s)'%(jid, presence,), curses.color_pair(theme.COLOR_INFORMATION_BAR)) self.finish_line(theme.COLOR_INFORMATION_BAR) + self.addstr(1, 0, 'Subscription: %s' % (contact.get_subscription(),)) + if contact.get_ask(): + self.addstr(' Ask: %s' % (contact.get_ask(),), curses.color_pair(1)) def draw_group_info(self, group): """ @@ -1330,10 +1339,9 @@ class ContactInfoWin(Win): if isinstance(selected_row, RosterGroup): self.draw_group_info(selected_row) elif isinstance(selected_row, Contact): - self.draw_contact_info(selected_row.get_highest_priority_resource(), - selected_row.get_bare_jid()) - elif isinstance(selected_row, Resource): self.draw_contact_info(selected_row) + # elif isinstance(selected_row, Resource): + # self.draw_contact_info(None, selected_row) self._refresh() class ListWin(Win): |