Mercurial > pidgin
annotate src/perl.c @ 586:4a1181b764b6
[gaim-migrate @ 596]
finally got 'cvs add' to work :)
committer: Tailor Script <tailor@pidgin.im>
author | Todd Kulesza <fflewddur> |
---|---|
date | Wed, 02 Aug 2000 15:50:10 +0000 |
parents | c72e5ee07d0a |
children | 91f877d86ca6 |
rev | line source |
---|---|
560 | 1 /* |
2 * gaim | |
3 * | |
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 * This was taken almost exactly from X-Chat. The power of the GPL. | |
21 * Translated from X-Chat to Gaim by Eric Warmenhoven. | |
22 * Originally by Erik Scrafford <eriks@chilisoft.com>. | |
23 * | |
24 */ | |
25 | |
26 #ifdef HAVE_CONFIG_H | |
27 #include "../config.h" | |
28 #endif | |
561
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
29 #undef PACKAGE |
560 | 30 |
580
9a8b067eb368
[gaim-migrate @ 590]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
579
diff
changeset
|
31 #ifndef USE_APPLET /* FIXME: _ conflicts */ |
9a8b067eb368
[gaim-migrate @ 590]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
579
diff
changeset
|
32 #ifdef USE_PERL |
560 | 33 |
34 #include <EXTERN.h> | |
35 #ifndef _SEM_SEMUN_UNDEFINED | |
36 #define HAS_UNION_SEMUN | |
37 #endif | |
38 #include <perl.h> | |
39 #include <XSUB.h> | |
40 #include <sys/mman.h> | |
41 #include <sys/types.h> | |
42 #include <sys/stat.h> | |
43 #include <fcntl.h> | |
44 #undef PACKAGE | |
45 #include <stdio.h> | |
46 #include "gaim.h" | |
47 | |
561
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
48 struct perlscript { |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
49 char *name; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
50 char *version; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
51 char *shutdowncallback; /* bleh */ |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
52 }; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
53 |
573
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
54 struct _perl_timeout_handlers { |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
55 char *handler_name; |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
56 gint iotag; |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
57 }; |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
58 |
561
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
59 static GList *perl_list = NULL; |
573
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
60 static GList *perl_timeout_handlers = NULL; |
560 | 61 static PerlInterpreter *my_perl = NULL; |
62 | |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
63 /* dealing with gaim */ |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
64 XS(XS_AIM_register); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
65 XS(XS_AIM_get_info); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
66 XS(XS_AIM_print); /* lemme figure this one out... */ |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
67 |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
68 /* list stuff */ |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
69 XS(XS_AIM_buddy_list); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
70 XS(XS_AIM_online_list); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
71 XS(XS_AIM_deny_list); /* also returns permit list */ |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
72 |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
73 /* server stuff */ |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
74 XS(XS_AIM_command); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
75 XS(XS_AIM_user_info); /* given name, return struct buddy members */ |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
76 |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
77 /* handler commands */ |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
78 XS(XS_AIM_add_message_handler); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
79 XS(XS_AIM_add_command_handler); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
80 XS(XS_AIM_add_timeout_handler); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
81 |
561
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
82 |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
83 /* perl module support */ |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
84 extern void xs_init _((void)); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
85 extern void boot_DynaLoader _((CV * cv)); /* perl is so wacky */ |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
86 |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
87 void xs_init() |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
88 { |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
89 char *file = __FILE__; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
90 newXS ("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
91 } |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
92 |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
93 static char *escape_quotes(char *buf) |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
94 { |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
95 static char *tmp_buf = NULL; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
96 char *i, *j; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
97 |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
98 if (tmp_buf) |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
99 g_free(tmp_buf); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
100 tmp_buf = g_malloc(strlen(buf) * 2 + 1); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
101 for (i = buf, j = tmp_buf; *i; i++, j++) { |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
102 if (*i == '\'' || *i == '\\') |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
103 *j++ = '\\'; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
104 *j = *i; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
105 } |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
106 *j = '\0'; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
107 |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
108 return (tmp_buf); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
109 } |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
110 |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
111 static SV *execute_perl(char *function, char *args) |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
112 { |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
113 static char *perl_cmd = NULL; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
114 |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
115 if (perl_cmd) |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
116 g_free(perl_cmd); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
117 perl_cmd = g_malloc(strlen(function) + strlen(args) + 2 + 10); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
118 sprintf(perl_cmd, "&%s('%s')", function, escape_quotes(args)); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
119 #ifndef HAVE_PERL_EVAL_PV |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
120 return (perl_eval_pv(perl_cmd, TRUE)); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
121 #else |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
122 return (Perl_eval_pv(perl_cmd, TRUE)); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
123 #endif |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
124 } |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
125 |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
126 int perl_load_file(char *script_name) |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
127 { |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
128 SV *return_val; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
129 return_val = execute_perl("load_file", script_name); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
130 return SvNV (return_val); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
131 } |
560 | 132 |
581
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
133 void perl_init() |
560 | 134 { |
135 char *perl_args[] = {"", "-e", "0"}; | |
136 char load_file[] = | |
137 "sub load_file()\n" | |
138 "{\n" | |
139 " (my $file_name) = @_;\n" | |
140 " open FH, $file_name or return 2;\n" | |
141 " local($/) = undef;\n" | |
142 " $file = <FH>;\n" | |
143 " close FH;\n" | |
144 " eval $file;\n" | |
145 " eval $file if $@;\n" | |
146 " return 1 if $@;\n" | |
147 " return 0;\n" | |
148 "}"; | |
149 | |
150 my_perl = perl_alloc(); | |
151 perl_construct(my_perl); | |
561
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
152 perl_parse(my_perl, xs_init, 4, perl_args, NULL); |
560 | 153 #ifndef HAVE_PERL_EVAL_PV |
154 perl_eval_pv(load_file, TRUE); | |
155 #else | |
156 Perl_eval_pv(load_file, TRUE); | |
157 #endif | |
158 | |
561
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
159 newXS ("AIM::register", XS_AIM_register, "AIM"); |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
160 newXS ("AIM::get_info", XS_AIM_get_info, "AIM"); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
161 newXS ("AIM::print", XS_AIM_print, "AIM"); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
162 |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
163 newXS ("AIM::buddy_list", XS_AIM_buddy_list, "AIM"); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
164 newXS ("AIM::online_list", XS_AIM_online_list, "AIM"); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
165 newXS ("AIM::deny_list", XS_AIM_deny_list, "AIM"); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
166 |
561
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
167 newXS ("AIM::command", XS_AIM_command, "AIM"); |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
168 newXS ("AIM::user_info", XS_AIM_user_info, "AIM"); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
169 |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
170 newXS ("AIM::add_message_handler", XS_AIM_add_message_handler, "AIM"); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
171 newXS ("AIM::add_command_handler", XS_AIM_add_command_handler, "AIM"); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
172 newXS ("AIM::add_timeout_handler", XS_AIM_add_timeout_handler, "AIM"); |
560 | 173 } |
174 | |
175 void perl_end() | |
176 { | |
565
7209b474bdc3
[gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
562
diff
changeset
|
177 struct perlscript *scp; |
573
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
178 struct _perl_timeout_handlers *thn; |
565
7209b474bdc3
[gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
562
diff
changeset
|
179 |
7209b474bdc3
[gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
562
diff
changeset
|
180 while (perl_list) { |
7209b474bdc3
[gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
562
diff
changeset
|
181 scp = perl_list->data; |
7209b474bdc3
[gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
562
diff
changeset
|
182 perl_list = g_list_remove(perl_list, scp); |
7209b474bdc3
[gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
562
diff
changeset
|
183 if (scp->shutdowncallback[0]) |
7209b474bdc3
[gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
562
diff
changeset
|
184 execute_perl(scp->shutdowncallback, ""); |
7209b474bdc3
[gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
562
diff
changeset
|
185 g_free(scp->name); |
7209b474bdc3
[gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
562
diff
changeset
|
186 g_free(scp->version); |
7209b474bdc3
[gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
562
diff
changeset
|
187 g_free(scp->shutdowncallback); |
7209b474bdc3
[gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
562
diff
changeset
|
188 g_free(scp); |
7209b474bdc3
[gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
562
diff
changeset
|
189 } |
7209b474bdc3
[gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
562
diff
changeset
|
190 |
573
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
191 while (perl_timeout_handlers) { |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
192 thn = perl_timeout_handlers->data; |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
193 perl_timeout_handlers = g_list_remove(perl_timeout_handlers, thn); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
194 gtk_timeout_remove(thn->iotag); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
195 g_free(thn->handler_name); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
196 g_free(thn); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
197 } |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
198 |
560 | 199 if (my_perl != NULL) { |
200 perl_destruct(my_perl); | |
201 perl_free(my_perl); | |
202 my_perl = NULL; | |
203 } | |
204 } | |
205 | |
561
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
206 XS (XS_AIM_register) |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
207 { |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
208 char *name, *ver, *callback, *unused; /* exactly like X-Chat, eh? :) */ |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
209 int junk; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
210 struct perlscript *scp; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
211 dXSARGS; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
212 items = 0; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
213 |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
214 name = SvPV (ST (0), junk); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
215 ver = SvPV (ST (1), junk); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
216 callback = SvPV (ST (2), junk); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
217 unused = SvPV (ST (3), junk); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
218 |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
219 scp = g_new0(struct perlscript, 1); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
220 scp->name = g_strdup(name); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
221 scp->version = g_strdup(ver); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
222 scp->shutdowncallback = g_strdup(callback); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
223 perl_list = g_list_append(perl_list, scp); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
224 |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
225 XST_mPV (0, VERSION); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
226 XSRETURN (1); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
227 } |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
228 |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
229 XS (XS_AIM_get_info) |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
230 { |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
231 int junk; |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
232 dXSARGS; |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
233 items = 0; |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
234 |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
235 switch(atoi(SvPV(ST(0), junk))) { |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
236 case 0: |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
237 XST_mPV(0, VERSION); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
238 break; |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
239 case 1: |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
240 XST_mPV(0, current_user->username); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
241 break; |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
242 /* FIXME */ |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
243 default: |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
244 XST_mPV(0, "Error2"); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
245 } |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
246 |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
247 XSRETURN(1); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
248 } |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
249 |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
250 XS (XS_AIM_print) |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
251 { |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
252 /* FIXME */ |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
253 } |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
254 |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
255 XS (XS_AIM_buddy_list) |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
256 { |
581
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
257 struct buddy *buddy; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
258 struct group *g; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
259 GList *list = groups; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
260 GList *mem; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
261 int i = 0; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
262 dXSARGS; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
263 items = 0; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
264 |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
265 while (list) { |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
266 g = (struct group *)list->data; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
267 mem = g->members; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
268 while (mem) { |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
269 buddy = (struct buddy *)mem->data; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
270 XST_mPV(i++, buddy->name); |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
271 mem = mem->next; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
272 } |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
273 list = list->next; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
274 } |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
275 XSRETURN(i); |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
276 } |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
277 |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
278 XS (XS_AIM_online_list) |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
279 { |
581
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
280 struct buddy *b; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
281 struct group *g; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
282 GList *list = groups; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
283 GList *mem; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
284 int i = 0; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
285 dXSARGS; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
286 items = 0; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
287 |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
288 while (list) { |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
289 g = (struct group *)list->data; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
290 mem = g->members; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
291 while (mem) { |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
292 b = (struct buddy *)mem->data; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
293 if (b->present) XST_mPV(i++, b->name); |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
294 mem = mem->next; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
295 } |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
296 list = list->next; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
297 } |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
298 XSRETURN(i); |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
299 } |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
300 |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
301 XS (XS_AIM_deny_list) |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
302 { |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
303 /* FIXME */ |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
304 } |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
305 |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
306 XS (XS_AIM_command) |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
307 { |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
308 /* FIXME */ |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
309 } |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
310 |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
311 XS (XS_AIM_user_info) |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
312 { |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
313 int junk; |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
314 struct buddy *buddy; |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
315 char *nick; |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
316 dXSARGS; |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
317 items = 0; |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
318 |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
319 nick = SvPV(ST(0), junk); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
320 if (!nick[0]) |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
321 XSRETURN(0); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
322 buddy = find_buddy(nick); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
323 if (!buddy) |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
324 XSRETURN(0); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
325 XST_mPV(0, buddy->name); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
326 XST_mPV(1, buddy->present ? "Online" : "Offline"); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
327 XST_mIV(2, buddy->evil); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
328 XST_mIV(3, buddy->signon); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
329 XST_mIV(4, buddy->idle); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
330 XST_mIV(5, buddy->uc); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
331 XST_mIV(6, buddy->caps); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
332 XSRETURN(6); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
333 } |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
334 |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
335 XS (XS_AIM_add_message_handler) |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
336 { |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
337 /* FIXME */ |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
338 } |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
339 |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
340 XS (XS_AIM_add_command_handler) |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
341 { |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
342 /* FIXME */ |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
343 } |
561
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
344 |
573
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
345 static int perl_timeout(struct _perl_timeout_handlers *handler) |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
346 { |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
347 execute_perl(handler->handler_name, ""); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
348 perl_timeout_handlers = g_list_remove(perl_timeout_handlers, handler); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
349 g_free(handler->handler_name); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
350 g_free(handler); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
351 |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
352 return 0; /* returning zero removes the timeout handler */ |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
353 } |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
354 |
561
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
355 XS (XS_AIM_add_timeout_handler) |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
356 { |
573
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
357 int junk; |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
358 long timeout; |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
359 struct _perl_timeout_handlers *handler; |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
360 dXSARGS; |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
361 items = 0; |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
362 |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
363 handler = g_new0(struct _perl_timeout_handlers, 1); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
364 timeout = atol(SvPV(ST(0), junk)); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
365 handler->handler_name = g_strdup(SvPV(ST(1), junk)); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
366 perl_timeout_handlers = g_list_append(perl_timeout_handlers, handler); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
367 handler->iotag = gtk_timeout_add(timeout, (GtkFunction)perl_timeout, handler); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
368 XSRETURN_EMPTY; |
561
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
369 } |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
370 |
560 | 371 #endif /* USE_PERL */ |
580
9a8b067eb368
[gaim-migrate @ 590]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
579
diff
changeset
|
372 #endif /* ifndef USE_APPLET */ |