# HG changeset patch # User Richard Laager # Date 1182730381 0 # Node ID 7a6a1da4121be49e3200873d1670f6b3d528e820 # Parent 35d9810915065e219806772370dbdcf4941f90d1 Trying to avoid duplicating a single line of code is stupid. I've finally gotten around to changing this code to be more understandable. Eventually I'll improve the UI as well. diff -r 35d981091506 -r 7a6a1da4121b libpurple/plugins/log_reader.c --- a/libpurple/plugins/log_reader.c Sun Jun 24 23:52:08 2007 +0000 +++ b/libpurple/plugins/log_reader.c Mon Jun 25 00:13:01 2007 +0000 @@ -2149,15 +2149,11 @@ /* Calculate default Adium log directory. */ #ifdef _WIN32 - path = ""; + purple_prefs_add_string("/plugins/core/log_reader/adium/log_directory", ""); #else - path = g_build_filename(purple_home_dir(), "Library", "Application Support", - "Adium 2.0", "Users", "Default", "Logs", NULL); -#endif - + path = g_build_filename(purple_home_dir(), "Library", "Application Support", + "Adium 2.0", "Users", "Default", "Logs", NULL); purple_prefs_add_string("/plugins/core/log_reader/adium/log_directory", path); - -#ifndef _WIN32 g_free(path); #endif @@ -2167,15 +2163,11 @@ /* Calculate default Fire log directory. */ #ifdef _WIN32 - path = ""; + purple_prefs_add_string("/plugins/core/log_reader/fire/log_directory", ""); #else - path = g_build_filename(purple_home_dir(), "Library", "Application Support", - "Fire", "Sessions", NULL); -#endif - + path = g_build_filename(purple_home_dir(), "Library", "Application Support", + "Fire", "Sessions", NULL); purple_prefs_add_string("/plugins/core/log_reader/fire/log_directory", path); - -#ifndef _WIN32 g_free(path); #endif @@ -2187,21 +2179,15 @@ #ifdef _WIN32 folder = wpurple_get_special_folder(CSIDL_PERSONAL); if (folder) { -#endif - path = g_build_filename( -#ifdef _WIN32 - folder, + path = g_build_filename(folder, "My Chat Logs", NULL); + g_free(folder); + } else + path = g_strdup(""); #else - PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, "Documents and Settings", - g_get_user_name(), "My Documents", + path = g_build_filename(PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, + "Documents and Settings", g_get_user_name(), + "My Documents", "My Chat Logs", NULL); #endif - "My Chat Logs", NULL); -#ifdef _WIN32 - g_free(folder); - } else /* !folder */ - path = g_strdup(""); -#endif - purple_prefs_add_string("/plugins/core/log_reader/messenger_plus/log_directory", path); g_free(path); @@ -2213,21 +2199,15 @@ #ifdef _WIN32 folder = wpurple_get_special_folder(CSIDL_PERSONAL); if (folder) { -#endif - path = g_build_filename( -#ifdef _WIN32 - folder, + path = g_build_filename(folder, "My Received Files", NULL); + g_free(folder); + } else + path = g_strdup(""); #else - PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, "Documents and Settings", - g_get_user_name(), "My Documents", + path = g_build_filename(PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, + "Documents and Settings", g_get_user_name(), + "My Documents", "My Received Files", NULL); #endif - "My Received Files", NULL); -#ifdef _WIN32 - g_free(folder); - } else /* !folder */ - path = g_strdup(""); -#endif - purple_prefs_add_string("/plugins/core/log_reader/msn/log_directory", path); g_free(path); @@ -2270,7 +2250,7 @@ char *folder = wpurple_get_special_folder(CSIDL_PROGRAM_FILES); if (folder) { path = g_build_filename(folder, "Trillian", - "users", "default", "talk.ini", NULL); + "users", "default", "talk.ini", NULL); g_free(folder); } } @@ -2345,51 +2325,41 @@ } /* path */ if (!found) { -#endif /* defined(_WIN32) */ + folder = wpurple_get_special_folder(CSIDL_PROGRAM_FILES); + if (folder) { + path = g_build_filename(folder, "Trillian", "users", + "default", "logs", NULL); + g_free(folder); + } else + path = g_strdup(""); + } +#else /* !defined(_WIN32) */ + /* TODO: At some point, this could attempt to parse talk.ini + * TODO: from the default Trillian install directory on the + * TODO: Windows mount point. */ /* Calculate default Trillian log directory. */ + path = g_build_filename(PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, + "Program Files", "Trillian", "users", + "default", "logs", NULL); +#endif + + + /* Add QIP log directory preference. */ + purple_prefs_add_none("/plugins/core/log_reader/qip"); + + /* Calculate default QIP log directory. */ #ifdef _WIN32 folder = wpurple_get_special_folder(CSIDL_PROGRAM_FILES); if (folder) { -#endif - path = g_build_filename( -#ifdef _WIN32 - folder, + path = g_build_filename(folder, "QIP", "Users", NULL); + g_free(folder); + } else + path = g_strdup(""); #else - PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, "Program Files", -#endif - "Trillian", "users", "default", "logs", NULL); -#ifdef _WIN32 - g_free(folder); - } else /* !folder */ - path = g_strdup(""); -#endif - -#ifdef _WIN32 - } /* !found */ + path = g_build_filename(PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, + "Program Files", "QIP", "Users", NULL); #endif - - /* Add QIP log directory preference. */ - purple_prefs_add_none("/plugins/core/log_reader/qip"); - -#ifdef _WIN32 - /* Calculate default Messenger Plus! log directory. */ - folder = wpurple_get_special_folder(CSIDL_PROGRAM_FILES); - if (folder) { -#endif - path = g_build_filename( -#ifdef _WIN32 - folder, -#else - PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, "Program Files", -#endif - "QIP", "Users", NULL); -#ifdef _WIN32 - g_free(folder); - } else /* !folder */ - path = g_strdup(""); -#endif - purple_prefs_add_string("/plugins/core/log_reader/qip/log_directory", path); g_free(path); }