aboutsummaryrefslogtreecommitdiff
path: root/plugins/http-files
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/http-files')
-rw-r--r--plugins/http-files/src/manager.vala2
-rw-r--r--plugins/http-files/src/upload_stream_module.vala28
2 files changed, 15 insertions, 15 deletions
diff --git a/plugins/http-files/src/manager.vala b/plugins/http-files/src/manager.vala
index c27babe2..7335b89a 100644
--- a/plugins/http-files/src/manager.vala
+++ b/plugins/http-files/src/manager.vala
@@ -32,7 +32,7 @@ public class Manager : StreamInteractionModule, FileSender, Object {
public void send_file(Conversation conversation, FileTransfer file_transfer) {
Xmpp.XmppStream? stream = stream_interactor.get_stream(file_transfer.account);
if (stream != null) {
- stream_interactor.module_manager.get_module(file_transfer.account, UploadStreamModule.IDENTITY).upload(stream, file_transfer.input_stream, file_transfer.server_file_name, file_transfer.size, file_transfer.mime_type,
+ stream_interactor.module_manager.get_module(file_transfer.account, UploadStreamModule.IDENTITY).upload(stream, file_transfer.input_stream, file_transfer.server_file_name, file_transfer.mime_type,
(stream, url_down) => {
uploaded(file_transfer, url_down);
file_transfer.info = url_down;
diff --git a/plugins/http-files/src/upload_stream_module.vala b/plugins/http-files/src/upload_stream_module.vala
index 4835f268..934d4df5 100644
--- a/plugins/http-files/src/upload_stream_module.vala
+++ b/plugins/http-files/src/upload_stream_module.vala
@@ -15,21 +15,21 @@ public class UploadStreamModule : XmppStreamModule {
public delegate void OnUploadOk(XmppStream stream, string url_down);
public delegate void OnError(XmppStream stream, string error);
- public void upload(XmppStream stream, InputStream input_stream, string file_name, int file_size, string file_content_type, owned OnUploadOk listener, owned OnError error_listener) {
- request_slot(stream, file_name, file_size, file_content_type,
- (stream, url_down, url_up) => {
- uint8[] buf = new uint8[256];
- Array<uint8> data = new Array<uint8>(false, true, 0);
- size_t len = -1;
- do {
- try {
- len = input_stream.read(buf);
- } catch (IOError error) {
- error_listener(stream, @"HTTP upload: IOError reading stream: $(error.message)");
- }
- data.append_vals(buf, (uint) len);
- } while(len > 0);
+ public void upload(XmppStream stream, InputStream input_stream, string file_name, string file_content_type, owned OnUploadOk listener, owned OnError error_listener) {
+ uint8[] buf = new uint8[256];
+ Array<uint8> data = new Array<uint8>(false, true, 0);
+ size_t len = -1;
+ do {
+ try {
+ len = input_stream.read(buf);
+ } catch (IOError error) {
+ error_listener(stream, @"HTTP upload: IOError reading stream: $(error.message)");
+ }
+ data.append_vals(buf, (uint) len);
+ } while(len > 0);
+ request_slot(stream, file_name, (int) data.length, file_content_type,
+ (stream, url_down, url_up) => {
Soup.Message message = new Soup.Message("PUT", url_up);
message.set_request(file_content_type, Soup.MemoryUse.COPY, data.data);
Soup.Session session = new Soup.Session();