Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liblinphone
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
10
Issues
10
List
Board
Labels
Milestones
Merge Requests
21
Merge Requests
21
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
External Wiki
External Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
BC
public
liblinphone
Commits
ead7221c
Commit
ead7221c
authored
Mar 13, 2018
by
Ghislain MARY
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle Content-Encoding in C++ Content object.
parent
307e27e6
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
2 deletions
+33
-2
client-group-chat-room.cpp
src/chat/chat-room/client-group-chat-room.cpp
+4
-0
local-conference-event-handler.cpp
src/conference/handlers/local-conference-event-handler.cpp
+4
-0
content-p.h
src/content/content-p.h
+1
-0
content.cpp
src/content/content.cpp
+16
-1
content.h
src/content/content.h
+3
-0
call-op.cpp
src/sal/call-op.cpp
+5
-1
No files found.
src/chat/chat-room/client-group-chat-room.cpp
View file @
ead7221c
...
...
@@ -310,6 +310,10 @@ void ClientGroupChatRoom::addParticipants (
content
.
setBody
(
getResourceLists
(
addressesList
));
content
.
setContentType
(
"application/resource-lists+xml"
);
content
.
setContentDisposition
(
"recipient-list"
);
// TODO: Activate compression
//if (linphone_core_content_encoding_supported(getCore()->getCCore(), "deflate"))
// content.setContentEncoding("deflate");
// TODO: Activate compression
shared_ptr
<
CallSession
>
session
=
dConference
->
focus
->
getPrivate
()
->
getSession
();
if
(
session
)
...
...
src/conference/handlers/local-conference-event-handler.cpp
View file @
ead7221c
...
...
@@ -372,6 +372,10 @@ void LocalConferenceEventHandlerPrivate::notifyParticipantDevice (const string &
content
,
multipart
?
"mixed;boundary=---------------------------14737809831466499882746641449"
:
"conference-info"
);
// TODO: Activate compression
//if (linphone_core_content_encoding_supported(conf->getCore()->getCCore(), "deflate"))
// linphone_content_set_encoding(content, "deflate");
// TODO: Activate compression
linphone_event_notify
(
ev
,
content
);
linphone_content_unref
(
content
);
}
...
...
src/content/content-p.h
View file @
ead7221c
...
...
@@ -33,6 +33,7 @@ private:
std
::
vector
<
char
>
body
;
ContentType
contentType
;
std
::
string
contentDisposition
;
std
::
string
contentEncoding
;
std
::
list
<
std
::
pair
<
std
::
string
,
std
::
string
>>
headers
;
L_DECLARE_PUBLIC
(
Content
);
...
...
src/content/content.cpp
View file @
ead7221c
...
...
@@ -40,7 +40,8 @@ Content::Content (const Content &other) : ClonableObject(*new ContentPrivate), A
L_D
();
d
->
body
=
other
.
getBody
();
d
->
contentType
=
other
.
getContentType
();
d
->
contentDisposition
=
other
.
getContentDisposition
();;
d
->
contentDisposition
=
other
.
getContentDisposition
();
d
->
contentEncoding
=
other
.
getContentEncoding
();
d
->
headers
=
other
.
getHeaders
();
}
...
...
@@ -50,6 +51,7 @@ Content::Content (Content &&other) : ClonableObject(*new ContentPrivate), AppDat
d
->
body
=
move
(
dOther
->
body
);
d
->
contentType
=
move
(
dOther
->
contentType
);
d
->
contentDisposition
=
move
(
dOther
->
contentDisposition
);
d
->
contentEncoding
=
move
(
dOther
->
contentEncoding
);
d
->
headers
=
move
(
dOther
->
headers
);
}
...
...
@@ -71,6 +73,7 @@ Content &Content::operator= (const Content &other) {
d
->
body
=
other
.
getBody
();
d
->
contentType
=
other
.
getContentType
();
d
->
contentDisposition
=
other
.
getContentDisposition
();
d
->
contentEncoding
=
other
.
getContentEncoding
();
d
->
headers
=
other
.
getHeaders
();
}
return
*
this
;
...
...
@@ -83,6 +86,7 @@ Content &Content::operator= (Content &&other) {
d
->
body
=
move
(
dOther
->
body
);
d
->
contentType
=
move
(
dOther
->
contentType
);
d
->
contentDisposition
=
move
(
dOther
->
contentDisposition
);
d
->
contentEncoding
=
move
(
dOther
->
contentEncoding
);
d
->
headers
=
move
(
dOther
->
headers
);
return
*
this
;
}
...
...
@@ -92,6 +96,7 @@ bool Content::operator== (const Content &other) const {
return
d
->
contentType
==
other
.
getContentType
()
&&
d
->
body
==
other
.
getBody
()
&&
d
->
contentDisposition
==
other
.
getContentDisposition
()
&&
d
->
contentEncoding
==
other
.
getContentEncoding
()
&&
d
->
headers
==
other
.
getHeaders
();
}
...
...
@@ -120,6 +125,16 @@ void Content::setContentDisposition (const string &contentDisposition) {
d
->
contentDisposition
=
contentDisposition
;
}
const
string
&
Content
::
getContentEncoding
()
const
{
L_D
();
return
d
->
contentEncoding
;
}
void
Content
::
setContentEncoding
(
const
string
&
contentEncoding
)
{
L_D
();
d
->
contentEncoding
=
contentEncoding
;
}
const
vector
<
char
>
&
Content
::
getBody
()
const
{
L_D
();
return
d
->
body
;
...
...
src/content/content.h
View file @
ead7221c
...
...
@@ -54,6 +54,9 @@ public:
const
std
::
string
&
getContentDisposition
()
const
;
void
setContentDisposition
(
const
std
::
string
&
contentDisposition
);
const
std
::
string
&
getContentEncoding
()
const
;
void
setContentEncoding
(
const
std
::
string
&
contentEncoding
);
const
std
::
vector
<
char
>
&
getBody
()
const
;
std
::
string
getBodyAsString
()
const
;
std
::
string
getBodyAsUtf8String
()
const
;
...
...
src/sal/call-op.cpp
View file @
ead7221c
...
...
@@ -103,6 +103,7 @@ belle_sip_header_allow_t *SalCallOp::create_allow(bool_t enable_update) {
int
SalCallOp
::
set_custom_body
(
belle_sip_message_t
*
msg
,
const
Content
&
body
)
{
ContentType
contentType
=
body
.
getContentType
();
string
contentDisposition
=
body
.
getContentDisposition
();
string
contentEncoding
=
body
.
getContentEncoding
();
size_t
bodySize
=
body
.
getBody
().
size
();
if
(
bodySize
>
SIP_MESSAGE_BODY_LIMIT
)
{
...
...
@@ -118,12 +119,15 @@ int SalCallOp::set_custom_body(belle_sip_message_t *msg, const Content &body) {
belle_sip_header_content_disposition_t
*
contentDispositionHeader
=
belle_sip_header_content_disposition_create
(
contentDisposition
.
c_str
());
belle_sip_message_add_header
(
msg
,
BELLE_SIP_HEADER
(
contentDispositionHeader
));
}
if
(
!
contentEncoding
.
empty
())
belle_sip_message_add_header
(
msg
,
belle_sip_header_create
(
"Content-Encoding"
,
contentEncoding
.
c_str
()));
belle_sip_header_content_length_t
*
content_length
=
belle_sip_header_content_length_create
(
bodySize
);
belle_sip_message_add_header
(
msg
,
BELLE_SIP_HEADER
(
content_length
));
if
(
bodySize
>
0
)
{
char
*
buffer
=
bctbx_new
(
char
,
bodySize
);
char
*
buffer
=
bctbx_new
(
char
,
bodySize
+
1
);
memcpy
(
buffer
,
body
.
getBody
().
data
(),
bodySize
);
buffer
[
bodySize
]
=
'\0'
;
belle_sip_message_assign_body
(
msg
,
buffer
,
bodySize
);
}
...
...
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