jp: fixed bad try/except hidding errors + fixed bad management of jids without node

This commit is contained in:
Goffi 2015-03-30 10:04:29 +02:00
commit e67b4bd9eb

View file

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