Fri, 21 May 2004 00:32:52 +0000
[gaim-migrate @ 9768]
update the structs
| 5205 | 1 | /* |
| 2 | * gaim | |
| 3 | * | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
4 | * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org> |
| 5205 | 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 | */ | |
|
6235
8293e7d4c050
[gaim-migrate @ 6728]
Mark Doliner <markdoliner@pidgin.im>
parents:
6100
diff
changeset
|
20 | #ifdef HAVE_CONFIG_H |
|
8293e7d4c050
[gaim-migrate @ 6728]
Mark Doliner <markdoliner@pidgin.im>
parents:
6100
diff
changeset
|
21 | #include <config.h> |
| 8138 | 22 | # ifdef HAVE_LIMITS_H |
| 23 | # include <limits.h> | |
| 24 | # ifndef NAME_MAX | |
| 25 | # define NAME_MAX _POSIX_NAME_MAX | |
| 26 | # endif | |
| 27 | # endif | |
|
6235
8293e7d4c050
[gaim-migrate @ 6728]
Mark Doliner <markdoliner@pidgin.im>
parents:
6100
diff
changeset
|
28 | #endif |
|
8293e7d4c050
[gaim-migrate @ 6728]
Mark Doliner <markdoliner@pidgin.im>
parents:
6100
diff
changeset
|
29 | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
30 | #ifdef DEBUG |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
31 | # undef DEBUG |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
32 | #endif |
| 5205 | 33 | |
| 34 | #undef PACKAGE | |
| 35 | ||
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
36 | |
| 5205 | 37 | #define group perl_group |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
38 | |
| 5205 | 39 | #ifdef _WIN32 |
| 40 | /* This took me an age to figure out.. without this __declspec(dllimport) | |
| 41 | * will be ignored. | |
| 42 | */ | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
43 | # define HASATTRIBUTE |
| 5205 | 44 | #endif |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
45 | |
| 5205 | 46 | #include <EXTERN.h> |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
47 | |
| 5205 | 48 | #ifndef _SEM_SEMUN_UNDEFINED |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
49 | # define HAS_UNION_SEMUN |
| 5205 | 50 | #endif |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
51 | |
| 5205 | 52 | #include <perl.h> |
| 53 | #include <XSUB.h> | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
54 | |
| 5205 | 55 | #ifndef _WIN32 |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
56 | # include <sys/mman.h> |
| 5205 | 57 | #endif |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
58 | |
| 5205 | 59 | #undef PACKAGE |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
60 | |
| 5205 | 61 | #ifndef _WIN32 |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
62 | # include <dirent.h> |
| 5205 | 63 | #else |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
64 | /* We're using perl's win32 port of this */ |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
65 | # define dirent direct |
| 5205 | 66 | #endif |
| 67 | ||
| 68 | #undef group | |
| 69 | ||
| 70 | /* perl module support */ | |
| 71 | #ifdef OLD_PERL | |
| 72 | extern void boot_DynaLoader _((CV * cv)); | |
| 73 | #else | |
| 74 | extern void boot_DynaLoader _((pTHX_ CV * cv)); /* perl is so wacky */ | |
| 75 | #endif | |
| 76 | ||
| 77 | #undef _ | |
| 78 | #ifdef DEBUG | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
79 | # undef DEBUG |
| 5205 | 80 | #endif |
| 81 | #ifdef _WIN32 | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
82 | # undef pipe |
| 5205 | 83 | #endif |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
84 | |
|
6575
fdb1928afdf9
[gaim-migrate @ 7097]
Herman Bloggs <herman@bluedigits.com>
parents:
6549
diff
changeset
|
85 | #ifdef _WIN32 |
|
fdb1928afdf9
[gaim-migrate @ 7097]
Herman Bloggs <herman@bluedigits.com>
parents:
6549
diff
changeset
|
86 | #define _WIN32DEP_H_ |
|
fdb1928afdf9
[gaim-migrate @ 7097]
Herman Bloggs <herman@bluedigits.com>
parents:
6549
diff
changeset
|
87 | #endif |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
88 | #include "internal.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
89 | #include "debug.h" |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
90 | #include "plugin.h" |
|
6531
3fca41d7b411
[gaim-migrate @ 7048]
Christian Hammond <chipx86@chipx86.com>
parents:
6527
diff
changeset
|
91 | #include "signals.h" |
| 5205 | 92 | |
|
6526
c6c3f10519ab
[gaim-migrate @ 7043]
Christian Hammond <chipx86@chipx86.com>
parents:
6525
diff
changeset
|
93 | #include "perl-common.h" |
|
6522
e7d94240fc71
[gaim-migrate @ 7039]
Christian Hammond <chipx86@chipx86.com>
parents:
6520
diff
changeset
|
94 | #include "perl-handlers.h" |
|
e7d94240fc71
[gaim-migrate @ 7039]
Christian Hammond <chipx86@chipx86.com>
parents:
6520
diff
changeset
|
95 | |
| 5205 | 96 | #define PERL_PLUGIN_ID "core-perl" |
| 97 | ||
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
98 | typedef struct |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
99 | { |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
100 | GaimPlugin *plugin; |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
101 | char *package; |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
102 | char *load_sub; |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
103 | char *unload_sub; |
| 5205 | 104 | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
105 | } GaimPerlScript; |
| 5205 | 106 | |
| 107 | ||
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
108 | PerlInterpreter *my_perl = NULL; |
| 5205 | 109 | |
| 110 | static void | |
| 111 | #ifdef OLD_PERL | |
| 112 | xs_init() | |
| 113 | #else | |
| 114 | xs_init(pTHX) | |
| 115 | #endif | |
| 116 | { | |
| 117 | char *file = __FILE__; | |
| 118 | ||
| 119 | /* This one allows dynamic loading of perl modules in perl | |
| 120 | scripts by the 'use perlmod;' construction*/ | |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
121 | newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); |
| 5205 | 122 | } |
| 123 | ||
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
124 | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
125 | static void |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
126 | perl_init(void) |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
127 | { |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
128 | /* changed the name of the variable from load_file to |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
129 | perl_definitions since now it does much more than defining |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
130 | the load_file sub. Moreover, deplaced the initialisation to |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
131 | the xs_init function. (TheHobbit)*/ |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
132 | char *perl_args[] = { "", "-e", "0", "-w" }; |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
133 | char perl_definitions[] = |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
134 | { |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
135 | /* We use to function one to load a file the other to |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
136 | execute the string obtained from the first and holding |
|
8735
01248ea222d3
[gaim-migrate @ 9490]
Jonathan Champ <royanee@users.sourceforge.net>
parents:
8138
diff
changeset
|
137 | the file contents. This allows to have a really local $/ |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
138 | without introducing temp variables to hold the old |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
139 | value. Just a question of style:) */ |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
140 | "package Gaim::PerlLoader;" |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
141 | "use Symbol;" |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
142 | |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
143 | "sub load_file {" |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
144 | "my $f_name=shift;" |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
145 | "local $/=undef;" |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
146 | "open FH,$f_name or return \"__FAILED__\";" |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
147 | "$_=<FH>;" |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
148 | "close FH;" |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
149 | "return $_;" |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
150 | "}" |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
151 | |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
152 | "sub destroy_package {" |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
153 | "eval { $_[0]->UNLOAD() if $_[0]->can('UNLOAD'); };" |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
154 | "Symbol::delete_package($_[0]);" |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
155 | "}" |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
156 | |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
157 | "sub load_n_eval {" |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
158 | "my ($f_name, $package) = @_;" |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
159 | "destroy_package($package);" |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
160 | "my $strin=load_file($f_name);" |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
161 | "return 2 if($strin eq \"__FAILED__\");" |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
162 | "my $eval = qq{package $package; $strin;};" |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
163 | |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
164 | "{" |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
165 | " eval $eval;" |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
166 | "}" |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
167 | |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
168 | "if($@) {" |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
169 | /*" #something went wrong\n"*/ |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
170 | "die(\"Errors loading file $f_name: $@\");" |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
171 | "}" |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
172 | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
173 | "return 0;" |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
174 | "}" |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
175 | }; |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
176 | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
177 | my_perl = perl_alloc(); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
178 | perl_construct(my_perl); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
179 | #ifdef DEBUG |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
180 | perl_parse(my_perl, xs_init, 4, perl_args, NULL); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
181 | #else |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
182 | perl_parse(my_perl, xs_init, 3, perl_args, NULL); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
183 | #endif |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
184 | #ifdef HAVE_PERL_EVAL_PV |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
185 | eval_pv(perl_definitions, TRUE); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
186 | #else |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
187 | perl_eval_pv(perl_definitions, TRUE); /* deprecated */ |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
188 | #endif |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
189 | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
190 | perl_run(my_perl); |
| 5205 | 191 | } |
| 192 | ||
| 193 | static void | |
| 194 | perl_end(void) | |
| 195 | { | |
|
6520
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
196 | if (my_perl == NULL) |
|
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
197 | return; |
|
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
198 | |
|
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
199 | perl_eval_pv( |
|
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
200 | "foreach my $lib (@DynaLoader::dl_modules) {" |
|
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
201 | "if ($lib =~ /^Gaim\\b/) {" |
|
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
202 | "$lib .= '::deinit();';" |
|
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
203 | "eval $lib;" |
|
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
204 | "}" |
|
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
205 | "}", |
|
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
206 | TRUE); |
|
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
207 | |
|
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
208 | perl_destruct(my_perl); |
|
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
209 | perl_free(my_perl); |
|
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
210 | my_perl = NULL; |
| 5205 | 211 | } |
| 212 | ||
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
213 | void |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
214 | gaim_perl_callXS(void (*subaddr)(pTHX_ CV *cv), CV *cv, SV **mark) |
| 5205 | 215 | { |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
216 | dSP; |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
217 | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
218 | PUSHMARK(mark); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
219 | (*subaddr)(aTHX_ cv); |
| 5205 | 220 | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
221 | PUTBACK; |
| 5205 | 222 | } |
| 223 | ||
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
224 | static void |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
225 | normalize_script_name(char *name) |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
226 | { |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
227 | char *c; |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
228 | |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
229 | c = strrchr(name, '.'); |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
230 | |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
231 | if (c != NULL) |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
232 | *c = '\0'; |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
233 | |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
234 | for (c = name; *c != '\0'; c++) |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
235 | { |
| 8095 | 236 | if (*c != '_' && !g_ascii_isalnum(*c)) |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
237 | *c = '_'; |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
238 | } |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
239 | } |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
240 | |
| 5205 | 241 | static gboolean |
| 242 | probe_perl_plugin(GaimPlugin *plugin) | |
| 243 | { | |
| 244 | /* XXX This would be much faster if I didn't create a new | |
| 245 | * PerlInterpreter every time I probed a plugin */ | |
| 246 | PerlInterpreter *prober = perl_alloc(); | |
| 247 | char *argv[] = {"", plugin->path }; | |
| 248 | gboolean status = TRUE; | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
249 | HV *plugin_info; |
| 5205 | 250 | |
| 251 | perl_construct(prober); | |
| 5922 | 252 | perl_parse(prober, xs_init, 2, argv, NULL); |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
253 | perl_run(prober); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
254 | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
255 | plugin_info = perl_get_hv("PLUGIN_INFO", FALSE); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
256 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
257 | if (plugin_info == NULL) |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
258 | status = FALSE; |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
259 | else if (!hv_exists(plugin_info, "perl_api_version", |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
260 | strlen("perl_api_version")) || |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
261 | !hv_exists(plugin_info, "name", strlen("name")) || |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
262 | !hv_exists(plugin_info, "load", strlen("load"))) |
| 5205 | 263 | { |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
264 | /* Not a valid plugin. */ |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
265 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
266 | status = FALSE; |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
267 | } |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
268 | else |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
269 | { |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
270 | SV **key; |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
271 | int perl_api_ver; |
| 5205 | 272 | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
273 | key = hv_fetch(plugin_info, "perl_api_version", |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
274 | strlen("perl_api_version"), 0); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
275 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
276 | perl_api_ver = SvIV(*key); |
| 5205 | 277 | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
278 | if (perl_api_ver != 2) |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
279 | status = FALSE; |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
280 | else |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
281 | { |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
282 | GaimPluginInfo *info; |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
283 | GaimPerlScript *gps; |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
284 | char *basename; |
|
6678
c633179afd00
[gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
6636
diff
changeset
|
285 | STRLEN len; |
| 5205 | 286 | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
287 | gaim_debug(GAIM_DEBUG_INFO, "perl", "Found plugin info\n"); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
288 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
289 | info = g_new0(GaimPluginInfo, 1); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
290 | gps = g_new0(GaimPerlScript, 1); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
291 | |
|
8761
2d596fd60ba8
[gaim-migrate @ 9516]
Mark Doliner <markdoliner@pidgin.im>
parents:
8749
diff
changeset
|
292 | info->api_version = GAIM_PLUGIN_API_VERSION; |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
293 | info->type = GAIM_PLUGIN_STANDARD; |
| 5205 | 294 | |
| 295 | info->dependencies = g_list_append(info->dependencies, | |
| 296 | PERL_PLUGIN_ID); | |
| 297 | ||
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
298 | gps->plugin = plugin; |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
299 | |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
300 | basename = g_path_get_basename(plugin->path); |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
301 | normalize_script_name(basename); |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
302 | gps->package = g_strdup_printf("Gaim::Script::%s", basename); |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
303 | g_free(basename); |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
304 | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
305 | /* We know this one exists. */ |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
306 | key = hv_fetch(plugin_info, "name", strlen("name"), 0); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
307 | info->name = g_strdup(SvPV(*key, len)); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
308 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
309 | if ((key = hv_fetch(plugin_info, "url", strlen("url"), 0))) |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
310 | info->homepage = g_strdup(SvPV(*key, len)); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
311 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
312 | if ((key = hv_fetch(plugin_info, "author", strlen("author"), 0))) |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
313 | info->author = g_strdup(SvPV(*key, len)); |
| 5205 | 314 | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
315 | if ((key = hv_fetch(plugin_info, "summary", |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
316 | strlen("summary"), 0))) |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
317 | info->summary = g_strdup(SvPV(*key, len)); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
318 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
319 | if ((key = hv_fetch(plugin_info, "description", |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
320 | strlen("description"), 0))) |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
321 | info->description = g_strdup(SvPV(*key, len)); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
322 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
323 | if ((key = hv_fetch(plugin_info, "version", strlen("version"), 0))) |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
324 | info->version = g_strdup(SvPV(*key, len)); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
325 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
326 | if ((key = hv_fetch(plugin_info, "load", strlen("load"), 0))) |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
327 | gps->load_sub = g_strdup_printf("%s::%s", gps->package, |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
328 | SvPV(*key, len)); |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
329 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
330 | if ((key = hv_fetch(plugin_info, "unload", strlen("unload"), 0))) |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
331 | gps->unload_sub = g_strdup_printf("%s::%s", gps->package, |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
332 | SvPV(*key, len)); |
| 5205 | 333 | |
| 334 | plugin->info = info; | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
335 | info->extra_info = gps; |
| 5205 | 336 | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
337 | status = gaim_plugin_register(plugin); |
| 5205 | 338 | } |
| 339 | } | |
| 340 | ||
| 341 | perl_destruct(prober); | |
| 342 | perl_free(prober); | |
| 343 | ||
| 344 | return status; | |
| 345 | } | |
| 346 | ||
| 347 | static gboolean | |
| 348 | load_perl_plugin(GaimPlugin *plugin) | |
| 349 | { | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
350 | GaimPerlScript *gps = (GaimPerlScript *)plugin->info->extra_info; |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
351 | char *atmp[3] = { plugin->path, NULL, NULL }; |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
352 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
353 | if (gps == NULL || gps->load_sub == NULL) |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
354 | return FALSE; |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
355 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
356 | gaim_debug(GAIM_DEBUG_INFO, "perl", "Loading perl script\n"); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
357 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
358 | if (my_perl == NULL) |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
359 | perl_init(); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
360 | |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
361 | plugin->handle = gps; |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
362 | |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
363 | atmp[1] = gps->package; |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
364 | |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
365 | execute_perl("Gaim::PerlLoader::load_n_eval", 2, atmp); |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
366 | |
|
6536
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
367 | { |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
368 | dSP; |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
369 | ENTER; |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
370 | SAVETMPS; |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
371 | PUSHMARK(sp); |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
372 | XPUSHs(sv_2mortal(gaim_perl_bless_object(plugin, "Gaim::Plugin"))); |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
373 | PUTBACK; |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
374 | |
|
6536
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
375 | perl_call_pv(gps->load_sub, G_EVAL | G_SCALAR); |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
376 | SPAGAIN; |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
377 | |
|
6536
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
378 | if (SvTRUE(ERRSV)) { |
|
6678
c633179afd00
[gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
6636
diff
changeset
|
379 | STRLEN len; |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
380 | |
|
6536
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
381 | gaim_debug(GAIM_DEBUG_ERROR, "perl", |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
382 | "Perl function %s exited abnormally: %s\n", |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
383 | gps->load_sub, SvPV(ERRSV, len)); |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
384 | } |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
385 | |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
386 | PUTBACK; |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
387 | FREETMPS; |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
388 | LEAVE; |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
389 | } |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
390 | |
| 5205 | 391 | return TRUE; |
| 392 | } | |
| 393 | ||
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
394 | static void |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
395 | destroy_package(const char *package) |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
396 | { |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
397 | dSP; |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
398 | |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
399 | ENTER; |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
400 | SAVETMPS; |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
401 | |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
402 | PUSHMARK(SP); |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
403 | XPUSHs(sv_2mortal(newSVpv(package, strlen(package)))); |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
404 | PUTBACK; |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
405 | |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
406 | perl_call_pv("Gaim::PerlLoader::destroy_package", |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
407 | G_VOID | G_EVAL | G_DISCARD); |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
408 | |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
409 | SPAGAIN; |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
410 | |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
411 | PUTBACK; |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
412 | FREETMPS; |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
413 | LEAVE; |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
414 | } |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
415 | |
| 5205 | 416 | static gboolean |
| 417 | unload_perl_plugin(GaimPlugin *plugin) | |
| 418 | { | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
419 | GaimPerlScript *gps = (GaimPerlScript *)plugin->info->extra_info; |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
420 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
421 | if (gps == NULL || gps->unload_sub == NULL) |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
422 | return FALSE; |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
423 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
424 | gaim_debug(GAIM_DEBUG_INFO, "perl", "Unloading perl script\n"); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
425 | |
|
6536
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
426 | { |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
427 | dSP; |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
428 | ENTER; |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
429 | SAVETMPS; |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
430 | PUSHMARK(sp); |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
431 | XPUSHs(sv_2mortal(gaim_perl_bless_object(plugin, "Gaim::Plugin"))); |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
432 | PUTBACK; |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
433 | |
|
6536
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
434 | perl_call_pv(gps->unload_sub, G_EVAL | G_SCALAR); |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
435 | SPAGAIN; |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
436 | |
|
6536
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
437 | if (SvTRUE(ERRSV)) { |
|
6678
c633179afd00
[gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
6636
diff
changeset
|
438 | STRLEN len; |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
439 | |
|
6536
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
440 | gaim_debug(GAIM_DEBUG_ERROR, "perl", |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
441 | "Perl function %s exited abnormally: %s\n", |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
442 | gps->load_sub, SvPV(ERRSV, len)); |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
443 | } |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
444 | |
|
6536
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
445 | PUTBACK; |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
446 | FREETMPS; |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
447 | LEAVE; |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
448 | } |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
449 | |
|
6549
8e6ba2a45698
[gaim-migrate @ 7071]
Christian Hammond <chipx86@chipx86.com>
parents:
6536
diff
changeset
|
450 | gaim_perl_signal_clear_for_plugin(plugin); |
|
6522
e7d94240fc71
[gaim-migrate @ 7039]
Christian Hammond <chipx86@chipx86.com>
parents:
6520
diff
changeset
|
451 | gaim_perl_timeout_clear_for_plugin(plugin); |
| 5205 | 452 | |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
453 | destroy_package(gps->package); |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
454 | |
| 5205 | 455 | return TRUE; |
| 456 | } | |
| 457 | ||
| 458 | static void | |
| 459 | destroy_perl_plugin(GaimPlugin *plugin) | |
| 460 | { | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
461 | if (plugin->info != NULL) |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
462 | { |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
463 | GaimPerlScript *gps; |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
464 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
465 | if (plugin->info->name != NULL) |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
466 | g_free(plugin->info->name); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
467 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
468 | if (plugin->info->version != NULL) |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
469 | g_free(plugin->info->version); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
470 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
471 | if (plugin->info->summary != NULL) |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
472 | g_free(plugin->info->summary); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
473 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
474 | if (plugin->info->description != NULL) |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
475 | g_free(plugin->info->description); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
476 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
477 | if (plugin->info->author != NULL) |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
478 | g_free(plugin->info->author); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
479 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
480 | if (plugin->info->homepage != NULL) |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
481 | g_free(plugin->info->homepage); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
482 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
483 | gps = (GaimPerlScript *)plugin->info->extra_info; |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
484 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
485 | if (gps != NULL) |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
486 | { |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
487 | if (gps->load_sub != NULL) |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
488 | g_free(gps->load_sub); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
489 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
490 | if (gps->unload_sub != NULL) |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
491 | g_free(gps->unload_sub); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
492 | |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
493 | if (gps->package != NULL) |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
494 | g_free(gps->package); |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
495 | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
496 | g_free(gps); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
497 | plugin->info->extra_info = NULL; |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
498 | } |
| 5205 | 499 | } |
| 500 | } | |
| 501 | ||
| 502 | static gboolean | |
| 503 | plugin_unload(GaimPlugin *plugin) | |
| 504 | { | |
| 505 | perl_end(); | |
| 506 | ||
| 507 | return TRUE; | |
| 508 | } | |
| 509 | ||
| 510 | static GaimPluginLoaderInfo loader_info = | |
| 511 | { | |
|
8749
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
512 | GAIM_LOADER_API_VERSION, /**< api_version */ |
| 5205 | 513 | NULL, /**< exts */ |
| 514 | ||
| 515 | probe_perl_plugin, /**< probe */ | |
| 516 | load_perl_plugin, /**< load */ | |
| 517 | unload_perl_plugin, /**< unload */ | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
518 | destroy_perl_plugin /**< destroy */ |
| 5205 | 519 | }; |
| 520 | ||
| 521 | static GaimPluginInfo info = | |
| 522 | { | |
|
8749
fb487e9e101a
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
523 | GAIM_PLUGIN_API_VERSION, /**< api_version */ |
| 5205 | 524 | GAIM_PLUGIN_LOADER, /**< type */ |
| 525 | NULL, /**< ui_requirement */ | |
| 526 | 0, /**< flags */ | |
| 527 | NULL, /**< dependencies */ | |
| 528 | GAIM_PRIORITY_DEFAULT, /**< priority */ | |
| 529 | ||
| 530 | PERL_PLUGIN_ID, /**< id */ | |
| 531 | N_("Perl Plugin Loader"), /**< name */ | |
| 532 | VERSION, /**< version */ | |
| 533 | N_("Provides support for loading perl plugins."), /**< summary */ | |
| 534 | N_("Provides support for loading perl plugins."), /**< description */ | |
| 535 | "Christian Hammond <chipx86@gnupdate.org>", /**< author */ | |
|
6371
e92b66ee5518
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6235
diff
changeset
|
536 | GAIM_WEBSITE, /**< homepage */ |
| 5205 | 537 | |
| 538 | NULL, /**< load */ | |
| 539 | plugin_unload, /**< unload */ | |
| 540 | NULL, /**< destroy */ | |
| 541 | ||
| 542 | NULL, /**< ui_info */ | |
| 8993 | 543 | &loader_info, /**< extra_info */ |
| 544 | NULL, | |
| 545 | NULL | |
| 5205 | 546 | }; |
| 547 | ||
| 548 | static void | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
549 | init_plugin(GaimPlugin *plugin) |
| 5205 | 550 | { |
| 551 | loader_info.exts = g_list_append(loader_info.exts, "pl"); | |
| 552 | } | |
| 553 | ||
| 6063 | 554 | GAIM_INIT_PLUGIN(perl, init_plugin, info) |