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: ...@@ -511,6 +511,7 @@ class GajimCore:
self.hub.sendPlugin('ROSTER_INFO', self.connections[con], (jid, name, sub, ask, groups)) self.hub.sendPlugin('ROSTER_INFO', self.connections[con], (jid, name, sub, ask, groups))
def BrowseResultCB(self, con, iq_obj): def BrowseResultCB(self, con, iq_obj):
print "*************** ICI ************"
identities, features, items = [], [], [] identities, features, items = [], [], []
q = iq_obj.getTag('service') q = iq_obj.getTag('service')
if not q: if not q:
...@@ -546,6 +547,11 @@ class GajimCore: ...@@ -546,6 +547,11 @@ class GajimCore:
self.hub.sendPlugin('AGENT_INFO_ITEMS', self.connections[con],\ self.hub.sendPlugin('AGENT_INFO_ITEMS', self.connections[con],\
(jid, items)) (jid, items))
def DiscoverInfoErrorCB(self, con, iq_obj):
print " ERROR *************"
jid = str(iq_obj.getFrom())
con.browseAgents(jid)
def DiscoverInfoCB(self, con, iq_obj): def DiscoverInfoCB(self, con, iq_obj):
# According to JEP-0030: # According to JEP-0030:
# For identity: category, name is mandatory, type is optional. # For identity: category, name is mandatory, type is optional.
...@@ -617,6 +623,8 @@ class GajimCore: ...@@ -617,6 +623,8 @@ class GajimCore:
common.jabber.NS_P_DISC_ITEMS) common.jabber.NS_P_DISC_ITEMS)
con.registerHandler('iq',self.DiscoverInfoCB,'result', \ con.registerHandler('iq',self.DiscoverInfoCB,'result', \
common.jabber.NS_P_DISC_INFO) common.jabber.NS_P_DISC_INFO)
con.registerHandler('iq',self.DiscoverInfoErrorCB,'error', \
common.jabber.NS_P_DISC_INFO)
try: try:
con.connect() con.connect()
except IOError, e: except IOError, e:
...@@ -903,8 +911,10 @@ class GajimCore: ...@@ -903,8 +911,10 @@ class GajimCore:
log = None, proxy = proxy) log = None, proxy = proxy)
try: try:
c.connect() c.connect()
except IOError, e: except:
log.debug("Couldn't connect to %s %s" % (hostname, e)) log.debug("Couldn't connect to %s" % ev[2][0])
self.hub.sendPlugin('ERROR', None, \
_('Couldn\'t connect to ')+ev[2][0])
return 0 return 0
else: else:
log.debug("Connected to server") 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