comparison src/plugin.c @ 5449:9442e8d0b21d

[gaim-migrate @ 5836] Decklin Foster writes: "this makes --enable-static-prpls compile again. i'm so lazy. it's only been what, well over a week since the new plugin api broke this? :) i'm not sure if everything here is "correct" but i'm sure someone can look over it. mainly, because i made _load return TRUE all the time, for the sake of consistency/completeness i changed the other applicable functions to do so as well. my feeling is, the only time these things are going to be called in the static case is from static_proto_init (since there's no plugin UI or whatever) and therefore they always "succeed". oh, yeah, and someone please test it *without* static prpls turned on. like i said, i'm lazy. :)" it works for me with no static prpls. committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Mon, 19 May 2003 17:27:03 +0000
parents 07358c067495
children bb1e160467b6
comparison
equal deleted inserted replaced
5448:aed28286e4fc 5449:9442e8d0b21d
138 } 138 }
139 139
140 return NULL; 140 return NULL;
141 } 141 }
142 142
143 #endif /* GAIM_PLUGINS */
144
143 static gint 145 static gint
144 compare_prpl(GaimPlugin *a, GaimPlugin *b) 146 compare_prpl(GaimPlugin *a, GaimPlugin *b)
145 { 147 {
146 /* neg if a before b, 0 if equal, pos if a after b */ 148 /* neg if a before b, 0 if equal, pos if a after b */
147 return ((GAIM_IS_PROTOCOL_PLUGIN(a) 149 return ((GAIM_IS_PROTOCOL_PLUGIN(a)
148 ? GAIM_PLUGIN_PROTOCOL_INFO(a)->protocol : -1) - 150 ? GAIM_PLUGIN_PROTOCOL_INFO(a)->protocol : -1) -
149 ((GAIM_IS_PROTOCOL_PLUGIN(b) 151 ((GAIM_IS_PROTOCOL_PLUGIN(b)
150 ? GAIM_PLUGIN_PROTOCOL_INFO(b)->protocol : -1))); 152 ? GAIM_PLUGIN_PROTOCOL_INFO(b)->protocol : -1)));
151 } 153 }
152 154
153 #endif /* GAIM_PLUGINS */
154
155 GaimPlugin * 155 GaimPlugin *
156 gaim_plugin_new(gboolean native, const char *path) 156 gaim_plugin_new(gboolean native, const char *path)
157 { 157 {
158 GaimPlugin *plugin; 158 GaimPlugin *plugin;
159 159
296 load_cb(plugin, load_cb_data); 296 load_cb(plugin, load_cb_data);
297 297
298 return TRUE; 298 return TRUE;
299 299
300 #else 300 #else
301 return FALSE; 301 return TRUE;
302 #endif /* !GAIM_PLUGINS */ 302 #endif /* !GAIM_PLUGINS */
303 } 303 }
304 304
305 gboolean 305 gboolean
306 gaim_plugin_unload(GaimPlugin *plugin) 306 gaim_plugin_unload(GaimPlugin *plugin)
381 /* TODO */ 381 /* TODO */
382 if (unload_cb != NULL) 382 if (unload_cb != NULL)
383 unload_cb(plugin, unload_cb_data); 383 unload_cb(plugin, unload_cb_data);
384 384
385 return TRUE; 385 return TRUE;
386 #else
387 return TRUE;
386 #endif /* GAIM_PLUGINS */ 388 #endif /* GAIM_PLUGINS */
387 } 389 }
388 390
389 gboolean 391 gboolean
390 gaim_plugin_reload(GaimPlugin *plugin) 392 gaim_plugin_reload(GaimPlugin *plugin)
399 if (!gaim_plugin_load(plugin)) 401 if (!gaim_plugin_load(plugin))
400 return FALSE; 402 return FALSE;
401 403
402 return TRUE; 404 return TRUE;
403 #else 405 #else
404 return NULL; 406 return TRUE;
405 #endif /* !GAIM_PLUGINS */ 407 #endif /* !GAIM_PLUGINS */
406 } 408 }
407 409
408 void 410 void
409 gaim_plugin_destroy(GaimPlugin *plugin) 411 gaim_plugin_destroy(GaimPlugin *plugin)
410 { 412 {
413 #ifdef GAIM_PLUGINS
411 g_return_if_fail(plugin != NULL); 414 g_return_if_fail(plugin != NULL);
412 415
413 if (gaim_plugin_is_loaded(plugin)) 416 if (gaim_plugin_is_loaded(plugin))
414 gaim_plugin_unload(plugin); 417 gaim_plugin_unload(plugin);
415 418
466 469
467 if (plugin->path != NULL) g_free(plugin->path); 470 if (plugin->path != NULL) g_free(plugin->path);
468 if (plugin->error != NULL) g_free(plugin->error); 471 if (plugin->error != NULL) g_free(plugin->error);
469 472
470 g_free(plugin); 473 g_free(plugin);
474 #endif /* !GAIM_PLUGINS */
471 } 475 }
472 476
473 gboolean 477 gboolean
474 gaim_plugin_is_loaded(const GaimPlugin *plugin) 478 gaim_plugin_is_loaded(const GaimPlugin *plugin)
475 { 479 {
566 } 570 }
567 571
568 gboolean 572 gboolean
569 gaim_plugin_register(GaimPlugin *plugin) 573 gaim_plugin_register(GaimPlugin *plugin)
570 { 574 {
571 #ifdef GAIM_PLUGINS
572 g_return_val_if_fail(plugin != NULL, FALSE); 575 g_return_val_if_fail(plugin != NULL, FALSE);
573 576
574 if (g_list_find(plugins, plugin)) 577 if (g_list_find(plugins, plugin))
575 return TRUE; 578 return TRUE;
576 579
619 } 622 }
620 623
621 plugins = g_list_append(plugins, plugin); 624 plugins = g_list_append(plugins, plugin);
622 625
623 return TRUE; 626 return TRUE;
624 #else
625 return FALSE;
626 #endif /* !GAIM_PLUGINS */
627 } 627 }
628 628
629 gboolean 629 gboolean
630 gaim_plugins_enabled(void) 630 gaim_plugins_enabled(void)
631 { 631 {