diff options
author | mathieui <mathieui@mathieui.net> | 2012-04-18 23:45:16 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2012-04-18 23:45:16 +0200 |
commit | 71596ec10b56e40a87b91c1e9dab5de3a0398761 (patch) | |
tree | 6739a7964eb8e4cbf3409c61591d78e16caa0d46 /src | |
parent | bdcddf56e12567d20baa38717335f41c49e978bc (diff) | |
download | poezio-71596ec10b56e40a87b91c1e9dab5de3a0398761.tar.gz poezio-71596ec10b56e40a87b91c1e9dab5de3a0398761.tar.bz2 poezio-71596ec10b56e40a87b91c1e9dab5de3a0398761.tar.xz poezio-71596ec10b56e40a87b91c1e9dab5de3a0398761.zip |
Add a 'v' keybind on the roster to get the version of the selected
resource-s
Diffstat (limited to 'src')
-rw-r--r-- | src/contact.py | 5 | ||||
-rw-r--r-- | src/tabs.py | 13 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/contact.py b/src/contact.py index 1874ff59..66f8c453 100644 --- a/src/contact.py +++ b/src/contact.py @@ -79,6 +79,11 @@ class Contact(object): return self._groups @property + def resources(self): + """Resources of the contact""" + return self._resources + + @property def bare_jid(self): """The bare_jid or the contact""" return self._jid diff --git a/src/tabs.py b/src/tabs.py index 88e94e64..403e05f8 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -44,7 +44,7 @@ from sleekxmpp.xmlstream import matcher from sleekxmpp.xmlstream.handler import Callback from config import config from roster import RosterGroup, roster -from contact import Contact +from contact import Contact, Resource from text_buffer import TextBuffer from user import User from os import getenv, path @@ -1710,6 +1710,7 @@ class RosterInfoTab(Tab): self.key_func["M-[1;5B"] = self.move_cursor_to_next_group self.key_func["M-[1;5A"] = self.move_cursor_to_prev_group self.key_func["o"] = self.toggle_offline_show + self.key_func["v"] = self.get_contact_version 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: 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) @@ -2247,6 +2248,16 @@ class RosterInfoTab(Tab): selected_row.toggle_folded() return True + def get_contact_version(self): + selected_row = self.roster_win.get_selected_row() + if isinstance(selected_row, Contact): + for resource in selected_row.resources: + self.core.command_version(str(resource.jid)) + elif isinstance(selected_row, Resource): + self.core.command_version(str(selected_row.jid)) + else: + self.core.information('Nothing to get versions from', 'Info') + def start_search(self): """ Start the search. The input should appear with a short instruction |