From f6db249c92e8fd25c1cb52872d3a647be034b626 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sun, 28 Jan 2018 20:56:27 +0100 Subject: Only display transferred images, display file names, open in system viewer, include and use pgp embedded file names --- plugins/http-files/src/file_provider.vala | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'plugins/http-files/src/file_provider.vala') diff --git a/plugins/http-files/src/file_provider.vala b/plugins/http-files/src/file_provider.vala index bfeca922..5737ebf8 100644 --- a/plugins/http-files/src/file_provider.vala +++ b/plugins/http-files/src/file_provider.vala @@ -20,10 +20,8 @@ public class FileProvider : Dino.FileProvider, Object { 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).message_sent.connect(check_out_message); stream_interactor.get_module(MessageProcessor.IDENTITY).received_pipeline.connect(new ReceivedMessageListener(this)); stream_interactor.get_module(Manager.IDENTITY).uploaded.connect((file_transfer, url) => { - file_transfer.info = url; ignore_once.add(url); }); } @@ -56,14 +54,6 @@ public class FileProvider : Dino.FileProvider, Object { } } - public void check_out_message(Message message, Conversation conversation) { - if (ignore_once.remove(message.body)) return; - if (message.body.length < 5) return; - if (!url_regex.match(message.body)) return; - if (!file_ext_regex.match(message.body)) return; - download_url(message, conversation); - } - private async bool download_url(Message message, Conversation conversation) { bool success = false; var session = new Soup.Session(); @@ -101,7 +91,7 @@ public class FileProvider : Dino.FileProvider, Object { file_transfer.size = int.parse(content_length); file_transfer.state = FileTransfer.State.NOT_STARTED; file_transfer.provider = 0; - file_transfer.info = message.body; + file_transfer.info = message.id.to_string(); file_incoming(file_transfer); success = true; Idle.add((owned)callback); -- cgit v1.2.3-54-g00ecf