Name

otrl_message_receiving — Process a received message

Synopsis

(is_internal, processed_message, tlvs) otrl_message_receiving(ustate,  
 (ops, opdata),  
 local_account,  
 protocol,  
 remote_user,  
 message,  
 (add_app_data_callback, data)); 
OtrlUserState ustate;
tuple (ops, opdata);
string local_account;
string protocol;
string remote_user;
string message;
tuple (add_app_data_callback, data);
 

Description

Handles a received message from remote_user to local_account using protocol, dencrypting it if necessary. It is safe to pass all received messages to this function before further processing.

In the event that a new ConnContext is created in this process, add_app_data_callback(data=data, context=the_new_context) is called so that the ConnContext's app_data can be filled in by the application.

The tuple containing the add_app_data_callback function and the the data is optional, default is not to use app_data.

Returns a tuple (is_internal, processed_message, tlvs). If is_internal is 1 you can ignore processed_message, otherwise processed_message contains the message that should be used for further processing (usually this means: delivery to the local user). tlvs is either None or contains an OtrlTLV which should be checked for it's type and processed accordingly.