From d091a6c3cd0812873bcdef53c51a2f60e12f2b8a Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sun, 5 Apr 2020 16:19:56 +0200 Subject: Add keyboard shortcut (up key) to activate last message correction --- libdino/src/service/message_correction.vala | 10 +++++++++- libdino/src/service/message_processor.vala | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'libdino/src/service') diff --git a/libdino/src/service/message_correction.vala b/libdino/src/service/message_correction.vala index 320c0b7e..90d0580f 100644 --- a/libdino/src/service/message_correction.vala +++ b/libdino/src/service/message_correction.vala @@ -91,6 +91,12 @@ public class MessageCorrection : StreamInteractionModule, MessageListener { public override string[] after_actions { get { return after_actions_const; } } public override async bool run(Entities.Message message, Xmpp.MessageStanza stanza, Conversation conversation) { + if (conversation.type_ != Conversation.Type.CHAT) { + // Don't process messages or corrections from MUC history + DateTime? mam_delay = Xep.DelayedDelivery.get_time_for_message(stanza, message.from.bare_jid); + if (mam_delay != null) return false; + } + string? replace_id = Xep.LastMessageCorrection.get_replace_id(stanza); if (replace_id == null) { if (!last_messages.has_key(conversation)) { @@ -126,9 +132,11 @@ public class MessageCorrection : StreamInteractionModule, MessageListener { message.edit_to = replace_id; on_received_correction(conversation, current_correction_message_id); + + return true; } - return true; + return false; } private void on_received_correction(Conversation conversation, int message_id) { diff --git a/libdino/src/service/message_processor.vala b/libdino/src/service/message_processor.vala index 0120fcd4..6bc4fc9e 100644 --- a/libdino/src/service/message_processor.vala +++ b/libdino/src/service/message_processor.vala @@ -122,7 +122,7 @@ public class MessageProcessor : StreamInteractionModule, Object { if (id == null) return; StanzaNode? delay_node = message.stanza.get_deep_subnode(mam_flag.ns_ver + ":result", "urn:xmpp:forward:0:forwarded", "urn:xmpp:delay:delay"); if (delay_node == null) return; - DateTime? time = DelayedDelivery.Module.get_time_for_node(delay_node); + DateTime? time = DelayedDelivery.get_time_for_node(delay_node); if (time == null) return; mam_times[account][id] = time; -- cgit v1.2.3-70-g09d2