From 44327da3ec399aa4eb29a4fb93a585bd99c47af5 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 4 Sep 2015 15:13:51 +0200 Subject: [PATCH] fix declrations --- coreapi/chat.c | 4 +++- coreapi/linphonecore.h | 10 +++++++++- tester/message_tester.c | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/coreapi/chat.c b/coreapi/chat.c index 57e111476..990f06998 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -366,7 +366,8 @@ void linphone_core_enable_chat(LinphoneCore *lc){ bool_t linphone_core_chat_enabled(const LinphoneCore *lc){ return lc->chat_deny_code!=LinphoneReasonNone; } -MSList* linphone_core_get_chat_rooms(LinphoneCore *lc) { + +const MSList* linphone_core_get_chat_rooms(LinphoneCore *lc) { return lc->chatrooms; } @@ -443,6 +444,7 @@ LinphoneChatRoom *linphone_core_get_chat_room(LinphoneCore *lc, const LinphoneAd void linphone_core_delete_chat_room(LinphoneCore *lc, LinphoneChatRoom *cr){ if (ms_list_find(lc->chatrooms, cr)){ lc->chatrooms = ms_list_remove(cr->lc->chatrooms, cr); + linphone_chat_room_delete_history(cr); linphone_chat_room_unref(cr); }else{ ms_error("linphone_core_delete_chat_room(): chatroom [%p] isn't part of LinphoneCore.", diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 53016b499..cdc275bb1 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1250,6 +1250,14 @@ LINPHONE_PUBLIC LinphoneChatRoom *linphone_core_get_chat_room(LinphoneCore *lc, * @return #LinphoneChatRoom where messaging can take place. **/ LINPHONE_PUBLIC LinphoneChatRoom *linphone_core_get_chat_room_from_uri(LinphoneCore *lc, const char *to); + +/** + * Removes a chatroom including all message history from the LinphoneCore. + * @param lc The linphone core + * @param to The chatroom. +**/ +LINPHONE_PUBLIC void linphone_core_delete_chat_room(LinphoneCore *lc, LinphoneChatRoom *cr); + /** * Inconditionnaly disable incoming chat messages. * @param lc the core @@ -1432,7 +1440,7 @@ LINPHONE_PUBLIC LinphoneCore* linphone_chat_room_get_core(LinphoneChatRoom *cr); * @param[in] lc #LinphoneCore object * @return \mslist{LinphoneChatRoom} **/ -LINPHONE_PUBLIC MSList* linphone_core_get_chat_rooms(LinphoneCore *lc); +LINPHONE_PUBLIC const MSList* linphone_core_get_chat_rooms(LinphoneCore *lc); LINPHONE_PUBLIC unsigned int linphone_chat_message_store(LinphoneChatMessage *msg); /** diff --git a/tester/message_tester.c b/tester/message_tester.c index 568b77739..06fc648e3 100644 --- a/tester/message_tester.c +++ b/tester/message_tester.c @@ -1255,7 +1255,7 @@ static void file_transfer_2_messages_simultaneously() { BC_ASSERT_EQUAL(ms_list_size(linphone_core_get_chat_rooms(marie->lc)), 1, int, "%d"); if (ms_list_size(linphone_core_get_chat_rooms(marie->lc)) != 1) { char * buf = ms_strdup_printf("Found %d rooms instead of 1: ", ms_list_size(linphone_core_get_chat_rooms(marie->lc))); - MSList *it = linphone_core_get_chat_rooms(marie->lc); + const MSList *it = linphone_core_get_chat_rooms(marie->lc); while (it) { const LinphoneAddress * peer = linphone_chat_room_get_peer_address(it->data); buf = ms_strcat_printf("%s, ", linphone_address_get_username(peer)); @@ -1515,7 +1515,7 @@ static void message_storage_migration() { LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc"); char *src_db = bc_tester_res("messages.db"); char *tmp_db = bc_tester_file("tmp.db"); - MSList* chatrooms; + const MSList* chatrooms; BC_ASSERT_EQUAL_FATAL(message_tester_copy_file(src_db, tmp_db), 0, int, "%d");