Mercurial > pidgin
annotate src/plugins.c @ 1745:c39cc2b44226
[gaim-migrate @ 1755]
This was bugging me and I dont know why
committer: Tailor Script <tailor@pidgin.im>
author | Rob Flynn <gaim@robflynn.com> |
---|---|
date | Tue, 24 Apr 2001 23:23:40 +0000 |
parents | 560b3117aedf |
children | 5bfc58c20e82 |
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 | |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
53 /* ------------------ Global Variables ----------------------- */ |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
54 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
55 GList *plugins = NULL; |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
56 GList *callbacks = NULL; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
57 |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
58 /* ------------------ Local Variables ------------------------ */ |
1 | 59 |
90 | 60 static GtkWidget *plugin_dialog = NULL; |
61 | |
62 static GtkWidget *pluglist; | |
63 static GtkWidget *plugtext; | |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
64 static GtkWidget *plugwindow; |
1 | 65 |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
66 static GtkWidget *config = NULL; |
403
d6f02d7f78d8
[gaim-migrate @ 413]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
397
diff
changeset
|
67 static guint confighandle = 0; |
1025
84a5d80e52f1
[gaim-migrate @ 1035]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
68 static char *last_dir = NULL; |
110
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
69 |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
70 /* --------------- Function Declarations --------------------- */ |
1 | 71 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
72 void show_plugins(GtkWidget *, gpointer); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
73 void load_plugin(char *); |
90 | 74 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
75 void gaim_signal_connect(GModule *, enum gaim_event, void *, void *); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
76 void gaim_signal_disconnect(GModule *, enum gaim_event, void *); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
77 void gaim_plugin_unload(GModule *); |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
78 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
79 static void destroy_plugins(GtkWidget *, gpointer); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
80 static void load_file(GtkWidget *, gpointer); |
90 | 81 static void load_which_plugin(GtkWidget *, gpointer); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
82 static void unload(GtkWidget *, gpointer); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
83 static void unload_immediate(GModule *); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
84 static void list_clicked(GtkWidget *, struct gaim_plugin *); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
85 static void update_show_plugins(); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
86 static void hide_plugins(GtkWidget *, gpointer); |
90 | 87 |
1 | 88 /* ------------------ Code Below ---------------------------- */ |
89 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
90 static void destroy_plugins(GtkWidget *w, gpointer data) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
91 { |
90 | 92 if (plugin_dialog) |
93 gtk_widget_destroy(plugin_dialog); | |
94 plugin_dialog = NULL; | |
95 } | |
96 | |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
139
diff
changeset
|
97 static void load_file(GtkWidget *w, gpointer data) |
1 | 98 { |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
99 gchar *buf; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
100 |
138
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
101 if (plugin_dialog) { |
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
102 gtk_widget_show(plugin_dialog); |
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
103 gdk_window_raise(plugin_dialog->window); |
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
104 return; |
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
105 } |
90 | 106 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
107 plugin_dialog = gtk_file_selection_new(_("Gaim - Plugin List")); |
138
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
108 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
109 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(plugin_dialog)); |
90 | 110 |
1025
84a5d80e52f1
[gaim-migrate @ 1035]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
111 if (!last_dir) |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1145
diff
changeset
|
112 buf = g_strdup(LIBDIR); |
153
8ed64c704fb0
[gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
142
diff
changeset
|
113 else |
1025
84a5d80e52f1
[gaim-migrate @ 1035]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
114 buf = g_strconcat(last_dir, G_DIR_SEPARATOR_S, NULL); |
1 | 115 |
90 | 116 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
|
117 gtk_file_selection_complete(GTK_FILE_SELECTION(plugin_dialog), "*.so"); |
90 | 118 gtk_signal_connect(GTK_OBJECT(plugin_dialog), "destroy", |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
119 GTK_SIGNAL_FUNC(destroy_plugins), plugin_dialog); |
90 | 120 |
121 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
|
122 "clicked", GTK_SIGNAL_FUNC(load_which_plugin), NULL); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
123 |
90 | 124 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
|
125 "clicked", GTK_SIGNAL_FUNC(destroy_plugins), NULL); |
90 | 126 |
127 g_free(buf); | |
626
d86cc11faab8
[gaim-migrate @ 636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
128 gtk_widget_show(plugin_dialog); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
129 gdk_window_raise(plugin_dialog->window); |
90 | 130 } |
1 | 131 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
132 static void load_which_plugin(GtkWidget *w, gpointer data) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
133 { |
1035
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1025
diff
changeset
|
134 char *file; |
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1025
diff
changeset
|
135 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
136 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
|
137 if (file_is_dir(file, plugin_dialog)) { |
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1025
diff
changeset
|
138 return; |
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1025
diff
changeset
|
139 } |
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1025
diff
changeset
|
140 |
1710
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
141 if (file) |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
142 load_plugin(file); |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
139
diff
changeset
|
143 |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
139
diff
changeset
|
144 if (plugin_dialog) |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
139
diff
changeset
|
145 gtk_widget_destroy(plugin_dialog); |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
139
diff
changeset
|
146 plugin_dialog = NULL; |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
139
diff
changeset
|
147 } |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
139
diff
changeset
|
148 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
149 void load_plugin(char *filename) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
150 { |
90 | 151 struct gaim_plugin *plug; |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
152 GList *c = plugins; |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
153 char *(*gaim_plugin_init)(GModule *); |
90 | 154 char *(*cfunc)(); |
155 char *error; | |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
156 char *retval; |
90 | 157 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
158 if (!g_module_supported()) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
159 return; |
1710
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
160 if (filename && !strlen(filename)) |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
161 return; |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
162 |
1710
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
163 while (filename && c) { |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
164 plug = (struct gaim_plugin *)c->data; |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
165 if (!strcmp(filename, g_module_name(plug->handle))) { |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
166 void (*gaim_plugin_remove)(); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
167 if (g_module_symbol(plug->handle, "gaim_plugin_remove", |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
168 (gpointer *)&gaim_plugin_remove)) |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
169 (*gaim_plugin_remove)(); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
170 |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
171 unload_immediate(plug->handle); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
172 c = plugins; |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
173 } else |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
174 c = g_list_next(c); |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
175 } |
90 | 176 plug = g_malloc(sizeof *plug); |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
177 |
1710
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
178 if (filename) { |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
179 if (last_dir) |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
180 g_free(last_dir); |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
181 last_dir = g_dirname(filename); |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
182 } |
1025
84a5d80e52f1
[gaim-migrate @ 1035]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
183 |
1236
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1185
diff
changeset
|
184 debug_printf("Loading %s\n", filename); |
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1185
diff
changeset
|
185 plug->handle = g_module_open(filename, 0); |
90 | 186 if (!plug->handle) { |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
187 error = (char *)g_module_error(); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
188 do_error_dialog(error, _("Plugin Error")); |
90 | 189 g_free(plug); |
190 return; | |
191 } | |
192 | |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
193 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
|
194 do_error_dialog(g_module_error(), _("Plugin Error")); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
195 g_module_close(plug->handle); |
90 | 196 g_free(plug); |
197 return; | |
198 } | |
199 | |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
200 retval = (*gaim_plugin_init)(plug->handle); |
970 | 201 debug_printf("loaded plugin returned %d\n", retval); |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
202 if (retval) { |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
203 GList *c = callbacks; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
204 struct gaim_callback *g; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
205 while (c) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
206 g = (struct gaim_callback *)c->data; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
207 if (g->handle == plug->handle) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
208 callbacks = g_list_remove(callbacks, c->data); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
209 debug_printf("Removing callback, %d remain\n", g_list_length(callbacks)); |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
210 c = callbacks; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
211 if (c == NULL) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
212 break; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
213 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
214 } else { |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
215 c = g_list_next(c); |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
216 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
217 } |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
218 do_error_dialog(retval, _("Plugin Error")); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
219 g_module_close(plug->handle); |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
220 g_free(plug); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
221 return; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
222 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
223 |
90 | 224 plugins = g_list_append(plugins, plug); |
1 | 225 |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
226 if (g_module_symbol(plug->handle, "name", (gpointer *)&cfunc)) |
90 | 227 plug->name = (*cfunc)(); |
228 else | |
229 plug->name = NULL; | |
1 | 230 |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
231 if (g_module_symbol(plug->handle, "description", (gpointer *)&cfunc)) |
90 | 232 plug->description = (*cfunc)(); |
233 else | |
234 plug->description = NULL; | |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
235 |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
236 update_show_plugins(); |
153
8ed64c704fb0
[gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
142
diff
changeset
|
237 save_prefs(); |
90 | 238 } |
1 | 239 |
1710
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
240 char *gaim_plugin_init(GModule *mod) |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
241 { |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
242 void (*asdf)(void *); |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
243 char *(*gem)(); |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
244 g_module_symbol(mod, "do_stuff", (gpointer *)&asdf); |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
245 g_module_symbol(mod, "gem", (gpointer *)&gem); |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
246 asdf(gem); |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
247 return NULL; |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
248 } |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
249 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
250 void show_plugins(GtkWidget *w, gpointer data) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
251 { |
90 | 252 /* most of this code was shamelessly stolen from prefs.c */ |
253 GtkWidget *page; | |
254 GtkWidget *topbox; | |
255 GtkWidget *botbox; | |
256 GtkWidget *sw; | |
257 GtkWidget *label; | |
258 GtkWidget *list_item; | |
259 GtkWidget *sw2; | |
260 GtkWidget *add; | |
261 GtkWidget *remove; | |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
262 GtkWidget *close; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
263 GList *plugs = plugins; |
90 | 264 struct gaim_plugin *p; |
265 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
266 if (plugwindow) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
267 return; |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
268 |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
269 plugwindow = gtk_window_new(GTK_WINDOW_DIALOG); |
905 | 270 gtk_window_set_wmclass(GTK_WINDOW(plugwindow), "plugins", "Gaim"); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
271 gtk_widget_realize(plugwindow); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
272 aol_icon(plugwindow->window); |
1185 | 273 gtk_container_border_width(GTK_CONTAINER(plugwindow), 5); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
274 gtk_window_set_title(GTK_WINDOW(plugwindow), _("Gaim - Plugins")); |
656
732ee4f6f541
[gaim-migrate @ 666]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
626
diff
changeset
|
275 gtk_widget_set_usize(plugwindow, 400, 250); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
276 gtk_signal_connect(GTK_OBJECT(plugwindow), "destroy", GTK_SIGNAL_FUNC(hide_plugins), NULL); |
90 | 277 |
1185 | 278 page = gtk_vbox_new(FALSE, 5); |
279 topbox = gtk_hbox_new(FALSE, 5); | |
280 botbox = gtk_hbox_new(FALSE, 5); | |
90 | 281 |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
282 /* Left side: list of plugin file names */ |
90 | 283 sw2 = gtk_scrolled_window_new(NULL, NULL); |
284 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw2), | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
285 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
90 | 286 |
287 pluglist = gtk_list_new(); | |
288 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw2), pluglist); | |
289 gtk_box_pack_start(GTK_BOX(topbox), sw2, TRUE, TRUE, 0); | |
290 | |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
291 /* Right side: the text description of the plugin */ |
90 | 292 sw = gtk_scrolled_window_new(NULL, NULL); |
293 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
294 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
90 | 295 |
296 plugtext = gtk_text_new(NULL, NULL); | |
297 gtk_container_add(GTK_CONTAINER(sw), plugtext); | |
298 gtk_box_pack_start(GTK_BOX(topbox), sw, TRUE, TRUE, 0); | |
299 gtk_text_set_word_wrap(GTK_TEXT(plugtext), TRUE); | |
300 gtk_text_set_editable(GTK_TEXT(plugtext), FALSE); | |
301 | |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
302 /* Build the bottom button bar */ |
656
732ee4f6f541
[gaim-migrate @ 666]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
626
diff
changeset
|
303 add = gtk_button_new_with_label(_("Load Plugin")); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
304 gtk_signal_connect(GTK_OBJECT(add), "clicked", GTK_SIGNAL_FUNC(load_file), NULL); |
1185 | 305 gtk_box_pack_start(GTK_BOX(botbox), add, TRUE, TRUE, 0); |
656
732ee4f6f541
[gaim-migrate @ 666]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
626
diff
changeset
|
306 if (display_options & OPT_DISP_COOL_LOOK) |
732ee4f6f541
[gaim-migrate @ 666]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
626
diff
changeset
|
307 gtk_button_set_relief(GTK_BUTTON(add), GTK_RELIEF_NONE); |
90 | 308 |
656
732ee4f6f541
[gaim-migrate @ 666]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
626
diff
changeset
|
309 config = gtk_button_new_with_label(_("Configure Plugin")); |
110
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
310 gtk_widget_set_sensitive(config, 0); |
1185 | 311 gtk_box_pack_start(GTK_BOX(botbox), config, TRUE, TRUE, 0); |
656
732ee4f6f541
[gaim-migrate @ 666]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
626
diff
changeset
|
312 if (display_options & OPT_DISP_COOL_LOOK) |
732ee4f6f541
[gaim-migrate @ 666]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
626
diff
changeset
|
313 gtk_button_set_relief(GTK_BUTTON(config), GTK_RELIEF_NONE); |
110
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
314 |
656
732ee4f6f541
[gaim-migrate @ 666]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
626
diff
changeset
|
315 remove = gtk_button_new_with_label(_("Unload Plugin")); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
316 gtk_signal_connect(GTK_OBJECT(remove), "clicked", GTK_SIGNAL_FUNC(unload), pluglist); |
1185 | 317 gtk_box_pack_start(GTK_BOX(botbox), remove, TRUE, TRUE, 0); |
656
732ee4f6f541
[gaim-migrate @ 666]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
626
diff
changeset
|
318 if (display_options & OPT_DISP_COOL_LOOK) |
732ee4f6f541
[gaim-migrate @ 666]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
626
diff
changeset
|
319 gtk_button_set_relief(GTK_BUTTON(remove), GTK_RELIEF_NONE); |
90 | 320 |
656
732ee4f6f541
[gaim-migrate @ 666]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
626
diff
changeset
|
321 close = gtk_button_new_with_label(_("Close")); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
322 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(hide_plugins), NULL); |
1185 | 323 gtk_box_pack_start(GTK_BOX(botbox), close, TRUE, TRUE, 0); |
656
732ee4f6f541
[gaim-migrate @ 666]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
626
diff
changeset
|
324 if (display_options & OPT_DISP_COOL_LOOK) |
732ee4f6f541
[gaim-migrate @ 666]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
626
diff
changeset
|
325 gtk_button_set_relief(GTK_BUTTON(close), GTK_RELIEF_NONE); |
619 | 326 |
90 | 327 gtk_box_pack_start(GTK_BOX(page), topbox, TRUE, TRUE, 0); |
328 gtk_box_pack_start(GTK_BOX(page), botbox, FALSE, FALSE, 0); | |
329 | |
330 while (plugs) { | |
331 p = (struct gaim_plugin *)plugs->data; | |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
332 label = gtk_label_new(g_module_name(p->handle)); |
90 | 333 list_item = gtk_list_item_new(); |
334 gtk_container_add(GTK_CONTAINER(list_item), label); | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
335 gtk_signal_connect(GTK_OBJECT(list_item), "select", GTK_SIGNAL_FUNC(list_clicked), p); |
90 | 336 gtk_object_set_user_data(GTK_OBJECT(list_item), p); |
337 | |
338 gtk_widget_show(label); | |
339 gtk_container_add(GTK_CONTAINER(pluglist), list_item); | |
340 gtk_widget_show(list_item); | |
341 | |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
342 plugs = g_list_next(plugs); |
90 | 343 } |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
344 |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
345 /* Make the first item selected */ |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
346 if (plugins != NULL) |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
347 gtk_list_select_item(GTK_LIST(pluglist), 0); |
90 | 348 |
349 gtk_widget_show(page); | |
350 gtk_widget_show(topbox); | |
351 gtk_widget_show(botbox); | |
352 gtk_widget_show(sw); | |
353 gtk_widget_show(sw2); | |
354 gtk_widget_show(pluglist); | |
355 gtk_widget_show(plugtext); | |
356 gtk_widget_show(add); | |
110
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
357 gtk_widget_show(config); |
90 | 358 gtk_widget_show(remove); |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
359 gtk_widget_show(close); |
90 | 360 |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
361 gtk_container_add(GTK_CONTAINER(plugwindow), page); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
362 gtk_widget_show(plugwindow); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
363 } |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
364 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
365 void update_show_plugins() |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
366 { |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
367 GList *plugs = plugins; |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
368 struct gaim_plugin *p; |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
369 GtkWidget *label; |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
370 GtkWidget *list_item; |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
371 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
372 if (plugwindow == NULL) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
373 return; |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
374 |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
375 gtk_list_clear_items(GTK_LIST(pluglist), 0, -1); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
376 while (plugs) { |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
377 p = (struct gaim_plugin *)plugs->data; |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
378 label = gtk_label_new(g_module_name(p->handle)); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
379 list_item = gtk_list_item_new(); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
380 gtk_container_add(GTK_CONTAINER(list_item), label); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
381 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
|
382 gtk_object_set_user_data(GTK_OBJECT(list_item), p); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
383 |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
384 gtk_widget_show(label); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
385 gtk_container_add(GTK_CONTAINER(pluglist), list_item); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
386 gtk_widget_show(list_item); |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
387 plugs = g_list_next(plugs); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
388 } |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
389 if (plugins != NULL) |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
390 gtk_list_select_item(GTK_LIST(pluglist), 0); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
391 else { |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
392 gtk_text_set_point(GTK_TEXT(plugtext), 0); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
393 gtk_text_forward_delete(GTK_TEXT(plugtext), gtk_text_get_length(GTK_TEXT(plugtext))); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
394 } |
1 | 395 } |
396 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
397 void unload(GtkWidget *w, gpointer data) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
398 { |
90 | 399 GList *i; |
400 struct gaim_plugin *p; | |
401 void (*gaim_plugin_remove)(); | |
402 | |
403 i = GTK_LIST(pluglist)->selection; | |
404 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
405 if (i == NULL) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
406 return; |
90 | 407 |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
408 p = gtk_object_get_user_data(GTK_OBJECT(i->data)); |
1 | 409 |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
410 /* Attempt to call the plugin's remove function (if there) */ |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
411 if (g_module_symbol(p->handle, "gaim_plugin_remove", (gpointer *)&gaim_plugin_remove)) |
90 | 412 (*gaim_plugin_remove)(); |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
413 |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
414 unload_immediate(p->handle); |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
415 } |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
416 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
417 static void unload_for_real(void *handle) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
418 { |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
419 GList *i; |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
420 struct gaim_plugin *p = NULL; |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
421 GList *c = callbacks; |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
422 struct gaim_callback *g; |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
423 |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
424 i = plugins; |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
425 while (i) { |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
426 p = (struct gaim_plugin *)i->data; |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
427 if (handle == p->handle) |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
428 break; |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
429 p = NULL; |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
430 i = g_list_next(i); |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
431 } |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
432 |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
433 if (!p) |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
434 return; |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
435 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
436 debug_printf("Unloading %s\n", g_module_name(p->handle)); |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
437 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
438 debug_printf("%d callbacks to search\n", g_list_length(callbacks)); |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
439 |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
440 while (c) { |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
441 g = (struct gaim_callback *)c->data; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
442 if (g->handle == p->handle) { |
138
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
443 callbacks = g_list_remove(callbacks, c->data); |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
444 g_free(g); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
445 debug_printf("Removing callback, %d remain\n", g_list_length(callbacks)); |
138
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
446 c = callbacks; |
176
c99d0b82c8a8
[gaim-migrate @ 186]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
154
diff
changeset
|
447 if (c == NULL) { |
c99d0b82c8a8
[gaim-migrate @ 186]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
154
diff
changeset
|
448 break; |
c99d0b82c8a8
[gaim-migrate @ 186]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
154
diff
changeset
|
449 } |
c99d0b82c8a8
[gaim-migrate @ 186]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
154
diff
changeset
|
450 } else { |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
451 c = g_list_next(c); |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
452 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
453 } |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
454 |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
455 plugins = g_list_remove(plugins, p); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
970
diff
changeset
|
456 g_free(p); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
457 if (config) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
458 gtk_widget_set_sensitive(config, 0); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
459 update_show_plugins(); |
154
1c4e47c0c5dd
[gaim-migrate @ 164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
153
diff
changeset
|
460 save_prefs(); |
90 | 461 } |
462 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
463 void unload_immediate(GModule *handle) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
464 { |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
465 unload_for_real(handle); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
466 g_module_close(handle); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
467 } |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
468 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
469 static gint unload_timeout(GModule *handle) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
470 { |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
471 g_module_close(handle); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
472 return FALSE; |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
473 } |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
474 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
475 void gaim_plugin_unload(GModule *handle) |
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 gtk_timeout_add(5000, (GtkFunction)unload_timeout, 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 void list_clicked(GtkWidget *w, struct gaim_plugin *p) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
482 { |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
483 gchar *temp; |
90 | 484 guint text_len; |
110
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
485 void (*gaim_plugin_config)(); |
90 | 486 |
522
11cbf8b403b6
[gaim-migrate @ 532]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
425
diff
changeset
|
487 if (confighandle != 0) |
403
d6f02d7f78d8
[gaim-migrate @ 413]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
397
diff
changeset
|
488 gtk_signal_disconnect(GTK_OBJECT(config), confighandle); |
90 | 489 text_len = gtk_text_get_length(GTK_TEXT(plugtext)); |
490 gtk_text_set_point(GTK_TEXT(plugtext), 0); | |
491 gtk_text_forward_delete(GTK_TEXT(plugtext), text_len); | |
492 | |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
493 temp = g_strdup_printf("%s\n%s", p->name, p->description); |
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
494 gtk_text_insert(GTK_TEXT(plugtext), NULL, NULL, NULL, temp, -1); |
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
495 g_free(temp); |
110
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
496 |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
497 /* Find out if this plug-in has a configuration function */ |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
498 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
|
499 confighandle = gtk_signal_connect(GTK_OBJECT(config), "clicked", |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
500 GTK_SIGNAL_FUNC(gaim_plugin_config), NULL); |
110
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
501 gtk_widget_set_sensitive(config, 1); |
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
502 } else { |
403
d6f02d7f78d8
[gaim-migrate @ 413]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
397
diff
changeset
|
503 confighandle = 0; |
110
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
504 gtk_widget_set_sensitive(config, 0); |
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
505 } |
90 | 506 } |
507 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
508 void hide_plugins(GtkWidget *w, gpointer data) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
509 { |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
510 if (plugwindow) |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
511 gtk_widget_destroy(plugwindow); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
512 plugwindow = NULL; |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
513 config = NULL; |
522
11cbf8b403b6
[gaim-migrate @ 532]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
425
diff
changeset
|
514 confighandle = 0; |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
515 } |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
516 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
517 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
|
518 { |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
970
diff
changeset
|
519 struct gaim_callback *call = g_new0(struct gaim_callback, 1); |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
520 call->handle = handle; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
521 call->event = which; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
522 call->function = func; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
523 call->data = data; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
524 |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
525 callbacks = g_list_append(callbacks, call); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
526 debug_printf("Adding callback %d\n", g_list_length(callbacks)); |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
527 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
528 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
529 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
|
530 { |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
531 GList *c = callbacks; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
532 struct gaim_callback *g = NULL; |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
533 |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
534 while (c) { |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
535 g = (struct gaim_callback *)c->data; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
536 if (handle == g->handle && func == g->function) { |
138
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
537 callbacks = g_list_remove(callbacks, c->data); |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
538 g_free(g); |
138
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
539 c = callbacks; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
540 if (c == NULL) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
541 break; |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
542 } |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
543 c = g_list_next(c); |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
544 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
545 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
546 |
90 | 547 #endif /* GAIM_PLUGINS */ |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
548 |
797
c13e78ae0f86
[gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
789
diff
changeset
|
549 char *event_name(enum gaim_event event) |
c13e78ae0f86
[gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
789
diff
changeset
|
550 { |
c13e78ae0f86
[gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
789
diff
changeset
|
551 static char buf[128]; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
552 switch (event) { |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
553 case event_signon: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
554 sprintf(buf, "event_signon"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
555 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
556 case event_signoff: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
557 sprintf(buf, "event_signoff"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
558 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
559 case event_away: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
560 sprintf(buf, "event_away"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
561 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
562 case event_back: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
563 sprintf(buf, "event_back"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
564 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
565 case event_im_recv: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
566 sprintf(buf, "event_im_recv"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
567 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
568 case event_im_send: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
569 sprintf(buf, "event_im_send"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
570 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
571 case event_buddy_signon: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
572 sprintf(buf, "event_buddy_signon"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
573 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
574 case event_buddy_signoff: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
575 sprintf(buf, "event_buddy_signoff"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
576 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
577 case event_buddy_away: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
578 sprintf(buf, "event_buddy_away"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
579 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
580 case event_buddy_back: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
581 sprintf(buf, "event_buddy_back"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
582 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
583 case event_buddy_idle: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
584 sprintf(buf, "event_buddy_idle"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
585 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
586 case event_buddy_unidle: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
587 sprintf(buf, "event_buddy_unidle"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
588 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
589 case event_blist_update: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
590 sprintf(buf, "event_blist_update"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
591 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
592 case event_chat_invited: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
593 sprintf(buf, "event_chat_invited"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
594 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
595 case event_chat_join: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
596 sprintf(buf, "event_chat_join"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
597 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
598 case event_chat_leave: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
599 sprintf(buf, "event_chat_leave"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
600 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
601 case event_chat_buddy_join: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
602 sprintf(buf, "event_chat_buddy_join"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
603 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
604 case event_chat_buddy_leave: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
605 sprintf(buf, "event_chat_buddy_leave"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
606 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
607 case event_chat_recv: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
608 sprintf(buf, "event_chat_recv"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
609 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
610 case event_chat_send: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
611 sprintf(buf, "event_chat_send"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
612 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
613 case event_warned: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
614 sprintf(buf, "event_warned"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
615 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
616 case event_error: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
617 sprintf(buf, "event_error"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
618 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
619 case event_quit: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
620 sprintf(buf, "event_quit"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
621 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
622 case event_new_conversation: |
1745 | 623 sprintf(buf, "event_new_conversation"); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
624 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
625 default: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
626 sprintf(buf, "event_unknown"); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
627 break; |
797
c13e78ae0f86
[gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
789
diff
changeset
|
628 } |
c13e78ae0f86
[gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
789
diff
changeset
|
629 return buf; |
c13e78ae0f86
[gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
789
diff
changeset
|
630 } |
c13e78ae0f86
[gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
789
diff
changeset
|
631 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
632 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
|
633 { |
783
5bad8e4d1c88
[gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
634 #ifdef USE_PERL |
5bad8e4d1c88
[gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
635 char buf[BUF_LONG]; |
797
c13e78ae0f86
[gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
789
diff
changeset
|
636 char *tmp; |
783
5bad8e4d1c88
[gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
637 #endif |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
638 #ifdef GAIM_PLUGINS |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
639 GList *c = callbacks; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
640 struct gaim_callback *g; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
641 |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
642 while (c) { |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
643 g = (struct gaim_callback *)c->data; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
644 if (g->event == event && g->function !=NULL) { |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
645 switch (event) { |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
646 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
647 /* struct gaim_connection * */ |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
648 case event_signon: |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
649 case event_signoff: |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
650 { |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
651 void (*function) (struct gaim_connection *, void *) = |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
652 g->function; |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
653 (*function)(arg1, g->data); |
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
654 } |
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
655 break; |
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
656 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
657 /* no args */ |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
658 case event_blist_update: |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
659 case event_quit: |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
660 { |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
661 void (*function)(void *) = g->function; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
662 (*function)(g->data); |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
663 } |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
664 break; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
665 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
666 /* struct gaim_connection *, char **, char ** */ |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
667 case event_im_recv: |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
668 { |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
669 void (*function)(struct gaim_connection *, char **, char **, |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
670 void *) = g->function; |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
671 (*function)(arg1, arg2, arg3, g->data); |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
672 } |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
673 break; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
674 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
675 /* struct gaim_connection *, char *, char ** */ |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
676 case event_im_send: |
783
5bad8e4d1c88
[gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
677 case event_chat_send: |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
678 { |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
679 void (*function)(struct gaim_connection *, char *, char **, |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
680 void *) = g->function; |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
681 (*function)(arg1, arg2, arg3, g->data); |
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
682 } |
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
683 break; |
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
684 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
685 /* struct gaim_connection *, char * */ |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
686 case event_chat_join: |
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
687 case event_chat_leave: |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
688 case event_buddy_signon: |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
689 case event_buddy_signoff: |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
690 case event_buddy_away: |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
691 case event_buddy_back: |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
692 case event_buddy_idle: |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
693 case event_buddy_unidle: |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
694 { |
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
695 void (*function)(struct gaim_connection *, char *, void *) = |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
696 g->function; |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
697 (*function)(arg1, arg2, g->data); |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
698 } |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
699 break; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
700 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
701 /* char * */ |
808
9d61f3d01046
[gaim-migrate @ 818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
806
diff
changeset
|
702 case event_new_conversation: |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
703 { |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
704 void (*function)(char *, void *) = g->function; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
705 (*function)(arg1, g->data); |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
706 } |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
707 break; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
708 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
709 /* struct gaim_connection *, char *, char *, char * */ |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
710 case event_chat_invited: |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
711 case event_chat_recv: |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
712 { |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
713 void (*function)(struct gaim_connection *, char *, char *, |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
714 char *, void *) = g->function; |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
715 (*function)(arg1, arg2, arg3, arg4, g->data); |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
716 } |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
717 break; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
718 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
719 /* struct gaim_connection *, char *, char * */ |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
720 case event_chat_buddy_join: |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
721 case event_chat_buddy_leave: |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
722 case event_away: |
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
723 case event_back: |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
724 { |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
725 void (*function)(struct gaim_connection *, char *, char *, |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
726 void *) = g->function; |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
727 (*function)(arg1, arg2, arg3, g->data); |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
728 } |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
729 break; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
730 |
1429
865a6ead3258
[gaim-migrate @ 1439]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
731 /* struct gaim_connection *, char *, int */ |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
732 case event_warned: |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
733 { |
1429
865a6ead3258
[gaim-migrate @ 1439]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
734 void (*function)(struct gaim_connection *, char *, int, |
865a6ead3258
[gaim-migrate @ 1439]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
735 void *) = g->function; |
865a6ead3258
[gaim-migrate @ 1439]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
736 (*function)(arg1, arg2, (int)arg3, g->data); |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
737 } |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
738 break; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
739 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
740 /* int */ |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
741 case event_error: |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
742 { |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
743 void (*function)(int, void *) = g->function; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
744 (*function)((int)arg1, g->data); |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
745 } |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
746 break; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
747 |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
748 default: |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
749 debug_printf("unknown event %d\n", event); |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
750 break; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
751 } |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
752 } |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
753 c = c->next; |
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 #endif /* GAIM_PLUGINS */ |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
756 #ifdef USE_PERL |
783
5bad8e4d1c88
[gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
757 switch (event) { |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
758 case event_signon: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
759 g_snprintf(buf, sizeof buf, "\"%s\"", ((struct gaim_connection *)arg1)->username); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
760 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
761 case event_signoff: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
762 g_snprintf(buf, sizeof buf, "\"%s\"", ((struct gaim_connection *)arg1)->username); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
763 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
764 case event_away: |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
765 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
|
766 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
767 case event_back: |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
768 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
|
769 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
770 case event_im_recv: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
771 g_snprintf(buf, sizeof buf, "\"%s\" \"%s\" %s", |
1712
560b3117aedf
[gaim-migrate @ 1722]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
772 ((struct gaim_connection *)arg1)->username, |
560b3117aedf
[gaim-migrate @ 1722]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
773 *(char **)arg2 ? *(char **)arg2 : "(null)", |
560b3117aedf
[gaim-migrate @ 1722]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
774 *(char **)arg3 ? *(char **)arg3 : "(null)"); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
775 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
776 case event_im_send: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
777 g_snprintf(buf, sizeof buf, "\"%s\" \"%s\" %s", |
1712
560b3117aedf
[gaim-migrate @ 1722]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
778 ((struct gaim_connection *)arg1)->username, (char *)arg2, |
560b3117aedf
[gaim-migrate @ 1722]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
779 *(char **)arg3 ? *(char **)arg3 : "(null)"); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
780 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
781 case event_buddy_signon: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
782 g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
783 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
784 case event_buddy_signoff: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
785 g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
786 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
787 case event_buddy_away: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
788 g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
789 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
790 case event_buddy_back: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
791 g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
792 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
793 case event_buddy_idle: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
794 g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
795 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
796 case event_buddy_unidle: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
797 g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
798 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
799 case event_blist_update: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
800 buf[0] = 0; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
801 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
802 case event_chat_invited: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
803 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
|
804 (char *)arg4); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
805 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
806 case event_chat_join: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
807 g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
808 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
809 case event_chat_leave: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
810 g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
811 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
812 case event_chat_buddy_join: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
813 g_snprintf(buf, sizeof buf, "\"%s\" \"%s\"", (char *)arg2, (char *)arg3); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
814 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
815 case event_chat_buddy_leave: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
816 g_snprintf(buf, sizeof buf, "\"%s\" \"%s\"", (char *)arg2, (char *)arg3); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
817 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
818 case event_chat_recv: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
819 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
|
820 (char *)arg4); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
821 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
822 case event_chat_send: |
1712
560b3117aedf
[gaim-migrate @ 1722]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
823 g_snprintf(buf, sizeof buf, "\"%s\" %s", (char *)arg2, |
560b3117aedf
[gaim-migrate @ 1722]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
824 *(char **)arg3 ? *(char **)arg3 : "(null)"); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
825 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
826 case event_warned: |
1429
865a6ead3258
[gaim-migrate @ 1439]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
827 g_snprintf(buf, sizeof buf, "\"%s\" \"%s\" %d", |
865a6ead3258
[gaim-migrate @ 1439]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
828 ((struct gaim_connection *)arg1)->username, (char *)arg2, (int)arg3); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
829 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
830 case event_error: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
831 g_snprintf(buf, sizeof buf, "%d", (int)arg1); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
832 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
833 case event_quit: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
834 buf[0] = 0; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
835 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
836 case event_new_conversation: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
837 g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg1); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
838 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
839 default: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
840 break; |
783
5bad8e4d1c88
[gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
841 } |
797
c13e78ae0f86
[gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
789
diff
changeset
|
842 tmp = event_name(event); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
843 debug_printf("%s: %s\n", tmp, buf); |
1100
f168625b63fe
[gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
844 return perl_event(tmp, buf); |
f168625b63fe
[gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
845 #else |
f168625b63fe
[gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
846 return 0; |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
847 #endif |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
656
diff
changeset
|
848 } |