Mercurial > pidgin
annotate src/perl.c @ 964:2cd7b73e2c9a
[gaim-migrate @ 974]
damn i'm smooth. chat is working now. :)
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Tue, 10 Oct 2000 10:04:59 +0000 |
parents | fa681641643d |
children | 2586b2a3725e |
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>. | |
597
3a24fd19ff5f
[gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
592
diff
changeset
|
23 * X-Chat Copyright (C) 1998 Peter Zelezny. |
560 | 24 * |
25 */ | |
26 | |
27 #ifdef HAVE_CONFIG_H | |
28 #include "../config.h" | |
29 #endif | |
561
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
30 #undef PACKAGE |
560 | 31 |
580
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> | |
800
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
46 #include <dirent.h> |
798
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
47 #include <gtk/gtk.h> |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
48 #include "pixmaps/add.xpm" |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
49 #include "pixmaps/cancel.xpm" |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
50 |
590
91f877d86ca6
[gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
581
diff
changeset
|
51 |
91f877d86ca6
[gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
581
diff
changeset
|
52 /* perl module support */ |
91f877d86ca6
[gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
581
diff
changeset
|
53 extern void xs_init _((void)); |
91f877d86ca6
[gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
581
diff
changeset
|
54 extern void boot_DynaLoader _((CV * cv)); /* perl is so wacky */ |
91f877d86ca6
[gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
581
diff
changeset
|
55 |
91f877d86ca6
[gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
581
diff
changeset
|
56 #undef _ |
560 | 57 #include "gaim.h" |
58 | |
561
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
59 struct perlscript { |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
60 char *name; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
61 char *version; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
62 char *shutdowncallback; /* bleh */ |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
63 }; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
64 |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
65 struct _perl_event_handlers { |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
66 char *event_type; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
67 char *handler_name; |
781
95ebfdb31a9b
[gaim-migrate @ 791]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
68 }; |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
69 |
573
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
70 struct _perl_timeout_handlers { |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
71 char *handler_name; |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
72 gint iotag; |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
73 }; |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
74 |
597
3a24fd19ff5f
[gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
592
diff
changeset
|
75 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
|
76 static GList *perl_timeout_handlers = NULL; |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
77 static GList *perl_event_handlers = NULL; |
560 | 78 static PerlInterpreter *my_perl = NULL; |
79 | |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
80 /* dealing with gaim */ |
591
a26eb4c472d8
[gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
590
diff
changeset
|
81 XS(XS_AIM_register); /* set up hooks for script */ |
a26eb4c472d8
[gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
590
diff
changeset
|
82 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
|
83 XS(XS_AIM_print); /* lemme figure this one out... */ |
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 /* list stuff */ |
591
a26eb4c472d8
[gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
590
diff
changeset
|
86 XS(XS_AIM_buddy_list); /* all buddies */ |
a26eb4c472d8
[gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
590
diff
changeset
|
87 XS(XS_AIM_online_list); /* online buddies */ |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
88 XS(XS_AIM_deny_list); /* also returns permit list */ |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
89 |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
90 /* server stuff */ |
591
a26eb4c472d8
[gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
590
diff
changeset
|
91 XS(XS_AIM_command); /* send command to server */ |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
92 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
|
93 XS(XS_AIM_print_to_conv); /* send message to someone */ |
603
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
94 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
|
95 |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
96 /* handler commands */ |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
97 XS(XS_AIM_add_event_handler); /* when servers talk */ |
591
a26eb4c472d8
[gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
590
diff
changeset
|
98 XS(XS_AIM_add_timeout_handler); /* figure it out */ |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
99 |
561
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
100 void xs_init() |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
101 { |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
102 char *file = __FILE__; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
103 newXS ("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
104 } |
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 static char *escape_quotes(char *buf) |
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 static char *tmp_buf = NULL; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
109 char *i, *j; |
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 if (tmp_buf) |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
112 g_free(tmp_buf); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
113 tmp_buf = g_malloc(strlen(buf) * 2 + 1); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
114 for (i = buf, j = tmp_buf; *i; i++, j++) { |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
115 if (*i == '\'' || *i == '\\') |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
116 *j++ = '\\'; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
117 *j = *i; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
118 } |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
119 *j = '\0'; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
120 |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
121 return (tmp_buf); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
122 } |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
123 |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
124 static SV *execute_perl(char *function, char *args) |
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 static char *perl_cmd = NULL; |
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 if (perl_cmd) |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
129 g_free(perl_cmd); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
130 perl_cmd = g_malloc(strlen(function) + strlen(args) + 2 + 10); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
131 sprintf(perl_cmd, "&%s('%s')", function, escape_quotes(args)); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
132 #ifndef HAVE_PERL_EVAL_PV |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
133 return (perl_eval_pv(perl_cmd, TRUE)); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
134 #else |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
135 return (Perl_eval_pv(perl_cmd, TRUE)); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
136 #endif |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
137 } |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
138 |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
139 int perl_load_file(char *script_name) |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
140 { |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
141 SV *return_val; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
142 return_val = execute_perl("load_file", script_name); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
143 return SvNV (return_val); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
144 } |
560 | 145 |
800
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
146 static int is_pl_file(char *filename) |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
147 { |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
148 int len; |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
149 if (!filename) return 0; |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
150 if (!filename[0]) return 0; |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
151 len = strlen(filename); |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
152 len -= 3; |
805
2f0655e185b8
[gaim-migrate @ 815]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
800
diff
changeset
|
153 if (len < 0) return 0; |
800
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
154 return (!strncmp(filename + len, ".pl", 3)); |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
155 } |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
156 |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
157 void perl_autoload() |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
158 { |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
159 DIR *dir; |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
160 struct dirent *ent; |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
161 char *buf; |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
162 char path[BUF_LONG]; |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
163 |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
164 g_snprintf(path, sizeof(path), "%s/.gaim", getenv("HOME")); |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
165 dir = opendir(path); |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
166 if (dir) { |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
167 while ((ent = readdir(dir))) { |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
168 if (strcmp(ent->d_name, ".") && strcmp(ent->d_name, "..")) { |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
169 if (is_pl_file(ent->d_name)) { |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
170 buf = g_malloc(strlen(path) + strlen(ent->d_name) + 2); |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
171 sprintf(buf, "%s/%s", path, ent->d_name); |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
172 perl_load_file(buf); |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
173 g_free(buf); |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
174 } |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
175 } |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
176 } |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
177 closedir(dir); |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
178 } |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
179 } |
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
799
diff
changeset
|
180 |
581
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
181 void perl_init() |
560 | 182 { |
947
1d021b2eb65d
[gaim-migrate @ 957]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
183 char *perl_args[] = {"", "-e", "0", "-w"}; |
560 | 184 char load_file[] = |
185 "sub load_file()\n" | |
186 "{\n" | |
187 " (my $file_name) = @_;\n" | |
188 " open FH, $file_name or return 2;\n" | |
947
1d021b2eb65d
[gaim-migrate @ 957]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
189 " my $is = $/;\n" |
560 | 190 " local($/) = undef;\n" |
191 " $file = <FH>;\n" | |
192 " close FH;\n" | |
947
1d021b2eb65d
[gaim-migrate @ 957]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
193 " $/ = $is;\n" |
1d021b2eb65d
[gaim-migrate @ 957]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
194 " $file = \"\\@ISA = qw(Exporter DynaLoader);\\n\" . $file;\n" |
560 | 195 " eval $file;\n" |
196 " eval $file if $@;\n" | |
197 " return 1 if $@;\n" | |
198 " return 0;\n" | |
199 "}"; | |
200 | |
201 my_perl = perl_alloc(); | |
202 perl_construct(my_perl); | |
561
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
203 perl_parse(my_perl, xs_init, 4, perl_args, NULL); |
560 | 204 #ifndef HAVE_PERL_EVAL_PV |
205 perl_eval_pv(load_file, TRUE); | |
206 #else | |
207 Perl_eval_pv(load_file, TRUE); | |
208 #endif | |
209 | |
561
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
210 newXS ("AIM::register", XS_AIM_register, "AIM"); |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
211 newXS ("AIM::get_info", XS_AIM_get_info, "AIM"); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
212 newXS ("AIM::print", XS_AIM_print, "AIM"); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
213 |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
214 newXS ("AIM::buddy_list", XS_AIM_buddy_list, "AIM"); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
215 newXS ("AIM::online_list", XS_AIM_online_list, "AIM"); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
216 newXS ("AIM::deny_list", XS_AIM_deny_list, "AIM"); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
217 |
561
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
218 newXS ("AIM::command", XS_AIM_command, "AIM"); |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
219 newXS ("AIM::user_info", XS_AIM_user_info, "AIM"); |
597
3a24fd19ff5f
[gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
592
diff
changeset
|
220 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
|
221 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
|
222 |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
223 newXS ("AIM::add_event_handler", XS_AIM_add_event_handler, "AIM"); |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
224 newXS ("AIM::add_timeout_handler", XS_AIM_add_timeout_handler, "AIM"); |
560 | 225 } |
226 | |
227 void perl_end() | |
228 { | |
565
7209b474bdc3
[gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
562
diff
changeset
|
229 struct perlscript *scp; |
573
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
230 struct _perl_timeout_handlers *thn; |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
231 struct _perl_event_handlers *ehn; |
565
7209b474bdc3
[gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
562
diff
changeset
|
232 |
7209b474bdc3
[gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
562
diff
changeset
|
233 while (perl_list) { |
7209b474bdc3
[gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
562
diff
changeset
|
234 scp = perl_list->data; |
7209b474bdc3
[gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
562
diff
changeset
|
235 perl_list = g_list_remove(perl_list, scp); |
7209b474bdc3
[gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
562
diff
changeset
|
236 if (scp->shutdowncallback[0]) |
7209b474bdc3
[gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
562
diff
changeset
|
237 execute_perl(scp->shutdowncallback, ""); |
7209b474bdc3
[gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
562
diff
changeset
|
238 g_free(scp->name); |
7209b474bdc3
[gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
562
diff
changeset
|
239 g_free(scp->version); |
7209b474bdc3
[gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
562
diff
changeset
|
240 g_free(scp->shutdowncallback); |
7209b474bdc3
[gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
562
diff
changeset
|
241 g_free(scp); |
7209b474bdc3
[gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
562
diff
changeset
|
242 } |
7209b474bdc3
[gaim-migrate @ 575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
562
diff
changeset
|
243 |
573
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
244 while (perl_timeout_handlers) { |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
245 thn = perl_timeout_handlers->data; |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
246 perl_timeout_handlers = g_list_remove(perl_timeout_handlers, thn); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
247 gtk_timeout_remove(thn->iotag); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
248 g_free(thn->handler_name); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
249 g_free(thn); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
250 } |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
251 |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
252 while (perl_event_handlers) { |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
253 ehn = perl_event_handlers->data; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
254 perl_event_handlers = g_list_remove(perl_event_handlers, ehn); |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
255 g_free(ehn->event_type); |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
256 g_free(ehn->handler_name); |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
257 g_free(ehn); |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
258 } |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
259 |
560 | 260 if (my_perl != NULL) { |
261 perl_destruct(my_perl); | |
262 perl_free(my_perl); | |
263 my_perl = NULL; | |
264 } | |
265 } | |
266 | |
561
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
267 XS (XS_AIM_register) |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
268 { |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
269 char *name, *ver, *callback, *unused; /* exactly like X-Chat, eh? :) */ |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
270 int junk; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
271 struct perlscript *scp; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
272 dXSARGS; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
273 items = 0; |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
274 |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
275 name = SvPV (ST (0), junk); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
276 ver = SvPV (ST (1), junk); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
277 callback = SvPV (ST (2), junk); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
278 unused = SvPV (ST (3), junk); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
279 |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
280 scp = g_new0(struct perlscript, 1); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
281 scp->name = g_strdup(name); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
282 scp->version = g_strdup(ver); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
283 scp->shutdowncallback = g_strdup(callback); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
284 perl_list = g_list_append(perl_list, scp); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
285 |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
286 XST_mPV (0, VERSION); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
287 XSRETURN (1); |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
288 } |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
289 |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
290 XS (XS_AIM_get_info) |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
291 { |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
292 int junk; |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
293 dXSARGS; |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
294 items = 0; |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
295 |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
296 switch(atoi(SvPV(ST(0), junk))) { |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
297 case 0: |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
298 XST_mPV(0, VERSION); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
299 break; |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
300 case 1: |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
947
diff
changeset
|
301 /* FIXME: no more current_user |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
302 XST_mPV(0, current_user->username); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
947
diff
changeset
|
303 */ |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
304 break; |
591
a26eb4c472d8
[gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
590
diff
changeset
|
305 case 2: |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
947
diff
changeset
|
306 /* FIXME: more per-connection issues |
591
a26eb4c472d8
[gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
590
diff
changeset
|
307 if (!blist) |
a26eb4c472d8
[gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
590
diff
changeset
|
308 XST_mPV(0, "Offline"); |
a26eb4c472d8
[gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
590
diff
changeset
|
309 else if (!USE_OSCAR) |
a26eb4c472d8
[gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
590
diff
changeset
|
310 XST_mPV(0, "TOC"); |
a26eb4c472d8
[gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
590
diff
changeset
|
311 else |
a26eb4c472d8
[gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
590
diff
changeset
|
312 XST_mPV(0, "Oscar"); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
947
diff
changeset
|
313 */ |
591
a26eb4c472d8
[gaim-migrate @ 601]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
590
diff
changeset
|
314 break; |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
315 default: |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
316 XST_mPV(0, "Error2"); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
317 } |
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 XSRETURN(1); |
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_print) |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
323 { |
592
7c75d69a1129
[gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
591
diff
changeset
|
324 char *title; |
7c75d69a1129
[gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
591
diff
changeset
|
325 char *message; |
7c75d69a1129
[gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
591
diff
changeset
|
326 int junk; |
7c75d69a1129
[gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
591
diff
changeset
|
327 dXSARGS; |
7c75d69a1129
[gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
591
diff
changeset
|
328 items = 0; |
7c75d69a1129
[gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
591
diff
changeset
|
329 |
7c75d69a1129
[gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
591
diff
changeset
|
330 title = SvPV(ST(0), junk); |
7c75d69a1129
[gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
591
diff
changeset
|
331 message = SvPV(ST(1), junk); |
7c75d69a1129
[gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
591
diff
changeset
|
332 do_error_dialog(message, title); |
7c75d69a1129
[gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
591
diff
changeset
|
333 XSRETURN(0); |
579
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 |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
336 XS (XS_AIM_buddy_list) |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
337 { |
581
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
338 struct buddy *buddy; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
339 struct group *g; |
940 | 340 GSList *list = groups; |
581
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
341 GList *mem; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
342 int i = 0; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
343 dXSARGS; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
344 items = 0; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
345 |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
346 while (list) { |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
347 g = (struct group *)list->data; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
348 mem = g->members; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
349 while (mem) { |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
350 buddy = (struct buddy *)mem->data; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
351 XST_mPV(i++, buddy->name); |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
352 mem = mem->next; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
353 } |
940 | 354 list = g_slist_next(list); |
581
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
355 } |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
356 XSRETURN(i); |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
357 } |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
358 |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
359 XS (XS_AIM_online_list) |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
360 { |
581
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
361 struct buddy *b; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
362 struct group *g; |
940 | 363 GSList *list = groups; |
581
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
364 GList *mem; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
365 int i = 0; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
366 dXSARGS; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
367 items = 0; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
368 |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
369 while (list) { |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
370 g = (struct group *)list->data; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
371 mem = g->members; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
372 while (mem) { |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
373 b = (struct buddy *)mem->data; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
374 if (b->present) XST_mPV(i++, b->name); |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
375 mem = mem->next; |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
376 } |
940 | 377 list = g_slist_next(list); |
581
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
378 } |
c72e5ee07d0a
[gaim-migrate @ 591]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
580
diff
changeset
|
379 XSRETURN(i); |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
380 } |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
381 |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
382 XS (XS_AIM_deny_list) |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
383 { |
590
91f877d86ca6
[gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
581
diff
changeset
|
384 char *name; |
91f877d86ca6
[gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
581
diff
changeset
|
385 GList *list = deny; |
91f877d86ca6
[gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
581
diff
changeset
|
386 int i = 0; |
91f877d86ca6
[gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
581
diff
changeset
|
387 dXSARGS; |
91f877d86ca6
[gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
581
diff
changeset
|
388 items = 0; |
91f877d86ca6
[gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
581
diff
changeset
|
389 |
91f877d86ca6
[gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
581
diff
changeset
|
390 while (list) { |
91f877d86ca6
[gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
581
diff
changeset
|
391 name = (char *)list->data; |
91f877d86ca6
[gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
581
diff
changeset
|
392 XST_mPV(i++, name); |
91f877d86ca6
[gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
581
diff
changeset
|
393 list = list->next; |
91f877d86ca6
[gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
581
diff
changeset
|
394 } |
91f877d86ca6
[gaim-migrate @ 600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
581
diff
changeset
|
395 XSRETURN(i); |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
396 } |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
397 |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
398 XS (XS_AIM_command) |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
399 { |
603
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
400 int junk; |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
401 char *command = NULL; |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
402 dXSARGS; |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
403 items = 0; |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
404 |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
405 command = SvPV(ST(0), junk); |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
406 if (!command) XSRETURN(0); |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
407 if (!strncasecmp(command, "signon", 6)) { |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
947
diff
changeset
|
408 /* FIXME |
628
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
603
diff
changeset
|
409 if (!blist) { |
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
603
diff
changeset
|
410 show_login(); |
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
603
diff
changeset
|
411 dologin(0, 0); |
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
603
diff
changeset
|
412 } |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
947
diff
changeset
|
413 */ |
603
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
414 } else if (!strncasecmp(command, "signoff", 7)) { |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
947
diff
changeset
|
415 /* FIXME: we need to figure out how this works for multiple connections |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
947
diff
changeset
|
416 * signoff(); */ |
603
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
417 } else if (!strncasecmp(command, "away", 4)) { |
630
3d2f14064083
[gaim-migrate @ 640]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
628
diff
changeset
|
418 char *message = SvPV(ST(1), junk); |
3d2f14064083
[gaim-migrate @ 640]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
628
diff
changeset
|
419 struct away_message a; |
3d2f14064083
[gaim-migrate @ 640]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
628
diff
changeset
|
420 g_snprintf(a.message, sizeof(a.message), "%s", message); |
3d2f14064083
[gaim-migrate @ 640]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
628
diff
changeset
|
421 do_away_message(NULL, &a); |
603
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
422 } else if (!strncasecmp(command, "back", 4)) { |
628
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
603
diff
changeset
|
423 do_im_back(); |
603
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
424 } else if (!strncasecmp(command, "idle", 4)) { |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
947
diff
changeset
|
425 /* FIXME |
630
3d2f14064083
[gaim-migrate @ 640]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
628
diff
changeset
|
426 serv_set_idle(atoi(SvPV(ST(1), junk))); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
947
diff
changeset
|
427 */ |
603
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
428 } else if (!strncasecmp(command, "warn", 4)) { |
749
94edd99b7302
[gaim-migrate @ 759]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
630
diff
changeset
|
429 char *name = SvPV(ST(1), junk); |
94edd99b7302
[gaim-migrate @ 759]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
630
diff
changeset
|
430 serv_warn(name, 0); |
603
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
431 } |
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 XSRETURN(0); |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
434 } |
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 XS (XS_AIM_user_info) |
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 int junk; |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
439 struct buddy *buddy; |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
440 char *nick; |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
441 dXSARGS; |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
442 items = 0; |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
443 |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
444 nick = SvPV(ST(0), junk); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
445 if (!nick[0]) |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
446 XSRETURN(0); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
447 buddy = find_buddy(nick); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
448 if (!buddy) |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
449 XSRETURN(0); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
450 XST_mPV(0, buddy->name); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
451 XST_mPV(1, buddy->present ? "Online" : "Offline"); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
452 XST_mIV(2, buddy->evil); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
453 XST_mIV(3, buddy->signon); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
454 XST_mIV(4, buddy->idle); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
455 XST_mIV(5, buddy->uc); |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
456 XST_mIV(6, buddy->caps); |
597
3a24fd19ff5f
[gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
592
diff
changeset
|
457 XSRETURN(7); |
3a24fd19ff5f
[gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
592
diff
changeset
|
458 } |
3a24fd19ff5f
[gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
592
diff
changeset
|
459 |
3a24fd19ff5f
[gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
592
diff
changeset
|
460 XS (XS_AIM_print_to_conv) |
3a24fd19ff5f
[gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
592
diff
changeset
|
461 { |
3a24fd19ff5f
[gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
592
diff
changeset
|
462 char *nick, *what; |
3a24fd19ff5f
[gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
592
diff
changeset
|
463 struct conversation *c; |
3a24fd19ff5f
[gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
592
diff
changeset
|
464 int junk; |
3a24fd19ff5f
[gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
592
diff
changeset
|
465 dXSARGS; |
3a24fd19ff5f
[gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
592
diff
changeset
|
466 items = 0; |
3a24fd19ff5f
[gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
592
diff
changeset
|
467 |
3a24fd19ff5f
[gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
592
diff
changeset
|
468 nick = SvPV(ST(0), junk); |
3a24fd19ff5f
[gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
592
diff
changeset
|
469 what = SvPV(ST(1), junk); |
3a24fd19ff5f
[gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
592
diff
changeset
|
470 c = find_conversation(nick); |
3a24fd19ff5f
[gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
592
diff
changeset
|
471 if (!c) |
3a24fd19ff5f
[gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
592
diff
changeset
|
472 c = new_conversation(nick); |
3a24fd19ff5f
[gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
592
diff
changeset
|
473 write_to_conv(c, what, WFLAG_SEND, NULL); |
3a24fd19ff5f
[gaim-migrate @ 607]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
592
diff
changeset
|
474 serv_send_im(nick, what, 0); |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
475 } |
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
476 |
603
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
477 XS (XS_AIM_print_to_chat) |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
478 { |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
479 /* FIXME: need to make this multi-connection based |
603
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
480 char *nick, *what; |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
481 struct conversation *c = NULL; |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
482 GList *bcs = buddy_chats; |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
483 int junk; |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
484 dXSARGS; |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
485 items = 0; |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
486 |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
487 nick = SvPV(ST(0), junk); |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
488 what = SvPV(ST(1), junk); |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
489 while (bcs) { |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
490 c = (struct conversation *)bcs->data; |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
491 if (!strcmp(c->name, nick)) |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
492 break; |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
493 bcs = bcs->next; |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
494 c = NULL; |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
495 } |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
496 if (!c) |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
497 XSRETURN(0); |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
498 serv_chat_send(c->id, what); |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
499 */ |
603
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
500 } |
9b0717b4a490
[gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
597
diff
changeset
|
501 |
806
67bdecdecbb7
[gaim-migrate @ 816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
805
diff
changeset
|
502 int perl_event(char *event, char *args) |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
503 { |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
504 GList *handler; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
505 struct _perl_event_handlers *data; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
506 |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
507 for (handler = perl_event_handlers; handler != NULL; handler = handler->next) { |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
508 data = handler->data; |
806
67bdecdecbb7
[gaim-migrate @ 816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
805
diff
changeset
|
509 if (!strcmp(event, data->event_type)) |
781
95ebfdb31a9b
[gaim-migrate @ 791]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
510 execute_perl(data->handler_name, args); |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
511 } |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
512 |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
513 return 0; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
514 } |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
515 |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
516 XS (XS_AIM_add_event_handler) |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
517 { |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
518 int junk; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
519 struct _perl_event_handlers *handler; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
520 dXSARGS; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
521 items = 0; |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
522 |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
523 handler = g_new0(struct _perl_event_handlers, 1); |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
524 handler->event_type = g_strdup(SvPV(ST(0), junk)); |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
525 handler->handler_name = g_strdup(SvPV(ST(1), junk)); |
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
526 perl_event_handlers = g_list_append(perl_event_handlers, handler); |
806
67bdecdecbb7
[gaim-migrate @ 816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
805
diff
changeset
|
527 sprintf(debug_buff, "registered perl event handler for %s\n", handler->event_type); |
67bdecdecbb7
[gaim-migrate @ 816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
805
diff
changeset
|
528 debug_print(debug_buff); |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
529 XSRETURN_EMPTY; |
579
7b501c39a6ee
[gaim-migrate @ 589]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
577
diff
changeset
|
530 } |
561
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
531 |
573
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
532 static int perl_timeout(struct _perl_timeout_handlers *handler) |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
533 { |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
534 execute_perl(handler->handler_name, ""); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
535 perl_timeout_handlers = g_list_remove(perl_timeout_handlers, handler); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
536 g_free(handler->handler_name); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
537 g_free(handler); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
538 |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
539 return 0; /* returning zero removes the timeout handler */ |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
540 } |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
541 |
561
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
542 XS (XS_AIM_add_timeout_handler) |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
543 { |
573
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
544 int junk; |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
545 long timeout; |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
546 struct _perl_timeout_handlers *handler; |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
547 dXSARGS; |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
548 items = 0; |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
549 |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
550 handler = g_new0(struct _perl_timeout_handlers, 1); |
806
67bdecdecbb7
[gaim-migrate @ 816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
805
diff
changeset
|
551 timeout = 1000 * atol(SvPV(ST(0), junk)); |
573
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
552 handler->handler_name = g_strdup(SvPV(ST(1), junk)); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
553 perl_timeout_handlers = g_list_append(perl_timeout_handlers, handler); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
554 handler->iotag = gtk_timeout_add(timeout, (GtkFunction)perl_timeout, handler); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
565
diff
changeset
|
555 XSRETURN_EMPTY; |
561
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
556 } |
9b36c91cce26
[gaim-migrate @ 571]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
560
diff
changeset
|
557 |
798
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
558 static GtkWidget *config = NULL; |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
559 static GtkWidget *entry = NULL; |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
560 |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
561 static void cfdes(GtkWidget *m, gpointer n) { |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
562 if (config) gtk_widget_destroy(config); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
563 config = NULL; |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
564 } |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
565 |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
566 static void do_load(GtkWidget *m, gpointer n) { |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
567 char *file = gtk_entry_get_text(GTK_ENTRY(entry)); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
568 if (!file || !strlen(file)) { |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
569 perl_end(); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
570 perl_init(); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
571 return; |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
572 } |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
573 perl_load_file(file); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
574 gtk_widget_destroy(config); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
575 } |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
576 |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
577 void load_perl_script(GtkWidget *w, gpointer d) |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
578 { |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
579 GtkWidget *frame; |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
580 GtkWidget *vbox; |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
581 GtkWidget *hbox; |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
582 GtkWidget *label; |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
583 GtkWidget *ok; |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
584 GtkWidget *cancel; |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
585 |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
586 if (config) { |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
587 gtk_widget_show(config); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
588 return; |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
589 } |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
590 |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
591 config = gtk_window_new(GTK_WINDOW_DIALOG); |
905 | 592 gtk_window_set_policy(GTK_WINDOW(config), TRUE, TRUE, FALSE); |
593 gtk_window_set_wmclass(GTK_WINDOW(config), "perl_script", "Gaim"); | |
798
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
594 gtk_window_set_title(GTK_WINDOW(config), "Gaim - Add Perl Script"); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
595 gtk_container_set_border_width(GTK_CONTAINER(config), 5); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
596 gtk_signal_connect(GTK_OBJECT(config), "destroy", GTK_SIGNAL_FUNC(cfdes), 0); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
597 gtk_widget_realize(config); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
598 aol_icon(config->window); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
599 |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
600 frame = gtk_frame_new("Load Script"); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
601 gtk_container_add(GTK_CONTAINER(config), frame); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
602 gtk_widget_show(frame); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
603 |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
604 vbox = gtk_vbox_new(FALSE, 5); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
605 gtk_container_add(GTK_CONTAINER(frame), vbox); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
606 gtk_widget_show(vbox); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
607 |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
608 hbox = gtk_hbox_new(FALSE, 5); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
609 gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 5); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
610 gtk_widget_show(hbox); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
611 |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
612 label = gtk_label_new("File Name:"); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
613 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
614 gtk_widget_show(label); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
615 |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
616 entry = gtk_entry_new(); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
617 gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 5); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
618 gtk_signal_connect(GTK_OBJECT(entry), "activate", GTK_SIGNAL_FUNC(do_load), 0); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
619 gtk_widget_show(entry); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
620 |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
621 hbox = gtk_hbox_new(TRUE, 10); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
622 gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 5); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
623 gtk_widget_show(hbox); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
624 |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
625 ok = picture_button(config, "Load", add_xpm); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
626 gtk_box_pack_start(GTK_BOX(hbox), ok, FALSE, FALSE, 5); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
627 gtk_signal_connect(GTK_OBJECT(ok), "clicked", GTK_SIGNAL_FUNC(do_load), 0); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
628 |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
629 cancel = picture_button(config, "Cancel", cancel_xpm); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
630 gtk_box_pack_start(GTK_BOX(hbox), cancel, FALSE, FALSE, 5); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
631 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", GTK_SIGNAL_FUNC(cfdes), 0); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
632 |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
633 gtk_widget_show(config); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
634 } |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
635 |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
636 extern void unload_perl_scripts(GtkWidget *w, gpointer d) |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
637 { |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
638 perl_end(); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
639 perl_init(); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
640 } |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
641 |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
642 extern void list_perl_scripts(GtkWidget *w, gpointer d) |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
643 { |
799
72f8ac951c11
[gaim-migrate @ 809]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
798
diff
changeset
|
644 GList *s = perl_list; |
72f8ac951c11
[gaim-migrate @ 809]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
798
diff
changeset
|
645 struct perlscript *p; |
72f8ac951c11
[gaim-migrate @ 809]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
798
diff
changeset
|
646 char buf[BUF_LONG * 4]; |
72f8ac951c11
[gaim-migrate @ 809]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
798
diff
changeset
|
647 int at = 0; |
72f8ac951c11
[gaim-migrate @ 809]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
798
diff
changeset
|
648 |
72f8ac951c11
[gaim-migrate @ 809]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
798
diff
changeset
|
649 at += g_snprintf(buf + at, sizeof(buf) - at, "Loaded scripts:\n"); |
72f8ac951c11
[gaim-migrate @ 809]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
798
diff
changeset
|
650 while (s) { |
72f8ac951c11
[gaim-migrate @ 809]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
798
diff
changeset
|
651 p = (struct perlscript *)s->data; |
72f8ac951c11
[gaim-migrate @ 809]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
798
diff
changeset
|
652 at += g_snprintf(buf + at, sizeof(buf) - at, "%s\n", p->name); |
72f8ac951c11
[gaim-migrate @ 809]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
798
diff
changeset
|
653 s = s->next; |
72f8ac951c11
[gaim-migrate @ 809]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
798
diff
changeset
|
654 } |
72f8ac951c11
[gaim-migrate @ 809]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
798
diff
changeset
|
655 |
72f8ac951c11
[gaim-migrate @ 809]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
798
diff
changeset
|
656 do_error_dialog(buf, _("Perl Scripts")); |
798
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
797
diff
changeset
|
657 } |
799
72f8ac951c11
[gaim-migrate @ 809]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
798
diff
changeset
|
658 |
560 | 659 #endif /* USE_PERL */ |