annotate src/plugin.c @ 10007:267a2b69e36e

[gaim-migrate @ 10924] Better i18nability and more uniform code? committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 10 Sep 2004 04:30:37 +0000
parents f8e395a054e2
children 9fdbfe832fac
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
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33 #ifdef _WIN32
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34 # define PLUGIN_EXT ".dll"
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35 #else
6639
1b91cb6be4c3 [gaim-migrate @ 7164]
Luke Schierer <lschiere@pidgin.im>
parents: 6635
diff changeset
36 #ifdef __hpux
1b91cb6be4c3 [gaim-migrate @ 7164]
Luke Schierer <lschiere@pidgin.im>
parents: 6635
diff changeset
37 # define PLUGIN_EXT ".sl"
1b91cb6be4c3 [gaim-migrate @ 7164]
Luke Schierer <lschiere@pidgin.im>
parents: 6635
diff changeset
38 #else
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
39 # define PLUGIN_EXT ".so"
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40 #endif
6639
1b91cb6be4c3 [gaim-migrate @ 7164]
Luke Schierer <lschiere@pidgin.im>
parents: 6635
diff changeset
41 #endif
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42
6822
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
43 typedef struct
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 GHashTable *commands;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
46 size_t command_count;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
47
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
48 } GaimPluginIpcInfo;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
49
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
50 typedef struct
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
51 {
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
52 GaimCallback func;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
53 GaimSignalMarshalFunc marshal;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
54
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
55 int num_params;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
56 GaimValue **params;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
57 GaimValue *ret_value;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
58
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
59 } GaimPluginIpcCommand;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
60
6981
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
61 static GList *loaded_plugins = NULL;
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
62 static GList *plugins = NULL;
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
63 static GList *plugin_loaders = NULL;
5573
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
64 static GList *protocol_plugins = NULL;
6981
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
65 static GList *load_queue = NULL;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
67 static size_t search_path_count = 0;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68 static char **search_paths = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 static void (*probe_cb)(void *) = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71 static void *probe_cb_data = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 static void (*load_cb)(GaimPlugin *, void *) = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73 static void *load_cb_data = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74 static void (*unload_cb)(GaimPlugin *, void *) = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
75 static void *unload_cb_data = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
77
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
78 void *
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
79 gaim_plugins_get_handle(void)
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
80 {
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
81 static int handle;
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
82 return &handle;
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
83 }
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
84
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
85
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
86 #ifdef GAIM_PLUGINS
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87 static int
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88 is_so_file(const char *filename, const char *ext)
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 int len, extlen;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
91
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
92 if (filename == NULL || *filename == '\0' || ext == NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
93 return 0;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
94
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
95 extlen = strlen(ext);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
96 len = strlen(filename) - extlen;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
97
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
98 if (len < 0)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
99 return 0;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
100
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
101 return (!strncmp(filename + len, ext, extlen));
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
102 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
103
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
104 static gboolean
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5646
diff changeset
105 loader_supports_file(GaimPlugin *loader, const char *filename)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
106 {
6432
f9428d38c03b [gaim-migrate @ 6940]
Luke Schierer <lschiere@pidgin.im>
parents: 5981
diff changeset
107 GList *exts;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
108
6432
f9428d38c03b [gaim-migrate @ 6940]
Luke Schierer <lschiere@pidgin.im>
parents: 5981
diff changeset
109 for (exts = GAIM_PLUGIN_LOADER_INFO(loader)->exts; exts != NULL; exts = exts->next) {
f9428d38c03b [gaim-migrate @ 6940]
Luke Schierer <lschiere@pidgin.im>
parents: 5981
diff changeset
110 if (is_so_file(filename, (char *)exts->data)) {
f9428d38c03b [gaim-migrate @ 6940]
Luke Schierer <lschiere@pidgin.im>
parents: 5981
diff changeset
111 return TRUE;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
112 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
113 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
114
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
115 return FALSE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
116 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
117
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
118 static GaimPlugin *
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5646
diff changeset
119 find_loader_for_plugin(const GaimPlugin *plugin)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
120 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
121 GaimPlugin *loader;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
122 GList *l;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
123
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
124 if (plugin->path == NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
125 return NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
126
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
127 for (l = gaim_plugins_get_loaded(); l != NULL; l = l->next) {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
128 loader = l->data;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
129
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
130 if (loader->info->type == GAIM_PLUGIN_LOADER &&
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5646
diff changeset
131 loader_supports_file(loader, plugin->path)) {
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 return loader;
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
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
136 loader = NULL;
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
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
139 return NULL;
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
5449
9442e8d0b21d [gaim-migrate @ 5836]
Luke Schierer <lschiere@pidgin.im>
parents: 5443
diff changeset
142 #endif /* GAIM_PLUGINS */
9442e8d0b21d [gaim-migrate @ 5836]
Luke Schierer <lschiere@pidgin.im>
parents: 5443
diff changeset
143
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
144 static gint
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
145 compare_prpl(GaimPlugin *a, GaimPlugin *b)
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 /* neg if a before b, 0 if equal, pos if a after b */
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7279
diff changeset
148 if(GAIM_IS_PROTOCOL_PLUGIN(a)) {
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7279
diff changeset
149 if(GAIM_IS_PROTOCOL_PLUGIN(b))
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7279
diff changeset
150 return strcmp(a->info->name, b->info->name);
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7279
diff changeset
151 else
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7279
diff changeset
152 return -1;
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7279
diff changeset
153 } else {
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7279
diff changeset
154 if(GAIM_IS_PROTOCOL_PLUGIN(b))
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7279
diff changeset
155 return 1;
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7279
diff changeset
156 else
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7279
diff changeset
157 return 0;
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7279
diff changeset
158 }
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
159 }
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 GaimPlugin *
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
162 gaim_plugin_new(gboolean native, const char *path)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
163 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
164 GaimPlugin *plugin;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
165
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
166 plugin = g_new0(GaimPlugin, 1);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
167
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
168 plugin->native_plugin = native;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
169 plugin->path = (path == NULL ? NULL : g_strdup(path));
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
170
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
171 return plugin;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
172 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
173
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
174 GaimPlugin *
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
175 gaim_plugin_probe(const char *filename)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
176 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
177 #ifdef GAIM_PLUGINS
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
178 GaimPlugin *plugin = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
179 GaimPlugin *loader;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
180 gboolean (*gaim_init_plugin)(GaimPlugin *);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
181
6981
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
182 gaim_debug_misc("plugins", "probing %s\n", filename);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
183 g_return_val_if_fail(filename != NULL, NULL);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
184
5973
53782414bc3a [gaim-migrate @ 6420]
Mark Doliner <mark@kingant.net>
parents: 5949
diff changeset
185 if (!g_file_test(filename, G_FILE_TEST_EXISTS))
53782414bc3a [gaim-migrate @ 6420]
Mark Doliner <mark@kingant.net>
parents: 5949
diff changeset
186 return NULL;
53782414bc3a [gaim-migrate @ 6420]
Mark Doliner <mark@kingant.net>
parents: 5949
diff changeset
187
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
188 plugin = gaim_plugins_find_with_filename(filename);
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 if (plugin != NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
191 return plugin;
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 plugin = gaim_plugin_new(is_so_file(filename, PLUGIN_EXT), filename);
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 if (plugin->native_plugin) {
5450
bb1e160467b6 [gaim-migrate @ 5838]
Nathan Walp <nwalp@pidgin.im>
parents: 5449
diff changeset
196 const char *error;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
197 plugin->handle = g_module_open(filename, 0);
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 if (plugin->handle == NULL) {
5443
07358c067495 [gaim-migrate @ 5825]
Nathan Walp <nwalp@pidgin.im>
parents: 5436
diff changeset
200 error = g_module_error();
5269
cd7e4ba049f9 [gaim-migrate @ 5641]
Christian Hammond <chipx86@chipx86.com>
parents: 5268
diff changeset
201 gaim_debug(GAIM_DEBUG_ERROR, "plugins", "%s is unloadable: %s\n",
5443
07358c067495 [gaim-migrate @ 5825]
Nathan Walp <nwalp@pidgin.im>
parents: 5436
diff changeset
202 plugin->path, error ? error : "Unknown error.");
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
203
5269
cd7e4ba049f9 [gaim-migrate @ 5641]
Christian Hammond <chipx86@chipx86.com>
parents: 5268
diff changeset
204 gaim_plugin_destroy(plugin);
cd7e4ba049f9 [gaim-migrate @ 5641]
Christian Hammond <chipx86@chipx86.com>
parents: 5268
diff changeset
205
cd7e4ba049f9 [gaim-migrate @ 5641]
Christian Hammond <chipx86@chipx86.com>
parents: 5268
diff changeset
206 return NULL;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
207 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
208
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
209 if (!g_module_symbol(plugin->handle, "gaim_init_plugin",
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
210 (gpointer *)&gaim_init_plugin)) {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
211 g_module_close(plugin->handle);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
212 plugin->handle = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
213
5443
07358c067495 [gaim-migrate @ 5825]
Nathan Walp <nwalp@pidgin.im>
parents: 5436
diff changeset
214 error = g_module_error();
5211
0241d6b6702d [gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
215 gaim_debug(GAIM_DEBUG_ERROR, "plugins", "%s is unloadable: %s\n",
5443
07358c067495 [gaim-migrate @ 5825]
Nathan Walp <nwalp@pidgin.im>
parents: 5436
diff changeset
216 plugin->path, error ? error : "Unknown error.");
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 gaim_plugin_destroy(plugin);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
219
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
220 return NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
221 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
222 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
223 else {
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5646
diff changeset
224 loader = find_loader_for_plugin(plugin);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
225
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
226 if (loader == NULL) {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
227 gaim_plugin_destroy(plugin);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
228
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
229 return NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
230 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
231
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
232 gaim_init_plugin = GAIM_PLUGIN_LOADER_INFO(loader)->probe;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
233 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
234
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
235 plugin->error = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
236
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
237 if (!gaim_init_plugin(plugin) || plugin->info == NULL) {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
238 gaim_plugin_destroy(plugin);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
239
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
240 return NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
241 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
242
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
243 if (plugin->info->magic != GAIM_PLUGIN_MAGIC ||
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
244 plugin->info->major_version != GAIM_MAJOR_VERSION ||
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
245 plugin->info->minor_version > GAIM_MINOR_VERSION)
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
246 {
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
247 gaim_debug(GAIM_DEBUG_ERROR, "plugins", "%s is unloadable: API version mismatch %d.%d.x (need %d.%d.x)\n",
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
248 plugin->path, plugin->info->major_version, plugin->info->minor_version, GAIM_MAJOR_VERSION, GAIM_MINOR_VERSION);
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
249 gaim_plugin_destroy(plugin);
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
250 return NULL;
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
251 }
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
252
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
253 return plugin;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
254 #else
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
255 return NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
256 #endif /* !GAIM_PLUGINS */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
257 }
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 gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
260 gaim_plugin_load(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
261 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
262 #ifdef GAIM_PLUGINS
6486
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
263 GList *dep_list = NULL;
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
264 GList *l;
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
265
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
266 g_return_val_if_fail(plugin != NULL, FALSE);
5270
d1fe8e320dab [gaim-migrate @ 5642]
Christian Hammond <chipx86@chipx86.com>
parents: 5269
diff changeset
267 g_return_val_if_fail(plugin->error == NULL, FALSE);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
268
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
269 if (gaim_plugin_is_loaded(plugin))
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
270 return TRUE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
271
6486
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
272 /*
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
273 * Go through the list of the plugin's dependencies.
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
274 *
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
275 * First pass: Make sure all the plugins needed are probed.
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
276 */
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
277 for (l = plugin->info->dependencies; l != NULL; l = l->next)
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
278 {
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
279 const char *dep_name = (const char *)l->data;
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
280 GaimPlugin *dep_plugin;
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
281
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
282 dep_plugin = gaim_plugins_find_with_id(dep_name);
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
283
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
284 if (dep_plugin == NULL)
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
285 {
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
286 char buf[BUFSIZ];
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
287
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
288 g_snprintf(buf, sizeof(buf),
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
289 _("The required plugin %s was not found. "
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
290 "Please install this plugin and try again."),
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
291 dep_name);
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
292
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
293 gaim_notify_error(NULL, NULL,
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
294 _("Gaim was unable to load your plugin."),
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
295 buf);
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
296
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
297 if (dep_list != NULL)
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
298 g_list_free(dep_list);
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
299
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
300 return FALSE;
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
301 }
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
302
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
303 dep_list = g_list_append(dep_list, dep_plugin);
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
304 }
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
305
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
306 /* Second pass: load all the required plugins. */
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
307 for (l = dep_list; l != NULL; l = l->next)
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
308 {
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
309 GaimPlugin *dep_plugin = (GaimPlugin *)l->data;
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
310
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
311 if (!gaim_plugin_is_loaded(dep_plugin))
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
312 {
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
313 if (!gaim_plugin_load(dep_plugin))
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
314 {
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
315 char buf[BUFSIZ];
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
316
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
317 g_snprintf(buf, sizeof(buf),
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
318 _("The required plugin %s was unable to load."),
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
319 plugin->info->name);
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
320
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
321 gaim_notify_error(NULL, NULL,
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
322 _("Gaim was unable to load your plugin."),
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
323 buf);
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
324
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
325 if (dep_list != NULL)
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
326 g_list_free(dep_list);
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 return FALSE;
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 }
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
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
333 if (dep_list != NULL)
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
334 g_list_free(dep_list);
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
335
6981
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
336 if (plugin->native_plugin)
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
337 {
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
338 if (plugin->info != NULL && plugin->info->load != NULL)
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
339 {
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
340 if (!plugin->info->load(plugin))
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
341 return FALSE;
5357
2a1c92df7024 [gaim-migrate @ 5733]
Christian Hammond <chipx86@chipx86.com>
parents: 5270
diff changeset
342 }
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
343 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
344 else {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
345 GaimPlugin *loader;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
346 GaimPluginLoaderInfo *loader_info;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
347
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5646
diff changeset
348 loader = find_loader_for_plugin(plugin);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
349
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
350 if (loader == NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
351 return FALSE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
352
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
353 loader_info = GAIM_PLUGIN_LOADER_INFO(loader);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
354
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
355 if (loader_info->load != NULL)
6981
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
356 {
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
357 if (!loader_info->load(plugin))
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
358 return FALSE;
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
359 }
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
360 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
361
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
362 loaded_plugins = g_list_append(loaded_plugins, plugin);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
363
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
364 plugin->loaded = TRUE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
365
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
366 /* TODO */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
367 if (load_cb != NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
368 load_cb(plugin, load_cb_data);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
369
8993
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8986
diff changeset
370 gaim_signal_emit(gaim_plugins_get_handle(), "plugin-load", plugin);
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
371
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
372 return TRUE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
373
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
374 #else
5449
9442e8d0b21d [gaim-migrate @ 5836]
Luke Schierer <lschiere@pidgin.im>
parents: 5443
diff changeset
375 return TRUE;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
376 #endif /* !GAIM_PLUGINS */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
377 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
378
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
379 gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
380 gaim_plugin_unload(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
381 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
382 #ifdef GAIM_PLUGINS
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
383 g_return_val_if_fail(plugin != NULL, FALSE);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
384
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
385 loaded_plugins = g_list_remove(loaded_plugins, plugin);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
386
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
387 g_return_val_if_fail(gaim_plugin_is_loaded(plugin), FALSE);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
388
5211
0241d6b6702d [gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
389 gaim_debug(GAIM_DEBUG_INFO, "plugins", "Unloading plugin %s\n",
0241d6b6702d [gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
390 plugin->info->name);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
391
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
392 /* cancel any pending dialogs the plugin has */
5498
cce2d7868c78 [gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents: 5450
diff changeset
393 gaim_request_close_with_handle(plugin);
cce2d7868c78 [gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents: 5450
diff changeset
394 gaim_notify_close_with_handle(plugin);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
395
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
396 plugin->loaded = FALSE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
397
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
398 if (plugin->native_plugin) {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
399 if (plugin->info->unload != NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
400 plugin->info->unload(plugin);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
401
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
402 if (plugin->info->type == GAIM_PLUGIN_PROTOCOL) {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
403 GaimPluginProtocolInfo *prpl_info;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
404 GList *l;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
405
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
406 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(plugin);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
407
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
408 for (l = prpl_info->user_splits; l != NULL; l = l->next)
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
409 gaim_account_user_split_destroy(l->data);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
410
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
411 for (l = prpl_info->protocol_options; l != NULL; l = l->next)
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5573
diff changeset
412 gaim_account_option_destroy(l->data);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
413
5646
48c63ee49961 [gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents: 5638
diff changeset
414 if (prpl_info->user_splits != NULL)
48c63ee49961 [gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents: 5638
diff changeset
415 g_list_free(prpl_info->user_splits);
48c63ee49961 [gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents: 5638
diff changeset
416
48c63ee49961 [gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents: 5638
diff changeset
417 if (prpl_info->protocol_options != NULL)
48c63ee49961 [gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents: 5638
diff changeset
418 g_list_free(prpl_info->protocol_options);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
419 }
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 else {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
422 GaimPlugin *loader;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
423 GaimPluginLoaderInfo *loader_info;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
424
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5646
diff changeset
425 loader = find_loader_for_plugin(plugin);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
426
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
427 if (loader == NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
428 return FALSE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
429
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
430 loader_info = GAIM_PLUGIN_LOADER_INFO(loader);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
431
9697
f568b6655331 [gaim-migrate @ 10556]
Christian Hammond <chipx86@chipx86.com>
parents: 9667
diff changeset
432 if (loader_info->unload != NULL)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
433 loader_info->unload(plugin);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
434 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
435
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
436 gaim_signals_disconnect_by_handle(plugin);
6822
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
437 gaim_plugin_ipc_unregister_all(plugin);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
438
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
439 /* TODO */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
440 if (unload_cb != NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
441 unload_cb(plugin, unload_cb_data);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
442
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
443 /* I suppose this is the right place to call this... */
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
444 gaim_signal_emit(gaim_plugins_get_handle(), "plugin-unload", plugin);
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
445
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
446 return TRUE;
5449
9442e8d0b21d [gaim-migrate @ 5836]
Luke Schierer <lschiere@pidgin.im>
parents: 5443
diff changeset
447 #else
9442e8d0b21d [gaim-migrate @ 5836]
Luke Schierer <lschiere@pidgin.im>
parents: 5443
diff changeset
448 return TRUE;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
449 #endif /* GAIM_PLUGINS */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
450 }
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 gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
453 gaim_plugin_reload(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
454 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
455 #ifdef GAIM_PLUGINS
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
456 g_return_val_if_fail(plugin != NULL, FALSE);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
457 g_return_val_if_fail(gaim_plugin_is_loaded(plugin), FALSE);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
458
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
459 if (!gaim_plugin_unload(plugin))
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
460 return FALSE;
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 if (!gaim_plugin_load(plugin))
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
463 return FALSE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
464
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
465 return TRUE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
466 #else
5449
9442e8d0b21d [gaim-migrate @ 5836]
Luke Schierer <lschiere@pidgin.im>
parents: 5443
diff changeset
467 return TRUE;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
468 #endif /* !GAIM_PLUGINS */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
469 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
470
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
471 void
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
472 gaim_plugin_destroy(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
473 {
5449
9442e8d0b21d [gaim-migrate @ 5836]
Luke Schierer <lschiere@pidgin.im>
parents: 5443
diff changeset
474 #ifdef GAIM_PLUGINS
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
475 g_return_if_fail(plugin != NULL);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
476
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
477 if (gaim_plugin_is_loaded(plugin))
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
478 gaim_plugin_unload(plugin);
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 plugins = g_list_remove(plugins, plugin);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
481
6981
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
482 if (load_queue != NULL)
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
483 load_queue = g_list_remove(load_queue, plugin);
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
484
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
485 /* 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
486 * 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
487 * 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
488 if(plugin->info == NULL || plugin->info->magic != GAIM_PLUGIN_MAGIC ||
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
489 plugin->info->major_version != GAIM_MAJOR_VERSION) {
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
490 if(plugin->handle)
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
491 g_module_close(plugin->handle);
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
492 g_free(plugin);
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
493 return;
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
494 }
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
495
5243
f6e0c689a88b [gaim-migrate @ 5614]
Christian Hammond <chipx86@chipx86.com>
parents: 5242
diff changeset
496 if (plugin->info != NULL && plugin->info->dependencies != NULL)
f6e0c689a88b [gaim-migrate @ 5614]
Christian Hammond <chipx86@chipx86.com>
parents: 5242
diff changeset
497 g_list_free(plugin->info->dependencies);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
498
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
499 if (plugin->native_plugin)
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
500 {
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
501 if (plugin->info != NULL && plugin->info->type == GAIM_PLUGIN_LOADER)
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
502 {
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
503 GaimPluginLoaderInfo *loader_info;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
504 GList *exts, *l, *next_l;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
505 GaimPlugin *p2;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
506
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
507 loader_info = GAIM_PLUGIN_LOADER_INFO(plugin);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
508
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
509 if (loader_info != NULL && loader_info->exts != NULL)
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
510 {
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
511 for (exts = GAIM_PLUGIN_LOADER_INFO(plugin)->exts;
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
512 exts != NULL;
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
513 exts = exts->next) {
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
514
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
515 for (l = gaim_plugins_get_all(); l != NULL; l = next_l)
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
516 {
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
517 next_l = l->next;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
518
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
519 p2 = l->data;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
520
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
521 if (p2->path != NULL &&
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
522 is_so_file(p2->path, exts->data))
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
523 {
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
524 gaim_plugin_destroy(p2);
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
525 }
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
526 }
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
527 }
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
528
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
529 g_list_free(loader_info->exts);
5205
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 plugin_loaders = g_list_remove(plugin_loaders, plugin);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
533 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
534
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
535 if (plugin->info != NULL && plugin->info->destroy != NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
536 plugin->info->destroy(plugin);
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 (plugin->handle != NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
539 g_module_close(plugin->handle);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
540 }
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
541 else
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
542 {
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
543 GaimPlugin *loader;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
544 GaimPluginLoaderInfo *loader_info;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
545
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5646
diff changeset
546 loader = find_loader_for_plugin(plugin);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
547
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
548 if (loader != NULL)
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
549 {
5941
a3e60ff95b7d [gaim-migrate @ 6381]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
550 loader_info = GAIM_PLUGIN_LOADER_INFO(loader);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
551
5941
a3e60ff95b7d [gaim-migrate @ 6381]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
552 if (loader_info->destroy != NULL)
a3e60ff95b7d [gaim-migrate @ 6381]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
553 loader_info->destroy(plugin);
a3e60ff95b7d [gaim-migrate @ 6381]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
554 }
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
555 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
556
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
557 if (plugin->path != NULL) g_free(plugin->path);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
558 if (plugin->error != NULL) g_free(plugin->error);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
559
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
560 g_free(plugin);
5449
9442e8d0b21d [gaim-migrate @ 5836]
Luke Schierer <lschiere@pidgin.im>
parents: 5443
diff changeset
561 #endif /* !GAIM_PLUGINS */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
562 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
563
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
564 gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
565 gaim_plugin_is_loaded(const GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
566 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
567 g_return_val_if_fail(plugin != NULL, FALSE);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
568
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
569 return plugin->loaded;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
570 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
571
6822
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
572 /**************************************************************************
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
573 * Plugin IPC
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
574 **************************************************************************/
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
575 static void
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
576 destroy_ipc_info(void *data)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
577 {
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
578 GaimPluginIpcCommand *ipc_command = (GaimPluginIpcCommand *)data;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
579 int i;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
580
9667
22928adecb84 [gaim-migrate @ 10519]
Christian Hammond <chipx86@chipx86.com>
parents: 9018
diff changeset
581 if (ipc_command->params != NULL)
22928adecb84 [gaim-migrate @ 10519]
Christian Hammond <chipx86@chipx86.com>
parents: 9018
diff changeset
582 {
22928adecb84 [gaim-migrate @ 10519]
Christian Hammond <chipx86@chipx86.com>
parents: 9018
diff changeset
583 for (i = 0; i < ipc_command->num_params; i++)
22928adecb84 [gaim-migrate @ 10519]
Christian Hammond <chipx86@chipx86.com>
parents: 9018
diff changeset
584 gaim_value_destroy(ipc_command->params[i]);
22928adecb84 [gaim-migrate @ 10519]
Christian Hammond <chipx86@chipx86.com>
parents: 9018
diff changeset
585
22928adecb84 [gaim-migrate @ 10519]
Christian Hammond <chipx86@chipx86.com>
parents: 9018
diff changeset
586 g_free(ipc_command->params);
22928adecb84 [gaim-migrate @ 10519]
Christian Hammond <chipx86@chipx86.com>
parents: 9018
diff changeset
587 }
6822
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
588
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
589 if (ipc_command->ret_value != NULL)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
590 gaim_value_destroy(ipc_command->ret_value);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
591
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
592 g_free(ipc_command);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
593 }
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
594
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
595 gboolean
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
596 gaim_plugin_ipc_register(GaimPlugin *plugin, const char *command,
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
597 GaimCallback func, GaimSignalMarshalFunc marshal,
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
598 GaimValue *ret_value, int num_params, ...)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
599 {
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
600 GaimPluginIpcInfo *ipc_info;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
601 GaimPluginIpcCommand *ipc_command;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
602
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
603 g_return_val_if_fail(plugin != NULL, FALSE);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
604 g_return_val_if_fail(command != NULL, FALSE);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
605 g_return_val_if_fail(func != NULL, FALSE);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
606 g_return_val_if_fail(marshal != NULL, FALSE);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
607
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
608 if (plugin->ipc_data == NULL)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
609 {
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
610 ipc_info = plugin->ipc_data = g_new0(GaimPluginIpcInfo, 1);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
611 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
612 g_free, destroy_ipc_info);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
613 }
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
614 else
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
615 ipc_info = (GaimPluginIpcInfo *)plugin->ipc_data;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
616
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
617 ipc_command = g_new0(GaimPluginIpcCommand, 1);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
618 ipc_command->func = func;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
619 ipc_command->marshal = marshal;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
620 ipc_command->num_params = num_params;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
621 ipc_command->ret_value = ret_value;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
622
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
623 if (num_params > 0)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
624 {
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
625 va_list args;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
626 int i;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
627
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
628 ipc_command->params = g_new0(GaimValue *, num_params);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
629
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
630 va_start(args, num_params);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
631
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
632 for (i = 0; i < num_params; i++)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
633 ipc_command->params[i] = va_arg(args, GaimValue *);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
634
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
635 va_end(args);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
636 }
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
637
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
638 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
639
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
640 ipc_info->command_count++;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
641
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
642 return TRUE;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
643 }
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
644
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
645 void
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
646 gaim_plugin_ipc_unregister(GaimPlugin *plugin, const char *command)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
647 {
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
648 GaimPluginIpcInfo *ipc_info;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
649
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
650 g_return_if_fail(plugin != NULL);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
651 g_return_if_fail(command != NULL);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
652
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
653 ipc_info = (GaimPluginIpcInfo *)plugin->ipc_data;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
654
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
655 if (ipc_info == NULL ||
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
656 g_hash_table_lookup(ipc_info->commands, command) == NULL)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
657 {
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
658 gaim_debug_error("plugins",
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
659 "IPC command '%s' was not registered for plugin %s\n",
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
660 command, plugin->info->name);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
661 return;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
662 }
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
663
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
664 g_hash_table_remove(ipc_info->commands, command);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
665
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
666 ipc_info->command_count--;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
667
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
668 if (ipc_info->command_count == 0)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
669 {
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
670 g_hash_table_destroy(ipc_info->commands);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
671 g_free(ipc_info);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
672
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
673 plugin->ipc_data = NULL;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
674 }
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
675 }
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
676
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
677 void
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
678 gaim_plugin_ipc_unregister_all(GaimPlugin *plugin)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
679 {
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
680 GaimPluginIpcInfo *ipc_info;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
681
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
682 g_return_if_fail(plugin != NULL);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
683
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
684 if (plugin->ipc_data == NULL)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
685 return; /* Silently ignore it. */
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
686
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
687 ipc_info = (GaimPluginIpcInfo *)plugin->ipc_data;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
688
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
689 g_hash_table_destroy(ipc_info->commands);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
690 g_free(ipc_info);
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 plugin->ipc_data = NULL;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
693 }
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 gboolean
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
696 gaim_plugin_ipc_get_params(GaimPlugin *plugin, const char *command,
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
697 GaimValue **ret_value, int *num_params,
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
698 GaimValue ***params)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
699 {
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
700 GaimPluginIpcInfo *ipc_info;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
701 GaimPluginIpcCommand *ipc_command;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
702
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
703 g_return_val_if_fail(plugin != NULL, FALSE);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
704 g_return_val_if_fail(command != NULL, FALSE);
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 ipc_info = (GaimPluginIpcInfo *)plugin->ipc_data;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
707
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
708 if (ipc_info == NULL ||
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
709 (ipc_command = g_hash_table_lookup(ipc_info->commands,
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
710 command)) == NULL)
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 gaim_debug_error("plugins",
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
713 "IPC command '%s' was not registered for plugin %s\n",
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
714 command, plugin->info->name);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
715
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
716 return FALSE;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
717 }
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
718
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
719 if (num_params != NULL)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
720 *num_params = ipc_command->num_params;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
721
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
722 if (params != NULL)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
723 *params = ipc_command->params;
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 (ret_value != NULL)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
726 *ret_value = ipc_command->ret_value;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
727
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
728 return TRUE;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
729 }
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 void *
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
732 gaim_plugin_ipc_call(GaimPlugin *plugin, const char *command,
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
733 gboolean *ok, ...)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
734 {
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
735 GaimPluginIpcInfo *ipc_info;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
736 GaimPluginIpcCommand *ipc_command;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
737 va_list args;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
738 void *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 (ok != NULL)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
741 *ok = FALSE;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
742
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
743 g_return_val_if_fail(plugin != NULL, NULL);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
744 g_return_val_if_fail(command != NULL, NULL);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
745
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
746 ipc_info = (GaimPluginIpcInfo *)plugin->ipc_data;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
747
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
748 if (ipc_info == NULL ||
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
749 (ipc_command = g_hash_table_lookup(ipc_info->commands,
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
750 command)) == NULL)
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 gaim_debug_error("plugins",
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
753 "IPC command '%s' was not registered for plugin %s\n",
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
754 command, plugin->info->name);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
755
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
756 return NULL;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
757 }
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 va_start(args, ok);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
760 ipc_command->marshal(ipc_command->func, args, NULL, &ret_value);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
761 va_end(args);
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
762
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
763 if (ok != NULL)
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
764 *ok = TRUE;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
765
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
766 return ret_value;
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
767 }
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
768
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 * Plugins subsystem
7dba3e17cb21 [gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents: 6639
diff changeset
771 **************************************************************************/
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
772 void
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
773 gaim_plugins_set_search_paths(size_t count, char **paths)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
774 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
775 size_t s;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
776
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
777 g_return_if_fail(count > 0);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
778 g_return_if_fail(paths != NULL);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
779
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
780 if (search_paths != NULL) {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
781 for (s = 0; s < search_path_count; s++)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
782 g_free(search_paths[s]);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
783
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
784 g_free(search_paths);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
785 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
786
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
787 search_paths = g_new0(char *, count);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
788
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
789 for (s = 0; s < count; s++) {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
790 if (paths[s] == NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
791 search_paths[s] = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
792 else
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
793 search_paths[s] = g_strdup(paths[s]);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
794 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
795
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
796 search_path_count = count;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
797 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
798
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
799 void
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
800 gaim_plugins_unload_all(void)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
801 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
802 #ifdef GAIM_PLUGINS
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
803
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
804 while (loaded_plugins != NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
805 gaim_plugin_unload(loaded_plugins->data);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
806
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
807 #endif /* GAIM_PLUGINS */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
808 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
809
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
810 void
5242
fd81a00480ac [gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents: 5211
diff changeset
811 gaim_plugins_destroy_all(void)
fd81a00480ac [gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents: 5211
diff changeset
812 {
fd81a00480ac [gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents: 5211
diff changeset
813 #ifdef GAIM_PLUGINS
fd81a00480ac [gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents: 5211
diff changeset
814
fd81a00480ac [gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents: 5211
diff changeset
815 while (plugins != NULL)
fd81a00480ac [gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents: 5211
diff changeset
816 gaim_plugin_destroy(plugins->data);
fd81a00480ac [gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents: 5211
diff changeset
817
fd81a00480ac [gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents: 5211
diff changeset
818 #endif /* GAIM_PLUGINS */
fd81a00480ac [gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents: 5211
diff changeset
819 }
5838
6aa7651c7c15 [gaim-migrate @ 6269]
Nathan Walp <nwalp@pidgin.im>
parents: 5794
diff changeset
820
6aa7651c7c15 [gaim-migrate @ 6269]
Nathan Walp <nwalp@pidgin.im>
parents: 5794
diff changeset
821 void
5949
90d0849abd3c [gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents: 5941
diff changeset
822 gaim_plugins_load_saved(const char *key)
5838
6aa7651c7c15 [gaim-migrate @ 6269]
Nathan Walp <nwalp@pidgin.im>
parents: 5794
diff changeset
823 {
6aa7651c7c15 [gaim-migrate @ 6269]
Nathan Walp <nwalp@pidgin.im>
parents: 5794
diff changeset
824 #ifdef GAIM_PLUGINS
5949
90d0849abd3c [gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents: 5941
diff changeset
825 GList *f, *files;
90d0849abd3c [gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents: 5941
diff changeset
826
90d0849abd3c [gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents: 5941
diff changeset
827 g_return_if_fail(key != NULL);
5838
6aa7651c7c15 [gaim-migrate @ 6269]
Nathan Walp <nwalp@pidgin.im>
parents: 5794
diff changeset
828
5949
90d0849abd3c [gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents: 5941
diff changeset
829 files = gaim_prefs_get_string_list(key);
90d0849abd3c [gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents: 5941
diff changeset
830
7033
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
831 for (f = files; f; f = f->next)
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
832 {
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
833 char *filename = g_path_get_basename(f->data);
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
834 GaimPlugin *plugin = NULL;
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
835
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
836 if (filename != NULL)
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
837 {
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
838 if ((plugin = gaim_plugins_find_with_basename(filename)) != NULL)
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
839 {
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
840 gaim_debug_info("plugins", "Loading saved plugin %s\n",
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
841 filename);
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
842 gaim_plugin_load(plugin);
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
843 }
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
844 else
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
845 {
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
846 gaim_debug_error("plugins", "Unable to find saved plugin %s\n",
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
847 filename);
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
848 }
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
849
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
850 g_free(filename);
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
851 }
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
852
5838
6aa7651c7c15 [gaim-migrate @ 6269]
Nathan Walp <nwalp@pidgin.im>
parents: 5794
diff changeset
853 g_free(f->data);
6aa7651c7c15 [gaim-migrate @ 6269]
Nathan Walp <nwalp@pidgin.im>
parents: 5794
diff changeset
854 }
6aa7651c7c15 [gaim-migrate @ 6269]
Nathan Walp <nwalp@pidgin.im>
parents: 5794
diff changeset
855
6aa7651c7c15 [gaim-migrate @ 6269]
Nathan Walp <nwalp@pidgin.im>
parents: 5794
diff changeset
856 g_list_free(files);
6aa7651c7c15 [gaim-migrate @ 6269]
Nathan Walp <nwalp@pidgin.im>
parents: 5794
diff changeset
857 #endif /* GAIM_PLUGINS */
6aa7651c7c15 [gaim-migrate @ 6269]
Nathan Walp <nwalp@pidgin.im>
parents: 5794
diff changeset
858 }
6aa7651c7c15 [gaim-migrate @ 6269]
Nathan Walp <nwalp@pidgin.im>
parents: 5794
diff changeset
859
6aa7651c7c15 [gaim-migrate @ 6269]
Nathan Walp <nwalp@pidgin.im>
parents: 5794
diff changeset
860
5242
fd81a00480ac [gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents: 5211
diff changeset
861 void
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
862 gaim_plugins_probe(const char *ext)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
863 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
864 #ifdef GAIM_PLUGINS
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
865 GDir *dir;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
866 const gchar *file;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
867 gchar *path;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
868 GaimPlugin *plugin;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
869 size_t i;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
870
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
871 void *handle;
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
872
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
873 if (!g_module_supported())
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
874 return;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
875
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
876 handle = gaim_plugins_get_handle();
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
877
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
878 gaim_debug_info("plugins", "registering plugin-load signal\n");
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
879 gaim_signal_register(handle, "plugin-load", gaim_marshal_VOID__POINTER, NULL,
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
880 1, gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_PLUGIN));
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
881
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
882 gaim_debug_info("plugins", "registering plugin-unload signal\n");
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
883 gaim_signal_register(handle, "plugin-unload", gaim_marshal_VOID__POINTER, NULL,
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
884 1, gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_PLUGIN));
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
885
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8759
diff changeset
886
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
887 for (i = 0; i < search_path_count; i++) {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
888 if (search_paths[i] == NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
889 continue;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
890
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
891 dir = g_dir_open(search_paths[i], 0, NULL);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
892
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
893 if (dir != NULL) {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
894 while ((file = g_dir_read_name(dir)) != NULL) {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
895 path = g_build_filename(search_paths[i], file, NULL);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
896
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
897 if (ext == NULL || is_so_file(file, ext))
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
898 plugin = gaim_plugin_probe(path);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
899
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
900 g_free(path);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
901 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
902
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
903 g_dir_close(dir);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
904 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
905 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
906
6981
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
907 /* See if we have any plugins waiting to load. */
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
908 while (load_queue != NULL)
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
909 {
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
910 plugin = (GaimPlugin *)load_queue->data;
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
911
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
912 load_queue = g_list_remove(load_queue, plugin);
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
913
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
914 if (plugin == NULL || plugin->info == NULL)
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
915 continue;
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
916
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
917 if (plugin->info->type == GAIM_PLUGIN_LOADER)
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
918 {
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
919 GList *exts;
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
920
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
921 /* We'll just load this right now. */
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
922 if (!gaim_plugin_load(plugin))
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
923 {
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
924 gaim_plugin_destroy(plugin);
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
925
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
926 continue;
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
927 }
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
928
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
929 plugin_loaders = g_list_append(plugin_loaders, plugin);
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
930
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
931 for (exts = GAIM_PLUGIN_LOADER_INFO(plugin)->exts;
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
932 exts != NULL;
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
933 exts = exts->next)
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
934 {
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
935 gaim_plugins_probe(exts->data);
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
936 }
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
937 }
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
938 else if (plugin->info->type == GAIM_PLUGIN_PROTOCOL)
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
939 {
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
940 /* We'll just load this right now. */
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
941 if (!gaim_plugin_load(plugin))
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
942 {
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
943 gaim_plugin_destroy(plugin);
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
944
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
945 continue;
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
946 }
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
947
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7279
diff changeset
948 if (gaim_find_prpl(plugin->info->id))
6981
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
949 {
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
950 /* Nothing to see here--move along, move along */
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
951 gaim_plugin_destroy(plugin);
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
952
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
953 continue;
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
954 }
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
955
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
956 protocol_plugins = g_list_insert_sorted(protocol_plugins, plugin,
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
957 (GCompareFunc)compare_prpl);
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
958 }
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
959 }
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
960
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
961 if (load_queue != NULL)
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
962 {
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
963 g_list_free(load_queue);
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
964 load_queue = NULL;
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
965 }
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
966
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
967 if (probe_cb != NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
968 probe_cb(probe_cb_data);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
969
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
970 #endif /* GAIM_PLUGINS */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
971 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
972
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
973 gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
974 gaim_plugin_register(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
975 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
976 g_return_val_if_fail(plugin != NULL, FALSE);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
977
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
978 if (g_list_find(plugins, plugin))
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
979 return TRUE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
980
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
981 if (plugin->info->type == GAIM_PLUGIN_LOADER)
6981
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
982 {
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
983 GaimPluginLoaderInfo *loader_info;
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
984
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
985 loader_info = GAIM_PLUGIN_LOADER_INFO(plugin);
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
986
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
987 if (loader_info == NULL)
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
988 {
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
989 gaim_debug(GAIM_DEBUG_ERROR, "plugins", "%s is unloadable\n",
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
990 plugin->path);
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
991 return FALSE;
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
992 }
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
993
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
994 load_queue = g_list_append(load_queue, plugin);
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
995 }
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
996 else if (plugin->info->type == GAIM_PLUGIN_PROTOCOL)
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
997 {
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
998 GaimPluginProtocolInfo *prpl_info;
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
999
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
1000 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(plugin);
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
1001
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
1002 if (prpl_info == NULL)
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
1003 {
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
1004 gaim_debug(GAIM_DEBUG_ERROR, "plugins", "%s is unloadable\n",
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9697
diff changeset
1005 plugin->path);
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
1006 return FALSE;
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
1007 }
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
1008
6981
abd3c684da31 [gaim-migrate @ 7537]
Christian Hammond <chipx86@chipx86.com>
parents: 6822
diff changeset
1009 load_queue = g_list_append(load_queue, plugin);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1010 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1011
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1012 plugins = g_list_append(plugins, plugin);
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 return TRUE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1015 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1016
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1017 gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1018 gaim_plugins_enabled(void)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1019 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1020 #ifdef GAIM_PLUGINS
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1021 return TRUE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1022 #else
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1023 return FALSE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1024 #endif
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1025 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1026
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1027 void
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1028 gaim_plugins_register_probe_notify_cb(void (*func)(void *), void *data)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1029 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1030 /* TODO */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1031 probe_cb = func;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1032 probe_cb_data = data;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1033 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1034
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1035 void
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1036 gaim_plugins_unregister_probe_notify_cb(void (*func)(void *))
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1037 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1038 /* TODO */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1039 probe_cb = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1040 probe_cb_data = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1041 }
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 void
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1044 gaim_plugins_register_load_notify_cb(void (*func)(GaimPlugin *, void *),
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1045 void *data)
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 /* TODO */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1048 load_cb = func;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1049 load_cb_data = data;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1050 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1051
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1052 void
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1053 gaim_plugins_unregister_load_notify_cb(void (*func)(GaimPlugin *, void *))
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1054 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1055 /* TODO */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1056 load_cb = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1057 load_cb_data = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1058 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1059
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1060 void
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1061 gaim_plugins_register_unload_notify_cb(void (*func)(GaimPlugin *, void *),
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1062 void *data)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1063 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1064 /* TODO */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1065 unload_cb = func;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1066 unload_cb_data = data;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1067 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1068
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1069 void
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1070 gaim_plugins_unregister_unload_notify_cb(void (*func)(GaimPlugin *, void *))
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1071 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1072 /* TODO */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1073 unload_cb = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1074 unload_cb_data = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1075 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1076
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1077 GaimPlugin *
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1078 gaim_plugins_find_with_name(const char *name)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1079 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1080 GaimPlugin *plugin;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1081 GList *l;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1082
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1083 for (l = plugins; l != NULL; l = l->next) {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1084 plugin = l->data;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1085
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1086 if (!strcmp(plugin->info->name, name))
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1087 return plugin;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1088 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1089
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1090 return NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1091 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1092
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1093 GaimPlugin *
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1094 gaim_plugins_find_with_filename(const char *filename)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1095 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1096 GaimPlugin *plugin;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1097 GList *l;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1098
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1099 for (l = plugins; l != NULL; l = l->next) {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1100 plugin = l->data;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1101
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1102 if (plugin->path != NULL && !strcmp(plugin->path, filename))
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1103 return plugin;
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 return NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1107 }
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 GaimPlugin *
7033
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1110 gaim_plugins_find_with_basename(const char *basename)
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1111 {
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1112 GaimPlugin *plugin;
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1113 GList *l;
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1114
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1115 g_return_val_if_fail(basename != NULL, NULL);
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1116
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1117 for (l = plugins; l != NULL; l = l->next)
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1118 {
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1119 char *tmp;
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1120
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1121 plugin = (GaimPlugin *)l->data;
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1122
7278
6d5dc6a65c47 [gaim-migrate @ 7857]
Sean Egan <seanegan@gmail.com>
parents: 7033
diff changeset
1123 if (plugin->path != NULL) {
6d5dc6a65c47 [gaim-migrate @ 7857]
Sean Egan <seanegan@gmail.com>
parents: 7033
diff changeset
1124 tmp = g_path_get_basename(plugin->path);
6d5dc6a65c47 [gaim-migrate @ 7857]
Sean Egan <seanegan@gmail.com>
parents: 7033
diff changeset
1125 if (!strcmp(tmp, basename)) {
6d5dc6a65c47 [gaim-migrate @ 7857]
Sean Egan <seanegan@gmail.com>
parents: 7033
diff changeset
1126 g_free(tmp);
7033
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1127 return plugin;
7278
6d5dc6a65c47 [gaim-migrate @ 7857]
Sean Egan <seanegan@gmail.com>
parents: 7033
diff changeset
1128 }
7279
0d24c94e4fbc [gaim-migrate @ 7858]
Nathan Walp <nwalp@pidgin.im>
parents: 7278
diff changeset
1129 g_free(tmp);
7033
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1130 }
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1131 }
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1132
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1133 return NULL;
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1134 }
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1135
cf1126ba1834 [gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
1136 GaimPlugin *
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1137 gaim_plugins_find_with_id(const char *id)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1138 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1139 GaimPlugin *plugin;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1140 GList *l;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1141
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1142 g_return_val_if_fail(id != NULL, NULL);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1143
6486
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
1144 for (l = plugins; l != NULL; l = l->next)
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
1145 {
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1146 plugin = l->data;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1147
6486
fab81e4b885c [gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
1148 if (plugin->info->id != NULL && !strcmp(plugin->info->id, id))
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1149 return plugin;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1150 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1151
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1152 return NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1153 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1154
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1155 GList *
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1156 gaim_plugins_get_loaded(void)
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 return loaded_plugins;
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
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1161 GList *
5573
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
1162 gaim_plugins_get_protocols(void)
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
1163 {
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
1164 return protocol_plugins;
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
1165 }
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
1166
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
1167 GList *
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1168 gaim_plugins_get_all(void)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1169 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1170 return plugins;
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
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
1173
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
1174 GaimPluginAction *
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
1175 gaim_plugin_action_new(char* label, void (*callback)(GaimPluginAction *))
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
1176 {
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
1177 GaimPluginAction *act = g_new0(GaimPluginAction, 1);
9018
bb168141eb5f [gaim-migrate @ 9794]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
1178
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
1179 act->label = label;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
1180 act->callback = callback;
9018
bb168141eb5f [gaim-migrate @ 9794]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
1181
bb168141eb5f [gaim-migrate @ 9794]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
1182 return act;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
1183 }
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
1184