otrl_message_sending — Handle a message about to be sent to the network
string otrl_message_sending( | ustate, | |
(ops, opdata), | ||
local_account, | ||
protocol, | ||
remote_user, | ||
message, | ||
tlvs, | ||
(add_app_data_callback, data)) ; |
OtrlUserState ustate
;tuple (ops, opdata)
;string local_account
;string protocol
;string remote_user
;string message
;OtrlTLV tlvs
;tuple (add_app_data_callback, data)
;
Handles a message
about to be sent, encrypting it if necessary. It is safe to pass all messages about to be sent to this function. It replaces OTRL_MSGTYPE_QUERY
messages with a more convenient query message and, if the policy is set accordingly, it tags messages with a whitespace tag to signalise that we can talk OTR. It also checks for policy violations and FINISHED contexts.
Returns the new message, processed as outlined above according to the matching ConnContext for the local account (with the given local_account
using the given protocol
) to the remote_user
from the given ustate
.
tlvs
is a chain of OtrlTLV that should be appended to the message, however, you usually pass None
here.
In the event that a new ConnContext is created in this process,
is called so that the ConnContext's add_app_data_callback
(data=data
, context=the_new_context)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
.
If an error occures, it raises an Exception with the attributes errno
(containing a numeric gcry error code), os_errno
(containing an OS errno, if possible) and strerror
(containing a string describing the error).
![]() | Caution |
---|---|
You MUST NOT send the message in plaintext if an exception was raised. |
![]() | Note |
---|---|
You should process the returned new message immediatly with otrl_message_fragment_and_send. |