Ticket #1110: patch1.diff

File patch1.diff, 1.1 KB (added by Flexo <bitlbee@…>, at 2014-01-17T21:11:14Z)

Fix for eaten messages when OTR is inactive.

  • otr.c

    === modified file 'otr.c'
     
    453453
    454454        st = otrl_message_sending(irc->otr->us, &otr_ops, ic,
    455455                ic->acc->user, ic->acc->prpl->name, iu->bu->handle, instag,
    456                 emsg, NULL, &otrmsg, OTRL_FRAGMENT_SEND_ALL, &ctx, NULL, NULL);
     456                emsg, NULL, &otrmsg, OTRL_FRAGMENT_SEND_SKIP, &ctx, NULL, NULL);
    457457        /* in libotr 4.0.0 with OTRL_FRAGMENT_SEND_ALL, otrmsg must be passed
    458458         * but the value it gets carries no meaning. it can be set even though
    459          * the message has been injected. */
     459         * the message has been injected.
     460         * With OTRL_FRAGMENT_SEND_SKIP, libotr doesn't handle the sending, it's
     461         * up to us.
     462         */
     463        printf("otrmsg %s\n", otrmsg);
    460464
    461465        if(emsg != msg) {
    462466                g_free(emsg);   /* we're done with this one */
     467                emsg = NULL;
    463468        }
    464469        if(st) {
    465                 /* TODO: Error reporting? */
     470                irc_rootmsg(irc, "Error encrypting text for OTR: %d", st);
    466471        }
    467472       
    468         return NULL;
     473        printf("Reached end\n");
     474        if (otrmsg != NULL) {
     475                return otrmsg;
     476        }
     477        return emsg;
    469478}
    470479
    471480static const struct irc_plugin otr_plugin =