From 6fb3151202743d951e4ea0fb98381f81e92b7e6c Mon Sep 17 00:00:00 2001 From: Georg Lukas Date: Thu, 20 Jul 2017 11:24:48 +0200 Subject: [PATCH] Ping: properly process IQ errors, always display error condition --- plugins/ping.py | 11 +++++++---- 1 file 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: