summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2012-04-19 00:12:22 +0200
committermathieui <mathieui@mathieui.net>2012-04-19 00:12:22 +0200
commit80b1e835b74b5f5d497f8a13bc55b07a92227558 (patch)
tree81920ba32256bb6e588403db30c405c610915074 /src
parent71596ec10b56e40a87b91c1e9dab5de3a0398761 (diff)
downloadpoezio-80b1e835b74b5f5d497f8a13bc55b07a92227558.tar.gz
poezio-80b1e835b74b5f5d497f8a13bc55b07a92227558.tar.bz2
poezio-80b1e835b74b5f5d497f8a13bc55b07a92227558.tar.xz
poezio-80b1e835b74b5f5d497f8a13bc55b07a92227558.zip
Show the contact info in the roster when 'i' is pressed
Diffstat (limited to 'src')
-rw-r--r--src/tabs.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/tabs.py b/src/tabs.py
index 403e05f8..2c714bac 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -1711,6 +1711,7 @@ class RosterInfoTab(Tab):
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["i"] = self.show_contact_info
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)
@@ -2258,6 +2259,33 @@ class RosterInfoTab(Tab):
else:
self.core.information('Nothing to get versions from', 'Info')
+ def show_contact_info(self):
+ selected_row = self.roster_win.get_selected_row()
+ if isinstance(selected_row, Contact):
+ cont = selected_row
+ res = selected_row.get_highest_priority_resource()
+ msg = 'Contact: %s (%s)\n%s connected resources\nCurrent status: %s' % (
+ cont.bare_jid,
+ res.presence if res else 'unavailable',
+ cont.get_nb_resources(),
+ res.status if res else '',)
+ elif isinstance(selected_row, Resource):
+ res = selected_row
+ msg = 'Resource: %s (%s)\nCurrent status: %s' % (
+ res.jid,
+ res.presence,
+ res.status,)
+ elif isinstance(selected_row, RosterGroup):
+ rg = selected_row
+ msg = 'Group: %s [%s/%s] contacts online' % (
+ rg.name,
+ rg.get_nb_connected_contacts(),
+ len(rg),)
+ else:
+ msg = None
+ if msg:
+ self.core.information(msg, 'Info')
+
def start_search(self):
"""
Start the search. The input should appear with a short instruction