annotate src/plugins.c @ 808:9d61f3d01046

[gaim-migrate @ 818] event_new_conversation committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 31 Aug 2000 03:40:17 +0000
parents 67bdecdecbb7
children 9a123b171f46
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1 /*
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2 * gaim
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
5 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
9 * (at your option) any later version.
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
10 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
14 * GNU General Public License for more details.
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
15 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
19 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
20 * ----------------
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
21 * The Plug-in plug
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
22 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
23 * Plugin support is currently being maintained by Mike Saraf
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
24 * msaraf@dwc.edu
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
25 *
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
26 * Well, I didn't see any work done on it for a while, so I'm going to try
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
27 * my hand at it. - Eric warmenhoven@yahoo.com
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
28 *
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
29 */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
30
349
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 176
diff changeset
31 #ifdef HAVE_CONFIG_H
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 176
diff changeset
32 #include "../config.h"
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 176
diff changeset
33 #endif
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 176
diff changeset
34
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
35 #ifdef GAIM_PLUGINS
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
36
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
37 #include <string.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
38 #include <sys/time.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
39
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
40 #include <sys/types.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
41 #include <sys/stat.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
42
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
43 #include <unistd.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
44 #include <stdio.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
45 #include <stdlib.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
46 #include <gtk/gtk.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
47 #include "gaim.h"
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
48
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
49 #include <dlfcn.h>
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
50
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
51 /* ------------------ Global Variables ----------------------- */
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
52
142
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 139
diff changeset
53 GList *plugins = NULL;
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
54 GList *callbacks = NULL;
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
55
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
56 /* ------------------ Local Variables ------------------------ */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
57
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
58 static GtkWidget *plugin_dialog = NULL;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
59
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
60 static GtkWidget *pluglist;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
61 static GtkWidget *plugtext;
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
62 static GtkWidget *plugwindow;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
63
425
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
64 static GtkWidget *config = NULL;
403
d6f02d7f78d8 [gaim-migrate @ 413]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 397
diff changeset
65 static guint confighandle = 0;
110
f7c6366ca703 [gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 96
diff changeset
66
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
67 /* --------------- Function Declarations --------------------- */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
68
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
69 void show_plugins (GtkWidget *, gpointer);
142
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 139
diff changeset
70 void load_plugin (char *);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
71
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
72 void gaim_signal_connect (void *, enum gaim_event, void *, void *);
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
73 void gaim_signal_disconnect(void *, enum gaim_event, void *);
425
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
74 void gaim_plugin_unload (void *);
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
75
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
76 static void destroy_plugins (GtkWidget *, gpointer);
142
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 139
diff changeset
77 static void load_file (GtkWidget *, gpointer);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
78 static void load_which_plugin(GtkWidget *, gpointer);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
79 static void unload (GtkWidget *, gpointer);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
80 static void list_clicked (GtkWidget *, struct gaim_plugin *);
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
81 static void update_show_plugins();
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
82 static void hide_plugins (GtkWidget *, gpointer);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
83
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
84 /* ------------------ Code Below ---------------------------- */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
85
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
86 static void destroy_plugins(GtkWidget *w, gpointer data) {
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
87 if (plugin_dialog)
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
88 gtk_widget_destroy(plugin_dialog);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
89 plugin_dialog = NULL;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
90 }
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
91
142
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 139
diff changeset
92 static void load_file(GtkWidget *w, gpointer data)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
93 {
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
94 char *buf = g_malloc(BUF_LEN);
153
8ed64c704fb0 [gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 142
diff changeset
95 FILE *fd;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
96
138
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
97 if (plugin_dialog) {
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
98 g_free(buf);
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
99 gtk_widget_show(plugin_dialog);
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
100 gdk_window_raise(plugin_dialog->window);
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
101 return;
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
102 }
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
103
350
fd3cc0a28d5d [gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
104 plugin_dialog = gtk_file_selection_new(_("Gaim - Plugin List"));
138
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
105
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
106 gtk_file_selection_hide_fileop_buttons(
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
107 GTK_FILE_SELECTION(plugin_dialog));
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
108
153
8ed64c704fb0 [gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 142
diff changeset
109 g_snprintf(buf, BUF_LEN - 1, "%s/%s", getenv("HOME"), PLUGIN_DIR);
8ed64c704fb0 [gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 142
diff changeset
110 fd = fopen(buf, "r");
8ed64c704fb0 [gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 142
diff changeset
111 if (!fd)
8ed64c704fb0 [gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 142
diff changeset
112 mkdir(buf, S_IRUSR | S_IWUSR | S_IXUSR);
8ed64c704fb0 [gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 142
diff changeset
113 else
8ed64c704fb0 [gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 142
diff changeset
114 fclose(fd);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
115
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
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
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
118 gtk_signal_connect(GTK_OBJECT(plugin_dialog), "destroy",
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
119 GTK_SIGNAL_FUNC(destroy_plugins), plugin_dialog);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
120
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
121 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(plugin_dialog)->ok_button),
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
122 "clicked", GTK_SIGNAL_FUNC(load_which_plugin), NULL);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
123
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
124 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(plugin_dialog)->cancel_button),
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
125 "clicked", GTK_SIGNAL_FUNC(destroy_plugins), NULL);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
126
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
127 g_free(buf);
626
d86cc11faab8 [gaim-migrate @ 636]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 619
diff changeset
128 gtk_widget_show(plugin_dialog);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
129 gdk_window_raise(plugin_dialog->window);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
130 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
131
139
c009c4f4ad02 [gaim-migrate @ 149]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 138
diff changeset
132 static void load_which_plugin(GtkWidget *w, gpointer data) {
142
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 139
diff changeset
133 load_plugin(gtk_file_selection_get_filename(
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 139
diff changeset
134 GTK_FILE_SELECTION(plugin_dialog)));
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 139
diff changeset
135
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 139
diff changeset
136 if (plugin_dialog)
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 139
diff changeset
137 gtk_widget_destroy(plugin_dialog);
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 139
diff changeset
138 plugin_dialog = NULL;
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 139
diff changeset
139 }
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 139
diff changeset
140
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 139
diff changeset
141 void load_plugin(char *filename) {
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
142 struct gaim_plugin *plug;
425
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
143 GList *c = plugins;
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
144 int (*gaim_plugin_init)();
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
145 char *(*gaim_plugin_error)(int);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
146 char *(*cfunc)();
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
147 char *error;
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
148 int retval;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
149 char *plugin_error;
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
150
153
8ed64c704fb0 [gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 142
diff changeset
151 if (filename == NULL) return;
425
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
152 /* i shouldn't be checking based solely on path, but i'm lazy */
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
153 while (c) {
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
154 plug = (struct gaim_plugin *)c->data;
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
155 if (!strcmp(filename, plug->filename)) {
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
156 sprintf(debug_buff, _("Already loaded %s, "
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
157 "not reloading.\n"), filename);
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
158 debug_print(debug_buff);
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
159 return;
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
160 }
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
161 c = c->next;
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
162 }
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
163 plug = g_malloc(sizeof *plug);
153
8ed64c704fb0 [gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 142
diff changeset
164 if (filename[0] != '/') {
8ed64c704fb0 [gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 142
diff changeset
165 char *buf = g_malloc(BUF_LEN);
8ed64c704fb0 [gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 142
diff changeset
166 g_snprintf(buf, BUF_LEN - 1, "%s/%s", getenv("HOME"), PLUGIN_DIR);
8ed64c704fb0 [gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 142
diff changeset
167 plug->filename = g_malloc(strlen(buf) + strlen(filename) + 1);
8ed64c704fb0 [gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 142
diff changeset
168 sprintf(plug->filename, "%s%s", buf, filename);
787
53d2e3e02297 [gaim-migrate @ 797]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 784
diff changeset
169 g_free(buf);
153
8ed64c704fb0 [gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 142
diff changeset
170 } else
8ed64c704fb0 [gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 142
diff changeset
171 plug->filename = g_strdup(filename);
176
c99d0b82c8a8 [gaim-migrate @ 186]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 154
diff changeset
172 sprintf(debug_buff, "Loading %s\n", filename);
c99d0b82c8a8 [gaim-migrate @ 186]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 154
diff changeset
173 debug_print(debug_buff);
425
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
174 /* do NOT `OR' with RTLD_GLOBAL, otherwise plugins may conflict
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
175 * (it's really just a way to work around other people's bad
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
176 * programming, by not using RTLD_GLOBAL :P ) */
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
177 plug->handle = dlopen(plug->filename, RTLD_LAZY);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
178 if (!plug->handle) {
129
4290a5a20d3c [gaim-migrate @ 139]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 110
diff changeset
179 error = (char *)dlerror();
350
fd3cc0a28d5d [gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
180 do_error_dialog(error, _("Plugin Error"));
787
53d2e3e02297 [gaim-migrate @ 797]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 784
diff changeset
181 g_free(plug->filename);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
182 g_free(plug);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
183 return;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
184 }
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
185
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
186 gaim_plugin_init = dlsym(plug->handle, "gaim_plugin_init");
129
4290a5a20d3c [gaim-migrate @ 139]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 110
diff changeset
187 if ((error = (char *)dlerror()) != NULL) {
350
fd3cc0a28d5d [gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
188 do_error_dialog(error, _("Plugin Error"));
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
189 dlclose(plug->handle);
787
53d2e3e02297 [gaim-migrate @ 797]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 784
diff changeset
190 g_free(plug->filename);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
191 g_free(plug);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
192 return;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
193 }
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
194
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
195 retval = (*gaim_plugin_init)(plug->handle);
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
196 sprintf(debug_buff, "loaded plugin returned %d\n", retval);
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
197 debug_print(debug_buff);
397
0b5ecac8aa54 [gaim-migrate @ 407]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 392
diff changeset
198 if (retval < 0) {
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
199 GList *c = callbacks;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
200 struct gaim_callback *g;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
201 while (c) {
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
202 g = (struct gaim_callback *)c->data;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
203 if (g->handle == plug->handle) {
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
204 callbacks = g_list_remove(callbacks, c->data);
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
205 sprintf(debug_buff, "Removing callback, %d remain\n",
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
206 g_list_length(callbacks));
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
207 debug_print(debug_buff);
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
208 c = callbacks;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
209 if (c == NULL) {
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
210 break;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
211 }
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
212 } else {
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
213 c = c->next;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
214 }
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
215 }
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
216 gaim_plugin_error = dlsym(plug->handle, "gaim_plugin_error");
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
217 if ((error = (char *)dlerror()) == NULL) {
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
218 plugin_error = (*gaim_plugin_error)(retval);
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
219 if (plugin_error)
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
220 do_error_dialog(plugin_error, _("Plugin Error"));
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
221 }
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
222 dlclose(plug->handle);
787
53d2e3e02297 [gaim-migrate @ 797]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 784
diff changeset
223 g_free(plug->filename);
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
224 g_free(plug);
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
225 return;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
226 }
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
227
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
228 plugins = g_list_append(plugins, plug);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
229
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
230 cfunc = dlsym(plug->handle, "name");
129
4290a5a20d3c [gaim-migrate @ 139]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 110
diff changeset
231 if ((error = (char *)dlerror()) == NULL)
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
232 plug->name = (*cfunc)();
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
233 else
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
234 plug->name = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
235
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
236 cfunc = dlsym(plug->handle, "description");
129
4290a5a20d3c [gaim-migrate @ 139]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 110
diff changeset
237 if ((error = (char *)dlerror()) == NULL)
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
238 plug->description = (*cfunc)();
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
239 else
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
240 plug->description = NULL;
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
241
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
242 update_show_plugins();
153
8ed64c704fb0 [gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 142
diff changeset
243 save_prefs();
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
244 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
245
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
246 void show_plugins(GtkWidget *w, gpointer data) {
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
247 /* most of this code was shamelessly stolen from prefs.c */
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
248 GtkWidget *page;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
249 GtkWidget *topbox;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
250 GtkWidget *botbox;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
251 GtkWidget *sw;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
252 GtkWidget *label;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
253 GtkWidget *list_item;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
254 GtkWidget *sw2;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
255 GtkWidget *add;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
256 GtkWidget *remove;
96
247f540ea6e1 [gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 94
diff changeset
257 GtkWidget *close;
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
258 GList *plugs = plugins;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
259 struct gaim_plugin *p;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
260 gchar buffer[1024];
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
261
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
262 if (plugwindow) return;
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
263
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
264 plugwindow = gtk_window_new(GTK_WINDOW_DIALOG);
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
265 gtk_widget_realize(plugwindow);
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
266 aol_icon(plugwindow->window);
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
267 gtk_container_border_width(GTK_CONTAINER(plugwindow), 10);
350
fd3cc0a28d5d [gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
268 gtk_window_set_title(GTK_WINDOW(plugwindow), _("Gaim - Plugins"));
656
732ee4f6f541 [gaim-migrate @ 666]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 626
diff changeset
269 gtk_widget_set_usize(plugwindow, 400, 250);
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
270 gtk_signal_connect(GTK_OBJECT(plugwindow), "destroy",
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
271 GTK_SIGNAL_FUNC(hide_plugins), NULL);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
272
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
273 page = gtk_vbox_new(FALSE, 0);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
274 topbox = gtk_hbox_new(FALSE, 0);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
275 botbox = gtk_hbox_new(FALSE, 0);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
276
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
277 sw2 = gtk_scrolled_window_new(NULL, NULL);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
278 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw2),
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
279 GTK_POLICY_AUTOMATIC,
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
280 GTK_POLICY_AUTOMATIC);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
281
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
282 pluglist = gtk_list_new();
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
283 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw2), pluglist);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
284 gtk_box_pack_start(GTK_BOX(topbox), sw2, TRUE, TRUE, 0);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
285
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
286 sw = gtk_scrolled_window_new(NULL, NULL);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
287 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
288 GTK_POLICY_AUTOMATIC,
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
289 GTK_POLICY_AUTOMATIC);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
290
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
291 plugtext = gtk_text_new(NULL, NULL);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
292 gtk_container_add(GTK_CONTAINER(sw), plugtext);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
293 gtk_box_pack_start(GTK_BOX(topbox), sw, TRUE, TRUE, 0);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
294 gtk_text_set_word_wrap(GTK_TEXT(plugtext), TRUE);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
295 gtk_text_set_editable(GTK_TEXT(plugtext), FALSE);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
296
656
732ee4f6f541 [gaim-migrate @ 666]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 626
diff changeset
297 add = gtk_button_new_with_label(_("Load Plugin"));
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
298 gtk_signal_connect(GTK_OBJECT(add), "clicked",
142
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 139
diff changeset
299 GTK_SIGNAL_FUNC(load_file), NULL);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
300 gtk_box_pack_start(GTK_BOX(botbox), add, TRUE, FALSE, 5);
656
732ee4f6f541 [gaim-migrate @ 666]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 626
diff changeset
301 if (display_options & OPT_DISP_COOL_LOOK)
732ee4f6f541 [gaim-migrate @ 666]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 626
diff changeset
302 gtk_button_set_relief(GTK_BUTTON(add), GTK_RELIEF_NONE);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
303
656
732ee4f6f541 [gaim-migrate @ 666]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 626
diff changeset
304 config = gtk_button_new_with_label(_("Configure Plugin"));
110
f7c6366ca703 [gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 96
diff changeset
305 gtk_widget_set_sensitive(config, 0);
f7c6366ca703 [gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 96
diff changeset
306 gtk_box_pack_start(GTK_BOX(botbox), config, TRUE, FALSE, 5);
656
732ee4f6f541 [gaim-migrate @ 666]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 626
diff changeset
307 if (display_options & OPT_DISP_COOL_LOOK)
732ee4f6f541 [gaim-migrate @ 666]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 626
diff changeset
308 gtk_button_set_relief(GTK_BUTTON(config), GTK_RELIEF_NONE);
110
f7c6366ca703 [gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 96
diff changeset
309
656
732ee4f6f541 [gaim-migrate @ 666]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 626
diff changeset
310 remove = gtk_button_new_with_label(_("Unload Plugin"));
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
311 gtk_signal_connect(GTK_OBJECT(remove), "clicked",
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
312 GTK_SIGNAL_FUNC(unload), pluglist);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
313 gtk_box_pack_start(GTK_BOX(botbox), remove, TRUE, FALSE, 5);
656
732ee4f6f541 [gaim-migrate @ 666]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 626
diff changeset
314 if (display_options & OPT_DISP_COOL_LOOK)
732ee4f6f541 [gaim-migrate @ 666]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 626
diff changeset
315 gtk_button_set_relief(GTK_BUTTON(remove), GTK_RELIEF_NONE);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
316
656
732ee4f6f541 [gaim-migrate @ 666]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 626
diff changeset
317 close = gtk_button_new_with_label(_("Close"));
96
247f540ea6e1 [gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 94
diff changeset
318 gtk_signal_connect(GTK_OBJECT(close), "clicked",
247f540ea6e1 [gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 94
diff changeset
319 GTK_SIGNAL_FUNC(hide_plugins), NULL);
247f540ea6e1 [gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 94
diff changeset
320 gtk_box_pack_start(GTK_BOX(botbox), close, TRUE, FALSE, 5);
656
732ee4f6f541 [gaim-migrate @ 666]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 626
diff changeset
321 if (display_options & OPT_DISP_COOL_LOOK)
732ee4f6f541 [gaim-migrate @ 666]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 626
diff changeset
322 gtk_button_set_relief(GTK_BUTTON(close), GTK_RELIEF_NONE);
619
faa7603ae02e [gaim-migrate @ 629]
Todd Kulesza <fflewddur>
parents: 535
diff changeset
323
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
324 gtk_box_pack_start(GTK_BOX(page), topbox, TRUE, TRUE, 0);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
325 gtk_box_pack_start(GTK_BOX(page), botbox, FALSE, FALSE, 0);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
326
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
327 if (plugs != NULL) {
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
328 p = (struct gaim_plugin *)plugs->data;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
329 g_snprintf(buffer, sizeof(buffer), "%s", p->filename);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
330 gtk_text_insert(GTK_TEXT(plugtext), NULL, NULL, NULL, buffer, -1);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
331 }
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
332
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
333 while (plugs) {
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
334 p = (struct gaim_plugin *)plugs->data;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
335 label = gtk_label_new(p->filename);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
336 list_item = gtk_list_item_new();
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
337 gtk_container_add(GTK_CONTAINER(list_item), label);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
338 gtk_signal_connect(GTK_OBJECT(list_item), "select",
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
339 GTK_SIGNAL_FUNC(list_clicked), p);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
340 gtk_object_set_user_data(GTK_OBJECT(list_item), p);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
341
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
342 gtk_widget_show(label);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
343 gtk_container_add(GTK_CONTAINER(pluglist), list_item);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
344 gtk_widget_show(list_item);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
345
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
346 plugs = plugs->next;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
347 }
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
348 if (plugins != NULL)
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
349 gtk_list_select_item(GTK_LIST(pluglist), 0);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
350
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
351 gtk_widget_show(page);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
352 gtk_widget_show(topbox);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
353 gtk_widget_show(botbox);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
354 gtk_widget_show(sw);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
355 gtk_widget_show(sw2);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
356 gtk_widget_show(pluglist);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
357 gtk_widget_show(plugtext);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
358 gtk_widget_show(add);
110
f7c6366ca703 [gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 96
diff changeset
359 gtk_widget_show(config);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
360 gtk_widget_show(remove);
96
247f540ea6e1 [gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 94
diff changeset
361 gtk_widget_show(close);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
362
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
363 gtk_container_add(GTK_CONTAINER(plugwindow), page);
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
364 gtk_widget_show(plugwindow);
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
365 }
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
366
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
367 void update_show_plugins() {
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
368 GList *plugs = plugins;
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
369 struct gaim_plugin *p;
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
370 GtkWidget *label;
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
371 GtkWidget *list_item;
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
372
425
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
373 if (plugwindow == NULL) 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;
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
378 label = gtk_label_new(p->filename);
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);
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
381 gtk_signal_connect(GTK_OBJECT(list_item), "select",
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
382 GTK_SIGNAL_FUNC(list_clicked), p);
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
383 gtk_object_set_user_data(GTK_OBJECT(list_item), p);
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
384
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
385 gtk_widget_show(label);
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
386 gtk_container_add(GTK_CONTAINER(pluglist), list_item);
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
387 gtk_widget_show(list_item);
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
388 plugs = plugs->next;
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
389 }
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
390 if (plugins != NULL)
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
391 gtk_list_select_item(GTK_LIST(pluglist), 0);
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
392 else {
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
393 gtk_text_set_point(GTK_TEXT(plugtext), 0);
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
394 gtk_text_forward_delete(GTK_TEXT(plugtext),
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
395 gtk_text_get_length(GTK_TEXT(plugtext)));
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
396 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
397 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
398
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
399 void unload(GtkWidget *w, gpointer data) {
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
400 GList *i;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
401 struct gaim_plugin *p;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
402 void (*gaim_plugin_remove)();
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
403 char *error;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
404
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
405 i = GTK_LIST(pluglist)->selection;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
406
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
407 if (i == NULL) return;
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
408
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
409 p = gtk_object_get_user_data(GTK_OBJECT(i->data));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
410
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
411 gaim_plugin_remove = dlsym(p->handle, "gaim_plugin_remove");
129
4290a5a20d3c [gaim-migrate @ 139]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 110
diff changeset
412 if ((error = (char *)dlerror()) == NULL)
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
413 (*gaim_plugin_remove)();
425
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
414
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
415 gaim_plugin_unload(p->handle);
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
416 }
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
417
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
418 static void remove_callback(struct gaim_plugin *p) {
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
419 gtk_timeout_remove(p->remove);
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
420 dlclose(p->handle);
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
421 g_free(p);
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
422 }
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 /* gaim_plugin_unload serves 2 purposes: 1. so plugins can unload themselves
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
425 * 2. to make my life easier */
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
426 void gaim_plugin_unload(void *handle) {
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
427 GList *i;
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
428 struct gaim_plugin *p = NULL;
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
429 GList *c = callbacks;
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
430 struct gaim_callback *g;
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 i = plugins;
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
433 while (i) {
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
434 p = (struct gaim_plugin *)i->data;
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
435 if (handle == p->handle)
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
436 break;
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
437 p = NULL;
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
438 i = i->next;
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
439 }
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
440
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
441 if (!p)
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
442 return;
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
443
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
444 sprintf(debug_buff, "Unloading %s\n", p->filename);
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
445 debug_print(debug_buff);
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
446
176
c99d0b82c8a8 [gaim-migrate @ 186]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 154
diff changeset
447 sprintf(debug_buff, "%d callbacks to search\n", g_list_length(callbacks));
c99d0b82c8a8 [gaim-migrate @ 186]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 154
diff changeset
448 debug_print(debug_buff);
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
449 while (c) {
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
450 g = (struct gaim_callback *)c->data;
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
451 if (g->handle == p->handle) {
138
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
452 callbacks = g_list_remove(callbacks, c->data);
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
453 g_free(g);
176
c99d0b82c8a8 [gaim-migrate @ 186]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 154
diff changeset
454 sprintf(debug_buff, "Removing callback, %d remain\n",
c99d0b82c8a8 [gaim-migrate @ 186]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 154
diff changeset
455 g_list_length(callbacks));
c99d0b82c8a8 [gaim-migrate @ 186]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 154
diff changeset
456 debug_print(debug_buff);
138
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
457 c = callbacks;
176
c99d0b82c8a8 [gaim-migrate @ 186]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 154
diff changeset
458 if (c == NULL) {
c99d0b82c8a8 [gaim-migrate @ 186]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 154
diff changeset
459 break;
c99d0b82c8a8 [gaim-migrate @ 186]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 154
diff changeset
460 }
c99d0b82c8a8 [gaim-migrate @ 186]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 154
diff changeset
461 } else {
c99d0b82c8a8 [gaim-migrate @ 186]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 154
diff changeset
462 c = c->next;
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
463 }
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
464 }
425
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
465 p->remove = gtk_timeout_add(5000, (GtkFunction)remove_callback, p);
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
466
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
467 plugins = g_list_remove(plugins, p);
138
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
468 g_free(p->filename);
425
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
469 if (config) gtk_widget_set_sensitive(config, 0);
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
470 update_show_plugins();
154
1c4e47c0c5dd [gaim-migrate @ 164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 153
diff changeset
471 save_prefs();
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
472 }
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
473
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
474 void list_clicked(GtkWidget *w, struct gaim_plugin *p) {
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
475 gchar buffer[2048];
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
476 guint text_len;
110
f7c6366ca703 [gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 96
diff changeset
477 void (*gaim_plugin_config)();
f7c6366ca703 [gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 96
diff changeset
478 char *error;
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
479
522
11cbf8b403b6 [gaim-migrate @ 532]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 425
diff changeset
480 if (confighandle != 0)
403
d6f02d7f78d8 [gaim-migrate @ 413]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 397
diff changeset
481 gtk_signal_disconnect(GTK_OBJECT(config), confighandle);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
482 text_len = gtk_text_get_length(GTK_TEXT(plugtext));
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
483 gtk_text_set_point(GTK_TEXT(plugtext), 0);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
484 gtk_text_forward_delete(GTK_TEXT(plugtext), text_len);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
485
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
486 g_snprintf(buffer, sizeof buffer, "%s\n%s", p->name, p->description);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
487 gtk_text_insert(GTK_TEXT(plugtext), NULL, NULL, NULL, buffer, -1);
110
f7c6366ca703 [gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 96
diff changeset
488
f7c6366ca703 [gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 96
diff changeset
489 gaim_plugin_config = dlsym(p->handle, "gaim_plugin_config");
129
4290a5a20d3c [gaim-migrate @ 139]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 110
diff changeset
490 if ((error = (char *)dlerror()) == NULL) {
403
d6f02d7f78d8 [gaim-migrate @ 413]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 397
diff changeset
491 confighandle = gtk_signal_connect(GTK_OBJECT(config), "clicked",
110
f7c6366ca703 [gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 96
diff changeset
492 GTK_SIGNAL_FUNC(gaim_plugin_config), NULL);
f7c6366ca703 [gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 96
diff changeset
493 gtk_widget_set_sensitive(config, 1);
f7c6366ca703 [gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 96
diff changeset
494 } else {
403
d6f02d7f78d8 [gaim-migrate @ 413]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 397
diff changeset
495 confighandle = 0;
110
f7c6366ca703 [gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 96
diff changeset
496 gtk_widget_set_sensitive(config, 0);
f7c6366ca703 [gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 96
diff changeset
497 }
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
498 }
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
499
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
500 void hide_plugins(GtkWidget *w, gpointer data) {
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
501 if (plugwindow)
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
502 gtk_widget_destroy(plugwindow);
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
503 plugwindow = NULL;
425
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
504 config = NULL;
522
11cbf8b403b6 [gaim-migrate @ 532]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 425
diff changeset
505 confighandle = 0;
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
506 }
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
507
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
508 void gaim_signal_connect(void *handle, enum gaim_event which,
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
509 void *func, void *data) {
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
510 struct gaim_callback *call = g_malloc(sizeof *call);
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
511 call->handle = handle;
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
512 call->event = which;
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
513 call->function = func;
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
514 call->data = data;
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
515
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
516 callbacks = g_list_append(callbacks, call);
176
c99d0b82c8a8 [gaim-migrate @ 186]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 154
diff changeset
517 sprintf(debug_buff, "Adding callback %d\n", g_list_length(callbacks));
c99d0b82c8a8 [gaim-migrate @ 186]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 154
diff changeset
518 debug_print(debug_buff);
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
519 }
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
520
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
521 void gaim_signal_disconnect(void *handle, enum gaim_event which, void *func) {
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
522 GList *c = callbacks;
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
523 struct gaim_callback *g = NULL;
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
524 while (c) {
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
525 g = (struct gaim_callback *)c->data;
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
526 if (handle == g->handle && func == g->function) {
138
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
527 callbacks = g_list_remove(callbacks, c->data);
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
528 g_free(g);
138
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
529 c = callbacks;
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
530 if (c == NULL) break;
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
531 }
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
532 c = c->next;
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
533 }
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
534 }
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
535
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
536 #endif /* GAIM_PLUGINS */
780
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
537
797
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
538 char *event_name(enum gaim_event event)
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
539 {
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
540 static char buf[128];
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
541 switch(event) {
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
542 case event_signon:
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
543 sprintf(buf, "event_signon");
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
544 break;
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
545 case event_signoff:
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
546 sprintf(buf, "event_signoff");
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
547 break;
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
548 case event_away:
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
549 sprintf(buf, "event_away");
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
550 break;
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
551 case event_back:
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
552 sprintf(buf, "event_back");
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
553 break;
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
554 case event_im_recv:
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
555 sprintf(buf, "event_im_recv");
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
556 break;
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
557 case event_im_send:
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
558 sprintf(buf, "event_im_send");
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
559 break;
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
560 case event_buddy_signon:
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
561 sprintf(buf, "event_buddy_signon");
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
562 break;
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
563 case event_buddy_signoff:
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
564 sprintf(buf, "event_buddy_signoff");
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
565 break;
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
566 case event_buddy_away:
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
567 sprintf(buf, "event_buddy_away");
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
568 break;
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
569 case event_buddy_back:
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
570 sprintf(buf, "event_buddy_back");
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
571 break;
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
572 case event_blist_update:
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
573 sprintf(buf, "event_blist_update");
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
574 break;
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
575 case event_chat_invited:
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
576 sprintf(buf, "event_chat_invited");
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
577 break;
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
578 case event_chat_join:
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
579 sprintf(buf, "event_chat_join");
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
580 break;
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
581 case event_chat_leave:
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
582 sprintf(buf, "event_chat_leave");
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
583 break;
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
584 case event_chat_buddy_join:
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
585 sprintf(buf, "event_chat_buddy_join");
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
586 break;
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
587 case event_chat_buddy_leave:
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
588 sprintf(buf, "event_chat_buddy_leave");
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
589 break;
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
590 case event_chat_recv:
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
591 sprintf(buf, "event_chat_recv");
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
592 break;
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
593 case event_chat_send:
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
594 sprintf(buf, "event_chat_send");
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
595 break;
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
596 case event_warned:
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
597 sprintf(buf, "event_warned");
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
598 break;
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
599 case event_error:
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
600 sprintf(buf, "event_error");
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
601 break;
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
602 case event_quit:
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
603 sprintf(buf, "event_quit");
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
604 break;
808
9d61f3d01046 [gaim-migrate @ 818]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 806
diff changeset
605 case event_new_conversation:
9d61f3d01046 [gaim-migrate @ 818]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 806
diff changeset
606 sprintf(buf, "event_new_conversaion");
9d61f3d01046 [gaim-migrate @ 818]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 806
diff changeset
607 break;
797
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
608 default:
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
609 sprintf(buf, "event_unknown");
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
610 break;
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
611 }
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
612 return buf;
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
613 }
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
614
780
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
615 void plugin_event(enum gaim_event event, void *arg1, void *arg2, void *arg3) {
783
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
616 #ifdef USE_PERL
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
617 char buf[BUF_LONG];
797
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
618 char *tmp;
783
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
619 #endif
780
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
620 #ifdef GAIM_PLUGINS
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
621 GList *c = callbacks;
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
622 struct gaim_callback *g;
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
623
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
624 while (c) {
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
625 g = (struct gaim_callback *)c->data;
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
626 if (g->event == event && g->function != NULL) {
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
627 switch(event) {
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
628
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
629 /* no args */
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
630 case event_signon:
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
631 case event_signoff:
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
632 case event_away:
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
633 case event_back:
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
634 case event_blist_update:
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
635 case event_quit:
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
636 {
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
637 void (*function)(void *) = g->function;
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
638 (*function)(g->data);
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
639 }
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
640 break;
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 /* char **, char ** */
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
643 case event_im_recv:
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
644 {
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
645 void (*function)(char **, char **, void *) = g->function;
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
646 (*function)(arg1, arg2, g->data);
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
647 }
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
648 break;
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
649
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
650 /* char *, char ** */
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
651 case event_im_send:
783
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
652 case event_chat_send:
780
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
653 {
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
654 void (*function)(char *, char **, void *) = g->function;
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
655 (*function)(arg1, arg2, g->data);
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
656 }
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
657 break;
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
658
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
659 /* char * */
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
660 case event_buddy_signon:
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
661 case event_buddy_signoff:
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
662 case event_buddy_away:
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
663 case event_buddy_back:
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
664 case event_chat_join:
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
665 case event_chat_leave:
808
9d61f3d01046 [gaim-migrate @ 818]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 806
diff changeset
666 case event_new_conversation:
780
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
667 {
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
668 void (*function)(char *, void *) = g->function;
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
669 (*function)(arg1, g->data);
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
670 }
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
671 break;
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 /* char *, char *, char * */
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
674 case event_chat_invited:
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
675 case event_chat_recv:
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
676 {
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
677 void (*function)(char *, char *, char *, void *) = g->function;
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
678 (*function)(arg1, arg2, arg3, g->data);
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
679 }
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
680 break;
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
681
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
682 /* char *, char * */
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
683 case event_chat_buddy_join:
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
684 case event_chat_buddy_leave:
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
685 {
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
686 void (*function)(char *, char *, void *) = g->function;
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
687 (*function)(arg1, arg2, g->data);
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
688 }
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
689 break;
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
690
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
691 /* char *, int */
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
692 case event_warned:
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
693 {
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
694 void (*function)(char *, int, void *) = g->function;
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
695 (*function)(arg1, (int)arg2, g->data);
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
696 }
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
697 break;
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 /* int */
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
700 case event_error:
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
701 {
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
702 void (*function)(int, void *) = g->function;
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
703 (*function)((int)arg1, g->data);
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
704 }
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
705 break;
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 default:
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
708 sprintf(debug_buff, "unknown event %d\n", event);
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
709 debug_print(debug_buff);
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
710 break;
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
711 }
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
712 }
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
713 c = c->next;
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
714 }
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
715 #endif /* GAIM_PLUGINS */
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
716 #ifdef USE_PERL
783
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
717 switch (event) {
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
718 case event_signon:
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
719 buf[0] = 0;
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
720 break;
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
721 case event_signoff:
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
722 buf[0] = 0;
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
723 break;
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
724 case event_away:
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
725 buf[0] = 0;
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
726 break;
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
727 case event_back:
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
728 buf[0] = 0;
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
729 break;
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
730 case event_im_recv:
802
1afe98d2461e [gaim-migrate @ 812]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 797
diff changeset
731 sprintf(buf, "\"%s\" %s", *(char **)arg1, *(char **)arg2);
783
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
732 break;
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
733 case event_im_send:
802
1afe98d2461e [gaim-migrate @ 812]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 797
diff changeset
734 sprintf(buf, "\"%s\" %s", (char *)arg1, *(char **)arg2);
783
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
735 break;
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
736 case event_buddy_signon:
802
1afe98d2461e [gaim-migrate @ 812]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 797
diff changeset
737 sprintf(buf, "\"%s\"", (char *)arg1);
783
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
738 break;
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
739 case event_buddy_signoff:
802
1afe98d2461e [gaim-migrate @ 812]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 797
diff changeset
740 sprintf(buf, "\"%s\"", (char *)arg1);
783
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
741 break;
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
742 case event_buddy_away:
802
1afe98d2461e [gaim-migrate @ 812]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 797
diff changeset
743 sprintf(buf, "\"%s\"", (char *)arg1);
783
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
744 break;
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
745 case event_buddy_back:
802
1afe98d2461e [gaim-migrate @ 812]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 797
diff changeset
746 sprintf(buf, "\"%s\"", (char *)arg1);
783
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
747 break;
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
748 case event_blist_update:
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
749 buf[0] = 0;
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
750 break;
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
751 case event_chat_invited:
802
1afe98d2461e [gaim-migrate @ 812]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 797
diff changeset
752 sprintf(buf, "\"%s\" \"%s\" %s", (char *)arg1, (char *)arg2, (char *)arg3);
783
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
753 break;
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
754 case event_chat_join:
802
1afe98d2461e [gaim-migrate @ 812]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 797
diff changeset
755 sprintf(buf, "\"%s\"", (char *)arg1);
783
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
756 break;
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
757 case event_chat_leave:
802
1afe98d2461e [gaim-migrate @ 812]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 797
diff changeset
758 sprintf(buf, "\"%s\"", (char *)arg1);
783
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
759 break;
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
760 case event_chat_buddy_join:
802
1afe98d2461e [gaim-migrate @ 812]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 797
diff changeset
761 sprintf(buf, "\"%s\" \"%s\"", (char *)arg1, (char *)arg2);
783
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
762 break;
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
763 case event_chat_buddy_leave:
802
1afe98d2461e [gaim-migrate @ 812]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 797
diff changeset
764 sprintf(buf, "\"%s\" \"%s\"", (char *)arg1, (char *)arg2);
783
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
765 break;
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
766 case event_chat_recv:
802
1afe98d2461e [gaim-migrate @ 812]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 797
diff changeset
767 sprintf(buf, "\"%s\" \"%s\" %s", (char *)arg1, (char *)arg2, (char *)arg3);
783
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
768 break;
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
769 case event_chat_send:
802
1afe98d2461e [gaim-migrate @ 812]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 797
diff changeset
770 sprintf(buf, "\"%s\" %s", (char *)arg1, *(char **)arg2);
783
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
771 break;
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
772 case event_warned:
802
1afe98d2461e [gaim-migrate @ 812]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 797
diff changeset
773 sprintf(buf, "\"%s\" %d", (char *)arg1, (int)arg2);
783
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
774 break;
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
775 case event_error:
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
776 sprintf(buf, "%d", (int)arg1);
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
777 break;
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
778 case event_quit:
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
779 buf[0] = 0;
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
780 break;
808
9d61f3d01046 [gaim-migrate @ 818]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 806
diff changeset
781 case event_new_conversation:
9d61f3d01046 [gaim-migrate @ 818]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 806
diff changeset
782 sprintf(buf, "\"%s\"", (char *)arg1);
9d61f3d01046 [gaim-migrate @ 818]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 806
diff changeset
783 break;
783
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
784 default:
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
785 break;
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
786 }
797
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
787 tmp = event_name(event);
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
788 sprintf(debug_buff, "%s: %s\n", tmp, buf);
783
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
789 debug_print(debug_buff);
806
67bdecdecbb7 [gaim-migrate @ 816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 802
diff changeset
790 perl_event(tmp, buf);
780
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
791 #endif
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
792 }