From ef40b617349f49f3f7543b4647bb142590773bc5 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Tue, 30 Jan 2018 17:29:54 +0100 Subject: [PATCH] Small fixes --- libdino/src/service/chat_interaction.vala | 2 +- libdino/src/service/message_processor.vala | 2 +- libdino/src/service/muc_manager.vala | 4 ++-- main/src/ui/conversation_summary/message_textview.vala | 2 +- plugins/http-files/src/file_provider.vala | 6 ++---- plugins/omemo/src/manager.vala | 2 +- plugins/openpgp/src/manager.vala | 2 +- xmpp-vala/src/module/util.vala | 5 +---- 8 files changed, 10 insertions(+), 15 deletions(-) diff --git a/libdino/src/service/chat_interaction.vala b/libdino/src/service/chat_interaction.vala index eefde28e..635a4a73 100644 --- a/libdino/src/service/chat_interaction.vala +++ b/libdino/src/service/chat_interaction.vala @@ -126,7 +126,7 @@ public class ChatInteraction : StreamInteractionModule, Object { private class ReceivedMessageListener : MessageListener { - public string[] after_actions_const = new string[]{ "" }; + public string[] after_actions_const = new string[]{ }; public override string action_group { get { return "OTHER_NODES"; } } public override string[] after_actions { get { return after_actions_const; } } diff --git a/libdino/src/service/message_processor.vala b/libdino/src/service/message_processor.vala index 697eae4c..01050631 100644 --- a/libdino/src/service/message_processor.vala +++ b/libdino/src/service/message_processor.vala @@ -152,7 +152,7 @@ public class MessageProcessor : StreamInteractionModule, Object { private class DeduplicateMessageListener : MessageListener { - public string[] after_actions_const = new string[]{ "" }; + public string[] after_actions_const = new string[]{ "MUC" }; public override string action_group { get { return "DEDUPLICATE"; } } public override string[] after_actions { get { return after_actions_const; } } diff --git a/libdino/src/service/muc_manager.vala b/libdino/src/service/muc_manager.vala index 696f304c..60dc0446 100644 --- a/libdino/src/service/muc_manager.vala +++ b/libdino/src/service/muc_manager.vala @@ -327,8 +327,8 @@ public class MucManager : StreamInteractionModule, Object { private class ReceivedMessageListener : MessageListener { - public string[] after_actions_const = new string[]{ "" }; - public override string action_group { get { return "OTHER_NODES"; } } + public string[] after_actions_const = new string[]{ }; + public override string action_group { get { return "MUC"; } } public override string[] after_actions { get { return after_actions_const; } } private StreamInteractor stream_interactor; diff --git a/main/src/ui/conversation_summary/message_textview.vala b/main/src/ui/conversation_summary/message_textview.vala index d11fd9e1..0b5ed6e4 100644 --- a/main/src/ui/conversation_summary/message_textview.vala +++ b/main/src/ui/conversation_summary/message_textview.vala @@ -74,7 +74,7 @@ public class MessageTextView : TextView { TextIter iter; get_iter_at_location(out iter, x, y); TextIter start_iter = iter, end_iter = iter; - if (start_iter.backward_to_tag_toggle(null) && end_iter.forward_to_tag_toggle(null)) { + if (start_iter.backward_to_tag_toggle(link_tag) && end_iter.forward_to_tag_toggle(link_tag)) { return start_iter.get_text(end_iter); } diff --git a/plugins/http-files/src/file_provider.vala b/plugins/http-files/src/file_provider.vala index 5737ebf8..b647cdbb 100644 --- a/plugins/http-files/src/file_provider.vala +++ b/plugins/http-files/src/file_provider.vala @@ -11,14 +11,12 @@ public class FileProvider : Dino.FileProvider, Object { private StreamInteractor stream_interactor; private Regex url_regex; - private Regex file_ext_regex; private Gee.List ignore_once = new ArrayList(); public FileProvider(StreamInteractor stream_interactor, Dino.Database dino_db) { this.stream_interactor = stream_interactor; this.url_regex = new Regex("""^(?i)\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))$"""); - this.file_ext_regex = new Regex("""\.(png|jpg|jpeg|svg|gif|pgp)$"""); stream_interactor.get_module(MessageProcessor.IDENTITY).received_pipeline.connect(new ReceivedMessageListener(this)); stream_interactor.get_module(Manager.IDENTITY).uploaded.connect((file_transfer, url) => { @@ -28,7 +26,7 @@ public class FileProvider : Dino.FileProvider, Object { private class ReceivedMessageListener : MessageListener { - public string[] after_actions_const = new string[]{ "" }; + public string[] after_actions_const = new string[]{ }; public override string action_group { get { return "DECRYPT"; } } public override string[] after_actions { get { return after_actions_const; } } @@ -47,7 +45,7 @@ public class FileProvider : Dino.FileProvider, Object { if (message.direction == Message.DIRECTION_RECEIVED && !in_roster) return false; string? oob_url = Xmpp.Xep.OutOfBandData.get_url_from_message(message.stanza); - if ((oob_url != null && oob_url == message.body) || outer.file_ext_regex.match(message.body)) { + if (oob_url != null && oob_url == message.body) { yield outer.download_url(message, conversation); } return false; diff --git a/plugins/omemo/src/manager.vala b/plugins/omemo/src/manager.vala index f4c5ed0f..00b73138 100644 --- a/plugins/omemo/src/manager.vala +++ b/plugins/omemo/src/manager.vala @@ -72,7 +72,7 @@ public class Manager : StreamInteractionModule, Object { private class ReceivedMessageListener : MessageListener { - public string[] after_actions_const = new string[]{ "" }; + public string[] after_actions_const = new string[]{ }; public override string action_group { get { return "DECRYPT"; } } public override string[] after_actions { get { return after_actions_const; } } diff --git a/plugins/openpgp/src/manager.vala b/plugins/openpgp/src/manager.vala index 4f8b87bb..6ec30acc 100644 --- a/plugins/openpgp/src/manager.vala +++ b/plugins/openpgp/src/manager.vala @@ -102,7 +102,7 @@ public class Manager : StreamInteractionModule, Object { private class ReceivedMessageListener : MessageListener { - public string[] after_actions_const = new string[]{ "" }; + public string[] after_actions_const = new string[]{ }; public override string action_group { get { return "DECRYPT"; } } public override string[] after_actions { get { return after_actions_const; } } diff --git a/xmpp-vala/src/module/util.vala b/xmpp-vala/src/module/util.vala index 02f391ae..849aeeec 100644 --- a/xmpp-vala/src/module/util.vala +++ b/xmpp-vala/src/module/util.vala @@ -63,16 +63,13 @@ public abstract class ListenerHolder : Object { bool changed = false; Gee.Iterator iter = remaining.iterator(); while (iter.has_next()) { - if (!iter.valid) { - iter.next(); - } + iter.next(); OrderedListener l = iter.get(); if (!set_contains_action(remaining, l.after_actions)) { new_list.add(l); iter.remove(); changed = true; } - iter.next(); } if (!changed) error("Can't sort listeners"); }