# HG changeset patch # User Luke Schierer # Date 1093654590 0 # Node ID 284a84477ee93a9aa2f7b7fcd0d97ee0928247a6 # Parent 67dbf65e76cffd450cb905ae026a0f8bbc72dd99 [gaim-migrate @ 10780] (20:58:51) datallah: "this should make windows suck less..." i don't think that's possible. but it might make gaim on win32 suck less. committer: Tailor Script diff -r 67dbf65e76cf -r 284a84477ee9 src/log.c --- a/src/log.c Fri Aug 27 22:23:31 2004 +0000 +++ b/src/log.c Sat Aug 28 00:56:30 2004 +0000 @@ -74,8 +74,6 @@ void gaim_log_write(GaimLog *log, GaimMessageFlags type, const char *from, time_t time, const char *message) { - struct _gaim_logsize_user lu; - g_return_if_fail(log); g_return_if_fail(log->logger); g_return_if_fail(log->logger->write); @@ -86,11 +84,16 @@ gaim_prefs_get_bool("/core/logging/log_chats")) || (log->type == GAIM_LOG_SYSTEM && gaim_prefs_get_bool("/core/logging/log_system"))) { + struct _gaim_logsize_user *lu; (log->logger->write)(log, type, from, time, message); - lu.name = g_strdup(gaim_normalize(log->account, log->name)); - lu.account = log->account; - g_hash_table_remove(logsize_users, &lu); - g_free(lu.name); + + lu = g_new(struct _gaim_logsize_user, 1); + + lu->name = g_strdup(gaim_normalize(log->account, log->name)); + lu->account = log->account; + g_hash_table_remove(logsize_users, lu); + g_free(lu->name); + g_free(lu); } } @@ -343,14 +346,14 @@ /* This log is new */ char *ud = gaim_user_dir(); char *acct_name = g_strdup(gaim_normalize(log->account, - gaim_account_get_username(log->account))); + gaim_account_get_username(log->account))); char *target; char *dir; char *filename, *path; if (log->type == GAIM_LOG_CHAT) { target = g_strdup_printf("%s.chat", gaim_normalize(log->account, - log->name)); + log->name)); } else if(log->type == GAIM_LOG_SYSTEM) { target = g_strdup(".system"); } else { @@ -376,7 +379,7 @@ data->file = fopen(path, "a"); if (!data->file) { gaim_debug(GAIM_DEBUG_ERROR, "log", - "Could not create log file %s\n", filename); + "Could not create log file %s\n", path); g_free(path); return; } @@ -585,6 +588,10 @@ } + /* if we can't write to the file, give up before we hurt ourselves */ + if(!data->file) + return; + gaim_markup_html_to_xhtml(message, &msg_fixed, NULL); if(log->type == GAIM_LOG_SYSTEM){