diff options
author | Georg Lukas <georg@op-co.de> | 2017-07-20 11:24:48 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2017-07-20 23:28:33 +0200 |
commit | 6fb3151202743d951e4ea0fb98381f81e92b7e6c (patch) | |
tree | 9fbc2974085e50104f07fdaa689f52f5351ead0d | |
parent | 12136b48a53040fc2fb2cad7bb6c8b2aaee57d25 (diff) | |
download | poezio-6fb3151202743d951e4ea0fb98381f81e92b7e6c.tar.gz poezio-6fb3151202743d951e4ea0fb98381f81e92b7e6c.tar.bz2 poezio-6fb3151202743d951e4ea0fb98381f81e92b7e6c.tar.xz poezio-6fb3151202743d951e4ea0fb98381f81e92b7e6c.zip |
Ping: properly process IQ errors, always display error condition
-rw-r--r-- | plugins/ping.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/plugins/ping.py b/plugins/ping.py index d27effad..d373fc22 100644 --- a/plugins/ping.py +++ b/plugins/ping.py @@ -69,11 +69,14 @@ class Plugin(BasePlugin): if iq['type'] == 'error': error_condition = iq['error']['condition'] reply = error_condition - if error_condition in ('remote-server-timeout', 'remote-server-not-found'): + # These IQ errors are not ping errors: + # 'service-unavailable': official "not supported" response as of RFC6120 (§8.4) and XEP-0199 (§4.1) + # 'feature-not-implemented': inoffcial not-supported response from many clients + if error_condition not in ('service-unavailable', 'feature-not-implemented'): error = True - error_text = iq['error']['text'] - if error_text: - reply = '%s: %s' % (error_condition, error_text) + error_text = iq['error']['text'] + if error_text: + reply = '%s: %s' % (error_condition, error_text) if error: message = '%s did not respond to ping: %s' % (jid, reply) else: |