Mercurial > pidgin
annotate src/plugins.c @ 2372:2927c2c26fe6
[gaim-migrate @ 2385]
reformatting. nothing else.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Thu, 27 Sep 2001 19:17:11 +0000 |
parents | 8a304d8c5ce3 |
children | a7ecfd3f7714 |
rev | line source |
---|---|
1 | 1 /* |
2 * gaim | |
3 * | |
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 * ---------------- | |
21 * The Plug-in plug | |
22 * | |
23 * Plugin support is currently being maintained by Mike Saraf | |
24 * msaraf@dwc.edu | |
25 * | |
90 | 26 * Well, I didn't see any work done on it for a while, so I'm going to try |
27 * my hand at it. - Eric warmenhoven@yahoo.com | |
28 * | |
1745 | 29 * Mike is my roomate. I can assure you that he's lazy :-P -- Rob rob@marko.net |
30 * | |
1 | 31 */ |
32 | |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
176
diff
changeset
|
33 #ifdef HAVE_CONFIG_H |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
34 #include <config.h> |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
176
diff
changeset
|
35 #endif |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
176
diff
changeset
|
36 |
1 | 37 #include <string.h> |
38 #include <sys/time.h> | |
39 | |
40 #include <sys/types.h> | |
41 #include <sys/stat.h> | |
42 | |
43 #include <unistd.h> | |
44 #include <stdio.h> | |
45 #include <stdlib.h> | |
46 #include <gtk/gtk.h> | |
47 #include "gaim.h" | |
48 | |
885
db5f5c33e83f
[gaim-migrate @ 895]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
49 #ifdef GAIM_PLUGINS |
db5f5c33e83f
[gaim-migrate @ 895]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
50 |
90 | 51 #include <dlfcn.h> |
52 | |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
53 #include "pixmaps/gnome_add.xpm" |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
54 #include "pixmaps/gnome_remove.xpm" |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
55 #include "pixmaps/gnome_preferences.xpm" |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
56 #include "pixmaps/refresh.xpm" |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
57 #include "pixmaps/cancel.xpm" |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
58 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
59 #define PATHSIZE 1024 /* XXX: stolen from dialogs.c */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
60 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
61 |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
62 /* ------------------ Global Variables ----------------------- */ |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
63 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
64 GList *plugins = NULL; |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
65 GList *callbacks = NULL; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
66 |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
67 /* ------------------ Local Variables ------------------------ */ |
1 | 68 |
90 | 69 static GtkWidget *plugin_dialog = NULL; |
70 | |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
71 static GtkWidget *pluglist = NULL; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
72 static GtkWidget *plugtext = NULL; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
73 static GtkWidget *plugwindow = NULL; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
74 static GtkWidget *plugentry = NULL; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
75 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
76 static GtkTooltips *tooltips = NULL; |
1 | 77 |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
78 static GtkWidget *config = NULL; |
403
d6f02d7f78d8
[gaim-migrate @ 413]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
397
diff
changeset
|
79 static guint confighandle = 0; |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
80 static GtkWidget *reload = NULL; |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
81 static GtkWidget *unload = NULL; |
1025
84a5d80e52f1
[gaim-migrate @ 1035]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
82 static char *last_dir = NULL; |
110
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
83 |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
84 /* --------------- Function Declarations --------------------- */ |
1 | 85 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
86 void show_plugins(GtkWidget *, gpointer); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
87 void load_plugin(char *); |
90 | 88 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
89 void gaim_signal_connect(GModule *, enum gaim_event, void *, void *); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
90 void gaim_signal_disconnect(GModule *, enum gaim_event, void *); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
91 void gaim_plugin_unload(GModule *); |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
92 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
93 /* UI button callbacks */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
94 static void plugin_reload_cb(GtkWidget *, gpointer); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
95 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
96 static const gchar *plugin_makelistname(GModule *); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
97 static void plugin_remove_callbacks(GModule *); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
98 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
99 static void plugin_reload(struct gaim_plugin *p); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
100 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
101 static void destroy_plugins(GtkWidget *, gpointer); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
102 static void load_file(GtkWidget *, gpointer); |
90 | 103 static void load_which_plugin(GtkWidget *, gpointer); |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
104 static void unload_plugin(GtkWidget *, gpointer); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
105 static void unload_immediate(GModule *); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
106 static void list_clicked(GtkWidget *, struct gaim_plugin *); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
107 static void update_show_plugins(); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
108 static void hide_plugins(GtkWidget *, gpointer); |
90 | 109 |
1 | 110 /* ------------------ Code Below ---------------------------- */ |
111 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
112 static void destroy_plugins(GtkWidget *w, gpointer data) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
113 { |
90 | 114 if (plugin_dialog) |
115 gtk_widget_destroy(plugin_dialog); | |
116 plugin_dialog = NULL; | |
117 } | |
118 | |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
139
diff
changeset
|
119 static void load_file(GtkWidget *w, gpointer data) |
1 | 120 { |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
121 gchar *buf; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
122 |
138
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
123 if (plugin_dialog) { |
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
124 gtk_widget_show(plugin_dialog); |
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
125 gdk_window_raise(plugin_dialog->window); |
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
126 return; |
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
127 } |
90 | 128 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
129 plugin_dialog = gtk_file_selection_new(_("Gaim - Plugin List")); |
138
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
130 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
131 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(plugin_dialog)); |
90 | 132 |
1025
84a5d80e52f1
[gaim-migrate @ 1035]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
133 if (!last_dir) |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1145
diff
changeset
|
134 buf = g_strdup(LIBDIR); |
153
8ed64c704fb0
[gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
142
diff
changeset
|
135 else |
1025
84a5d80e52f1
[gaim-migrate @ 1035]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
136 buf = g_strconcat(last_dir, G_DIR_SEPARATOR_S, NULL); |
1 | 137 |
90 | 138 gtk_file_selection_set_filename(GTK_FILE_SELECTION(plugin_dialog), buf); |
153
8ed64c704fb0
[gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
142
diff
changeset
|
139 gtk_file_selection_complete(GTK_FILE_SELECTION(plugin_dialog), "*.so"); |
90 | 140 gtk_signal_connect(GTK_OBJECT(plugin_dialog), "destroy", |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
141 GTK_SIGNAL_FUNC(destroy_plugins), plugin_dialog); |
90 | 142 |
143 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(plugin_dialog)->ok_button), | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
144 "clicked", GTK_SIGNAL_FUNC(load_which_plugin), NULL); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
145 |
90 | 146 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(plugin_dialog)->cancel_button), |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
147 "clicked", GTK_SIGNAL_FUNC(destroy_plugins), NULL); |
90 | 148 |
149 g_free(buf); | |
626
d86cc11faab8
[gaim-migrate @ 636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
150 gtk_widget_show(plugin_dialog); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
151 gdk_window_raise(plugin_dialog->window); |
90 | 152 } |
1 | 153 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
154 static void load_which_plugin(GtkWidget *w, gpointer data) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
155 { |
1035
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1025
diff
changeset
|
156 char *file; |
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1025
diff
changeset
|
157 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
158 file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(plugin_dialog)); |
1035
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1025
diff
changeset
|
159 if (file_is_dir(file, plugin_dialog)) { |
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1025
diff
changeset
|
160 return; |
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1025
diff
changeset
|
161 } |
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1025
diff
changeset
|
162 |
1710
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
163 if (file) |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
164 load_plugin(file); |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
139
diff
changeset
|
165 |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
139
diff
changeset
|
166 if (plugin_dialog) |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
139
diff
changeset
|
167 gtk_widget_destroy(plugin_dialog); |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
139
diff
changeset
|
168 plugin_dialog = NULL; |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
139
diff
changeset
|
169 } |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
139
diff
changeset
|
170 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
171 void load_plugin(char *filename) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
172 { |
90 | 173 struct gaim_plugin *plug; |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
174 GList *c = plugins; |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
175 char *(*gaim_plugin_init)(GModule *); |
90 | 176 char *(*cfunc)(); |
177 char *error; | |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
178 char *retval; |
90 | 179 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
180 if (!g_module_supported()) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
181 return; |
1710
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
182 if (filename && !strlen(filename)) |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
183 return; |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
184 |
1710
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
185 while (filename && c) { |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
186 plug = (struct gaim_plugin *)c->data; |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
187 if (!strcmp(filename, g_module_name(plug->handle))) { |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
188 /* just need to reload plugin */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
189 plugin_reload(plug); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
190 return; |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
191 } else |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
192 c = g_list_next(c); |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
193 } |
90 | 194 plug = g_malloc(sizeof *plug); |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
195 |
1710
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
196 if (filename) { |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
197 if (last_dir) |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
198 g_free(last_dir); |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
199 last_dir = g_dirname(filename); |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
200 } |
1025
84a5d80e52f1
[gaim-migrate @ 1035]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
201 |
1236
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1185
diff
changeset
|
202 debug_printf("Loading %s\n", filename); |
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1185
diff
changeset
|
203 plug->handle = g_module_open(filename, 0); |
90 | 204 if (!plug->handle) { |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
205 error = (char *)g_module_error(); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
206 do_error_dialog(error, _("Plugin Error")); |
90 | 207 g_free(plug); |
208 return; | |
209 } | |
210 | |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
211 if (!g_module_symbol(plug->handle, "gaim_plugin_init", (gpointer *)&gaim_plugin_init)) { |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
212 do_error_dialog(g_module_error(), _("Plugin Error")); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
213 g_module_close(plug->handle); |
90 | 214 g_free(plug); |
215 return; | |
216 } | |
217 | |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
218 retval = (*gaim_plugin_init)(plug->handle); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
219 debug_printf("loaded plugin returned %s\n", retval ? retval : "NULL"); |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
220 if (retval) { |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
221 plugin_remove_callbacks(plug->handle); |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
222 do_error_dialog(retval, _("Plugin Error")); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
223 g_module_close(plug->handle); |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
224 g_free(plug); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
225 return; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
226 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
227 |
90 | 228 plugins = g_list_append(plugins, plug); |
1 | 229 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2360
diff
changeset
|
230 if (g_module_symbol(plug->handle, "name", (gpointer *)&cfunc)) { |
90 | 231 plug->name = (*cfunc)(); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2360
diff
changeset
|
232 } else { |
90 | 233 plug->name = NULL; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2360
diff
changeset
|
234 } |
1 | 235 |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
236 if (g_module_symbol(plug->handle, "description", (gpointer *)&cfunc)) |
90 | 237 plug->description = (*cfunc)(); |
238 else | |
239 plug->description = NULL; | |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
240 |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
241 update_show_plugins(); |
153
8ed64c704fb0
[gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
142
diff
changeset
|
242 save_prefs(); |
90 | 243 } |
1 | 244 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
245 void show_plugins(GtkWidget *w, gpointer data) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
246 { |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
247 /* most of this code was shamelessly stolen from Glade */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
248 GtkWidget *mainvbox; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
249 GtkWidget *tophbox; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
250 GtkWidget *bothbox; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
251 GtkWidget *hbox; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
252 GtkWidget *vbox; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
253 GtkWidget *frame; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
254 GtkWidget *scrolledwindow; |
90 | 255 GtkWidget *label; |
256 GtkWidget *add; | |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
257 GtkWidget *close; |
90 | 258 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
259 if (plugwindow) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
260 return; |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
261 |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
262 plugwindow = gtk_window_new(GTK_WINDOW_DIALOG); |
905 | 263 gtk_window_set_wmclass(GTK_WINDOW(plugwindow), "plugins", "Gaim"); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
264 gtk_widget_realize(plugwindow); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
265 aol_icon(plugwindow->window); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
266 gtk_window_set_title(GTK_WINDOW(plugwindow), _("Gaim - Plugins")); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
267 gtk_widget_set_usize(plugwindow, 515, 300); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
268 gtk_signal_connect(GTK_OBJECT(plugwindow), "destroy", GTK_SIGNAL_FUNC(hide_plugins), NULL); |
90 | 269 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
270 mainvbox = gtk_vbox_new(FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
271 gtk_container_add(GTK_CONTAINER(plugwindow), mainvbox); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
272 gtk_widget_show(mainvbox); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
273 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
274 /* Build the top */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
275 tophbox = gtk_hbox_new(FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
276 gtk_box_pack_start(GTK_BOX(mainvbox), tophbox, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
277 gtk_widget_show(tophbox); |
90 | 278 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
279 /* Left side: frame with list of plugin file names */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
280 frame = gtk_frame_new(_("Plugins")); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
281 gtk_box_pack_start(GTK_BOX(tophbox), frame, FALSE, FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
282 gtk_widget_set_usize(frame, 140, -1); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
283 gtk_container_set_border_width(GTK_CONTAINER(frame), 6); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
284 gtk_frame_set_label_align(GTK_FRAME(frame), 0.05, 0.5); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
285 gtk_widget_show(frame); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
286 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
287 scrolledwindow = gtk_scrolled_window_new(NULL, NULL); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
288 gtk_container_add(GTK_CONTAINER(frame), scrolledwindow); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
289 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow), |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
290 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
291 gtk_widget_show(scrolledwindow); |
90 | 292 |
293 pluglist = gtk_list_new(); | |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
294 gtk_list_set_selection_mode(GTK_LIST(pluglist), GTK_SELECTION_BROWSE); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
295 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwindow), pluglist); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
296 gtk_widget_show(pluglist); |
90 | 297 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
298 /* Right side: frame with description and the filepath of plugin */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
299 frame = gtk_frame_new(_("Description")); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
300 gtk_box_pack_start(GTK_BOX(tophbox), frame, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
301 gtk_container_set_border_width(GTK_CONTAINER(frame), 6); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
302 gtk_frame_set_label_align(GTK_FRAME(frame), 0.05, 0.5); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
303 gtk_widget_show(frame); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
304 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
305 vbox = gtk_vbox_new(FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
306 gtk_container_add(GTK_CONTAINER(frame), vbox); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
307 gtk_widget_show(vbox); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
308 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
309 scrolledwindow = gtk_scrolled_window_new(NULL, NULL); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
310 gtk_box_pack_start(GTK_BOX(vbox), scrolledwindow, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
311 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow), |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
312 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
313 gtk_widget_show(scrolledwindow); |
90 | 314 |
315 plugtext = gtk_text_new(NULL, NULL); | |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
316 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwindow), plugtext); |
90 | 317 gtk_text_set_word_wrap(GTK_TEXT(plugtext), TRUE); |
318 gtk_text_set_editable(GTK_TEXT(plugtext), FALSE); | |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
319 gtk_widget_show(plugtext); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
320 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
321 hbox = gtk_hbox_new(FALSE, 5); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
322 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
323 gtk_container_set_border_width(GTK_CONTAINER(hbox), 6); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
324 gtk_widget_show(hbox); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
325 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
326 label = gtk_label_new(_("Filepath:")); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
327 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
328 gtk_widget_show(label); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
329 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
330 plugentry = gtk_entry_new(); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
331 gtk_box_pack_start(GTK_BOX(hbox), plugentry, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
332 gtk_entry_set_editable(GTK_ENTRY(plugentry), FALSE); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
333 gtk_widget_show(plugentry); |
90 | 334 |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
335 /* Build the bottom button bar */ |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
336 bothbox = gtk_hbox_new(TRUE, 10); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
337 gtk_box_pack_start(GTK_BOX(mainvbox), bothbox, FALSE, FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
338 gtk_container_set_border_width(GTK_CONTAINER(hbox), 5); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
339 gtk_widget_show(bothbox); |
110
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
340 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
341 if (!tooltips) |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
342 tooltips = gtk_tooltips_new(); |
90 | 343 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
344 add = picture_button(plugwindow, _("Load"), gnome_add_xpm); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
345 gtk_signal_connect(GTK_OBJECT(add), "clicked", GTK_SIGNAL_FUNC(load_file), NULL); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
346 gtk_box_pack_start(GTK_BOX(bothbox), add, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
347 gtk_tooltips_set_tip(tooltips, add, _("Load a plugin from a file"), ""); |
90 | 348 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
349 config = picture_button(plugwindow, _("Configure"), gnome_preferences_xpm); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
350 gtk_widget_set_sensitive(config, FALSE); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
351 gtk_box_pack_start(GTK_BOX(bothbox), config, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
352 gtk_tooltips_set_tip(tooltips, config, _("Configure settings of the selected plugin"), ""); |
90 | 353 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
354 reload = picture_button(plugwindow, _("Reload"), refresh_xpm); |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
355 gtk_widget_set_sensitive(reload, FALSE); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
356 gtk_signal_connect(GTK_OBJECT(reload), "clicked", GTK_SIGNAL_FUNC(plugin_reload_cb), NULL); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
357 gtk_box_pack_start(GTK_BOX(bothbox), reload, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
358 gtk_tooltips_set_tip(tooltips, reload, _("Reload the selected plugin"), ""); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
359 |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
360 unload = picture_button(plugwindow, _("Unload"), gnome_remove_xpm); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
361 gtk_signal_connect(GTK_OBJECT(unload), "clicked", GTK_SIGNAL_FUNC(unload_plugin), pluglist); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
362 gtk_box_pack_start(GTK_BOX(bothbox), unload, TRUE, TRUE, 0); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
363 gtk_tooltips_set_tip(tooltips, unload, _("Unload the selected plugin"), ""); |
90 | 364 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
365 close = picture_button(plugwindow, _("Close"), cancel_xpm); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
366 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(hide_plugins), NULL); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
367 gtk_box_pack_start(GTK_BOX(bothbox), close, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
368 gtk_tooltips_set_tip(tooltips, close, _("Close this window"), ""); |
90 | 369 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
370 update_show_plugins(); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
371 gtk_widget_show(plugwindow); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
372 } |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
373 |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
374 static void update_show_plugins() |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
375 { |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
376 GList *plugs = plugins; |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
377 struct gaim_plugin *p; |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
378 GtkWidget *label; |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
379 GtkWidget *list_item; |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
380 GtkWidget *hbox; |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
381 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
382 if (plugwindow == NULL) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
383 return; |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
384 |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
385 gtk_list_clear_items(GTK_LIST(pluglist), 0, -1); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
386 while (plugs) { |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
387 p = (struct gaim_plugin *)plugs->data; |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
388 label = gtk_label_new(plugin_makelistname(p->handle)); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
389 hbox = gtk_hbox_new(FALSE, 0); /* for left justification */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
390 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
391 |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
392 list_item = gtk_list_item_new(); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
393 gtk_container_add(GTK_CONTAINER(list_item), hbox); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
394 gtk_signal_connect(GTK_OBJECT(list_item), "select", GTK_SIGNAL_FUNC(list_clicked), p); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
395 gtk_object_set_user_data(GTK_OBJECT(list_item), p); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
396 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
397 gtk_widget_show(hbox); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
398 gtk_widget_show(label); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
399 gtk_container_add(GTK_CONTAINER(pluglist), list_item); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
400 gtk_widget_show(list_item); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
401 |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
402 plugs = g_list_next(plugs); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
403 } |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
404 |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
405 /* Clear the display if nothing's selected */ |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
406 if (GTK_LIST(pluglist)->selection == NULL) { |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
407 guint text_len = gtk_text_get_length(GTK_TEXT(plugtext)); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
408 gtk_text_set_point(GTK_TEXT(plugtext), 0); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
409 gtk_text_forward_delete(GTK_TEXT(plugtext), text_len); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
410 gtk_entry_set_text(GTK_ENTRY(plugentry), ""); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
411 |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
412 gtk_widget_set_sensitive(config, FALSE); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
413 gtk_widget_set_sensitive(reload, FALSE); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
414 gtk_widget_set_sensitive(unload, FALSE); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
415 } |
1 | 416 } |
417 | |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
418 static void unload_plugin(GtkWidget *w, gpointer data) |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
419 { |
90 | 420 GList *i; |
421 struct gaim_plugin *p; | |
422 void (*gaim_plugin_remove)(); | |
423 | |
424 i = GTK_LIST(pluglist)->selection; | |
425 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
426 if (i == NULL) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
427 return; |
90 | 428 |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
429 p = gtk_object_get_user_data(GTK_OBJECT(i->data)); |
1 | 430 |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
431 /* Attempt to call the plugin's remove function (if there) */ |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
432 if (g_module_symbol(p->handle, "gaim_plugin_remove", (gpointer *)&gaim_plugin_remove)) |
90 | 433 (*gaim_plugin_remove)(); |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
434 |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
435 unload_immediate(p->handle); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
436 update_show_plugins(); |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
437 } |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
438 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
439 static void unload_for_real(void *handle) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
440 { |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
441 GList *i; |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
442 struct gaim_plugin *p = NULL; |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
443 |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
444 i = plugins; |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
445 while (i) { |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
446 p = (struct gaim_plugin *)i->data; |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
447 if (handle == p->handle) |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
448 break; |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
449 p = NULL; |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
450 i = g_list_next(i); |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
451 } |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
452 |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
453 if (!p) |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
454 return; |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
455 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
456 debug_printf("Unloading %s\n", g_module_name(p->handle)); |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
457 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
458 plugin_remove_callbacks(p->handle); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
459 |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
460 plugins = g_list_remove(plugins, p); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
970
diff
changeset
|
461 g_free(p); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
462 update_show_plugins(); |
154
1c4e47c0c5dd
[gaim-migrate @ 164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
153
diff
changeset
|
463 save_prefs(); |
90 | 464 } |
465 | |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
466 static void unload_immediate(GModule *handle) |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
467 { |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
468 unload_for_real(handle); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
469 g_module_close(handle); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
470 } |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
471 |
2150
eb2cadb18479
[gaim-migrate @ 2160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2140
diff
changeset
|
472 static gboolean unload_timeout(gpointer handle) |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
473 { |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
474 g_module_close(handle); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
475 return FALSE; |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
476 } |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
477 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
478 void gaim_plugin_unload(GModule *handle) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
479 { |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
480 unload_for_real(handle); |
2131
acc11216ec5d
[gaim-migrate @ 2141]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2125
diff
changeset
|
481 g_timeout_add(5000, unload_timeout, handle); |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
482 } |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
483 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
484 static void plugin_reload_cb(GtkWidget *w, gpointer data) |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
485 { |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
486 GList *i; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
487 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
488 i = GTK_LIST(pluglist)->selection; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
489 if (i == NULL) |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
490 return; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
491 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
492 /* Just pass off plugin to the actual function */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
493 plugin_reload(gtk_object_get_user_data(GTK_OBJECT(i->data))); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
494 } |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
495 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
496 /* Do unload/load cycle of plugin. */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
497 static void plugin_reload(struct gaim_plugin *p) |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
498 { |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
499 char file[PATHSIZE]; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
500 void (*gaim_plugin_remove)(); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
501 GModule *handle = p->handle; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
502 struct gaim_plugin *plug; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
503 GList *plugs; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
504 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
505 strncpy(file, g_module_name(handle), sizeof(file)); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
506 file[sizeof(file) - 1] = '\0'; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
507 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
508 debug_printf("Reloading %s\n", file); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
509 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
510 /* Unload */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
511 if (g_module_symbol(handle, "gaim_plugin_remove", (gpointer *)&gaim_plugin_remove)) |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
512 (*gaim_plugin_remove)(); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
513 unload_immediate(handle); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
514 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
515 /* Load */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
516 load_plugin(file); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
517 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
518 /* Try and reselect the plugin in list */ |
2280
13d5d7e829c9
[gaim-migrate @ 2290]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2274
diff
changeset
|
519 if (!pluglist) |
13d5d7e829c9
[gaim-migrate @ 2290]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2274
diff
changeset
|
520 return; |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
521 plugs = plugins; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
522 while (plugs) { |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
523 plug = plugs->data; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
524 if (!strcmp(file, g_module_name(plug->handle))) { |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
525 gtk_list_select_item(GTK_LIST(pluglist), g_list_index(plugins, plug)); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
526 return; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
527 } |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
528 plugs = plugs->next; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
529 } |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
530 } |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
531 |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
532 static void list_clicked(GtkWidget *w, struct gaim_plugin *p) |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
533 { |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
534 gchar *temp; |
90 | 535 guint text_len; |
110
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
536 void (*gaim_plugin_config)(); |
90 | 537 |
522
11cbf8b403b6
[gaim-migrate @ 532]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
425
diff
changeset
|
538 if (confighandle != 0) |
403
d6f02d7f78d8
[gaim-migrate @ 413]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
397
diff
changeset
|
539 gtk_signal_disconnect(GTK_OBJECT(config), confighandle); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
540 |
90 | 541 text_len = gtk_text_get_length(GTK_TEXT(plugtext)); |
542 gtk_text_set_point(GTK_TEXT(plugtext), 0); | |
543 gtk_text_forward_delete(GTK_TEXT(plugtext), text_len); | |
544 | |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
545 temp = g_strdup_printf("Name: %s\n\nDescription:\n%s", |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
546 (p->name != NULL) ? p->name : "", |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
547 (p->description != NULL) ? p->description : ""); |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
548 gtk_text_insert(GTK_TEXT(plugtext), NULL, NULL, NULL, temp, -1); |
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
549 g_free(temp); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
550 gtk_entry_set_text(GTK_ENTRY(plugentry), g_module_name(p->handle)); |
110
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
551 |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
552 /* Find out if this plug-in has a configuration function */ |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
553 if (g_module_symbol(p->handle, "gaim_plugin_config", (gpointer *)&gaim_plugin_config)) { |
403
d6f02d7f78d8
[gaim-migrate @ 413]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
397
diff
changeset
|
554 confighandle = gtk_signal_connect(GTK_OBJECT(config), "clicked", |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
555 GTK_SIGNAL_FUNC(gaim_plugin_config), NULL); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
556 gtk_widget_set_sensitive(config, TRUE); |
110
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
557 } else { |
403
d6f02d7f78d8
[gaim-migrate @ 413]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
397
diff
changeset
|
558 confighandle = 0; |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
559 gtk_widget_set_sensitive(config, FALSE); |
110
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
560 } |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
561 |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
562 gtk_widget_set_sensitive(reload, TRUE); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
563 gtk_widget_set_sensitive(unload, TRUE); |
90 | 564 } |
565 | |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
566 static void hide_plugins(GtkWidget *w, gpointer data) |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
567 { |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
568 if (plugwindow) |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
569 gtk_widget_destroy(plugwindow); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
570 plugwindow = NULL; |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
571 config = NULL; |
522
11cbf8b403b6
[gaim-migrate @ 532]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
425
diff
changeset
|
572 confighandle = 0; |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
573 } |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
574 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
575 static const gchar *plugin_makelistname(GModule *module) |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
576 { |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
577 static gchar filename[PATHSIZE]; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
578 gchar *filepath = g_module_name(module); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
579 char *cp; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
580 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
581 if (filepath == NULL || strlen(filepath) == 0) |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
582 return NULL; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
583 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
584 if ((cp = strrchr(filepath, '/')) == NULL || *++cp == '\0') |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
585 cp = filepath; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
586 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
587 strncpy(filename, cp, sizeof(filename)); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
588 filename[sizeof(filename) - 1] = '\0'; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
589 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
590 /* Try to pretty name by removing any trailing ".so" */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
591 if (strlen(filename) > 3 && |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
592 strncmp(filename + strlen(filename) - 3, ".so", 3) == 0) |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
593 filename[strlen(filename) - 3] = '\0'; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
594 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
595 return filename; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
596 } |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
597 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
598 /* Remove all callbacks associated with plugin handle */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
599 static void plugin_remove_callbacks(GModule *handle) |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
600 { |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
601 GList *c = callbacks; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
602 struct gaim_callback *g; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
603 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
604 debug_printf("%d callbacks to search\n", g_list_length(callbacks)); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
605 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
606 while (c) { |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
607 g = (struct gaim_callback *)c->data; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
608 if (g->handle == handle) { |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
609 c = g_list_next(c); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
610 callbacks = g_list_remove(callbacks, (gpointer)g); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
611 debug_printf("Removing callback, %d remain\n", g_list_length(callbacks)); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
612 } else |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
613 c = g_list_next(c); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
614 } |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
615 } |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
616 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
617 void gaim_signal_connect(GModule *handle, enum gaim_event which, void *func, void *data) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
618 { |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
970
diff
changeset
|
619 struct gaim_callback *call = g_new0(struct gaim_callback, 1); |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
620 call->handle = handle; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
621 call->event = which; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
622 call->function = func; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
623 call->data = data; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
624 |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
625 callbacks = g_list_append(callbacks, call); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
626 debug_printf("Adding callback %d\n", g_list_length(callbacks)); |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
627 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
628 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
629 void gaim_signal_disconnect(GModule *handle, enum gaim_event which, void *func) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
630 { |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
631 GList *c = callbacks; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
632 struct gaim_callback *g = NULL; |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
633 |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
634 while (c) { |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
635 g = (struct gaim_callback *)c->data; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
636 if (handle == g->handle && func == g->function) { |
138
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
637 callbacks = g_list_remove(callbacks, c->data); |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
638 g_free(g); |
138
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
639 c = callbacks; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
640 if (c == NULL) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
641 break; |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
642 } |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
643 c = g_list_next(c); |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
644 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
645 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
646 |
90 | 647 #endif /* GAIM_PLUGINS */ |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
648 |
2345
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
649 static char *event_name(enum gaim_event event) |
797
c13e78ae0f86
[gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
789
diff
changeset
|
650 { |
c13e78ae0f86
[gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
789
diff
changeset
|
651 static char buf[128]; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
652 switch (event) { |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
653 case event_signon: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
654 sprintf(buf, "event_signon"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
655 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
656 case event_signoff: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
657 sprintf(buf, "event_signoff"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
658 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
659 case event_away: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
660 sprintf(buf, "event_away"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
661 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
662 case event_back: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
663 sprintf(buf, "event_back"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
664 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
665 case event_im_recv: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
666 sprintf(buf, "event_im_recv"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
667 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
668 case event_im_send: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
669 sprintf(buf, "event_im_send"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
670 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
671 case event_buddy_signon: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
672 sprintf(buf, "event_buddy_signon"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
673 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
674 case event_buddy_signoff: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
675 sprintf(buf, "event_buddy_signoff"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
676 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
677 case event_buddy_away: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
678 sprintf(buf, "event_buddy_away"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
679 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
680 case event_buddy_back: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
681 sprintf(buf, "event_buddy_back"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
682 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
683 case event_buddy_idle: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
684 sprintf(buf, "event_buddy_idle"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
685 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
686 case event_buddy_unidle: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
687 sprintf(buf, "event_buddy_unidle"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
688 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
689 case event_blist_update: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
690 sprintf(buf, "event_blist_update"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
691 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
692 case event_chat_invited: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
693 sprintf(buf, "event_chat_invited"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
694 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
695 case event_chat_join: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
696 sprintf(buf, "event_chat_join"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
697 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
698 case event_chat_leave: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
699 sprintf(buf, "event_chat_leave"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
700 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
701 case event_chat_buddy_join: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
702 sprintf(buf, "event_chat_buddy_join"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
703 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
704 case event_chat_buddy_leave: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
705 sprintf(buf, "event_chat_buddy_leave"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
706 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
707 case event_chat_recv: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
708 sprintf(buf, "event_chat_recv"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
709 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
710 case event_chat_send: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
711 sprintf(buf, "event_chat_send"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
712 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
713 case event_warned: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
714 sprintf(buf, "event_warned"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
715 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
716 case event_error: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
717 sprintf(buf, "event_error"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
718 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
719 case event_quit: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
720 sprintf(buf, "event_quit"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
721 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
722 case event_new_conversation: |
1745 | 723 sprintf(buf, "event_new_conversation"); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
724 break; |
1749
5bfc58c20e82
[gaim-migrate @ 1759]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1745
diff
changeset
|
725 case event_set_info: |
5bfc58c20e82
[gaim-migrate @ 1759]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1745
diff
changeset
|
726 sprintf(buf, "event_set_info"); |
5bfc58c20e82
[gaim-migrate @ 1759]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1745
diff
changeset
|
727 break; |
1874
1e33bd2d7780
[gaim-migrate @ 1884]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1749
diff
changeset
|
728 case event_draw_menu: |
1e33bd2d7780
[gaim-migrate @ 1884]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1749
diff
changeset
|
729 sprintf(buf, "event_draw_menu"); |
1e33bd2d7780
[gaim-migrate @ 1884]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1749
diff
changeset
|
730 break; |
2104
0b81421021fd
[gaim-migrate @ 2114]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2102
diff
changeset
|
731 case event_im_displayed_sent: |
0b81421021fd
[gaim-migrate @ 2114]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2102
diff
changeset
|
732 sprintf(buf, "event_im_displayed_sent"); |
0b81421021fd
[gaim-migrate @ 2114]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2102
diff
changeset
|
733 break; |
0b81421021fd
[gaim-migrate @ 2114]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2102
diff
changeset
|
734 case event_im_displayed_rcvd: |
0b81421021fd
[gaim-migrate @ 2114]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2102
diff
changeset
|
735 sprintf(buf, "event_im_displayed_rcvd"); |
2102
899c22dcee42
[gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
736 break; |
2345
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
737 case event_chat_send_invite: |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
738 sprintf(buf, "event_chat_send_invite"); |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
739 break; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
740 default: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
741 sprintf(buf, "event_unknown"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
742 break; |
797
c13e78ae0f86
[gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
789
diff
changeset
|
743 } |
c13e78ae0f86
[gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
789
diff
changeset
|
744 return buf; |
c13e78ae0f86
[gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
789
diff
changeset
|
745 } |
c13e78ae0f86
[gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
789
diff
changeset
|
746 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
747 int plugin_event(enum gaim_event event, void *arg1, void *arg2, void *arg3, void *arg4) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
748 { |
783
5bad8e4d1c88
[gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
749 #ifdef USE_PERL |
5bad8e4d1c88
[gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
750 char buf[BUF_LONG]; |
5bad8e4d1c88
[gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
751 #endif |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
752 #ifdef GAIM_PLUGINS |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
753 GList *c = callbacks; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
754 struct gaim_callback *g; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
755 |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
756 while (c) { |
2345
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
757 void (*zero)(void *); |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
758 void (*one)(void *, void *); |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
759 void (*two)(void *, void *, void *); |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
760 void (*three)(void *, void *, void *, void *); |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
761 void (*four)(void *, void *, void *, void *, void *); |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
762 |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
763 g = (struct gaim_callback *)c->data; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
764 if (g->event == event && g->function !=NULL) { |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
765 switch (event) { |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
766 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
767 /* no args */ |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
768 case event_blist_update: |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
769 case event_quit: |
2345
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
770 zero = g->function; |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
771 (*zero)(g->data); |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
772 break; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
773 |
2345
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
774 /* one arg */ |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
775 case event_signon: |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
776 case event_signoff: |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
777 case event_new_conversation: |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
778 case event_error: |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
779 one = g->function; |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
780 (*one)(arg1, g->data); |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
781 break; |
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
782 |
2345
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
783 /* two args */ |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
784 case event_buddy_signon: |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
785 case event_buddy_signoff: |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
786 case event_buddy_away: |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
787 case event_buddy_back: |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
788 case event_buddy_idle: |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
789 case event_buddy_unidle: |
2345
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
790 case event_chat_leave: |
1749
5bfc58c20e82
[gaim-migrate @ 1759]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1745
diff
changeset
|
791 case event_set_info: |
2345
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
792 case event_draw_menu: |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
793 two = g->function; |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
794 (*two)(arg1, arg2, g->data); |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
795 break; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
796 |
2345
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
797 /* three args */ |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
798 case event_im_send: |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
799 case event_im_displayed_sent: |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
800 case event_chat_join: |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
801 case event_chat_buddy_join: |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
802 case event_chat_buddy_leave: |
2345
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
803 case event_chat_send: |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
804 case event_away: |
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
805 case event_back: |
2345
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
806 case event_warned: |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
807 three = g->function; |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
808 (*three)(arg1, arg2, arg3, g->data); |
2273
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2150
diff
changeset
|
809 break; |
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2150
diff
changeset
|
810 |
2345
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
811 /* four args */ |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
812 case event_im_recv: |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
813 case event_chat_recv: |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
814 case event_im_displayed_rcvd: |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
815 case event_chat_send_invite: |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
816 case event_chat_invited: |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
817 four = g->function; |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
818 (*four)(arg1, arg2, arg3, arg4, g->data); |
1874
1e33bd2d7780
[gaim-migrate @ 1884]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1749
diff
changeset
|
819 break; |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
820 |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
821 default: |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
822 debug_printf("unknown event %d\n", event); |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
823 break; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
824 } |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
825 } |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
826 c = c->next; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
827 } |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
828 #endif /* GAIM_PLUGINS */ |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
829 #ifdef USE_PERL |
783
5bad8e4d1c88
[gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
830 switch (event) { |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
831 case event_signon: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
832 case event_signoff: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
833 case event_away: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
834 case event_back: |
2355
571971659533
[gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2345
diff
changeset
|
835 g_snprintf(buf, sizeof buf, "%lu", (unsigned long)arg1); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
836 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
837 case event_im_recv: |
2355
571971659533
[gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2345
diff
changeset
|
838 g_snprintf(buf, sizeof buf, "%lu \"%s\" %s", (unsigned long)arg1, |
1712
560b3117aedf
[gaim-migrate @ 1722]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
839 *(char **)arg2 ? *(char **)arg2 : "(null)", |
560b3117aedf
[gaim-migrate @ 1722]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
840 *(char **)arg3 ? *(char **)arg3 : "(null)"); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
841 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
842 case event_im_send: |
2355
571971659533
[gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2345
diff
changeset
|
843 g_snprintf(buf, sizeof buf, "%lu \"%s\" %s", (unsigned long)arg1, |
2345
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
844 (char *)arg2, *(char **)arg3 ? *(char **)arg3 : "(null)"); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
845 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
846 case event_buddy_signon: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
847 case event_buddy_signoff: |
1749
5bfc58c20e82
[gaim-migrate @ 1759]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1745
diff
changeset
|
848 case event_set_info: |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
849 case event_buddy_away: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
850 case event_buddy_back: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
851 case event_buddy_idle: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
852 case event_buddy_unidle: |
2355
571971659533
[gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2345
diff
changeset
|
853 g_snprintf(buf, sizeof buf, "%lu \"%s\"", (unsigned long)arg1, (char *)arg2); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
854 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
855 case event_chat_invited: |
2355
571971659533
[gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2345
diff
changeset
|
856 g_snprintf(buf, sizeof buf, "%lu \"%s\" \"%s\" %s", (unsigned long)arg1, |
2345
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
857 (char *)arg2, (char *)arg3, arg4 ? (char *)arg4 : ""); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
858 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
859 case event_chat_join: |
2345
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
860 case event_chat_buddy_join: |
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
861 case event_chat_buddy_leave: |
2355
571971659533
[gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2345
diff
changeset
|
862 g_snprintf(buf, sizeof buf, "%lu %d \"%s\"", (unsigned long)arg1, |
571971659533
[gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2345
diff
changeset
|
863 (int)arg2, (char *)arg3); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
864 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
865 case event_chat_leave: |
2355
571971659533
[gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2345
diff
changeset
|
866 g_snprintf(buf, sizeof buf, "%lu %d", (unsigned long)arg1, (int)arg2); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
867 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
868 case event_chat_recv: |
2360
8a304d8c5ce3
[gaim-migrate @ 2373]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2359
diff
changeset
|
869 g_snprintf(buf, sizeof buf, "%lu %d \"%s\" %s", (unsigned long)arg1, |
8a304d8c5ce3
[gaim-migrate @ 2373]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2359
diff
changeset
|
870 (int)arg2, (char *)arg3, (char *)arg4 ? (char *)arg4 : "(null)"); |
8a304d8c5ce3
[gaim-migrate @ 2373]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2359
diff
changeset
|
871 break; |
2345
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
872 case event_chat_send_invite: |
2355
571971659533
[gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2345
diff
changeset
|
873 g_snprintf(buf, sizeof buf, "%lu %d \"%s\" %s", (unsigned long)arg1, |
2359
ad56a93661fc
[gaim-migrate @ 2372]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2355
diff
changeset
|
874 (int)arg2, (char *)arg3, *(char **)arg4 ? *(char **)arg4 : "(null)"); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
875 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
876 case event_chat_send: |
2355
571971659533
[gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2345
diff
changeset
|
877 g_snprintf(buf, sizeof buf, "%lu %d %s", (unsigned long)arg1, (int)arg2, |
1712
560b3117aedf
[gaim-migrate @ 1722]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
878 *(char **)arg3 ? *(char **)arg3 : "(null)"); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
879 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
880 case event_warned: |
2355
571971659533
[gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2345
diff
changeset
|
881 g_snprintf(buf, sizeof buf, "%lu \"%s\" %d", (unsigned long)arg1, |
571971659533
[gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2345
diff
changeset
|
882 arg2 ? (char *)arg2 : "", (int)arg3); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
883 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
884 case event_quit: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
885 buf[0] = 0; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
886 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
887 case event_new_conversation: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
888 g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg1); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
889 break; |
2104
0b81421021fd
[gaim-migrate @ 2114]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2102
diff
changeset
|
890 case event_im_displayed_sent: |
2355
571971659533
[gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2345
diff
changeset
|
891 g_snprintf(buf, sizeof buf, "%lu \"%s\" %s", (unsigned long)arg1, |
2345
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
892 (char *)arg2, *(char **)arg3 ? *(char **)arg3 : "(null)"); |
2104
0b81421021fd
[gaim-migrate @ 2114]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2102
diff
changeset
|
893 break; |
0b81421021fd
[gaim-migrate @ 2114]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2102
diff
changeset
|
894 case event_im_displayed_rcvd: |
2355
571971659533
[gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2345
diff
changeset
|
895 g_snprintf(buf, sizeof buf, "%lu \"%s\" %s", (unsigned long)arg1, |
2345
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
896 (char *)arg2, (char *)arg3 ? (char *)arg3 : "(null)"); |
2102
899c22dcee42
[gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
897 break; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
898 default: |
2345
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
899 return 0; |
783
5bad8e4d1c88
[gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
900 } |
2345
a49e8f1afbc4
[gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2280
diff
changeset
|
901 return perl_event(event_name(event), buf); |
1100
f168625b63fe
[gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
902 #else |
f168625b63fe
[gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
903 return 0; |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
904 #endif |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
905 } |
2125
af59d854de29
[gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2104
diff
changeset
|
906 |
af59d854de29
[gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2104
diff
changeset
|
907 /* Calls the gaim_plugin_remove function in any loaded plugin that has one */ |
2140
66a84ff0445a
[gaim-migrate @ 2150]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2131
diff
changeset
|
908 #ifdef GAIM_PLUGINS |
2125
af59d854de29
[gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2104
diff
changeset
|
909 void remove_all_plugins() |
af59d854de29
[gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2104
diff
changeset
|
910 { |
af59d854de29
[gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2104
diff
changeset
|
911 GList *c = plugins; |
af59d854de29
[gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2104
diff
changeset
|
912 struct gaim_plugin *p; |
af59d854de29
[gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2104
diff
changeset
|
913 void (*gaim_plugin_remove)(); |
af59d854de29
[gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2104
diff
changeset
|
914 |
af59d854de29
[gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2104
diff
changeset
|
915 while (c) { |
af59d854de29
[gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2104
diff
changeset
|
916 p = (struct gaim_plugin *)c->data; |
af59d854de29
[gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2104
diff
changeset
|
917 if (g_module_symbol(p->handle, "gaim_plugin_remove", (gpointer *)&gaim_plugin_remove)) |
af59d854de29
[gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2104
diff
changeset
|
918 (*gaim_plugin_remove)(); |
af59d854de29
[gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2104
diff
changeset
|
919 g_free(p); |
af59d854de29
[gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2104
diff
changeset
|
920 c = c->next; |
af59d854de29
[gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2104
diff
changeset
|
921 } |
af59d854de29
[gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2104
diff
changeset
|
922 } |
2140
66a84ff0445a
[gaim-migrate @ 2150]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2131
diff
changeset
|
923 #endif |