From 30d30f60ccd9f03fddf1b0bbe26d6253fe9cf7f5 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Tue, 23 Feb 2016 10:49:13 +0100 Subject: [PATCH] chat.c: dont change message state to in progress if we failed to send it (fix improper field test) --- coreapi/chat.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/coreapi/chat.c b/coreapi/chat.c index 3cabe976c..e25eecb25 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -418,7 +418,10 @@ void _linphone_chat_room_send_message(LinphoneChatRoom *cr, LinphoneChatMessage linphone_chat_room_delete_composing_refresh_timer(cr); } - linphone_chat_message_set_state(msg, LinphoneChatMessageStateInProgress); + // if operation failed, we should not change message state + if (msg->dir == LinphoneChatMessageOutgoing) { + linphone_chat_message_set_state(msg, LinphoneChatMessageStateInProgress); + } } void linphone_chat_message_update_state(LinphoneChatMessage *msg, LinphoneChatMessageState new_state) { @@ -842,10 +845,10 @@ void linphone_core_real_time_text_received(LinphoneCore *lc, LinphoneChatRoom *c uint32_t new_line = 0x2028; uint32_t crlf = 0x0D0A; uint32_t lf = 0x0A; - + if (call && linphone_call_params_realtime_text_enabled(linphone_call_get_current_params(call))) { LinphoneChatMessageCharacter *cmc = ms_new0(LinphoneChatMessageCharacter, 1); - + if (cr->pending_message == NULL) { cr->pending_message = linphone_chat_room_create_message(cr, ""); } @@ -856,7 +859,7 @@ void linphone_core_real_time_text_received(LinphoneCore *lc, LinphoneChatRoom *c cr->remote_is_composing = LinphoneIsComposingActive; linphone_core_notify_is_composing_received(cr->lc, cr); - + if (character == new_line || character == crlf || character == lf) { // End of message LinphoneChatMessage *msg = cr->pending_message;