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
24
Merge Requests
24
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
b7fdc471
Commit
b7fdc471
authored
Oct 04, 2017
by
Sylvain Berfini
🎩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added CPIM tester
parent
6caf117b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
6 deletions
+32
-6
chat-message.cpp
src/chat/chat-message.cpp
+5
-0
chat-message.h
src/chat/chat-message.h
+1
-0
cpim-chat-message-modifier.cpp
src/chat/modifier/cpim-chat-message-modifier.cpp
+1
-0
cpim-tester.cpp
tester/cpim-tester.cpp
+25
-6
No files found.
src/chat/chat-message.cpp
View file @
b7fdc471
...
...
@@ -1310,6 +1310,11 @@ void ChatMessage::removeContent (const Content& content) {
d
->
contents
.
remove
(
content
);
}
const
Content
&
ChatMessage
::
getInternalContent
()
const
{
L_D
();
return
d
->
internalContent
;
}
string
ChatMessage
::
getCustomHeaderValue
(
const
string
&
headerName
)
const
{
L_D
();
try
{
...
...
src/chat/chat-message.h
View file @
b7fdc471
...
...
@@ -125,6 +125,7 @@ public:
const
std
::
list
<
Content
>&
getContents
()
const
;
void
addContent
(
const
Content
&
content
);
void
removeContent
(
const
Content
&
content
);
const
Content
&
getInternalContent
()
const
;
std
::
string
getCustomHeaderValue
(
const
std
::
string
&
headerName
)
const
;
void
addCustomHeader
(
const
std
::
string
&
headerName
,
const
std
::
string
&
headerValue
);
...
...
src/chat/modifier/cpim-chat-message-modifier.cpp
View file @
b7fdc471
...
...
@@ -89,6 +89,7 @@ int CpimChatMessageModifier::decode (ChatMessagePrivate *messagePrivate) {
ContentType
newContentType
(
message
->
getContentHeaders
()
->
front
()
->
getValue
());
newContent
.
setContentType
(
newContentType
);
newContent
.
setBody
(
message
->
getContent
());
messagePrivate
->
internalContent
=
newContent
;
}
else
{
//TODO
}
...
...
tester/cpim-tester.cpp
View file @
b7fdc471
...
...
@@ -17,6 +17,9 @@
*/
#include "chat/cpim/cpim.h"
#include "address/address.h"
#include "chat/basic-chat-room.h"
#include "chat/chat-message.h"
#include "liblinphone_tester.h"
...
...
@@ -379,12 +382,29 @@ static void build_message () {
BC_ASSERT_STRING_EQUAL
(
strMessage
.
c_str
(),
expectedMessage
.
c_str
());
}
static
void
cpim_chat_message_modifier_encoder
(
void
)
{
}
static
void
cpim_chat_message_modifier
(
void
)
{
LinphoneCoreManager
*
marie
=
linphone_core_manager_new
(
"marie_rc"
);
LinphoneCoreManager
*
pauline
=
linphone_core_manager_new
(
"pauline_tcp_rc"
);
LpConfig
*
config
=
linphone_core_get_config
(
marie
->
lc
);
lp_config_set_int
(
config
,
"sip"
,
"use_cpim"
,
1
);
Address
paulineAddress
(
linphone_address_as_string_uri_only
(
pauline
->
identity
));
shared_ptr
<
ChatRoom
>
marieRoom
=
ObjectFactory
::
create
<
BasicChatRoom
>
(
marie
->
lc
,
paulineAddress
);
static
void
cpim_chat_message_modifier_decoder
(
void
)
{
shared_ptr
<
ChatMessage
>
marieMessage
=
marieRoom
->
createMessage
(
"Hello CPIM"
);
marieRoom
->
sendMessage
(
marieMessage
);
BC_ASSERT_TRUE
(
wait_for
(
pauline
->
lc
,
marie
->
lc
,
&
pauline
->
stat
.
number_of_LinphoneMessageReceived
,
1
));
BC_ASSERT_TRUE
(
ContentType
::
isCpim
(
marieMessage
->
getInternalContent
().
getContentType
().
asString
()));
BC_ASSERT_PTR_NOT_NULL
(
pauline
->
stat
.
last_received_chat_message
);
if
(
pauline
->
stat
.
last_received_chat_message
!=
NULL
)
{
BC_ASSERT_STRING_EQUAL
(
linphone_chat_message_get_text
(
pauline
->
stat
.
last_received_chat_message
),
"Hello CPIM"
);
BC_ASSERT_STRING_EQUAL
(
linphone_chat_message_get_content_type
(
pauline
->
stat
.
last_received_chat_message
),
"text/plain"
);
}
linphone_core_manager_destroy
(
marie
);
linphone_core_manager_destroy
(
pauline
);
}
test_t
cpim_tests
[]
=
{
...
...
@@ -397,8 +417,7 @@ test_t cpim_tests[] = {
TEST_NO_TAG
(
"Parse RFC example"
,
parse_rfc_example
),
TEST_NO_TAG
(
"Parse Message with generic header parameters"
,
parse_message_with_generic_header_parameters
),
TEST_NO_TAG
(
"Build Message"
,
build_message
),
TEST_NO_TAG
(
"CPIM chat message modifier encoder"
,
cpim_chat_message_modifier_encoder
),
TEST_NO_TAG
(
"CPIM chat message modifier decoder"
,
cpim_chat_message_modifier_decoder
)
TEST_NO_TAG
(
"CPIM chat message modifier"
,
cpim_chat_message_modifier
)
};
test_suite_t
cpim_test_suite
=
{
...
...
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