Mercurial > pidgin.yaz
comparison src/log.c @ 7623:5381f96fc185
[gaim-migrate @ 8247]
more logging tweaks. this should let the last </body></html> get written
to all the open logs when you quit gaim.
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Mon, 24 Nov 2003 07:00:39 +0000 |
parents | 53e38b1ce00a |
children | e293d0c42ccb |
comparison
equal
deleted
inserted
replaced
7622:072feee65244 | 7623:5381f96fc185 |
---|---|
452 | 452 |
453 log->logger_data = data = g_new0(struct generic_logger_data, 1); | 453 log->logger_data = data = g_new0(struct generic_logger_data, 1); |
454 | 454 |
455 data->file = fopen(filename, "a"); | 455 data->file = fopen(filename, "a"); |
456 if (!data->file) { | 456 if (!data->file) { |
457 gaim_debug(GAIM_DEBUG_ERROR, "log", "Could not create log file %s\n", filename); | 457 gaim_debug(GAIM_DEBUG_ERROR, "log", |
458 "Could not create log file %s\n", filename); | |
458 g_free(filename); | 459 g_free(filename); |
459 return; | 460 return; |
460 } | 461 } |
461 g_free(filename); | 462 g_free(filename); |
462 strftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S", localtime(&log->time)); | 463 strftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S", localtime(&log->time)); |
466 fprintf(data->file, "</title></head><body>"); | 467 fprintf(data->file, "</title></head><body>"); |
467 fprintf(data->file, | 468 fprintf(data->file, |
468 "<h3>Conversation with %s at %s on %s (%s)</h3>\n", | 469 "<h3>Conversation with %s at %s on %s (%s)</h3>\n", |
469 log->name, date, gaim_account_get_username(log->account), prpl); | 470 log->name, date, gaim_account_get_username(log->account), prpl); |
470 } | 471 } |
472 | |
473 /* if we can't write to the file, give up before we hurt ourselves */ | |
474 if(!data->file) | |
475 return; | |
476 | |
471 strftime(date, sizeof(date), "%H:%M:%S", localtime(&time)); | 477 strftime(date, sizeof(date), "%H:%M:%S", localtime(&time)); |
472 if (type & GAIM_MESSAGE_SYSTEM) | 478 if (type & GAIM_MESSAGE_SYSTEM) |
473 fprintf(data->file, "(%s)<b> %s</b><br/>\n", date, message); | 479 fprintf(data->file, "(%s)<b> %s</b><br/>\n", date, message); |
474 else if (type & GAIM_MESSAGE_WHISPER) | 480 else if (type & GAIM_MESSAGE_WHISPER) |
475 fprintf(data->file, "<font color=\"#6C2585\">(%s)<b> %s:</b></font> %s<br/>\n", | 481 fprintf(data->file, "<font color=\"#6C2585\">(%s)<b> %s:</b></font> %s<br/>\n", |
601 strftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S", localtime(&log->time)); | 607 strftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S", localtime(&log->time)); |
602 fprintf(data->file, "Conversation with %s at %s on %s (%s)\n", | 608 fprintf(data->file, "Conversation with %s at %s on %s (%s)\n", |
603 log->name, date, gaim_account_get_username(log->account), prpl); | 609 log->name, date, gaim_account_get_username(log->account), prpl); |
604 } | 610 } |
605 | 611 |
612 /* if we can't write to the file, give up before we hurt ourselves */ | |
613 if(!data->file) | |
614 return; | |
615 | |
606 strftime(date, sizeof(date), "%H:%M:%S", localtime(&time)); | 616 strftime(date, sizeof(date), "%H:%M:%S", localtime(&time)); |
607 stripped = gaim_markup_strip_html(message); | 617 stripped = gaim_markup_strip_html(message); |
608 if (type & GAIM_MESSAGE_SEND || | 618 if (type & GAIM_MESSAGE_SEND || |
609 type & GAIM_MESSAGE_RECV) { | 619 type & GAIM_MESSAGE_RECV) { |
610 if (type & GAIM_MESSAGE_AUTO_RESP) { | 620 if (type & GAIM_MESSAGE_AUTO_RESP) { |