| 101 |
101 |
| 102 debug_printf("Loading %s\n", filename); |
102 debug_printf("Loading %s\n", filename); |
| 103 plug->handle = g_module_open(filename, 0); |
103 plug->handle = g_module_open(filename, 0); |
| 104 if (!plug->handle) { |
104 if (!plug->handle) { |
| 105 error = (char *)g_module_error(); |
105 error = (char *)g_module_error(); |
| 106 do_error_dialog(error, _("Plugin Error")); |
106 do_error_dialog(_("Gaim was unable to load your plugin."), error, GAIM_ERROR); |
| 107 g_free(plug); |
107 g_free(plug); |
| 108 return NULL; |
108 return NULL; |
| 109 } |
109 } |
| 110 |
110 |
| 111 if (!g_module_symbol(plug->handle, "gaim_plugin_init", (gpointer *)&gaim_plugin_init)) { |
111 if (!g_module_symbol(plug->handle, "gaim_plugin_init", (gpointer *)&gaim_plugin_init)) { |
| 112 do_error_dialog(g_module_error(), _("Plugin Error")); |
112 do_error_dialog(_("Gaim was unable to load your plugin."), g_module_error(), GAIM_ERROR); |
| 113 g_module_close(plug->handle); |
113 g_module_close(plug->handle); |
| 114 g_free(plug); |
114 g_free(plug); |
| 115 return NULL; |
115 return NULL; |
| 116 } |
116 } |
| 117 |
117 |
| 118 retval = gaim_plugin_init(plug->handle); |
118 retval = gaim_plugin_init(plug->handle); |
| 119 debug_printf("loaded plugin returned %s\n", retval ? retval : "NULL"); |
119 debug_printf("loaded plugin returned %s\n", retval ? retval : "NULL"); |
| 120 if (retval) { |
120 if (retval) { |
| 121 plugin_remove_callbacks(plug->handle); |
121 plugin_remove_callbacks(plug->handle); |
| 122 do_error_dialog(retval, _("Plugin Error")); |
122 do_error_dialog("Gaim was unable to load your plugin.", retval, GAIM_ERROR); |
| 123 g_module_close(plug->handle); |
123 g_module_close(plug->handle); |
| 124 g_free(plug); |
124 g_free(plug); |
| 125 return NULL; |
125 return NULL; |
| 126 } |
126 } |
| 127 |
127 |