Source

Target

Commits (1)
Showing with 2655 additions and 2490 deletions
......@@ -445,7 +445,7 @@ static void message_received(SalOp *op, const SalMessage *msg){
LinphoneCall *call=(LinphoneCall*)op->getUserPointer();
LinphoneReason reason = lc->chat_deny_code;
if (reason == LinphoneReasonNone) {
linphone_core_message_received(lc, op, msg);
reason = linphone_core_message_received(lc, op, msg);
}
auto messageOp = dynamic_cast<SalMessageOpInterface *>(op);
messageOp->reply(linphone_reason_to_sal(reason));
......
......@@ -151,10 +151,13 @@ LinphoneChatRoom *linphone_core_find_one_to_one_chat_room_2 (
);
}
int linphone_core_message_received(LinphoneCore *lc, LinphonePrivate::SalOp *op, const SalMessage *sal_msg) {
LinphoneReason linphone_core_message_received(LinphoneCore *lc, LinphonePrivate::SalOp *op, const SalMessage *sal_msg) {
LinphoneReason reason = LinphoneReasonNotAcceptable;
std::string peerAddress;
std::string localAddress;
const char *session_mode = sal_custom_header_find(op->getRecvCustomHeaders(), "Session-mode");
if (linphone_core_conference_server_enabled(lc)) {
localAddress = peerAddress = op->getTo();
} else {
......@@ -170,9 +173,18 @@ int linphone_core_message_received(LinphoneCore *lc, LinphonePrivate::SalOp *op,
if (chatRoom)
reason = L_GET_PRIVATE(chatRoom)->onSipMessageReceived(op, sal_msg);
else if (!linphone_core_conference_server_enabled(lc)) {
chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->getOrCreateBasicChatRoom(conferenceId);
if (chatRoom)
reason = L_GET_PRIVATE(chatRoom)->onSipMessageReceived(op, sal_msg);
/* Client mode but check that it is really for basic chatroom before creating it.*/
if (session_mode && strcasecmp(session_mode, "true") == 0){
lError() << "Message is received in the context of a client chatroom for which we have no context.";
reason = LinphoneReasonNotAcceptable;
}else{
chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->getOrCreateBasicChatRoom(conferenceId);
if (chatRoom)
reason = L_GET_PRIVATE(chatRoom)->onSipMessageReceived(op, sal_msg);
}
}else{
/* Server mode but chatroom not found. */
reason = LinphoneReasonNotFound;
}
return reason;
}
......
......@@ -270,7 +270,7 @@ LINPHONE_PUBLIC void linphone_core_get_local_ip(LinphoneCore *lc, int af, const
LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LinphoneCore *lc, int index);
void linphone_proxy_config_write_to_config_file(LinphoneConfig* config,LinphoneProxyConfig *obj, int index);
int linphone_core_message_received(LinphoneCore *lc, LinphonePrivate::SalOp *op, const SalMessage *msg);
LinphoneReason linphone_core_message_received(LinphoneCore *lc, LinphonePrivate::SalOp *op, const SalMessage *msg);
void linphone_core_real_time_text_received(LinphoneCore *lc, LinphoneChatRoom *cr, uint32_t character, LinphoneCall *call);
void linphone_call_init_media_streams(LinphoneCall *call);
......
......@@ -195,6 +195,7 @@ set(SOURCE_FILES_C
eventapi_tester.c
flexisip_tester.c
group_chat_tester.c
group_chat_secure.c
liblinphone_tester.c
log_collection_tester.c
message_tester.c
......
This diff is collapsed.
This diff is collapsed.
......@@ -309,6 +309,8 @@ int logfile_arg_func(const char *arg) {
void liblinphone_tester_add_suites() {
bc_tester_add_suite(&setup_test_suite);
bc_tester_add_suite(&register_test_suite);
bc_tester_add_suite(&group_chat_test_suite);
bc_tester_add_suite(&secure_group_chat_test_suite);
bc_tester_add_suite(&tunnel_test_suite);
bc_tester_add_suite(&offeranswer_test_suite);
bc_tester_add_suite(&call_test_suite);
......@@ -349,7 +351,6 @@ void liblinphone_tester_add_suites() {
#ifdef VCARD_ENABLED
bc_tester_add_suite(&vcard_test_suite);
#endif
bc_tester_add_suite(&group_chat_test_suite);
bc_tester_add_suite(&utils_test_suite);
}
......
......@@ -62,6 +62,7 @@ extern test_suite_t event_test_suite;
extern test_suite_t main_db_test_suite;
extern test_suite_t flexisip_test_suite;
extern test_suite_t group_chat_test_suite;
extern test_suite_t secure_group_chat_test_suite;
extern test_suite_t log_collection_test_suite;
extern test_suite_t message_test_suite;
extern test_suite_t multi_call_test_suite;
......@@ -377,6 +378,11 @@ void message_received(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMess
void file_transfer_received(LinphoneChatMessage *message, const LinphoneContent* content, const LinphoneBuffer *buffer);
LinphoneBuffer * tester_file_transfer_send(LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t size);
LinphoneChatMessage *_send_message(LinphoneChatRoom *chatRoom, const char *message);
void _send_file_plus_text(LinphoneChatRoom* cr, const char *sendFilepath, const char *text);
void _send_file(LinphoneChatRoom* cr, const char *sendFilepath);
void _receive_file(bctbx_list_t *coresList, LinphoneCoreManager *lcm, stats *receiverStats, const char *receive_filepath, const char *sendFilepath);
void _receive_file_plus_text(bctbx_list_t *coresList, LinphoneCoreManager *lcm, stats *receiverStats, const char *receive_filepath, const char *sendFilepath, const char *text);
LinphoneBuffer * tester_memory_file_transfer_send(LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t size);
void file_transfer_progress_indication(LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t total);
void is_composing_received(LinphoneCore *lc, LinphoneChatRoom *room);
......