annotate src/plugin.c @ 12285:af257d8679fe

[gaim-migrate @ 14589] Ok, so I'm changing the semantics of gaim_account_notify_added, having it check for the existance of a buddy was breaking some jabber scenarios. So buddy checks should now be done in the prpls. I also added a gaim_account_request_add. _notify_added only notifies the user of the add, request_add notifies the user AND asks them if they want to add the buddy to their buddy list. I only updated jabber for these changes because it's the only protocol I really know at all well. So everyone PLEASE make sure that the other protocols get updated for this. That is make sure that when you expect to prompt the user to add the buddy you use _request_add instead of just using _notify_added and expecting the core to determine if it needs to prompt the user. Oh, there are also some other jabber changes which should hopefully fix some issues that people were seeing, like buddies not signing off when you unsubscribed with them, etc. Let me know if anyone notices any jabber oddities after this. committer: Tailor Script <tailor@pidgin.im>
author Etan Reisner <pidgin@unreliablesource.net>
date Thu, 01 Dec 2005 20:09:27 +0000
parents cb77957d644c
children 720fb68418d8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /*
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 * gaim
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 *
8046
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7956
diff changeset
4 * Gaim is the legal property of its developers, whose names are too numerous
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7956
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7956
diff changeset
6 * source distribution.
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 *
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * (at your option) any later version.
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 *
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * GNU General Public License for more details.
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 *
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 */
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5840
diff changeset
22 #include "internal.h"
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
24 #include "accountopt.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5840
diff changeset
25 #include "debug.h"
5436
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5357
diff changeset
26 #include "notify.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5840
diff changeset
27 #include "prefs.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5840
diff changeset
28 #include "prpl.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5840
diff changeset
29 #include "request.h"
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6432
diff changeset
30 #include "signals.h"
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
31 #include "version.h"
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32
6822
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
33 typedef struct
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
34 {
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
35 GHashTable *commands;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
36 size_t command_count;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
37
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
38 } GaimPluginIpcInfo;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
39
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
40 typedef struct
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
41 {
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
42 GaimCallback func;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
43 GaimSignalMarshalFunc marshal;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
44
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
45 int num_params;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
46 GaimValue **params;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
47 GaimValue *ret_value;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
48
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
49 } GaimPluginIpcCommand;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
50
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
51 static GList *search_paths = NULL;
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
52 static GList *plugins = NULL;
11950
2b9ca8861ca5 [gaim-migrate @ 14241]
Mark Doliner <mark@kingant.net>
parents: 11772
diff changeset
53 static GList *loaded_plugins = NULL;
2b9ca8861ca5 [gaim-migrate @ 14241]
Mark Doliner <mark@kingant.net>
parents: 11772
diff changeset
54 static GList *protocol_plugins = NULL;
2b9ca8861ca5 [gaim-migrate @ 14241]
Mark Doliner <mark@kingant.net>
parents: 11772
diff changeset
55 #ifdef GAIM_PLUGINS
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
56 static GList *load_queue = NULL;
6981
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
57 static GList *plugin_loaders = NULL;
11950
2b9ca8861ca5 [gaim-migrate @ 14241]
Mark Doliner <mark@kingant.net>
parents: 11772
diff changeset
58 #endif
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59
11963
d8787960e398 [gaim-migrate @ 14254]
Mark Doliner <mark@kingant.net>
parents: 11950
diff changeset
60 /*
d8787960e398 [gaim-migrate @ 14254]
Mark Doliner <mark@kingant.net>
parents: 11950
diff changeset
61 * TODO: I think the intention was to allow multiple load and unload
d8787960e398 [gaim-migrate @ 14254]
Mark Doliner <mark@kingant.net>
parents: 11950
diff changeset
62 * callback functions. Perhaps using a GList instead of a
d8787960e398 [gaim-migrate @ 14254]
Mark Doliner <mark@kingant.net>
parents: 11950
diff changeset
63 * pointer to a single function.
d8787960e398 [gaim-migrate @ 14254]
Mark Doliner <mark@kingant.net>
parents: 11950
diff changeset
64 */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65 static void (*probe_cb)(void *) = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66 static void *probe_cb_data = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
67 static void (*load_cb)(GaimPlugin *, void *) = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68 static void *load_cb_data = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 static void (*unload_cb)(GaimPlugin *, void *) = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 static void *unload_cb_data = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 #ifdef GAIM_PLUGINS
11950
2b9ca8861ca5 [gaim-migrate @ 14241]
Mark Doliner <mark@kingant.net>
parents: 11772
diff changeset
73
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
74 static gboolean
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
75 has_file_extension(const char *filename, const char *ext)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
77 int len, extlen;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
78
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79 if (filename == NULL || *filename == '\0' || ext == NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80 return 0;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82 extlen = strlen(ext);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83 len = strlen(filename) - extlen;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85 if (len < 0)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
86 return 0;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
88 return (strncmp(filename + len, ext, extlen) == 0);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
90
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
91 static gboolean
10682
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
92 is_native(const char *filename)
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
93 {
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
94 const char *last_period;
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
95
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
96 last_period = strrchr(filename, '.');
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
97 if (last_period == NULL)
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
98 return FALSE;
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
99
12077
3cf98e532126 [gaim-migrate @ 14374]
Mark Doliner <mark@kingant.net>
parents: 12066
diff changeset
100 return !(strcmp(last_period, ".dll") &
3cf98e532126 [gaim-migrate @ 14374]
Mark Doliner <mark@kingant.net>
parents: 12066
diff changeset
101 strcmp(last_period, ".sl") &
3cf98e532126 [gaim-migrate @ 14374]
Mark Doliner <mark@kingant.net>
parents: 12066
diff changeset
102 strcmp(last_period, ".so"));
10682
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
103 }
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
104
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
105 static char *
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
106 gaim_plugin_get_basename(const char *filename)
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
107 {
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
108 const char *basename;
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
109 const char *last_period;
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
110
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
111 basename = strrchr(filename, G_DIR_SEPARATOR);
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
112 if (basename != NULL)
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
113 basename++;
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
114 else
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
115 basename = filename;
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
116
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
117 if (is_native(basename) &&
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
118 ((last_period = strrchr(basename, '.')) != NULL))
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
119 return g_strndup(basename, (last_period - basename));
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
120
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
121 return g_strdup(basename);
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
122 }
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
123
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
124 static gboolean
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5646
diff changeset
125 loader_supports_file(GaimPlugin *loader, const char *filename)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
126 {
6432
f9428d38c03b [gaim-migrate @ 6940]
Luke Schierer <lschiere@pidgin.im>
parents: 5981
diff changeset
127 GList *exts;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
128
6432
f9428d38c03b [gaim-migrate @ 6940]
Luke Schierer <lschiere@pidgin.im>
parents: 5981
diff changeset
129 for (exts = GAIM_PLUGIN_LOADER_INFO(loader)->exts; exts != NULL; exts = exts->next) {
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
130 if (has_file_extension(filename, (char *)exts->data)) {
6432
f9428d38c03b [gaim-migrate @ 6940]
Luke Schierer <lschiere@pidgin.im>
parents: 5981
diff changeset
131 return TRUE;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
132 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
133 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
134
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
135 return FALSE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
136 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
137
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
138 static GaimPlugin *
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5646
diff changeset
139 find_loader_for_plugin(const GaimPlugin *plugin)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
140 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
141 GaimPlugin *loader;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
142 GList *l;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
143
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
144 if (plugin->path == NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
145 return NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
146
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
147 for (l = gaim_plugins_get_loaded(); l != NULL; l = l->next) {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
148 loader = l->data;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
149
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
150 if (loader->info->type == GAIM_PLUGIN_LOADER &&
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5646
diff changeset
151 loader_supports_file(loader, plugin->path)) {
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
152
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
153 return loader;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
154 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
155
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
156 loader = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
157 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
158
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
159 return NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
160 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
161
5449
9442e8d0b21d [gaim-migrate @ 5836]
Luke Schierer <lschiere@pidgin.im>
parents: 5443
diff changeset
162 #endif /* GAIM_PLUGINS */
9442e8d0b21d [gaim-migrate @ 5836]
Luke Schierer <lschiere@pidgin.im>
parents: 5443
diff changeset
163
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
164 /**
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
165 * Negative if a before b, 0 if equal, positive if a after b.
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
166 */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
167 static gint
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
168 compare_prpl(GaimPlugin *a, GaimPlugin *b)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
169 {
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7279
diff changeset
170 if(GAIM_IS_PROTOCOL_PLUGIN(a)) {
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7279
diff changeset
171 if(GAIM_IS_PROTOCOL_PLUGIN(b))
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7279
diff changeset
172 return strcmp(a->info->name, b->info->name);
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7279
diff changeset
173 else
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7279
diff changeset
174 return -1;
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7279
diff changeset
175 } else {
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7279
diff changeset
176 if(GAIM_IS_PROTOCOL_PLUGIN(b))
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7279
diff changeset
177 return 1;
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7279
diff changeset
178 else
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7279
diff changeset
179 return 0;
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7279
diff changeset
180 }
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
181 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
182
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
183 GaimPlugin *
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
184 gaim_plugin_new(gboolean native, const char *path)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
185 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
186 GaimPlugin *plugin;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
187
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
188 plugin = g_new0(GaimPlugin, 1);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
189
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
190 plugin->native_plugin = native;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
191 plugin->path = (path == NULL ? NULL : g_strdup(path));
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
192
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
193 return plugin;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
194 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
195
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
196 GaimPlugin *
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
197 gaim_plugin_probe(const char *filename)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
198 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
199 #ifdef GAIM_PLUGINS
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
200 GaimPlugin *plugin = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
201 GaimPlugin *loader;
10124
b4efa002dad8 [gaim-migrate @ 11161]
Nathan Walp <nwalp@pidgin.im>
parents: 10087
diff changeset
202 gpointer unpunned;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
203 gboolean (*gaim_init_plugin)(GaimPlugin *);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
204
6981
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
205 gaim_debug_misc("plugins", "probing %s\n", filename);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
206 g_return_val_if_fail(filename != NULL, NULL);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
207
5973
53782414bc3a [gaim-migrate @ 6420]
Mark Doliner <mark@kingant.net>
parents: 5949
diff changeset
208 if (!g_file_test(filename, G_FILE_TEST_EXISTS))
53782414bc3a [gaim-migrate @ 6420]
Mark Doliner <mark@kingant.net>
parents: 5949
diff changeset
209 return NULL;
53782414bc3a [gaim-migrate @ 6420]
Mark Doliner <mark@kingant.net>
parents: 5949
diff changeset
210
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
211 /* If this plugin has already been probed then exit */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
212 plugin = gaim_plugins_find_with_filename(filename);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
213 if (plugin != NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
214 return plugin;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
215
12066
ee8312c764b1 [gaim-migrate @ 14361]
Mark Doliner <mark@kingant.net>
parents: 11963
diff changeset
216 plugin = gaim_plugin_new(has_file_extension(filename, G_MODULE_SUFFIX), filename);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
217
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
218 if (plugin->native_plugin) {
5450
bb1e160467b6 [gaim-migrate @ 5838]
Nathan Walp <nwalp@pidgin.im>
parents: 5449
diff changeset
219 const char *error;
10737
b7f0bc436179 [gaim-migrate @ 12339]
Mark Doliner <mark@kingant.net>
parents: 10682
diff changeset
220 /*
10950
4b0f64ab869c [gaim-migrate @ 12750]
Mark Doliner <mark@kingant.net>
parents: 10884
diff changeset
221 * We pass G_MODULE_BIND_LOCAL here to prevent symbols from
4b0f64ab869c [gaim-migrate @ 12750]
Mark Doliner <mark@kingant.net>
parents: 10884
diff changeset
222 * plugins being added to the global name space.
11378
3c88e4519fd1 [gaim-migrate @ 13604]
Mark Doliner <mark@kingant.net>
parents: 11256
diff changeset
223 *
3c88e4519fd1 [gaim-migrate @ 13604]
Mark Doliner <mark@kingant.net>
parents: 11256
diff changeset
224 * G_MODULE_BIND_LOCAL was added in glib 2.3.3.
11950
2b9ca8861ca5 [gaim-migrate @ 14241]
Mark Doliner <mark@kingant.net>
parents: 11772
diff changeset
225 * TODO: I guess there's nothing we can do about that?
10737
b7f0bc436179 [gaim-migrate @ 12339]
Mark Doliner <mark@kingant.net>
parents: 10682
diff changeset
226 */
11378
3c88e4519fd1 [gaim-migrate @ 13604]
Mark Doliner <mark@kingant.net>
parents: 11256
diff changeset
227 #if GLIB_CHECK_VERSION(2,3,3)
10884
5cda52915a1f [gaim-migrate @ 12582]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10737
diff changeset
228 plugin->handle = g_module_open(filename, G_MODULE_BIND_LOCAL);
11378
3c88e4519fd1 [gaim-migrate @ 13604]
Mark Doliner <mark@kingant.net>
parents: 11256
diff changeset
229 #else
3c88e4519fd1 [gaim-migrate @ 13604]
Mark Doliner <mark@kingant.net>
parents: 11256
diff changeset
230 plugin->handle = g_module_open(filename, 0);
3c88e4519fd1 [gaim-migrate @ 13604]
Mark Doliner <mark@kingant.net>
parents: 11256
diff changeset
231 #endif
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
232
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
233 if (plugin->handle == NULL)
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
234 {
5443
07358c067495 [gaim-migrate @ 5825]
Nathan Walp <nwalp@pidgin.im>
parents: 5436
diff changeset
235 error = g_module_error();
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
236 gaim_debug_error("plugins", "%s is unloadable: %s\n",
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
237 plugin->path, error ? error : "Unknown error.");
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
238
5269
cd7e4ba049f9 [gaim-migrate @ 5641]
Christian Hammond <chipx86@chipx86.com>
parents: 5268
diff changeset
239 gaim_plugin_destroy(plugin);
cd7e4ba049f9 [gaim-migrate @ 5641]
Christian Hammond <chipx86@chipx86.com>
parents: 5268
diff changeset
240
cd7e4ba049f9 [gaim-migrate @ 5641]
Christian Hammond <chipx86@chipx86.com>
parents: 5268
diff changeset
241 return NULL;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
242 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
243
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
244 if (!g_module_symbol(plugin->handle, "gaim_init_plugin",
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
245 &unpunned))
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
246 {
11950
2b9ca8861ca5 [gaim-migrate @ 14241]
Mark Doliner <mark@kingant.net>
parents: 11772
diff changeset
247 gaim_debug_error("plugins", "%s is not usable because the "
2b9ca8861ca5 [gaim-migrate @ 14241]
Mark Doliner <mark@kingant.net>
parents: 11772
diff changeset
248 "'gaim_init_plugin' symbol could not be "
2b9ca8861ca5 [gaim-migrate @ 14241]
Mark Doliner <mark@kingant.net>
parents: 11772
diff changeset
249 "found. Does the plugin call the "
2b9ca8861ca5 [gaim-migrate @ 14241]
Mark Doliner <mark@kingant.net>
parents: 11772
diff changeset
250 "GAIM_INIT_PLUGIN() macro?\n", plugin->path);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
251
11950
2b9ca8861ca5 [gaim-migrate @ 14241]
Mark Doliner <mark@kingant.net>
parents: 11772
diff changeset
252 g_module_close(plugin->handle);
5443
07358c067495 [gaim-migrate @ 5825]
Nathan Walp <nwalp@pidgin.im>
parents: 5436
diff changeset
253 error = g_module_error();
11950
2b9ca8861ca5 [gaim-migrate @ 14241]
Mark Doliner <mark@kingant.net>
parents: 11772
diff changeset
254 if (error != NULL)
2b9ca8861ca5 [gaim-migrate @ 14241]
Mark Doliner <mark@kingant.net>
parents: 11772
diff changeset
255 gaim_debug_error("plugins", "Error closing module %s: %s\n",
2b9ca8861ca5 [gaim-migrate @ 14241]
Mark Doliner <mark@kingant.net>
parents: 11772
diff changeset
256 plugin->path, error);
2b9ca8861ca5 [gaim-migrate @ 14241]
Mark Doliner <mark@kingant.net>
parents: 11772
diff changeset
257 plugin->handle = NULL;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
258
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
259 gaim_plugin_destroy(plugin);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
260
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
261 return NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
262 }
10124
b4efa002dad8 [gaim-migrate @ 11161]
Nathan Walp <nwalp@pidgin.im>
parents: 10087
diff changeset
263 gaim_init_plugin = unpunned;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
264 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
265 else {
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5646
diff changeset
266 loader = find_loader_for_plugin(plugin);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
267
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
268 if (loader == NULL) {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
269 gaim_plugin_destroy(plugin);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
270
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
271 return NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
272 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
273
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
274 gaim_init_plugin = GAIM_PLUGIN_LOADER_INFO(loader)->probe;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
275 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
276
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
277 plugin->error = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
278
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
279 if (!gaim_init_plugin(plugin) || plugin->info == NULL) {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
280 gaim_plugin_destroy(plugin);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
281
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
282 return NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
283 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
284
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
285 if (plugin->info->magic != GAIM_PLUGIN_MAGIC ||
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
286 plugin->info->major_version != GAIM_MAJOR_VERSION ||
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
287 plugin->info->minor_version > GAIM_MINOR_VERSION)
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
288 {
10156
0dbeb6d1e258 [gaim-migrate @ 11236]
Mark Doliner <mark@kingant.net>
parents: 10145
diff changeset
289 gaim_debug_error("plugins", "%s is unloadable: API version mismatch %d.%d.x (need %d.%d.x)\n",
0dbeb6d1e258 [gaim-migrate @ 11236]
Mark Doliner <mark@kingant.net>
parents: 10145
diff changeset
290 plugin->path, plugin->info->major_version, plugin->info->minor_version,
0dbeb6d1e258 [gaim-migrate @ 11236]
Mark Doliner <mark@kingant.net>
parents: 10145
diff changeset
291 GAIM_MAJOR_VERSION, GAIM_MINOR_VERSION);
0dbeb6d1e258 [gaim-migrate @ 11236]
Mark Doliner <mark@kingant.net>
parents: 10145
diff changeset
292 gaim_plugin_destroy(plugin);
0dbeb6d1e258 [gaim-migrate @ 11236]
Mark Doliner <mark@kingant.net>
parents: 10145
diff changeset
293 return NULL;
0dbeb6d1e258 [gaim-migrate @ 11236]
Mark Doliner <mark@kingant.net>
parents: 10145
diff changeset
294 }
0dbeb6d1e258 [gaim-migrate @ 11236]
Mark Doliner <mark@kingant.net>
parents: 10145
diff changeset
295
0dbeb6d1e258 [gaim-migrate @ 11236]
Mark Doliner <mark@kingant.net>
parents: 10145
diff changeset
296 /* If plugin is a PRPL, make sure it implements the required functions */
0dbeb6d1e258 [gaim-migrate @ 11236]
Mark Doliner <mark@kingant.net>
parents: 10145
diff changeset
297 if ((plugin->info->type == GAIM_PLUGIN_PROTOCOL) && (
0dbeb6d1e258 [gaim-migrate @ 11236]
Mark Doliner <mark@kingant.net>
parents: 10145
diff changeset
298 (GAIM_PLUGIN_PROTOCOL_INFO(plugin)->list_icon == NULL) ||
0dbeb6d1e258 [gaim-migrate @ 11236]
Mark Doliner <mark@kingant.net>
parents: 10145
diff changeset
299 (GAIM_PLUGIN_PROTOCOL_INFO(plugin)->login == NULL) ||
0dbeb6d1e258 [gaim-migrate @ 11236]
Mark Doliner <mark@kingant.net>
parents: 10145
diff changeset
300 (GAIM_PLUGIN_PROTOCOL_INFO(plugin)->close == NULL)))
0dbeb6d1e258 [gaim-migrate @ 11236]
Mark Doliner <mark@kingant.net>
parents: 10145
diff changeset
301 {
0dbeb6d1e258 [gaim-migrate @ 11236]
Mark Doliner <mark@kingant.net>
parents: 10145
diff changeset
302 gaim_debug_error("plugins", "%s is unloadable: Does not implement all required functions\n",
0dbeb6d1e258 [gaim-migrate @ 11236]
Mark Doliner <mark@kingant.net>
parents: 10145
diff changeset
303 plugin->path);
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
304 gaim_plugin_destroy(plugin);
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
305 return NULL;
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
306 }
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
307
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
308 return plugin;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
309 #else
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
310 return NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
311 #endif /* !GAIM_PLUGINS */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
312 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
313
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
314 gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
315 gaim_plugin_load(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
316 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
317 #ifdef GAIM_PLUGINS
6486
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
318 GList *dep_list = NULL;
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
319 GList *l;
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
320
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
321 g_return_val_if_fail(plugin != NULL, FALSE);
5270
d1fe8e320dab [gaim-migrate @ 5642]
Christian Hammond <chipx86@chipx86.com>
parents: 5269
diff changeset
322 g_return_val_if_fail(plugin->error == NULL, FALSE);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
323
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
324 if (gaim_plugin_is_loaded(plugin))
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
325 return TRUE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
326
6486
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
327 /*
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
328 * Go through the list of the plugin's dependencies.
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
329 *
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
330 * First pass: Make sure all the plugins needed are probed.
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
331 */
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
332 for (l = plugin->info->dependencies; l != NULL; l = l->next)
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
333 {
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
334 const char *dep_name = (const char *)l->data;
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
335 GaimPlugin *dep_plugin;
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
336
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
337 dep_plugin = gaim_plugins_find_with_id(dep_name);
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
338
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
339 if (dep_plugin == NULL)
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
340 {
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
341 char buf[BUFSIZ];
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
342
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
343 g_snprintf(buf, sizeof(buf),
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
344 _("The required plugin %s was not found. "
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
345 "Please install this plugin and try again."),
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
346 dep_name);
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
347
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
348 gaim_notify_error(NULL, NULL,
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
349 _("Gaim was unable to load your plugin."),
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
350 buf);
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
351
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
352 if (dep_list != NULL)
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
353 g_list_free(dep_list);
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
354
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
355 return FALSE;
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
356 }
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
357
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
358 dep_list = g_list_append(dep_list, dep_plugin);
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
359 }
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
360
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
361 /* Second pass: load all the required plugins. */
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
362 for (l = dep_list; l != NULL; l = l->next)
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
363 {
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
364 GaimPlugin *dep_plugin = (GaimPlugin *)l->data;
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
365
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
366 if (!gaim_plugin_is_loaded(dep_plugin))
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
367 {
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
368 if (!gaim_plugin_load(dep_plugin))
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
369 {
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
370 char buf[BUFSIZ];
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
371
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
372 g_snprintf(buf, sizeof(buf),
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
373 _("The required plugin %s was unable to load."),
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
374 plugin->info->name);
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
375
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
376 gaim_notify_error(NULL, NULL,
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
377 _("Gaim was unable to load your plugin."),
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
378 buf);
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
379
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
380 if (dep_list != NULL)
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
381 g_list_free(dep_list);
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
382
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
383 return FALSE;
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
384 }
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
385 }
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
386 }
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
387
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
388 if (dep_list != NULL)
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
389 g_list_free(dep_list);
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
390
6981
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
391 if (plugin->native_plugin)
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
392 {
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
393 if (plugin->info != NULL && plugin->info->load != NULL)
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
394 {
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
395 if (!plugin->info->load(plugin))
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
396 return FALSE;
5357
2a1c92df7024 [gaim-migrate @ 5733]
Christian Hammond <chipx86@chipx86.com>
parents: 5270
diff changeset
397 }
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
398 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
399 else {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
400 GaimPlugin *loader;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
401 GaimPluginLoaderInfo *loader_info;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
402
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5646
diff changeset
403 loader = find_loader_for_plugin(plugin);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
404
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
405 if (loader == NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
406 return FALSE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
407
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
408 loader_info = GAIM_PLUGIN_LOADER_INFO(loader);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
409
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
410 if (loader_info->load != NULL)
6981
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
411 {
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
412 if (!loader_info->load(plugin))
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
413 return FALSE;
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
414 }
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
415 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
416
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
417 loaded_plugins = g_list_append(loaded_plugins, plugin);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
418
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
419 plugin->loaded = TRUE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
420
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
421 /* TODO */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
422 if (load_cb != NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
423 load_cb(plugin, load_cb_data);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
424
8993
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8986
diff changeset
425 gaim_signal_emit(gaim_plugins_get_handle(), "plugin-load", plugin);
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
426
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
427 return TRUE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
428
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
429 #else
5449
9442e8d0b21d [gaim-migrate @ 5836]
Luke Schierer <lschiere@pidgin.im>
parents: 5443
diff changeset
430 return TRUE;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
431 #endif /* !GAIM_PLUGINS */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
432 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
433
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
434 gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
435 gaim_plugin_unload(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
436 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
437 #ifdef GAIM_PLUGINS
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
438 g_return_val_if_fail(plugin != NULL, FALSE);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
439
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
440 loaded_plugins = g_list_remove(loaded_plugins, plugin);
11950
2b9ca8861ca5 [gaim-migrate @ 14241]
Mark Doliner <mark@kingant.net>
parents: 11772
diff changeset
441 if ((plugin->info != NULL) && GAIM_IS_PROTOCOL_PLUGIN(plugin))
2b9ca8861ca5 [gaim-migrate @ 14241]
Mark Doliner <mark@kingant.net>
parents: 11772
diff changeset
442 protocol_plugins = g_list_remove(protocol_plugins, plugin);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
443
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
444 g_return_val_if_fail(gaim_plugin_is_loaded(plugin), FALSE);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
445
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
446 gaim_debug_info("plugins", "Unloading plugin %s\n", plugin->info->name);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
447
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
448 /* cancel any pending dialogs the plugin has */
5498
cce2d7868c78 [gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents: 5450
diff changeset
449 gaim_request_close_with_handle(plugin);
cce2d7868c78 [gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents: 5450
diff changeset
450 gaim_notify_close_with_handle(plugin);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
451
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
452 plugin->loaded = FALSE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
453
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
454 if (plugin->native_plugin) {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
455 if (plugin->info->unload != NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
456 plugin->info->unload(plugin);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
457
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
458 if (plugin->info->type == GAIM_PLUGIN_PROTOCOL) {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
459 GaimPluginProtocolInfo *prpl_info;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
460 GList *l;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
461
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
462 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(plugin);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
463
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
464 for (l = prpl_info->user_splits; l != NULL; l = l->next)
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
465 gaim_account_user_split_destroy(l->data);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
466
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
467 for (l = prpl_info->protocol_options; l != NULL; l = l->next)
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
468 gaim_account_option_destroy(l->data);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
469
12117
cb77957d644c [gaim-migrate @ 14417]
Nathan Walp <nwalp@pidgin.im>
parents: 12081
diff changeset
470 if (prpl_info->user_splits != NULL) {
5646
48c63ee49961 [gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents: 5638
diff changeset
471 g_list_free(prpl_info->user_splits);
12117
cb77957d644c [gaim-migrate @ 14417]
Nathan Walp <nwalp@pidgin.im>
parents: 12081
diff changeset
472 prpl_info->user_splits = NULL;
cb77957d644c [gaim-migrate @ 14417]
Nathan Walp <nwalp@pidgin.im>
parents: 12081
diff changeset
473 }
5646
48c63ee49961 [gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents: 5638
diff changeset
474
12117
cb77957d644c [gaim-migrate @ 14417]
Nathan Walp <nwalp@pidgin.im>
parents: 12081
diff changeset
475 if (prpl_info->protocol_options != NULL) {
5646
48c63ee49961 [gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents: 5638
diff changeset
476 g_list_free(prpl_info->protocol_options);
12117
cb77957d644c [gaim-migrate @ 14417]
Nathan Walp <nwalp@pidgin.im>
parents: 12081
diff changeset
477 prpl_info->protocol_options = NULL;
cb77957d644c [gaim-migrate @ 14417]
Nathan Walp <nwalp@pidgin.im>
parents: 12081
diff changeset
478 }
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
479 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
480 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
481 else {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
482 GaimPlugin *loader;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
483 GaimPluginLoaderInfo *loader_info;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
484
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5646
diff changeset
485 loader = find_loader_for_plugin(plugin);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
486
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
487 if (loader == NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
488 return FALSE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
489
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
490 loader_info = GAIM_PLUGIN_LOADER_INFO(loader);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
491
9697
f568b6655331 [gaim-migrate @ 10556]
Christian Hammond <chipx86@chipx86.com>
parents: 9667
diff changeset
492 if (loader_info->unload != NULL)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
493 loader_info->unload(plugin);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
494 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
495
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
496 gaim_signals_disconnect_by_handle(plugin);
6822
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
497 gaim_plugin_ipc_unregister_all(plugin);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
498
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
499 /* TODO */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
500 if (unload_cb != NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
501 unload_cb(plugin, unload_cb_data);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
502
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
503 gaim_signal_emit(gaim_plugins_get_handle(), "plugin-unload", plugin);
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
504
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 9943
diff changeset
505 gaim_prefs_disconnect_by_handle(plugin);
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 9943
diff changeset
506
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
507 return TRUE;
5449
9442e8d0b21d [gaim-migrate @ 5836]
Luke Schierer <lschiere@pidgin.im>
parents: 5443
diff changeset
508 #else
9442e8d0b21d [gaim-migrate @ 5836]
Luke Schierer <lschiere@pidgin.im>
parents: 5443
diff changeset
509 return TRUE;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
510 #endif /* GAIM_PLUGINS */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
511 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
512
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
513 gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
514 gaim_plugin_reload(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
515 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
516 #ifdef GAIM_PLUGINS
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
517 g_return_val_if_fail(plugin != NULL, FALSE);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
518 g_return_val_if_fail(gaim_plugin_is_loaded(plugin), FALSE);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
519
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
520 if (!gaim_plugin_unload(plugin))
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
521 return FALSE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
522
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
523 if (!gaim_plugin_load(plugin))
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
524 return FALSE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
525
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
526 return TRUE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
527 #else
5449
9442e8d0b21d [gaim-migrate @ 5836]
Luke Schierer <lschiere@pidgin.im>
parents: 5443
diff changeset
528 return TRUE;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
529 #endif /* !GAIM_PLUGINS */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
530 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
531
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
532 void
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
533 gaim_plugin_destroy(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
534 {
5449
9442e8d0b21d [gaim-migrate @ 5836]
Luke Schierer <lschiere@pidgin.im>
parents: 5443
diff changeset
535 #ifdef GAIM_PLUGINS
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
536 g_return_if_fail(plugin != NULL);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
537
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
538 if (gaim_plugin_is_loaded(plugin))
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
539 gaim_plugin_unload(plugin);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
540
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
541 plugins = g_list_remove(plugins, plugin);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
542
6981
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
543 if (load_queue != NULL)
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
544 load_queue = g_list_remove(load_queue, plugin);
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
545
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
546 /* true, this may leak a little memory if there is a major version
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
547 * mismatch, but it's a lot better than trying to free something
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
548 * we shouldn't, and crashing while trying to load an old plugin */
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
549 if(plugin->info == NULL || plugin->info->magic != GAIM_PLUGIN_MAGIC ||
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
550 plugin->info->major_version != GAIM_MAJOR_VERSION) {
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
551 if(plugin->handle)
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
552 g_module_close(plugin->handle);
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
553 g_free(plugin);
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
554 return;
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
555 }
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
556
5243
f6e0c689a88b [gaim-migrate @ 5614]
Christian Hammond <chipx86@chipx86.com>
parents: 5242
diff changeset
557 if (plugin->info != NULL && plugin->info->dependencies != NULL)
f6e0c689a88b [gaim-migrate @ 5614]
Christian Hammond <chipx86@chipx86.com>
parents: 5242
diff changeset
558 g_list_free(plugin->info->dependencies);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
559
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
560 if (plugin->native_plugin)
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
561 {
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
562 if (plugin->info != NULL && plugin->info->type == GAIM_PLUGIN_LOADER)
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
563 {
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
564 GaimPluginLoaderInfo *loader_info;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
565 GList *exts, *l, *next_l;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
566 GaimPlugin *p2;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
567
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
568 loader_info = GAIM_PLUGIN_LOADER_INFO(plugin);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
569
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
570 if (loader_info != NULL && loader_info->exts != NULL)
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
571 {
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
572 for (exts = GAIM_PLUGIN_LOADER_INFO(plugin)->exts;
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
573 exts != NULL;
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
574 exts = exts->next) {
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
575
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
576 for (l = gaim_plugins_get_all(); l != NULL; l = next_l)
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
577 {
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
578 next_l = l->next;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
579
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
580 p2 = l->data;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
581
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
582 if (p2->path != NULL &&
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
583 has_file_extension(p2->path, exts->data))
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
584 {
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
585 gaim_plugin_destroy(p2);
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
586 }
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
587 }
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
588 }
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
589
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
590 g_list_free(loader_info->exts);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
591 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
592
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
593 plugin_loaders = g_list_remove(plugin_loaders, plugin);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
594 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
595
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
596 if (plugin->info != NULL && plugin->info->destroy != NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
597 plugin->info->destroy(plugin);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
598
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
599 if (plugin->handle != NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
600 g_module_close(plugin->handle);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
601 }
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
602 else
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
603 {
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
604 GaimPlugin *loader;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
605 GaimPluginLoaderInfo *loader_info;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
606
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5646
diff changeset
607 loader = find_loader_for_plugin(plugin);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
608
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
609 if (loader != NULL)
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
610 {
5941
a3e60ff95b7d [gaim-migrate @ 6381]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
611 loader_info = GAIM_PLUGIN_LOADER_INFO(loader);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
612
5941
a3e60ff95b7d [gaim-migrate @ 6381]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
613 if (loader_info->destroy != NULL)
a3e60ff95b7d [gaim-migrate @ 6381]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
614 loader_info->destroy(plugin);
a3e60ff95b7d [gaim-migrate @ 6381]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
615 }
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
616 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
617
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
618 if (plugin->path != NULL) g_free(plugin->path);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
619 if (plugin->error != NULL) g_free(plugin->error);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
620
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
621 g_free(plugin);
5449
9442e8d0b21d [gaim-migrate @ 5836]
Luke Schierer <lschiere@pidgin.im>
parents: 5443
diff changeset
622 #endif /* !GAIM_PLUGINS */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
623 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
624
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
625 gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
626 gaim_plugin_is_loaded(const GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
627 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
628 g_return_val_if_fail(plugin != NULL, FALSE);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
629
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
630 return plugin->loaded;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
631 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
632
11772
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
633 const gchar *
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
634 gaim_plugin_get_id(const GaimPlugin *plugin) {
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
635 g_return_val_if_fail(plugin, NULL);
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
636 g_return_val_if_fail(plugin->info, NULL);
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
637
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
638 return plugin->info->id;
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
639 }
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
640
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
641 const gchar *
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
642 gaim_plugin_get_name(const GaimPlugin *plugin) {
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
643 g_return_val_if_fail(plugin, NULL);
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
644 g_return_val_if_fail(plugin->info, NULL);
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
645
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
646 return plugin->info->name;
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
647 }
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
648
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
649 const gchar *
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
650 gaim_plugin_get_version(const GaimPlugin *plugin) {
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
651 g_return_val_if_fail(plugin, NULL);
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
652 g_return_val_if_fail(plugin->info, NULL);
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
653
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
654 return plugin->info->version;
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
655 }
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
656
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
657 const gchar *
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
658 gaim_plugin_get_summary(const GaimPlugin *plugin) {
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
659 g_return_val_if_fail(plugin, NULL);
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
660 g_return_val_if_fail(plugin->info, NULL);
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
661
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
662 return plugin->info->summary;
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
663 }
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
664
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
665 const gchar *
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
666 gaim_plugin_get_description(const GaimPlugin *plugin) {
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
667 g_return_val_if_fail(plugin, NULL);
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
668 g_return_val_if_fail(plugin->info, NULL);
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
669
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
670 return plugin->info->description;
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
671 }
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
672
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
673 const gchar *
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
674 gaim_plugin_get_author(const GaimPlugin *plugin) {
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
675 g_return_val_if_fail(plugin, NULL);
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
676 g_return_val_if_fail(plugin->info, NULL);
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
677
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
678 return plugin->info->author;
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
679 }
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
680
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
681 const gchar *
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
682 gaim_plugin_get_homepage(const GaimPlugin *plugin) {
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
683 g_return_val_if_fail(plugin, NULL);
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
684 g_return_val_if_fail(plugin->info, NULL);
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
685
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
686 return plugin->info->homepage;
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
687 }
d1d5f27de95d [gaim-migrate @ 14063]
Gary Kramlich <grim@reaperworld.com>
parents: 11378
diff changeset
688
6822
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
689 /**************************************************************************
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
690 * Plugin IPC
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
691 **************************************************************************/
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
692 static void
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
693 destroy_ipc_info(void *data)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
694 {
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
695 GaimPluginIpcCommand *ipc_command = (GaimPluginIpcCommand *)data;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
696 int i;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
697
9667
22928adecb84 [gaim-migrate @ 10519]
Christian Hammond <chipx86@chipx86.com>
parents: 9018
diff changeset
698 if (ipc_command->params != NULL)
22928adecb84 [gaim-migrate @ 10519]
Christian Hammond <chipx86@chipx86.com>
parents: 9018
diff changeset
699 {
22928adecb84 [gaim-migrate @ 10519]
Christian Hammond <chipx86@chipx86.com>
parents: 9018
diff changeset
700 for (i = 0; i < ipc_command->num_params; i++)
22928adecb84 [gaim-migrate @ 10519]
Christian Hammond <chipx86@chipx86.com>
parents: 9018
diff changeset
701 gaim_value_destroy(ipc_command->params[i]);
22928adecb84 [gaim-migrate @ 10519]
Christian Hammond <chipx86@chipx86.com>
parents: 9018
diff changeset
702
22928adecb84 [gaim-migrate @ 10519]
Christian Hammond <chipx86@chipx86.com>
parents: 9018
diff changeset
703 g_free(ipc_command->params);
22928adecb84 [gaim-migrate @ 10519]
Christian Hammond <chipx86@chipx86.com>
parents: 9018
diff changeset
704 }
6822
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
705
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
706 if (ipc_command->ret_value != NULL)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
707 gaim_value_destroy(ipc_command->ret_value);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
708
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
709 g_free(ipc_command);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
710 }
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
711
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
712 gboolean
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
713 gaim_plugin_ipc_register(GaimPlugin *plugin, const char *command,
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
714 GaimCallback func, GaimSignalMarshalFunc marshal,
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
715 GaimValue *ret_value, int num_params, ...)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
716 {
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
717 GaimPluginIpcInfo *ipc_info;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
718 GaimPluginIpcCommand *ipc_command;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
719
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
720 g_return_val_if_fail(plugin != NULL, FALSE);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
721 g_return_val_if_fail(command != NULL, FALSE);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
722 g_return_val_if_fail(func != NULL, FALSE);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
723 g_return_val_if_fail(marshal != NULL, FALSE);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
724
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
725 if (plugin->ipc_data == NULL)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
726 {
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
727 ipc_info = plugin->ipc_data = g_new0(GaimPluginIpcInfo, 1);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
728 ipc_info->commands = g_hash_table_new_full(g_str_hash, g_str_equal,
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
729 g_free, destroy_ipc_info);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
730 }
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
731 else
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
732 ipc_info = (GaimPluginIpcInfo *)plugin->ipc_data;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
733
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
734 ipc_command = g_new0(GaimPluginIpcCommand, 1);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
735 ipc_command->func = func;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
736 ipc_command->marshal = marshal;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
737 ipc_command->num_params = num_params;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
738 ipc_command->ret_value = ret_value;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
739
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
740 if (num_params > 0)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
741 {
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
742 va_list args;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
743 int i;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
744
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
745 ipc_command->params = g_new0(GaimValue *, num_params);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
746
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
747 va_start(args, num_params);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
748
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
749 for (i = 0; i < num_params; i++)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
750 ipc_command->params[i] = va_arg(args, GaimValue *);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
751
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
752 va_end(args);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
753 }
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
754
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
755 g_hash_table_replace(ipc_info->commands, g_strdup(command), ipc_command);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
756
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
757 ipc_info->command_count++;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
758
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
759 return TRUE;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
760 }
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
761
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
762 void
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
763 gaim_plugin_ipc_unregister(GaimPlugin *plugin, const char *command)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
764 {
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
765 GaimPluginIpcInfo *ipc_info;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
766
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
767 g_return_if_fail(plugin != NULL);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
768 g_return_if_fail(command != NULL);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
769
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
770 ipc_info = (GaimPluginIpcInfo *)plugin->ipc_data;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
771
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
772 if (ipc_info == NULL ||
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
773 g_hash_table_lookup(ipc_info->commands, command) == NULL)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
774 {
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
775 gaim_debug_error("plugins",
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
776 "IPC command '%s' was not registered for plugin %s\n",
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
777 command, plugin->info->name);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
778 return;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
779 }
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
780
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
781 g_hash_table_remove(ipc_info->commands, command);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
782
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
783 ipc_info->command_count--;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
784
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
785 if (ipc_info->command_count == 0)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
786 {
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
787 g_hash_table_destroy(ipc_info->commands);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
788 g_free(ipc_info);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
789
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
790 plugin->ipc_data = NULL;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
791 }
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
792 }
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
793
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
794 void
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
795 gaim_plugin_ipc_unregister_all(GaimPlugin *plugin)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
796 {
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
797 GaimPluginIpcInfo *ipc_info;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
798
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
799 g_return_if_fail(plugin != NULL);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
800
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
801 if (plugin->ipc_data == NULL)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
802 return; /* Silently ignore it. */
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
803
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
804 ipc_info = (GaimPluginIpcInfo *)plugin->ipc_data;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
805
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
806 g_hash_table_destroy(ipc_info->commands);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
807 g_free(ipc_info);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
808
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
809 plugin->ipc_data = NULL;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
810 }
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
811
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
812 gboolean
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
813 gaim_plugin_ipc_get_params(GaimPlugin *plugin, const char *command,
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
814 GaimValue **ret_value, int *num_params,
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
815 GaimValue ***params)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
816 {
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
817 GaimPluginIpcInfo *ipc_info;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
818 GaimPluginIpcCommand *ipc_command;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
819
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
820 g_return_val_if_fail(plugin != NULL, FALSE);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
821 g_return_val_if_fail(command != NULL, FALSE);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
822
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
823 ipc_info = (GaimPluginIpcInfo *)plugin->ipc_data;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
824
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
825 if (ipc_info == NULL ||
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
826 (ipc_command = g_hash_table_lookup(ipc_info->commands,
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
827 command)) == NULL)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
828 {
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
829 gaim_debug_error("plugins",
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
830 "IPC command '%s' was not registered for plugin %s\n",
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
831 command, plugin->info->name);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
832
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
833 return FALSE;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
834 }
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
835
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
836 if (num_params != NULL)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
837 *num_params = ipc_command->num_params;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
838
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
839 if (params != NULL)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
840 *params = ipc_command->params;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
841
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
842 if (ret_value != NULL)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
843 *ret_value = ipc_command->ret_value;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
844
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
845 return TRUE;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
846 }
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
847
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
848 void *
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
849 gaim_plugin_ipc_call(GaimPlugin *plugin, const char *command,
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
850 gboolean *ok, ...)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
851 {
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
852 GaimPluginIpcInfo *ipc_info;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
853 GaimPluginIpcCommand *ipc_command;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
854 va_list args;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
855 void *ret_value;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
856
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
857 if (ok != NULL)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
858 *ok = FALSE;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
859
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
860 g_return_val_if_fail(plugin != NULL, NULL);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
861 g_return_val_if_fail(command != NULL, NULL);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
862
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
863 ipc_info = (GaimPluginIpcInfo *)plugin->ipc_data;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
864
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
865 if (ipc_info == NULL ||
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
866 (ipc_command = g_hash_table_lookup(ipc_info->commands,
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
867 command)) == NULL)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
868 {
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
869 gaim_debug_error("plugins",
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
870 "IPC command '%s' was not registered for plugin %s\n",
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
871 command, plugin->info->name);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
872
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
873 return NULL;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
874 }
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
875
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
876 va_start(args, ok);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
877 ipc_command->marshal(ipc_command->func, args, NULL, &ret_value);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
878 va_end(args);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
879
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
880 if (ok != NULL)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
881 *ok = TRUE;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
882
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
883 return ret_value;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
884 }
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
885
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
886 /**************************************************************************
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
887 * Plugins subsystem
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
888 **************************************************************************/
10479
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
889 void *
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
890 gaim_plugins_get_handle(void) {
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
891 static int handle;
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
892
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
893 return &handle;
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
894 }
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
895
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
896 void
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
897 gaim_plugins_init(void) {
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
898 void *handle = gaim_plugins_get_handle();
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
899
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
900 gaim_signal_register(handle, "plugin-load",
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
901 gaim_marshal_VOID__POINTER,
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
902 NULL, 1,
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
903 gaim_value_new(GAIM_TYPE_SUBTYPE,
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
904 GAIM_SUBTYPE_PLUGIN));
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
905 gaim_signal_register(handle, "plugin-unload",
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
906 gaim_marshal_VOID__POINTER,
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
907 NULL, 1,
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
908 gaim_value_new(GAIM_TYPE_SUBTYPE,
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
909 GAIM_SUBTYPE_PLUGIN));
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
910 }
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
911
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
912 void
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
913 gaim_plugins_uninit(void) {
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
914 gaim_signals_disconnect_by_handle(gaim_plugins_get_handle());
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
915 }
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
916
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
917 /**************************************************************************
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
918 * Plugins API
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10464
diff changeset
919 **************************************************************************/
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
920 void
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
921 gaim_plugins_add_search_path(const char *path)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
922 {
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
923 g_return_if_fail(path != NULL);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
924
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
925 if (g_list_find_custom(search_paths, path, (GCompareFunc)strcmp))
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
926 return;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
927
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
928 search_paths = g_list_append(search_paths, strdup(path));
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
929 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
930
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
931 void
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
932 gaim_plugins_unload_all(void)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
933 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
934 #ifdef GAIM_PLUGINS
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
935
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
936 while (loaded_plugins != NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
937 gaim_plugin_unload(loaded_plugins->data);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
938
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
939 #endif /* GAIM_PLUGINS */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
940 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
941
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
942 void
5242
fd81a00480ac [gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents: 5211
diff changeset
943 gaim_plugins_destroy_all(void)
fd81a00480ac [gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents: 5211
diff changeset
944 {
fd81a00480ac [gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents: 5211
diff changeset
945 #ifdef GAIM_PLUGINS
fd81a00480ac [gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents: 5211
diff changeset
946
fd81a00480ac [gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents: 5211
diff changeset
947 while (plugins != NULL)
fd81a00480ac [gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents: 5211
diff changeset
948 gaim_plugin_destroy(plugins->data);
fd81a00480ac [gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents: 5211
diff changeset
949
fd81a00480ac [gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents: 5211
diff changeset
950 #endif /* GAIM_PLUGINS */
fd81a00480ac [gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents: 5211
diff changeset
951 }
5838
6aa7651c7c15 [gaim-migrate @ 6269]
Nathan Walp <nwalp@pidgin.im>
parents: 5794
diff changeset
952
6aa7651c7c15 [gaim-migrate @ 6269]
Nathan Walp <nwalp@pidgin.im>
parents: 5794
diff changeset
953 void
5949
90d0849abd3c [gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents: 5941
diff changeset
954 gaim_plugins_load_saved(const char *key)
5838
6aa7651c7c15 [gaim-migrate @ 6269]
Nathan Walp <nwalp@pidgin.im>
parents: 5794
diff changeset
955 {
6aa7651c7c15 [gaim-migrate @ 6269]
Nathan Walp <nwalp@pidgin.im>
parents: 5794
diff changeset
956 #ifdef GAIM_PLUGINS
5949
90d0849abd3c [gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents: 5941
diff changeset
957 GList *f, *files;
90d0849abd3c [gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents: 5941
diff changeset
958
90d0849abd3c [gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents: 5941
diff changeset
959 g_return_if_fail(key != NULL);
5838
6aa7651c7c15 [gaim-migrate @ 6269]
Nathan Walp <nwalp@pidgin.im>
parents: 5794
diff changeset
960
5949
90d0849abd3c [gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents: 5941
diff changeset
961 files = gaim_prefs_get_string_list(key);
90d0849abd3c [gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents: 5941
diff changeset
962
7033
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
963 for (f = files; f; f = f->next)
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
964 {
10682
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
965 char *filename;
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
966 char *basename;
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
967 GaimPlugin *plugin;
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
968
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
969 if (f->data == NULL)
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
970 continue;
7033
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
971
10682
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
972 filename = f->data;
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
973 /*
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
974 * We don't know if the filename uses Windows or Unix path
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
975 * separators (because people might be sharing a prefs.xml
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
976 * file across systems), so we find the last occurrence
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
977 * of either.
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
978 */
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
979 basename = strrchr(filename, '/');
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
980 if ((basename == NULL) || (basename < strrchr(filename, '\\')))
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
981 basename = strrchr(filename, '\\');
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
982 if (basename != NULL)
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
983 basename++;
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
984
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
985 if ((plugin = gaim_plugins_find_with_filename(filename)) != NULL)
7033
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
986 {
10682
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
987 gaim_debug_info("plugins", "Loading saved plugin %s\n",
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
988 plugin->path);
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
989 gaim_plugin_load(plugin);
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
990 }
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
991 else if ((plugin = gaim_plugins_find_with_basename(basename)) != NULL)
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
992 {
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
993 gaim_debug_info("plugins", "Loading saved plugin %s\n",
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
994 plugin->path);
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
995 gaim_plugin_load(plugin);
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
996 }
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
997 else
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
998 {
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
999 gaim_debug_error("plugins", "Unable to find saved plugin %s\n",
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
1000 filename);
7033
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1001 }
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1002
5838
6aa7651c7c15 [gaim-migrate @ 6269]
Nathan Walp <nwalp@pidgin.im>
parents: 5794
diff changeset
1003 g_free(f->data);
6aa7651c7c15 [gaim-migrate @ 6269]
Nathan Walp <nwalp@pidgin.im>
parents: 5794
diff changeset
1004 }
6aa7651c7c15 [gaim-migrate @ 6269]
Nathan Walp <nwalp@pidgin.im>
parents: 5794
diff changeset
1005
6aa7651c7c15 [gaim-migrate @ 6269]
Nathan Walp <nwalp@pidgin.im>
parents: 5794
diff changeset
1006 g_list_free(files);
6aa7651c7c15 [gaim-migrate @ 6269]
Nathan Walp <nwalp@pidgin.im>
parents: 5794
diff changeset
1007 #endif /* GAIM_PLUGINS */
6aa7651c7c15 [gaim-migrate @ 6269]
Nathan Walp <nwalp@pidgin.im>
parents: 5794
diff changeset
1008 }
6aa7651c7c15 [gaim-migrate @ 6269]
Nathan Walp <nwalp@pidgin.im>
parents: 5794
diff changeset
1009
6aa7651c7c15 [gaim-migrate @ 6269]
Nathan Walp <nwalp@pidgin.im>
parents: 5794
diff changeset
1010
5242
fd81a00480ac [gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents: 5211
diff changeset
1011 void
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1012 gaim_plugins_probe(const char *ext)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1013 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1014 #ifdef GAIM_PLUGINS
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1015 GDir *dir;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1016 const gchar *file;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1017 gchar *path;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1018 GaimPlugin *plugin;
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
1019 GList *cur;
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
1020 const char *search_path;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1021
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1022 if (!g_module_supported())
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1023 return;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1024
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
1025 /* Probe plugins */
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
1026 for (cur = search_paths; cur != NULL; cur = cur->next)
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
1027 {
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
1028 search_path = cur->data;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1029
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
1030 dir = g_dir_open(search_path, 0, NULL);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1031
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
1032 if (dir != NULL)
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
1033 {
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
1034 while ((file = g_dir_read_name(dir)) != NULL)
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
1035 {
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
1036 path = g_build_filename(search_path, file, NULL);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1037
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
1038 if (ext == NULL || has_file_extension(file, ext))
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1039 plugin = gaim_plugin_probe(path);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1040
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1041 g_free(path);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1042 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1043
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1044 g_dir_close(dir);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1045 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1046 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1047
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
1048 /* See if we have any plugins waiting to load */
6981
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1049 while (load_queue != NULL)
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1050 {
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1051 plugin = (GaimPlugin *)load_queue->data;
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1052
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1053 load_queue = g_list_remove(load_queue, plugin);
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1054
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1055 if (plugin == NULL || plugin->info == NULL)
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1056 continue;
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1057
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1058 if (plugin->info->type == GAIM_PLUGIN_LOADER)
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1059 {
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1060 /* We'll just load this right now. */
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1061 if (!gaim_plugin_load(plugin))
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1062 {
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1063 gaim_plugin_destroy(plugin);
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1064
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1065 continue;
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1066 }
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1067
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1068 plugin_loaders = g_list_append(plugin_loaders, plugin);
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1069
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
1070 for (cur = GAIM_PLUGIN_LOADER_INFO(plugin)->exts;
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
1071 cur != NULL;
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
1072 cur = cur->next)
6981
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1073 {
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
1074 gaim_plugins_probe(cur->data);
6981
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1075 }
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1076 }
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1077 else if (plugin->info->type == GAIM_PLUGIN_PROTOCOL)
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1078 {
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1079 /* We'll just load this right now. */
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1080 if (!gaim_plugin_load(plugin))
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1081 {
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1082 gaim_plugin_destroy(plugin);
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1083
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1084 continue;
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1085 }
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1086
11950
2b9ca8861ca5 [gaim-migrate @ 14241]
Mark Doliner <mark@kingant.net>
parents: 11772
diff changeset
1087 /* Make sure we don't load two PRPLs with the same name? */
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7279
diff changeset
1088 if (gaim_find_prpl(plugin->info->id))
6981
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1089 {
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1090 /* Nothing to see here--move along, move along */
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1091 gaim_plugin_destroy(plugin);
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1092
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1093 continue;
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1094 }
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1095
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1096 protocol_plugins = g_list_insert_sorted(protocol_plugins, plugin,
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1097 (GCompareFunc)compare_prpl);
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1098 }
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1099 }
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1100
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1101 if (probe_cb != NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1102 probe_cb(probe_cb_data);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1103 #endif /* GAIM_PLUGINS */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1104 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1105
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1106 gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1107 gaim_plugin_register(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1108 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1109 g_return_val_if_fail(plugin != NULL, FALSE);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1110
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
1111 /* If this plugin has been registered already then exit */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1112 if (g_list_find(plugins, plugin))
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1113 return TRUE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1114
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
1115 /* Ensure the plugin has the requisite information */
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
1116 if (plugin->info->type == GAIM_PLUGIN_LOADER)
6981
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1117 {
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
1118 GaimPluginLoaderInfo *loader_info;
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
1119
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
1120 loader_info = GAIM_PLUGIN_LOADER_INFO(plugin);
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
1121
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
1122 if (loader_info == NULL)
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
1123 {
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
1124 gaim_debug_error("plugins", "%s is unloadable\n",
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
1125 plugin->path);
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
1126 return FALSE;
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
1127 }
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
1128 }
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
1129 else if (plugin->info->type == GAIM_PLUGIN_PROTOCOL)
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
1130 {
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
1131 GaimPluginProtocolInfo *prpl_info;
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
1132
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
1133 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(plugin);
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
1134
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
1135 if (prpl_info == NULL)
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
1136 {
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
1137 gaim_debug_error("plugins", "%s is unloadable\n",
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
1138 plugin->path);
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
1139 return FALSE;
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
1140 }
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
1141 }
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
1142
11950
2b9ca8861ca5 [gaim-migrate @ 14241]
Mark Doliner <mark@kingant.net>
parents: 11772
diff changeset
1143 #ifdef GAIM_PLUGINS
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
1144 /* This plugin should be probed and maybe loaded--add it to the queue */
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10279
diff changeset
1145 load_queue = g_list_append(load_queue, plugin);
11950
2b9ca8861ca5 [gaim-migrate @ 14241]
Mark Doliner <mark@kingant.net>
parents: 11772
diff changeset
1146 #else
12081
5a08737f76c6 [gaim-migrate @ 14378]
Mark Doliner <mark@kingant.net>
parents: 12077
diff changeset
1147 if (plugin->info != NULL)
5a08737f76c6 [gaim-migrate @ 14378]
Mark Doliner <mark@kingant.net>
parents: 12077
diff changeset
1148 {
5a08737f76c6 [gaim-migrate @ 14378]
Mark Doliner <mark@kingant.net>
parents: 12077
diff changeset
1149 if (plugin->info->type == GAIM_PLUGIN_PROTOCOL)
5a08737f76c6 [gaim-migrate @ 14378]
Mark Doliner <mark@kingant.net>
parents: 12077
diff changeset
1150 protocol_plugins = g_list_insert_sorted(protocol_plugins, plugin,
5a08737f76c6 [gaim-migrate @ 14378]
Mark Doliner <mark@kingant.net>
parents: 12077
diff changeset
1151 (GCompareFunc)compare_prpl);
5a08737f76c6 [gaim-migrate @ 14378]
Mark Doliner <mark@kingant.net>
parents: 12077
diff changeset
1152 if (plugin->info->load != NULL)
5a08737f76c6 [gaim-migrate @ 14378]
Mark Doliner <mark@kingant.net>
parents: 12077
diff changeset
1153 if (!plugin->info->load(plugin))
5a08737f76c6 [gaim-migrate @ 14378]
Mark Doliner <mark@kingant.net>
parents: 12077
diff changeset
1154 return FALSE;
5a08737f76c6 [gaim-migrate @ 14378]
Mark Doliner <mark@kingant.net>
parents: 12077
diff changeset
1155 }
11950
2b9ca8861ca5 [gaim-migrate @ 14241]
Mark Doliner <mark@kingant.net>
parents: 11772
diff changeset
1156 #endif
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1157
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1158 plugins = g_list_append(plugins, plugin);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1159
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1160 return TRUE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1161 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1162
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1163 gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1164 gaim_plugins_enabled(void)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1165 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1166 #ifdef GAIM_PLUGINS
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1167 return TRUE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1168 #else
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1169 return FALSE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1170 #endif
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1171 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1172
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1173 void
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1174 gaim_plugins_register_probe_notify_cb(void (*func)(void *), void *data)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1175 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1176 /* TODO */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1177 probe_cb = func;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1178 probe_cb_data = data;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1179 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1180
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1181 void
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1182 gaim_plugins_unregister_probe_notify_cb(void (*func)(void *))
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1183 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1184 /* TODO */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1185 probe_cb = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1186 probe_cb_data = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1187 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1188
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1189 void
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1190 gaim_plugins_register_load_notify_cb(void (*func)(GaimPlugin *, void *),
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1191 void *data)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1192 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1193 /* TODO */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1194 load_cb = func;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1195 load_cb_data = data;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1196 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1197
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1198 void
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1199 gaim_plugins_unregister_load_notify_cb(void (*func)(GaimPlugin *, void *))
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1200 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1201 /* TODO */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1202 load_cb = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1203 load_cb_data = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1204 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1206 void
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1207 gaim_plugins_register_unload_notify_cb(void (*func)(GaimPlugin *, void *),
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1208 void *data)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1209 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1210 /* TODO */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1211 unload_cb = func;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1212 unload_cb_data = data;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1213 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1214
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1215 void
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1216 gaim_plugins_unregister_unload_notify_cb(void (*func)(GaimPlugin *, void *))
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1217 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1218 /* TODO */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1219 unload_cb = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1220 unload_cb_data = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1221 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1222
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1223 GaimPlugin *
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1224 gaim_plugins_find_with_name(const char *name)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1225 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1226 GaimPlugin *plugin;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1227 GList *l;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1228
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1229 for (l = plugins; l != NULL; l = l->next) {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1230 plugin = l->data;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1231
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1232 if (!strcmp(plugin->info->name, name))
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1233 return plugin;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1234 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1235
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1236 return NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1237 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1238
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1239 GaimPlugin *
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1240 gaim_plugins_find_with_filename(const char *filename)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1241 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1242 GaimPlugin *plugin;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1243 GList *l;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1244
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1245 for (l = plugins; l != NULL; l = l->next) {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1246 plugin = l->data;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1247
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1248 if (plugin->path != NULL && !strcmp(plugin->path, filename))
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1249 return plugin;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1250 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1251
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1252 return NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1253 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1254
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1255 GaimPlugin *
7033
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1256 gaim_plugins_find_with_basename(const char *basename)
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1257 {
11950
2b9ca8861ca5 [gaim-migrate @ 14241]
Mark Doliner <mark@kingant.net>
parents: 11772
diff changeset
1258 #ifdef GAIM_PLUGINS
7033
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1259 GaimPlugin *plugin;
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1260 GList *l;
10682
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
1261 char *basename_no_ext;
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
1262 char *tmp;
7033
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1263
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1264 g_return_val_if_fail(basename != NULL, NULL);
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1265
10682
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
1266 basename_no_ext = gaim_plugin_get_basename(basename);
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
1267
7033
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1268 for (l = plugins; l != NULL; l = l->next)
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1269 {
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1270 plugin = (GaimPlugin *)l->data;
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1271
7278
6d5dc6a65c47 [gaim-migrate @ 7857]
Sean Egan <seanegan@gmail.com>
parents: 7033
diff changeset
1272 if (plugin->path != NULL) {
10682
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
1273 tmp = gaim_plugin_get_basename(plugin->path);
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
1274 if (!strcmp(tmp, basename_no_ext))
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
1275 {
7278
6d5dc6a65c47 [gaim-migrate @ 7857]
Sean Egan <seanegan@gmail.com>
parents: 7033
diff changeset
1276 g_free(tmp);
10682
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
1277 g_free(basename_no_ext);
7033
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1278 return plugin;
7278
6d5dc6a65c47 [gaim-migrate @ 7857]
Sean Egan <seanegan@gmail.com>
parents: 7033
diff changeset
1279 }
7279
0d24c94e4fbc [gaim-migrate @ 7858]
Nathan Walp <nwalp@pidgin.im>
parents: 7278
diff changeset
1280 g_free(tmp);
7033
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1281 }
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1282 }
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1283
10682
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
1284 g_free(basename_no_ext);
11950
2b9ca8861ca5 [gaim-migrate @ 14241]
Mark Doliner <mark@kingant.net>
parents: 11772
diff changeset
1285 #endif /* GAIM_PLUGINS */
10682
c604c88a7530 [gaim-migrate @ 12228]
Mark Doliner <mark@kingant.net>
parents: 10504
diff changeset
1286
7033
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1287 return NULL;
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1288 }
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1289
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1290 GaimPlugin *
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1291 gaim_plugins_find_with_id(const char *id)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1292 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1293 GaimPlugin *plugin;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1294 GList *l;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1295
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1296 g_return_val_if_fail(id != NULL, NULL);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1297
6486
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
1298 for (l = plugins; l != NULL; l = l->next)
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
1299 {
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1300 plugin = l->data;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1301
6486
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
1302 if (plugin->info->id != NULL && !strcmp(plugin->info->id, id))
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1303 return plugin;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1304 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1305
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1306 return NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1307 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1308
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1309 GList *
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1310 gaim_plugins_get_loaded(void)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1311 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1312 return loaded_plugins;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1313 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1314
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1315 GList *
5573
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
1316 gaim_plugins_get_protocols(void)
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
1317 {
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
1318 return protocol_plugins;
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
1319 }
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
1320
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
1321 GList *
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1322 gaim_plugins_get_all(void)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1323 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1324 return plugins;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1325 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1326
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
1327
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
1328 GaimPluginAction *
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
1329 gaim_plugin_action_new(char* label, void (*callback)(GaimPluginAction *))
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
1330 {
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
1331 GaimPluginAction *act = g_new0(GaimPluginAction, 1);
9018
bb168141eb5f [gaim-migrate @ 9794]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
1332
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
1333 act->label = label;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
1334 act->callback = callback;
9018
bb168141eb5f [gaim-migrate @ 9794]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
1335
bb168141eb5f [gaim-migrate @ 9794]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
1336 return act;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
1337 }