Fixed group chat's Send File + Text message test

This commit is contained in:
Sylvain Berfini 2018-04-24 18:11:20 +02:00
parent 95cac9b579
commit 03520fcd52
3 changed files with 14 additions and 5 deletions

View file

@ -925,7 +925,7 @@ int lime_im_encryption_engine_process_uploading_file_cb(LinphoneImEncryptionEngi
if (!buffer || *size == 0)
return lime_encryptFile(linphone_content_get_cryptoContext_address(content), NULL, 0, NULL, NULL);
size_t file_size = linphone_content_get_size(content);
size_t file_size = linphone_content_get_file_size(content);
if (file_size == 0) {
ms_warning("File size has not been set, encryption will fail if not done in one step (if file is larger than 16K)");
} else if (offset + *size < file_size) {

View file

@ -136,6 +136,13 @@ LINPHONE_PUBLIC void linphone_content_set_string_buffer (LinphoneContent *conten
*/
LINPHONE_PUBLIC size_t linphone_content_get_size (const LinphoneContent *content);
/**
* Get the file size if content is either a FileContent or a FileTransferContent.
* @param[in] content #LinphoneContent object.
* @return The represented file size.
*/
LINPHONE_PUBLIC size_t linphone_content_get_file_size(const LinphoneContent *content);
/**
* Set the content data size, excluding null character despite null character is always set for convenience.
* @param[in] content #LinphoneContent object

View file

@ -125,17 +125,19 @@ void linphone_content_set_string_buffer (LinphoneContent *content, const char *b
L_GET_CPP_PTR_FROM_C_OBJECT(content)->setBodyFromUtf8(L_C_TO_STRING(buffer));
}
size_t linphone_content_get_size (const LinphoneContent *content) {
size_t linphone_content_get_file_size(const LinphoneContent *content) {
const LinphonePrivate::Content *c = L_GET_CPP_PTR_FROM_C_OBJECT(content);
size_t size = 0;
if (c->isFile())
size = static_cast<const LinphonePrivate::FileContent *>(c)->getFileSize();
else if (c->isFileTransfer())
size = static_cast<const LinphonePrivate::FileTransferContent *>(c)->getFileSize();
return size;
}
if (size == 0) {
size = c->getSize();
}
size_t linphone_content_get_size (const LinphoneContent *content) {
const LinphonePrivate::Content *c = L_GET_CPP_PTR_FROM_C_OBJECT(content);
size_t size = c->getSize();
if (size == 0) {
size = content->size;
}