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
>From 5d1be476199ba0cc779cc550250dc2c269473b5c Mon Sep 17 00:00:00 2001 From: Martin Milata <[email protected]> Date: Tue, 18 Feb 2014 23:35:44 +0100 Subject: [PATCH] Strip HTML and newlines from default query string The new line characters confuse IRC servers. --- src/proto.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/proto.c b/src/proto.c index 4512e91..b14da1a 100644 --- a/src/proto.c +++ b/src/proto.c @@ -241,11 +241,9 @@ char *otrl_proto_default_query_msg(const char *ourname, OtrlPolicy policy) * require that they g_free() it, because this pointer will probably * get passed to the main IM application for processing (and * free()ing). */ - const char *format = "?OTR%s\n<b>%s</b> has requested an " - "<a href=\"https://otr.cypherpunks.ca/\">Off-the-Record " - "private conversation</a>. However, you do not have a plugin " - "to support that.\nSee <a href=\"https://otr.cypherpunks.ca/\">" - "https://otr.cypherpunks.ca/</a> for more information."; + const char *format = "?OTR%s %s has requested an Off-the-Record private " + "conversation. However, you do not have a plugin to support " + "that. See https://otr.cypherpunks.ca/ for more information."; /* Figure out the version tag */ v1_supported = (policy & OTRL_POLICY_ALLOW_V1); -- 1.8.5.3
_______________________________________________ OTR-dev mailing list [email protected] http://lists.cypherpunks.ca/mailman/listinfo/otr-dev
