diff options
author | mathieui <mathieui@mathieui.net> | 2012-04-19 17:37:53 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2012-04-19 17:37:53 +0200 |
commit | 2f78a5f2dd3cf73a15700f236cf69384c930f7eb (patch) | |
tree | 93276d71bf123455aace3f7f3a7fba744e85a57c | |
parent | 5a1a7a567d22fdad490df76bf43669d56cf46325 (diff) | |
download | poezio-2f78a5f2dd3cf73a15700f236cf69384c930f7eb.tar.gz poezio-2f78a5f2dd3cf73a15700f236cf69384c930f7eb.tar.bz2 poezio-2f78a5f2dd3cf73a15700f236cf69384c930f7eb.tar.xz poezio-2f78a5f2dd3cf73a15700f236cf69384c930f7eb.zip |
Add an autofill for /name in the roster when 'n' is pressed
-rw-r--r-- | src/tabs.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/tabs.py b/src/tabs.py index 1ef93511..82427715 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -1712,6 +1712,7 @@ class RosterInfoTab(Tab): 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["n"] = self.change_contact_name 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) @@ -2250,6 +2251,9 @@ class RosterInfoTab(Tab): return True def get_contact_version(self): + """ + Show the versions of the resource(s) currently selected + """ selected_row = self.roster_win.get_selected_row() if isinstance(selected_row, Contact): for resource in selected_row.resources: @@ -2260,6 +2264,10 @@ class RosterInfoTab(Tab): self.core.information('Nothing to get versions from', 'Info') def show_contact_info(self): + """ + Show the contact info (resource number, status, presence, etc) + when 'i' is pressed. + """ selected_row = self.roster_win.get_selected_row() if isinstance(selected_row, Contact): cont = selected_row @@ -2287,6 +2295,22 @@ class RosterInfoTab(Tab): if msg: self.core.information(msg, 'Info') + def change_contact_name(self): + """ + Auto-fill a /name command when 'n' is pressed + """ + selected_row = self.roster_win.get_selected_row() + if isinstance(selected_row, Contact): + jid = selected_row.bare_jid + elif isinstance(selected_row, Resource): + jid = JID(selected_row.jid).bare + else: + return + self.on_slash() + self.input.text = '/name "%s" ' % jid + self.input.key_end() + self.input.refresh() + def start_search(self): """ Start the search. The input should appear with a short instruction |