comparison src/plugins.c @ 1236:dcf9242241ee

[gaim-migrate @ 1246] fixing some plugin stuff committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 12 Dec 2000 11:31:58 +0000
parents 47cf56b72d4b
children b5783215b245
comparison
equal deleted inserted replaced
1235:a9cf2f61a7b1 1236:dcf9242241ee
148 GList *c = plugins; 148 GList *c = plugins;
149 char *(*gaim_plugin_init)(GModule *); 149 char *(*gaim_plugin_init)(GModule *);
150 char *(*cfunc)(); 150 char *(*cfunc)();
151 char *error; 151 char *error;
152 char *retval; 152 char *retval;
153 char *tmp_filename;
154 153
155 if (!g_module_supported()) return; 154 if (!g_module_supported()) return;
156 if (filename == NULL) return; 155 if (filename == NULL) return;
156 if (strlen(filename) == 0) return;
157 157
158 while (c) { 158 while (c) {
159 plug = (struct gaim_plugin *)c->data; 159 plug = (struct gaim_plugin *)c->data;
160 if (!strcmp(filename, g_module_name(plug->handle))) { 160 if (!strcmp(filename, g_module_name(plug->handle))) {
161 void (*gaim_plugin_remove)(); 161 void (*gaim_plugin_remove)();
166 c = plugins; 166 c = plugins;
167 } else 167 } else
168 c = g_list_next(c); 168 c = g_list_next(c);
169 } 169 }
170 plug = g_malloc(sizeof *plug); 170 plug = g_malloc(sizeof *plug);
171 if (!g_path_is_absolute(filename))
172 tmp_filename = g_strconcat(g_get_home_dir(), G_DIR_SEPARATOR_S,
173 PLUGIN_DIR, filename, NULL);
174 else
175 tmp_filename = g_strdup(filename);
176 171
177 if (last_dir) 172 if (last_dir)
178 g_free(last_dir); 173 g_free(last_dir);
179 last_dir = g_dirname(tmp_filename); 174 last_dir = g_dirname(filename);
180 175
181 debug_printf("Loading %s\n", tmp_filename); 176 debug_printf("Loading %s\n", filename);
182 plug->handle = g_module_open(tmp_filename, 0); 177 plug->handle = g_module_open(filename, 0);
183 g_free(tmp_filename);
184 if (!plug->handle) { 178 if (!plug->handle) {
185 error = (char *)g_module_error(); 179 error = (char *)g_module_error();
186 do_error_dialog(error, _("Plugin Error")); 180 do_error_dialog(error, _("Plugin Error"));
187 g_free(plug); 181 g_free(plug);
188 return; 182 return;