comparison frontends/src/jp/cmd_profile.py @ 1702:bc7e3ff3c838

jp (profile): fixed creating profile with given JID and XMPP password
author souliane <souliane@mailoo.org>
date Mon, 30 Nov 2015 09:25:23 +0100
parents de9cc4d62a4a
children d17772b0fe22
comparison
equal deleted inserted replaced
1701:23560a1cd397 1702:bc7e3ff3c838
119 self.parser.add_argument('-p', '--password', type=str, default='', help=_('the password of the profile')) 119 self.parser.add_argument('-p', '--password', type=str, default='', help=_('the password of the profile'))
120 self.parser.add_argument('-j', '--jid', type=str, help=_('the jid of the profile')) 120 self.parser.add_argument('-j', '--jid', type=str, help=_('the jid of the profile'))
121 self.parser.add_argument('-x', '--xmpp-password', type=str, help=_('the password of the XMPP account (use profile password if not specified)'), 121 self.parser.add_argument('-x', '--xmpp-password', type=str, help=_('the password of the XMPP account (use profile password if not specified)'),
122 metavar='PASSWORD') 122 metavar='PASSWORD')
123 123
124 def _profile_created(self): 124 def _session_started(self, dummy):
125 if self.args.jid: 125 if self.args.jid:
126 self.host.bridge.setParam("JabberID", self.args.jid, "Connection" ,profile_key=self.args.profile) 126 self.host.bridge.setParam("JabberID", self.args.jid, "Connection" ,profile_key=self.args.profile)
127 xmpp_pwd = self.args.password or self.args.xmpp_password 127 xmpp_pwd = self.args.password or self.args.xmpp_password
128 if xmpp_pwd: 128 if xmpp_pwd:
129 self.host.bridge.setParam("Password", xmpp_pwd, "Connection", profile_key=self.args.profile) 129 self.host.bridge.setParam("Password", xmpp_pwd, "Connection", profile_key=self.args.profile)
130 self.host.quit() 130 self.host.quit()
131
132 def _profile_created(self):
133 self.host.bridge.profileStartSession(self.args.password, self.args.profile, callback=self._session_started, errback=None)
131 134
132 def run(self): 135 def run(self):
133 """Create a new profile""" 136 """Create a new profile"""
134 self.need_loop = True 137 self.need_loop = True
135 if self.args.profile in self.host.bridge.getProfilesList(): 138 if self.args.profile in self.host.bridge.getProfilesList():