From ff9478259d91178e0c05fc3c2064cde4c514b410 Mon Sep 17 00:00:00 2001 From: Mathieu Pasquet Date: Thu, 14 Nov 2013 21:26:19 +0100 Subject: Add a /password command in the RosterTab Thanks to Florob for the initial input --- doc/source/commands.rst | 5 +++++ src/connection.py | 3 +++ src/tabs.py | 19 +++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/doc/source/commands.rst b/doc/source/commands.rst index 008fbda2..da49d57e 100644 --- a/doc/source/commands.rst +++ b/doc/source/commands.rst @@ -440,6 +440,11 @@ Roster tab commands Set the given JID’s name in your roster. + /password + **Usage:** ``/password `` + + Change your password. + /groupadd **Usage:** ``/groupadd `` diff --git a/src/connection.py b/src/connection.py index d8746557..37385650 100644 --- a/src/connection.py +++ b/src/connection.py @@ -68,7 +68,10 @@ class Connection(sleekxmpp.ClientXMPP): self.register_plugin('xep_0045') self.register_plugin('xep_0048') self.register_plugin('xep_0060') + self.register_plugin('xep_0066') self.register_plugin('xep_0071') + self.register_plugin('xep_0077') + self.plugin['xep_0077'].create_account = False self.register_plugin('xep_0085') self.register_plugin('xep_0115') self.register_plugin('xep_0191') diff --git a/src/tabs.py b/src/tabs.py index 598cf82a..725cc8d8 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -2273,6 +2273,10 @@ class RosterInfoTab(Tab): desc=_('Informs you of the last activity of a JID.'), shortdesc=_('Get the activity of someone.'), completion=self.core.completion_last_activity) + self.register_command('password', self.command_password, + usage='', + shortdesc=_('Change your password')) + self.resize() self.update_commands() self.update_keys() @@ -2465,6 +2469,21 @@ class RosterInfoTab(Tab): self.core.information_win.rebuild_everything(self.core.information_buffer) self.refresh() + def command_password(self, arg): + """ + /password + """ + def callback(iq): + if iq['type'] == 'result': + self.core.information('Password updated', 'Account') + if config.get('password', ''): + config.silent_set('password', arg) + else: + self.core.information('Unable to change the password', 'Account') + self.core.xmpp.plugin['xep_0077'].change_password(arg, callback=callback) + + + def command_deny(self, arg): """ /deny [jid] -- cgit v1.2.3