Changeset f03a498


Ignore:
Timestamp:
2011-09-21T20:09:18Z (13 years ago)
Author:
unknown <pesco@…>
Branches:
master
Children:
da44b08
Parents:
ff18fc1
Message:

nix html-escaping in otr plugin

File:
1 edited

Legend:

Unmodified
Added
Removed
  • otr.c

    rff18fc1 rf03a498  
    431431        int st;
    432432        char *otrmsg = NULL;
     433        char *emsg = msg;           /* the message as we hand it to libotr */
    433434        ConnContext *ctx = NULL;
    434435        irc_t *irc = iu->irc;
     
    440441        }
    441442
    442         /* HTML encoding */
    443         /* consider OTR plaintext to be HTML if otr_does_html is set */
    444         if(set_getbool(&ic->bee->set, "otr_does_html") &&
    445            (g_strncasecmp(msg, "<html>", 6) != 0)) {
    446                 msg = escape_html(msg);
    447         }
    448        
    449         st = otrl_message_sending(irc->otr->us, &otr_ops, ic,
    450                 ic->acc->user, ic->acc->prpl->name, iu->bu->handle,
    451                 msg, NULL, &otrmsg, NULL, NULL);
    452         if(st) {
    453                 return NULL;
    454         }
    455 
    456443        ctx = otrl_context_find(irc->otr->us,
    457444                        iu->bu->handle, ic->acc->user, ic->acc->prpl->name,
    458445                        1, NULL, NULL, NULL);
     446
     447        /* HTML encoding */
     448        /* consider OTR plaintext to be HTML if otr_does_html is set */
     449        if(ctx && ctx->msgstate == OTRL_MSGSTATE_ENCRYPTED &&
     450           set_getbool(&ic->bee->set, "otr_does_html") &&
     451           (g_strncasecmp(msg, "<html>", 6) != 0)) {
     452                emsg = escape_html(msg);
     453        }
     454       
     455        st = otrl_message_sending(irc->otr->us, &otr_ops, ic,
     456                ic->acc->user, ic->acc->prpl->name, iu->bu->handle,
     457                emsg, NULL, &otrmsg, NULL, NULL);
     458        if(emsg != msg) {
     459                g_free(emsg);   /* we're done with this one */
     460        }
     461        if(st) {
     462                return NULL;
     463        }
    459464
    460465        if(otrmsg) {
Note: See TracChangeset for help on using the changeset viewer.