diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/http-files/src/file_provider.vala | 2 | ||||
-rw-r--r-- | plugins/omemo/src/stream_module.vala | 12 | ||||
-rw-r--r-- | plugins/openpgp/src/stream_module.vala | 31 |
3 files changed, 23 insertions, 22 deletions
diff --git a/plugins/http-files/src/file_provider.vala b/plugins/http-files/src/file_provider.vala index 53fe3bb0..58ff6445 100644 --- a/plugins/http-files/src/file_provider.vala +++ b/plugins/http-files/src/file_provider.vala @@ -17,7 +17,7 @@ public class FileProvider : Dino.FileProvider, Object { 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)"""); + this.file_ext_regex = new Regex("""\.(png|jpg|jpeg|svg|gif|pgp)"""); stream_interactor.get_module(MessageProcessor.IDENTITY).message_received.connect(check_message); stream_interactor.get_module(MessageProcessor.IDENTITY).message_sent.connect(check_message); diff --git a/plugins/omemo/src/stream_module.vala b/plugins/omemo/src/stream_module.vala index 75a919f7..1aa92801 100644 --- a/plugins/omemo/src/stream_module.vala +++ b/plugins/omemo/src/stream_module.vala @@ -21,6 +21,7 @@ public class StreamModule : XmppStreamModule { private ConcurrentSet<string> active_devicelist_requests = new ConcurrentSet<string>(); private Map<string, ArrayList<int32>> device_lists = new HashMap<string, ArrayList<int32>>(); private Map<string, ArrayList<int32>> ignored_devices = new HashMap<string, ArrayList<int32>>(); + private ReceivedPipelineListener received_pipeline_listener; public signal void store_created(Store store); public signal void device_list_loaded(string jid); @@ -117,10 +118,15 @@ public class StreamModule : XmppStreamModule { this.store = Plugin.get_context().create_store(); store_created(store); - stream.get_module(Message.Module.IDENTITY).received_pipeline.connect(new ReceivedPipelineListener(store)); + received_pipeline_listener = new ReceivedPipelineListener(store); + stream.get_module(Message.Module.IDENTITY).received_pipeline.connect(received_pipeline_listener); stream.get_module(Pubsub.Module.IDENTITY).add_filtered_notification(stream, NODE_DEVICELIST, (stream, jid, id, node) => on_devicelist(stream, jid, id, node)); } + public override void detach(XmppStream stream) { + stream.get_module(Message.Module.IDENTITY).received_pipeline.disconnect(received_pipeline_listener); + } + public void request_user_devicelist(XmppStream stream, string jid) { if (active_devicelist_requests.add(jid)) { if (Plugin.DEBUG) print(@"OMEMO: requesting device list for $jid\n"); @@ -369,10 +375,6 @@ public class StreamModule : XmppStreamModule { stream.get_module(Pubsub.Module.IDENTITY).publish(stream, null, @"$NODE_BUNDLES:$device_id", @"$NODE_BUNDLES:$device_id", "1", bundle); } - public override void detach(XmppStream stream) { - - } - public override string get_ns() { return NS_URI; } diff --git a/plugins/openpgp/src/stream_module.vala b/plugins/openpgp/src/stream_module.vala index 6264ce49..a2b48dd9 100644 --- a/plugins/openpgp/src/stream_module.vala +++ b/plugins/openpgp/src/stream_module.vala @@ -15,6 +15,7 @@ namespace Dino.Plugins.OpenPgp { private string? signed_status = null; private Key? own_key = null; + private ReceivedPipelineDecryptListener received_pipeline_decrypt_listener = new ReceivedPipelineDecryptListener(); public Module(string? own_key_id = null) { set_private_key_id(own_key_id); @@ -28,7 +29,6 @@ namespace Dino.Plugins.OpenPgp { } catch (Error e) { } if (own_key != null) { signed_status = gpg_sign("", own_key); - get_sign_key(signed_status, ""); } } } @@ -46,13 +46,14 @@ namespace Dino.Plugins.OpenPgp { public override void attach(XmppStream stream) { stream.get_module(Presence.Module.IDENTITY).received_presence.connect(on_received_presence); stream.get_module(Presence.Module.IDENTITY).pre_send_presence_stanza.connect(on_pre_send_presence_stanza); - stream.get_module(Message.Module.IDENTITY).received_pipeline.connect(new ReceivedPipelineDecryptListener()); + stream.get_module(Message.Module.IDENTITY).received_pipeline.connect(received_pipeline_decrypt_listener); stream.add_flag(new Flag()); } public override void detach(XmppStream stream) { stream.get_module(Presence.Module.IDENTITY).received_presence.disconnect(on_received_presence); stream.get_module(Presence.Module.IDENTITY).pre_send_presence_stanza.disconnect(on_pre_send_presence_stanza); + stream.get_module(Message.Module.IDENTITY).received_pipeline.disconnect(received_pipeline_decrypt_listener); } public static void require(XmppStream stream) { @@ -63,21 +64,19 @@ namespace Dino.Plugins.OpenPgp { public override string get_id() { return IDENTITY.id; } private void on_received_presence(XmppStream stream, Presence.Stanza presence) { + StanzaNode x_node = presence.stanza.get_subnode("x", NS_URI_SIGNED); + if (x_node == null) return; + string? sig = x_node.get_string_content(); + if (sig == null) return; new Thread<void*> (null, () => { - StanzaNode x_node = presence.stanza.get_subnode("x", NS_URI_SIGNED); - if (x_node != null) { - string? sig = x_node.get_string_content(); - if (sig != null) { - string signed_data = presence.status == null ? "" : presence.status; - string? key_id = get_sign_key(sig, signed_data); - if (key_id != null) { - stream.get_flag(Flag.IDENTITY).set_key_id(presence.from, key_id); - Idle.add(() => { - received_jid_key_id(stream, presence.from, key_id); - return false; - }); - } - } + string signed_data = presence.status == null ? "" : presence.status; + string? key_id = get_sign_key(sig, signed_data); + if (key_id != null) { + stream.get_flag(Flag.IDENTITY).set_key_id(presence.from, key_id); + Idle.add(() => { + received_jid_key_id(stream, presence.from, key_id); + return false; + }); } return null; }); |