annotate src/perl.c @ 649:779c04b844f4

[gaim-migrate @ 659] hehe, i told ya it'd break everything :) committer: Tailor Script <tailor@pidgin.im>
author Todd Kulesza <fflewddur>
date Wed, 09 Aug 2000 04:20:12 +0000
parents 3d2f14064083
children 94edd99b7302
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
560
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1 /*
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2 * gaim
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3 *
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5 *
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
9 * (at your option) any later version.
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
10 *
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
14 * GNU General Public License for more details.
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
15 *
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
19 *
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
20 * This was taken almost exactly from X-Chat. The power of the GPL.
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
21 * Translated from X-Chat to Gaim by Eric Warmenhoven.
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
22 * Originally by Erik Scrafford <eriks@chilisoft.com>.
597
3a24fd19ff5f [gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 592
diff changeset
23 * X-Chat Copyright (C) 1998 Peter Zelezny.
560
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
24 *
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
25 */
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
26
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
27 #ifdef HAVE_CONFIG_H
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
28 #include "../config.h"
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
29 #endif
561
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
30 #undef PACKAGE
560
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
31
580
9a8b067eb368 [gaim-migrate @ 590]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 579
diff changeset
32 #ifdef USE_PERL
560
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
33
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
34 #include <EXTERN.h>
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
35 #ifndef _SEM_SEMUN_UNDEFINED
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
36 #define HAS_UNION_SEMUN
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
37 #endif
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
38 #include <perl.h>
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
39 #include <XSUB.h>
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
40 #include <sys/mman.h>
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
41 #include <sys/types.h>
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
42 #include <sys/stat.h>
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
43 #include <fcntl.h>
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
44 #undef PACKAGE
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
45 #include <stdio.h>
590
91f877d86ca6 [gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 581
diff changeset
46
91f877d86ca6 [gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 581
diff changeset
47 /* perl module support */
91f877d86ca6 [gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 581
diff changeset
48 extern void xs_init _((void));
91f877d86ca6 [gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 581
diff changeset
49 extern void boot_DynaLoader _((CV * cv)); /* perl is so wacky */
91f877d86ca6 [gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 581
diff changeset
50
91f877d86ca6 [gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 581
diff changeset
51 #undef _
560
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
52 #include "gaim.h"
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
53
561
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
54 struct perlscript {
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
55 char *name;
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
56 char *version;
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
57 char *shutdowncallback; /* bleh */
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
58 };
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
59
573
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
60 struct _perl_timeout_handlers {
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
61 char *handler_name;
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
62 gint iotag;
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
63 };
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
64
597
3a24fd19ff5f [gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 592
diff changeset
65 static GList *perl_list = NULL; /* should probably extern this at some point */
573
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
66 static GList *perl_timeout_handlers = NULL;
560
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
67 static PerlInterpreter *my_perl = NULL;
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
68
579
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
69 /* dealing with gaim */
591
a26eb4c472d8 [gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 590
diff changeset
70 XS(XS_AIM_register); /* set up hooks for script */
a26eb4c472d8 [gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 590
diff changeset
71 XS(XS_AIM_get_info); /* version, last to attempt signon, protocol */
579
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
72 XS(XS_AIM_print); /* lemme figure this one out... */
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
73
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
74 /* list stuff */
591
a26eb4c472d8 [gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 590
diff changeset
75 XS(XS_AIM_buddy_list); /* all buddies */
a26eb4c472d8 [gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 590
diff changeset
76 XS(XS_AIM_online_list); /* online buddies */
579
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
77 XS(XS_AIM_deny_list); /* also returns permit list */
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
78
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
79 /* server stuff */
591
a26eb4c472d8 [gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 590
diff changeset
80 XS(XS_AIM_command); /* send command to server */
579
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
81 XS(XS_AIM_user_info); /* given name, return struct buddy members */
597
3a24fd19ff5f [gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 592
diff changeset
82 XS(XS_AIM_print_to_conv); /* send message to someone */
603
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
83 XS(XS_AIM_print_to_chat); /* send message to chat room */
579
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
84
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
85 /* handler commands */
591
a26eb4c472d8 [gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 590
diff changeset
86 XS(XS_AIM_add_message_handler); /* when people talk */
a26eb4c472d8 [gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 590
diff changeset
87 XS(XS_AIM_add_command_handler); /* when servers talk */
a26eb4c472d8 [gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 590
diff changeset
88 XS(XS_AIM_add_timeout_handler); /* figure it out */
579
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
89
561
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
90 void xs_init()
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 char *file = __FILE__;
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
93 newXS ("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);
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
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
96 static char *escape_quotes(char *buf)
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 static char *tmp_buf = NULL;
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
99 char *i, *j;
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
100
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
101 if (tmp_buf)
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
102 g_free(tmp_buf);
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
103 tmp_buf = g_malloc(strlen(buf) * 2 + 1);
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
104 for (i = buf, j = tmp_buf; *i; i++, j++) {
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
105 if (*i == '\'' || *i == '\\')
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
106 *j++ = '\\';
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
107 *j = *i;
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
108 }
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
109 *j = '\0';
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 return (tmp_buf);
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
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
114 static SV *execute_perl(char *function, char *args)
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
115 {
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
116 static char *perl_cmd = NULL;
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
117
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
118 if (perl_cmd)
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
119 g_free(perl_cmd);
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
120 perl_cmd = g_malloc(strlen(function) + strlen(args) + 2 + 10);
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
121 sprintf(perl_cmd, "&%s('%s')", function, escape_quotes(args));
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
122 #ifndef HAVE_PERL_EVAL_PV
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
123 return (perl_eval_pv(perl_cmd, TRUE));
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
124 #else
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
125 return (Perl_eval_pv(perl_cmd, TRUE));
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
126 #endif
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
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
129 int perl_load_file(char *script_name)
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
130 {
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
131 SV *return_val;
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
132 return_val = execute_perl("load_file", script_name);
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
133 return SvNV (return_val);
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
134 }
560
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
135
581
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
136 void perl_init()
560
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
137 {
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
138 char *perl_args[] = {"", "-e", "0"};
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
139 char load_file[] =
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
140 "sub load_file()\n"
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
141 "{\n"
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
142 " (my $file_name) = @_;\n"
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
143 " open FH, $file_name or return 2;\n"
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
144 " local($/) = undef;\n"
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
145 " $file = <FH>;\n"
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
146 " close FH;\n"
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
147 " eval $file;\n"
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
148 " eval $file if $@;\n"
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
149 " return 1 if $@;\n"
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
150 " return 0;\n"
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
151 "}";
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
152
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
153 my_perl = perl_alloc();
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
154 perl_construct(my_perl);
561
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
155 perl_parse(my_perl, xs_init, 4, perl_args, NULL);
560
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
156 #ifndef HAVE_PERL_EVAL_PV
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
157 perl_eval_pv(load_file, TRUE);
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
158 #else
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
159 Perl_eval_pv(load_file, TRUE);
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
160 #endif
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
161
561
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
162 newXS ("AIM::register", XS_AIM_register, "AIM");
579
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
163 newXS ("AIM::get_info", XS_AIM_get_info, "AIM");
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
164 newXS ("AIM::print", XS_AIM_print, "AIM");
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
165
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
166 newXS ("AIM::buddy_list", XS_AIM_buddy_list, "AIM");
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
167 newXS ("AIM::online_list", XS_AIM_online_list, "AIM");
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
168 newXS ("AIM::deny_list", XS_AIM_deny_list, "AIM");
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
169
561
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
170 newXS ("AIM::command", XS_AIM_command, "AIM");
579
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
171 newXS ("AIM::user_info", XS_AIM_user_info, "AIM");
597
3a24fd19ff5f [gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 592
diff changeset
172 newXS ("AIM::print_to_conv", XS_AIM_print_to_conv, "AIM");
603
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
173 newXS ("AIM::print_to_chat", XS_AIM_print_to_chat, "AIM");
579
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
174
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
175 newXS ("AIM::add_message_handler", XS_AIM_add_message_handler, "AIM");
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
176 newXS ("AIM::add_command_handler", XS_AIM_add_command_handler, "AIM");
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
177 newXS ("AIM::add_timeout_handler", XS_AIM_add_timeout_handler, "AIM");
560
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
178 }
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
179
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
180 void perl_end()
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
181 {
565
7209b474bdc3 [gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 562
diff changeset
182 struct perlscript *scp;
573
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
183 struct _perl_timeout_handlers *thn;
565
7209b474bdc3 [gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 562
diff changeset
184
7209b474bdc3 [gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 562
diff changeset
185 while (perl_list) {
7209b474bdc3 [gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 562
diff changeset
186 scp = perl_list->data;
7209b474bdc3 [gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 562
diff changeset
187 perl_list = g_list_remove(perl_list, scp);
7209b474bdc3 [gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 562
diff changeset
188 if (scp->shutdowncallback[0])
7209b474bdc3 [gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 562
diff changeset
189 execute_perl(scp->shutdowncallback, "");
7209b474bdc3 [gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 562
diff changeset
190 g_free(scp->name);
7209b474bdc3 [gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 562
diff changeset
191 g_free(scp->version);
7209b474bdc3 [gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 562
diff changeset
192 g_free(scp->shutdowncallback);
7209b474bdc3 [gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 562
diff changeset
193 g_free(scp);
7209b474bdc3 [gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 562
diff changeset
194 }
7209b474bdc3 [gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 562
diff changeset
195
573
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
196 while (perl_timeout_handlers) {
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
197 thn = perl_timeout_handlers->data;
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
198 perl_timeout_handlers = g_list_remove(perl_timeout_handlers, thn);
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
199 gtk_timeout_remove(thn->iotag);
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
200 g_free(thn->handler_name);
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
201 g_free(thn);
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
202 }
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
203
560
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
204 if (my_perl != NULL) {
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
205 perl_destruct(my_perl);
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
206 perl_free(my_perl);
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
207 my_perl = NULL;
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
208 }
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
209 }
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
210
561
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
211 XS (XS_AIM_register)
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
212 {
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
213 char *name, *ver, *callback, *unused; /* exactly like X-Chat, eh? :) */
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
214 int junk;
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
215 struct perlscript *scp;
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
216 dXSARGS;
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
217 items = 0;
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 name = SvPV (ST (0), junk);
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
220 ver = SvPV (ST (1), junk);
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
221 callback = SvPV (ST (2), junk);
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
222 unused = SvPV (ST (3), junk);
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
223
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
224 scp = g_new0(struct perlscript, 1);
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
225 scp->name = g_strdup(name);
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
226 scp->version = g_strdup(ver);
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
227 scp->shutdowncallback = g_strdup(callback);
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
228 perl_list = g_list_append(perl_list, scp);
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
229
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
230 XST_mPV (0, VERSION);
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
231 XSRETURN (1);
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
232 }
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
233
579
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
234 XS (XS_AIM_get_info)
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
235 {
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
236 int junk;
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
237 dXSARGS;
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
238 items = 0;
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
239
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
240 switch(atoi(SvPV(ST(0), junk))) {
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
241 case 0:
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
242 XST_mPV(0, VERSION);
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
243 break;
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
244 case 1:
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
245 XST_mPV(0, current_user->username);
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
246 break;
591
a26eb4c472d8 [gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 590
diff changeset
247 case 2:
a26eb4c472d8 [gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 590
diff changeset
248 if (!blist)
a26eb4c472d8 [gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 590
diff changeset
249 XST_mPV(0, "Offline");
a26eb4c472d8 [gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 590
diff changeset
250 else if (!USE_OSCAR)
a26eb4c472d8 [gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 590
diff changeset
251 XST_mPV(0, "TOC");
a26eb4c472d8 [gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 590
diff changeset
252 else
a26eb4c472d8 [gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 590
diff changeset
253 XST_mPV(0, "Oscar");
a26eb4c472d8 [gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 590
diff changeset
254 break;
579
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
255 default:
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
256 XST_mPV(0, "Error2");
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
257 }
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
258
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
259 XSRETURN(1);
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
260 }
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
261
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
262 XS (XS_AIM_print)
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
263 {
592
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 591
diff changeset
264 char *title;
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 591
diff changeset
265 char *message;
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 591
diff changeset
266 int junk;
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 591
diff changeset
267 dXSARGS;
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 591
diff changeset
268 items = 0;
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 591
diff changeset
269
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 591
diff changeset
270 title = SvPV(ST(0), junk);
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 591
diff changeset
271 message = SvPV(ST(1), junk);
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 591
diff changeset
272 do_error_dialog(message, title);
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 591
diff changeset
273 XSRETURN(0);
579
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
274 }
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
275
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
276 XS (XS_AIM_buddy_list)
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
277 {
581
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
278 struct buddy *buddy;
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
279 struct group *g;
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
280 GList *list = groups;
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
281 GList *mem;
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
282 int i = 0;
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
283 dXSARGS;
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
284 items = 0;
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
285
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
286 while (list) {
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
287 g = (struct group *)list->data;
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
288 mem = g->members;
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
289 while (mem) {
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
290 buddy = (struct buddy *)mem->data;
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
291 XST_mPV(i++, buddy->name);
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
292 mem = mem->next;
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
293 }
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
294 list = list->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 XSRETURN(i);
579
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
297 }
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
298
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
299 XS (XS_AIM_online_list)
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
300 {
581
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
301 struct buddy *b;
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
302 struct group *g;
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
303 GList *list = groups;
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
304 GList *mem;
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
305 int i = 0;
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
306 dXSARGS;
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
307 items = 0;
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
308
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
309 while (list) {
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
310 g = (struct group *)list->data;
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
311 mem = g->members;
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
312 while (mem) {
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
313 b = (struct buddy *)mem->data;
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
314 if (b->present) XST_mPV(i++, b->name);
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
315 mem = mem->next;
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
316 }
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
317 list = list->next;
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
318 }
c72e5ee07d0a [gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 580
diff changeset
319 XSRETURN(i);
579
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
320 }
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
321
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
322 XS (XS_AIM_deny_list)
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
323 {
590
91f877d86ca6 [gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 581
diff changeset
324 char *name;
91f877d86ca6 [gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 581
diff changeset
325 GList *list = deny;
91f877d86ca6 [gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 581
diff changeset
326 int i = 0;
91f877d86ca6 [gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 581
diff changeset
327 dXSARGS;
91f877d86ca6 [gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 581
diff changeset
328 items = 0;
91f877d86ca6 [gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 581
diff changeset
329
91f877d86ca6 [gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 581
diff changeset
330 while (list) {
91f877d86ca6 [gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 581
diff changeset
331 name = (char *)list->data;
91f877d86ca6 [gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 581
diff changeset
332 XST_mPV(i++, name);
91f877d86ca6 [gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 581
diff changeset
333 list = list->next;
91f877d86ca6 [gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 581
diff changeset
334 }
91f877d86ca6 [gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 581
diff changeset
335 XSRETURN(i);
579
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
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
338 XS (XS_AIM_command)
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
339 {
603
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
340 int junk;
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
341 char *command = NULL;
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
342 dXSARGS;
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
343 items = 0;
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
344
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
345 command = SvPV(ST(0), junk);
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
346 if (!command) XSRETURN(0);
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
347 if (!strncasecmp(command, "signon", 6)) {
628
a46a68d46d2b [gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 603
diff changeset
348 if (!blist) {
a46a68d46d2b [gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 603
diff changeset
349 show_login();
a46a68d46d2b [gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 603
diff changeset
350 dologin(0, 0);
a46a68d46d2b [gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 603
diff changeset
351 }
603
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
352 } else if (!strncasecmp(command, "signoff", 7)) {
628
a46a68d46d2b [gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 603
diff changeset
353 signoff();
603
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
354 } else if (!strncasecmp(command, "away", 4)) {
630
3d2f14064083 [gaim-migrate @ 640]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 628
diff changeset
355 char *message = SvPV(ST(1), junk);
3d2f14064083 [gaim-migrate @ 640]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 628
diff changeset
356 struct away_message a;
3d2f14064083 [gaim-migrate @ 640]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 628
diff changeset
357 g_snprintf(a.message, sizeof(a.message), "%s", message);
3d2f14064083 [gaim-migrate @ 640]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 628
diff changeset
358 do_away_message(NULL, &a);
603
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
359 } else if (!strncasecmp(command, "back", 4)) {
628
a46a68d46d2b [gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 603
diff changeset
360 do_im_back();
603
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
361 } else if (!strncasecmp(command, "idle", 4)) {
630
3d2f14064083 [gaim-migrate @ 640]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 628
diff changeset
362 serv_set_idle(atoi(SvPV(ST(1), junk)));
603
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
363 } else if (!strncasecmp(command, "warn", 4)) {
628
a46a68d46d2b [gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 603
diff changeset
364 /* FIXME */
603
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
365 }
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
366
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
367 XSRETURN(0);
579
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
368 }
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
369
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
370 XS (XS_AIM_user_info)
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
371 {
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
372 int junk;
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
373 struct buddy *buddy;
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
374 char *nick;
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
375 dXSARGS;
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
376 items = 0;
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
377
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
378 nick = SvPV(ST(0), junk);
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
379 if (!nick[0])
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
380 XSRETURN(0);
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
381 buddy = find_buddy(nick);
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
382 if (!buddy)
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
383 XSRETURN(0);
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
384 XST_mPV(0, buddy->name);
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
385 XST_mPV(1, buddy->present ? "Online" : "Offline");
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
386 XST_mIV(2, buddy->evil);
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
387 XST_mIV(3, buddy->signon);
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
388 XST_mIV(4, buddy->idle);
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
389 XST_mIV(5, buddy->uc);
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
390 XST_mIV(6, buddy->caps);
597
3a24fd19ff5f [gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 592
diff changeset
391 XSRETURN(7);
3a24fd19ff5f [gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 592
diff changeset
392 }
3a24fd19ff5f [gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 592
diff changeset
393
3a24fd19ff5f [gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 592
diff changeset
394 XS (XS_AIM_print_to_conv)
3a24fd19ff5f [gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 592
diff changeset
395 {
3a24fd19ff5f [gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 592
diff changeset
396 char *nick, *what;
3a24fd19ff5f [gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 592
diff changeset
397 struct conversation *c;
3a24fd19ff5f [gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 592
diff changeset
398 int junk;
3a24fd19ff5f [gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 592
diff changeset
399 dXSARGS;
3a24fd19ff5f [gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 592
diff changeset
400 items = 0;
3a24fd19ff5f [gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 592
diff changeset
401
3a24fd19ff5f [gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 592
diff changeset
402 nick = SvPV(ST(0), junk);
3a24fd19ff5f [gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 592
diff changeset
403 what = SvPV(ST(1), junk);
3a24fd19ff5f [gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 592
diff changeset
404 c = find_conversation(nick);
3a24fd19ff5f [gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 592
diff changeset
405 if (!c)
3a24fd19ff5f [gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 592
diff changeset
406 c = new_conversation(nick);
3a24fd19ff5f [gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 592
diff changeset
407 write_to_conv(c, what, WFLAG_SEND, NULL);
3a24fd19ff5f [gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 592
diff changeset
408 serv_send_im(nick, what, 0);
579
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
409 }
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
410
603
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
411 XS (XS_AIM_print_to_chat)
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
412 {
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
413 char *nick, *what;
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
414 struct conversation *c = NULL;
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
415 GList *bcs = buddy_chats;
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
416 int junk;
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
417 dXSARGS;
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
418 items = 0;
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
419
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
420 nick = SvPV(ST(0), junk);
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
421 what = SvPV(ST(1), junk);
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
422 while (bcs) {
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
423 c = (struct conversation *)bcs->data;
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
424 if (!strcmp(c->name, nick))
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
425 break;
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
426 bcs = bcs->next;
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
427 c = NULL;
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
428 }
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
429 if (!c)
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
430 XSRETURN(0);
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
431 serv_chat_send(c->id, what);
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
432 }
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 597
diff changeset
433
579
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
434 XS (XS_AIM_add_message_handler)
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
435 {
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
436 /* FIXME */
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
437 }
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
438
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
439 XS (XS_AIM_add_command_handler)
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
440 {
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
441 /* FIXME */
7b501c39a6ee [gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 577
diff changeset
442 }
561
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
443
573
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
444 static int perl_timeout(struct _perl_timeout_handlers *handler)
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
445 {
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
446 execute_perl(handler->handler_name, "");
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
447 perl_timeout_handlers = g_list_remove(perl_timeout_handlers, handler);
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
448 g_free(handler->handler_name);
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
449 g_free(handler);
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
450
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
451 return 0; /* returning zero removes the timeout handler */
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
452 }
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
453
561
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
454 XS (XS_AIM_add_timeout_handler)
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
455 {
573
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
456 int junk;
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
457 long timeout;
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
458 struct _perl_timeout_handlers *handler;
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
459 dXSARGS;
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
460 items = 0;
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
461
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
462 handler = g_new0(struct _perl_timeout_handlers, 1);
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
463 timeout = atol(SvPV(ST(0), junk));
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
464 handler->handler_name = g_strdup(SvPV(ST(1), junk));
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
465 perl_timeout_handlers = g_list_append(perl_timeout_handlers, handler);
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
466 handler->iotag = gtk_timeout_add(timeout, (GtkFunction)perl_timeout, handler);
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 565
diff changeset
467 XSRETURN_EMPTY;
561
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
468 }
9b36c91cce26 [gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 560
diff changeset
469
560
cf3da01f451c [gaim-migrate @ 570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
470 #endif /* USE_PERL */