| 497 /* This log is new. We could use the loggers 'new' function, but |
497 /* This log is new. We could use the loggers 'new' function, but |
| 498 * creating a new file there would result in empty files in the case |
498 * creating a new file there would result in empty files in the case |
| 499 * that you open a convo with someone, but don't say anything. |
499 * that you open a convo with someone, but don't say anything. |
| 500 */ |
500 */ |
| 501 char *ud = gaim_user_dir(); |
501 char *ud = gaim_user_dir(); |
| |
502 char *filename; |
| 502 char *guy = g_strdup(gaim_normalize(log->account, gaim_account_get_username(log->account))); |
503 char *guy = g_strdup(gaim_normalize(log->account, gaim_account_get_username(log->account))); |
| 503 const char *prpl = GAIM_PLUGIN_PROTOCOL_INFO |
504 const char *prpl = GAIM_PLUGIN_PROTOCOL_INFO |
| 504 (gaim_find_prpl(gaim_account_get_protocol(log->account)))->list_icon(log->account, NULL); |
505 (gaim_find_prpl(gaim_account_get_protocol(log->account)))->list_icon(log->account, NULL); |
| 505 char *dir; |
506 char *dir; |
| 506 FILE *file; |
507 FILE *file; |
| 521 dir = g_build_filename(ud, "logs", |
522 dir = g_build_filename(ud, "logs", |
| 522 prpl, guy, gaim_normalize(log->account, log->name), NULL); |
523 prpl, guy, gaim_normalize(log->account, log->name), NULL); |
| 523 mkdir (dir, S_IRUSR | S_IWUSR | S_IXUSR); |
524 mkdir (dir, S_IRUSR | S_IWUSR | S_IXUSR); |
| 524 g_free(guy); |
525 g_free(guy); |
| 525 |
526 |
| 526 char *filename = g_build_filename(dir, date, NULL); |
527 filename = g_build_filename(dir, date, NULL); |
| 527 g_free(dir); |
528 g_free(dir); |
| 528 |
529 |
| 529 file = fopen(dir, "r"); |
530 file = fopen(dir, "r"); |
| 530 if(!file) |
531 if(!file) |
| 531 mkdir(dir, S_IRUSR | S_IWUSR | S_IXUSR); |
532 mkdir(dir, S_IRUSR | S_IWUSR | S_IXUSR); |
| 612 char *logfile = g_strdup_printf("%s.log", gaim_normalize(account, sn)); |
613 char *logfile = g_strdup_printf("%s.log", gaim_normalize(account, sn)); |
| 613 char *date; |
614 char *date; |
| 614 char *path = g_build_filename(gaim_user_dir(), "logs", logfile, NULL); |
615 char *path = g_build_filename(gaim_user_dir(), "logs", logfile, NULL); |
| 615 char *newlog; |
616 char *newlog; |
| 616 |
617 |
| 617 g_free(logfile); |
|
| 618 |
|
| 619 GaimLog *log = NULL; |
618 GaimLog *log = NULL; |
| 620 GList *list = NULL; |
619 GList *list = NULL; |
| |
620 |
| |
621 g_free(logfile); |
| 621 |
622 |
| 622 if (!(file = fopen(path, "rb"))) { |
623 if (!(file = fopen(path, "rb"))) { |
| 623 g_free(path); |
624 g_free(path); |
| 624 return NULL; |
625 return NULL; |
| 625 } |
626 } |