Mercurial > pidgin
comparison src/log.c @ 7489:8f05bdc08faf
[gaim-migrate @ 8102]
This will produce better logs. I'm going to try to get even *better* logs
committer: Tailor Script <tailor@pidgin.im>
| author | Sean Egan <seanegan@gmail.com> |
|---|---|
| date | Thu, 13 Nov 2003 00:48:05 +0000 |
| parents | 3c21f3084ff0 |
| children | 9b537f41bd55 |
comparison
equal
deleted
inserted
replaced
| 7488:c42d1532faab | 7489:8f05bdc08faf |
|---|---|
| 380 ****************************/ | 380 ****************************/ |
| 381 | 381 |
| 382 static void html_logger_write(GaimLog *log, GaimMessageFlags type, | 382 static void html_logger_write(GaimLog *log, GaimMessageFlags type, |
| 383 const char *from, time_t time, const char *message) | 383 const char *from, time_t time, const char *message) |
| 384 { | 384 { |
| 385 GaimConnection *gc = gaim_account_get_connection(log->account); | |
| 385 char date[64]; | 386 char date[64]; |
| 386 if(!log->logger_data) { | 387 if(!log->logger_data) { |
| 387 /* This log is new */ | 388 /* This log is new */ |
| 388 char *ud = gaim_user_dir(); | 389 char *ud = gaim_user_dir(); |
| 389 char *guy = g_strdup(gaim_normalize(log->account, gaim_account_get_username(log->account))); | 390 char *guy = g_strdup(gaim_normalize(log->account, gaim_account_get_username(log->account))); |
| 434 fprintf(log->logger_data, | 435 fprintf(log->logger_data, |
| 435 "<h3>Conversation with %s at %s on %s (%s)</h3>\n", | 436 "<h3>Conversation with %s at %s on %s (%s)</h3>\n", |
| 436 log->name, date, gaim_account_get_username(log->account), prpl); | 437 log->name, date, gaim_account_get_username(log->account), prpl); |
| 437 } | 438 } |
| 438 strftime(date, sizeof(date), "%H:%M:%S", localtime(&time)); | 439 strftime(date, sizeof(date), "%H:%M:%S", localtime(&time)); |
| 439 fprintf(log->logger_data, "(%s) %s%s %s<br/>\n", date, from ? from : "", from ? ":" : "", message); | 440 if (type & GAIM_MESSAGE_SYSTEM) |
| 441 fprintf(log->logger_data, "(%s)<b> %s</b><br/>\n", date, message); | |
| 442 else if (type & GAIM_MESSAGE_WHISPER) | |
| 443 fprintf(log->logger_data, "<font color=\"#6C2585\">(%s)<b> %s:</b></font> %s<br/>\n", | |
| 444 date, from, message); | |
| 445 else if (type & GAIM_MESSAGE_AUTO_RESP) { | |
| 446 if (type & GAIM_MESSAGE_SEND) | |
| 447 fprintf(log->logger_data, _("<font color=\"#16569E\">(%s) <b>%s <AUTO-REPLY>:</b></font> %s<br/>\n"), date, from, message); | |
| 448 else if (type & GAIM_MESSAGE_RECV) | |
| 449 fprintf(log->logger_data, _("<font color=\"#A82F2F\">(%s) <b>%s <AUTO-REPLY>:</b></font> %s<br/>\n"), date, from, message); | |
| 450 } else if (type & GAIM_MESSAGE_RECV) | |
| 451 fprintf(log->logger_data, "<font color=\"#A82F2F\">(%s) <b>%s:</b></font> <font sml=\"%s\">%s</font><br/>\n", | |
| 452 date, from, gc->prpl->info->name, message); | |
| 453 else if (type & GAIM_MESSAGE_RECV) | |
| 454 fprintf(log->logger_data, "<font color=\"#16569E\">(%s) <b>%s:</b></font> <font sml=\"%s\">%s</font><br/>\n", | |
| 455 date, from, gc->prpl->info->name, message); | |
| 440 fflush(log->logger_data); | 456 fflush(log->logger_data); |
| 441 } | 457 } |
| 442 | 458 |
| 443 static void html_logger_finalize(GaimLog *log) | 459 static void html_logger_finalize(GaimLog *log) |
| 444 { | 460 { |
| 544 log->name, date, gaim_account_get_username(log->account), prpl); | 560 log->name, date, gaim_account_get_username(log->account), prpl); |
| 545 } | 561 } |
| 546 | 562 |
| 547 strftime(date, sizeof(date), "%H:%M:%S", localtime(&time)); | 563 strftime(date, sizeof(date), "%H:%M:%S", localtime(&time)); |
| 548 stripped = gaim_markup_strip_html(message); | 564 stripped = gaim_markup_strip_html(message); |
| 549 fprintf(log->logger_data, "(%s) %s%s %s\n", date, from ? from : "", from ? ":" : "", stripped); | 565 if (type & GAIM_MESSAGE_SEND || |
| 566 type & GAIM_MESSAGE_RECV) | |
| 567 fprintf(log->logger_data, "(%s) %s: %s\n", date, from, stripped); | |
| 568 else if (type & GAIM_MESSAGE_SYSTEM) | |
| 569 fprintf(log->logger_data, "(%s) %s\n", date, stripped); | |
| 570 else if (type & GAIM_MESSAGE_AUTO_RESP) | |
| 571 fprintf(log->logger_data, _("(%s) %s <AUTO-REPLY>: %s\n"), date, from, stripped); | |
| 572 else if (type & GAIM_MESSAGE_NO_LOG) { | |
| 573 /* This shouldn't happen */ | |
| 574 g_free(stripped); | |
| 575 return; | |
| 576 } else if (type & GAIM_MESSAGE_WHISPER) | |
| 577 fprintf(log->logger_data, "(%s) *%s* %s", date, from, stripped); | |
| 578 else | |
| 579 fprintf(log->logger_data, "(%s) %s%s %s\n", date, from ? from : "", from ? ":" : "", stripped); | |
| 580 | |
| 550 fflush(log->logger_data); | 581 fflush(log->logger_data); |
| 551 g_free(stripped); | 582 g_free(stripped); |
| 552 } | 583 } |
| 553 | 584 |
| 554 static void txt_logger_finalize(GaimLog *log) | 585 static void txt_logger_finalize(GaimLog *log) |
