Mercurial > pidgin
comparison src/plugin.c @ 7033:cf1126ba1834
[gaim-migrate @ 7596]
Multiple copies of gaim installed at different locations no longer attempt
to load the same, possibly incompatible plugins. It does this by saving
the base filenames of the plugins, rather than the full names, and attempts
to load them at the particular copy's plugin directory. Now a released gaim
in the system default prefix and a development gaim in a home directory
will no longer try to load each other's plugins. They'll each load their
own versions of each. Thanks to Robot101 for the patch.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Mon, 29 Sep 2003 22:46:15 +0000 |
parents | 083d1e4a9c78 |
children | 6d5dc6a65c47 |
comparison
equal
deleted
inserted
replaced
7032:0ffd540660df | 7033:cf1126ba1834 |
---|---|
763 | 763 |
764 g_return_if_fail(key != NULL); | 764 g_return_if_fail(key != NULL); |
765 | 765 |
766 files = gaim_prefs_get_string_list(key); | 766 files = gaim_prefs_get_string_list(key); |
767 | 767 |
768 for (f = files; f; f = f->next) { | 768 for (f = files; f; f = f->next) |
769 gaim_plugin_load(gaim_plugin_probe(f->data)); | 769 { |
770 char *filename = g_path_get_basename(f->data); | |
771 GaimPlugin *plugin = NULL; | |
772 | |
773 if (filename != NULL) | |
774 { | |
775 if ((plugin = gaim_plugins_find_with_basename(filename)) != NULL) | |
776 { | |
777 gaim_debug_info("plugins", "Loading saved plugin %s\n", | |
778 filename); | |
779 gaim_plugin_load(plugin); | |
780 } | |
781 else | |
782 { | |
783 gaim_debug_error("plugins", "Unable to find saved plugin %s\n", | |
784 filename); | |
785 } | |
786 | |
787 g_free(filename); | |
788 } | |
789 | |
770 g_free(f->data); | 790 g_free(f->data); |
771 } | 791 } |
772 | 792 |
773 g_list_free(files); | 793 g_list_free(files); |
774 #endif /* GAIM_PLUGINS */ | 794 #endif /* GAIM_PLUGINS */ |
987 | 1007 |
988 return NULL; | 1008 return NULL; |
989 } | 1009 } |
990 | 1010 |
991 GaimPlugin * | 1011 GaimPlugin * |
992 gaim_plugins_find_with_id(const char *id) | 1012 gaim_plugins_find_with_basename(const char *basename) |
993 { | 1013 { |
994 GaimPlugin *plugin; | 1014 GaimPlugin *plugin; |
995 GList *l; | 1015 GList *l; |
996 | 1016 |
1017 g_return_val_if_fail(basename != NULL, NULL); | |
1018 | |
1019 for (l = plugins; l != NULL; l = l->next) | |
1020 { | |
1021 char *tmp; | |
1022 | |
1023 plugin = (GaimPlugin *)l->data; | |
1024 | |
1025 if (plugin->path != NULL && | |
1026 (tmp = g_strrstr(plugin->path, basename)) != NULL) | |
1027 { | |
1028 tmp += strlen(basename); | |
1029 | |
1030 if (*tmp == '\0') | |
1031 return plugin; | |
1032 } | |
1033 } | |
1034 | |
1035 return NULL; | |
1036 } | |
1037 | |
1038 GaimPlugin * | |
1039 gaim_plugins_find_with_id(const char *id) | |
1040 { | |
1041 GaimPlugin *plugin; | |
1042 GList *l; | |
1043 | |
997 g_return_val_if_fail(id != NULL, NULL); | 1044 g_return_val_if_fail(id != NULL, NULL); |
998 | 1045 |
999 for (l = plugins; l != NULL; l = l->next) | 1046 for (l = plugins; l != NULL; l = l->next) |
1000 { | 1047 { |
1001 plugin = l->data; | 1048 plugin = l->data; |