Mercurial > pidgin
annotate src/plugins.c @ 2070:c0994df57443
[gaim-migrate @ 2080]
loop on read (large messages cause a disconnect without this). [This would happen while talking to SmarterChild(@hotmail.com).]
committer: Tailor Script <tailor@pidgin.im>
author | Adam Fritzler <mid@auk.cx> |
---|---|
date | Sun, 15 Jul 2001 23:08:48 +0000 |
parents | 5028a07250c7 |
children | 424a40f12a6c |
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 |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
176
diff
changeset
|
34 #include "../config.h" |
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 |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
230 if (g_module_symbol(plug->handle, "name", (gpointer *)&cfunc)) |
90 | 231 plug->name = (*cfunc)(); |
232 else | |
233 plug->name = NULL; | |
1 | 234 |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
235 if (g_module_symbol(plug->handle, "description", (gpointer *)&cfunc)) |
90 | 236 plug->description = (*cfunc)(); |
237 else | |
238 plug->description = NULL; | |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
239 |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
240 update_show_plugins(); |
153
8ed64c704fb0
[gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
142
diff
changeset
|
241 save_prefs(); |
90 | 242 } |
1 | 243 |
1710
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
244 char *gaim_plugin_init(GModule *mod) |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
245 { |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
246 void (*asdf)(void *); |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
247 char *(*gem)(); |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
248 g_module_symbol(mod, "do_stuff", (gpointer *)&asdf); |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
249 g_module_symbol(mod, "gem", (gpointer *)&gem); |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
250 asdf(gem); |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
251 return NULL; |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
252 } |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
253 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
254 void show_plugins(GtkWidget *w, gpointer data) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
255 { |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
256 /* most of this code was shamelessly stolen from Glade */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
257 GtkWidget *mainvbox; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
258 GtkWidget *tophbox; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
259 GtkWidget *bothbox; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
260 GtkWidget *hbox; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
261 GtkWidget *vbox; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
262 GtkWidget *frame; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
263 GtkWidget *scrolledwindow; |
90 | 264 GtkWidget *label; |
265 GtkWidget *add; | |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
266 GtkWidget *close; |
90 | 267 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
268 if (plugwindow) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
269 return; |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
270 |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
271 plugwindow = gtk_window_new(GTK_WINDOW_DIALOG); |
905 | 272 gtk_window_set_wmclass(GTK_WINDOW(plugwindow), "plugins", "Gaim"); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
273 gtk_widget_realize(plugwindow); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
274 aol_icon(plugwindow->window); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
275 gtk_window_set_title(GTK_WINDOW(plugwindow), _("Gaim - Plugins")); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
276 gtk_widget_set_usize(plugwindow, 515, 300); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
277 gtk_signal_connect(GTK_OBJECT(plugwindow), "destroy", GTK_SIGNAL_FUNC(hide_plugins), NULL); |
90 | 278 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
279 mainvbox = gtk_vbox_new(FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
280 gtk_container_add(GTK_CONTAINER(plugwindow), mainvbox); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
281 gtk_widget_show(mainvbox); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
282 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
283 /* Build the top */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
284 tophbox = gtk_hbox_new(FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
285 gtk_box_pack_start(GTK_BOX(mainvbox), tophbox, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
286 gtk_widget_show(tophbox); |
90 | 287 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
288 /* Left side: frame with list of plugin file names */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
289 frame = gtk_frame_new(_("Plugins")); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
290 gtk_box_pack_start(GTK_BOX(tophbox), frame, FALSE, FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
291 gtk_widget_set_usize(frame, 140, -1); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
292 gtk_container_set_border_width(GTK_CONTAINER(frame), 6); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
293 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
|
294 gtk_widget_show(frame); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
295 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
296 scrolledwindow = gtk_scrolled_window_new(NULL, NULL); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
297 gtk_container_add(GTK_CONTAINER(frame), scrolledwindow); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
298 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow), |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
299 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
300 gtk_widget_show(scrolledwindow); |
90 | 301 |
302 pluglist = gtk_list_new(); | |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
303 gtk_list_set_selection_mode(GTK_LIST(pluglist), GTK_SELECTION_BROWSE); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
304 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwindow), pluglist); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
305 gtk_widget_show(pluglist); |
90 | 306 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
307 /* Right side: frame with description and the filepath of plugin */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
308 frame = gtk_frame_new(_("Description")); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
309 gtk_box_pack_start(GTK_BOX(tophbox), frame, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
310 gtk_container_set_border_width(GTK_CONTAINER(frame), 6); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
311 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
|
312 gtk_widget_show(frame); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
313 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
314 vbox = gtk_vbox_new(FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
315 gtk_container_add(GTK_CONTAINER(frame), vbox); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
316 gtk_widget_show(vbox); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
317 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
318 scrolledwindow = gtk_scrolled_window_new(NULL, NULL); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
319 gtk_box_pack_start(GTK_BOX(vbox), scrolledwindow, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
320 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow), |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
321 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
322 gtk_widget_show(scrolledwindow); |
90 | 323 |
324 plugtext = gtk_text_new(NULL, NULL); | |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
325 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwindow), plugtext); |
90 | 326 gtk_text_set_word_wrap(GTK_TEXT(plugtext), TRUE); |
327 gtk_text_set_editable(GTK_TEXT(plugtext), FALSE); | |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
328 gtk_widget_show(plugtext); |
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 hbox = gtk_hbox_new(FALSE, 5); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
331 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
332 gtk_container_set_border_width(GTK_CONTAINER(hbox), 6); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
333 gtk_widget_show(hbox); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
334 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
335 label = gtk_label_new(_("Filepath:")); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
336 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
337 gtk_widget_show(label); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
338 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
339 plugentry = gtk_entry_new(); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
340 gtk_box_pack_start(GTK_BOX(hbox), plugentry, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
341 gtk_entry_set_editable(GTK_ENTRY(plugentry), FALSE); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
342 gtk_widget_show(plugentry); |
90 | 343 |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
344 /* Build the bottom button bar */ |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
345 bothbox = gtk_hbox_new(TRUE, 10); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
346 gtk_box_pack_start(GTK_BOX(mainvbox), bothbox, FALSE, FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
347 gtk_container_set_border_width(GTK_CONTAINER(hbox), 5); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
348 gtk_widget_show(bothbox); |
110
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
349 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
350 if (!tooltips) |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
351 tooltips = gtk_tooltips_new(); |
90 | 352 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
353 add = picture_button(plugwindow, _("Load"), gnome_add_xpm); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
354 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
|
355 gtk_box_pack_start(GTK_BOX(bothbox), add, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
356 gtk_tooltips_set_tip(tooltips, add, _("Load a plugin from a file"), ""); |
90 | 357 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
358 config = picture_button(plugwindow, _("Configure"), gnome_preferences_xpm); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
359 gtk_widget_set_sensitive(config, FALSE); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
360 gtk_box_pack_start(GTK_BOX(bothbox), config, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
361 gtk_tooltips_set_tip(tooltips, config, _("Configure settings of the selected plugin"), ""); |
90 | 362 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
363 reload = picture_button(plugwindow, _("Reload"), refresh_xpm); |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
364 gtk_widget_set_sensitive(reload, FALSE); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
365 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
|
366 gtk_box_pack_start(GTK_BOX(bothbox), reload, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
367 gtk_tooltips_set_tip(tooltips, reload, _("Reload the selected plugin"), ""); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
368 |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
369 unload = picture_button(plugwindow, _("Unload"), gnome_remove_xpm); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
370 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
|
371 gtk_box_pack_start(GTK_BOX(bothbox), unload, TRUE, TRUE, 0); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
372 gtk_tooltips_set_tip(tooltips, unload, _("Unload the selected plugin"), ""); |
90 | 373 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
374 close = picture_button(plugwindow, _("Close"), cancel_xpm); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
375 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
|
376 gtk_box_pack_start(GTK_BOX(bothbox), close, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
377 gtk_tooltips_set_tip(tooltips, close, _("Close this window"), ""); |
90 | 378 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
379 update_show_plugins(); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
380 gtk_widget_show(plugwindow); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
381 } |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
382 |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
383 static void update_show_plugins() |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
384 { |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
385 GList *plugs = plugins; |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
386 struct gaim_plugin *p; |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
387 GtkWidget *label; |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
388 GtkWidget *list_item; |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
389 GtkWidget *hbox; |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
390 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
391 if (plugwindow == NULL) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
392 return; |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
393 |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
394 gtk_list_clear_items(GTK_LIST(pluglist), 0, -1); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
395 while (plugs) { |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
396 p = (struct gaim_plugin *)plugs->data; |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
397 label = gtk_label_new(plugin_makelistname(p->handle)); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
398 hbox = gtk_hbox_new(FALSE, 0); /* for left justification */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
399 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
400 |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
401 list_item = gtk_list_item_new(); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
402 gtk_container_add(GTK_CONTAINER(list_item), hbox); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
403 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
|
404 gtk_object_set_user_data(GTK_OBJECT(list_item), p); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
405 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
406 gtk_widget_show(hbox); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
407 gtk_widget_show(label); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
408 gtk_container_add(GTK_CONTAINER(pluglist), list_item); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
409 gtk_widget_show(list_item); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
410 |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
411 plugs = g_list_next(plugs); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
412 } |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
413 |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
414 /* Clear the display if nothing's selected */ |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
415 if (GTK_LIST(pluglist)->selection == NULL) { |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
416 guint text_len = gtk_text_get_length(GTK_TEXT(plugtext)); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
417 gtk_text_set_point(GTK_TEXT(plugtext), 0); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
418 gtk_text_forward_delete(GTK_TEXT(plugtext), text_len); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
419 gtk_entry_set_text(GTK_ENTRY(plugentry), ""); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
420 |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
421 gtk_widget_set_sensitive(config, FALSE); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
422 gtk_widget_set_sensitive(reload, FALSE); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
423 gtk_widget_set_sensitive(unload, FALSE); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
424 } |
1 | 425 } |
426 | |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
427 static void unload_plugin(GtkWidget *w, gpointer data) |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
428 { |
90 | 429 GList *i; |
430 struct gaim_plugin *p; | |
431 void (*gaim_plugin_remove)(); | |
432 | |
433 i = GTK_LIST(pluglist)->selection; | |
434 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
435 if (i == NULL) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
436 return; |
90 | 437 |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
438 p = gtk_object_get_user_data(GTK_OBJECT(i->data)); |
1 | 439 |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
440 /* Attempt to call the plugin's remove function (if there) */ |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
441 if (g_module_symbol(p->handle, "gaim_plugin_remove", (gpointer *)&gaim_plugin_remove)) |
90 | 442 (*gaim_plugin_remove)(); |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
443 |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
444 unload_immediate(p->handle); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
445 update_show_plugins(); |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
446 } |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
447 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
448 static void unload_for_real(void *handle) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
449 { |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
450 GList *i; |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
451 struct gaim_plugin *p = NULL; |
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 i = plugins; |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
454 while (i) { |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
455 p = (struct gaim_plugin *)i->data; |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
456 if (handle == p->handle) |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
457 break; |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
458 p = NULL; |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
459 i = g_list_next(i); |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
460 } |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
461 |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
462 if (!p) |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
463 return; |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
464 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
465 debug_printf("Unloading %s\n", g_module_name(p->handle)); |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
466 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
467 plugin_remove_callbacks(p->handle); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
468 |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
469 plugins = g_list_remove(plugins, p); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
970
diff
changeset
|
470 g_free(p); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
471 update_show_plugins(); |
154
1c4e47c0c5dd
[gaim-migrate @ 164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
153
diff
changeset
|
472 save_prefs(); |
90 | 473 } |
474 | |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
475 static void unload_immediate(GModule *handle) |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
476 { |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
477 unload_for_real(handle); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
478 g_module_close(handle); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
479 } |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
480 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
481 static gint unload_timeout(GModule *handle) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
482 { |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
483 g_module_close(handle); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
484 return FALSE; |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
485 } |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
486 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
487 void gaim_plugin_unload(GModule *handle) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
488 { |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
489 unload_for_real(handle); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
490 gtk_timeout_add(5000, (GtkFunction)unload_timeout, handle); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
491 } |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
492 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
493 static void plugin_reload_cb(GtkWidget *w, gpointer 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 GList *i; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
496 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
497 i = GTK_LIST(pluglist)->selection; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
498 if (i == NULL) |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
499 return; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
500 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
501 /* Just pass off plugin to the actual function */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
502 plugin_reload(gtk_object_get_user_data(GTK_OBJECT(i->data))); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
503 } |
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 /* Do unload/load cycle of plugin. */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
506 static void plugin_reload(struct gaim_plugin *p) |
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 char file[PATHSIZE]; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
509 void (*gaim_plugin_remove)(); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
510 GModule *handle = p->handle; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
511 struct gaim_plugin *plug; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
512 GList *plugs; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
513 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
514 strncpy(file, g_module_name(handle), sizeof(file)); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
515 file[sizeof(file) - 1] = '\0'; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
516 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
517 debug_printf("Reloading %s\n", file); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
518 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
519 /* Unload */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
520 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
|
521 (*gaim_plugin_remove)(); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
522 unload_immediate(handle); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
523 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
524 /* Load */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
525 load_plugin(file); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
526 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
527 /* Try and reselect the plugin in list */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
528 plugs = plugins; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
529 while (plugs) { |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
530 plug = plugs->data; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
531 if (!strcmp(file, g_module_name(plug->handle))) { |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
532 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
|
533 return; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
534 } |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
535 plugs = plugs->next; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
536 } |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
537 } |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
538 |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
539 static void list_clicked(GtkWidget *w, struct gaim_plugin *p) |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
540 { |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
541 gchar *temp; |
90 | 542 guint text_len; |
110
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
543 void (*gaim_plugin_config)(); |
90 | 544 |
522
11cbf8b403b6
[gaim-migrate @ 532]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
425
diff
changeset
|
545 if (confighandle != 0) |
403
d6f02d7f78d8
[gaim-migrate @ 413]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
397
diff
changeset
|
546 gtk_signal_disconnect(GTK_OBJECT(config), confighandle); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
547 |
90 | 548 text_len = gtk_text_get_length(GTK_TEXT(plugtext)); |
549 gtk_text_set_point(GTK_TEXT(plugtext), 0); | |
550 gtk_text_forward_delete(GTK_TEXT(plugtext), text_len); | |
551 | |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
552 temp = g_strdup_printf("Name: %s\n\nDescription:\n%s", |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
553 (p->name != NULL) ? p->name : "", |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
554 (p->description != NULL) ? p->description : ""); |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
555 gtk_text_insert(GTK_TEXT(plugtext), NULL, NULL, NULL, temp, -1); |
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
556 g_free(temp); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
557 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
|
558 |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
559 /* Find out if this plug-in has a configuration function */ |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
560 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
|
561 confighandle = gtk_signal_connect(GTK_OBJECT(config), "clicked", |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
562 GTK_SIGNAL_FUNC(gaim_plugin_config), NULL); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
563 gtk_widget_set_sensitive(config, TRUE); |
110
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
564 } else { |
403
d6f02d7f78d8
[gaim-migrate @ 413]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
397
diff
changeset
|
565 confighandle = 0; |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
566 gtk_widget_set_sensitive(config, FALSE); |
110
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
567 } |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
568 |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
569 gtk_widget_set_sensitive(reload, TRUE); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
570 gtk_widget_set_sensitive(unload, TRUE); |
90 | 571 } |
572 | |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
573 static void hide_plugins(GtkWidget *w, gpointer data) |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
574 { |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
575 if (plugwindow) |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
576 gtk_widget_destroy(plugwindow); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
577 plugwindow = NULL; |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
578 config = NULL; |
522
11cbf8b403b6
[gaim-migrate @ 532]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
425
diff
changeset
|
579 confighandle = 0; |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
580 } |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
581 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
582 static const gchar *plugin_makelistname(GModule *module) |
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 static gchar filename[PATHSIZE]; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
585 gchar *filepath = g_module_name(module); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
586 char *cp; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
587 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
588 if (filepath == NULL || strlen(filepath) == 0) |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
589 return NULL; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
590 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
591 if ((cp = strrchr(filepath, '/')) == NULL || *++cp == '\0') |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
592 cp = filepath; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
593 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
594 strncpy(filename, cp, sizeof(filename)); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
595 filename[sizeof(filename) - 1] = '\0'; |
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 /* Try to pretty name by removing any trailing ".so" */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
598 if (strlen(filename) > 3 && |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
599 strncmp(filename + strlen(filename) - 3, ".so", 3) == 0) |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
600 filename[strlen(filename) - 3] = '\0'; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
601 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
602 return filename; |
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 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
605 /* Remove all callbacks associated with plugin handle */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
606 static void plugin_remove_callbacks(GModule *handle) |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
607 { |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
608 GList *c = callbacks; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
609 struct gaim_callback *g; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
610 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
611 debug_printf("%d callbacks to search\n", g_list_length(callbacks)); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
612 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
613 while (c) { |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
614 g = (struct gaim_callback *)c->data; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
615 if (g->handle == handle) { |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
616 c = g_list_next(c); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
617 callbacks = g_list_remove(callbacks, (gpointer)g); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
618 debug_printf("Removing callback, %d remain\n", g_list_length(callbacks)); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
619 } else |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
620 c = g_list_next(c); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
621 } |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
622 } |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
623 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
624 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
|
625 { |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
970
diff
changeset
|
626 struct gaim_callback *call = g_new0(struct gaim_callback, 1); |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
627 call->handle = handle; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
628 call->event = which; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
629 call->function = func; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
630 call->data = data; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
631 |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
632 callbacks = g_list_append(callbacks, call); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
633 debug_printf("Adding callback %d\n", g_list_length(callbacks)); |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
634 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
635 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
636 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
|
637 { |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
638 GList *c = callbacks; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
639 struct gaim_callback *g = NULL; |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
640 |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
641 while (c) { |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
642 g = (struct gaim_callback *)c->data; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
643 if (handle == g->handle && func == g->function) { |
138
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
644 callbacks = g_list_remove(callbacks, c->data); |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
645 g_free(g); |
138
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
646 c = callbacks; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
647 if (c == NULL) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
648 break; |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
649 } |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
650 c = g_list_next(c); |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
651 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
652 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
653 |
90 | 654 #endif /* GAIM_PLUGINS */ |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
655 |
797
c13e78ae0f86
[gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
789
diff
changeset
|
656 char *event_name(enum gaim_event event) |
c13e78ae0f86
[gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
789
diff
changeset
|
657 { |
c13e78ae0f86
[gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
789
diff
changeset
|
658 static char buf[128]; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
659 switch (event) { |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
660 case event_signon: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
661 sprintf(buf, "event_signon"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
662 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
663 case event_signoff: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
664 sprintf(buf, "event_signoff"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
665 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
666 case event_away: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
667 sprintf(buf, "event_away"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
668 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
669 case event_back: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
670 sprintf(buf, "event_back"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
671 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
672 case event_im_recv: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
673 sprintf(buf, "event_im_recv"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
674 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
675 case event_im_send: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
676 sprintf(buf, "event_im_send"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
677 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
678 case event_buddy_signon: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
679 sprintf(buf, "event_buddy_signon"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
680 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
681 case event_buddy_signoff: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
682 sprintf(buf, "event_buddy_signoff"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
683 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
684 case event_buddy_away: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
685 sprintf(buf, "event_buddy_away"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
686 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
687 case event_buddy_back: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
688 sprintf(buf, "event_buddy_back"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
689 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
690 case event_buddy_idle: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
691 sprintf(buf, "event_buddy_idle"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
692 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
693 case event_buddy_unidle: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
694 sprintf(buf, "event_buddy_unidle"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
695 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
696 case event_blist_update: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
697 sprintf(buf, "event_blist_update"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
698 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
699 case event_chat_invited: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
700 sprintf(buf, "event_chat_invited"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
701 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
702 case event_chat_join: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
703 sprintf(buf, "event_chat_join"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
704 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
705 case event_chat_leave: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
706 sprintf(buf, "event_chat_leave"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
707 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
708 case event_chat_buddy_join: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
709 sprintf(buf, "event_chat_buddy_join"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
710 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
711 case event_chat_buddy_leave: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
712 sprintf(buf, "event_chat_buddy_leave"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
713 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
714 case event_chat_recv: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
715 sprintf(buf, "event_chat_recv"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
716 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
717 case event_chat_send: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
718 sprintf(buf, "event_chat_send"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
719 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
720 case event_warned: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
721 sprintf(buf, "event_warned"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
722 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
723 case event_error: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
724 sprintf(buf, "event_error"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
725 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
726 case event_quit: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
727 sprintf(buf, "event_quit"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
728 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
729 case event_new_conversation: |
1745 | 730 sprintf(buf, "event_new_conversation"); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
731 break; |
1749
5bfc58c20e82
[gaim-migrate @ 1759]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1745
diff
changeset
|
732 case event_set_info: |
5bfc58c20e82
[gaim-migrate @ 1759]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1745
diff
changeset
|
733 sprintf(buf, "event_set_info"); |
5bfc58c20e82
[gaim-migrate @ 1759]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1745
diff
changeset
|
734 break; |
1874
1e33bd2d7780
[gaim-migrate @ 1884]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1749
diff
changeset
|
735 case event_draw_menu: |
1e33bd2d7780
[gaim-migrate @ 1884]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1749
diff
changeset
|
736 sprintf(buf, "event_draw_menu"); |
1e33bd2d7780
[gaim-migrate @ 1884]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1749
diff
changeset
|
737 break; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
738 default: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
739 sprintf(buf, "event_unknown"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
740 break; |
797
c13e78ae0f86
[gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
789
diff
changeset
|
741 } |
c13e78ae0f86
[gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
789
diff
changeset
|
742 return buf; |
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 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
745 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
|
746 { |
783
5bad8e4d1c88
[gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
747 #ifdef USE_PERL |
5bad8e4d1c88
[gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
748 char buf[BUF_LONG]; |
797
c13e78ae0f86
[gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
789
diff
changeset
|
749 char *tmp; |
783
5bad8e4d1c88
[gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
750 #endif |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
751 #ifdef GAIM_PLUGINS |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
752 GList *c = callbacks; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
753 struct gaim_callback *g; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
754 |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
755 while (c) { |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
756 g = (struct gaim_callback *)c->data; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
757 if (g->event == event && g->function !=NULL) { |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
758 switch (event) { |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
759 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
760 /* struct gaim_connection * */ |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
761 case event_signon: |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
762 case event_signoff: |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
763 { |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
764 void (*function) (struct gaim_connection *, void *) = |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
765 g->function; |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
766 (*function)(arg1, g->data); |
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
767 } |
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
768 break; |
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
769 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
770 /* no args */ |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
771 case event_blist_update: |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
772 case event_quit: |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
773 { |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
774 void (*function)(void *) = g->function; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
775 (*function)(g->data); |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
776 } |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
777 break; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
778 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
779 /* struct gaim_connection *, char **, char ** */ |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
780 case event_im_recv: |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
781 { |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
782 void (*function)(struct gaim_connection *, char **, char **, |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
783 void *) = g->function; |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
784 (*function)(arg1, arg2, arg3, g->data); |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
785 } |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
786 break; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
787 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
788 /* struct gaim_connection *, char *, char ** */ |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
789 case event_im_send: |
783
5bad8e4d1c88
[gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
790 case event_chat_send: |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
791 { |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
792 void (*function)(struct gaim_connection *, char *, char **, |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
793 void *) = g->function; |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
794 (*function)(arg1, arg2, arg3, g->data); |
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
795 } |
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
796 break; |
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
797 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
798 /* struct gaim_connection *, char * */ |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
799 case event_chat_join: |
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
800 case event_chat_leave: |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
801 case event_buddy_signon: |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
802 case event_buddy_signoff: |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
803 case event_buddy_away: |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
804 case event_buddy_back: |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
805 case event_buddy_idle: |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
806 case event_buddy_unidle: |
1749
5bfc58c20e82
[gaim-migrate @ 1759]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1745
diff
changeset
|
807 case event_set_info: |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
808 { |
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
809 void (*function)(struct gaim_connection *, char *, void *) = |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
810 g->function; |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
811 (*function)(arg1, arg2, g->data); |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
812 } |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
813 break; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
814 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
815 /* char * */ |
808
9d61f3d01046
[gaim-migrate @ 818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
806
diff
changeset
|
816 case event_new_conversation: |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
817 { |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
818 void (*function)(char *, void *) = g->function; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
819 (*function)(arg1, g->data); |
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 break; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
822 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
823 /* struct gaim_connection *, char *, char *, char * */ |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
824 case event_chat_invited: |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
825 case event_chat_recv: |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
826 { |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
827 void (*function)(struct gaim_connection *, char *, char *, |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
828 char *, void *) = g->function; |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
829 (*function)(arg1, arg2, arg3, arg4, g->data); |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
830 } |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
831 break; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
832 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
833 /* struct gaim_connection *, char *, char * */ |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
834 case event_chat_buddy_join: |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
835 case event_chat_buddy_leave: |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
836 case event_away: |
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
837 case event_back: |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
838 { |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
839 void (*function)(struct gaim_connection *, char *, char *, |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
840 void *) = g->function; |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
841 (*function)(arg1, arg2, arg3, g->data); |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
842 } |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
843 break; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
844 |
1429
865a6ead3258
[gaim-migrate @ 1439]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
845 /* struct gaim_connection *, char *, int */ |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
846 case event_warned: |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
847 { |
1429
865a6ead3258
[gaim-migrate @ 1439]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
848 void (*function)(struct gaim_connection *, char *, int, |
865a6ead3258
[gaim-migrate @ 1439]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
849 void *) = g->function; |
865a6ead3258
[gaim-migrate @ 1439]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
850 (*function)(arg1, arg2, (int)arg3, g->data); |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
851 } |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
852 break; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
853 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
854 /* int */ |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
855 case event_error: |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
856 { |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
857 void (*function)(int, void *) = g->function; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
858 (*function)((int)arg1, g->data); |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
859 } |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
860 break; |
1874
1e33bd2d7780
[gaim-migrate @ 1884]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1749
diff
changeset
|
861 /* GtkWidget *, char * */ |
1e33bd2d7780
[gaim-migrate @ 1884]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1749
diff
changeset
|
862 case event_draw_menu: |
1e33bd2d7780
[gaim-migrate @ 1884]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1749
diff
changeset
|
863 { |
1e33bd2d7780
[gaim-migrate @ 1884]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1749
diff
changeset
|
864 void(*function)(GtkWidget *, char *) = g->function; |
1e33bd2d7780
[gaim-migrate @ 1884]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1749
diff
changeset
|
865 (*function)(arg1, arg2); |
1e33bd2d7780
[gaim-migrate @ 1884]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1749
diff
changeset
|
866 } |
1e33bd2d7780
[gaim-migrate @ 1884]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1749
diff
changeset
|
867 break; |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
868 |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
869 default: |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
870 debug_printf("unknown event %d\n", event); |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
871 break; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
872 } |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
873 } |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
874 c = c->next; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
875 } |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
876 #endif /* GAIM_PLUGINS */ |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
877 #ifdef USE_PERL |
783
5bad8e4d1c88
[gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
878 switch (event) { |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
879 case event_signon: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
880 g_snprintf(buf, sizeof buf, "\"%s\"", ((struct gaim_connection *)arg1)->username); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
881 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
882 case event_signoff: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
883 g_snprintf(buf, sizeof buf, "\"%s\"", ((struct gaim_connection *)arg1)->username); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
884 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
885 case event_away: |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
886 g_snprintf(buf, sizeof buf, "\"%s\"", ((struct gaim_connection *)arg1)->username); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
887 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
888 case event_back: |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
889 g_snprintf(buf, sizeof buf, "\"%s\"", ((struct gaim_connection *)arg1)->username); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
890 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
891 case event_im_recv: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
892 g_snprintf(buf, sizeof buf, "\"%s\" \"%s\" %s", |
1712
560b3117aedf
[gaim-migrate @ 1722]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
893 ((struct gaim_connection *)arg1)->username, |
560b3117aedf
[gaim-migrate @ 1722]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
894 *(char **)arg2 ? *(char **)arg2 : "(null)", |
560b3117aedf
[gaim-migrate @ 1722]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
895 *(char **)arg3 ? *(char **)arg3 : "(null)"); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
896 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
897 case event_im_send: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
898 g_snprintf(buf, sizeof buf, "\"%s\" \"%s\" %s", |
1712
560b3117aedf
[gaim-migrate @ 1722]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
899 ((struct gaim_connection *)arg1)->username, (char *)arg2, |
560b3117aedf
[gaim-migrate @ 1722]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
900 *(char **)arg3 ? *(char **)arg3 : "(null)"); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
901 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
902 case event_buddy_signon: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
903 g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
904 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
905 case event_buddy_signoff: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
906 g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
907 break; |
1749
5bfc58c20e82
[gaim-migrate @ 1759]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1745
diff
changeset
|
908 case event_set_info: |
5bfc58c20e82
[gaim-migrate @ 1759]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1745
diff
changeset
|
909 g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2); |
5bfc58c20e82
[gaim-migrate @ 1759]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1745
diff
changeset
|
910 break; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
911 case event_buddy_away: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
912 g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
913 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
914 case event_buddy_back: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
915 g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
916 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
917 case event_buddy_idle: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
918 g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
919 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
920 case event_buddy_unidle: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
921 g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
922 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
923 case event_blist_update: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
924 buf[0] = 0; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
925 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
926 case event_chat_invited: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
927 g_snprintf(buf, sizeof buf, "\"%s\" \"%s\" %s", (char *)arg2, (char *)arg3, |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
928 (char *)arg4); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
929 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
930 case event_chat_join: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
931 g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
932 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
933 case event_chat_leave: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
934 g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
935 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
936 case event_chat_buddy_join: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
937 g_snprintf(buf, sizeof buf, "\"%s\" \"%s\"", (char *)arg2, (char *)arg3); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
938 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
939 case event_chat_buddy_leave: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
940 g_snprintf(buf, sizeof buf, "\"%s\" \"%s\"", (char *)arg2, (char *)arg3); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
941 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
942 case event_chat_recv: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
943 g_snprintf(buf, sizeof buf, "\"%s\" \"%s\" %s", (char *)arg2, (char *)arg3, |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
944 (char *)arg4); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
945 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
946 case event_chat_send: |
1712
560b3117aedf
[gaim-migrate @ 1722]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
947 g_snprintf(buf, sizeof buf, "\"%s\" %s", (char *)arg2, |
560b3117aedf
[gaim-migrate @ 1722]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
948 *(char **)arg3 ? *(char **)arg3 : "(null)"); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
949 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
950 case event_warned: |
1429
865a6ead3258
[gaim-migrate @ 1439]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
951 g_snprintf(buf, sizeof buf, "\"%s\" \"%s\" %d", |
865a6ead3258
[gaim-migrate @ 1439]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
952 ((struct gaim_connection *)arg1)->username, (char *)arg2, (int)arg3); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
953 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
954 case event_error: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
955 g_snprintf(buf, sizeof buf, "%d", (int)arg1); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
956 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
957 case event_quit: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
958 buf[0] = 0; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
959 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
960 case event_new_conversation: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
961 g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg1); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
962 break; |
1874
1e33bd2d7780
[gaim-migrate @ 1884]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1749
diff
changeset
|
963 case event_draw_menu: |
1e33bd2d7780
[gaim-migrate @ 1884]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1749
diff
changeset
|
964 g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2); |
1e33bd2d7780
[gaim-migrate @ 1884]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1749
diff
changeset
|
965 break; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
966 default: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
967 break; |
783
5bad8e4d1c88
[gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
968 } |
797
c13e78ae0f86
[gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
789
diff
changeset
|
969 tmp = event_name(event); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
970 debug_printf("%s: %s\n", tmp, buf); |
1100
f168625b63fe
[gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
971 return perl_event(tmp, buf); |
f168625b63fe
[gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
972 #else |
f168625b63fe
[gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
973 return 0; |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
974 #endif |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
975 } |