Changeset 1082395
- Timestamp:
- 2011-06-29T01:35:18Z (13 years ago)
- Branches:
- master
- Children:
- f1cf01c
- Parents:
- 9a57b1f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
otr.c
r9a57b1f r1082395 240 240 l = g_slist_prepend( l, "always" ); 241 241 s->eval_data = l; 242 243 s = set_add( &irc->b->set, "otr_does_html", "true", set_eval_bool, irc ); 242 244 243 245 return TRUE; … … 388 390 ConnContext *context = otrl_context_find(irc->otr->us, iu->bu->handle, 389 391 ic->acc->user, ic->acc->prpl->name, 0, NULL, NULL, NULL); 390 if(context && context->msgstate == OTRL_MSGSTATE_ENCRYPTED && 391 set_getbool(&ic->bee->set, "otr_color_encrypted")) { 392 /* color according to f'print trust */ 393 int color; 394 const char *trust = context->active_fingerprint->trust; 395 if(trust && trust[0] != '\0') 396 color=3; /* green */ 397 else 398 color=5; /* red */ 399 400 if(newmsg[0] == ',') { 401 /* could be a problem with the color code */ 402 /* insert a space between color spec and message */ 403 colormsg = g_strdup_printf("\x03%.2d %s\x0F", color, newmsg); 404 } else { 405 colormsg = g_strdup_printf("\x03%.2d%s\x0F", color, newmsg); 392 393 if(context && context->msgstate == OTRL_MSGSTATE_ENCRYPTED) { 394 /* HTML decoding */ 395 /* perform any necessary stripping that the top level would miss */ 396 if(set_getbool(&ic->bee->set, "otr_does_html") && 397 !(ic->flags & OPT_DOES_HTML) && 398 set_getbool(&ic->bee->set, "strip_html")) { 399 strip_html(newmsg); 400 } 401 402 /* coloring */ 403 if(set_getbool(&ic->bee->set, "otr_color_encrypted")) { 404 /* color according to f'print trust */ 405 int color; 406 const char *trust = context->active_fingerprint->trust; 407 if(trust && trust[0] != '\0') 408 color=3; /* green */ 409 else 410 color=5; /* red */ 411 412 if(newmsg[0] == ',') { 413 /* could be a problem with the color code */ 414 /* insert a space between color spec and message */ 415 colormsg = g_strdup_printf("\x03%.2d %s\x0F", color, newmsg); 416 } else { 417 colormsg = g_strdup_printf("\x03%.2d%s\x0F", color, newmsg); 418 } 406 419 } 407 420 } else { 408 421 colormsg = g_strdup(newmsg); 409 422 } 423 410 424 otrl_message_free(newmsg); 411 425 return colormsg; … … 424 438 if(ic->acc->prpl->options & OPT_NOOTR) { 425 439 return msg; 440 } 441 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); 426 447 } 427 448
Note: See TracChangeset
for help on using the changeset viewer.