check if we have a connection before we send it sth
This commit is contained in:
parent
0f41e49758
commit
517211b63f
1 changed files with 4 additions and 0 deletions
|
@ -136,6 +136,8 @@ class Connection:
|
||||||
handler(self.name, data)
|
handler(self.name, data)
|
||||||
|
|
||||||
def _discover(self, ns, jid, node = None): #FIXME: this is in features.py but it is blocking
|
def _discover(self, ns, jid, node = None): #FIXME: this is in features.py but it is blocking
|
||||||
|
if not self.connection:
|
||||||
|
return
|
||||||
iq = common.xmpp.Iq(typ = 'get', to = jid, queryNS = ns)
|
iq = common.xmpp.Iq(typ = 'get', to = jid, queryNS = ns)
|
||||||
if node:
|
if node:
|
||||||
iq.setQuerynode(node)
|
iq.setQuerynode(node)
|
||||||
|
@ -966,6 +968,8 @@ class Connection:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
self.connected = 0
|
self.connected = 0
|
||||||
self.dispatch('STATUS', 'offline')
|
self.dispatch('STATUS', 'offline')
|
||||||
|
if not self.connection:
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
self.connection.disconnect()
|
self.connection.disconnect()
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Add table
Reference in a new issue