Changeset da44b08
- Timestamp:
- 2011-09-30T04:32:32Z (13 years ago)
- Branches:
- master
- Children:
- fb11647a
- Parents:
- f03a498
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
otr.c
rf03a498 rda44b08 365 365 char *newmsg = NULL; 366 366 OtrlTLV *tlvs = NULL; 367 char *colormsg;368 367 irc_t *irc = iu->irc; 369 368 struct im_connection *ic = iu->bu->ic; … … 385 384 } else if(!newmsg) { 386 385 /* this was a non-OTR message */ 387 return g_strdup(msg);386 return msg; 388 387 } else { 389 388 /* OTR has processed this message */ 390 389 ConnContext *context = otrl_context_find(irc->otr->us, iu->bu->handle, 391 390 ic->acc->user, ic->acc->prpl->name, 0, NULL, NULL, NULL); 391 392 /* we're done with the original msg, which will be caller-freed. */ 393 /* NB: must not change the newmsg pointer, since we free it. */ 394 msg = newmsg; 392 395 393 396 if(context && context->msgstate == OTRL_MSGSTATE_ENCRYPTED) { … … 397 400 !(ic->flags & OPT_DOES_HTML) && 398 401 set_getbool(&ic->bee->set, "strip_html")) { 399 strip_html( newmsg);402 strip_html(msg); 400 403 } 401 404 402 405 /* coloring */ 403 406 if(set_getbool(&ic->bee->set, "otr_color_encrypted")) { 404 /* color according to f'print trust */405 int color;407 int color; /* color according to f'print trust */ 408 char *pre="", *sep=""; /* optional parts */ 406 409 const char *trust = context->active_fingerprint->trust; 410 407 411 if(trust && trust[0] != '\0') 408 412 color=3; /* green */ … … 410 414 color=5; /* red */ 411 415 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); 416 /* keep "/me " uncolored at the beginning */ 417 if (g_strncasecmp(msg, "/me ", 4) == 0) { 418 msg += 4; /* skip */ 419 pre = "/me "; 418 420 } 421 422 /* comma in first place could mess with the color code */ 423 if (msg[0] == ',') { 424 /* insert a space between color spec and message */ 425 sep = " "; 426 } 427 428 msg = g_strdup_printf("%s\x03%.2d%s%s\x0F", pre, 429 color, sep, msg); 419 430 } 420 } else { 421 colormsg = g_strdup(newmsg); 422 } 423 431 } 432 433 if(msg == newmsg) { 434 msg = g_strdup(newmsg); 435 } 424 436 otrl_message_free(newmsg); 425 return colormsg;437 return msg; 426 438 } 427 439 }
Note: See TracChangeset
for help on using the changeset viewer.