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 /libdino/src/service | |
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 'libdino/src/service')
-rw-r--r-- | libdino/src/service/message_processor.vala | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libdino/src/service/message_processor.vala b/libdino/src/service/message_processor.vala index 669aa193..fcabeba6 100644 --- a/libdino/src/service/message_processor.vala +++ b/libdino/src/service/message_processor.vala @@ -144,6 +144,19 @@ public class MessageProcessor : StreamInteractionModule, Object { hitted_range[query_id] = -2; } }); + stream_interactor.module_manager.get_module(account, Xmpp.MessageModule.IDENTITY).received_error.connect((stream, message_stanza, error_stanza) => { + Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation(message_stanza.from.bare_jid, account); + if (conversation == null) return; + Message? message = stream_interactor.get_module(MessageStorage.IDENTITY).get_message_by_stanza_id(message_stanza.id, conversation); + if (message == null) return; + // We don't care about delivery errors if our counterpart already ACKed the message. + if (message.marked in Message.MARKED_RECEIVED) return; + + warning("Message delivery error from %s. Type: %s, Condition: %s, Text: %s", message_stanza.from.to_string(), error_stanza.type_ ?? "-", error_stanza.condition, error_stanza.text ?? "-"); + if (error_stanza.condition == Xmpp.ErrorStanza.CONDITION_RECIPIENT_UNAVAILABLE && error_stanza.type_ == Xmpp.ErrorStanza.TYPE_CANCEL) return; + + message.marked = Message.Marked.ERROR; + }); convert_sending_to_unsent_msgs(account); } |