Small fixes
This commit is contained in:
parent
8c46c423c0
commit
ef40b61734
|
@ -126,7 +126,7 @@ public class ChatInteraction : StreamInteractionModule, Object {
|
||||||
|
|
||||||
private class ReceivedMessageListener : MessageListener {
|
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 action_group { get { return "OTHER_NODES"; } }
|
||||||
public override string[] after_actions { get { return after_actions_const; } }
|
public override string[] after_actions { get { return after_actions_const; } }
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ public class MessageProcessor : StreamInteractionModule, Object {
|
||||||
|
|
||||||
private class DeduplicateMessageListener : MessageListener {
|
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 action_group { get { return "DEDUPLICATE"; } }
|
||||||
public override string[] after_actions { get { return after_actions_const; } }
|
public override string[] after_actions { get { return after_actions_const; } }
|
||||||
|
|
||||||
|
|
|
@ -327,8 +327,8 @@ public class MucManager : StreamInteractionModule, Object {
|
||||||
|
|
||||||
private class ReceivedMessageListener : MessageListener {
|
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 action_group { get { return "MUC"; } }
|
||||||
public override string[] after_actions { get { return after_actions_const; } }
|
public override string[] after_actions { get { return after_actions_const; } }
|
||||||
|
|
||||||
private StreamInteractor stream_interactor;
|
private StreamInteractor stream_interactor;
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class MessageTextView : TextView {
|
||||||
TextIter iter;
|
TextIter iter;
|
||||||
get_iter_at_location(out iter, x, y);
|
get_iter_at_location(out iter, x, y);
|
||||||
TextIter start_iter = iter, end_iter = iter;
|
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);
|
return start_iter.get_text(end_iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,14 +11,12 @@ public class FileProvider : Dino.FileProvider, Object {
|
||||||
|
|
||||||
private StreamInteractor stream_interactor;
|
private StreamInteractor stream_interactor;
|
||||||
private Regex url_regex;
|
private Regex url_regex;
|
||||||
private Regex file_ext_regex;
|
|
||||||
|
|
||||||
private Gee.List<string> ignore_once = new ArrayList<string>();
|
private Gee.List<string> ignore_once = new ArrayList<string>();
|
||||||
|
|
||||||
public FileProvider(StreamInteractor stream_interactor, Dino.Database dino_db) {
|
public FileProvider(StreamInteractor stream_interactor, Dino.Database dino_db) {
|
||||||
this.stream_interactor = stream_interactor;
|
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.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(MessageProcessor.IDENTITY).received_pipeline.connect(new ReceivedMessageListener(this));
|
||||||
stream_interactor.get_module(Manager.IDENTITY).uploaded.connect((file_transfer, url) => {
|
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 {
|
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 action_group { get { return "DECRYPT"; } }
|
||||||
public override string[] after_actions { get { return after_actions_const; } }
|
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;
|
if (message.direction == Message.DIRECTION_RECEIVED && !in_roster) return false;
|
||||||
|
|
||||||
string? oob_url = Xmpp.Xep.OutOfBandData.get_url_from_message(message.stanza);
|
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);
|
yield outer.download_url(message, conversation);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class Manager : StreamInteractionModule, Object {
|
||||||
|
|
||||||
private class ReceivedMessageListener : MessageListener {
|
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 action_group { get { return "DECRYPT"; } }
|
||||||
public override string[] after_actions { get { return after_actions_const; } }
|
public override string[] after_actions { get { return after_actions_const; } }
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ public class Manager : StreamInteractionModule, Object {
|
||||||
|
|
||||||
private class ReceivedMessageListener : MessageListener {
|
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 action_group { get { return "DECRYPT"; } }
|
||||||
public override string[] after_actions { get { return after_actions_const; } }
|
public override string[] after_actions { get { return after_actions_const; } }
|
||||||
|
|
||||||
|
|
|
@ -63,16 +63,13 @@ public abstract class ListenerHolder : Object {
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
Gee.Iterator<OrderedListener> iter = remaining.iterator();
|
Gee.Iterator<OrderedListener> iter = remaining.iterator();
|
||||||
while (iter.has_next()) {
|
while (iter.has_next()) {
|
||||||
if (!iter.valid) {
|
iter.next();
|
||||||
iter.next();
|
|
||||||
}
|
|
||||||
OrderedListener l = iter.get();
|
OrderedListener l = iter.get();
|
||||||
if (!set_contains_action(remaining, l.after_actions)) {
|
if (!set_contains_action(remaining, l.after_actions)) {
|
||||||
new_list.add(l);
|
new_list.add(l);
|
||||||
iter.remove();
|
iter.remove();
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
iter.next();
|
|
||||||
}
|
}
|
||||||
if (!changed) error("Can't sort listeners");
|
if (!changed) error("Can't sort listeners");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue