Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/otr.c @ 1580:c8be6c2243d6
Only html escape messages when otr session is established
author | franky |
---|---|
date | Tue, 14 Apr 2009 20:36:08 +0200 |
parents | e1a642472f4e |
children | 18069a9dca4a |
comparison
equal
deleted
inserted
replaced
1579:a2dd83167bc9 | 1580:c8be6c2243d6 |
---|---|
406 gcry_error_t err; | 406 gcry_error_t err; |
407 char *newmessage = NULL; | 407 char *newmessage = NULL; |
408 char *htmlmsg; | 408 char *htmlmsg; |
409 ConnContext * ctx = otr_get_context(buddy); | 409 ConnContext * ctx = otr_get_context(buddy); |
410 | 410 |
411 htmlmsg = html_escape(*msg); | 411 if (ctx->msgstate == OTRL_MSGSTATE_PLAINTEXT) |
412 | 412 err = otrl_message_sending(userstate, &ops, NULL, ctx->accountname, |
413 err = otrl_message_sending(userstate, &ops, NULL, ctx->accountname, | 413 ctx->protocol, ctx->username, *msg, NULL, |
414 ctx->protocol, ctx->username, htmlmsg, NULL, | 414 &newmessage, NULL, NULL); |
415 &newmessage, NULL, NULL); | 415 else { |
416 | 416 htmlmsg = html_escape(*msg); |
417 g_free(htmlmsg); | 417 err = otrl_message_sending(userstate, &ops, NULL, ctx->accountname, |
418 ctx->protocol, ctx->username, htmlmsg, NULL, | |
419 &newmessage, NULL, NULL); | |
420 g_free(htmlmsg); | |
421 } | |
418 | 422 |
419 if (err) | 423 if (err) |
420 *msg = NULL; /*something went wrong, don't send the plain-message! */ | 424 *msg = NULL; /*something went wrong, don't send the plain-message! */ |
421 | 425 |
422 if (!err && newmessage) { | 426 if (!err && newmessage) { |