summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Pasquet <mathieui@mathieui.net>2013-11-14 21:26:19 +0100
committerMathieu Pasquet <mathieui@mathieui.net>2013-11-14 21:26:19 +0100
commitff9478259d91178e0c05fc3c2064cde4c514b410 (patch)
treeba303375fac06ecdee2517cce3bf96b1a57dfe44
parent0c507859fb611bbec90ff7cc4abb7ff149b51153 (diff)
downloadpoezio-ff9478259d91178e0c05fc3c2064cde4c514b410.tar.gz
poezio-ff9478259d91178e0c05fc3c2064cde4c514b410.tar.bz2
poezio-ff9478259d91178e0c05fc3c2064cde4c514b410.tar.xz
poezio-ff9478259d91178e0c05fc3c2064cde4c514b410.zip
Add a /password command in the RosterTab
Thanks to Florob for the initial input
-rw-r--r--doc/source/commands.rst5
-rw-r--r--src/connection.py3
-rw-r--r--src/tabs.py19
3 files changed, 27 insertions, 0 deletions
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 <password>``
+
+ Change your password.
+
/groupadd
**Usage:** ``/groupadd <jid> <group>``
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='<password>',
+ 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 <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]