Sat, 06 Oct 2007 23:07:45 +0000
Fix a syntax error so this compiles.
| 5205 | 1 | /* |
| 15884 | 2 | * purple |
| 5205 | 3 | * |
| 15884 | 4 | * Purple is the legal property of its developers, whose names are too numerous |
| 8046 | 5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 6 | * source distribution. | |
| 5205 | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2 of the License, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * This program is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18889
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 5205 | 21 | */ |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
22 | #include "internal.h" |
| 5205 | 23 | |
|
5638
53e752c88ea1
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
24 | #include "accountopt.h" |
|
14787
2adb9bac76b5
[gaim-migrate @ 17479]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14254
diff
changeset
|
25 | #include "core.h" |
|
13136
0438506e90ac
[gaim-migrate @ 15497]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13107
diff
changeset
|
26 | #include "dbus-maybe.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
27 | #include "debug.h" |
|
5436
a0e0bacaa196
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5357
diff
changeset
|
28 | #include "notify.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
29 | #include "prefs.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
30 | #include "prpl.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
31 | #include "request.h" |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6432
diff
changeset
|
32 | #include "signals.h" |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
33 | #include "util.h" |
| 9943 | 34 | #include "version.h" |
| 5205 | 35 | |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
36 | typedef struct |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
37 | { |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
38 | GHashTable *commands; |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
39 | size_t command_count; |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
40 | |
| 15884 | 41 | } PurplePluginIpcInfo; |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
42 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
43 | typedef struct |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
44 | { |
| 15884 | 45 | PurpleCallback func; |
| 46 | PurpleSignalMarshalFunc marshal; | |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
47 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
48 | int num_params; |
| 15884 | 49 | PurpleValue **params; |
| 50 | PurpleValue *ret_value; | |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
51 | |
| 15884 | 52 | } PurplePluginIpcCommand; |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
53 | |
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
54 | static GList *search_paths = NULL; |
|
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
55 | static GList *plugins = NULL; |
|
11950
a522c2da66e5
[gaim-migrate @ 14241]
Evan Schoenberg <evands@pidgin.im>
parents:
11772
diff
changeset
|
56 | static GList *loaded_plugins = NULL; |
|
a522c2da66e5
[gaim-migrate @ 14241]
Evan Schoenberg <evands@pidgin.im>
parents:
11772
diff
changeset
|
57 | static GList *protocol_plugins = NULL; |
| 15884 | 58 | #ifdef PURPLE_PLUGINS |
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
59 | static GList *load_queue = NULL; |
|
6981
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
60 | static GList *plugin_loaders = NULL; |
|
11950
a522c2da66e5
[gaim-migrate @ 14241]
Evan Schoenberg <evands@pidgin.im>
parents:
11772
diff
changeset
|
61 | #endif |
| 5205 | 62 | |
| 63 | static void (*probe_cb)(void *) = NULL; | |
| 64 | static void *probe_cb_data = NULL; | |
| 15884 | 65 | static void (*load_cb)(PurplePlugin *, void *) = NULL; |
| 5205 | 66 | static void *load_cb_data = NULL; |
| 15884 | 67 | static void (*unload_cb)(PurplePlugin *, void *) = NULL; |
| 5205 | 68 | static void *unload_cb_data = NULL; |
| 69 | ||
| 15884 | 70 | #ifdef PURPLE_PLUGINS |
|
11950
a522c2da66e5
[gaim-migrate @ 14241]
Evan Schoenberg <evands@pidgin.im>
parents:
11772
diff
changeset
|
71 | |
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
72 | static gboolean |
|
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
73 | has_file_extension(const char *filename, const char *ext) |
| 5205 | 74 | { |
| 75 | int len, extlen; | |
| 76 | ||
| 77 | if (filename == NULL || *filename == '\0' || ext == NULL) | |
| 78 | return 0; | |
| 79 | ||
| 80 | extlen = strlen(ext); | |
| 81 | len = strlen(filename) - extlen; | |
| 82 | ||
| 83 | if (len < 0) | |
| 84 | return 0; | |
| 85 | ||
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
86 | return (strncmp(filename + len, ext, extlen) == 0); |
| 5205 | 87 | } |
| 88 | ||
| 89 | static gboolean | |
|
10682
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
90 | is_native(const char *filename) |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
91 | { |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
92 | const char *last_period; |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
93 | |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
94 | last_period = strrchr(filename, '.'); |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
95 | if (last_period == NULL) |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
96 | return FALSE; |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
97 | |
|
12077
484da2b29933
[gaim-migrate @ 14374]
Mark Doliner <markdoliner@pidgin.im>
parents:
12066
diff
changeset
|
98 | return !(strcmp(last_period, ".dll") & |
|
484da2b29933
[gaim-migrate @ 14374]
Mark Doliner <markdoliner@pidgin.im>
parents:
12066
diff
changeset
|
99 | strcmp(last_period, ".sl") & |
|
484da2b29933
[gaim-migrate @ 14374]
Mark Doliner <markdoliner@pidgin.im>
parents:
12066
diff
changeset
|
100 | strcmp(last_period, ".so")); |
|
10682
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
101 | } |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
102 | |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
103 | static char * |
| 15884 | 104 | purple_plugin_get_basename(const char *filename) |
|
10682
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
105 | { |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
106 | const char *basename; |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
107 | const char *last_period; |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
108 | |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
109 | basename = strrchr(filename, G_DIR_SEPARATOR); |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
110 | if (basename != NULL) |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
111 | basename++; |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
112 | else |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
113 | basename = filename; |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
114 | |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
115 | if (is_native(basename) && |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
116 | ((last_period = strrchr(basename, '.')) != NULL)) |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
117 | return g_strndup(basename, (last_period - basename)); |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
118 | |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
119 | return g_strdup(basename); |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
120 | } |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
121 | |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
122 | static gboolean |
| 15884 | 123 | loader_supports_file(PurplePlugin *loader, const char *filename) |
| 5205 | 124 | { |
| 6432 | 125 | GList *exts; |
| 5205 | 126 | |
| 15884 | 127 | for (exts = PURPLE_PLUGIN_LOADER_INFO(loader)->exts; exts != NULL; exts = exts->next) { |
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
128 | if (has_file_extension(filename, (char *)exts->data)) { |
| 6432 | 129 | return TRUE; |
| 5205 | 130 | } |
| 131 | } | |
| 132 | ||
| 133 | return FALSE; | |
| 134 | } | |
| 135 | ||
| 15884 | 136 | static PurplePlugin * |
| 137 | find_loader_for_plugin(const PurplePlugin *plugin) | |
| 5205 | 138 | { |
| 15884 | 139 | PurplePlugin *loader; |
| 5205 | 140 | GList *l; |
| 141 | ||
| 142 | if (plugin->path == NULL) | |
| 143 | return NULL; | |
| 144 | ||
| 15884 | 145 | for (l = purple_plugins_get_loaded(); l != NULL; l = l->next) { |
| 5205 | 146 | loader = l->data; |
| 147 | ||
| 15884 | 148 | if (loader->info->type == PURPLE_PLUGIN_LOADER && |
|
5794
ebdbb7dc6658
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5646
diff
changeset
|
149 | loader_supports_file(loader, plugin->path)) { |
| 5205 | 150 | |
| 151 | return loader; | |
| 152 | } | |
| 153 | ||
| 154 | loader = NULL; | |
| 155 | } | |
| 156 | ||
| 157 | return NULL; | |
| 158 | } | |
| 159 | ||
| 15884 | 160 | #endif /* PURPLE_PLUGINS */ |
|
5449
4c350eb7d4a0
[gaim-migrate @ 5836]
Decklin Foster <decklin@red-bean.com>
parents:
5443
diff
changeset
|
161 | |
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
162 | /** |
|
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
163 | * Negative if a before b, 0 if equal, positive if a after b. |
|
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
164 | */ |
| 5205 | 165 | static gint |
| 15884 | 166 | compare_prpl(PurplePlugin *a, PurplePlugin *b) |
| 5205 | 167 | { |
| 15884 | 168 | if(PURPLE_IS_PROTOCOL_PLUGIN(a)) { |
| 169 | if(PURPLE_IS_PROTOCOL_PLUGIN(b)) | |
| 7956 | 170 | return strcmp(a->info->name, b->info->name); |
| 171 | else | |
| 172 | return -1; | |
| 173 | } else { | |
| 15884 | 174 | if(PURPLE_IS_PROTOCOL_PLUGIN(b)) |
| 7956 | 175 | return 1; |
| 176 | else | |
| 177 | return 0; | |
| 178 | } | |
| 5205 | 179 | } |
| 180 | ||
| 15884 | 181 | PurplePlugin * |
| 182 | purple_plugin_new(gboolean native, const char *path) | |
| 5205 | 183 | { |
| 15884 | 184 | PurplePlugin *plugin; |
| 5205 | 185 | |
| 15884 | 186 | plugin = g_new0(PurplePlugin, 1); |
| 5205 | 187 | |
| 188 | plugin->native_plugin = native; | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14024
diff
changeset
|
189 | plugin->path = g_strdup(path); |
| 5205 | 190 | |
| 15884 | 191 | PURPLE_DBUS_REGISTER_POINTER(plugin, PurplePlugin); |
|
13136
0438506e90ac
[gaim-migrate @ 15497]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13107
diff
changeset
|
192 | |
| 5205 | 193 | return plugin; |
| 194 | } | |
| 195 | ||
| 15884 | 196 | PurplePlugin * |
| 197 | purple_plugin_probe(const char *filename) | |
| 5205 | 198 | { |
| 15884 | 199 | #ifdef PURPLE_PLUGINS |
| 200 | PurplePlugin *plugin = NULL; | |
| 201 | PurplePlugin *loader; | |
| 10124 | 202 | gpointer unpunned; |
|
12342
da61b726d595
[gaim-migrate @ 14646]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12332
diff
changeset
|
203 | gchar *basename = NULL; |
| 15884 | 204 | gboolean (*purple_init_plugin)(PurplePlugin *); |
| 5205 | 205 | |
| 15884 | 206 | purple_debug_misc("plugins", "probing %s\n", filename); |
| 5205 | 207 | g_return_val_if_fail(filename != NULL, NULL); |
| 208 | ||
|
5973
adc75f0fcaa3
[gaim-migrate @ 6420]
Mark Doliner <markdoliner@pidgin.im>
parents:
5949
diff
changeset
|
209 | if (!g_file_test(filename, G_FILE_TEST_EXISTS)) |
|
adc75f0fcaa3
[gaim-migrate @ 6420]
Mark Doliner <markdoliner@pidgin.im>
parents:
5949
diff
changeset
|
210 | return NULL; |
|
adc75f0fcaa3
[gaim-migrate @ 6420]
Mark Doliner <markdoliner@pidgin.im>
parents:
5949
diff
changeset
|
211 | |
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
212 | /* If this plugin has already been probed then exit */ |
| 15884 | 213 | basename = purple_plugin_get_basename(filename); |
| 214 | plugin = purple_plugins_find_with_basename(basename); | |
|
12342
da61b726d595
[gaim-migrate @ 14646]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12332
diff
changeset
|
215 | g_free(basename); |
| 5205 | 216 | if (plugin != NULL) |
|
12342
da61b726d595
[gaim-migrate @ 14646]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12332
diff
changeset
|
217 | { |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
218 | if (!strcmp(filename, plugin->path)) |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
219 | return plugin; |
| 15884 | 220 | else if (!purple_plugin_is_unloadable(plugin)) |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
221 | { |
| 15884 | 222 | purple_debug_info("plugins", "Not loading %s. " |
|
12342
da61b726d595
[gaim-migrate @ 14646]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12332
diff
changeset
|
223 | "Another plugin with the same name (%s) has already been loaded.\n", |
|
da61b726d595
[gaim-migrate @ 14646]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12332
diff
changeset
|
224 | filename, plugin->path); |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
225 | return plugin; |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
226 | } |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
227 | else |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
228 | { |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
229 | /* The old plugin was a different file and it was unloadable. |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
230 | * There's no guarantee that this new file with the same name |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
231 | * will be loadable, but unless it fails in one of the silent |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
232 | * ways and the first one didn't, it's not any worse. The user |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
233 | * will still see a greyed-out plugin, which is what we want. */ |
| 15884 | 234 | purple_plugin_destroy(plugin); |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
235 | } |
|
12342
da61b726d595
[gaim-migrate @ 14646]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12332
diff
changeset
|
236 | } |
| 5205 | 237 | |
| 15884 | 238 | plugin = purple_plugin_new(has_file_extension(filename, G_MODULE_SUFFIX), filename); |
| 5205 | 239 | |
|
12699
81611fa7a208
[gaim-migrate @ 15042]
Richard Laager <rlaager@pidgin.im>
parents:
12696
diff
changeset
|
240 | if (plugin->native_plugin) { |
|
81611fa7a208
[gaim-migrate @ 15042]
Richard Laager <rlaager@pidgin.im>
parents:
12696
diff
changeset
|
241 | const char *error; |
|
12623
4f1fe7e1f808
[gaim-migrate @ 14959]
Daniel Atallah <datallah@pidgin.im>
parents:
12342
diff
changeset
|
242 | #ifdef _WIN32 |
|
4f1fe7e1f808
[gaim-migrate @ 14959]
Daniel Atallah <datallah@pidgin.im>
parents:
12342
diff
changeset
|
243 | /* Suppress error popups for failing to load plugins */ |
|
4f1fe7e1f808
[gaim-migrate @ 14959]
Daniel Atallah <datallah@pidgin.im>
parents:
12342
diff
changeset
|
244 | UINT old_error_mode = SetErrorMode(SEM_FAILCRITICALERRORS); |
|
4f1fe7e1f808
[gaim-migrate @ 14959]
Daniel Atallah <datallah@pidgin.im>
parents:
12342
diff
changeset
|
245 | #endif |
| 12696 | 246 | |
|
10737
c7759d698996
[gaim-migrate @ 12339]
Mark Doliner <markdoliner@pidgin.im>
parents:
10682
diff
changeset
|
247 | /* |
|
10950
72a6cc0fc7a8
[gaim-migrate @ 12750]
Richard Laager <rlaager@pidgin.im>
parents:
10884
diff
changeset
|
248 | * We pass G_MODULE_BIND_LOCAL here to prevent symbols from |
|
72a6cc0fc7a8
[gaim-migrate @ 12750]
Richard Laager <rlaager@pidgin.im>
parents:
10884
diff
changeset
|
249 | * plugins being added to the global name space. |
|
11378
5857f76fb6b2
[gaim-migrate @ 13604]
Mark Doliner <markdoliner@pidgin.im>
parents:
11256
diff
changeset
|
250 | * |
|
5857f76fb6b2
[gaim-migrate @ 13604]
Mark Doliner <markdoliner@pidgin.im>
parents:
11256
diff
changeset
|
251 | * G_MODULE_BIND_LOCAL was added in glib 2.3.3. |
|
10737
c7759d698996
[gaim-migrate @ 12339]
Mark Doliner <markdoliner@pidgin.im>
parents:
10682
diff
changeset
|
252 | */ |
|
11378
5857f76fb6b2
[gaim-migrate @ 13604]
Mark Doliner <markdoliner@pidgin.im>
parents:
11256
diff
changeset
|
253 | #if GLIB_CHECK_VERSION(2,3,3) |
|
10884
672f44600655
[gaim-migrate @ 12582]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10737
diff
changeset
|
254 | plugin->handle = g_module_open(filename, G_MODULE_BIND_LOCAL); |
|
11378
5857f76fb6b2
[gaim-migrate @ 13604]
Mark Doliner <markdoliner@pidgin.im>
parents:
11256
diff
changeset
|
255 | #else |
|
5857f76fb6b2
[gaim-migrate @ 13604]
Mark Doliner <markdoliner@pidgin.im>
parents:
11256
diff
changeset
|
256 | plugin->handle = g_module_open(filename, 0); |
|
5857f76fb6b2
[gaim-migrate @ 13604]
Mark Doliner <markdoliner@pidgin.im>
parents:
11256
diff
changeset
|
257 | #endif |
| 5205 | 258 | |
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
259 | if (plugin->handle == NULL) |
|
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
260 | { |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
261 | const char *error = g_module_error(); |
| 15884 | 262 | if (error != NULL && purple_str_has_prefix(error, filename)) |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
263 | { |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
264 | error = error + strlen(filename); |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
265 | |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
266 | /* These are just so we don't crash. If we |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
267 | * got this far, they should always be true. */ |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
268 | if (*error == ':') |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
269 | error++; |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
270 | if (*error == ' ') |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
271 | error++; |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
272 | } |
| 5205 | 273 | |
|
12704
f4cbb5550f67
[gaim-migrate @ 15047]
Richard Laager <rlaager@pidgin.im>
parents:
12703
diff
changeset
|
274 | if (error == NULL || !*error) |
|
f4cbb5550f67
[gaim-migrate @ 15047]
Richard Laager <rlaager@pidgin.im>
parents:
12703
diff
changeset
|
275 | { |
|
f4cbb5550f67
[gaim-migrate @ 15047]
Richard Laager <rlaager@pidgin.im>
parents:
12703
diff
changeset
|
276 | plugin->error = g_strdup(_("Unknown error")); |
| 15884 | 277 | purple_debug_error("plugins", "%s is not loadable: Unknown error\n", |
|
12704
f4cbb5550f67
[gaim-migrate @ 15047]
Richard Laager <rlaager@pidgin.im>
parents:
12703
diff
changeset
|
278 | plugin->path); |
|
f4cbb5550f67
[gaim-migrate @ 15047]
Richard Laager <rlaager@pidgin.im>
parents:
12703
diff
changeset
|
279 | } |
|
f4cbb5550f67
[gaim-migrate @ 15047]
Richard Laager <rlaager@pidgin.im>
parents:
12703
diff
changeset
|
280 | else |
|
f4cbb5550f67
[gaim-migrate @ 15047]
Richard Laager <rlaager@pidgin.im>
parents:
12703
diff
changeset
|
281 | { |
|
f4cbb5550f67
[gaim-migrate @ 15047]
Richard Laager <rlaager@pidgin.im>
parents:
12703
diff
changeset
|
282 | plugin->error = g_strdup(error); |
| 15884 | 283 | purple_debug_error("plugins", "%s is not loadable: %s\n", |
|
12704
f4cbb5550f67
[gaim-migrate @ 15047]
Richard Laager <rlaager@pidgin.im>
parents:
12703
diff
changeset
|
284 | plugin->path, plugin->error); |
|
f4cbb5550f67
[gaim-migrate @ 15047]
Richard Laager <rlaager@pidgin.im>
parents:
12703
diff
changeset
|
285 | } |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
286 | #if GLIB_CHECK_VERSION(2,3,3) |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
287 | plugin->handle = g_module_open(filename, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL); |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
288 | #else |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
289 | plugin->handle = g_module_open(filename, G_MODULE_BIND_LAZY); |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
290 | #endif |
|
5269
a318feccd844
[gaim-migrate @ 5641]
Christian Hammond <chipx86@chipx86.com>
parents:
5268
diff
changeset
|
291 | |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
292 | if (plugin->handle == NULL) |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
293 | { |
|
12699
81611fa7a208
[gaim-migrate @ 15042]
Richard Laager <rlaager@pidgin.im>
parents:
12696
diff
changeset
|
294 | #ifdef _WIN32 |
|
81611fa7a208
[gaim-migrate @ 15042]
Richard Laager <rlaager@pidgin.im>
parents:
12696
diff
changeset
|
295 | /* Restore the original error mode */ |
|
81611fa7a208
[gaim-migrate @ 15042]
Richard Laager <rlaager@pidgin.im>
parents:
12696
diff
changeset
|
296 | SetErrorMode(old_error_mode); |
|
81611fa7a208
[gaim-migrate @ 15042]
Richard Laager <rlaager@pidgin.im>
parents:
12696
diff
changeset
|
297 | #endif |
| 15884 | 298 | purple_plugin_destroy(plugin); |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
299 | return NULL; |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
300 | } |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
301 | else |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
302 | { |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
303 | /* We were able to load the plugin with lazy symbol binding. |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
304 | * This means we're missing some symbol. Mark it as |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
305 | * unloadable and keep going so we get the info to display |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
306 | * to the user so they know to rebuild this plugin. */ |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
307 | plugin->unloadable = TRUE; |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
308 | } |
| 5205 | 309 | } |
| 310 | ||
| 15884 | 311 | if (!g_module_symbol(plugin->handle, "purple_init_plugin", |
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
312 | &unpunned)) |
|
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
313 | { |
| 15884 | 314 | purple_debug_error("plugins", "%s is not usable because the " |
| 315 | "'purple_init_plugin' symbol could not be " | |
|
11950
a522c2da66e5
[gaim-migrate @ 14241]
Evan Schoenberg <evands@pidgin.im>
parents:
11772
diff
changeset
|
316 | "found. Does the plugin call the " |
| 15884 | 317 | "PURPLE_INIT_PLUGIN() macro?\n", plugin->path); |
| 5205 | 318 | |
|
11950
a522c2da66e5
[gaim-migrate @ 14241]
Evan Schoenberg <evands@pidgin.im>
parents:
11772
diff
changeset
|
319 | g_module_close(plugin->handle); |
| 5443 | 320 | error = g_module_error(); |
|
11950
a522c2da66e5
[gaim-migrate @ 14241]
Evan Schoenberg <evands@pidgin.im>
parents:
11772
diff
changeset
|
321 | if (error != NULL) |
| 15884 | 322 | purple_debug_error("plugins", "Error closing module %s: %s\n", |
|
11950
a522c2da66e5
[gaim-migrate @ 14241]
Evan Schoenberg <evands@pidgin.im>
parents:
11772
diff
changeset
|
323 | plugin->path, error); |
|
a522c2da66e5
[gaim-migrate @ 14241]
Evan Schoenberg <evands@pidgin.im>
parents:
11772
diff
changeset
|
324 | plugin->handle = NULL; |
| 5205 | 325 | |
|
12699
81611fa7a208
[gaim-migrate @ 15042]
Richard Laager <rlaager@pidgin.im>
parents:
12696
diff
changeset
|
326 | #ifdef _WIN32 |
|
81611fa7a208
[gaim-migrate @ 15042]
Richard Laager <rlaager@pidgin.im>
parents:
12696
diff
changeset
|
327 | /* Restore the original error mode */ |
|
81611fa7a208
[gaim-migrate @ 15042]
Richard Laager <rlaager@pidgin.im>
parents:
12696
diff
changeset
|
328 | SetErrorMode(old_error_mode); |
|
81611fa7a208
[gaim-migrate @ 15042]
Richard Laager <rlaager@pidgin.im>
parents:
12696
diff
changeset
|
329 | #endif |
| 15884 | 330 | purple_plugin_destroy(plugin); |
| 5205 | 331 | return NULL; |
| 332 | } | |
| 15884 | 333 | purple_init_plugin = unpunned; |
|
12699
81611fa7a208
[gaim-migrate @ 15042]
Richard Laager <rlaager@pidgin.im>
parents:
12696
diff
changeset
|
334 | |
|
81611fa7a208
[gaim-migrate @ 15042]
Richard Laager <rlaager@pidgin.im>
parents:
12696
diff
changeset
|
335 | #ifdef _WIN32 |
|
81611fa7a208
[gaim-migrate @ 15042]
Richard Laager <rlaager@pidgin.im>
parents:
12696
diff
changeset
|
336 | /* Restore the original error mode */ |
|
81611fa7a208
[gaim-migrate @ 15042]
Richard Laager <rlaager@pidgin.im>
parents:
12696
diff
changeset
|
337 | SetErrorMode(old_error_mode); |
|
81611fa7a208
[gaim-migrate @ 15042]
Richard Laager <rlaager@pidgin.im>
parents:
12696
diff
changeset
|
338 | #endif |
| 5205 | 339 | } |
| 340 | else { | |
|
5794
ebdbb7dc6658
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5646
diff
changeset
|
341 | loader = find_loader_for_plugin(plugin); |
| 5205 | 342 | |
| 343 | if (loader == NULL) { | |
| 15884 | 344 | purple_plugin_destroy(plugin); |
| 5205 | 345 | return NULL; |
| 346 | } | |
| 347 | ||
| 15884 | 348 | purple_init_plugin = PURPLE_PLUGIN_LOADER_INFO(loader)->probe; |
| 5205 | 349 | } |
| 350 | ||
| 15884 | 351 | if (!purple_init_plugin(plugin) || plugin->info == NULL) |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
352 | { |
| 15884 | 353 | purple_plugin_destroy(plugin); |
| 5205 | 354 | return NULL; |
| 355 | } | |
|
14787
2adb9bac76b5
[gaim-migrate @ 17479]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14254
diff
changeset
|
356 | else if (plugin->info->ui_requirement && |
| 15884 | 357 | strcmp(plugin->info->ui_requirement, purple_core_get_ui())) |
|
14787
2adb9bac76b5
[gaim-migrate @ 17479]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14254
diff
changeset
|
358 | { |
|
14918
db9f9d302973
[gaim-migrate @ 17625]
Mark Doliner <markdoliner@pidgin.im>
parents:
14895
diff
changeset
|
359 | plugin->error = g_strdup_printf(_("You are using %s, but this plugin requires %s."), |
| 15884 | 360 | purple_core_get_ui(), plugin->info->ui_requirement); |
| 361 | purple_debug_error("plugins", "%s is not loadable: The UI requirement is not met.\n", plugin->path); | |
|
14787
2adb9bac76b5
[gaim-migrate @ 17479]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14254
diff
changeset
|
362 | plugin->unloadable = TRUE; |
|
2adb9bac76b5
[gaim-migrate @ 17479]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14254
diff
changeset
|
363 | return plugin; |
|
2adb9bac76b5
[gaim-migrate @ 17479]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14254
diff
changeset
|
364 | } |
| 5205 | 365 | |
|
15962
572de405bf5b
Get rid of an unnecessary strdup
Mark Doliner <markdoliner@pidgin.im>
parents:
15938
diff
changeset
|
366 | /* |
|
572de405bf5b
Get rid of an unnecessary strdup
Mark Doliner <markdoliner@pidgin.im>
parents:
15938
diff
changeset
|
367 | * Check to make sure a plugin has defined an id. |
|
572de405bf5b
Get rid of an unnecessary strdup
Mark Doliner <markdoliner@pidgin.im>
parents:
15938
diff
changeset
|
368 | * Not having this check caused purple_plugin_unload to |
|
572de405bf5b
Get rid of an unnecessary strdup
Mark Doliner <markdoliner@pidgin.im>
parents:
15938
diff
changeset
|
369 | * enter an infinite loop in certain situations by passing |
|
572de405bf5b
Get rid of an unnecessary strdup
Mark Doliner <markdoliner@pidgin.im>
parents:
15938
diff
changeset
|
370 | * purple_find_plugin_by_id a NULL value. -- ecoffey |
|
572de405bf5b
Get rid of an unnecessary strdup
Mark Doliner <markdoliner@pidgin.im>
parents:
15938
diff
changeset
|
371 | */ |
|
15951
079275c87868
A small fix to the patch from ecoffey: Gary pointed out that the strcmp()
Richard Laager <rlaager@pidgin.im>
parents:
15938
diff
changeset
|
372 | if (plugin->info->id == NULL || *plugin->info->id == '\0') |
|
15938
1b037158411e
SF Patch #1686400 from Eoin Coffey ("ecoffey")
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
373 | { |
|
1b037158411e
SF Patch #1686400 from Eoin Coffey ("ecoffey")
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
374 | plugin->error = g_strdup_printf(_("This plugin has not defined an ID.")); |
|
1b037158411e
SF Patch #1686400 from Eoin Coffey ("ecoffey")
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
375 | purple_debug_error("plugins", "%s is not loadable: info->id is not defined.\n", plugin->path); |
|
1b037158411e
SF Patch #1686400 from Eoin Coffey ("ecoffey")
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
376 | plugin->unloadable = TRUE; |
|
1b037158411e
SF Patch #1686400 from Eoin Coffey ("ecoffey")
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
377 | return plugin; |
|
1b037158411e
SF Patch #1686400 from Eoin Coffey ("ecoffey")
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
378 | } |
|
1b037158411e
SF Patch #1686400 from Eoin Coffey ("ecoffey")
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
379 | |
|
12703
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
380 | /* Really old plugins. */ |
| 15884 | 381 | if (plugin->info->magic != PURPLE_PLUGIN_MAGIC) |
|
12703
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
382 | { |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
383 | if (plugin->info->magic >= 2 && plugin->info->magic <= 4) |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
384 | { |
| 15884 | 385 | struct _PurplePluginInfo2 |
|
12703
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
386 | { |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
387 | unsigned int api_version; |
| 15884 | 388 | PurplePluginType type; |
|
12703
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
389 | char *ui_requirement; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
390 | unsigned long flags; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
391 | GList *dependencies; |
| 15884 | 392 | PurplePluginPriority priority; |
|
14895
38793d566e1c
[gaim-migrate @ 17600]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
14894
diff
changeset
|
393 | |
|
12703
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
394 | char *id; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
395 | char *name; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
396 | char *version; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
397 | char *summary; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
398 | char *description; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
399 | char *author; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
400 | char *homepage; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
401 | |
| 15884 | 402 | gboolean (*load)(PurplePlugin *plugin); |
| 403 | gboolean (*unload)(PurplePlugin *plugin); | |
| 404 | void (*destroy)(PurplePlugin *plugin); | |
|
12703
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
405 | |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
406 | void *ui_info; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
407 | void *extra_info; |
| 15884 | 408 | PurplePluginUiInfo *prefs_info; |
| 409 | GList *(*actions)(PurplePlugin *plugin, gpointer context); | |
| 410 | } *info2 = (struct _PurplePluginInfo2 *)plugin->info; | |
|
12703
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
411 | |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
412 | /* This leaks... but only for ancient plugins, so deal with it. */ |
| 15884 | 413 | plugin->info = g_new0(PurplePluginInfo, 1); |
|
12703
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
414 | |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
415 | /* We don't really need all these to display the plugin info, but |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
416 | * I'm copying them all for good measure. */ |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
417 | plugin->info->magic = info2->api_version; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
418 | plugin->info->type = info2->type; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
419 | plugin->info->ui_requirement = info2->ui_requirement; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
420 | plugin->info->flags = info2->flags; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
421 | plugin->info->dependencies = info2->dependencies; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
422 | plugin->info->id = info2->id; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
423 | plugin->info->name = info2->name; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
424 | plugin->info->version = info2->version; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
425 | plugin->info->summary = info2->summary; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
426 | plugin->info->description = info2->description; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
427 | plugin->info->author = info2->author; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
428 | plugin->info->homepage = info2->homepage; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
429 | plugin->info->load = info2->load; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
430 | plugin->info->unload = info2->unload; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
431 | plugin->info->destroy = info2->destroy; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
432 | plugin->info->ui_info = info2->ui_info; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
433 | plugin->info->extra_info = info2->extra_info; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
434 | |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
435 | if (info2->api_version >= 3) |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
436 | plugin->info->prefs_info = info2->prefs_info; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
437 | |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
438 | if (info2->api_version >= 4) |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
439 | plugin->info->actions = info2->actions; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
440 | |
|
12704
f4cbb5550f67
[gaim-migrate @ 15047]
Richard Laager <rlaager@pidgin.im>
parents:
12703
diff
changeset
|
441 | |
|
f4cbb5550f67
[gaim-migrate @ 15047]
Richard Laager <rlaager@pidgin.im>
parents:
12703
diff
changeset
|
442 | plugin->error = g_strdup_printf(_("Plugin magic mismatch %d (need %d)"), |
| 15884 | 443 | plugin->info->magic, PURPLE_PLUGIN_MAGIC); |
| 444 | purple_debug_error("plugins", "%s is not loadable: Plugin magic mismatch %d (need %d)\n", | |
| 445 | plugin->path, plugin->info->magic, PURPLE_PLUGIN_MAGIC); | |
|
12703
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
446 | plugin->unloadable = TRUE; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
447 | return plugin; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
448 | } |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
449 | |
| 15884 | 450 | purple_debug_error("plugins", "%s is not loadable: Plugin magic mismatch %d (need %d)\n", |
| 451 | plugin->path, plugin->info->magic, PURPLE_PLUGIN_MAGIC); | |
| 452 | purple_plugin_destroy(plugin); | |
|
12703
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
453 | return NULL; |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
454 | } |
|
77b2e8d93ab8
[gaim-migrate @ 15046]
Richard Laager <rlaager@pidgin.im>
parents:
12699
diff
changeset
|
455 | |
| 15884 | 456 | if (plugin->info->major_version != PURPLE_MAJOR_VERSION || |
| 457 | plugin->info->minor_version > PURPLE_MINOR_VERSION) | |
|
8749
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
458 | { |
|
12704
f4cbb5550f67
[gaim-migrate @ 15047]
Richard Laager <rlaager@pidgin.im>
parents:
12703
diff
changeset
|
459 | plugin->error = g_strdup_printf(_("ABI version mismatch %d.%d.x (need %d.%d.x)"), |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
460 | plugin->info->major_version, plugin->info->minor_version, |
| 15884 | 461 | PURPLE_MAJOR_VERSION, PURPLE_MINOR_VERSION); |
| 462 | purple_debug_error("plugins", "%s is not loadable: ABI version mismatch %d.%d.x (need %d.%d.x)\n", | |
|
12704
f4cbb5550f67
[gaim-migrate @ 15047]
Richard Laager <rlaager@pidgin.im>
parents:
12703
diff
changeset
|
463 | plugin->path, plugin->info->major_version, plugin->info->minor_version, |
| 15884 | 464 | PURPLE_MAJOR_VERSION, PURPLE_MINOR_VERSION); |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
465 | plugin->unloadable = TRUE; |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
466 | return plugin; |
|
10156
463aca04c29a
[gaim-migrate @ 11236]
Mark Doliner <markdoliner@pidgin.im>
parents:
10145
diff
changeset
|
467 | } |
|
463aca04c29a
[gaim-migrate @ 11236]
Mark Doliner <markdoliner@pidgin.im>
parents:
10145
diff
changeset
|
468 | |
| 15884 | 469 | if (plugin->info->type == PURPLE_PLUGIN_PROTOCOL) |
|
10156
463aca04c29a
[gaim-migrate @ 11236]
Mark Doliner <markdoliner@pidgin.im>
parents:
10145
diff
changeset
|
470 | { |
|
13311
0d7ab73ca418
[gaim-migrate @ 15676]
Richard Laager <rlaager@pidgin.im>
parents:
13251
diff
changeset
|
471 | /* If plugin is a PRPL, make sure it implements the required functions */ |
| 15884 | 472 | if ((PURPLE_PLUGIN_PROTOCOL_INFO(plugin)->list_icon == NULL) || |
| 473 | (PURPLE_PLUGIN_PROTOCOL_INFO(plugin)->login == NULL) || | |
| 474 | (PURPLE_PLUGIN_PROTOCOL_INFO(plugin)->close == NULL)) | |
|
13311
0d7ab73ca418
[gaim-migrate @ 15676]
Richard Laager <rlaager@pidgin.im>
parents:
13251
diff
changeset
|
475 | { |
|
0d7ab73ca418
[gaim-migrate @ 15676]
Richard Laager <rlaager@pidgin.im>
parents:
13251
diff
changeset
|
476 | plugin->error = g_strdup(_("Plugin does not implement all required functions")); |
| 15884 | 477 | purple_debug_error("plugins", "%s is not loadable: Plugin does not implement all required functions\n", |
|
13311
0d7ab73ca418
[gaim-migrate @ 15676]
Richard Laager <rlaager@pidgin.im>
parents:
13251
diff
changeset
|
478 | plugin->path); |
|
0d7ab73ca418
[gaim-migrate @ 15676]
Richard Laager <rlaager@pidgin.im>
parents:
13251
diff
changeset
|
479 | plugin->unloadable = TRUE; |
|
0d7ab73ca418
[gaim-migrate @ 15676]
Richard Laager <rlaager@pidgin.im>
parents:
13251
diff
changeset
|
480 | return plugin; |
|
0d7ab73ca418
[gaim-migrate @ 15676]
Richard Laager <rlaager@pidgin.im>
parents:
13251
diff
changeset
|
481 | } |
|
0d7ab73ca418
[gaim-migrate @ 15676]
Richard Laager <rlaager@pidgin.im>
parents:
13251
diff
changeset
|
482 | |
|
0d7ab73ca418
[gaim-migrate @ 15676]
Richard Laager <rlaager@pidgin.im>
parents:
13251
diff
changeset
|
483 | /* For debugging, let's warn about prpl prefs. */ |
|
0d7ab73ca418
[gaim-migrate @ 15676]
Richard Laager <rlaager@pidgin.im>
parents:
13251
diff
changeset
|
484 | if (plugin->info->prefs_info != NULL) |
|
0d7ab73ca418
[gaim-migrate @ 15676]
Richard Laager <rlaager@pidgin.im>
parents:
13251
diff
changeset
|
485 | { |
| 15884 | 486 | purple_debug_error("plugins", "%s has a prefs_info, but is a prpl. This is no longer supported.\n", |
|
13311
0d7ab73ca418
[gaim-migrate @ 15676]
Richard Laager <rlaager@pidgin.im>
parents:
13251
diff
changeset
|
487 | plugin->path); |
|
0d7ab73ca418
[gaim-migrate @ 15676]
Richard Laager <rlaager@pidgin.im>
parents:
13251
diff
changeset
|
488 | } |
|
8749
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
489 | } |
|
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
490 | |
| 5205 | 491 | return plugin; |
| 492 | #else | |
| 493 | return NULL; | |
| 15884 | 494 | #endif /* !PURPLE_PLUGINS */ |
| 5205 | 495 | } |
| 496 | ||
| 15884 | 497 | #ifdef PURPLE_PLUGINS |
|
12332
9841e312051d
[gaim-migrate @ 14636]
Mark Doliner <markdoliner@pidgin.im>
parents:
12117
diff
changeset
|
498 | static gint |
|
9841e312051d
[gaim-migrate @ 14636]
Mark Doliner <markdoliner@pidgin.im>
parents:
12117
diff
changeset
|
499 | compare_plugins(gconstpointer a, gconstpointer b) |
|
9841e312051d
[gaim-migrate @ 14636]
Mark Doliner <markdoliner@pidgin.im>
parents:
12117
diff
changeset
|
500 | { |
| 15884 | 501 | const PurplePlugin *plugina = a; |
| 502 | const PurplePlugin *pluginb = b; | |
|
12332
9841e312051d
[gaim-migrate @ 14636]
Mark Doliner <markdoliner@pidgin.im>
parents:
12117
diff
changeset
|
503 | |
|
9841e312051d
[gaim-migrate @ 14636]
Mark Doliner <markdoliner@pidgin.im>
parents:
12117
diff
changeset
|
504 | return strcmp(plugina->info->name, pluginb->info->name); |
|
9841e312051d
[gaim-migrate @ 14636]
Mark Doliner <markdoliner@pidgin.im>
parents:
12117
diff
changeset
|
505 | } |
| 15884 | 506 | #endif /* PURPLE_PLUGINS */ |
|
12332
9841e312051d
[gaim-migrate @ 14636]
Mark Doliner <markdoliner@pidgin.im>
parents:
12117
diff
changeset
|
507 | |
| 5205 | 508 | gboolean |
| 15884 | 509 | purple_plugin_load(PurplePlugin *plugin) |
| 5205 | 510 | { |
| 15884 | 511 | #ifdef PURPLE_PLUGINS |
|
6486
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
512 | GList *dep_list = NULL; |
|
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
513 | GList *l; |
|
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
514 | |
| 5205 | 515 | g_return_val_if_fail(plugin != NULL, FALSE); |
| 516 | ||
| 15884 | 517 | if (purple_plugin_is_loaded(plugin)) |
| 5205 | 518 | return TRUE; |
| 519 | ||
| 15884 | 520 | if (purple_plugin_is_unloadable(plugin)) |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
521 | return FALSE; |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
522 | |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
523 | g_return_val_if_fail(plugin->error == NULL, FALSE); |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
524 | |
|
6486
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
525 | /* |
|
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
526 | * Go through the list of the plugin's dependencies. |
|
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
527 | * |
|
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
528 | * First pass: Make sure all the plugins needed are probed. |
|
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
529 | */ |
|
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
530 | for (l = plugin->info->dependencies; l != NULL; l = l->next) |
|
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
531 | { |
|
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
532 | const char *dep_name = (const char *)l->data; |
| 15884 | 533 | PurplePlugin *dep_plugin; |
|
6486
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
534 | |
| 15884 | 535 | dep_plugin = purple_plugins_find_with_id(dep_name); |
|
6486
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
536 | |
|
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
537 | if (dep_plugin == NULL) |
|
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
538 | { |
| 12926 | 539 | char *tmp; |
|
6486
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
540 | |
| 12983 | 541 | tmp = g_strdup_printf(_("The required plugin %s was not found. " |
| 12926 | 542 | "Please install this plugin and try again."), |
| 543 | dep_name); | |
|
6486
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
544 | |
| 15884 | 545 | purple_notify_error(NULL, NULL, |
|
15444
b793ef258d23
I think this changes every user-visible string that contains 'Gaim.' We probably want the UI to be able
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
546 | _("Unable to load the plugin"), tmp); |
| 12926 | 547 | g_free(tmp); |
|
6486
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
548 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14024
diff
changeset
|
549 | g_list_free(dep_list); |
|
6486
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
550 | |
|
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
551 | return FALSE; |
|
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
552 | } |
|
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
553 | |
|
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
554 | dep_list = g_list_append(dep_list, dep_plugin); |
|
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
555 | } |
|
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
556 | |
|
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
557 | /* Second pass: load all the required plugins. */ |
|
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
558 | for (l = dep_list; l != NULL; l = l->next) |
|
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
559 | { |
| 15884 | 560 | PurplePlugin *dep_plugin = (PurplePlugin *)l->data; |
|
6486
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
561 | |
| 15884 | 562 | if (!purple_plugin_is_loaded(dep_plugin)) |
|
6486
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
563 | { |
| 15884 | 564 | if (!purple_plugin_load(dep_plugin)) |
|
6486
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
565 | { |
| 12926 | 566 | char *tmp; |
|
6486
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
567 | |
| 12926 | 568 | tmp = g_strdup_printf(_("The required plugin %s was unable to load."), |
| 569 | plugin->info->name); | |
|
6486
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
570 | |
| 15884 | 571 | purple_notify_error(NULL, NULL, |
|
15444
b793ef258d23
I think this changes every user-visible string that contains 'Gaim.' We probably want the UI to be able
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
572 | _("Unable to load your plugin."), tmp); |
| 12926 | 573 | g_free(tmp); |
|
6486
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
574 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14024
diff
changeset
|
575 | g_list_free(dep_list); |
|
6486
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
576 | |
|
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
577 | return FALSE; |
|
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
578 | } |
|
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
579 | } |
|
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
580 | } |
|
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
581 | |
| 12926 | 582 | /* Third pass: note that other plugins are dependencies of this plugin. |
| 583 | * This is done separately in case we had to bail out earlier. */ | |
| 584 | for (l = dep_list; l != NULL; l = l->next) | |
| 585 | { | |
| 15884 | 586 | PurplePlugin *dep_plugin = (PurplePlugin *)l->data; |
| 12926 | 587 | dep_plugin->dependent_plugins = g_list_prepend(dep_plugin->dependent_plugins, plugin->info->id); |
| 588 | } | |
| 589 | ||
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14024
diff
changeset
|
590 | g_list_free(dep_list); |
|
6486
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
591 | |
|
6981
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
592 | if (plugin->native_plugin) |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
593 | { |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
594 | if (plugin->info != NULL && plugin->info->load != NULL) |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
595 | { |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
596 | if (!plugin->info->load(plugin)) |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
597 | return FALSE; |
|
5357
1fa9e57df50c
[gaim-migrate @ 5733]
Christian Hammond <chipx86@chipx86.com>
parents:
5270
diff
changeset
|
598 | } |
| 5205 | 599 | } |
| 600 | else { | |
| 15884 | 601 | PurplePlugin *loader; |
| 602 | PurplePluginLoaderInfo *loader_info; | |
| 5205 | 603 | |
|
5794
ebdbb7dc6658
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5646
diff
changeset
|
604 | loader = find_loader_for_plugin(plugin); |
| 5205 | 605 | |
| 606 | if (loader == NULL) | |
| 607 | return FALSE; | |
| 608 | ||
| 15884 | 609 | loader_info = PURPLE_PLUGIN_LOADER_INFO(loader); |
| 5205 | 610 | |
| 611 | if (loader_info->load != NULL) | |
|
6981
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
612 | { |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
613 | if (!loader_info->load(plugin)) |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
614 | return FALSE; |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
615 | } |
| 5205 | 616 | } |
| 617 | ||
|
12332
9841e312051d
[gaim-migrate @ 14636]
Mark Doliner <markdoliner@pidgin.im>
parents:
12117
diff
changeset
|
618 | loaded_plugins = g_list_insert_sorted(loaded_plugins, plugin, compare_plugins); |
| 5205 | 619 | |
| 620 | plugin->loaded = TRUE; | |
| 621 | ||
| 622 | if (load_cb != NULL) | |
| 623 | load_cb(plugin, load_cb_data); | |
| 624 | ||
| 15884 | 625 | purple_signal_emit(purple_plugins_get_handle(), "plugin-load", plugin); |
|
8986
30ba617356bb
[gaim-migrate @ 9761]
Christopher O'Brien <siege@pidgin.im>
parents:
8759
diff
changeset
|
626 | |
| 5205 | 627 | return TRUE; |
| 628 | ||
| 629 | #else | |
|
5449
4c350eb7d4a0
[gaim-migrate @ 5836]
Decklin Foster <decklin@red-bean.com>
parents:
5443
diff
changeset
|
630 | return TRUE; |
| 15884 | 631 | #endif /* !PURPLE_PLUGINS */ |
| 5205 | 632 | } |
| 633 | ||
| 634 | gboolean | |
| 15884 | 635 | purple_plugin_unload(PurplePlugin *plugin) |
| 5205 | 636 | { |
| 15884 | 637 | #ifdef PURPLE_PLUGINS |
|
12992
4bb06c9c1fb3
[gaim-migrate @ 15345]
Richard Laager <rlaager@pidgin.im>
parents:
12985
diff
changeset
|
638 | GList *l; |
|
20805
bd18a055f953
Honor the return value of a plugin's unload function.
Richard Laager <rlaager@pidgin.im>
parents:
20777
diff
changeset
|
639 | GList *ll; |
| 12985 | 640 | |
| 5205 | 641 | g_return_val_if_fail(plugin != NULL, FALSE); |
| 15884 | 642 | g_return_val_if_fail(purple_plugin_is_loaded(plugin), FALSE); |
| 5205 | 643 | |
| 15884 | 644 | purple_debug_info("plugins", "Unloading plugin %s\n", plugin->info->name); |
| 5205 | 645 | |
| 12926 | 646 | /* Unload all plugins that depend on this plugin. */ |
|
20863
1fb9e7564f5d
Fix a syntax error so this compiles.
Richard Laager <rlaager@pidgin.im>
parents:
20806
diff
changeset
|
647 | for (l = plugin->dependent_plugins; l != NULL; l = ll) { |
| 12926 | 648 | const char * dep_name = (const char *)l->data; |
| 15884 | 649 | PurplePlugin *dep_plugin; |
| 12926 | 650 | |
|
20805
bd18a055f953
Honor the return value of a plugin's unload function.
Richard Laager <rlaager@pidgin.im>
parents:
20777
diff
changeset
|
651 | /* Store a pointer to the next element in the list. |
|
bd18a055f953
Honor the return value of a plugin's unload function.
Richard Laager <rlaager@pidgin.im>
parents:
20777
diff
changeset
|
652 | * This is because we'll be modifying this list in the loop. */ |
|
bd18a055f953
Honor the return value of a plugin's unload function.
Richard Laager <rlaager@pidgin.im>
parents:
20777
diff
changeset
|
653 | ll = l->next; |
|
bd18a055f953
Honor the return value of a plugin's unload function.
Richard Laager <rlaager@pidgin.im>
parents:
20777
diff
changeset
|
654 | |
| 15884 | 655 | dep_plugin = purple_plugins_find_with_id(dep_name); |
| 12926 | 656 | |
| 15884 | 657 | if (dep_plugin != NULL && purple_plugin_is_loaded(dep_plugin)) |
| 12926 | 658 | { |
| 15884 | 659 | if (!purple_plugin_unload(dep_plugin)) |
| 12926 | 660 | { |
| 661 | char *tmp; | |
| 662 | ||
| 663 | tmp = g_strdup_printf(_("The dependent plugin %s failed to unload."), | |
|
15962
572de405bf5b
Get rid of an unnecessary strdup
Mark Doliner <markdoliner@pidgin.im>
parents:
15938
diff
changeset
|
664 | _(dep_plugin->info->name)); |
| 12926 | 665 | |
| 15884 | 666 | purple_notify_error(NULL, NULL, |
|
20805
bd18a055f953
Honor the return value of a plugin's unload function.
Richard Laager <rlaager@pidgin.im>
parents:
20777
diff
changeset
|
667 | _("There were errors unloading the plugin."), tmp); |
| 12926 | 668 | g_free(tmp); |
|
20805
bd18a055f953
Honor the return value of a plugin's unload function.
Richard Laager <rlaager@pidgin.im>
parents:
20777
diff
changeset
|
669 | |
|
bd18a055f953
Honor the return value of a plugin's unload function.
Richard Laager <rlaager@pidgin.im>
parents:
20777
diff
changeset
|
670 | return FALSE; |
|
bd18a055f953
Honor the return value of a plugin's unload function.
Richard Laager <rlaager@pidgin.im>
parents:
20777
diff
changeset
|
671 | } |
|
bd18a055f953
Honor the return value of a plugin's unload function.
Richard Laager <rlaager@pidgin.im>
parents:
20777
diff
changeset
|
672 | else |
|
bd18a055f953
Honor the return value of a plugin's unload function.
Richard Laager <rlaager@pidgin.im>
parents:
20777
diff
changeset
|
673 | { |
|
bd18a055f953
Honor the return value of a plugin's unload function.
Richard Laager <rlaager@pidgin.im>
parents:
20777
diff
changeset
|
674 | plugin->dependent_plugins = g_list_remove(plugin->dependent_plugins, dep_name); |
| 12926 | 675 | } |
| 676 | } | |
| 677 | } | |
| 678 | ||
| 5205 | 679 | if (plugin->native_plugin) { |
| 680 | if (plugin->info->unload != NULL) | |
|
20805
bd18a055f953
Honor the return value of a plugin's unload function.
Richard Laager <rlaager@pidgin.im>
parents:
20777
diff
changeset
|
681 | if (!plugin->info->unload(plugin)) |
|
bd18a055f953
Honor the return value of a plugin's unload function.
Richard Laager <rlaager@pidgin.im>
parents:
20777
diff
changeset
|
682 | return FALSE; |
| 5205 | 683 | |
| 15884 | 684 | if (plugin->info->type == PURPLE_PLUGIN_PROTOCOL) { |
| 685 | PurplePluginProtocolInfo *prpl_info; | |
| 5205 | 686 | GList *l; |
| 687 | ||
| 15884 | 688 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); |
| 5205 | 689 | |
|
5638
53e752c88ea1
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
690 | for (l = prpl_info->user_splits; l != NULL; l = l->next) |
| 15884 | 691 | purple_account_user_split_destroy(l->data); |
| 5205 | 692 | |
|
5638
53e752c88ea1
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
693 | for (l = prpl_info->protocol_options; l != NULL; l = l->next) |
| 15884 | 694 | purple_account_option_destroy(l->data); |
| 5205 | 695 | |
| 12117 | 696 | if (prpl_info->user_splits != NULL) { |
|
5646
0aa637549d87
[gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
697 | g_list_free(prpl_info->user_splits); |
| 12117 | 698 | prpl_info->user_splits = NULL; |
| 699 | } | |
|
5646
0aa637549d87
[gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
700 | |
| 12117 | 701 | if (prpl_info->protocol_options != NULL) { |
|
5646
0aa637549d87
[gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
702 | g_list_free(prpl_info->protocol_options); |
| 12117 | 703 | prpl_info->protocol_options = NULL; |
| 704 | } | |
| 5205 | 705 | } |
|
20805
bd18a055f953
Honor the return value of a plugin's unload function.
Richard Laager <rlaager@pidgin.im>
parents:
20777
diff
changeset
|
706 | } else { |
| 15884 | 707 | PurplePlugin *loader; |
| 708 | PurplePluginLoaderInfo *loader_info; | |
| 5205 | 709 | |
|
5794
ebdbb7dc6658
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5646
diff
changeset
|
710 | loader = find_loader_for_plugin(plugin); |
| 5205 | 711 | |
| 712 | if (loader == NULL) | |
| 713 | return FALSE; | |
| 714 | ||
| 15884 | 715 | loader_info = PURPLE_PLUGIN_LOADER_INFO(loader); |
| 5205 | 716 | |
|
9697
9f014c2d2538
[gaim-migrate @ 10556]
Christian Hammond <chipx86@chipx86.com>
parents:
9667
diff
changeset
|
717 | if (loader_info->unload != NULL) |
|
20805
bd18a055f953
Honor the return value of a plugin's unload function.
Richard Laager <rlaager@pidgin.im>
parents:
20777
diff
changeset
|
718 | if (!loader_info->unload(plugin)) |
|
bd18a055f953
Honor the return value of a plugin's unload function.
Richard Laager <rlaager@pidgin.im>
parents:
20777
diff
changeset
|
719 | return FALSE; |
| 5205 | 720 | } |
| 721 | ||
|
20805
bd18a055f953
Honor the return value of a plugin's unload function.
Richard Laager <rlaager@pidgin.im>
parents:
20777
diff
changeset
|
722 | /* cancel any pending dialogs the plugin has */ |
|
bd18a055f953
Honor the return value of a plugin's unload function.
Richard Laager <rlaager@pidgin.im>
parents:
20777
diff
changeset
|
723 | purple_request_close_with_handle(plugin); |
|
bd18a055f953
Honor the return value of a plugin's unload function.
Richard Laager <rlaager@pidgin.im>
parents:
20777
diff
changeset
|
724 | purple_notify_close_with_handle(plugin); |
|
bd18a055f953
Honor the return value of a plugin's unload function.
Richard Laager <rlaager@pidgin.im>
parents:
20777
diff
changeset
|
725 | |
| 15884 | 726 | purple_signals_disconnect_by_handle(plugin); |
| 727 | purple_plugin_ipc_unregister_all(plugin); | |
| 5205 | 728 | |
|
20805
bd18a055f953
Honor the return value of a plugin's unload function.
Richard Laager <rlaager@pidgin.im>
parents:
20777
diff
changeset
|
729 | loaded_plugins = g_list_remove(loaded_plugins, plugin); |
|
bd18a055f953
Honor the return value of a plugin's unload function.
Richard Laager <rlaager@pidgin.im>
parents:
20777
diff
changeset
|
730 | if ((plugin->info != NULL) && PURPLE_IS_PROTOCOL_PLUGIN(plugin)) |
|
bd18a055f953
Honor the return value of a plugin's unload function.
Richard Laager <rlaager@pidgin.im>
parents:
20777
diff
changeset
|
731 | protocol_plugins = g_list_remove(protocol_plugins, plugin); |
|
bd18a055f953
Honor the return value of a plugin's unload function.
Richard Laager <rlaager@pidgin.im>
parents:
20777
diff
changeset
|
732 | plugin->loaded = FALSE; |
|
bd18a055f953
Honor the return value of a plugin's unload function.
Richard Laager <rlaager@pidgin.im>
parents:
20777
diff
changeset
|
733 | |
| 5205 | 734 | if (unload_cb != NULL) |
| 735 | unload_cb(plugin, unload_cb_data); | |
| 736 | ||
| 15884 | 737 | purple_signal_emit(purple_plugins_get_handle(), "plugin-unload", plugin); |
|
8986
30ba617356bb
[gaim-migrate @ 9761]
Christopher O'Brien <siege@pidgin.im>
parents:
8759
diff
changeset
|
738 | |
| 15884 | 739 | purple_prefs_disconnect_by_handle(plugin); |
|
10087
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9943
diff
changeset
|
740 | |
| 5205 | 741 | return TRUE; |
|
5449
4c350eb7d4a0
[gaim-migrate @ 5836]
Decklin Foster <decklin@red-bean.com>
parents:
5443
diff
changeset
|
742 | #else |
|
4c350eb7d4a0
[gaim-migrate @ 5836]
Decklin Foster <decklin@red-bean.com>
parents:
5443
diff
changeset
|
743 | return TRUE; |
| 15884 | 744 | #endif /* PURPLE_PLUGINS */ |
| 5205 | 745 | } |
| 746 | ||
| 747 | gboolean | |
| 15884 | 748 | purple_plugin_reload(PurplePlugin *plugin) |
| 5205 | 749 | { |
| 15884 | 750 | #ifdef PURPLE_PLUGINS |
| 5205 | 751 | g_return_val_if_fail(plugin != NULL, FALSE); |
| 15884 | 752 | g_return_val_if_fail(purple_plugin_is_loaded(plugin), FALSE); |
| 5205 | 753 | |
| 15884 | 754 | if (!purple_plugin_unload(plugin)) |
| 5205 | 755 | return FALSE; |
| 756 | ||
| 15884 | 757 | if (!purple_plugin_load(plugin)) |
| 5205 | 758 | return FALSE; |
| 759 | ||
| 760 | return TRUE; | |
| 761 | #else | |
|
5449
4c350eb7d4a0
[gaim-migrate @ 5836]
Decklin Foster <decklin@red-bean.com>
parents:
5443
diff
changeset
|
762 | return TRUE; |
| 15884 | 763 | #endif /* !PURPLE_PLUGINS */ |
| 5205 | 764 | } |
| 765 | ||
| 766 | void | |
| 15884 | 767 | purple_plugin_destroy(PurplePlugin *plugin) |
| 5205 | 768 | { |
| 15884 | 769 | #ifdef PURPLE_PLUGINS |
| 5205 | 770 | g_return_if_fail(plugin != NULL); |
| 771 | ||
| 15884 | 772 | if (purple_plugin_is_loaded(plugin)) |
| 773 | purple_plugin_unload(plugin); | |
| 5205 | 774 | |
| 775 | plugins = g_list_remove(plugins, plugin); | |
| 776 | ||
|
6981
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
777 | if (load_queue != NULL) |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
778 | load_queue = g_list_remove(load_queue, plugin); |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
779 | |
| 9943 | 780 | /* true, this may leak a little memory if there is a major version |
| 781 | * mismatch, but it's a lot better than trying to free something | |
| 782 | * we shouldn't, and crashing while trying to load an old plugin */ | |
| 15884 | 783 | if(plugin->info == NULL || plugin->info->magic != PURPLE_PLUGIN_MAGIC || |
| 784 | plugin->info->major_version != PURPLE_MAJOR_VERSION) | |
|
14024
60730ce4455c
[gaim-migrate @ 16515]
Mark Doliner <markdoliner@pidgin.im>
parents:
14016
diff
changeset
|
785 | { |
| 9943 | 786 | if(plugin->handle) |
| 787 | g_module_close(plugin->handle); | |
|
13136
0438506e90ac
[gaim-migrate @ 15497]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13107
diff
changeset
|
788 | |
|
14024
60730ce4455c
[gaim-migrate @ 16515]
Mark Doliner <markdoliner@pidgin.im>
parents:
14016
diff
changeset
|
789 | g_free(plugin->path); |
|
60730ce4455c
[gaim-migrate @ 16515]
Mark Doliner <markdoliner@pidgin.im>
parents:
14016
diff
changeset
|
790 | g_free(plugin->error); |
|
60730ce4455c
[gaim-migrate @ 16515]
Mark Doliner <markdoliner@pidgin.im>
parents:
14016
diff
changeset
|
791 | |
| 15884 | 792 | PURPLE_DBUS_UNREGISTER_POINTER(plugin); |
|
14024
60730ce4455c
[gaim-migrate @ 16515]
Mark Doliner <markdoliner@pidgin.im>
parents:
14016
diff
changeset
|
793 | |
| 9943 | 794 | g_free(plugin); |
| 795 | return; | |
| 796 | } | |
| 797 | ||
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14024
diff
changeset
|
798 | if (plugin->info != NULL) |
|
5243
e8d35a430c6d
[gaim-migrate @ 5614]
Christian Hammond <chipx86@chipx86.com>
parents:
5242
diff
changeset
|
799 | g_list_free(plugin->info->dependencies); |
| 5205 | 800 | |
|
8749
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
801 | if (plugin->native_plugin) |
|
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
802 | { |
| 15884 | 803 | if (plugin->info != NULL && plugin->info->type == PURPLE_PLUGIN_LOADER) |
|
8749
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
804 | { |
| 15884 | 805 | PurplePluginLoaderInfo *loader_info; |
| 5205 | 806 | GList *exts, *l, *next_l; |
| 15884 | 807 | PurplePlugin *p2; |
| 5205 | 808 | |
| 15884 | 809 | loader_info = PURPLE_PLUGIN_LOADER_INFO(plugin); |
| 5205 | 810 | |
| 9943 | 811 | if (loader_info != NULL && loader_info->exts != NULL) |
|
8749
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
812 | { |
| 15884 | 813 | for (exts = PURPLE_PLUGIN_LOADER_INFO(plugin)->exts; |
|
8749
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
814 | exts != NULL; |
|
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
815 | exts = exts->next) { |
|
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
816 | |
| 15884 | 817 | for (l = purple_plugins_get_all(); l != NULL; l = next_l) |
|
8749
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
818 | { |
|
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
819 | next_l = l->next; |
| 5205 | 820 | |
|
8749
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
821 | p2 = l->data; |
| 5205 | 822 | |
|
8749
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
823 | if (p2->path != NULL && |
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
824 | has_file_extension(p2->path, exts->data)) |
|
8749
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
825 | { |
| 15884 | 826 | purple_plugin_destroy(p2); |
|
8749
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
827 | } |
|
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
828 | } |
| 5205 | 829 | } |
|
8749
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
830 | |
|
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
831 | g_list_free(loader_info->exts); |
| 5205 | 832 | } |
| 833 | ||
| 834 | plugin_loaders = g_list_remove(plugin_loaders, plugin); | |
| 835 | } | |
| 836 | ||
| 837 | if (plugin->info != NULL && plugin->info->destroy != NULL) | |
| 838 | plugin->info->destroy(plugin); | |
| 839 | ||
| 840 | if (plugin->handle != NULL) | |
| 841 | g_module_close(plugin->handle); | |
| 842 | } | |
|
8749
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
843 | else |
|
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
844 | { |
| 15884 | 845 | PurplePlugin *loader; |
| 846 | PurplePluginLoaderInfo *loader_info; | |
| 5205 | 847 | |
|
5794
ebdbb7dc6658
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5646
diff
changeset
|
848 | loader = find_loader_for_plugin(plugin); |
| 5205 | 849 | |
|
8749
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
850 | if (loader != NULL) |
|
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
851 | { |
| 15884 | 852 | loader_info = PURPLE_PLUGIN_LOADER_INFO(loader); |
| 5205 | 853 | |
|
5941
46e136a842b8
[gaim-migrate @ 6381]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
854 | if (loader_info->destroy != NULL) |
|
46e136a842b8
[gaim-migrate @ 6381]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
855 | loader_info->destroy(plugin); |
|
46e136a842b8
[gaim-migrate @ 6381]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
856 | } |
| 5205 | 857 | } |
| 858 | ||
|
14016
2d2e0f347601
[gaim-migrate @ 16502]
Mark Doliner <markdoliner@pidgin.im>
parents:
13670
diff
changeset
|
859 | g_free(plugin->path); |
|
2d2e0f347601
[gaim-migrate @ 16502]
Mark Doliner <markdoliner@pidgin.im>
parents:
13670
diff
changeset
|
860 | g_free(plugin->error); |
| 5205 | 861 | |
| 15884 | 862 | PURPLE_DBUS_UNREGISTER_POINTER(plugin); |
|
13136
0438506e90ac
[gaim-migrate @ 15497]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13107
diff
changeset
|
863 | |
| 5205 | 864 | g_free(plugin); |
| 15884 | 865 | #endif /* !PURPLE_PLUGINS */ |
| 5205 | 866 | } |
| 867 | ||
| 868 | gboolean | |
| 15884 | 869 | purple_plugin_is_loaded(const PurplePlugin *plugin) |
| 5205 | 870 | { |
| 871 | g_return_val_if_fail(plugin != NULL, FALSE); | |
| 872 | ||
| 873 | return plugin->loaded; | |
| 874 | } | |
| 875 | ||
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
876 | gboolean |
| 15884 | 877 | purple_plugin_is_unloadable(const PurplePlugin *plugin) |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
878 | { |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
879 | g_return_val_if_fail(plugin != NULL, FALSE); |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
880 | |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
881 | return plugin->unloadable; |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
882 | } |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12623
diff
changeset
|
883 | |
|
11772
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
884 | const gchar * |
| 15884 | 885 | purple_plugin_get_id(const PurplePlugin *plugin) { |
|
11772
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
886 | g_return_val_if_fail(plugin, NULL); |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
887 | g_return_val_if_fail(plugin->info, NULL); |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
888 | |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
889 | return plugin->info->id; |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
890 | } |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
891 | |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
892 | const gchar * |
| 15884 | 893 | purple_plugin_get_name(const PurplePlugin *plugin) { |
|
11772
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
894 | g_return_val_if_fail(plugin, NULL); |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
895 | g_return_val_if_fail(plugin->info, NULL); |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
896 | |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
897 | return plugin->info->name; |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
898 | } |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
899 | |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
900 | const gchar * |
| 15884 | 901 | purple_plugin_get_version(const PurplePlugin *plugin) { |
|
11772
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
902 | g_return_val_if_fail(plugin, NULL); |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
903 | g_return_val_if_fail(plugin->info, NULL); |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
904 | |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
905 | return plugin->info->version; |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
906 | } |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
907 | |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
908 | const gchar * |
| 15884 | 909 | purple_plugin_get_summary(const PurplePlugin *plugin) { |
|
11772
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
910 | g_return_val_if_fail(plugin, NULL); |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
911 | g_return_val_if_fail(plugin->info, NULL); |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
912 | |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
913 | return plugin->info->summary; |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
914 | } |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
915 | |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
916 | const gchar * |
| 15884 | 917 | purple_plugin_get_description(const PurplePlugin *plugin) { |
|
11772
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
918 | g_return_val_if_fail(plugin, NULL); |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
919 | g_return_val_if_fail(plugin->info, NULL); |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
920 | |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
921 | return plugin->info->description; |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
922 | } |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
923 | |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
924 | const gchar * |
| 15884 | 925 | purple_plugin_get_author(const PurplePlugin *plugin) { |
|
11772
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
926 | g_return_val_if_fail(plugin, NULL); |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
927 | g_return_val_if_fail(plugin->info, NULL); |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
928 | |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
929 | return plugin->info->author; |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
930 | } |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
931 | |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
932 | const gchar * |
| 15884 | 933 | purple_plugin_get_homepage(const PurplePlugin *plugin) { |
|
11772
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
934 | g_return_val_if_fail(plugin, NULL); |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
935 | g_return_val_if_fail(plugin->info, NULL); |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
936 | |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
937 | return plugin->info->homepage; |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
938 | } |
|
0124b31e896a
[gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents:
11378
diff
changeset
|
939 | |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
940 | /************************************************************************** |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
941 | * Plugin IPC |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
942 | **************************************************************************/ |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
943 | static void |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
944 | destroy_ipc_info(void *data) |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
945 | { |
| 15884 | 946 | PurplePluginIpcCommand *ipc_command = (PurplePluginIpcCommand *)data; |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
947 | int i; |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
948 | |
|
9667
f66efc2631b3
[gaim-migrate @ 10519]
Christian Hammond <chipx86@chipx86.com>
parents:
9018
diff
changeset
|
949 | if (ipc_command->params != NULL) |
|
f66efc2631b3
[gaim-migrate @ 10519]
Christian Hammond <chipx86@chipx86.com>
parents:
9018
diff
changeset
|
950 | { |
|
f66efc2631b3
[gaim-migrate @ 10519]
Christian Hammond <chipx86@chipx86.com>
parents:
9018
diff
changeset
|
951 | for (i = 0; i < ipc_command->num_params; i++) |
| 15884 | 952 | purple_value_destroy(ipc_command->params[i]); |
|
9667
f66efc2631b3
[gaim-migrate @ 10519]
Christian Hammond <chipx86@chipx86.com>
parents:
9018
diff
changeset
|
953 | |
|
f66efc2631b3
[gaim-migrate @ 10519]
Christian Hammond <chipx86@chipx86.com>
parents:
9018
diff
changeset
|
954 | g_free(ipc_command->params); |
|
f66efc2631b3
[gaim-migrate @ 10519]
Christian Hammond <chipx86@chipx86.com>
parents:
9018
diff
changeset
|
955 | } |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
956 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
957 | if (ipc_command->ret_value != NULL) |
| 15884 | 958 | purple_value_destroy(ipc_command->ret_value); |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
959 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
960 | g_free(ipc_command); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
961 | } |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
962 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
963 | gboolean |
| 15884 | 964 | purple_plugin_ipc_register(PurplePlugin *plugin, const char *command, |
| 965 | PurpleCallback func, PurpleSignalMarshalFunc marshal, | |
| 966 | PurpleValue *ret_value, int num_params, ...) | |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
967 | { |
| 15884 | 968 | PurplePluginIpcInfo *ipc_info; |
| 969 | PurplePluginIpcCommand *ipc_command; | |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
970 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
971 | g_return_val_if_fail(plugin != NULL, FALSE); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
972 | g_return_val_if_fail(command != NULL, FALSE); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
973 | g_return_val_if_fail(func != NULL, FALSE); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
974 | g_return_val_if_fail(marshal != NULL, FALSE); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
975 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
976 | if (plugin->ipc_data == NULL) |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
977 | { |
| 15884 | 978 | ipc_info = plugin->ipc_data = g_new0(PurplePluginIpcInfo, 1); |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
979 | ipc_info->commands = g_hash_table_new_full(g_str_hash, g_str_equal, |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
980 | g_free, destroy_ipc_info); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
981 | } |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
982 | else |
| 15884 | 983 | ipc_info = (PurplePluginIpcInfo *)plugin->ipc_data; |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
984 | |
| 15884 | 985 | ipc_command = g_new0(PurplePluginIpcCommand, 1); |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
986 | ipc_command->func = func; |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
987 | ipc_command->marshal = marshal; |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
988 | ipc_command->num_params = num_params; |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
989 | ipc_command->ret_value = ret_value; |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
990 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
991 | if (num_params > 0) |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
992 | { |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
993 | va_list args; |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
994 | int i; |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
995 | |
| 15884 | 996 | ipc_command->params = g_new0(PurpleValue *, num_params); |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
997 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
998 | va_start(args, num_params); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
999 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1000 | for (i = 0; i < num_params; i++) |
| 15884 | 1001 | ipc_command->params[i] = va_arg(args, PurpleValue *); |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1002 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1003 | va_end(args); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1004 | } |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1005 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1006 | g_hash_table_replace(ipc_info->commands, g_strdup(command), ipc_command); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1007 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1008 | ipc_info->command_count++; |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1009 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1010 | return TRUE; |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1011 | } |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1012 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1013 | void |
| 15884 | 1014 | purple_plugin_ipc_unregister(PurplePlugin *plugin, const char *command) |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1015 | { |
| 15884 | 1016 | PurplePluginIpcInfo *ipc_info; |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1017 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1018 | g_return_if_fail(plugin != NULL); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1019 | g_return_if_fail(command != NULL); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1020 | |
| 15884 | 1021 | ipc_info = (PurplePluginIpcInfo *)plugin->ipc_data; |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1022 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1023 | if (ipc_info == NULL || |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1024 | g_hash_table_lookup(ipc_info->commands, command) == NULL) |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1025 | { |
| 15884 | 1026 | purple_debug_error("plugins", |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1027 | "IPC command '%s' was not registered for plugin %s\n", |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1028 | command, plugin->info->name); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1029 | return; |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1030 | } |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1031 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1032 | g_hash_table_remove(ipc_info->commands, command); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1033 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1034 | ipc_info->command_count--; |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1035 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1036 | if (ipc_info->command_count == 0) |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1037 | { |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1038 | g_hash_table_destroy(ipc_info->commands); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1039 | g_free(ipc_info); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1040 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1041 | plugin->ipc_data = NULL; |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1042 | } |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1043 | } |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1044 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1045 | void |
| 15884 | 1046 | purple_plugin_ipc_unregister_all(PurplePlugin *plugin) |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1047 | { |
| 15884 | 1048 | PurplePluginIpcInfo *ipc_info; |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1049 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1050 | g_return_if_fail(plugin != NULL); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1051 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1052 | if (plugin->ipc_data == NULL) |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1053 | return; /* Silently ignore it. */ |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1054 | |
| 15884 | 1055 | ipc_info = (PurplePluginIpcInfo *)plugin->ipc_data; |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1056 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1057 | g_hash_table_destroy(ipc_info->commands); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1058 | g_free(ipc_info); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1059 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1060 | plugin->ipc_data = NULL; |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1061 | } |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1062 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1063 | gboolean |
| 15884 | 1064 | purple_plugin_ipc_get_params(PurplePlugin *plugin, const char *command, |
| 1065 | PurpleValue **ret_value, int *num_params, | |
| 1066 | PurpleValue ***params) | |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1067 | { |
| 15884 | 1068 | PurplePluginIpcInfo *ipc_info; |
| 1069 | PurplePluginIpcCommand *ipc_command; | |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1070 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1071 | g_return_val_if_fail(plugin != NULL, FALSE); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1072 | g_return_val_if_fail(command != NULL, FALSE); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1073 | |
| 15884 | 1074 | ipc_info = (PurplePluginIpcInfo *)plugin->ipc_data; |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1075 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1076 | if (ipc_info == NULL || |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1077 | (ipc_command = g_hash_table_lookup(ipc_info->commands, |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1078 | command)) == NULL) |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1079 | { |
| 15884 | 1080 | purple_debug_error("plugins", |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1081 | "IPC command '%s' was not registered for plugin %s\n", |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1082 | command, plugin->info->name); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1083 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1084 | return FALSE; |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1085 | } |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1086 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1087 | if (num_params != NULL) |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1088 | *num_params = ipc_command->num_params; |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1089 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1090 | if (params != NULL) |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1091 | *params = ipc_command->params; |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1092 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1093 | if (ret_value != NULL) |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1094 | *ret_value = ipc_command->ret_value; |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1095 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1096 | return TRUE; |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1097 | } |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1098 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1099 | void * |
| 15884 | 1100 | purple_plugin_ipc_call(PurplePlugin *plugin, const char *command, |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1101 | gboolean *ok, ...) |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1102 | { |
| 15884 | 1103 | PurplePluginIpcInfo *ipc_info; |
| 1104 | PurplePluginIpcCommand *ipc_command; | |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1105 | va_list args; |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1106 | void *ret_value; |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1107 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1108 | if (ok != NULL) |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1109 | *ok = FALSE; |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1110 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1111 | g_return_val_if_fail(plugin != NULL, NULL); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1112 | g_return_val_if_fail(command != NULL, NULL); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1113 | |
| 15884 | 1114 | ipc_info = (PurplePluginIpcInfo *)plugin->ipc_data; |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1115 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1116 | if (ipc_info == NULL || |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1117 | (ipc_command = g_hash_table_lookup(ipc_info->commands, |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1118 | command)) == NULL) |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1119 | { |
| 15884 | 1120 | purple_debug_error("plugins", |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1121 | "IPC command '%s' was not registered for plugin %s\n", |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1122 | command, plugin->info->name); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1123 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1124 | return NULL; |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1125 | } |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1126 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1127 | va_start(args, ok); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1128 | ipc_command->marshal(ipc_command->func, args, NULL, &ret_value); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1129 | va_end(args); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1130 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1131 | if (ok != NULL) |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1132 | *ok = TRUE; |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1133 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1134 | return ret_value; |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1135 | } |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1136 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1137 | /************************************************************************** |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1138 | * Plugins subsystem |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6639
diff
changeset
|
1139 | **************************************************************************/ |
| 10479 | 1140 | void * |
| 15884 | 1141 | purple_plugins_get_handle(void) { |
| 10479 | 1142 | static int handle; |
| 1143 | ||
| 1144 | return &handle; | |
| 1145 | } | |
| 1146 | ||
| 1147 | void | |
| 15884 | 1148 | purple_plugins_init(void) { |
| 1149 | void *handle = purple_plugins_get_handle(); | |
| 10479 | 1150 | |
| 15884 | 1151 | purple_plugins_add_search_path(LIBDIR); |
|
15523
8505bd287c48
This renames the binary to 'pidgin', and I think it properly
Sean Egan <seanegan@pidgin.im>
parents:
15444
diff
changeset
|
1152 | |
| 15884 | 1153 | purple_signal_register(handle, "plugin-load", |
| 1154 | purple_marshal_VOID__POINTER, | |
| 10479 | 1155 | NULL, 1, |
| 15884 | 1156 | purple_value_new(PURPLE_TYPE_SUBTYPE, |
| 1157 | PURPLE_SUBTYPE_PLUGIN)); | |
| 1158 | purple_signal_register(handle, "plugin-unload", | |
| 1159 | purple_marshal_VOID__POINTER, | |
| 10479 | 1160 | NULL, 1, |
| 15884 | 1161 | purple_value_new(PURPLE_TYPE_SUBTYPE, |
| 1162 | PURPLE_SUBTYPE_PLUGIN)); | |
| 10479 | 1163 | } |
| 1164 | ||
| 1165 | void | |
| 15884 | 1166 | purple_plugins_uninit(void) { |
| 1167 | purple_signals_disconnect_by_handle(purple_plugins_get_handle()); | |
| 10479 | 1168 | } |
| 1169 | ||
| 1170 | /************************************************************************** | |
| 1171 | * Plugins API | |
| 1172 | **************************************************************************/ | |
| 5205 | 1173 | void |
| 15884 | 1174 | purple_plugins_add_search_path(const char *path) |
| 5205 | 1175 | { |
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
1176 | g_return_if_fail(path != NULL); |
| 5205 | 1177 | |
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
1178 | if (g_list_find_custom(search_paths, path, (GCompareFunc)strcmp)) |
|
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
1179 | return; |
| 5205 | 1180 | |
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
1181 | search_paths = g_list_append(search_paths, strdup(path)); |
| 5205 | 1182 | } |
| 1183 | ||
| 1184 | void | |
| 15884 | 1185 | purple_plugins_unload_all(void) |
| 5205 | 1186 | { |
| 15884 | 1187 | #ifdef PURPLE_PLUGINS |
| 5205 | 1188 | |
| 1189 | while (loaded_plugins != NULL) | |
| 15884 | 1190 | purple_plugin_unload(loaded_plugins->data); |
| 5205 | 1191 | |
| 15884 | 1192 | #endif /* PURPLE_PLUGINS */ |
| 5205 | 1193 | } |
| 1194 | ||
| 1195 | void | |
| 15884 | 1196 | purple_plugins_destroy_all(void) |
|
5242
155da5e9bbf0
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1197 | { |
| 15884 | 1198 | #ifdef PURPLE_PLUGINS |
|
5242
155da5e9bbf0
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1199 | |
|
155da5e9bbf0
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1200 | while (plugins != NULL) |
| 15884 | 1201 | purple_plugin_destroy(plugins->data); |
|
5242
155da5e9bbf0
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1202 | |
| 15884 | 1203 | #endif /* PURPLE_PLUGINS */ |
|
5242
155da5e9bbf0
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1204 | } |
| 5838 | 1205 | |
| 1206 | void | |
| 15884 | 1207 | purple_plugins_save_loaded(const char *key) |
| 15357 | 1208 | { |
| 15884 | 1209 | #ifdef PURPLE_PLUGINS |
| 15357 | 1210 | GList *pl; |
| 1211 | GList *files = NULL; | |
| 15884 | 1212 | PurplePlugin *p; |
| 15357 | 1213 | |
| 15884 | 1214 | for (pl = purple_plugins_get_loaded(); pl != NULL; pl = pl->next) { |
| 15357 | 1215 | p = pl->data; |
| 1216 | ||
| 15884 | 1217 | if (p->info->type != PURPLE_PLUGIN_PROTOCOL && |
| 1218 | p->info->type != PURPLE_PLUGIN_LOADER) { | |
| 15357 | 1219 | files = g_list_append(files, p->path); |
| 1220 | } | |
| 1221 | } | |
| 1222 | ||
| 15884 | 1223 | purple_prefs_set_path_list(key, files); |
| 15357 | 1224 | g_list_free(files); |
| 1225 | #endif | |
| 1226 | } | |
| 1227 | ||
| 1228 | void | |
| 15884 | 1229 | purple_plugins_load_saved(const char *key) |
| 5838 | 1230 | { |
| 15884 | 1231 | #ifdef PURPLE_PLUGINS |
|
5949
bb7cbf02dda9
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5941
diff
changeset
|
1232 | GList *f, *files; |
|
bb7cbf02dda9
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5941
diff
changeset
|
1233 | |
|
bb7cbf02dda9
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5941
diff
changeset
|
1234 | g_return_if_fail(key != NULL); |
| 5838 | 1235 | |
| 15884 | 1236 | files = purple_prefs_get_path_list(key); |
|
5949
bb7cbf02dda9
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5941
diff
changeset
|
1237 | |
|
7033
f6096f69a11e
[gaim-migrate @ 7596]
Robert McQueen <robot101@debian.org>
parents:
6982
diff
changeset
|
1238 | for (f = files; f; f = f->next) |
|
f6096f69a11e
[gaim-migrate @ 7596]
Robert McQueen <robot101@debian.org>
parents:
6982
diff
changeset
|
1239 | { |
|
10682
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
1240 | char *filename; |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
1241 | char *basename; |
| 15884 | 1242 | PurplePlugin *plugin; |
|
10682
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
1243 | |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
1244 | if (f->data == NULL) |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
1245 | continue; |
|
7033
f6096f69a11e
[gaim-migrate @ 7596]
Robert McQueen <robot101@debian.org>
parents:
6982
diff
changeset
|
1246 | |
|
10682
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
1247 | filename = f->data; |
|
13528
541152b0fad0
[gaim-migrate @ 15903]
Daniel Atallah <datallah@pidgin.im>
parents:
13311
diff
changeset
|
1248 | |
|
10682
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
1249 | /* |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
1250 | * We don't know if the filename uses Windows or Unix path |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
1251 | * separators (because people might be sharing a prefs.xml |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
1252 | * file across systems), so we find the last occurrence |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
1253 | * of either. |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
1254 | */ |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
1255 | basename = strrchr(filename, '/'); |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
1256 | if ((basename == NULL) || (basename < strrchr(filename, '\\'))) |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
1257 | basename = strrchr(filename, '\\'); |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
1258 | if (basename != NULL) |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
1259 | basename++; |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
1260 | |
|
13528
541152b0fad0
[gaim-migrate @ 15903]
Daniel Atallah <datallah@pidgin.im>
parents:
13311
diff
changeset
|
1261 | /* Strip the extension */ |
|
13567
4ec075b1ae40
[gaim-migrate @ 15945]
Daniel Atallah <datallah@pidgin.im>
parents:
13528
diff
changeset
|
1262 | if (basename) |
| 15884 | 1263 | basename = purple_plugin_get_basename(filename); |
|
13528
541152b0fad0
[gaim-migrate @ 15903]
Daniel Atallah <datallah@pidgin.im>
parents:
13311
diff
changeset
|
1264 | |
|
20777
fea03f2a8e96
Try to load a plugin from the saved preference even if it is not in the standard path.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
1265 | if (((plugin = purple_plugins_find_with_filename(filename)) != NULL) || |
|
fea03f2a8e96
Try to load a plugin from the saved preference even if it is not in the standard path.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
1266 | (basename && (plugin = purple_plugins_find_with_basename(basename)) != NULL) || |
|
fea03f2a8e96
Try to load a plugin from the saved preference even if it is not in the standard path.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
1267 | ((plugin = purple_plugin_probe(filename)) != NULL)) |
|
10682
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
1268 | { |
| 15884 | 1269 | purple_debug_info("plugins", "Loading saved plugin %s\n", |
|
10682
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
1270 | plugin->path); |
| 15884 | 1271 | purple_plugin_load(plugin); |
|
10682
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
1272 | } |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
1273 | else |
|
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
1274 | { |
| 15884 | 1275 | purple_debug_error("plugins", "Unable to find saved plugin %s\n", |
|
10682
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
1276 | filename); |
|
7033
f6096f69a11e
[gaim-migrate @ 7596]
Robert McQueen <robot101@debian.org>
parents:
6982
diff
changeset
|
1277 | } |
|
f6096f69a11e
[gaim-migrate @ 7596]
Robert McQueen <robot101@debian.org>
parents:
6982
diff
changeset
|
1278 | |
|
13528
541152b0fad0
[gaim-migrate @ 15903]
Daniel Atallah <datallah@pidgin.im>
parents:
13311
diff
changeset
|
1279 | g_free(basename); |
|
541152b0fad0
[gaim-migrate @ 15903]
Daniel Atallah <datallah@pidgin.im>
parents:
13311
diff
changeset
|
1280 | |
| 5838 | 1281 | g_free(f->data); |
| 1282 | } | |
| 1283 | ||
| 1284 | g_list_free(files); | |
| 15884 | 1285 | #endif /* PURPLE_PLUGINS */ |
| 5838 | 1286 | } |
| 1287 | ||
| 1288 | ||
|
5242
155da5e9bbf0
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1289 | void |
| 15884 | 1290 | purple_plugins_probe(const char *ext) |
| 5205 | 1291 | { |
| 15884 | 1292 | #ifdef PURPLE_PLUGINS |
| 5205 | 1293 | GDir *dir; |
| 1294 | const gchar *file; | |
| 1295 | gchar *path; | |
| 15884 | 1296 | PurplePlugin *plugin; |
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
1297 | GList *cur; |
|
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
1298 | const char *search_path; |
| 5205 | 1299 | |
| 1300 | if (!g_module_supported()) | |
| 1301 | return; | |
| 1302 | ||
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
1303 | /* Probe plugins */ |
|
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
1304 | for (cur = search_paths; cur != NULL; cur = cur->next) |
|
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
1305 | { |
|
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
1306 | search_path = cur->data; |
| 5205 | 1307 | |
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
1308 | dir = g_dir_open(search_path, 0, NULL); |
| 5205 | 1309 | |
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
1310 | if (dir != NULL) |
|
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
1311 | { |
|
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
1312 | while ((file = g_dir_read_name(dir)) != NULL) |
|
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
1313 | { |
|
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
1314 | path = g_build_filename(search_path, file, NULL); |
| 5205 | 1315 | |
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
1316 | if (ext == NULL || has_file_extension(file, ext)) |
| 15884 | 1317 | plugin = purple_plugin_probe(path); |
| 5205 | 1318 | |
| 1319 | g_free(path); | |
| 1320 | } | |
| 1321 | ||
| 1322 | g_dir_close(dir); | |
| 1323 | } | |
| 1324 | } | |
| 1325 | ||
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
1326 | /* See if we have any plugins waiting to load */ |
|
6981
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1327 | while (load_queue != NULL) |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1328 | { |
| 15884 | 1329 | plugin = (PurplePlugin *)load_queue->data; |
|
6981
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1330 | |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1331 | load_queue = g_list_remove(load_queue, plugin); |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1332 | |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1333 | if (plugin == NULL || plugin->info == NULL) |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1334 | continue; |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1335 | |
| 15884 | 1336 | if (plugin->info->type == PURPLE_PLUGIN_LOADER) |
|
6981
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1337 | { |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1338 | /* We'll just load this right now. */ |
| 15884 | 1339 | if (!purple_plugin_load(plugin)) |
|
6981
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1340 | { |
| 15884 | 1341 | purple_plugin_destroy(plugin); |
|
6981
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1342 | |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1343 | continue; |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1344 | } |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1345 | |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1346 | plugin_loaders = g_list_append(plugin_loaders, plugin); |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1347 | |
| 15884 | 1348 | for (cur = PURPLE_PLUGIN_LOADER_INFO(plugin)->exts; |
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
1349 | cur != NULL; |
|
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
1350 | cur = cur->next) |
|
6981
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1351 | { |
| 15884 | 1352 | purple_plugins_probe(cur->data); |
|
6981
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1353 | } |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1354 | } |
| 15884 | 1355 | else if (plugin->info->type == PURPLE_PLUGIN_PROTOCOL) |
|
6981
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1356 | { |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1357 | /* We'll just load this right now. */ |
| 15884 | 1358 | if (!purple_plugin_load(plugin)) |
|
6981
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1359 | { |
| 15884 | 1360 | purple_plugin_destroy(plugin); |
|
6981
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1361 | |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1362 | continue; |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1363 | } |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1364 | |
|
11950
a522c2da66e5
[gaim-migrate @ 14241]
Evan Schoenberg <evands@pidgin.im>
parents:
11772
diff
changeset
|
1365 | /* Make sure we don't load two PRPLs with the same name? */ |
| 15884 | 1366 | if (purple_find_prpl(plugin->info->id)) |
|
6981
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1367 | { |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1368 | /* Nothing to see here--move along, move along */ |
| 15884 | 1369 | purple_plugin_destroy(plugin); |
|
6981
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1370 | |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1371 | continue; |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1372 | } |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1373 | |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1374 | protocol_plugins = g_list_insert_sorted(protocol_plugins, plugin, |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1375 | (GCompareFunc)compare_prpl); |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1376 | } |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1377 | } |
|
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1378 | |
| 5205 | 1379 | if (probe_cb != NULL) |
| 1380 | probe_cb(probe_cb_data); | |
|
20805
bd18a055f953
Honor the return value of a plugin's unload function.
Richard Laager <rlaager@pidgin.im>
parents:
20777
diff
changeset
|
1381 | |
| 15884 | 1382 | #endif /* PURPLE_PLUGINS */ |
| 5205 | 1383 | } |
| 1384 | ||
| 1385 | gboolean | |
| 15884 | 1386 | purple_plugin_register(PurplePlugin *plugin) |
| 5205 | 1387 | { |
| 1388 | g_return_val_if_fail(plugin != NULL, FALSE); | |
| 1389 | ||
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
1390 | /* If this plugin has been registered already then exit */ |
| 5205 | 1391 | if (g_list_find(plugins, plugin)) |
| 1392 | return TRUE; | |
| 1393 | ||
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
1394 | /* Ensure the plugin has the requisite information */ |
| 15884 | 1395 | if (plugin->info->type == PURPLE_PLUGIN_LOADER) |
|
6981
749f11b02abf
[gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
1396 | { |
| 15884 | 1397 | PurplePluginLoaderInfo *loader_info; |
|
8749
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
1398 | |
| 15884 | 1399 | loader_info = PURPLE_PLUGIN_LOADER_INFO(plugin); |
|
8749
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
1400 | |
| 9943 | 1401 | if (loader_info == NULL) |
|
8749
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
1402 | { |
| 15884 | 1403 | purple_debug_error("plugins", "%s is not loadable, loader plugin missing loader_info\n", |
| 9943 | 1404 | plugin->path); |
|
8749
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
1405 | return FALSE; |
|
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
1406 | } |
|
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
1407 | } |
| 15884 | 1408 | else if (plugin->info->type == PURPLE_PLUGIN_PROTOCOL) |
|
8749
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
1409 | { |
| 15884 | 1410 | PurplePluginProtocolInfo *prpl_info; |
|
8749
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
1411 | |
| 15884 | 1412 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); |
|
8749
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
1413 | |
| 9943 | 1414 | if (prpl_info == NULL) |
|
8749
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
1415 | { |
| 15884 | 1416 | purple_debug_error("plugins", "%s is not loadable, protocol plugin missing prpl_info\n", |
| 9943 | 1417 | plugin->path); |
|
8749
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
1418 | return FALSE; |
|
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
1419 | } |
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
1420 | } |
|
8749
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
1421 | |
| 15884 | 1422 | #ifdef PURPLE_PLUGINS |
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
1423 | /* This plugin should be probed and maybe loaded--add it to the queue */ |
|
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10279
diff
changeset
|
1424 | load_queue = g_list_append(load_queue, plugin); |
|
11950
a522c2da66e5
[gaim-migrate @ 14241]
Evan Schoenberg <evands@pidgin.im>
parents:
11772
diff
changeset
|
1425 | #else |
|
12081
26a81230ffb1
[gaim-migrate @ 14378]
Evan Schoenberg <evands@pidgin.im>
parents:
12077
diff
changeset
|
1426 | if (plugin->info != NULL) |
|
26a81230ffb1
[gaim-migrate @ 14378]
Evan Schoenberg <evands@pidgin.im>
parents:
12077
diff
changeset
|
1427 | { |
| 15884 | 1428 | if (plugin->info->type == PURPLE_PLUGIN_PROTOCOL) |
|
12081
26a81230ffb1
[gaim-migrate @ 14378]
Evan Schoenberg <evands@pidgin.im>
parents:
12077
diff
changeset
|
1429 | protocol_plugins = g_list_insert_sorted(protocol_plugins, plugin, |
|
26a81230ffb1
[gaim-migrate @ 14378]
Evan Schoenberg <evands@pidgin.im>
parents:
12077
diff
changeset
|
1430 | (GCompareFunc)compare_prpl); |
|
26a81230ffb1
[gaim-migrate @ 14378]
Evan Schoenberg <evands@pidgin.im>
parents:
12077
diff
changeset
|
1431 | if (plugin->info->load != NULL) |
|
26a81230ffb1
[gaim-migrate @ 14378]
Evan Schoenberg <evands@pidgin.im>
parents:
12077
diff
changeset
|
1432 | if (!plugin->info->load(plugin)) |
|
26a81230ffb1
[gaim-migrate @ 14378]
Evan Schoenberg <evands@pidgin.im>
parents:
12077
diff
changeset
|
1433 | return FALSE; |
|
26a81230ffb1
[gaim-migrate @ 14378]
Evan Schoenberg <evands@pidgin.im>
parents:
12077
diff
changeset
|
1434 | } |
|
11950
a522c2da66e5
[gaim-migrate @ 14241]
Evan Schoenberg <evands@pidgin.im>
parents:
11772
diff
changeset
|
1435 | #endif |
| 5205 | 1436 | |
| 1437 | plugins = g_list_append(plugins, plugin); | |
| 1438 | ||
| 1439 | return TRUE; | |
| 1440 | } | |
| 1441 | ||
| 1442 | gboolean | |
| 15884 | 1443 | purple_plugins_enabled(void) |
| 5205 | 1444 | { |
| 15884 | 1445 | #ifdef PURPLE_PLUGINS |
| 5205 | 1446 | return TRUE; |
| 1447 | #else | |
| 1448 | return FALSE; | |
| 1449 | #endif | |
| 1450 | } | |
| 1451 | ||
| 1452 | void | |
| 15884 | 1453 | purple_plugins_register_probe_notify_cb(void (*func)(void *), void *data) |
| 5205 | 1454 | { |
| 1455 | probe_cb = func; | |
| 1456 | probe_cb_data = data; | |
| 1457 | } | |
| 1458 | ||
| 1459 | void | |
| 15884 | 1460 | purple_plugins_unregister_probe_notify_cb(void (*func)(void *)) |
| 5205 | 1461 | { |
| 1462 | probe_cb = NULL; | |
| 1463 | probe_cb_data = NULL; | |
| 1464 | } | |
| 1465 | ||
| 1466 | void | |
| 15884 | 1467 | purple_plugins_register_load_notify_cb(void (*func)(PurplePlugin *, void *), |
| 5205 | 1468 | void *data) |
| 1469 | { | |
| 1470 | load_cb = func; | |
| 1471 | load_cb_data = data; | |
| 1472 | } | |
| 1473 | ||
| 1474 | void | |
| 15884 | 1475 | purple_plugins_unregister_load_notify_cb(void (*func)(PurplePlugin *, void *)) |
| 5205 | 1476 | { |
| 1477 | load_cb = NULL; | |
| 1478 | load_cb_data = NULL; | |
| 1479 | } | |
| 1480 | ||
| 1481 | void | |
| 15884 | 1482 | purple_plugins_register_unload_notify_cb(void (*func)(PurplePlugin *, void *), |
| 5205 | 1483 | void *data) |
| 1484 | { | |
| 1485 | unload_cb = func; | |
| 1486 | unload_cb_data = data; | |
| 1487 | } | |
| 1488 | ||
| 1489 | void | |
| 15884 | 1490 | purple_plugins_unregister_unload_notify_cb(void (*func)(PurplePlugin *, void *)) |
| 5205 | 1491 | { |
| 1492 | unload_cb = NULL; | |
| 1493 | unload_cb_data = NULL; | |
| 1494 | } | |
| 1495 | ||
| 15884 | 1496 | PurplePlugin * |
| 1497 | purple_plugins_find_with_name(const char *name) | |
| 5205 | 1498 | { |
| 15884 | 1499 | PurplePlugin *plugin; |
| 5205 | 1500 | GList *l; |
| 1501 | ||
| 1502 | for (l = plugins; l != NULL; l = l->next) { | |
| 1503 | plugin = l->data; | |
| 1504 | ||
| 1505 | if (!strcmp(plugin->info->name, name)) | |
| 1506 | return plugin; | |
| 1507 | } | |
| 1508 | ||
| 1509 | return NULL; | |
| 1510 | } | |
| 1511 | ||
| 15884 | 1512 | PurplePlugin * |
| 1513 | purple_plugins_find_with_filename(const char *filename) | |
| 5205 | 1514 | { |
| 15884 | 1515 | PurplePlugin *plugin; |
| 5205 | 1516 | GList *l; |
| 1517 | ||
| 1518 | for (l = plugins; l != NULL; l = l->next) { | |
| 1519 | plugin = l->data; | |
| 1520 | ||
| 1521 | if (plugin->path != NULL && !strcmp(plugin->path, filename)) | |
| 1522 | return plugin; | |
| 1523 | } | |
| 1524 | ||
| 1525 | return NULL; | |
| 1526 | } | |
| 1527 | ||
| 15884 | 1528 | PurplePlugin * |
| 1529 | purple_plugins_find_with_basename(const char *basename) | |
|
7033
f6096f69a11e
[gaim-migrate @ 7596]
Robert McQueen <robot101@debian.org>
parents:
6982
diff
changeset
|
1530 | { |
| 15884 | 1531 | #ifdef PURPLE_PLUGINS |
| 1532 | PurplePlugin *plugin; | |
|
7033
f6096f69a11e
[gaim-migrate @ 7596]
Robert McQueen <robot101@debian.org>
parents:
6982
diff
changeset
|
1533 | GList *l; |
|
10682
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
1534 | char *tmp; |
|
7033
f6096f69a11e
[gaim-migrate @ 7596]
Robert McQueen <robot101@debian.org>
parents:
6982
diff
changeset
|
1535 | |
|
f6096f69a11e
[gaim-migrate @ 7596]
Robert McQueen <robot101@debian.org>
parents:
6982
diff
changeset
|
1536 | g_return_val_if_fail(basename != NULL, NULL); |
|
f6096f69a11e
[gaim-migrate @ 7596]
Robert McQueen <robot101@debian.org>
parents:
6982
diff
changeset
|
1537 | |
|
f6096f69a11e
[gaim-migrate @ 7596]
Robert McQueen <robot101@debian.org>
parents:
6982
diff
changeset
|
1538 | for (l = plugins; l != NULL; l = l->next) |
|
f6096f69a11e
[gaim-migrate @ 7596]
Robert McQueen <robot101@debian.org>
parents:
6982
diff
changeset
|
1539 | { |
| 15884 | 1540 | plugin = (PurplePlugin *)l->data; |
|
7033
f6096f69a11e
[gaim-migrate @ 7596]
Robert McQueen <robot101@debian.org>
parents:
6982
diff
changeset
|
1541 | |
| 7278 | 1542 | if (plugin->path != NULL) { |
| 15884 | 1543 | tmp = purple_plugin_get_basename(plugin->path); |
|
13528
541152b0fad0
[gaim-migrate @ 15903]
Daniel Atallah <datallah@pidgin.im>
parents:
13311
diff
changeset
|
1544 | if (!strcmp(tmp, basename)) |
|
10682
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
1545 | { |
| 7278 | 1546 | g_free(tmp); |
|
7033
f6096f69a11e
[gaim-migrate @ 7596]
Robert McQueen <robot101@debian.org>
parents:
6982
diff
changeset
|
1547 | return plugin; |
| 7278 | 1548 | } |
| 7279 | 1549 | g_free(tmp); |
|
7033
f6096f69a11e
[gaim-migrate @ 7596]
Robert McQueen <robot101@debian.org>
parents:
6982
diff
changeset
|
1550 | } |
|
f6096f69a11e
[gaim-migrate @ 7596]
Robert McQueen <robot101@debian.org>
parents:
6982
diff
changeset
|
1551 | } |
|
f6096f69a11e
[gaim-migrate @ 7596]
Robert McQueen <robot101@debian.org>
parents:
6982
diff
changeset
|
1552 | |
| 15884 | 1553 | #endif /* PURPLE_PLUGINS */ |
|
10682
c293ad49121e
[gaim-migrate @ 12228]
Richard Laager <rlaager@pidgin.im>
parents:
10504
diff
changeset
|
1554 | |
|
7033
f6096f69a11e
[gaim-migrate @ 7596]
Robert McQueen <robot101@debian.org>
parents:
6982
diff
changeset
|
1555 | return NULL; |
|
f6096f69a11e
[gaim-migrate @ 7596]
Robert McQueen <robot101@debian.org>
parents:
6982
diff
changeset
|
1556 | } |
|
f6096f69a11e
[gaim-migrate @ 7596]
Robert McQueen <robot101@debian.org>
parents:
6982
diff
changeset
|
1557 | |
| 15884 | 1558 | PurplePlugin * |
| 1559 | purple_plugins_find_with_id(const char *id) | |
| 5205 | 1560 | { |
| 15884 | 1561 | PurplePlugin *plugin; |
| 5205 | 1562 | GList *l; |
| 1563 | ||
| 1564 | g_return_val_if_fail(id != NULL, NULL); | |
| 1565 | ||
|
6486
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
1566 | for (l = plugins; l != NULL; l = l->next) |
|
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
1567 | { |
| 5205 | 1568 | plugin = l->data; |
| 1569 | ||
|
6486
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
1570 | if (plugin->info->id != NULL && !strcmp(plugin->info->id, id)) |
| 5205 | 1571 | return plugin; |
| 1572 | } | |
| 1573 | ||
| 1574 | return NULL; | |
| 1575 | } | |
| 1576 | ||
| 1577 | GList * | |
| 15884 | 1578 | purple_plugins_get_loaded(void) |
| 5205 | 1579 | { |
| 1580 | return loaded_plugins; | |
| 1581 | } | |
| 1582 | ||
| 1583 | GList * | |
| 15884 | 1584 | purple_plugins_get_protocols(void) |
|
5573
633880e3f137
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1585 | { |
|
633880e3f137
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1586 | return protocol_plugins; |
|
633880e3f137
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1587 | } |
|
633880e3f137
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1588 | |
|
633880e3f137
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1589 | GList * |
| 15884 | 1590 | purple_plugins_get_all(void) |
| 5205 | 1591 | { |
| 1592 | return plugins; | |
| 1593 | } | |
| 1594 | ||
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
1595 | |
| 15884 | 1596 | PurplePluginAction * |
| 1597 | purple_plugin_action_new(const char* label, void (*callback)(PurplePluginAction *)) | |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
1598 | { |
| 15884 | 1599 | PurplePluginAction *act = g_new0(PurplePluginAction, 1); |
|
9018
b13b46fa2f16
[gaim-migrate @ 9794]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1600 | |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12992
diff
changeset
|
1601 | act->label = g_strdup(label); |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
1602 | act->callback = callback; |
|
9018
b13b46fa2f16
[gaim-migrate @ 9794]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1603 | |
|
b13b46fa2f16
[gaim-migrate @ 9794]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1604 | return act; |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
1605 | } |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12992
diff
changeset
|
1606 | |
|
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12992
diff
changeset
|
1607 | void |
| 15884 | 1608 | purple_plugin_action_free(PurplePluginAction *action) |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12992
diff
changeset
|
1609 | { |
|
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12992
diff
changeset
|
1610 | g_return_if_fail(action != NULL); |
|
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12992
diff
changeset
|
1611 | |
|
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12992
diff
changeset
|
1612 | g_free(action->label); |
|
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12992
diff
changeset
|
1613 | g_free(action); |
|
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12992
diff
changeset
|
1614 | } |