Commit 9f2b9df1 authored by Simon Morlat's avatar Simon Morlat

Revert "chat: fix crash when receiving message status notification AFTER...

Revert "chat: fix crash when receiving message status notification AFTER having deleted the chat room"

This reverts commit 08e923a4.
This commit breaks compilation.
parent 08e923a4
......@@ -621,15 +621,13 @@ static void _linphone_chat_room_send_message(LinphoneChatRoom *cr, LinphoneChatM
linphone_chat_message_unref(msg);
}
void linphone_chat_message_update_state(LinphoneChatMessage* chat_msg, LinphoneCore* lc) {
linphone_chat_message_store_state(chat_msg, lc);
void linphone_chat_message_update_state(LinphoneChatMessage* chat_msg ) {
linphone_chat_message_store_state(chat_msg);
if( chat_msg->state == LinphoneChatMessageStateDelivered
|| chat_msg->state == LinphoneChatMessageStateNotDelivered ){
// message is not transient anymore, we can remove it from our transient list and unref it :
if (chat_msg->chat_room) {
chat_msg->chat_room->transient_messages = ms_list_remove(chat_msg->chat_room->transient_messages, chat_msg);
}
chat_msg->chat_room->transient_messages = ms_list_remove(chat_msg->chat_room->transient_messages, chat_msg);
linphone_chat_message_unref(chat_msg);
}
}
......@@ -1089,7 +1087,7 @@ void linphone_chat_message_set_appdata(LinphoneChatMessage* message, const char*
ms_free(message->appdata);
}
message->appdata = data? ms_strdup(data) : NULL;
linphone_chat_message_store_appdata(message, message->chat_room->lc);
linphone_chat_message_store_appdata(message);
}
......
......@@ -253,7 +253,8 @@ unsigned int linphone_chat_message_store(LinphoneChatMessage *msg){
return id;
}
void linphone_chat_message_store_state(LinphoneChatMessage *msg, LinphoneCore *lc){
void linphone_chat_message_store_state(LinphoneChatMessage *msg){
LinphoneCore *lc=msg->chat_room->lc;
if (lc->db){
char *buf=sqlite3_mprintf("UPDATE history SET status=%i WHERE (id = %i);",
msg->state,msg->storage_id);
......@@ -262,7 +263,8 @@ void linphone_chat_message_store_state(LinphoneChatMessage *msg, LinphoneCore *l
}
}
void linphone_chat_message_store_appdata(LinphoneChatMessage* msg, LinphoneCore *lc){
void linphone_chat_message_store_appdata(LinphoneChatMessage* msg){
LinphoneCore *lc=msg->chat_room->lc;
if (lc->db){
char *buf=sqlite3_mprintf("UPDATE history SET appdata=%Q WHERE id=%i;",
msg->appdata,msg->storage_id);
......@@ -669,10 +671,10 @@ unsigned int linphone_chat_message_store(LinphoneChatMessage *cr){
return 0;
}
void linphone_chat_message_store_state(LinphoneChatMessage *cr, LinphoneCore* lc)){
void linphone_chat_message_store_state(LinphoneChatMessage *cr){
}
void linphone_chat_message_store_appdata(LinphoneChatMessage *msg, LinphoneCore *lc){
void linphone_chat_message_store_appdata(LinphoneChatMessage *msg){
}
void linphone_chat_room_mark_as_read(LinphoneChatRoom *cr){
......
......@@ -79,7 +79,7 @@ extern "C" {
#endif
#include <libintl.h>
#ifndef _
#define _(String) dgettext(GETTEXT_PACKAGE,String)
#endif
......@@ -962,8 +962,8 @@ void linphone_upnp_destroy(LinphoneCore *lc);
sqlite3 * linphone_message_storage_init();
void linphone_message_storage_init_chat_rooms(LinphoneCore *lc);
#endif
void linphone_chat_message_store_state(LinphoneChatMessage *msg, LinphoneCore* lc);
void linphone_chat_message_store_appdata(LinphoneChatMessage* msg, LinphoneCore *lc);
void linphone_chat_message_store_state(LinphoneChatMessage *msg);
void linphone_chat_message_store_appdata(LinphoneChatMessage* msg);
void linphone_core_message_storage_init(LinphoneCore *lc);
void linphone_core_message_storage_close(LinphoneCore *lc);
void linphone_core_message_storage_set_debug(LinphoneCore *lc, bool_t debug);
......
......@@ -1692,17 +1692,7 @@ static void history_messages_count() {
}
#endif
static void text_status_after_destroying_chat_room() {
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
LinphoneChatRoom *chatroom = linphone_core_get_chat_room_from_uri(marie->lc, "<sip:Jehan@sip.linphone.org>");
LinphoneChatMessage *message = linphone_chat_room_create_message(chatroom, "hello");
linphone_chat_room_send_chat_message(chatroom, message);
linphone_chat_room_unref(chatroom);
wait_for_until(marie->lc, NULL, &marie->stat.number_of_LinphoneMessageNotDelivered, 1, 1000);
linphone_core_manager_destroy(marie);
}
test_t message_tests[] = {
{ "Text message", text_message },
......@@ -1736,7 +1726,6 @@ test_t message_tests[] = {
,{ "History count", history_messages_count }
,{ "History range", history_range_full_test }
#endif
,{ "Text status after destroying chat room", text_status_after_destroying_chat_room },
};
test_suite_t message_test_suite = {
......@@ -1747,4 +1736,3 @@ test_suite_t message_test_suite = {
message_tests
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment