From 447464f4d1ac0c184764f103ac9e51f7ff2dce91 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sat, 14 Aug 2021 20:22:52 +0200 Subject: Display message delivery error, color text using theme colors fixes #672 --- libdino/src/service/message_processor.vala | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'libdino/src/service') 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); } -- cgit v1.2.3-70-g09d2