annotate plugins/perl/perl.c @ 12855:f9401180115a

[gaim-migrate @ 15206] Fix a regression I introduced, as noted in SF Bug #1220557. The core now does escaping for the chat user add/remove functions. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Thu, 12 Jan 2006 21:30:59 +0000
parents cdd941172951
children 2422097a7a5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /*
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 * gaim
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 *
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
4 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 *
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 * (at your option) any later version.
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 *
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * GNU General Public License for more details.
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 *
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 */
6235
1049dd7e976e [gaim-migrate @ 6728]
Mark Doliner <mark@kingant.net>
parents: 6100
diff changeset
20 #ifdef HAVE_CONFIG_H
1049dd7e976e [gaim-migrate @ 6728]
Mark Doliner <mark@kingant.net>
parents: 6100
diff changeset
21 #include <config.h>
8138
3e8592b95f68 [gaim-migrate @ 8844]
Christian Hammond <chipx86@chipx86.com>
parents: 8095
diff changeset
22 # ifdef HAVE_LIMITS_H
3e8592b95f68 [gaim-migrate @ 8844]
Christian Hammond <chipx86@chipx86.com>
parents: 8095
diff changeset
23 # include <limits.h>
3e8592b95f68 [gaim-migrate @ 8844]
Christian Hammond <chipx86@chipx86.com>
parents: 8095
diff changeset
24 # ifndef NAME_MAX
3e8592b95f68 [gaim-migrate @ 8844]
Christian Hammond <chipx86@chipx86.com>
parents: 8095
diff changeset
25 # define NAME_MAX _POSIX_NAME_MAX
3e8592b95f68 [gaim-migrate @ 8844]
Christian Hammond <chipx86@chipx86.com>
parents: 8095
diff changeset
26 # endif
3e8592b95f68 [gaim-migrate @ 8844]
Christian Hammond <chipx86@chipx86.com>
parents: 8095
diff changeset
27 # endif
6235
1049dd7e976e [gaim-migrate @ 6728]
Mark Doliner <mark@kingant.net>
parents: 6100
diff changeset
28 #endif
1049dd7e976e [gaim-migrate @ 6728]
Mark Doliner <mark@kingant.net>
parents: 6100
diff changeset
29
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5775
diff changeset
30 #ifdef DEBUG
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5775
diff changeset
31 # undef DEBUG
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5775
diff changeset
32 #endif
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34 #undef PACKAGE
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36 #define group perl_group
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5775
diff changeset
37
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38 #ifdef _WIN32
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
39 /* This took me an age to figure out.. without this __declspec(dllimport)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40 * will be ignored.
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41 */
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5775
diff changeset
42 # define HASATTRIBUTE
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43 #endif
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5775
diff changeset
44
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45 #include <EXTERN.h>
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5775
diff changeset
46
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47 #ifndef _SEM_SEMUN_UNDEFINED
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5775
diff changeset
48 # define HAS_UNION_SEMUN
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49 #endif
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5775
diff changeset
50
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51 #include <perl.h>
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52 #include <XSUB.h>
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5775
diff changeset
53
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54 #ifndef _WIN32
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5775
diff changeset
55 # include <sys/mman.h>
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56 #endif
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5775
diff changeset
57
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58 #undef PACKAGE
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5775
diff changeset
59
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60 #ifndef _WIN32
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5775
diff changeset
61 # include <dirent.h>
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62 #else
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5775
diff changeset
63 /* We're using perl's win32 port of this */
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5775
diff changeset
64 # define dirent direct
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65 #endif
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
67 #undef group
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 /* perl module support */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 #ifdef OLD_PERL
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71 extern void boot_DynaLoader _((CV * cv));
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 #else
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73 extern void boot_DynaLoader _((pTHX_ CV * cv)); /* perl is so wacky */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74 #endif
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
75
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76 #undef _
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
77 #ifdef DEBUG
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5775
diff changeset
78 # undef DEBUG
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79 #endif
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80 #ifdef _WIN32
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5775
diff changeset
81 # undef pipe
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82 #endif
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5775
diff changeset
83
6575
87a0fb97d3b9 [gaim-migrate @ 7097]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6549
diff changeset
84 #ifdef _WIN32
87a0fb97d3b9 [gaim-migrate @ 7097]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6549
diff changeset
85 #define _WIN32DEP_H_
87a0fb97d3b9 [gaim-migrate @ 7097]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6549
diff changeset
86 #endif
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5775
diff changeset
87 #include "internal.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5775
diff changeset
88 #include "debug.h"
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
89 #include "plugin.h"
6531
7c42b8ca3222 [gaim-migrate @ 7048]
Christian Hammond <chipx86@chipx86.com>
parents: 6527
diff changeset
90 #include "signals.h"
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9578
diff changeset
91 #include "version.h"
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
92
6526
e162c765fe21 [gaim-migrate @ 7043]
Christian Hammond <chipx86@chipx86.com>
parents: 6525
diff changeset
93 #include "perl-common.h"
6522
0c5233faceb8 [gaim-migrate @ 7039]
Christian Hammond <chipx86@chipx86.com>
parents: 6520
diff changeset
94 #include "perl-handlers.h"
0c5233faceb8 [gaim-migrate @ 7039]
Christian Hammond <chipx86@chipx86.com>
parents: 6520
diff changeset
95
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
96 #define PERL_PLUGIN_ID "core-perl"
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
97
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
98 typedef struct
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
99 {
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
100 GaimPlugin *plugin;
6636
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
101 char *package;
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
102 char *load_sub;
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
103 char *unload_sub;
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
104 } GaimPerlScript;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
105
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
106
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
107 PerlInterpreter *my_perl = NULL;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
108
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
109 static void
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
110 #ifdef OLD_PERL
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
111 xs_init()
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
112 #else
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
113 xs_init(pTHX)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
114 #endif
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
115 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
116 char *file = __FILE__;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
117
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
118 /* This one allows dynamic loading of perl modules in perl
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
119 scripts by the 'use perlmod;' construction*/
6636
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
120 newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
121 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
122
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
123
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
124 static void
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
125 perl_init(void)
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
126 {
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
127 /* changed the name of the variable from load_file to
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
128 perl_definitions since now it does much more than defining
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
129 the load_file sub. Moreover, deplaced the initialisation to
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
130 the xs_init function. (TheHobbit)*/
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
131 char *perl_args[] = { "", "-e", "0", "-w" };
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
132 char perl_definitions[] =
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
133 {
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
134 /* We use to function one to load a file the other to
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
135 execute the string obtained from the first and holding
8735
92cbf9713795 [gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents: 8138
diff changeset
136 the file contents. This allows to have a really local $/
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
137 without introducing temp variables to hold the old
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
138 value. Just a question of style:) */
6636
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
139 "package Gaim::PerlLoader;"
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
140 "use Symbol;"
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
141
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
142 "sub load_file {"
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
143 "my $f_name=shift;"
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
144 "local $/=undef;"
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
145 "open FH,$f_name or return \"__FAILED__\";"
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
146 "$_=<FH>;"
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
147 "close FH;"
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
148 "return $_;"
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
149 "}"
6636
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
150
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
151 "sub destroy_package {"
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
152 "eval { $_[0]->UNLOAD() if $_[0]->can('UNLOAD'); };"
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
153 "Symbol::delete_package($_[0]);"
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
154 "}"
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
155
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
156 "sub load_n_eval {"
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
157 "my ($f_name, $package) = @_;"
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
158 "destroy_package($package);"
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
159 "my $strin=load_file($f_name);"
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
160 "return 2 if($strin eq \"__FAILED__\");"
6636
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
161 "my $eval = qq{package $package; $strin;};"
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
162
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
163 "{"
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
164 " eval $eval;"
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
165 "}"
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
166
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
167 "if($@) {"
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
168 /*" #something went wrong\n"*/
6636
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
169 "die(\"Errors loading file $f_name: $@\");"
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
170 "}"
6636
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
171
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
172 "return 0;"
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
173 "}"
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
174 };
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
175
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
176 my_perl = perl_alloc();
11290
b284c703d398 [gaim-migrate @ 13490]
John H. Kelm <johnkelm@gmail.com>
parents: 11256
diff changeset
177 PERL_SET_CONTEXT(my_perl);
b284c703d398 [gaim-migrate @ 13490]
John H. Kelm <johnkelm@gmail.com>
parents: 11256
diff changeset
178 PL_perl_destruct_level = 1;
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
179 perl_construct(my_perl);
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
180 #ifdef DEBUG
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
181 perl_parse(my_perl, xs_init, 4, perl_args, NULL);
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
182 #else
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
183 perl_parse(my_perl, xs_init, 3, perl_args, NULL);
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
184 #endif
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
185 #ifdef HAVE_PERL_EVAL_PV
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
186 eval_pv(perl_definitions, TRUE);
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
187 #else
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
188 perl_eval_pv(perl_definitions, TRUE); /* deprecated */
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
189 #endif
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
190 perl_run(my_perl);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
191 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
192
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
193 static void
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
194 perl_end(void)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
195 {
6520
2e2593d95121 [gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents: 6508
diff changeset
196 if (my_perl == NULL)
2e2593d95121 [gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents: 6508
diff changeset
197 return;
11290
b284c703d398 [gaim-migrate @ 13490]
John H. Kelm <johnkelm@gmail.com>
parents: 11256
diff changeset
198
b284c703d398 [gaim-migrate @ 13490]
John H. Kelm <johnkelm@gmail.com>
parents: 11256
diff changeset
199 PL_perl_destruct_level = 1;
b284c703d398 [gaim-migrate @ 13490]
John H. Kelm <johnkelm@gmail.com>
parents: 11256
diff changeset
200 PERL_SET_CONTEXT(my_perl);
6520
2e2593d95121 [gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents: 6508
diff changeset
201 perl_eval_pv(
2e2593d95121 [gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents: 6508
diff changeset
202 "foreach my $lib (@DynaLoader::dl_modules) {"
2e2593d95121 [gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents: 6508
diff changeset
203 "if ($lib =~ /^Gaim\\b/) {"
2e2593d95121 [gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents: 6508
diff changeset
204 "$lib .= '::deinit();';"
2e2593d95121 [gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents: 6508
diff changeset
205 "eval $lib;"
2e2593d95121 [gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents: 6508
diff changeset
206 "}"
2e2593d95121 [gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents: 6508
diff changeset
207 "}",
2e2593d95121 [gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents: 6508
diff changeset
208 TRUE);
2e2593d95121 [gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents: 6508
diff changeset
209
11290
b284c703d398 [gaim-migrate @ 13490]
John H. Kelm <johnkelm@gmail.com>
parents: 11256
diff changeset
210 PL_perl_destruct_level = 1;
b284c703d398 [gaim-migrate @ 13490]
John H. Kelm <johnkelm@gmail.com>
parents: 11256
diff changeset
211 PERL_SET_CONTEXT(my_perl);
6520
2e2593d95121 [gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents: 6508
diff changeset
212 perl_destruct(my_perl);
2e2593d95121 [gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents: 6508
diff changeset
213 perl_free(my_perl);
2e2593d95121 [gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents: 6508
diff changeset
214 my_perl = NULL;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
215 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
216
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
217 void
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
218 gaim_perl_callXS(void (*subaddr)(pTHX_ CV *cv), CV *cv, SV **mark)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
219 {
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
220 dSP;
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
221
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
222 PUSHMARK(mark);
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
223 (*subaddr)(aTHX_ cv);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
224
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
225 PUTBACK;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
226 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
227
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
228 static gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
229 probe_perl_plugin(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
230 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
231 /* XXX This would be much faster if I didn't create a new
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
232 * PerlInterpreter every time I probed a plugin */
11290
b284c703d398 [gaim-migrate @ 13490]
John H. Kelm <johnkelm@gmail.com>
parents: 11256
diff changeset
233
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
234 PerlInterpreter *prober = perl_alloc();
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
235 char *argv[] = {"", plugin->path };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
236 gboolean status = TRUE;
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
237 HV *plugin_info;
11290
b284c703d398 [gaim-migrate @ 13490]
John H. Kelm <johnkelm@gmail.com>
parents: 11256
diff changeset
238 PERL_SET_CONTEXT(prober);
b284c703d398 [gaim-migrate @ 13490]
John H. Kelm <johnkelm@gmail.com>
parents: 11256
diff changeset
239 PL_perl_destruct_level = 1;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
240 perl_construct(prober);
11290
b284c703d398 [gaim-migrate @ 13490]
John H. Kelm <johnkelm@gmail.com>
parents: 11256
diff changeset
241
5922
83507b72ae6d [gaim-migrate @ 6362]
Luke Schierer <lschiere@pidgin.im>
parents: 5912
diff changeset
242 perl_parse(prober, xs_init, 2, argv, NULL);
11290
b284c703d398 [gaim-migrate @ 13490]
John H. Kelm <johnkelm@gmail.com>
parents: 11256
diff changeset
243
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
244 perl_run(prober);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
245
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
246 plugin_info = perl_get_hv("PLUGIN_INFO", FALSE);
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
247
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
248 if (plugin_info == NULL)
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
249 status = FALSE;
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
250 else if (!hv_exists(plugin_info, "perl_api_version",
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
251 strlen("perl_api_version")) ||
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
252 !hv_exists(plugin_info, "name", strlen("name")) ||
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
253 !hv_exists(plugin_info, "load", strlen("load")))
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
254 {
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
255 /* Not a valid plugin. */
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
256
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
257 status = FALSE;
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
258 }
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
259 else
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
260 {
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
261 SV **key;
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
262 int perl_api_ver;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
263
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
264 key = hv_fetch(plugin_info, "perl_api_version",
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
265 strlen("perl_api_version"), 0);
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
266
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
267 perl_api_ver = SvIV(*key);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
268
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
269 if (perl_api_ver != 2)
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
270 status = FALSE;
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
271 else
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
272 {
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
273 GaimPluginInfo *info;
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
274 GaimPerlScript *gps;
6636
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
275 char *basename;
6678
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents: 6636
diff changeset
276 STRLEN len;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
277
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
278 gaim_debug(GAIM_DEBUG_INFO, "perl", "Found plugin info\n");
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
279
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
280 info = g_new0(GaimPluginInfo, 1);
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
281 gps = g_new0(GaimPerlScript, 1);
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
282
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9578
diff changeset
283 info->magic = GAIM_PLUGIN_MAGIC;
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9578
diff changeset
284 info->major_version = GAIM_MAJOR_VERSION;
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9578
diff changeset
285 info->minor_version = GAIM_MINOR_VERSION;
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
286 info->type = GAIM_PLUGIN_STANDARD;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
287
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
288 info->dependencies = g_list_append(info->dependencies,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
289 PERL_PLUGIN_ID);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
290
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
291 gps->plugin = plugin;
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
292
6636
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
293 basename = g_path_get_basename(plugin->path);
11170
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
294 gaim_perl_normalize_script_name(basename);
6636
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
295 gps->package = g_strdup_printf("Gaim::Script::%s", basename);
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
296 g_free(basename);
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
297
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
298 /* We know this one exists. */
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
299 key = hv_fetch(plugin_info, "name", strlen("name"), 0);
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
300 info->name = g_strdup(SvPV(*key, len));
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
301
11170
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
302 if ((key = hv_fetch(plugin_info, "GTK_UI", strlen("GTK_UI"), 0)))
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
303 info->ui_requirement = GAIM_GTK_PLUGIN_TYPE;
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
304
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
305 if ((key = hv_fetch(plugin_info, "url", strlen("url"), 0)))
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
306 info->homepage = g_strdup(SvPV(*key, len));
11170
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
307
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
308 if ((key = hv_fetch(plugin_info, "author", strlen("author"), 0)))
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
309 info->author = g_strdup(SvPV(*key, len));
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
310
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
311 if ((key = hv_fetch(plugin_info, "summary",
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
312 strlen("summary"), 0)))
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
313 info->summary = g_strdup(SvPV(*key, len));
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
314
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
315 if ((key = hv_fetch(plugin_info, "description",
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
316 strlen("description"), 0)))
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
317 info->description = g_strdup(SvPV(*key, len));
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
318
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
319 if ((key = hv_fetch(plugin_info, "version", strlen("version"), 0)))
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
320 info->version = g_strdup(SvPV(*key, len));
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
321
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
322 if ((key = hv_fetch(plugin_info, "load", strlen("load"), 0)))
6636
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
323 gps->load_sub = g_strdup_printf("%s::%s", gps->package,
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
324 SvPV(*key, len));
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
325
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
326 if ((key = hv_fetch(plugin_info, "unload", strlen("unload"), 0)))
6636
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
327 gps->unload_sub = g_strdup_printf("%s::%s", gps->package,
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
328 SvPV(*key, len));
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
329
11170
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
330 /********************************************************/
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
331 /* Only one of the next two options should be present */
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
332 /* */
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
333 /* prefs_info - Uses non-GUI (read GTK) gaim API calls */
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
334 /* and creates a GaimPluginPrefInfo type. */
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
335 /* */
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
336 /* gtk_prefs_info - Requires gtk2-perl be installed by */
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
337 /* the user and he must create a GtkWidget */
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
338 /* representing the plugin preferences */
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
339 /* page. */
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
340 /********************************************************/
11123
4315bb5f427b [gaim-migrate @ 13179]
John H. Kelm <johnkelm@gmail.com>
parents: 11033
diff changeset
341 if ((key = hv_fetch(plugin_info, "prefs_info", strlen("prefs_info"), 0))) {
11842
cdd941172951 [gaim-migrate @ 14133]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11318
diff changeset
342 char *tmp = g_strdup_printf("%s::%s", gps->package, SvPV(*key, len));
11123
4315bb5f427b [gaim-migrate @ 13179]
John H. Kelm <johnkelm@gmail.com>
parents: 11033
diff changeset
343 /* key now is the name of the Perl sub that will create a frame for us */
11842
cdd941172951 [gaim-migrate @ 14133]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11318
diff changeset
344 info->prefs_info = gaim_perl_plugin_pref(tmp);
cdd941172951 [gaim-migrate @ 14133]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11318
diff changeset
345 g_free(tmp);
11123
4315bb5f427b [gaim-migrate @ 13179]
John H. Kelm <johnkelm@gmail.com>
parents: 11033
diff changeset
346 }
11170
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
347
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
348 if ((key = hv_fetch(plugin_info, "gtk_prefs_info", strlen("gtk_prefs_info"), 0))) {
11842
cdd941172951 [gaim-migrate @ 14133]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11318
diff changeset
349 char *tmp = g_strdup_printf("%s::%s", gps->package, SvPV(*key, len));
11170
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
350 /* key now is the name of the Perl sub that will create a frame for us */
11842
cdd941172951 [gaim-migrate @ 14133]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11318
diff changeset
351 info->ui_info = gaim_perl_gtk_plugin_pref(tmp);
cdd941172951 [gaim-migrate @ 14133]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11318
diff changeset
352 g_free(tmp);
11170
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
353 }
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
354
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
355 /********************************************************/
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
356 /* */
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
357 /* plugin_action - This is given to the plugin info */
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
358 /* as the action GList. There are two parts */
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
359 /* so the user can set the title as it will appear */
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
360 /* in the plugin action menu. The name is */
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
361 /* extracted and then the callback perl sub's name */
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
362 /* both of which then are handled by an internal */
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
363 /* gaim_perl function that sets up the single cb */
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
364 /* function which is then inserted into 'info'. */
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
365 /********************************************************/
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
366 if ((key = hv_fetch(plugin_info, "plugin_action_label", strlen("plugin_action_label"), 0))) {
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
367 gaim_perl_plugin_action_label = g_strdup(SvPV(*key, len));
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
368 }
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
369
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
370 if ((key = hv_fetch(plugin_info, "plugin_action", strlen("plugin_action"), 0))) {
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
371 gaim_perl_plugin_action_callback_sub = g_strdup_printf("%s::%s", gps->package, SvPV(*key, len));
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
372 info->actions = gaim_perl_plugin_action;
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
373 }
11123
4315bb5f427b [gaim-migrate @ 13179]
John H. Kelm <johnkelm@gmail.com>
parents: 11033
diff changeset
374
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
375 plugin->info = info;
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
376 info->extra_info = gps;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
377
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
378 status = gaim_plugin_register(plugin);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
379 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
380 }
11170
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents: 11123
diff changeset
381
11290
b284c703d398 [gaim-migrate @ 13490]
John H. Kelm <johnkelm@gmail.com>
parents: 11256
diff changeset
382 PL_perl_destruct_level = 1;
b284c703d398 [gaim-migrate @ 13490]
John H. Kelm <johnkelm@gmail.com>
parents: 11256
diff changeset
383 PERL_SET_CONTEXT(prober);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
384 perl_destruct(prober);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
385 perl_free(prober);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
386 return status;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
387 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
388
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
389 static gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
390 load_perl_plugin(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
391 {
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
392 GaimPerlScript *gps = (GaimPerlScript *)plugin->info->extra_info;
6636
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
393 char *atmp[3] = { plugin->path, NULL, NULL };
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
394
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
395 if (gps == NULL || gps->load_sub == NULL)
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
396 return FALSE;
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
397
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
398 gaim_debug(GAIM_DEBUG_INFO, "perl", "Loading perl script\n");
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
399
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
400 if (my_perl == NULL)
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
401 perl_init();
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
402
6636
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
403 plugin->handle = gps;
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
404
6636
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
405 atmp[1] = gps->package;
11290
b284c703d398 [gaim-migrate @ 13490]
John H. Kelm <johnkelm@gmail.com>
parents: 11256
diff changeset
406
b284c703d398 [gaim-migrate @ 13490]
John H. Kelm <johnkelm@gmail.com>
parents: 11256
diff changeset
407 PERL_SET_CONTEXT(my_perl);
6636
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
408 execute_perl("Gaim::PerlLoader::load_n_eval", 2, atmp);
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
409
6536
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
410 {
11318
519dc2186438 [gaim-migrate @ 13521]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11290
diff changeset
411 dSP;
11290
b284c703d398 [gaim-migrate @ 13490]
John H. Kelm <johnkelm@gmail.com>
parents: 11256
diff changeset
412 PERL_SET_CONTEXT(my_perl);
11318
519dc2186438 [gaim-migrate @ 13521]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11290
diff changeset
413 SPAGAIN;
6536
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
414 ENTER;
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
415 SAVETMPS;
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
416 PUSHMARK(sp);
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
417 XPUSHs(sv_2mortal(gaim_perl_bless_object(plugin, "Gaim::Plugin")));
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
418 PUTBACK;
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
419
6536
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
420 perl_call_pv(gps->load_sub, G_EVAL | G_SCALAR);
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
421 SPAGAIN;
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
422
6536
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
423 if (SvTRUE(ERRSV)) {
6678
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents: 6636
diff changeset
424 STRLEN len;
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
425
6536
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
426 gaim_debug(GAIM_DEBUG_ERROR, "perl",
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
427 "Perl function %s exited abnormally: %s\n",
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
428 gps->load_sub, SvPV(ERRSV, len));
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
429 }
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
430
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
431 PUTBACK;
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
432 FREETMPS;
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
433 LEAVE;
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
434 }
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
435
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
436 return TRUE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
437 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
438
6636
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
439 static void
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
440 destroy_package(const char *package)
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
441 {
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
442 dSP;
11318
519dc2186438 [gaim-migrate @ 13521]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11290
diff changeset
443 PERL_SET_CONTEXT(my_perl);
519dc2186438 [gaim-migrate @ 13521]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11290
diff changeset
444 SPAGAIN;
6636
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
445
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
446 ENTER;
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
447 SAVETMPS;
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
448
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
449 PUSHMARK(SP);
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
450 XPUSHs(sv_2mortal(newSVpv(package, strlen(package))));
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
451 PUTBACK;
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
452
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
453 perl_call_pv("Gaim::PerlLoader::destroy_package",
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
454 G_VOID | G_EVAL | G_DISCARD);
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
455
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
456 SPAGAIN;
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
457
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
458 PUTBACK;
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
459 FREETMPS;
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
460 LEAVE;
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
461 }
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
462
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
463 static gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
464 unload_perl_plugin(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
465 {
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
466 GaimPerlScript *gps = (GaimPerlScript *)plugin->info->extra_info;
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
467
9578
7cd7da72c872 [gaim-migrate @ 10421]
Christian Hammond <chipx86@chipx86.com>
parents: 8993
diff changeset
468 if (gps == NULL)
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
469 return FALSE;
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
470
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
471 gaim_debug(GAIM_DEBUG_INFO, "perl", "Unloading perl script\n");
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
472
9578
7cd7da72c872 [gaim-migrate @ 10421]
Christian Hammond <chipx86@chipx86.com>
parents: 8993
diff changeset
473 if (gps->unload_sub != NULL)
6536
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
474 {
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
475 dSP;
11318
519dc2186438 [gaim-migrate @ 13521]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11290
diff changeset
476 PERL_SET_CONTEXT(my_perl);
519dc2186438 [gaim-migrate @ 13521]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11290
diff changeset
477 SPAGAIN;
6536
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
478 ENTER;
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
479 SAVETMPS;
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
480 PUSHMARK(sp);
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
481 XPUSHs(sv_2mortal(gaim_perl_bless_object(plugin, "Gaim::Plugin")));
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
482 PUTBACK;
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
483
6536
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
484 perl_call_pv(gps->unload_sub, G_EVAL | G_SCALAR);
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
485 SPAGAIN;
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
486
6536
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
487 if (SvTRUE(ERRSV)) {
6678
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents: 6636
diff changeset
488 STRLEN len;
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
489
6536
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
490 gaim_debug(GAIM_DEBUG_ERROR, "perl",
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
491 "Perl function %s exited abnormally: %s\n",
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
492 gps->load_sub, SvPV(ERRSV, len));
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
493 }
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
494
6536
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
495 PUTBACK;
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
496 FREETMPS;
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
497 LEAVE;
9767117bc47e [gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents: 6531
diff changeset
498 }
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
499
6549
ed796f756237 [gaim-migrate @ 7071]
Christian Hammond <chipx86@chipx86.com>
parents: 6536
diff changeset
500 gaim_perl_signal_clear_for_plugin(plugin);
6522
0c5233faceb8 [gaim-migrate @ 7039]
Christian Hammond <chipx86@chipx86.com>
parents: 6520
diff changeset
501 gaim_perl_timeout_clear_for_plugin(plugin);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
502
6636
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
503 destroy_package(gps->package);
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
504
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
505 return TRUE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
506 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
507
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
508 static void
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
509 destroy_perl_plugin(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
510 {
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
511 if (plugin->info != NULL)
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
512 {
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
513 GaimPerlScript *gps;
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
514
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
515 if (plugin->info->name != NULL)
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
516 g_free(plugin->info->name);
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
517
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
518 if (plugin->info->version != NULL)
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
519 g_free(plugin->info->version);
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
520
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
521 if (plugin->info->summary != NULL)
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
522 g_free(plugin->info->summary);
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
523
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
524 if (plugin->info->description != NULL)
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
525 g_free(plugin->info->description);
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
526
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
527 if (plugin->info->author != NULL)
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
528 g_free(plugin->info->author);
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
529
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
530 if (plugin->info->homepage != NULL)
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
531 g_free(plugin->info->homepage);
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
532
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
533 gps = (GaimPerlScript *)plugin->info->extra_info;
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
534
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
535 if (gps != NULL)
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
536 {
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
537 if (gps->load_sub != NULL)
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
538 g_free(gps->load_sub);
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
539
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
540 if (gps->unload_sub != NULL)
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
541 g_free(gps->unload_sub);
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
542
6636
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
543 if (gps->package != NULL)
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
544 g_free(gps->package);
452c62a92963 [gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents: 6575
diff changeset
545
6508
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
546 g_free(gps);
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
547 plugin->info->extra_info = NULL;
cbd24b37350d [gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
548 }
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
549 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
550 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
551
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
552 static gboolean
11033
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 9943
diff changeset
553 plugin_load(GaimPlugin *plugin)
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 9943
diff changeset
554 {
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 9943
diff changeset
555 return TRUE;
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 9943
diff changeset
556 }
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 9943
diff changeset
557
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 9943
diff changeset
558 static gboolean
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
559 plugin_unload(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
560 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
561 perl_end();
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
562
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
563 return TRUE;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
564 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
565
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
566 static GaimPluginLoaderInfo loader_info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
567 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
568 NULL, /**< exts */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
569 probe_perl_plugin, /**< probe */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
570 load_perl_plugin, /**< load */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
571 unload_perl_plugin, /**< unload */
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
572 destroy_perl_plugin /**< destroy */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
573 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
574
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
575 static GaimPluginInfo info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
576 {
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9578
diff changeset
577 GAIM_PLUGIN_MAGIC,
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9578
diff changeset
578 GAIM_MAJOR_VERSION,
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9578
diff changeset
579 GAIM_MINOR_VERSION,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
580 GAIM_PLUGIN_LOADER, /**< type */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
581 NULL, /**< ui_requirement */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
582 0, /**< flags */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
583 NULL, /**< dependencies */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
584 GAIM_PRIORITY_DEFAULT, /**< priority */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
585
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
586 PERL_PLUGIN_ID, /**< id */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
587 N_("Perl Plugin Loader"), /**< name */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
588 VERSION, /**< version */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
589 N_("Provides support for loading perl plugins."), /**< summary */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
590 N_("Provides support for loading perl plugins."), /**< description */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
591 "Christian Hammond <chipx86@gnupdate.org>", /**< author */
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6235
diff changeset
592 GAIM_WEBSITE, /**< homepage */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
593
11033
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 9943
diff changeset
594 plugin_load, /**< load */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
595 plugin_unload, /**< unload */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
596 NULL, /**< destroy */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
597
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
598 NULL, /**< ui_info */
8993
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8761
diff changeset
599 &loader_info, /**< extra_info */
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8761
diff changeset
600 NULL,
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8761
diff changeset
601 NULL
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
602 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
603
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
604 static void
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5775
diff changeset
605 init_plugin(GaimPlugin *plugin)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
606 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
607 loader_info.exts = g_list_append(loader_info.exts, "pl");
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
608 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
609
6063
5239a3b4ab33 [gaim-migrate @ 6513]
Nathan Walp <nwalp@pidgin.im>
parents: 6036
diff changeset
610 GAIM_INIT_PLUGIN(perl, init_plugin, info)