Changes in otr.c [329f9fe:cc17b76]
Legend:
- Unmodified
- Added
- Removed
-
otr.c
r329f9fe rcc17b76 441 441 int st; 442 442 char *otrmsg = NULL; 443 char *emsg = msg; /* the message as we hand it to libotr */ 443 444 ConnContext *ctx = NULL; 444 445 irc_t *irc = iu->irc; 445 446 struct im_connection *ic = iu->bu->ic; 446 otrl_instag_t instag = OTRL_INSTAG_BEST; // XXX? 447 /* NB: in libotr 4.0.0 OTRL_INSTAG_RECENT will cause a null-pointer deref 448 * in otrl_message_sending with newly-added OTR contexts. 449 */ 447 otrl_instag_t instag = OTRL_INSTAG_RECENT; // XXX? 450 448 451 449 /* don't do OTR on certain (not classic IM) protocols, e.g. twitter */ … … 456 454 st = otrl_message_sending(irc->otr->us, &otr_ops, ic, 457 455 ic->acc->user, ic->acc->prpl->name, iu->bu->handle, instag, 458 msg, NULL, &otrmsg, OTRL_FRAGMENT_SEND_ALL_BUT_LAST, &ctx, NULL, NULL); 459 460 if(otrmsg && otrmsg != msg) { 461 /* libotr wants us to replace our message */ 462 /* NB: caller will free old msg */ 463 msg = g_strdup(otrmsg); 464 otrl_message_free(otrmsg); 465 } 466 456 emsg, NULL, &otrmsg, OTRL_FRAGMENT_SEND_SKIP, &ctx, NULL, NULL); 457 /* in libotr 4.0.0 with OTRL_FRAGMENT_SEND_ALL, otrmsg must be passed 458 * but the value it gets carries no meaning. it can be set even though 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 464 if(emsg != msg) { 465 g_free(emsg); /* we're done with this one */ 466 emsg = NULL; 467 } 467 468 if(st) { 468 irc_usernotice(iu, "otr: error handling outgoing message: %d", st); 469 msg = NULL; /* do not send plaintext! */ 470 } 471 472 return msg; 469 irc_rootmsg(irc, "Error encrypting text for OTR: %d", st); 470 } 471 472 if (otrmsg != NULL) { 473 return otrmsg; 474 } 475 return emsg; 473 476 } 474 477 … … 1348 1351 irc_user_t *u; 1349 1352 ConnContext *ctx; 1350 otrl_instag_t instag = OTRL_INSTAG_ BEST; // XXX1353 otrl_instag_t instag = OTRL_INSTAG_RECENT; // XXX 1351 1354 1352 1355 u = irc_user_by_name(irc, nick);
Note: See TracChangeset
for help on using the changeset viewer.