back to previous xmlstream.py
print an error when we try to connect an inexisting server instead of crash
This commit is contained in:
parent
223b72d463
commit
9e378977f8
2 changed files with 461 additions and 454 deletions
14
Core/core.py
14
Core/core.py
|
@ -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:
|
||||||
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:
|
||||||
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:
|
||||||
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")
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue