aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2014-02-13 22:41:02 +0000
committerWilmer van der Gaast <wilmer@gaast.net>2014-02-13 22:41:02 +0000
commit6ae1056f266bb09750de640903a45b6806477665 (patch)
tree56a49243abdaa668e29bc337d735e58cb81ab8ea
parent7a80925eabe969ffc1e8e24c2ad31c80c33ab3cd (diff)
parent820a2a79b97c96e63b984b17802e690ec16e3265 (diff)
Merging two OTR-related bugfixes from pesco.
-rw-r--r--otr.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/otr.c b/otr.c
index a002f1a4..318f9f13 100644
--- a/otr.c
+++ b/otr.c
@@ -725,6 +725,7 @@ void op_convert_msg(void *opdata, ConnContext *ctx, OtrlConvertType typ,
if(typ == OTRL_CONVERT_RECEIVING) {
char *msg = g_strdup(src);
+ char *buf = msg;
/* HTML decoding */
if(set_getbool(&ic->bee->set, "otr_does_html") &&
@@ -760,7 +761,7 @@ void op_convert_msg(void *opdata, ConnContext *ctx, OtrlConvertType typ,
*dst = g_strdup_printf("%s\x03%.2d%s%s\x0F", pre,
color, sep, msg);
- g_free(msg);
+ g_free(buf);
}
} else {
/* HTML encoding */
@@ -966,6 +967,7 @@ void cmd_otr_disconnect(irc_t *irc, char **args)
void cmd_otr_connect(irc_t *irc, char **args)
{
irc_user_t *u;
+ char *msg, *query = "?OTR?";
u = irc_user_by_name(irc, args[1]);
if(!u || !u->bu || !u->bu->ic) {
@@ -979,7 +981,16 @@ void cmd_otr_connect(irc_t *irc, char **args)
/* passing this through the filter so it goes through libotr which
* will replace the simple query string with a proper one */
- otr_filter_msg_out(u, "?OTR?", 0);
+ msg = otr_filter_msg_out(u, query, 0);
+
+ /* send the message */
+ if(msg) {
+ u->bu->ic->acc->prpl->buddy_msg(u->bu->ic, u->bu->handle, msg, 0); /* XXX flags? */
+ /* XXX error message? */
+
+ if(msg != query)
+ g_free(msg);
+ }
}
void cmd_otr_smp(irc_t *irc, char **args)