Mercurial > pidgin
comparison src/module.c @ 3835:b359aab1c576
[gaim-migrate @ 3985]
bugfix. got rid of reload_plugin() function--it's no longer useful.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Wed, 30 Oct 2002 21:38:20 +0000 |
parents | 988485669631 |
children | 4927f8dd046f |
comparison
equal
deleted
inserted
replaced
3834:c66ed5df69ef | 3835:b359aab1c576 |
---|---|
62 /* --------------- Function Declarations --------------------- */ | 62 /* --------------- Function Declarations --------------------- */ |
63 | 63 |
64 struct gaim_plugin * load_plugin(const char *); | 64 struct gaim_plugin * load_plugin(const char *); |
65 #ifdef GAIM_PLUGINS | 65 #ifdef GAIM_PLUGINS |
66 void unload_plugin(struct gaim_plugin *p); | 66 void unload_plugin(struct gaim_plugin *p); |
67 struct gaim_plugin *reload_plugin(struct gaim_plugin *p); | |
68 void gaim_signal_connect(GModule *, enum gaim_event, void *, void *); | 67 void gaim_signal_connect(GModule *, enum gaim_event, void *, void *); |
69 void gaim_signal_disconnect(GModule *, enum gaim_event, void *); | 68 void gaim_signal_disconnect(GModule *, enum gaim_event, void *); |
70 void gaim_plugin_unload(GModule *); | 69 void gaim_plugin_unload(GModule *); |
71 | 70 |
72 /* --------------- Static Function Declarations ------------- */ | 71 /* --------------- Static Function Declarations ------------- */ |
214 break; | 213 break; |
215 p = p->next; | 214 p = p->next; |
216 } | 215 } |
217 | 216 |
218 if (plug && plug->handle) { | 217 if (plug && plug->handle) { |
219 reload_plugin(plug); | 218 return plug; |
220 return NULL; | |
221 } | 219 } |
222 | 220 |
223 if (!plug) { | 221 if (!plug) { |
224 plug = g_new0(struct gaim_plugin, 1); | 222 plug = g_new0(struct gaim_plugin, 1); |
225 g_snprintf(plug->path, sizeof(plug->path), filename); | 223 g_snprintf(plug->path, sizeof(plug->path), filename); |
332 update_show_plugins(); */ | 330 update_show_plugins(); */ |
333 | 331 |
334 g_timeout_add(5000, unload_timeout, handle); | 332 g_timeout_add(5000, unload_timeout, handle); |
335 } | 333 } |
336 | 334 |
337 /* Do unload/load cycle of plugin. */ | |
338 struct gaim_plugin *reload_plugin(struct gaim_plugin *p) | |
339 { | |
340 char file[1024]; | |
341 GModule *handle = p->handle; | |
342 | |
343 strncpy(file, g_module_name(handle), sizeof(file)); | |
344 file[sizeof(file) - 1] = '\0'; | |
345 | |
346 debug_printf("Reloading %s\n", file); | |
347 | |
348 /* Unload */ | |
349 unload_plugin(p); | |
350 | |
351 /* Load */ | |
352 return load_plugin(file); | |
353 } | |
354 | |
355 /* Remove all callbacks associated with plugin handle */ | 335 /* Remove all callbacks associated with plugin handle */ |
356 static void plugin_remove_callbacks(GModule *handle) | 336 static void plugin_remove_callbacks(GModule *handle) |
357 { | 337 { |
358 GList *c = callbacks; | 338 GList *c = callbacks; |
359 struct gaim_callback *g; | 339 struct gaim_callback *g; |