Add a /password command in the RosterTab

Thanks to Florob for the initial input
This commit is contained in:
Mathieu Pasquet 2013-11-14 21:26:19 +01:00
parent 0c507859fb
commit ff9478259d
3 changed files with 27 additions and 0 deletions

View file

@ -440,6 +440,11 @@ Roster tab commands
Set the given JIDs name in your roster.
/password
**Usage:** ``/password <password>``
Change your password.
/groupadd
**Usage:** ``/groupadd <jid> <group>``

View file

@ -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')

View file

@ -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]