| 128 /* do NOT OR with RTLD_GLOBAL, otherwise plugins may conflict |
128 /* do NOT OR with RTLD_GLOBAL, otherwise plugins may conflict |
| 129 * (it's really just a way to work around other people's bad |
129 * (it's really just a way to work around other people's bad |
| 130 * programming, by not using RTLD_GLOBAL :P ) */ |
130 * programming, by not using RTLD_GLOBAL :P ) */ |
| 131 plug->handle = dlopen(plug->filename, RTLD_LAZY); |
131 plug->handle = dlopen(plug->filename, RTLD_LAZY); |
| 132 if (!plug->handle) { |
132 if (!plug->handle) { |
| 133 error = dlerror(); |
133 error = (char *)dlerror(); |
| 134 do_error_dialog(error, "Plugin Error"); |
134 do_error_dialog(error, "Plugin Error"); |
| 135 g_free(plug); |
135 g_free(plug); |
| 136 return; |
136 return; |
| 137 } |
137 } |
| 138 |
138 |
| 139 if (plugin_dialog) |
139 if (plugin_dialog) |
| 140 gtk_widget_destroy(plugin_dialog); |
140 gtk_widget_destroy(plugin_dialog); |
| 141 plugin_dialog = NULL; |
141 plugin_dialog = NULL; |
| 142 |
142 |
| 143 gaim_plugin_init = dlsym(plug->handle, "gaim_plugin_init"); |
143 gaim_plugin_init = dlsym(plug->handle, "gaim_plugin_init"); |
| 144 if ((error = dlerror()) != NULL) { |
144 if ((error = (char *)dlerror()) != NULL) { |
| 145 do_error_dialog(error, "Plugin Error"); |
145 do_error_dialog(error, "Plugin Error"); |
| 146 dlclose(plug->handle); |
146 dlclose(plug->handle); |
| 147 g_free(plug); |
147 g_free(plug); |
| 148 return; |
148 return; |
| 149 } |
149 } |
| 150 |
150 |
| 151 plugins = g_list_append(plugins, plug); |
151 plugins = g_list_append(plugins, plug); |
| 152 (*gaim_plugin_init)(plug->handle); |
152 (*gaim_plugin_init)(plug->handle); |
| 153 |
153 |
| 154 cfunc = dlsym(plug->handle, "name"); |
154 cfunc = dlsym(plug->handle, "name"); |
| 155 if ((error = dlerror()) == NULL) |
155 if ((error = (char *)dlerror()) == NULL) |
| 156 plug->name = (*cfunc)(); |
156 plug->name = (*cfunc)(); |
| 157 else |
157 else |
| 158 plug->name = NULL; |
158 plug->name = NULL; |
| 159 |
159 |
| 160 cfunc = dlsym(plug->handle, "description"); |
160 cfunc = dlsym(plug->handle, "description"); |
| 161 if ((error = dlerror()) == NULL) |
161 if ((error = (char *)dlerror()) == NULL) |
| 162 plug->description = (*cfunc)(); |
162 plug->description = (*cfunc)(); |
| 163 else |
163 else |
| 164 plug->description = NULL; |
164 plug->description = NULL; |
| 165 |
165 |
| 166 update_show_plugins(); |
166 update_show_plugins(); |
| 328 if (i == NULL) return; |
328 if (i == NULL) return; |
| 329 |
329 |
| 330 p = gtk_object_get_user_data(GTK_OBJECT(i->data)); |
330 p = gtk_object_get_user_data(GTK_OBJECT(i->data)); |
| 331 |
331 |
| 332 gaim_plugin_remove = dlsym(p->handle, "gaim_plugin_remove"); |
332 gaim_plugin_remove = dlsym(p->handle, "gaim_plugin_remove"); |
| 333 if ((error = dlerror()) == NULL) |
333 if ((error = (char *)dlerror()) == NULL) |
| 334 (*gaim_plugin_remove)(); |
334 (*gaim_plugin_remove)(); |
| 335 while (c) { |
335 while (c) { |
| 336 g = (struct gaim_callback *)c->data; |
336 g = (struct gaim_callback *)c->data; |
| 337 if (g->handle == p->handle) { |
337 if (g->handle == p->handle) { |
| 338 callbacks = g_list_remove(callbacks, c); |
338 callbacks = g_list_remove(callbacks, c); |
| 359 |
359 |
| 360 g_snprintf(buffer, sizeof buffer, "%s\n%s", p->name, p->description); |
360 g_snprintf(buffer, sizeof buffer, "%s\n%s", p->name, p->description); |
| 361 gtk_text_insert(GTK_TEXT(plugtext), NULL, NULL, NULL, buffer, -1); |
361 gtk_text_insert(GTK_TEXT(plugtext), NULL, NULL, NULL, buffer, -1); |
| 362 |
362 |
| 363 gaim_plugin_config = dlsym(p->handle, "gaim_plugin_config"); |
363 gaim_plugin_config = dlsym(p->handle, "gaim_plugin_config"); |
| 364 if ((error = dlerror()) == NULL) { |
364 if ((error = (char *)dlerror()) == NULL) { |
| 365 gtk_signal_connect(GTK_OBJECT(config), "clicked", |
365 gtk_signal_connect(GTK_OBJECT(config), "clicked", |
| 366 GTK_SIGNAL_FUNC(gaim_plugin_config), NULL); |
366 GTK_SIGNAL_FUNC(gaim_plugin_config), NULL); |
| 367 gtk_widget_set_sensitive(config, 1); |
367 gtk_widget_set_sensitive(config, 1); |
| 368 } else { |
368 } else { |
| 369 gtk_widget_set_sensitive(config, 0); |
369 gtk_widget_set_sensitive(config, 0); |