Message forward
How to use it
Here's the API to create a forward message:
* Creates a forward message attached to the given chat room with a particular message.
* @param chat_room the #LinphoneChatRoom object. @notnil
* @param message #LinphoneChatMessage message to be forwarded. @notnil
* @return a new #LinphoneChatMessage @notnil
*/
LINPHONE_PUBLIC LinphoneChatMessage *linphone_chat_room_create_forward_message (LinphoneChatRoom *chat_room, LinphoneChatMessage *message);
By default the sender of the forwarded message will be anonymized, but you can change that using the following method:
* Enable whether or not to hide sender name in forward message
* @param core The #LinphoneCore @notnil
* @param enable whether or not to enable the feature
**/
LINPHONE_PUBLIC void linphone_core_enable_sender_name_hidden_in_forward_message(LinphoneCore *core, bool_t enable);
You can retrieve this information using the following methods:
* Returns wether the chat message is a forward message or not.
* @param message #LinphoneChatMessage object. @notnil
* @return TRUE if it is a forward message, FALSE otherwise
*/
LINPHONE_PUBLIC bool_t linphone_chat_message_is_forward (LinphoneChatMessage *message);
/**
* Gets the forward info if available as a string
* @param message #LinphoneChatMessage object. @notnil
* @return the original sender of the message if it has been forwarded, NULL otherwise. @maybenil
*/
LINPHONE_PUBLIC const char *linphone_chat_message_get_forward_info (const LinphoneChatMessage *message);
Requirements
Our implementation is based on a CPIM header, CPIM being an IETF standard: https://datatracker.ietf.org/doc/html/rfc3862
As explained in Replying to a specific message requirements, CPIM isn't enable by default on Basic chat room, only in Flexisip based chat rooms, but you can change that in your account parameters.
In case a forward message is sent in a basic chat room without CPIM, it will be sent as a classic SIP SIMPLE message without any information about being a forward.
How it works
Unlike the reply feature, content of the forward message is copied inside a new message, like you could have done manually using the ChatMessage APIs, and we add a CPIM header that contains the information about the original sender of the message if it hasn't been anonymized.