Mercurial > pidgin
comparison src/log.c @ 8577:599d6ac9bbfe
[gaim-migrate @ 9326]
a jabber tweak i forgot to commit
a fix for logging times wrt daylight savings time
re-fix html logging timestamp sizes, after the syslog merge
a cosmetic change to the log window
committer: Tailor Script <tailor@pidgin.im>
| author | Nathan Walp <nwalp@pidgin.im> |
|---|---|
| date | Sun, 04 Apr 2004 18:27:45 +0000 |
| parents | 7dcd6f26e4a7 |
| children | 089a3400b2aa |
comparison
equal
deleted
inserted
replaced
| 8576:ddbcef747dc7 | 8577:599d6ac9bbfe |
|---|---|
| 305 if (!(dir = g_dir_open(path, 0, NULL))) { | 305 if (!(dir = g_dir_open(path, 0, NULL))) { |
| 306 g_free(path); | 306 g_free(path); |
| 307 return NULL; | 307 return NULL; |
| 308 } | 308 } |
| 309 while ((filename = g_dir_read_name(dir))) { | 309 while ((filename = g_dir_read_name(dir))) { |
| 310 if (gaim_str_has_suffix(filename, ext)) { | 310 if (gaim_str_has_suffix(filename, ext) && |
| 311 const char *l = filename; | 311 strlen(filename) == 17 + strlen(ext)) { |
| 312 struct tm time; | |
| 313 GaimLog *log; | 312 GaimLog *log; |
| 314 struct generic_logger_data *data; | 313 struct generic_logger_data *data; |
| 315 char d[5]; | 314 time_t stamp = gaim_str_to_time(filename, FALSE); |
| 316 | 315 |
| 317 strncpy(d, l, 4); | 316 log = gaim_log_new(GAIM_LOG_IM, screenname, account, stamp); |
| 318 d[4] = '\0'; | |
| 319 time.tm_year = atoi(d) - 1900; | |
| 320 l = l + 5; | |
| 321 | |
| 322 strncpy(d, l, 2); | |
| 323 d[2] = '\0'; | |
| 324 time.tm_mon = atoi(d) - 1; | |
| 325 l = l + 3; | |
| 326 | |
| 327 strncpy(d, l, 2); | |
| 328 time.tm_mday = atoi(d); | |
| 329 l = l + 3; | |
| 330 | |
| 331 strncpy(d, l, 2); | |
| 332 time.tm_hour = atoi(d); | |
| 333 l = l + 2; | |
| 334 | |
| 335 strncpy(d, l, 2); | |
| 336 time.tm_min = atoi(d); | |
| 337 l = l + 2; | |
| 338 | |
| 339 strncpy(d, l, 2); | |
| 340 time.tm_sec = atoi(d); | |
| 341 l = l + 2; | |
| 342 log = gaim_log_new(GAIM_LOG_IM, screenname, account, mktime(&time)); | |
| 343 log->logger = logger; | 317 log->logger = logger; |
| 344 log->logger_data = data = g_new0(struct generic_logger_data, 1); | 318 log->logger_data = data = g_new0(struct generic_logger_data, 1); |
| 345 data->path = g_build_filename(path, filename, NULL); | 319 data->path = g_build_filename(path, filename, NULL); |
| 346 list = g_list_append(list, log); | 320 list = g_list_append(list, log); |
| 347 } | 321 } |
| 522 if(!data->file) | 496 if(!data->file) |
| 523 return; | 497 return; |
| 524 | 498 |
| 525 gaim_markup_html_to_xhtml(message, &msg_fixed, NULL); | 499 gaim_markup_html_to_xhtml(message, &msg_fixed, NULL); |
| 526 | 500 |
| 527 if(log->type == GAIM_LOG_SYSTEM){ | 501 if(log->type == GAIM_LOG_SYSTEM){ |
| 528 strftime(date, sizeof(date), "%c", localtime(&time)); | 502 strftime(date, sizeof(date), "%c", localtime(&time)); |
| 529 fprintf(data->file, "---- %s @ %s ----<br/>\n", msg_fixed, date); | 503 fprintf(data->file, "---- %s @ %s ----<br/>\n", msg_fixed, date); |
| 530 } else { | 504 } else { |
| 531 strftime(date, sizeof(date), "%H:%M:%S", localtime(&time)); | 505 strftime(date, sizeof(date), "%H:%M:%S", localtime(&time)); |
| 532 if (type & GAIM_MESSAGE_SYSTEM) | 506 if (type & GAIM_MESSAGE_SYSTEM) |
| 533 fprintf(data->file, "(%s)<b> %s</b><br/>\n", date, msg_fixed); | 507 fprintf(data->file, "<font size=\"2\">(%s)</font><b> %s</b><br/>\n", date, msg_fixed); |
| 534 else if (type & GAIM_MESSAGE_WHISPER) | 508 else if (type & GAIM_MESSAGE_WHISPER) |
| 535 fprintf(data->file, "<font color=\"#6C2585\">(%s)<b> %s:</b></font> %s<br/>\n", | 509 fprintf(data->file, "<font color=\"#6C2585\"><font size=\"2\">(%s)</font><b> %s:</b></font> %s<br/>\n", |
| 536 date, from, msg_fixed); | 510 date, from, msg_fixed); |
| 537 else if (type & GAIM_MESSAGE_AUTO_RESP) { | 511 else if (type & GAIM_MESSAGE_AUTO_RESP) { |
| 538 if (type & GAIM_MESSAGE_SEND) | 512 if (type & GAIM_MESSAGE_SEND) |
| 539 fprintf(data->file, _("<font color=\"#16569E\">(%s) <b>%s <AUTO-REPLY>:</b></font> %s<br/>\n"), date, from, msg_fixed); | 513 fprintf(data->file, _("<font color=\"#16569E\"><font size=\"2\">(%s)</font> <b>%s <AUTO-REPLY>:</b></font> %s<br/>\n"), date, from, msg_fixed); |
| 540 else if (type & GAIM_MESSAGE_RECV) | 514 else if (type & GAIM_MESSAGE_RECV) |
| 541 fprintf(data->file, _("<font color=\"#A82F2F\">(%s) <b>%s <AUTO-REPLY>:</b></font> %s<br/>\n"), date, from, msg_fixed); | 515 fprintf(data->file, _("<font color=\"#A82F2F\"><font size=\"2\">(%s)</font> <b>%s <AUTO-REPLY>:</b></font> %s<br/>\n"), date, from, msg_fixed); |
| 542 } else if (type & GAIM_MESSAGE_RECV) { | 516 } else if (type & GAIM_MESSAGE_RECV) { |
| 543 if(gaim_message_meify(msg_fixed, -1)) | 517 if(gaim_message_meify(msg_fixed, -1)) |
| 544 fprintf(data->file, "<font color=\"#6C2585\">(%s) <b>***%s</b></font> <font sml=\"%s\">%s</font><br/>\n", | 518 fprintf(data->file, "<font color=\"#6C2585\"><font size=\"2\">(%s)</font> <b>***%s</b></font> <font sml=\"%s\">%s</font><br/>\n", |
| 545 date, from, gc->prpl->info->name, msg_fixed); | 519 date, from, gc->prpl->info->name, msg_fixed); |
| 546 else | 520 else |
| 547 fprintf(data->file, "<font color=\"#A82F2F\">(%s) <b>%s:</b></font> <font sml=\"%s\">%s</font><br/>\n", | 521 fprintf(data->file, "<font color=\"#A82F2F\"><font size=\"2\">(%s)</font> <b>%s:</b></font> <font sml=\"%s\">%s</font><br/>\n", |
| 548 date, from, gc->prpl->info->name, msg_fixed); | 522 date, from, gc->prpl->info->name, msg_fixed); |
| 549 } else if (type & GAIM_MESSAGE_SEND) { | 523 } else if (type & GAIM_MESSAGE_SEND) { |
| 550 if(gaim_message_meify(msg_fixed, -1)) | 524 if(gaim_message_meify(msg_fixed, -1)) |
| 551 fprintf(data->file, "<font color=\"#6C2585\">(%s) <b>***%s</b></font> <font sml=\"%s\">%s</font><br/>\n", | 525 fprintf(data->file, "<font color=\"#6C2585\"><font size=\"2\">(%s)</font> <b>***%s</b></font> <font sml=\"%s\">%s</font><br/>\n", |
| 552 date, from, gc->prpl->info->name, msg_fixed); | 526 date, from, gc->prpl->info->name, msg_fixed); |
| 553 else | 527 else |
| 554 fprintf(data->file, "<font color=\"#16569E\">(%s) <b>%s:</b></font> <font sml=\"%s\">%s</font><br/>\n", | 528 fprintf(data->file, "<font color=\"#16569E\"><font size=\"2\">(%s)</font> <b>%s:</b></font> <font sml=\"%s\">%s</font><br/>\n", |
| 555 date, from, gc->prpl->info->name, msg_fixed); | 529 date, from, gc->prpl->info->name, msg_fixed); |
| 556 } | 530 } |
| 557 } | 531 } |
| 558 | 532 |
| 559 g_free(msg_fixed); | 533 g_free(msg_fixed); |
| 560 fflush(data->file); | 534 fflush(data->file); |
| 561 } | 535 } |
