comparison src/plugins.c @ 970:9eb07b383df4

[gaim-migrate @ 980] Bleat. committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Wed, 11 Oct 2000 00:31:15 +0000
parents 2f64424bf319
children 7e231bc0018a
comparison
equal deleted inserted replaced
969:eb5a82d64ce5 970:9eb07b383df4
150 if (filename == NULL) return; 150 if (filename == NULL) return;
151 /* i shouldn't be checking based solely on path, but i'm lazy */ 151 /* i shouldn't be checking based solely on path, but i'm lazy */
152 while (c) { 152 while (c) {
153 plug = (struct gaim_plugin *)c->data; 153 plug = (struct gaim_plugin *)c->data;
154 if (!strcmp(filename, plug->filename)) { 154 if (!strcmp(filename, plug->filename)) {
155 sprintf(debug_buff, _("Already loaded %s, " 155 debug_printf( _("Already loaded %s, not reloading.\n"), filename);
156 "not reloading.\n"), filename);
157 debug_print(debug_buff);
158 return; 156 return;
159 } 157 }
160 c = g_list_next(c); 158 c = g_list_next(c);
161 } 159 }
162 plug = g_malloc(sizeof *plug); 160 plug = g_malloc(sizeof *plug);
164 plug->filename = g_strconcat(g_get_home_dir(), G_DIR_SEPARATOR_S, 162 plug->filename = g_strconcat(g_get_home_dir(), G_DIR_SEPARATOR_S,
165 PLUGIN_DIR, filename, NULL); 163 PLUGIN_DIR, filename, NULL);
166 else 164 else
167 plug->filename = g_strdup(filename); 165 plug->filename = g_strdup(filename);
168 166
169 sprintf(debug_buff, "Loading %s\n", filename); 167 debug_printf("Loading %s\n", filename);
170 debug_print(debug_buff);
171 /* do NOT `OR' with RTLD_GLOBAL, otherwise plugins may conflict 168 /* do NOT `OR' with RTLD_GLOBAL, otherwise plugins may conflict
172 * (it's really just a way to work around other people's bad 169 * (it's really just a way to work around other people's bad
173 * programming, by not using RTLD_GLOBAL :P ) */ 170 * programming, by not using RTLD_GLOBAL :P ) */
174 plug->handle = dlopen(plug->filename, RTLD_LAZY); 171 plug->handle = dlopen(plug->filename, RTLD_LAZY);
175 if (!plug->handle) { 172 if (!plug->handle) {
188 g_free(plug); 185 g_free(plug);
189 return; 186 return;
190 } 187 }
191 188
192 retval = (*gaim_plugin_init)(plug->handle); 189 retval = (*gaim_plugin_init)(plug->handle);
193 sprintf(debug_buff, "loaded plugin returned %d\n", retval); 190 debug_printf("loaded plugin returned %d\n", retval);
194 debug_print(debug_buff);
195 if (retval < 0) { 191 if (retval < 0) {
196 GList *c = callbacks; 192 GList *c = callbacks;
197 struct gaim_callback *g; 193 struct gaim_callback *g;
198 while (c) { 194 while (c) {
199 g = (struct gaim_callback *)c->data; 195 g = (struct gaim_callback *)c->data;