Commit 2ed0e554 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

Added linphonerc field to disable RTT messages database storage

parent c1ebfa17
......@@ -877,7 +877,10 @@ void linphone_core_real_time_text_received(LinphoneCore *lc, LinphoneChatRoom *c
msg->state = LinphoneChatMessageStateDelivered;
msg->is_read = FALSE;
msg->dir = LinphoneChatMessageIncoming;
msg->storage_id = linphone_chat_message_store(msg);
if (lp_config_get_int(lc->config, "misc", "store_rtt_messages", 1) == 1) {
msg->storage_id = linphone_chat_message_store(msg);
}
if (cr->unread_count < 0) cr->unread_count = 1;
else cr->unread_count++;
......@@ -913,6 +916,7 @@ uint32_t linphone_chat_room_get_char(const LinphoneChatRoom *cr) {
int linphone_chat_message_put_char(LinphoneChatMessage *msg, uint32_t character) {
LinphoneChatRoom *cr = linphone_chat_message_get_chat_room(msg);
LinphoneCall *call = cr->call;
LinphoneCore *lc = cr->lc;
uint32_t new_line = 0x2028;
uint32_t crlf = 0x0D0A;
uint32_t lf = 0x0A;
......@@ -922,16 +926,18 @@ int linphone_chat_message_put_char(LinphoneChatMessage *msg, uint32_t character)
}
if (character == new_line || character == crlf || character == lf) {
ms_debug("New line sent, forge a message with content %s", msg->message);
msg->time = ms_time(0);
msg->state = LinphoneChatMessageStateDelivered;
msg->is_read = TRUE;
msg->dir = LinphoneChatMessageOutgoing;
if (msg->from) linphone_address_destroy(msg->from);
msg->from = linphone_address_new(linphone_core_get_identity(cr->lc));
msg->storage_id = linphone_chat_message_store(msg);
ms_free(msg->message);
msg->message = NULL;
if (lc && lp_config_get_int(lc->config, "misc", "store_rtt_messages", 1) == 1) {
ms_debug("New line sent, forge a message with content %s", msg->message);
msg->time = ms_time(0);
msg->state = LinphoneChatMessageStateDelivered;
msg->is_read = TRUE;
msg->dir = LinphoneChatMessageOutgoing;
if (msg->from) linphone_address_destroy(msg->from);
msg->from = linphone_address_new(linphone_core_get_identity(lc));
msg->storage_id = linphone_chat_message_store(msg);
ms_free(msg->message);
msg->message = NULL;
}
} else {
char *value = utf8_to_char(character);
msg->message = ms_strcat_printf(msg->message, value);
......
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