diff options
author | Nathan Fritz <nathan@andyet.net> | 2011-02-10 13:45:35 -0800 |
---|---|---|
committer | Nathan Fritz <nathan@andyet.net> | 2011-02-10 13:45:35 -0800 |
commit | 3463bf46c65f091f42643bc3f777ac05620192b6 (patch) | |
tree | 27ca9a4fd54d1d8c2e1fe2868c34a397064ebdb4 /sleekxmpp/plugins/xep_0199.py | |
parent | 13a01beb07329e3d87cdd53d167edd137b310668 (diff) | |
download | slixmpp-3463bf46c65f091f42643bc3f777ac05620192b6.tar.gz slixmpp-3463bf46c65f091f42643bc3f777ac05620192b6.tar.bz2 slixmpp-3463bf46c65f091f42643bc3f777ac05620192b6.tar.xz slixmpp-3463bf46c65f091f42643bc3f777ac05620192b6.zip |
added option to return false on ping error, added ping example
Diffstat (limited to 'sleekxmpp/plugins/xep_0199.py')
-rw-r--r-- | sleekxmpp/plugins/xep_0199.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sleekxmpp/plugins/xep_0199.py b/sleekxmpp/plugins/xep_0199.py index 16e79e26..e7ec5c46 100644 --- a/sleekxmpp/plugins/xep_0199.py +++ b/sleekxmpp/plugins/xep_0199.py @@ -42,7 +42,7 @@ class xep_0199(base.base_plugin): iq.attrib['to'] = xml.get('from', self.xmpp.boundjid.domain) self.xmpp.send(iq) - def sendPing(self, jid, timeout = 30): + def sendPing(self, jid, timeout = 30, errorfalse=False): """ sendPing(jid, timeout) Sends a ping to the specified jid, returning the time (in seconds) to receive a reply, or None if no reply is received in timeout seconds. @@ -57,7 +57,7 @@ class xep_0199(base.base_plugin): #pingresult = self.xmpp.send(iq, self.xmpp.makeIq(id), timeout) pingresult = iq.send() endTime = time.clock() - if pingresult == False: + if pingresult == False or (errorfalse and pingresult['type'] == 'error'): #self.xmpp.disconnect(reconnect=True) return False return endTime - startTime |