Commit 839b3a54 authored by DanmeiChen's avatar DanmeiChen
Browse files

Add new config sender_name_hidden_in_forward_message

parent 6f94e788
......@@ -1473,6 +1473,9 @@ static void sip_config_read(LinphoneCore *lc) {
tmp=lp_config_get_int(lc->config,"app","auto_download_incoming_files_max_size",-1);
linphone_core_set_max_size_for_auto_download_incoming_files(lc, tmp);
tmp=lp_config_get_int(lc->config,"app","sender_name_hidden_in_forward_message",0);
linphone_core_enable_sender_name_hidden_in_forward_message(lc, !!tmp);
/*In case of remote provisionning, function sip_config_read is initialy called in core_init, then in state ConfiguringSuccessfull*/
/*Accordingly, to avoid proxy_config to be added twice, it is mandatory to reset proxy config list from LinphoneCore*/
......@@ -4148,6 +4151,15 @@ void linphone_core_set_max_size_for_auto_download_incoming_files(LinphoneCore *l
lp_config_set_int(lc->config, "app", "auto_download_incoming_files_max_size", size);
}
bool_t linphone_core_is_sender_name_hidden_in_forward_message(LinphoneCore *lc) {
return lc->sender_name_hidden_in_forward_message;
}
void linphone_core_enable_sender_name_hidden_in_forward_message(LinphoneCore *lc, bool_t enable) {
lc->sender_name_hidden_in_forward_message = enable;
lp_config_set_int(lc->config, "app", "sender_name_hidden_in_forward_message", enable);
}
void linphone_core_set_presence_info(LinphoneCore *lc, int minutes_away, const char *contact, LinphoneOnlineStatus os) {
LinphonePresenceModel *presence = NULL;
LinphonePresenceActivity *activity = NULL;
......
......@@ -836,7 +836,8 @@ namespace LinphonePrivate {
bctbx_list_t *chat_rooms; \
bctbx_list_t *callsCache; \
bool_t dns_set_by_app; \
int auto_download_incoming_files_max_size;
int auto_download_incoming_files_max_size; \
bool_t sender_name_hidden_in_forward_message;
#define LINPHONE_CORE_STRUCT_FIELDS \
LINPHONE_CORE_STRUCT_BASE_FIELDS \
......
......@@ -6004,6 +6004,20 @@ LINPHONE_PUBLIC void linphone_core_set_max_size_for_auto_download_incoming_files
**/
LINPHONE_PUBLIC int linphone_core_get_max_size_for_auto_download_incoming_files(LinphoneCore *lc);
/**
* Returns whether or not sender name is hidden in forward message.
* @param[in] lc The #LinphoneCore
* @return whether or not the feature
**/
LINPHONE_PUBLIC bool_t linphone_core_is_sender_name_hidden_in_forward_message(LinphoneCore *lc);
/**
* Enable whether or not to hide sender name in forward message
* @param[in] lc The #LinphoneCore
* @param[in] enable whether or not to enable the feature
**/
LINPHONE_PUBLIC void linphone_core_enable_sender_name_hidden_in_forward_message(LinphoneCore *lc, bool_t enable);
/**
* @}
*/
......
......@@ -562,7 +562,14 @@ shared_ptr<ChatMessage> ChatRoom::createForwardMessage (const shared_ptr<ChatMes
}
// set forward info
std::string fInfo = msg->getForwardInfo().empty()? msg->getFromAddress().asString():msg->getForwardInfo();
std::string fInfo;
bool hidden = linphone_core_is_sender_name_hidden_in_forward_message(getCore()->getCCore());
if (hidden) {
fInfo = "Anonymous";
} else {
fInfo = msg->getForwardInfo().empty()? msg->getFromAddress().asString():msg->getForwardInfo();
}
chatMessage->getPrivate()->setForwardInfo(fInfo);
return chatMessage;
......
......@@ -3256,6 +3256,14 @@ static void group_chat_room_unique_one_to_one_chat_room_with_forward_message_rec
if (linphone_chat_room_get_history_size(marieCr) > 1) {
LinphoneChatMessage *recv_msg = linphone_chat_room_get_last_message_in_history(marieCr);
BC_ASSERT_TRUE(linphone_chat_message_is_forward(recv_msg));
// for marie, forward message by anonymous
LinphoneChatMessage *msgFromMarie = linphone_chat_room_create_forward_message(marieCr, recv_msg);
linphone_chat_message_send(msgFromMarie);
BC_ASSERT_TRUE(linphone_chat_message_is_forward(msgFromMarie));
BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_forward_info(msgFromMarie), "Anonymous");
linphone_chat_message_unref(msgFromMarie);
linphone_chat_message_unref(recv_msg);
}
} else {
......
......@@ -59,3 +59,6 @@ enabled=1
[misc]
hide_chat_rooms_from_removed_proxies=0
hide_empty_chat_rooms=0
[app]
sender_name_hidden_in_forward_message=1
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