Mercurial > libervia-backend
annotate sat_frontends/jp/cmd_account.py @ 2613:9680cd958529
plugin XEP-0045: fixed crash when muc service is not found
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 21 Jun 2018 01:21:44 +0200 |
parents | 26edcf3a30eb |
children | 56f94936df1e |
rev | line source |
---|---|
2180
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 #!/usr/bin/env python2 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 # -*- coding: utf-8 -*- |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
4 # jp: a SAT command line tool |
2483 | 5 # Copyright (C) 2009-2018 Jérôme Poisson (goffi@goffi.org) |
2180
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 # This program is free software: you can redistribute it and/or modify |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 # it under the terms of the GNU Affero General Public License as published by |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 # the Free Software Foundation, either version 3 of the License, or |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 # (at your option) any later version. |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 # This program is distributed in the hope that it will be useful, |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 # GNU Affero General Public License for more details. |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 # You should have received a copy of the GNU Affero General Public License |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
20 """This module permits to manage XMPP accounts using in-band registration (XEP-0077)""" |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
21 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
22 from sat_frontends.jp.constants import Const as C |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
23 from sat.core.log import getLogger |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 log = getLogger(__name__) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
25 from sat.core.i18n import _ |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
26 from sat_frontends.jp import base |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
27 from sat_frontends.tools import jid |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
28 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
29 __commands__ = ["Account"] |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
30 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
31 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
32 class AccountCreate(base.CommandBase): |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
33 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
34 def __init__(self, host): |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
35 super(AccountCreate, self).__init__(host, 'create', use_profile=False, use_verbose=True, help=_(u'create a XMPP account')) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
36 self.need_loop = True |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
37 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
38 def add_parser_options(self): |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
39 self.parser.add_argument('jid', type=base.unicode_decoder, help=_(u'jid to create')) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
40 self.parser.add_argument('password', type=base.unicode_decoder, help=_(u'password of the account')) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
41 self.parser.add_argument('-p', '--profile', type=base.unicode_decoder, help=_(u"create a profile to use this account (default: don't create profile)")) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
42 self.parser.add_argument('-e', '--email', type=base.unicode_decoder, default="", help=_(u"email (usage depends of XMPP server)")) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
43 self.parser.add_argument('-H', '--host', type=base.unicode_decoder, default="", help=_(u"server host (IP address or domain, default: use localhost)")) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
44 self.parser.add_argument('-P', '--port', type=int, default=0, help=_(u"server port (IP address or domain, default: use localhost)")) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
45 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
46 def _setParamCb(self): |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
47 self.host.bridge.setParam("Password", self.args.password, "Connection", profile_key=self.args.profile, callback=self.host.quit, errback=self.errback) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
48 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
49 def _session_started(self, dummy): |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
50 self.host.bridge.setParam("JabberID", self.args.jid, "Connection", profile_key=self.args.profile, callback=self._setParamCb, errback=self.errback) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
51 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
52 def _profileCreateCb(self): |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
53 self.disp(_(u"profile created"), 1) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
54 self.host.bridge.profileStartSession(self.args.password, self.args.profile, callback=self._session_started, errback=self.errback) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
55 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
56 def _profileCreateEb(self, failure_): |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
57 self.disp(_(u"Can't create profile {profile} to associate with jid {jid}: {msg}").format( |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
58 profile = self.args.profile, |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
59 jid = self.args.jid, |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
60 msg = failure_), error=True) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
61 self.host.quit(C.EXIT_BRIDGE_ERRBACK) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
62 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
63 def accountNewCb(self): |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
64 self.disp(_(u"XMPP account created"), 1) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
65 if self.args.profile is not None: |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
66 self.disp(_(u"creating profile"), 2) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
67 self.host.bridge.profileCreate(self.args.profile, self.args.password, "", callback=self._profileCreateCb, errback=self._profileCreateEb) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
68 else: |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
69 self.host.quit() |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
70 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
71 def accountNewEb(self, failure_): |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
72 self.disp(_(u"Can't create new account on server {host} with jid {jid}: {msg}").format( |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
73 host = self.args.host or u"localhost", |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
74 jid = self.args.jid, |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
75 msg = failure_), error=True) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
76 self.host.quit(C.EXIT_BRIDGE_ERRBACK) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
77 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
78 def start(self): |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
79 self.host.bridge.inBandAccountNew(self.args.jid, self.args.password, self.args.email, self.args.host, self.args.port, |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
80 callback=self.accountNewCb, errback=self.accountNewEb) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
81 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
82 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
83 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
84 class AccountModify(base.CommandBase): |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
85 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
86 def __init__(self, host): |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
87 super(AccountModify, self).__init__(host, 'modify', help=_(u'change password for XMPP account')) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
88 self.need_loop = True |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
89 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
90 def add_parser_options(self): |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
91 self.parser.add_argument('password', type=base.unicode_decoder, help=_(u'new XMPP password')) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
92 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
93 def start(self): |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
94 self.host.bridge.inBandPasswordChange(self.args.password, self.args.profile, |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
95 callback=self.host.quit, errback=self.errback) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
96 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
97 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
98 class AccountDelete(base.CommandBase): |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
99 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
100 def __init__(self, host): |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
101 super(AccountDelete, self).__init__(host, 'delete', help=_(u'delete a XMPP account')) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
102 self.need_loop = True |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
103 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
104 def add_parser_options(self): |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
105 self.parser.add_argument('-f', '--force', action='store_true', help=_(u'delete account without confirmation')) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
106 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
107 def _got_jid(self, jid_str): |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
108 jid_ = jid.JID(jid_str) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
109 if not self.args.force: |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
110 message = (u"You are about to delete the XMPP account with jid {jid_}\n" |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
111 u"This is the XMPP account of profile \"{profile}\"\n" |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
112 u"Are you sure that you want to delete this account ?".format( |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
113 jid_ = jid_, |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
114 profile=self.profile |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
115 )) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
116 res = raw_input("{} (y/N)? ".format(message)) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
117 if res not in ("y", "Y"): |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
118 self.disp(_(u"Account deletion cancelled")) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
119 self.host.quit(2) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
120 self.host.bridge.inBandUnregister(jid_.domain, self.args.profile, |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
121 callback=self.host.quit, errback=self.errback) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
122 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
123 def start(self): |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
124 self.host.bridge.asyncGetParamA("JabberID", "Connection", profile_key=self.profile, |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
125 callback=self._got_jid, errback=self.errback) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
126 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
127 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
128 class Account(base.CommandBase): |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
129 subcommands = (AccountCreate, AccountModify, AccountDelete) |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
130 |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
131 def __init__(self, host): |
be54e1c3394c
jp (account): command to handle XMPP account creation/password change/deletion using in-band registration
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
132 super(Account, self).__init__(host, 'account', use_profile=False, help=(u'XMPP account management')) |