diff options
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); } |