Name

otrl_context_find — Look up a connection context

Synopsis

(context, added) otrl_context_find(ustate,  
 user,  
 accountname,  
 protocol,  
 add_if_missing,  
 (add_app_data_callback, data)); 
OtrlUserState ustate;
String user;
String accountname;
String protocol;
String add_if_missing;
tuple (add_app_data_callback, data);
 

Description

Look up a context for the local account (with the given accountname using the given protocol) to the remote user from the given ustate. If add_if_missing is True, a new context is allocated and returned if one does not currently exist. In that event, 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 (context, added). context is either the found ConnContext object or None, added is 1 when the context was newly created (see above) and otherwise 0.