aboutsummaryrefslogtreecommitdiff
path: root/libdino
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2020-04-05 16:19:56 +0200
committerfiaxh <git@lightrise.org>2020-04-05 16:19:56 +0200
commitd091a6c3cd0812873bcdef53c51a2f60e12f2b8a (patch)
treed350880657a77e04a777a4d6072b5951c7cd58c0 /libdino
parent8f7595418890cc2dac62dc4903405c49e61176d2 (diff)
downloaddino-d091a6c3cd0812873bcdef53c51a2f60e12f2b8a.tar.gz
dino-d091a6c3cd0812873bcdef53c51a2f60e12f2b8a.zip
Add keyboard shortcut (up key) to activate last message correction
Diffstat (limited to 'libdino')
-rw-r--r--libdino/src/service/message_correction.vala10
-rw-r--r--libdino/src/service/message_processor.vala2
2 files changed, 10 insertions, 2 deletions
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;