[OTR-dev] Username in query message (Enhancement #112)
mandragore at foss.ntua.gr
Thu Dec 10 08:12:33 EST 2015
While we were studying the libotr code and peeking through the project's
bugtracker we came across enhancement #112 .
With the attached patch we changed the correspnding code so that it will
optionally no longer contain any information about the senders username
in the query message.
The patch contains a change in the query message formatter, replacing
the username with "You have been requested to join". It also changes the
msg buffer's allocated size and removes the ourname variable from the
sprintf call. This changes apply if the ourname formal parameter is
passed a NULL value. Otherwise nothing changes and the original code is
Two formatters are now defined in the function
otrl_proto_default_query_msg, one for including the username and one for
omiting it. A pointer points to the appropriate formatter according to
the ourname value. Then memory for the msg buffer is allocated. If
ourname is not NULL nothing changes. If it is NULL then the memory
needed is the length of the formatter plus the version tag. We must
remove 2 bytes for the "%s" special symbol used in sprintf later and
then add 1 for the null character, which leaves a total of -1. After the
allocation of the needed memory we can simply call sprintf to actually
create the query message. Again by checking the if ourname has a valid
address we can decide if we should include it in the sprintf call.
You can also find our patch in this github fork
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2701 bytes
Desc: not available
More information about the OTR-dev