diff --git a/frontends/src/jp/base.py b/frontends/src/jp/base.py index 401ae954..20a868e6 100644 --- a/frontends/src/jp/base.py +++ b/frontends/src/jp/base.py @@ -184,10 +184,15 @@ class Jp(object): nodes2jid = {} for contact in self.bridge.getContacts(self.profile): - _jid, attr, groups = contact - if attr.has_key("name"): - names2jid[attr["name"].lower()] = _jid - nodes2jid[JID(_jid).node.lower()] = _jid + jid_s, attr, groups = contact + _jid = JID(jid_s) + try: + names2jid[attr["name"].lower()] = jid_s + except KeyError: + pass + + if _jid.node: + nodes2jid[_jid.node.lower()] = jid_s def expand_jid(jid): _jid = jid.lower() @@ -356,16 +361,21 @@ class CommandBase(object): def run(self): try: if self.args.profile: - self.host.connect_profile(self.connected) + connect_profile = self.host.connect_profile except AttributeError: # the command doesn't need to connect profile pass + else: + connect_profile(self.connected) + try: if self.args.progress: - self.host.watch_progress() + watch_progress = self.host.watch_progress except AttributeError: # the command doesn't use progress bar pass + else: + watch_progress() def connected(self): if not self.need_loop: