comparison src/plugin.c @ 13527:33dc57ccbd83

[gaim-migrate @ 15903] Prevent plugins that have more than one period in the name from being duplicated with every probe. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Mon, 20 Mar 2006 05:06:26 +0000
parents 10c26505d6db
children 8ec038ec9998
comparison
equal deleted inserted replaced
13526:e79d8720de34 13527:33dc57ccbd83
1206 1206
1207 if (f->data == NULL) 1207 if (f->data == NULL)
1208 continue; 1208 continue;
1209 1209
1210 filename = f->data; 1210 filename = f->data;
1211
1211 /* 1212 /*
1212 * We don't know if the filename uses Windows or Unix path 1213 * We don't know if the filename uses Windows or Unix path
1213 * separators (because people might be sharing a prefs.xml 1214 * separators (because people might be sharing a prefs.xml
1214 * file across systems), so we find the last occurrence 1215 * file across systems), so we find the last occurrence
1215 * of either. 1216 * of either.
1218 if ((basename == NULL) || (basename < strrchr(filename, '\\'))) 1219 if ((basename == NULL) || (basename < strrchr(filename, '\\')))
1219 basename = strrchr(filename, '\\'); 1220 basename = strrchr(filename, '\\');
1220 if (basename != NULL) 1221 if (basename != NULL)
1221 basename++; 1222 basename++;
1222 1223
1224 /* Strip the extension */
1225 basename = gaim_plugin_get_basename(basename);
1226
1223 if ((plugin = gaim_plugins_find_with_filename(filename)) != NULL) 1227 if ((plugin = gaim_plugins_find_with_filename(filename)) != NULL)
1224 { 1228 {
1225 gaim_debug_info("plugins", "Loading saved plugin %s\n", 1229 gaim_debug_info("plugins", "Loading saved plugin %s\n",
1226 plugin->path); 1230 plugin->path);
1227 gaim_plugin_load(plugin); 1231 gaim_plugin_load(plugin);
1235 else 1239 else
1236 { 1240 {
1237 gaim_debug_error("plugins", "Unable to find saved plugin %s\n", 1241 gaim_debug_error("plugins", "Unable to find saved plugin %s\n",
1238 filename); 1242 filename);
1239 } 1243 }
1244
1245 g_free(basename);
1240 1246
1241 g_free(f->data); 1247 g_free(f->data);
1242 } 1248 }
1243 1249
1244 g_list_free(files); 1250 g_list_free(files);
1494 gaim_plugins_find_with_basename(const char *basename) 1500 gaim_plugins_find_with_basename(const char *basename)
1495 { 1501 {
1496 #ifdef GAIM_PLUGINS 1502 #ifdef GAIM_PLUGINS
1497 GaimPlugin *plugin; 1503 GaimPlugin *plugin;
1498 GList *l; 1504 GList *l;
1499 char *basename_no_ext;
1500 char *tmp; 1505 char *tmp;
1501 1506
1502 g_return_val_if_fail(basename != NULL, NULL); 1507 g_return_val_if_fail(basename != NULL, NULL);
1503
1504 basename_no_ext = gaim_plugin_get_basename(basename);
1505 1508
1506 for (l = plugins; l != NULL; l = l->next) 1509 for (l = plugins; l != NULL; l = l->next)
1507 { 1510 {
1508 plugin = (GaimPlugin *)l->data; 1511 plugin = (GaimPlugin *)l->data;
1509 1512
1510 if (plugin->path != NULL) { 1513 if (plugin->path != NULL) {
1511 tmp = gaim_plugin_get_basename(plugin->path); 1514 tmp = gaim_plugin_get_basename(plugin->path);
1512 if (!strcmp(tmp, basename_no_ext)) 1515 if (!strcmp(tmp, basename))
1513 { 1516 {
1514 g_free(tmp); 1517 g_free(tmp);
1515 g_free(basename_no_ext);
1516 return plugin; 1518 return plugin;
1517 } 1519 }
1518 g_free(tmp); 1520 g_free(tmp);
1519 } 1521 }
1520 } 1522 }
1521 1523
1522 g_free(basename_no_ext);
1523 #endif /* GAIM_PLUGINS */ 1524 #endif /* GAIM_PLUGINS */
1524 1525
1525 return NULL; 1526 return NULL;
1526 } 1527 }
1527 1528