diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2018-09-29 23:09:32 +0200 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2018-09-29 23:09:32 +0200 |
commit | c13ae1b932947dd102f8e3b20492a885f14a8198 (patch) | |
tree | 92ba491a3beac625926091800b0fe7621328b216 /poezio/core/handlers.py | |
parent | 2428084c8d141b5defbfe738f163095ef8bd5be3 (diff) | |
download | poezio-c13ae1b932947dd102f8e3b20492a885f14a8198.tar.gz poezio-c13ae1b932947dd102f8e3b20492a885f14a8198.tar.bz2 poezio-c13ae1b932947dd102f8e3b20492a885f14a8198.tar.xz poezio-c13ae1b932947dd102f8e3b20492a885f14a8198.zip |
Print the error given by the server when /bookmark fails.
Diffstat (limited to 'poezio/core/handlers.py')
-rw-r--r-- | poezio/core/handlers.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/poezio/core/handlers.py b/poezio/core/handlers.py index 36bc6821..0e655d68 100644 --- a/poezio/core/handlers.py +++ b/poezio/core/handlers.py @@ -891,16 +891,20 @@ class HandlerCore: _composing_tab_state(tab, state) self.core.refresh_tab_win() + @staticmethod + def _format_error(error): + error_condition = error['condition'] + error_text = error['text'] + return '%s: %s' % (error_condition, + error_text) if error_text else error_condition + def on_version_result(self, iq): """ Handle the result of a /version command. """ jid = iq['from'] if iq['type'] == 'error': - error_condition = iq['error']['condition'] - error_text = iq['error']['text'] - reply = '%s: %s' % (error_condition, - error_text) if error_text else error_condition + reply = self._format_error(iq['error']) return self.core.information( 'Could not get the software ' 'version from %s: %s' % (jid, reply), 'Warning') @@ -911,6 +915,16 @@ class HandlerCore: 'an unknown platform')) self.core.information(version, 'Info') + def on_bookmark_result(self, iq): + """ + Handle the result of a /bookmark commands. + """ + if iq['type'] == 'error': + reply = self._format_error(iq['error']) + return self.core.information( + 'Could not set the remote bookmarks: %s' % reply, 'Warning') + self.core.information('Bookmarks saved', 'Info') + ### subscription-related handlers ### def on_roster_update(self, iq): |