- Timestamp:
- 2010-09-01T22:09:27Z (14 years ago)
- Branches:
- master
- Children:
- 2dcaf9a
- Parents:
- 0c85c08
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
otr.c
r0c85c08 r934db064 344 344 } 345 345 346 char *otr_ handle_message(struct im_connection *ic, const char *handle, const char *msg)346 char *otr_filter_msg_in(irc_user_t *iu, char *msg, int flags) 347 347 { 348 348 int ignore_msg; … … 350 350 OtrlTLV *tlvs = NULL; 351 351 char *colormsg; 352 irc_t *irc = ic->bee->ui_data; 352 irc_t *irc = iu->irc; 353 struct im_connection *ic = iu->bu->ic; 353 354 354 355 /* don't do OTR on certain (not classic IM) protocols, e.g. twitter */ 355 356 if(ic->acc->prpl->options & OPT_NOOTR) { 356 return (g_strdup(msg));357 return msg; 357 358 } 358 359 359 360 ignore_msg = otrl_message_receiving(irc->otr->us, &otr_ops, ic, 360 ic->acc->user, ic->acc->prpl->name, handle, msg, &newmsg,361 ic->acc->user, ic->acc->prpl->name, iu->bu->handle, msg, &newmsg, 361 362 &tlvs, NULL, NULL); 362 363 363 otr_handle_smp(ic, handle, tlvs);364 otr_handle_smp(ic, iu->bu->handle, tlvs); 364 365 365 366 if(ignore_msg) { … … 371 372 } else { 372 373 /* OTR has processed this message */ 373 ConnContext *context = otrl_context_find(irc->otr->us, handle,374 ConnContext *context = otrl_context_find(irc->otr->us, iu->bu->handle, 374 375 ic->acc->user, ic->acc->prpl->name, 0, NULL, NULL, NULL); 375 376 if(context && context->msgstate == OTRL_MSGSTATE_ENCRYPTED && 376 set_getbool(&ic->bee->set, " color_encrypted")) {377 set_getbool(&ic->bee->set, "otr_color_encrypted")) { 377 378 /* color according to f'print trust */ 378 379 int color; … … 398 399 } 399 400 400 int otr_send_message(struct im_connection *ic, const char *handle, constchar *msg, int flags)401 char *otr_filter_msg_out(irc_user_t *iu, char *msg, int flags) 401 402 { 402 403 int st; 403 404 char *otrmsg = NULL; 404 405 ConnContext *ctx = NULL; 405 irc_t *irc = ic->bee->ui_data; 406 irc_t *irc = iu->irc; 407 struct im_connection *ic = iu->bu->ic; 406 408 407 409 /* don't do OTR on certain (not classic IM) protocols, e.g. twitter */ 408 410 if(ic->acc->prpl->options & OPT_NOOTR) { 409 /* TODO(wilmer): const */ 410 return (ic->acc->prpl->buddy_msg(ic, (char*) handle, (char*) msg, flags)); 411 return msg; 411 412 } 412 413 413 414 st = otrl_message_sending(irc->otr->us, &otr_ops, ic, 414 ic->acc->user, ic->acc->prpl->name, handle,415 ic->acc->user, ic->acc->prpl->name, iu->bu->handle, 415 416 msg, NULL, &otrmsg, NULL, NULL); 416 417 if(st) { 417 return st;418 return NULL; 418 419 } 419 420 420 421 ctx = otrl_context_find(irc->otr->us, 421 handle, ic->acc->user, ic->acc->prpl->name,422 iu->bu->handle, ic->acc->user, ic->acc->prpl->name, 422 423 1, NULL, NULL, NULL); 423 424 … … 425 426 if(!ctx) { 426 427 otrl_message_free(otrmsg); 427 return 1;428 return NULL; 428 429 } 429 430 st = otrl_message_fragment_and_send(&otr_ops, ic, ctx, … … 433 434 /* note: otrl_message_sending handles policy, so that if REQUIRE_ENCRYPTION is set, 434 435 this case does not occur */ 435 st = ic->acc->prpl->buddy_msg( ic, (char *)handle, (char *)msg, flags ); 436 } 437 438 return st; 436 return msg; 437 } 438 439 /* TODO: Error reporting should be done here now (if st!=0), probably. */ 440 441 return NULL; 439 442 } 440 443 … … 443 446 otr_irc_new, 444 447 otr_irc_free, 448 otr_filter_msg_out, 449 otr_filter_msg_in, 445 450 }; 446 451 … … 716 721 } 717 722 718 /* TODO(wilmer): imc_buddy_msg(u->bu->ic, u->bu->handle, "?OTR?", 0); */723 bee_user_msg(irc->b, u->bu, "?OTR?", 0); 719 724 } 720 725
Note: See TracChangeset
for help on using the changeset viewer.