Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
7811dfa3
Commit
7811dfa3
authored
Dec 18, 2017
by
Sylvain Berfini
🐮
Browse files
Added size information to FileTransferContent
parent
7a100ac9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
2 deletions
+28
-2
src/chat/modifier/file-transfer-chat-message-modifier.cpp
src/chat/modifier/file-transfer-chat-message-modifier.cpp
+7
-1
src/content/file-transfer-content.cpp
src/content/file-transfer-content.cpp
+18
-1
src/content/file-transfer-content.h
src/content/file-transfer-content.h
+3
-0
No files found.
src/chat/modifier/file-transfer-chat-message-modifier.cpp
View file @
7811dfa3
...
...
@@ -517,10 +517,16 @@ static void fillFileTransferContentInformationsFromVndGsmaRcsFtHttpXml(FileTrans
if
(
!
xmlStrcmp
(
typeAttribute
,
(
const
xmlChar
*
)
"file"
))
{
/* this is the node we are looking for */
cur
=
cur
->
xmlChildrenNode
;
/* now loop on the content of the file-info node */
while
(
cur
!=
nullptr
)
{
if
(
!
xmlStrcmp
(
cur
->
name
,
(
const
xmlChar
*
)
"file-size"
))
{
xmlChar
*
fileSizeString
=
xmlNodeListGetString
(
xmlMessageBody
,
cur
->
xmlChildrenNode
,
1
);
size_t
size
=
(
size_t
)
strtol
((
const
char
*
)
fileSizeString
,
nullptr
,
10
);
fileTransferContent
->
setFileSize
(
size
);
xmlFree
(
fileSizeString
);
}
if
(
!
xmlStrcmp
(
cur
->
name
,
(
const
xmlChar
*
)
"file-name"
))
{
xmlChar
*
filename
=
xmlNodeListGetString
(
xmlMessageBody
,
cur
->
xmlChildrenNode
,
1
);
fileTransferContent
->
setFileName
((
char
*
)
filename
);
xmlFree
(
filename
);
}
if
(
!
xmlStrcmp
(
cur
->
name
,
(
const
xmlChar
*
)
"data"
))
{
...
...
src/content/file-transfer-content.cpp
View file @
7811dfa3
...
...
@@ -37,6 +37,7 @@ public:
string
fileUrl
;
string
filePath
;
FileContent
*
fileContent
=
nullptr
;
size_t
fileSize
=
0
;
};
// -----------------------------------------------------------------------------
...
...
@@ -49,6 +50,7 @@ FileTransferContent::FileTransferContent (const FileTransferContent &src) : Cont
d
->
fileUrl
=
src
.
getFileUrl
();
d
->
filePath
=
src
.
getFilePath
();
d
->
fileContent
=
src
.
getFileContent
();
d
->
fileSize
=
src
.
getFileSize
();
}
FileTransferContent
::
FileTransferContent
(
FileTransferContent
&&
src
)
:
Content
(
*
new
FileTransferContentPrivate
)
{
...
...
@@ -57,6 +59,7 @@ FileTransferContent::FileTransferContent (FileTransferContent &&src) : Content(*
d
->
fileUrl
=
move
(
src
.
getPrivate
()
->
fileUrl
);
d
->
filePath
=
move
(
src
.
getPrivate
()
->
filePath
);
d
->
fileContent
=
move
(
src
.
getPrivate
()
->
fileContent
);
d
->
fileSize
=
move
(
src
.
getPrivate
()
->
fileSize
);
}
FileTransferContent
&
FileTransferContent
::
operator
=
(
const
FileTransferContent
&
src
)
{
...
...
@@ -67,6 +70,7 @@ FileTransferContent &FileTransferContent::operator= (const FileTransferContent &
d
->
fileUrl
=
src
.
getFileUrl
();
d
->
filePath
=
src
.
getFilePath
();
d
->
fileContent
=
src
.
getFileContent
();
d
->
fileSize
=
src
.
getFileSize
();
}
return
*
this
;
...
...
@@ -79,6 +83,7 @@ FileTransferContent &FileTransferContent::operator= (FileTransferContent &&src)
d
->
fileUrl
=
move
(
src
.
getPrivate
()
->
fileUrl
);
d
->
filePath
=
move
(
src
.
getPrivate
()
->
filePath
);
d
->
fileContent
=
move
(
src
.
getPrivate
()
->
fileContent
);
d
->
fileSize
=
move
(
src
.
getPrivate
()
->
fileSize
);
return
*
this
;
}
...
...
@@ -87,7 +92,8 @@ bool FileTransferContent::operator== (const FileTransferContent &content) const
return
Content
::
operator
==
(
content
)
&&
d
->
fileName
==
content
.
getFileName
()
&&
d
->
fileUrl
==
content
.
getFileUrl
()
&&
d
->
filePath
==
content
.
getFilePath
();
d
->
filePath
==
content
.
getFilePath
()
&&
d
->
fileSize
==
content
.
getFileSize
();
}
void
FileTransferContent
::
setFileName
(
const
string
&
name
)
{
...
...
@@ -130,11 +136,22 @@ FileContent *FileTransferContent::getFileContent () const {
return
d
->
fileContent
;
}
void
FileTransferContent
::
setFileSize
(
size_t
size
)
{
L_D
();
d
->
fileSize
=
size
;
}
size_t
FileTransferContent
::
getFileSize
()
const
{
L_D
();
return
d
->
fileSize
;
}
LinphoneContent
*
FileTransferContent
::
toLinphoneContent
()
const
{
LinphoneContent
*
content
=
linphone_core_create_content
(
nullptr
);
linphone_content_set_type
(
content
,
getContentType
().
getType
().
c_str
());
linphone_content_set_subtype
(
content
,
getContentType
().
getSubType
().
c_str
());
linphone_content_set_name
(
content
,
getFileName
().
c_str
());
linphone_content_set_size
(
content
,
getFileSize
());
return
content
;
}
...
...
src/content/file-transfer-content.h
View file @
7811dfa3
...
...
@@ -52,6 +52,9 @@ public:
void
setFileContent
(
FileContent
*
content
);
FileContent
*
getFileContent
()
const
;
void
setFileSize
(
size_t
size
);
size_t
getFileSize
()
const
;
// TODO: Remove me later.
LinphoneContent
*
toLinphoneContent
()
const
override
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment