Name

otrl_message_fragment_and_send — Send a message to the network, fragmenting it as necessary

Synopsis

string otrl_message_fragment_and_send((ops, opdata),  
 context,  
 message,  
 frag_policy); 
tuple (ops, opdata);
ConnContext context;
string message;
OtrlFragmentPolicy frag_policy;
 

Description

Send a message to the network. The message will be fragmented as requested by ops->max_message_size(opdata=opdata, context=context) and sent via ops->inject_message(opdata=opdata, accountname=context.accountname, protocol=context.protocol, recipient=context.username, message=message). If frag_policy is not OTRL_FRAGMENT_SEND_ALL, the respective fragment is returned and MUST be sended via the messengers plugin interface (or similar).

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]Caution

You MUST NOT send the message in plaintext if an exception was raised or None was returned.