From f03a49856fd41c621e258d1a969d360880a5e448 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 21 Sep 2011 22:09:18 +0200 Subject: nix html-escaping in otr plugin --- otr.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'otr.c') diff --git a/otr.c b/otr.c index 3968da96..ecb1f43e 100644 --- a/otr.c +++ b/otr.c @@ -430,6 +430,7 @@ char *otr_filter_msg_out(irc_user_t *iu, char *msg, int flags) { int st; char *otrmsg = NULL; + char *emsg = msg; /* the message as we hand it to libotr */ ConnContext *ctx = NULL; irc_t *irc = iu->irc; struct im_connection *ic = iu->bu->ic; @@ -439,24 +440,28 @@ char *otr_filter_msg_out(irc_user_t *iu, char *msg, int flags) return msg; } + ctx = otrl_context_find(irc->otr->us, + iu->bu->handle, ic->acc->user, ic->acc->prpl->name, + 1, NULL, NULL, NULL); + /* HTML encoding */ /* consider OTR plaintext to be HTML if otr_does_html is set */ - if(set_getbool(&ic->bee->set, "otr_does_html") && + if(ctx && ctx->msgstate == OTRL_MSGSTATE_ENCRYPTED && + set_getbool(&ic->bee->set, "otr_does_html") && (g_strncasecmp(msg, "", 6) != 0)) { - msg = escape_html(msg); + emsg = escape_html(msg); } st = otrl_message_sending(irc->otr->us, &otr_ops, ic, ic->acc->user, ic->acc->prpl->name, iu->bu->handle, - msg, NULL, &otrmsg, NULL, NULL); + emsg, NULL, &otrmsg, NULL, NULL); + if(emsg != msg) { + g_free(emsg); /* we're done with this one */ + } if(st) { return NULL; } - ctx = otrl_context_find(irc->otr->us, - iu->bu->handle, ic->acc->user, ic->acc->prpl->name, - 1, NULL, NULL, NULL); - if(otrmsg) { if(!ctx) { otrl_message_free(otrmsg); -- cgit v1.2.3