Mercurial > pidgin
comparison libpurple/plugins/log_reader.c @ 18250:7a6a1da4121b
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.
| author | Richard Laager <rlaager@wiktel.com> |
|---|---|
| date | Mon, 25 Jun 2007 00:13:01 +0000 |
| parents | 35d981091506 |
| children | 8908e9ec2420 |
comparison
equal
deleted
inserted
replaced
| 18249:35d981091506 | 18250:7a6a1da4121b |
|---|---|
| 2147 /* Add Adium log directory preference. */ | 2147 /* Add Adium log directory preference. */ |
| 2148 purple_prefs_add_none("/plugins/core/log_reader/adium"); | 2148 purple_prefs_add_none("/plugins/core/log_reader/adium"); |
| 2149 | 2149 |
| 2150 /* Calculate default Adium log directory. */ | 2150 /* Calculate default Adium log directory. */ |
| 2151 #ifdef _WIN32 | 2151 #ifdef _WIN32 |
| 2152 path = ""; | 2152 purple_prefs_add_string("/plugins/core/log_reader/adium/log_directory", ""); |
| 2153 #else | 2153 #else |
| 2154 path = g_build_filename(purple_home_dir(), "Library", "Application Support", | 2154 path = g_build_filename(purple_home_dir(), "Library", "Application Support", |
| 2155 "Adium 2.0", "Users", "Default", "Logs", NULL); | 2155 "Adium 2.0", "Users", "Default", "Logs", NULL); |
| 2156 #endif | |
| 2157 | |
| 2158 purple_prefs_add_string("/plugins/core/log_reader/adium/log_directory", path); | 2156 purple_prefs_add_string("/plugins/core/log_reader/adium/log_directory", path); |
| 2159 | |
| 2160 #ifndef _WIN32 | |
| 2161 g_free(path); | 2157 g_free(path); |
| 2162 #endif | 2158 #endif |
| 2163 | 2159 |
| 2164 | 2160 |
| 2165 /* Add Fire log directory preference. */ | 2161 /* Add Fire log directory preference. */ |
| 2166 purple_prefs_add_none("/plugins/core/log_reader/fire"); | 2162 purple_prefs_add_none("/plugins/core/log_reader/fire"); |
| 2167 | 2163 |
| 2168 /* Calculate default Fire log directory. */ | 2164 /* Calculate default Fire log directory. */ |
| 2169 #ifdef _WIN32 | 2165 #ifdef _WIN32 |
| 2170 path = ""; | 2166 purple_prefs_add_string("/plugins/core/log_reader/fire/log_directory", ""); |
| 2171 #else | 2167 #else |
| 2172 path = g_build_filename(purple_home_dir(), "Library", "Application Support", | 2168 path = g_build_filename(purple_home_dir(), "Library", "Application Support", |
| 2173 "Fire", "Sessions", NULL); | 2169 "Fire", "Sessions", NULL); |
| 2174 #endif | |
| 2175 | |
| 2176 purple_prefs_add_string("/plugins/core/log_reader/fire/log_directory", path); | 2170 purple_prefs_add_string("/plugins/core/log_reader/fire/log_directory", path); |
| 2177 | |
| 2178 #ifndef _WIN32 | |
| 2179 g_free(path); | 2171 g_free(path); |
| 2180 #endif | 2172 #endif |
| 2181 | 2173 |
| 2182 | 2174 |
| 2183 /* Add Messenger Plus! log directory preference. */ | 2175 /* Add Messenger Plus! log directory preference. */ |
| 2185 | 2177 |
| 2186 /* Calculate default Messenger Plus! log directory. */ | 2178 /* Calculate default Messenger Plus! log directory. */ |
| 2187 #ifdef _WIN32 | 2179 #ifdef _WIN32 |
| 2188 folder = wpurple_get_special_folder(CSIDL_PERSONAL); | 2180 folder = wpurple_get_special_folder(CSIDL_PERSONAL); |
| 2189 if (folder) { | 2181 if (folder) { |
| 2182 path = g_build_filename(folder, "My Chat Logs", NULL); | |
| 2183 g_free(folder); | |
| 2184 } else | |
| 2185 path = g_strdup(""); | |
| 2186 #else | |
| 2187 path = g_build_filename(PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, | |
| 2188 "Documents and Settings", g_get_user_name(), | |
| 2189 "My Documents", "My Chat Logs", NULL); | |
| 2190 #endif | 2190 #endif |
| 2191 path = g_build_filename( | |
| 2192 #ifdef _WIN32 | |
| 2193 folder, | |
| 2194 #else | |
| 2195 PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, "Documents and Settings", | |
| 2196 g_get_user_name(), "My Documents", | |
| 2197 #endif | |
| 2198 "My Chat Logs", NULL); | |
| 2199 #ifdef _WIN32 | |
| 2200 g_free(folder); | |
| 2201 } else /* !folder */ | |
| 2202 path = g_strdup(""); | |
| 2203 #endif | |
| 2204 | |
| 2205 purple_prefs_add_string("/plugins/core/log_reader/messenger_plus/log_directory", path); | 2191 purple_prefs_add_string("/plugins/core/log_reader/messenger_plus/log_directory", path); |
| 2206 g_free(path); | 2192 g_free(path); |
| 2207 | 2193 |
| 2208 | 2194 |
| 2209 /* Add MSN Messenger log directory preference. */ | 2195 /* Add MSN Messenger log directory preference. */ |
| 2211 | 2197 |
| 2212 /* Calculate default MSN message history directory. */ | 2198 /* Calculate default MSN message history directory. */ |
| 2213 #ifdef _WIN32 | 2199 #ifdef _WIN32 |
| 2214 folder = wpurple_get_special_folder(CSIDL_PERSONAL); | 2200 folder = wpurple_get_special_folder(CSIDL_PERSONAL); |
| 2215 if (folder) { | 2201 if (folder) { |
| 2202 path = g_build_filename(folder, "My Received Files", NULL); | |
| 2203 g_free(folder); | |
| 2204 } else | |
| 2205 path = g_strdup(""); | |
| 2206 #else | |
| 2207 path = g_build_filename(PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, | |
| 2208 "Documents and Settings", g_get_user_name(), | |
| 2209 "My Documents", "My Received Files", NULL); | |
| 2216 #endif | 2210 #endif |
| 2217 path = g_build_filename( | |
| 2218 #ifdef _WIN32 | |
| 2219 folder, | |
| 2220 #else | |
| 2221 PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, "Documents and Settings", | |
| 2222 g_get_user_name(), "My Documents", | |
| 2223 #endif | |
| 2224 "My Received Files", NULL); | |
| 2225 #ifdef _WIN32 | |
| 2226 g_free(folder); | |
| 2227 } else /* !folder */ | |
| 2228 path = g_strdup(""); | |
| 2229 #endif | |
| 2230 | |
| 2231 purple_prefs_add_string("/plugins/core/log_reader/msn/log_directory", path); | 2211 purple_prefs_add_string("/plugins/core/log_reader/msn/log_directory", path); |
| 2232 g_free(path); | 2212 g_free(path); |
| 2233 | 2213 |
| 2234 | 2214 |
| 2235 /* Add Trillian log directory preference. */ | 2215 /* Add Trillian log directory preference. */ |
| 2268 | 2248 |
| 2269 if (!path) { | 2249 if (!path) { |
| 2270 char *folder = wpurple_get_special_folder(CSIDL_PROGRAM_FILES); | 2250 char *folder = wpurple_get_special_folder(CSIDL_PROGRAM_FILES); |
| 2271 if (folder) { | 2251 if (folder) { |
| 2272 path = g_build_filename(folder, "Trillian", | 2252 path = g_build_filename(folder, "Trillian", |
| 2273 "users", "default", "talk.ini", NULL); | 2253 "users", "default", "talk.ini", NULL); |
| 2274 g_free(folder); | 2254 g_free(folder); |
| 2275 } | 2255 } |
| 2276 } | 2256 } |
| 2277 | 2257 |
| 2278 if (path) { | 2258 if (path) { |
| 2343 } | 2323 } |
| 2344 #endif /* !GTK_CHECK_VERSION(2,6,0) */ | 2324 #endif /* !GTK_CHECK_VERSION(2,6,0) */ |
| 2345 } /* path */ | 2325 } /* path */ |
| 2346 | 2326 |
| 2347 if (!found) { | 2327 if (!found) { |
| 2348 #endif /* defined(_WIN32) */ | 2328 folder = wpurple_get_special_folder(CSIDL_PROGRAM_FILES); |
| 2329 if (folder) { | |
| 2330 path = g_build_filename(folder, "Trillian", "users", | |
| 2331 "default", "logs", NULL); | |
| 2332 g_free(folder); | |
| 2333 } else | |
| 2334 path = g_strdup(""); | |
| 2335 } | |
| 2336 #else /* !defined(_WIN32) */ | |
| 2337 /* TODO: At some point, this could attempt to parse talk.ini | |
| 2338 * TODO: from the default Trillian install directory on the | |
| 2339 * TODO: Windows mount point. */ | |
| 2349 | 2340 |
| 2350 /* Calculate default Trillian log directory. */ | 2341 /* Calculate default Trillian log directory. */ |
| 2342 path = g_build_filename(PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, | |
| 2343 "Program Files", "Trillian", "users", | |
| 2344 "default", "logs", NULL); | |
| 2345 #endif | |
| 2346 | |
| 2347 | |
| 2348 /* Add QIP log directory preference. */ | |
| 2349 purple_prefs_add_none("/plugins/core/log_reader/qip"); | |
| 2350 | |
| 2351 /* Calculate default QIP log directory. */ | |
| 2351 #ifdef _WIN32 | 2352 #ifdef _WIN32 |
| 2352 folder = wpurple_get_special_folder(CSIDL_PROGRAM_FILES); | 2353 folder = wpurple_get_special_folder(CSIDL_PROGRAM_FILES); |
| 2353 if (folder) { | 2354 if (folder) { |
| 2355 path = g_build_filename(folder, "QIP", "Users", NULL); | |
| 2356 g_free(folder); | |
| 2357 } else | |
| 2358 path = g_strdup(""); | |
| 2359 #else | |
| 2360 path = g_build_filename(PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, | |
| 2361 "Program Files", "QIP", "Users", NULL); | |
| 2354 #endif | 2362 #endif |
| 2355 path = g_build_filename( | |
| 2356 #ifdef _WIN32 | |
| 2357 folder, | |
| 2358 #else | |
| 2359 PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, "Program Files", | |
| 2360 #endif | |
| 2361 "Trillian", "users", "default", "logs", NULL); | |
| 2362 #ifdef _WIN32 | |
| 2363 g_free(folder); | |
| 2364 } else /* !folder */ | |
| 2365 path = g_strdup(""); | |
| 2366 #endif | |
| 2367 | |
| 2368 #ifdef _WIN32 | |
| 2369 } /* !found */ | |
| 2370 #endif | |
| 2371 | |
| 2372 /* Add QIP log directory preference. */ | |
| 2373 purple_prefs_add_none("/plugins/core/log_reader/qip"); | |
| 2374 | |
| 2375 #ifdef _WIN32 | |
| 2376 /* Calculate default Messenger Plus! log directory. */ | |
| 2377 folder = wpurple_get_special_folder(CSIDL_PROGRAM_FILES); | |
| 2378 if (folder) { | |
| 2379 #endif | |
| 2380 path = g_build_filename( | |
| 2381 #ifdef _WIN32 | |
| 2382 folder, | |
| 2383 #else | |
| 2384 PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, "Program Files", | |
| 2385 #endif | |
| 2386 "QIP", "Users", NULL); | |
| 2387 #ifdef _WIN32 | |
| 2388 g_free(folder); | |
| 2389 } else /* !folder */ | |
| 2390 path = g_strdup(""); | |
| 2391 #endif | |
| 2392 | |
| 2393 purple_prefs_add_string("/plugins/core/log_reader/qip/log_directory", path); | 2363 purple_prefs_add_string("/plugins/core/log_reader/qip/log_directory", path); |
| 2394 g_free(path); | 2364 g_free(path); |
| 2395 } | 2365 } |
| 2396 | 2366 |
| 2397 static gboolean | 2367 static gboolean |
