http-files: Report correct file size for encrypted files (slot request)

This commit is contained in:
fiaxh 2018-01-28 23:26:37 +01:00
parent 78de584ad0
commit 8c46c423c0
2 changed files with 15 additions and 15 deletions

View file

@ -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;

View file

@ -15,9 +15,7 @@ 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) => {
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;
@ -30,6 +28,8 @@ public class UploadStreamModule : XmppStreamModule {
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();