[OTR-dev] libotr default query message

Martin Milata b42-ml at srck.net
Tue Feb 18 18:35:41 EST 2014


On Mon, Feb 17, 2014 at 11:23:48 -0500, Ian Goldberg wrote:
> > When requesting start of OTR session by passing "?OTR?" to
> > otrl_message_sending, libotr substitutes this message by a hardcoded
> > string [1]. This string is problematic because it contains newline
> > characters which are used to separate individual commands in the IRC
> > protocol. What is after the newline is not a valid command which makes
> > the IRC server respond with an error. The string also contains HTML tags
> > which are not interpreted by most IRC clients.
> > 
> > I'm using an ugly workaround to replace this string whenever it's
> > returned by otrl_message_sending. It appears that irssi-otr tries to
> > avoid this by directly sending ?OTRv23? without passing it to libotr.
> > 
> > Would it be possible to fix this, preferably without breaking current
> > API?
> 
> Hmm, good point.  I wonder what would happen if your application just
> defined its own otrl_proto_default_query_msg.  (But that's pretty evil,
> to be sure.)

I think the symbol is resolved at (static) link time so that wouldn't
work.

> Suggestions as to what to do here?  The "?OTRv23?" part should be
> generated by the library for sure, but the (English!) text should likely
> not be in the library, except as a default.
> 
> As always, patches are welcome.  ;-)

I'd like to write a patch but not sure how to go about it.

The otr_error_message callback seems to be the right place to generate
the message. A new OtrlErrorCode would have to be added which is IMO
backward-incompatible change since applications that only know the old
codes will do something undesirable when they see the new one.

In theory, otrl_init could detect that the application is using the
older API and does not know the error code. But I suppose most
applications use the OTRL_INIT macro shortcut which kind of defeats the
version check.

If that's too complicated, I'm attaching a patch that simply removes the
newlines and HTML.

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Strip-HTML-and-newlines-from-default-query-string.patch
Type: text/x-diff
Size: 1362 bytes
Desc: not available
URL: <http://lists.cypherpunks.ca/pipermail/otr-dev/attachments/20140219/62f5ae8f/attachment.patch>


More information about the OTR-dev mailing list