chat: refactoring it to always invoke callbacks when changing state, reenable disabled tests and add two new file upload tests where liblinphone should not crash while it does currently

This commit is contained in:
Gautier Pelloux-Prayer 2015-09-16 11:29:47 +02:00
parent 51df1ca124
commit fdf5abefd6
8 changed files with 890 additions and 840 deletions

View file

@ -1252,18 +1252,7 @@ static void text_delivery_update(SalOp *op, SalTextDeliveryStatus status){
}
// check that the message does not belong to an already destroyed chat room - if so, do not invoke callbacks
if (chat_msg->chat_room != NULL) {
chat_msg->state=chatStatusSal2Linphone(status);
linphone_chat_message_update_state(chat_msg);
if (chat_msg && (chat_msg->cb || (chat_msg->callbacks && linphone_chat_message_cbs_get_msg_state_changed(chat_msg->callbacks)))) {
ms_message("Notifying text delivery with status %s",linphone_chat_message_state_to_string(chat_msg->state));
if (chat_msg->callbacks && linphone_chat_message_cbs_get_msg_state_changed(chat_msg->callbacks)) {
linphone_chat_message_cbs_get_msg_state_changed(chat_msg->callbacks)(chat_msg, chat_msg->state);
} else {
/* Legacy */
chat_msg->cb(chat_msg,chat_msg->state,chat_msg->cb_ud);
}
}
linphone_chat_message_update_state(chat_msg, chatStatusSal2Linphone(status));
}
if (status != SalTextDeliveryInProgress) { /*only release op if not in progress*/
linphone_chat_message_destroy(chat_msg);

File diff suppressed because it is too large Load diff

View file

@ -205,8 +205,8 @@ struct _LinphoneChatMessage {
LinphoneChatMessageCbs *callbacks;
LinphoneChatMessageDir dir;
char* message;
LinphoneChatMessageStateChangedCb cb;
void* cb_ud;
LinphoneChatMessageStateChangedCb message_state_changed_cb;
void* message_state_changed_user_data;
void* message_userdata;
char* appdata;
char* external_body_url;
@ -501,7 +501,7 @@ void _linphone_proxy_config_release_ops(LinphoneProxyConfig *obj);
/*chat*/
void linphone_chat_room_release(LinphoneChatRoom *cr);
void linphone_chat_message_destroy(LinphoneChatMessage* msg);
void linphone_chat_message_update_state(LinphoneChatMessage* chat_msg );
void linphone_chat_message_update_state(LinphoneChatMessage *msg, LinphoneChatMessageState new_state);
/**/
struct _LinphoneProxyConfig

View file

@ -45,37 +45,33 @@ set(SOURCE_FILES
tunnel_tester.c
upnp_tester.c
video_tester.c
)
)
add_definitions(-DBC_CONFIG_FILE="config.h")
if(IOS)
add_library(linphonetester STATIC ${SOURCE_FILES})
target_include_directories(linphonetester PUBLIC ${CUNIT_INCLUDE_DIRS} PRIVATE common)
target_link_libraries(linphonetester linphone ${CUNIT_LIBRARIES})
install(TARGETS linphonetester
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
install(FILES "liblinphone_tester.h" "common/bc_tester_utils.h"
DESTINATION include/linphone
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
add_library(linphonetester STATIC ${SOURCE_FILES})
target_include_directories(linphonetester PUBLIC ${CUNIT_INCLUDE_DIRS} PRIVATE common)
target_link_libraries(linphonetester linphone ${CUNIT_LIBRARIES})
install(TARGETS linphonetester
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
install(FILES "liblinphone_tester.h" "common/bc_tester_utils.h"
DESTINATION include/linphone
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
else()
add_executable(liblinphone_tester ${SOURCE_FILES})
set_target_properties(liblinphone_tester PROPERTIES LINKER_LANGUAGE CXX)
target_include_directories(liblinphone_tester PUBLIC ${CUNIT_INCLUDE_DIRS} PRIVATE common)
target_link_libraries(liblinphone_tester linphone ${CUNIT_LIBRARIES})
if (GTK2_FOUND)
target_compile_definitions(liblinphone_tester PRIVATE HAVE_GTK)
target_include_directories(liblinphone_tester PUBLIC ${GTK2_INCLUDE_DIRS})
target_link_libraries(liblinphone_tester linphone ${GTK2_LIBRARIES})
endif()
add_executable(liblinphone_tester ${SOURCE_FILES})
set_target_properties(liblinphone_tester PROPERTIES LINKER_LANGUAGE CXX)
target_include_directories(liblinphone_tester PUBLIC ${CUNIT_INCLUDE_DIRS} PRIVATE common)
target_link_libraries(liblinphone_tester linphone ${CUNIT_LIBRARIES})
if (GTK2_FOUND)
target_compile_definitions(liblinphone_tester PRIVATE HAVE_GTK)
target_include_directories(liblinphone_tester PUBLIC ${GTK2_INCLUDE_DIRS})
target_link_libraries(liblinphone_tester linphone ${GTK2_LIBRARIES})
endif()
endif()

View file

@ -784,7 +784,7 @@ static void file_transfer_message_rcs_to_external_body_client(void) {
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d");
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1, int, "%d");
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageExtBodyReceived,1, int, "%d");
BC_ASSERT_TRUE(compare_files(send_filepath, receive_filepath));
compare_files(send_filepath, receive_filepath);
linphone_content_unref(content);
linphone_core_manager_destroy(marie);

View file

@ -318,7 +318,7 @@ void call_base_with_configfile(LinphoneMediaEncryption mode, bool_t enable_video
void call_base(LinphoneMediaEncryption mode, bool_t enable_video,bool_t enable_relay,LinphoneFirewallPolicy policy,bool_t enable_tunnel);
bool_t call_with_caller_params(LinphoneCoreManager* caller_mgr,LinphoneCoreManager* callee_mgr, const LinphoneCallParams *params);
bool_t pause_call_1(LinphoneCoreManager* mgr_1,LinphoneCall* call_1,LinphoneCoreManager* mgr_2,LinphoneCall* call_2);
bool_t compare_files(const char *path1, const char *path2);
void compare_files(const char *path1, const char *path2);
void check_media_direction(LinphoneCoreManager* mgr, LinphoneCall *call, MSList* lcs,LinphoneMediaDirection audio_dir, LinphoneMediaDirection video_dir);
extern const MSAudioDiffParams audio_cmp_params;

File diff suppressed because it is too large Load diff

View file

@ -115,7 +115,9 @@ LinphoneCore* configure_lc_from(LinphoneCoreVTable* v_table, const char* path, c
if (file){
filepath = ms_strdup_printf("%s/%s", path, file);
BC_ASSERT_EQUAL_FATAL(ortp_file_exist(filepath),0,int, "%d");
if (ortp_file_exist(filepath) != 0) {
ms_fatal("Could not find file %s in path %s, did you configured resources directory correctly?", file, path);
}
config = lp_config_new_with_factory(NULL,filepath);
}