comparison src/log.c @ 7882:b4c2f92d4d24

[gaim-migrate @ 8536] we'll try this for a bit committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Mon, 15 Dec 2003 01:04:51 +0000
parents 21be2d9e8399
children 1b8261f374ea
comparison
equal deleted inserted replaced
7881:e2435504d19c 7882:b4c2f92d4d24
420 static void html_logger_write(GaimLog *log, GaimMessageFlags type, 420 static void html_logger_write(GaimLog *log, GaimMessageFlags type,
421 const char *from, time_t time, const char *message) 421 const char *from, time_t time, const char *message)
422 { 422 {
423 GaimConnection *gc = gaim_account_get_connection(log->account); 423 GaimConnection *gc = gaim_account_get_connection(log->account);
424 char date[64]; 424 char date[64];
425 char *msg_fixed;
425 struct generic_logger_data *data = log->logger_data; 426 struct generic_logger_data *data = log->logger_data;
426 if(!data) { 427 if(!data) {
427 /* This log is new */ 428 /* This log is new */
428 char *ud = gaim_user_dir(); 429 char *ud = gaim_user_dir();
429 char *guy = g_strdup(gaim_normalize(log->account, gaim_account_get_username(log->account))); 430 char *guy = g_strdup(gaim_normalize(log->account, gaim_account_get_username(log->account)));
471 472
472 /* if we can't write to the file, give up before we hurt ourselves */ 473 /* if we can't write to the file, give up before we hurt ourselves */
473 if(!data->file) 474 if(!data->file)
474 return; 475 return;
475 476
477 gaim_markup_html_to_xhtml(message, &msg_fixed, NULL);
478
476 strftime(date, sizeof(date), "%H:%M:%S", localtime(&time)); 479 strftime(date, sizeof(date), "%H:%M:%S", localtime(&time));
477 if (type & GAIM_MESSAGE_SYSTEM) 480 if (type & GAIM_MESSAGE_SYSTEM)
478 fprintf(data->file, "(%s)<b> %s</b><br/>\n", date, message); 481 fprintf(data->file, "(%s)<b> %s</b><br/>\n", date, msg_fixed);
479 else if (type & GAIM_MESSAGE_WHISPER) 482 else if (type & GAIM_MESSAGE_WHISPER)
480 fprintf(data->file, "<font color=\"#6C2585\">(%s)<b> %s:</b></font> %s<br/>\n", 483 fprintf(data->file, "<font color=\"#6C2585\">(%s)<b> %s:</b></font> %s<br/>\n",
481 date, from, message); 484 date, from, msg_fixed);
482 else if (type & GAIM_MESSAGE_AUTO_RESP) { 485 else if (type & GAIM_MESSAGE_AUTO_RESP) {
483 if (type & GAIM_MESSAGE_SEND) 486 if (type & GAIM_MESSAGE_SEND)
484 fprintf(data->file, _("<font color=\"#16569E\">(%s) <b>%s <AUTO-REPLY>:</b></font> %s<br/>\n"), date, from, message); 487 fprintf(data->file, _("<font color=\"#16569E\">(%s) <b>%s <AUTO-REPLY>:</b></font> %s<br/>\n"), date, from, msg_fixed);
485 else if (type & GAIM_MESSAGE_RECV) 488 else if (type & GAIM_MESSAGE_RECV)
486 fprintf(data->file, _("<font color=\"#A82F2F\">(%s) <b>%s <AUTO-REPLY>:</b></font> %s<br/>\n"), date, from, message); 489 fprintf(data->file, _("<font color=\"#A82F2F\">(%s) <b>%s <AUTO-REPLY>:</b></font> %s<br/>\n"), date, from, msg_fixed);
487 } else if (type & GAIM_MESSAGE_RECV) { 490 } else if (type & GAIM_MESSAGE_RECV) {
488 char *msg = g_strdup(message); 491 if(gaim_message_meify(msg_fixed, -1))
489 if(gaim_message_meify(msg, -1))
490 fprintf(data->file, "<font color=\"#6C2585\">(%s) <b>***%s</b></font> <font sml=\"%s\">%s</font><br/>\n", 492 fprintf(data->file, "<font color=\"#6C2585\">(%s) <b>***%s</b></font> <font sml=\"%s\">%s</font><br/>\n",
491 date, from, gc->prpl->info->name, msg); 493 date, from, gc->prpl->info->name, msg_fixed);
492 else 494 else
493 fprintf(data->file, "<font color=\"#A82F2F\">(%s) <b>%s:</b></font> <font sml=\"%s\">%s</font><br/>\n", 495 fprintf(data->file, "<font color=\"#A82F2F\">(%s) <b>%s:</b></font> <font sml=\"%s\">%s</font><br/>\n",
494 date, from, gc->prpl->info->name, msg); 496 date, from, gc->prpl->info->name, msg_fixed);
495 g_free(msg);
496 } else if (type & GAIM_MESSAGE_SEND) { 497 } else if (type & GAIM_MESSAGE_SEND) {
497 char *msg = g_strdup(message); 498 if(gaim_message_meify(msg_fixed, -1))
498 if(gaim_message_meify(msg, -1))
499 fprintf(data->file, "<font color=\"#6C2585\">(%s) <b>***%s</b></font> <font sml=\"%s\">%s</font><br/>\n", 499 fprintf(data->file, "<font color=\"#6C2585\">(%s) <b>***%s</b></font> <font sml=\"%s\">%s</font><br/>\n",
500 date, from, gc->prpl->info->name, msg); 500 date, from, gc->prpl->info->name, msg_fixed);
501 else 501 else
502 fprintf(data->file, "<font color=\"#16569E\">(%s) <b>%s:</b></font> <font sml=\"%s\">%s</font><br/>\n", 502 fprintf(data->file, "<font color=\"#16569E\">(%s) <b>%s:</b></font> <font sml=\"%s\">%s</font><br/>\n",
503 date, from, gc->prpl->info->name, msg); 503 date, from, gc->prpl->info->name, msg_fixed);
504 g_free(msg); 504 }
505 } 505 g_free(msg_fixed);
506 fflush(data->file); 506 fflush(data->file);
507 } 507 }
508 508
509 static void html_logger_finalize(GaimLog *log) 509 static void html_logger_finalize(GaimLog *log)
510 { 510 {