aboutsummaryrefslogtreecommitdiffstats
path: root/otr.c
diff options
context:
space:
mode:
authorunknown <pesco@khjk.org>2011-09-21 22:09:18 +0200
committerunknown <pesco@khjk.org>2011-09-21 22:09:18 +0200
commitf03a49856fd41c621e258d1a969d360880a5e448 (patch)
treeb773320985ce4849e6c870d27dc034b168072666 /otr.c
parentff18fc1612e9468a8406728e180b453ca6bd408a (diff)
nix html-escaping in otr plugin
Diffstat (limited to 'otr.c')
-rw-r--r--otr.c19
1 files changed, 12 insertions, 7 deletions
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, "<html>", 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);