diff options
author | fiaxh <git@lightrise.org> | 2021-08-14 20:22:52 +0200 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2021-08-17 22:32:33 +0200 |
commit | 447464f4d1ac0c184764f103ac9e51f7ff2dce91 (patch) | |
tree | df4aab32001564c5aa706500ce6e7d68904e2d47 /xmpp-vala | |
parent | cf8501ba30e26bbc02b42204acf5cff650b338f4 (diff) | |
download | dino-447464f4d1ac0c184764f103ac9e51f7ff2dce91.tar.gz dino-447464f4d1ac0c184764f103ac9e51f7ff2dce91.zip |
Display message delivery error, color text using theme colors
fixes #672
Diffstat (limited to 'xmpp-vala')
-rw-r--r-- | xmpp-vala/src/module/message/module.vala | 7 | ||||
-rw-r--r-- | xmpp-vala/src/module/stanza.vala | 2 | ||||
-rw-r--r-- | xmpp-vala/src/module/stanza_error.vala | 7 |
3 files changed, 12 insertions, 4 deletions
diff --git a/xmpp-vala/src/module/message/module.vala b/xmpp-vala/src/module/message/module.vala index 5f7d40f0..2eced5c1 100644 --- a/xmpp-vala/src/module/message/module.vala +++ b/xmpp-vala/src/module/message/module.vala @@ -12,6 +12,7 @@ namespace Xmpp { public StanzaListenerHolder<MessageStanza> send_pipeline = new StanzaListenerHolder<MessageStanza>(); public signal void received_message(XmppStream stream, MessageStanza message); + public signal void received_error(XmppStream stream, MessageStanza message, ErrorStanza error); public signal void received_message_unprocessed(XmppStream stream, MessageStanza message); public async void send_message(XmppStream stream, MessageStanza message) throws IOStreamError { @@ -24,7 +25,11 @@ namespace Xmpp { received_message_unprocessed(stream, message); - if (!message.is_error()) { + if (message.is_error()) { + ErrorStanza? error_stanza = message.get_error(); + if (error_stanza == null) return; + received_error(stream, message, error_stanza); + } else { bool abort = yield received_pipeline.run(stream, message); if (abort) return; diff --git a/xmpp-vala/src/module/stanza.vala b/xmpp-vala/src/module/stanza.vala index f4e40f84..3b029197 100644 --- a/xmpp-vala/src/module/stanza.vala +++ b/xmpp-vala/src/module/stanza.vala @@ -74,7 +74,7 @@ public class Stanza : Object { } public ErrorStanza? get_error() { - return new ErrorStanza.from_stanza(this.stanza); + return ErrorStanza.from_stanza(this.stanza); } } diff --git a/xmpp-vala/src/module/stanza_error.vala b/xmpp-vala/src/module/stanza_error.vala index a5c3956c..5e872291 100644 --- a/xmpp-vala/src/module/stanza_error.vala +++ b/xmpp-vala/src/module/stanza_error.vala @@ -60,8 +60,11 @@ namespace Xmpp { public StanzaNode error_node; - public ErrorStanza.from_stanza(StanzaNode stanza) { - error_node = stanza.get_subnode("error"); + public static ErrorStanza? from_stanza(StanzaNode stanza) { + var error_stanza = new ErrorStanza(); + error_stanza.error_node = stanza.get_subnode("error"); + if (error_stanza.error_node == null) return null; + return error_stanza; } public ErrorStanza.build(string type, string condition, string? human_readable, StanzaNode? application_condition) { |