Skip to content
Snippets Groups Projects
Commit 9e378977 authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

back to previous xmlstream.py

print an error when we try to connect an inexisting server instead of crash
parent 223b72d4
No related branches found
No related tags found
No related merge requests found
......@@ -511,6 +511,7 @@ class GajimCore:
self.hub.sendPlugin('ROSTER_INFO', self.connections[con], (jid, name, sub, ask, groups))
def BrowseResultCB(self, con, iq_obj):
print "*************** ICI ************"
identities, features, items = [], [], []
q = iq_obj.getTag('service')
if not q:
......@@ -546,6 +547,11 @@ class GajimCore:
self.hub.sendPlugin('AGENT_INFO_ITEMS', self.connections[con],\
(jid, items))
def DiscoverInfoErrorCB(self, con, iq_obj):
print " ERROR *************"
jid = str(iq_obj.getFrom())
con.browseAgents(jid)
def DiscoverInfoCB(self, con, iq_obj):
# According to JEP-0030:
# For identity: category, name is mandatory, type is optional.
......@@ -617,6 +623,8 @@ class GajimCore:
common.jabber.NS_P_DISC_ITEMS)
con.registerHandler('iq',self.DiscoverInfoCB,'result', \
common.jabber.NS_P_DISC_INFO)
con.registerHandler('iq',self.DiscoverInfoErrorCB,'error', \
common.jabber.NS_P_DISC_INFO)
try:
con.connect()
except IOError, e:
......@@ -903,8 +911,10 @@ class GajimCore:
log = None, proxy = proxy)
try:
c.connect()
except IOError, e:
log.debug("Couldn't connect to %s %s" % (hostname, e))
except:
log.debug("Couldn't connect to %s" % ev[2][0])
self.hub.sendPlugin('ERROR', None, \
_('Couldn\'t connect to ')+ev[2][0])
return 0
else:
log.debug("Connected to server")
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment