aboutsummaryrefslogtreecommitdiff
path: root/plugins/http-files/src
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-12-31 20:19:51 +0100
committerfiaxh <git@mx.ax.lt>2017-12-31 22:48:14 +0100
commitc7c1fb51246f52801de118e1f519630a51adefdb (patch)
tree5ccc394ba6c525d24b586a63cc52cf5a348ab926 /plugins/http-files/src
parent119e7cce4ffb2774fa77bbfcef5dda80a5483f3f (diff)
downloaddino-c7c1fb51246f52801de118e1f519630a51adefdb.tar.gz
dino-c7c1fb51246f52801de118e1f519630a51adefdb.zip
Restore window state (size, maximized, position)
Diffstat (limited to 'plugins/http-files/src')
-rw-r--r--plugins/http-files/src/file_provider.vala46
1 files changed, 24 insertions, 22 deletions
diff --git a/plugins/http-files/src/file_provider.vala b/plugins/http-files/src/file_provider.vala
index 21d833eb..9a9db072 100644
--- a/plugins/http-files/src/file_provider.vala
+++ b/plugins/http-files/src/file_provider.vala
@@ -62,28 +62,30 @@ public class FileProvider : Dino.FileProvider, Object {
});
if (content_length != null && int.parse(content_length) < 5000000) {
FileTransfer file_transfer = new FileTransfer();
- Soup.Request request = session.request(message.body);
- request.send_async.begin(null, (obj, res) => {
- try {
- file_transfer.input_stream = request.send_async.end(res);
- } catch (Error e) {
- return;
- }
- file_transfer.account = conversation.account;
- file_transfer.counterpart = message.counterpart;
- file_transfer.ourpart = message.ourpart;
- file_transfer.encryption = Encryption.NONE;
- file_transfer.time = message.time;
- file_transfer.local_time = message.local_time;
- file_transfer.direction = message.direction;
- file_transfer.file_name = message.body.substring(message.body.last_index_of("/") + 1);
- file_transfer.mime_type = content_type;
- file_transfer.size = int.parse(content_length);
- file_transfer.state = FileTransfer.State.NOT_STARTED;
- file_transfer.provider = 0;
- file_transfer.info = message.body;
- file_incoming(file_transfer);
- });
+ try {
+ Soup.Request request = session.request(message.body);
+ request.send_async.begin(null, (obj, res) => {
+ try {
+ file_transfer.input_stream = request.send_async.end(res);
+ } catch (Error e) {
+ return;
+ }
+ file_transfer.account = conversation.account;
+ file_transfer.counterpart = message.counterpart;
+ file_transfer.ourpart = message.ourpart;
+ file_transfer.encryption = Encryption.NONE;
+ file_transfer.time = message.time;
+ file_transfer.local_time = message.local_time;
+ file_transfer.direction = message.direction;
+ file_transfer.file_name = message.body.substring(message.body.last_index_of("/") + 1);
+ file_transfer.mime_type = content_type;
+ file_transfer.size = int.parse(content_length);
+ file_transfer.state = FileTransfer.State.NOT_STARTED;
+ file_transfer.provider = 0;
+ file_transfer.info = message.body;
+ file_incoming(file_transfer);
+ });
+ } catch (Error e) { }
}
});
}