diff -u --exclude=Make* --exclude=*.o --exclude=gaim src/conversation.c src/changed/conversation.c --- src/conversation.c Fri Aug 20 19:31:18 1999 +++ src/changed/conversation.c Fri Aug 20 19:24:18 1999 @@ -42,7 +42,6 @@ #include "pixmaps/link.xpm" int state_lock=0; -char log_all_file[256]; GdkPixmap *dark_icon_pm = NULL; GdkBitmap *dark_icon_bm = NULL; @@ -298,6 +297,19 @@ c = (struct conversation *)g_new0(struct conversation, 1); g_snprintf(c->name, sizeof(c->name), "%s", name); + + if (log_all_conv) { + FILE *fd; + static char datetime[80]; + time_t tme; + time(&tme); + strftime(datetime, sizeof(datetime), "%Y/%m/%d, %H:%M:%S", localtime(&tme)); + + fd = open_log_file(c); + fprintf(fd, "----- New Conversation @ %s -----\n", datetime); + fclose(fd); + } + show_conv(c); conversations = g_list_append(conversations, c); return c; @@ -762,7 +774,6 @@ char *buf2 = g_malloc(BUF_LONG); struct log_conversation *l; FILE *fd; - int res; char colour[10]; if (flags & WFLAG_RECV) @@ -791,61 +802,14 @@ fclose(fd); } if (log_all_conv) { - struct stat st; - /* Dont log yourself */ - g_snprintf(log_all_file, 256, "%s/.gaim", getenv("HOME")); - - stat(log_all_file, &st); - if (!S_ISDIR(st.st_mode)) - unlink(log_all_file); - - fd = fopen(log_all_file, "r"); - - if (!fd) { - res = mkdir(log_all_file, S_IRUSR | S_IWUSR | S_IXUSR); - if (res < 0) { - g_snprintf(buf, BUF_LONG, "Unable to make directory %s for logging", log_all_file); - do_error_dialog(buf, "Error!"); - g_free(buf); - g_free(buf2); - return; - } - } else - fclose(fd); - - g_snprintf(log_all_file, 256, "%s/.gaim/%s", getenv("HOME"), ourname); - - stat(log_all_file, &st); - if (!S_ISDIR(st.st_mode)) - unlink(log_all_file); - - fd = fopen(log_all_file, "r"); - if (!fd) { - res = mkdir(log_all_file, S_IRUSR | S_IWUSR | S_IXUSR); - if (res < 0) { - g_snprintf(buf, BUF_LONG, "Unable to make directory %s for logging", log_all_file); - do_error_dialog(buf, "Error!"); - g_free(buf); - g_free(buf2); - return; - } - } else - fclose(fd); - - g_snprintf(log_all_file, 256, "%s/.gaim/%s/%s.log", getenv("HOME"), ourname, normalize(c->name)); - sprintf(debug_buff,"Logging to: \"%s\"\n", log_all_file); - debug_print(debug_buff); - fd = fopen(log_all_file, "a"); - if (show_time) fprintf(fd, "%s ", date()); - fprintf(fd, "%s: %s\n", who, what); - fclose(fd); + fd = open_log_file(c); + if (show_time) fprintf(fd, "%s ", date()); + fprintf(fd, "%s: %s\n", who, what); + fclose(fd); } g_free(buf); g_free(buf2); } - - - void conv_write(struct conversation *c, char *message, int flags) { Only in src: dialogs.c diff -u --exclude=Make* --exclude=*.o --exclude=gaim src/gaim.h src/changed/gaim.h --- src/gaim.h Fri Aug 20 19:31:19 1999 +++ src/changed/gaim.h Fri Aug 20 19:24:18 1999 @@ -350,7 +350,7 @@ extern void aol_icon(GdkWindow *); extern int query_state(); extern void set_state(int); - +extern FILE *open_log_file (struct conversation *c); /* Functions in server.c */ /* input to serv */ diff -u --exclude=Make* --exclude=*.o --exclude=gaim src/util.c src/changed/util.c --- src/util.c Fri Aug 20 19:31:20 1999 +++ src/changed/util.c Fri Aug 20 19:33:28 1999 @@ -19,10 +19,13 @@ * */ +#include #include #include +#include #include #include +#include #include #include #include @@ -33,7 +36,63 @@ static GdkBitmap *icon_bm = NULL; static int state; +FILE *open_log_file (struct conversation *c) +{ + char *buf = g_malloc(BUF_LONG); + char *buf2 = g_malloc(BUF_LONG); + char log_all_file[256]; + struct stat st; + FILE *fd; + int res; + /* Dont log yourself */ + g_snprintf(log_all_file, 256, "%s/.gaim", getenv("HOME")); + + stat(log_all_file, &st); + if (!S_ISDIR(st.st_mode)) + unlink(log_all_file); + + fd = fopen(log_all_file, "r"); + + if (!fd) { + res = mkdir(log_all_file, S_IRUSR | S_IWUSR | S_IXUSR); + if (res < 0) { + g_snprintf(buf, BUF_LONG, "Unable to make directory %s for logging", log_all_file); + do_error_dialog(buf, "Error!"); + g_free(buf); + g_free(buf2); + return NULL; + } + } else + fclose(fd); + + g_snprintf(log_all_file, 256, "%s/.gaim/%s", getenv("HOME"), ourname); + + stat(log_all_file, &st); + if (!S_ISDIR(st.st_mode)) + unlink(log_all_file); + + fd = fopen(log_all_file, "r"); + if (!fd) { + res = mkdir(log_all_file, S_IRUSR | S_IWUSR | S_IXUSR); + if (res < 0) { + g_snprintf(buf, BUF_LONG, "Unable to make directory %s for logging", log_all_file); + do_error_dialog(buf, "Error!"); + g_free(buf); + g_free(buf2); + return NULL; + } + } else + fclose(fd); + + g_snprintf(log_all_file, 256, "%s/.gaim/%s/%s.log", getenv("HOME"), ourname, normalize(c->name)); + + sprintf(debug_buff,"Logging to: \"%s\"\n", log_all_file); + debug_print(debug_buff); + + fd = fopen(log_all_file, "a"); + return fd; +} int escape_message(char *msg)