Thu, 13 Nov 2014 01:06:59 -0500
Merge with release-2.x.y
| 5205 | 1 | /* |
| 15884 | 2 | * purple |
| 5205 | 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 | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
16786
diff
changeset
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 5205 | 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 | ||
| 36 | #define group perl_group | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
37 | |
| 5205 | 38 | #ifdef _WIN32 |
| 39 | /* This took me an age to figure out.. without this __declspec(dllimport) | |
| 40 | * will be ignored. | |
| 41 | */ | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
42 | # define HASATTRIBUTE |
| 5205 | 43 | #endif |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
44 | |
| 5205 | 45 | #include <EXTERN.h> |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
46 | |
| 5205 | 47 | #ifndef _SEM_SEMUN_UNDEFINED |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
48 | # define HAS_UNION_SEMUN |
| 5205 | 49 | #endif |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
50 | |
|
35981
e8c02ea0800b
Backport warning fixes for perl from default
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
28642
diff
changeset
|
51 | #define SILENT_NO_TAINT_SUPPORT 0 |
|
e8c02ea0800b
Backport warning fixes for perl from default
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
28642
diff
changeset
|
52 | #define NO_TAINT_SUPPORT 0 |
|
e8c02ea0800b
Backport warning fixes for perl from default
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
28642
diff
changeset
|
53 | |
| 5205 | 54 | #include <perl.h> |
| 55 | #include <XSUB.h> | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
56 | |
| 5205 | 57 | #ifndef _WIN32 |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
58 | # include <sys/mman.h> |
| 5205 | 59 | #endif |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
60 | |
| 5205 | 61 | #undef PACKAGE |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
62 | |
| 5205 | 63 | #ifndef _WIN32 |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
64 | # include <dirent.h> |
| 5205 | 65 | #else |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
66 | /* We're using perl's win32 port of this */ |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
67 | # define dirent direct |
| 5205 | 68 | #endif |
| 69 | ||
| 70 | #undef group | |
| 71 | ||
| 72 | /* perl module support */ | |
|
23915
b62601fd6e7d
Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <datallah@pidgin.im>
parents:
20288
diff
changeset
|
73 | #ifdef _WIN32 |
|
b62601fd6e7d
Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <datallah@pidgin.im>
parents:
20288
diff
changeset
|
74 | EXTERN_C void boot_Win32CORE (pTHX_ CV* cv); |
|
b62601fd6e7d
Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <datallah@pidgin.im>
parents:
20288
diff
changeset
|
75 | #endif |
|
b62601fd6e7d
Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <datallah@pidgin.im>
parents:
20288
diff
changeset
|
76 | |
| 5205 | 77 | #ifdef OLD_PERL |
| 78 | extern void boot_DynaLoader _((CV * cv)); | |
| 79 | #else | |
| 80 | extern void boot_DynaLoader _((pTHX_ CV * cv)); /* perl is so wacky */ | |
| 81 | #endif | |
| 82 | ||
| 83 | #undef _ | |
| 84 | #ifdef DEBUG | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
85 | # undef DEBUG |
| 5205 | 86 | #endif |
| 87 | #ifdef _WIN32 | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
88 | # undef pipe |
| 5205 | 89 | #endif |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
90 | |
|
6575
fdb1928afdf9
[gaim-migrate @ 7097]
Herman Bloggs <herman@bluedigits.com>
parents:
6549
diff
changeset
|
91 | #ifdef _WIN32 |
|
fdb1928afdf9
[gaim-migrate @ 7097]
Herman Bloggs <herman@bluedigits.com>
parents:
6549
diff
changeset
|
92 | #define _WIN32DEP_H_ |
|
fdb1928afdf9
[gaim-migrate @ 7097]
Herman Bloggs <herman@bluedigits.com>
parents:
6549
diff
changeset
|
93 | #endif |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
94 | #include "internal.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5775
diff
changeset
|
95 | #include "debug.h" |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
96 | #include "plugin.h" |
|
6531
3fca41d7b411
[gaim-migrate @ 7048]
Christian Hammond <chipx86@chipx86.com>
parents:
6527
diff
changeset
|
97 | #include "signals.h" |
| 9943 | 98 | #include "version.h" |
| 5205 | 99 | |
|
6526
c6c3f10519ab
[gaim-migrate @ 7043]
Christian Hammond <chipx86@chipx86.com>
parents:
6525
diff
changeset
|
100 | #include "perl-common.h" |
|
6522
e7d94240fc71
[gaim-migrate @ 7039]
Christian Hammond <chipx86@chipx86.com>
parents:
6520
diff
changeset
|
101 | #include "perl-handlers.h" |
|
e7d94240fc71
[gaim-migrate @ 7039]
Christian Hammond <chipx86@chipx86.com>
parents:
6520
diff
changeset
|
102 | |
|
16529
1d0da9270ff9
This is mostly moving Purple::GtkUI:: -> Pidgin:: which has the side effect of
Etan Reisner <deryni@pidgin.im>
parents:
16528
diff
changeset
|
103 | #include <gmodule.h> |
|
1d0da9270ff9
This is mostly moving Purple::GtkUI:: -> Pidgin:: which has the side effect of
Etan Reisner <deryni@pidgin.im>
parents:
16528
diff
changeset
|
104 | |
| 5205 | 105 | #define PERL_PLUGIN_ID "core-perl" |
| 106 | ||
| 12872 | 107 | PerlInterpreter *my_perl = NULL; |
| 108 | ||
|
33906
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
109 | struct _PurplePerlInfoStrings |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
110 | { |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
111 | char *name; |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
112 | char *id; |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
113 | char *homepage; |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
114 | char *author; |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
115 | char *summary; |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
116 | char *description; |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
117 | char *version; |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
118 | }; |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
119 | |
| 15884 | 120 | static PurplePluginUiInfo ui_info = |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
121 | { |
| 15884 | 122 | purple_perl_get_plugin_frame, |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
123 | NULL, |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
124 | |
|
16786
65c04c7e5c8a
Add padding to structs as necessary to silence compiler warnings
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16750
diff
changeset
|
125 | /* Padding */ |
|
65c04c7e5c8a
Add padding to structs as necessary to silence compiler warnings
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16750
diff
changeset
|
126 | NULL, |
|
65c04c7e5c8a
Add padding to structs as necessary to silence compiler warnings
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16750
diff
changeset
|
127 | NULL, |
|
65c04c7e5c8a
Add padding to structs as necessary to silence compiler warnings
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16750
diff
changeset
|
128 | NULL, |
|
65c04c7e5c8a
Add padding to structs as necessary to silence compiler warnings
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16750
diff
changeset
|
129 | NULL |
| 12872 | 130 | }; |
| 5205 | 131 | |
| 15884 | 132 | #ifdef PURPLE_GTKPERL |
| 133 | static PurpleGtkPluginUiInfo gtk_ui_info = | |
| 12872 | 134 | { |
| 15884 | 135 | purple_perl_gtk_get_plugin_frame, |
| 12872 | 136 | 0 /* page_num (Reserved) */ |
| 137 | }; | |
|
14426
8d4f164c4979
[gaim-migrate @ 17070]
Daniel Atallah <datallah@pidgin.im>
parents:
14254
diff
changeset
|
138 | #endif |
| 5205 | 139 | |
|
33906
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
140 | static void perl_infostrings_free(PurplePerlInfoStrings *info_strings) |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
141 | { |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
142 | if (info_strings == NULL) |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
143 | return; |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
144 | |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
145 | g_free(info_strings->name); |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
146 | g_free(info_strings->id); |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
147 | g_free(info_strings->homepage); |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
148 | g_free(info_strings->author); |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
149 | g_free(info_strings->summary); |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
150 | g_free(info_strings->description); |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
151 | g_free(info_strings->version); |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
152 | g_free(info_strings); |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
153 | } |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
154 | |
| 5205 | 155 | static void |
| 156 | #ifdef OLD_PERL | |
| 157 | xs_init() | |
| 158 | #else | |
| 159 | xs_init(pTHX) | |
| 160 | #endif | |
| 161 | { | |
| 162 | char *file = __FILE__; | |
|
27584
134e07aa6f64
Install the Purple and Pidgin perl modules under $libdir instead of in perl's
Etan Reisner <deryni@pidgin.im>
parents:
24241
diff
changeset
|
163 | GList *search_paths = purple_plugins_get_search_paths(); |
|
23915
b62601fd6e7d
Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <datallah@pidgin.im>
parents:
20288
diff
changeset
|
164 | dXSUB_SYS; |
| 5205 | 165 | |
| 12873 | 166 | /* This one allows dynamic loading of perl modules in perl scripts by |
| 167 | * the 'use perlmod;' construction */ | |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
168 | newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); |
|
23915
b62601fd6e7d
Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <datallah@pidgin.im>
parents:
20288
diff
changeset
|
169 | #ifdef _WIN32 |
|
b62601fd6e7d
Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <datallah@pidgin.im>
parents:
20288
diff
changeset
|
170 | newXS("Win32CORE::bootstrap", boot_Win32CORE, file); |
|
b62601fd6e7d
Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <datallah@pidgin.im>
parents:
20288
diff
changeset
|
171 | #endif |
|
27584
134e07aa6f64
Install the Purple and Pidgin perl modules under $libdir instead of in perl's
Etan Reisner <deryni@pidgin.im>
parents:
24241
diff
changeset
|
172 | |
|
134e07aa6f64
Install the Purple and Pidgin perl modules under $libdir instead of in perl's
Etan Reisner <deryni@pidgin.im>
parents:
24241
diff
changeset
|
173 | while (search_paths != NULL) { |
|
134e07aa6f64
Install the Purple and Pidgin perl modules under $libdir instead of in perl's
Etan Reisner <deryni@pidgin.im>
parents:
24241
diff
changeset
|
174 | gchar *uselib; |
|
134e07aa6f64
Install the Purple and Pidgin perl modules under $libdir instead of in perl's
Etan Reisner <deryni@pidgin.im>
parents:
24241
diff
changeset
|
175 | const gchar *search_path = search_paths->data; |
|
134e07aa6f64
Install the Purple and Pidgin perl modules under $libdir instead of in perl's
Etan Reisner <deryni@pidgin.im>
parents:
24241
diff
changeset
|
176 | search_paths = g_list_next(search_paths); |
|
134e07aa6f64
Install the Purple and Pidgin perl modules under $libdir instead of in perl's
Etan Reisner <deryni@pidgin.im>
parents:
24241
diff
changeset
|
177 | |
|
27664
f237942129f0
This seems to work better on Windows, what with the spaces in the path and the
Etan Reisner <deryni@pidgin.im>
parents:
27584
diff
changeset
|
178 | uselib = g_strdup_printf("unshift @INC, q(%s%sperl);", |
|
f237942129f0
This seems to work better on Windows, what with the spaces in the path and the
Etan Reisner <deryni@pidgin.im>
parents:
27584
diff
changeset
|
179 | search_path, G_DIR_SEPARATOR_S); |
|
27584
134e07aa6f64
Install the Purple and Pidgin perl modules under $libdir instead of in perl's
Etan Reisner <deryni@pidgin.im>
parents:
24241
diff
changeset
|
180 | eval_pv(uselib, TRUE); |
|
134e07aa6f64
Install the Purple and Pidgin perl modules under $libdir instead of in perl's
Etan Reisner <deryni@pidgin.im>
parents:
24241
diff
changeset
|
181 | g_free(uselib); |
|
134e07aa6f64
Install the Purple and Pidgin perl modules under $libdir instead of in perl's
Etan Reisner <deryni@pidgin.im>
parents:
24241
diff
changeset
|
182 | } |
| 5205 | 183 | } |
| 184 | ||
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
185 | static void |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
186 | perl_init(void) |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
187 | { |
| 12873 | 188 | /* changed the name of the variable from load_file to perl_definitions |
| 189 | * since now it does much more than defining the load_file sub. | |
| 190 | * Moreover, deplaced the initialisation to the xs_init function. | |
| 191 | * (TheHobbit) */ | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
192 | char *perl_args[] = { "", "-e", "0", "-w" }; |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
193 | char perl_definitions[] = |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
194 | { |
| 12873 | 195 | /* We use to function one to load a file the other to execute |
| 196 | * the string obtained from the first and holding the file | |
| 197 | * contents. This allows to have a really local $/ without | |
| 198 | * introducing temp variables to hold the old value. Just a | |
| 199 | * question of style:) */ | |
| 15884 | 200 | "package Purple::PerlLoader;" |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
201 | "use Symbol;" |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
202 | |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
203 | "sub load_file {" |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
204 | "my $f_name=shift;" |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
205 | "local $/=undef;" |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
206 | "open FH,$f_name or return \"__FAILED__\";" |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
207 | "$_=<FH>;" |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
208 | "close FH;" |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
209 | "return $_;" |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
210 | "}" |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
211 | |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
212 | "sub destroy_package {" |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
213 | "eval { $_[0]->UNLOAD() if $_[0]->can('UNLOAD'); };" |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
214 | "Symbol::delete_package($_[0]);" |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
215 | "}" |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
216 | |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
217 | "sub load_n_eval {" |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
218 | "my ($f_name, $package) = @_;" |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
219 | "destroy_package($package);" |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
220 | "my $strin=load_file($f_name);" |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
221 | "return 2 if($strin eq \"__FAILED__\");" |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
222 | "my $eval = qq{package $package; $strin;};" |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
223 | |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
224 | "{" |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
225 | " eval $eval;" |
|
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 | |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
228 | "if($@) {" |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
229 | /*" #something went wrong\n"*/ |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
230 | "die(\"Errors loading file $f_name: $@\");" |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
231 | "}" |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
232 | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
233 | "return 0;" |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
234 | "}" |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
235 | }; |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
236 | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
237 | my_perl = perl_alloc(); |
| 12871 | 238 | PERL_SET_CONTEXT(my_perl); |
| 11290 | 239 | PL_perl_destruct_level = 1; |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
240 | perl_construct(my_perl); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
241 | #ifdef DEBUG |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
242 | perl_parse(my_perl, xs_init, 4, perl_args, NULL); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
243 | #else |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
244 | perl_parse(my_perl, xs_init, 3, perl_args, NULL); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
245 | #endif |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
246 | #ifdef HAVE_PERL_EVAL_PV |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
247 | eval_pv(perl_definitions, TRUE); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
248 | #else |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
249 | perl_eval_pv(perl_definitions, TRUE); /* deprecated */ |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
250 | #endif |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
251 | perl_run(my_perl); |
| 5205 | 252 | } |
| 253 | ||
| 254 | static void | |
| 255 | perl_end(void) | |
| 256 | { | |
|
6520
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
257 | if (my_perl == NULL) |
|
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
258 | return; |
| 12871 | 259 | |
| 11290 | 260 | PL_perl_destruct_level = 1; |
| 12873 | 261 | PERL_SET_CONTEXT(my_perl); |
|
6520
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
262 | perl_eval_pv( |
|
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
263 | "foreach my $lib (@DynaLoader::dl_modules) {" |
| 15884 | 264 | "if ($lib =~ /^Purple\\b/) {" |
|
6520
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
265 | "$lib .= '::deinit();';" |
|
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
266 | "eval $lib;" |
|
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
267 | "}" |
|
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
268 | "}", |
|
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
269 | TRUE); |
|
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
270 | |
| 11290 | 271 | PL_perl_destruct_level = 1; |
| 12871 | 272 | PERL_SET_CONTEXT(my_perl); |
|
6520
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
273 | perl_destruct(my_perl); |
|
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
274 | perl_free(my_perl); |
|
5386692555c9
[gaim-migrate @ 7037]
Christian Hammond <chipx86@chipx86.com>
parents:
6508
diff
changeset
|
275 | my_perl = NULL; |
| 5205 | 276 | } |
| 277 | ||
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
278 | void |
| 15884 | 279 | purple_perl_callXS(void (*subaddr)(pTHX_ CV *cv), CV *cv, SV **mark) |
| 5205 | 280 | { |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
281 | dSP; |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
282 | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
283 | PUSHMARK(mark); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
284 | (*subaddr)(aTHX_ cv); |
| 5205 | 285 | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
286 | PUTBACK; |
| 5205 | 287 | } |
| 288 | ||
| 289 | static gboolean | |
| 15884 | 290 | probe_perl_plugin(PurplePlugin *plugin) |
| 5205 | 291 | { |
| 12871 | 292 | |
|
23915
b62601fd6e7d
Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <datallah@pidgin.im>
parents:
20288
diff
changeset
|
293 | char *args[] = {"", plugin->path }; |
|
b62601fd6e7d
Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <datallah@pidgin.im>
parents:
20288
diff
changeset
|
294 | char **argv = args; |
|
23932
806fd6e850ed
Add error handling for visiblity to why Perl plugins fail to load.
Daniel Atallah <datallah@pidgin.im>
parents:
23930
diff
changeset
|
295 | int argc = 2, ret; |
|
23915
b62601fd6e7d
Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <datallah@pidgin.im>
parents:
20288
diff
changeset
|
296 | PerlInterpreter *prober; |
| 5205 | 297 | gboolean status = TRUE; |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
298 | HV *plugin_info; |
|
23915
b62601fd6e7d
Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <datallah@pidgin.im>
parents:
20288
diff
changeset
|
299 | |
|
b62601fd6e7d
Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <datallah@pidgin.im>
parents:
20288
diff
changeset
|
300 | PERL_SYS_INIT(&argc, &argv); |
|
b62601fd6e7d
Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <datallah@pidgin.im>
parents:
20288
diff
changeset
|
301 | |
|
b62601fd6e7d
Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <datallah@pidgin.im>
parents:
20288
diff
changeset
|
302 | /* XXX This would be much faster if we didn't create a new |
|
b62601fd6e7d
Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <datallah@pidgin.im>
parents:
20288
diff
changeset
|
303 | * PerlInterpreter every time we probe a plugin */ |
|
b62601fd6e7d
Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <datallah@pidgin.im>
parents:
20288
diff
changeset
|
304 | prober = perl_alloc(); |
|
b62601fd6e7d
Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <datallah@pidgin.im>
parents:
20288
diff
changeset
|
305 | |
| 12871 | 306 | PERL_SET_CONTEXT(prober); |
|
23915
b62601fd6e7d
Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <datallah@pidgin.im>
parents:
20288
diff
changeset
|
307 | |
| 11290 | 308 | PL_perl_destruct_level = 1; |
| 5205 | 309 | perl_construct(prober); |
| 11290 | 310 | |
|
23917
8555374207d8
Fix output redirection for perl plugins on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
23915
diff
changeset
|
311 | /* Fix IO redirection to match where pidgin's is going. |
|
8555374207d8
Fix output redirection for perl plugins on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
23915
diff
changeset
|
312 | * Without this, we lose stdout/stderr unless we redirect to a file */ |
|
8555374207d8
Fix output redirection for perl plugins on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
23915
diff
changeset
|
313 | #ifdef _WIN32 |
|
8555374207d8
Fix output redirection for perl plugins on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
23915
diff
changeset
|
314 | { |
|
8555374207d8
Fix output redirection for perl plugins on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
23915
diff
changeset
|
315 | PerlIO* newprlIO = PerlIO_open("CONOUT$", "w"); |
|
8555374207d8
Fix output redirection for perl plugins on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
23915
diff
changeset
|
316 | if (newprlIO) { |
|
8555374207d8
Fix output redirection for perl plugins on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
23915
diff
changeset
|
317 | int stdout_fd = PerlIO_fileno(PerlIO_stdout()); |
|
8555374207d8
Fix output redirection for perl plugins on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
23915
diff
changeset
|
318 | int stderr_fd = PerlIO_fileno(PerlIO_stderr()); |
|
8555374207d8
Fix output redirection for perl plugins on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
23915
diff
changeset
|
319 | PerlIO_close(PerlIO_stdout()); |
|
8555374207d8
Fix output redirection for perl plugins on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
23915
diff
changeset
|
320 | PerlIO_close(PerlIO_stderr()); |
|
8555374207d8
Fix output redirection for perl plugins on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
23915
diff
changeset
|
321 | PerlLIO_dup2(PerlIO_fileno(newprlIO), stdout_fd); |
|
8555374207d8
Fix output redirection for perl plugins on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
23915
diff
changeset
|
322 | PerlLIO_dup2(PerlIO_fileno(newprlIO), stderr_fd); |
|
8555374207d8
Fix output redirection for perl plugins on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
23915
diff
changeset
|
323 | |
|
8555374207d8
Fix output redirection for perl plugins on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
23915
diff
changeset
|
324 | PerlIO_close(newprlIO); |
|
8555374207d8
Fix output redirection for perl plugins on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
23915
diff
changeset
|
325 | } |
|
8555374207d8
Fix output redirection for perl plugins on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
23915
diff
changeset
|
326 | } |
|
8555374207d8
Fix output redirection for perl plugins on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
23915
diff
changeset
|
327 | #endif |
|
8555374207d8
Fix output redirection for perl plugins on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
23915
diff
changeset
|
328 | |
|
23932
806fd6e850ed
Add error handling for visiblity to why Perl plugins fail to load.
Daniel Atallah <datallah@pidgin.im>
parents:
23930
diff
changeset
|
329 | ret = perl_parse(prober, xs_init, argc, argv, NULL); |
|
806fd6e850ed
Add error handling for visiblity to why Perl plugins fail to load.
Daniel Atallah <datallah@pidgin.im>
parents:
23930
diff
changeset
|
330 | |
|
806fd6e850ed
Add error handling for visiblity to why Perl plugins fail to load.
Daniel Atallah <datallah@pidgin.im>
parents:
23930
diff
changeset
|
331 | if (ret != 0) { |
|
806fd6e850ed
Add error handling for visiblity to why Perl plugins fail to load.
Daniel Atallah <datallah@pidgin.im>
parents:
23930
diff
changeset
|
332 | const char * errmsg = "Unknown error"; |
|
806fd6e850ed
Add error handling for visiblity to why Perl plugins fail to load.
Daniel Atallah <datallah@pidgin.im>
parents:
23930
diff
changeset
|
333 | if (SvTRUE(ERRSV)) |
|
23980
a38cbb35eecf
Some cleanup and a couple leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
23932
diff
changeset
|
334 | errmsg = SvPVutf8_nolen(ERRSV); |
|
23932
806fd6e850ed
Add error handling for visiblity to why Perl plugins fail to load.
Daniel Atallah <datallah@pidgin.im>
parents:
23930
diff
changeset
|
335 | purple_debug_error("perl", "Unable to parse plugin %s (%d:%s)\n", |
|
806fd6e850ed
Add error handling for visiblity to why Perl plugins fail to load.
Daniel Atallah <datallah@pidgin.im>
parents:
23930
diff
changeset
|
336 | plugin->path, ret, errmsg); |
|
23980
a38cbb35eecf
Some cleanup and a couple leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
23932
diff
changeset
|
337 | status = FALSE; |
|
23932
806fd6e850ed
Add error handling for visiblity to why Perl plugins fail to load.
Daniel Atallah <datallah@pidgin.im>
parents:
23930
diff
changeset
|
338 | goto cleanup; |
|
806fd6e850ed
Add error handling for visiblity to why Perl plugins fail to load.
Daniel Atallah <datallah@pidgin.im>
parents:
23930
diff
changeset
|
339 | } |
| 11290 | 340 | |
|
23932
806fd6e850ed
Add error handling for visiblity to why Perl plugins fail to load.
Daniel Atallah <datallah@pidgin.im>
parents:
23930
diff
changeset
|
341 | ret = perl_run(prober); |
|
806fd6e850ed
Add error handling for visiblity to why Perl plugins fail to load.
Daniel Atallah <datallah@pidgin.im>
parents:
23930
diff
changeset
|
342 | |
|
806fd6e850ed
Add error handling for visiblity to why Perl plugins fail to load.
Daniel Atallah <datallah@pidgin.im>
parents:
23930
diff
changeset
|
343 | if (ret != 0) { |
|
806fd6e850ed
Add error handling for visiblity to why Perl plugins fail to load.
Daniel Atallah <datallah@pidgin.im>
parents:
23930
diff
changeset
|
344 | const char * errmsg = "Unknown error"; |
|
806fd6e850ed
Add error handling for visiblity to why Perl plugins fail to load.
Daniel Atallah <datallah@pidgin.im>
parents:
23930
diff
changeset
|
345 | if (SvTRUE(ERRSV)) |
|
23980
a38cbb35eecf
Some cleanup and a couple leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
23932
diff
changeset
|
346 | errmsg = SvPVutf8_nolen(ERRSV); |
|
23932
806fd6e850ed
Add error handling for visiblity to why Perl plugins fail to load.
Daniel Atallah <datallah@pidgin.im>
parents:
23930
diff
changeset
|
347 | purple_debug_error("perl", "Unable to run perl interpreter on plugin %s (%d:%s)\n", |
|
806fd6e850ed
Add error handling for visiblity to why Perl plugins fail to load.
Daniel Atallah <datallah@pidgin.im>
parents:
23930
diff
changeset
|
348 | plugin->path, ret, errmsg); |
|
23980
a38cbb35eecf
Some cleanup and a couple leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
23932
diff
changeset
|
349 | status = FALSE; |
|
23932
806fd6e850ed
Add error handling for visiblity to why Perl plugins fail to load.
Daniel Atallah <datallah@pidgin.im>
parents:
23930
diff
changeset
|
350 | goto cleanup; |
|
806fd6e850ed
Add error handling for visiblity to why Perl plugins fail to load.
Daniel Atallah <datallah@pidgin.im>
parents:
23930
diff
changeset
|
351 | } |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
352 | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
353 | plugin_info = perl_get_hv("PLUGIN_INFO", FALSE); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
354 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
355 | if (plugin_info == NULL) |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
356 | status = FALSE; |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
357 | else if (!hv_exists(plugin_info, "perl_api_version", |
| 12871 | 358 | strlen("perl_api_version")) || |
| 359 | !hv_exists(plugin_info, "name", strlen("name")) || | |
| 360 | !hv_exists(plugin_info, "load", strlen("load"))) { | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
361 | /* Not a valid plugin. */ |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
362 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
363 | status = FALSE; |
| 12871 | 364 | } else { |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
365 | SV **key; |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
366 | int perl_api_ver; |
| 5205 | 367 | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
368 | key = hv_fetch(plugin_info, "perl_api_version", |
| 12873 | 369 | strlen("perl_api_version"), 0); |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
370 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
371 | perl_api_ver = SvIV(*key); |
| 5205 | 372 | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
373 | if (perl_api_ver != 2) |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
374 | status = FALSE; |
| 12871 | 375 | else { |
| 15884 | 376 | PurplePluginInfo *info; |
| 377 | PurplePerlScript *gps; | |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
378 | char *basename; |
| 5205 | 379 | |
| 15884 | 380 | info = g_new0(PurplePluginInfo, 1); |
| 381 | gps = g_new0(PurplePerlScript, 1); | |
|
33906
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
382 | gps->info_strings = g_new0(PurplePerlInfoStrings, 1); |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
383 | |
| 15884 | 384 | info->magic = PURPLE_PLUGIN_MAGIC; |
| 385 | info->major_version = PURPLE_MAJOR_VERSION; | |
| 386 | info->minor_version = PURPLE_MINOR_VERSION; | |
| 387 | info->type = PURPLE_PLUGIN_STANDARD; | |
| 5205 | 388 | |
| 389 | info->dependencies = g_list_append(info->dependencies, | |
| 12871 | 390 | PERL_PLUGIN_ID); |
| 5205 | 391 | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
392 | gps->plugin = plugin; |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
393 | |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
394 | basename = g_path_get_basename(plugin->path); |
| 15884 | 395 | purple_perl_normalize_script_name(basename); |
| 396 | gps->package = g_strdup_printf("Purple::Script::%s", | |
| 12871 | 397 | basename); |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
398 | g_free(basename); |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
399 | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
400 | /* We know this one exists. */ |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
401 | key = hv_fetch(plugin_info, "name", strlen("name"), 0); |
|
33906
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
402 | info->name = gps->info_strings->name = g_strdup(SvPVutf8_nolen(*key)); |
| 12984 | 403 | /* Set id here in case we don't find one later. */ |
|
33906
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
404 | info->id = gps->info_strings->id = g_strdup(info->name); |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
405 | |
| 15884 | 406 | #ifdef PURPLE_GTKPERL |
| 12871 | 407 | if ((key = hv_fetch(plugin_info, "GTK_UI", |
| 408 | strlen("GTK_UI"), 0))) | |
| 15884 | 409 | info->ui_requirement = PURPLE_GTK_PLUGIN_TYPE; |
| 14434 | 410 | #endif |
| 11170 | 411 | |
| 12871 | 412 | if ((key = hv_fetch(plugin_info, "url", |
| 413 | strlen("url"), 0))) | |
|
33906
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
414 | info->homepage = gps->info_strings->homepage = g_strdup(SvPVutf8_nolen(*key)); |
| 12873 | 415 | |
| 12871 | 416 | if ((key = hv_fetch(plugin_info, "author", |
| 417 | strlen("author"), 0))) | |
|
33906
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
418 | info->author = gps->info_strings->author = g_strdup(SvPVutf8_nolen(*key)); |
| 5205 | 419 | |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
420 | if ((key = hv_fetch(plugin_info, "summary", |
| 12871 | 421 | strlen("summary"), 0))) |
|
33906
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
422 | info->summary = gps->info_strings->summary = g_strdup(SvPVutf8_nolen(*key)); |
|
6508
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 | if ((key = hv_fetch(plugin_info, "description", |
| 12871 | 425 | strlen("description"), 0))) |
|
33906
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
426 | info->description = gps->info_strings->description = g_strdup(SvPVutf8_nolen(*key)); |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
427 | |
| 12871 | 428 | if ((key = hv_fetch(plugin_info, "version", |
| 429 | strlen("version"), 0))) | |
|
33906
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
430 | info->version = gps->info_strings->version = g_strdup(SvPVutf8_nolen(*key)); |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
431 | |
| 12984 | 432 | /* We know this one exists. */ |
| 433 | key = hv_fetch(plugin_info, "load", strlen("load"), 0); | |
| 434 | gps->load_sub = g_strdup_printf("%s::%s", gps->package, | |
|
23980
a38cbb35eecf
Some cleanup and a couple leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
23932
diff
changeset
|
435 | SvPVutf8_nolen(*key)); |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
436 | |
| 12871 | 437 | if ((key = hv_fetch(plugin_info, "unload", |
| 438 | strlen("unload"), 0))) | |
| 439 | gps->unload_sub = g_strdup_printf("%s::%s", | |
| 440 | gps->package, | |
|
23980
a38cbb35eecf
Some cleanup and a couple leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
23932
diff
changeset
|
441 | SvPVutf8_nolen(*key)); |
| 5205 | 442 | |
| 12984 | 443 | if ((key = hv_fetch(plugin_info, "id", |
| 444 | strlen("id"), 0))) { | |
|
33906
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
445 | g_free(gps->info_strings->id); |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
446 | info->id = gps->info_strings->id = g_strdup_printf("perl-%s", |
|
23980
a38cbb35eecf
Some cleanup and a couple leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
23932
diff
changeset
|
447 | SvPVutf8_nolen(*key)); |
| 12984 | 448 | } |
| 449 | ||
| 12871 | 450 | /********************************************************/ |
| 451 | /* Only one of the next two options should be present */ | |
| 452 | /* */ | |
| 15884 | 453 | /* prefs_info - Uses non-GUI (read GTK) purple API calls */ |
| 454 | /* and creates a PurplePluginPrefInfo type. */ | |
| 12871 | 455 | /* */ |
| 456 | /* gtk_prefs_info - Requires gtk2-perl be installed by */ | |
| 12873 | 457 | /* the user and he must create a */ |
| 458 | /* GtkWidget the user and he must */ | |
| 459 | /* create a GtkWidget representing the */ | |
| 460 | /* plugin preferences page. */ | |
| 12871 | 461 | /********************************************************/ |
| 462 | if ((key = hv_fetch(plugin_info, "prefs_info", | |
| 463 | strlen("prefs_info"), 0))) { | |
| 464 | /* key now is the name of the Perl sub that | |
| 465 | * will create a frame for us */ | |
| 12872 | 466 | gps->prefs_sub = g_strdup_printf("%s::%s", |
| 467 | gps->package, | |
|
23980
a38cbb35eecf
Some cleanup and a couple leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
23932
diff
changeset
|
468 | SvPVutf8_nolen(*key)); |
| 12872 | 469 | info->prefs_info = &ui_info; |
| 11123 | 470 | } |
| 12890 | 471 | |
| 15884 | 472 | #ifdef PURPLE_GTKPERL |
| 12871 | 473 | if ((key = hv_fetch(plugin_info, "gtk_prefs_info", |
| 474 | strlen("gtk_prefs_info"), 0))) { | |
| 475 | /* key now is the name of the Perl sub that | |
| 476 | * will create a frame for us */ | |
| 12872 | 477 | gps->gtk_prefs_sub = g_strdup_printf("%s::%s", |
| 478 | gps->package, | |
|
23980
a38cbb35eecf
Some cleanup and a couple leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
23932
diff
changeset
|
479 | SvPVutf8_nolen(*key)); |
| 12872 | 480 | info->ui_info = >k_ui_info; |
| 11170 | 481 | } |
|
14426
8d4f164c4979
[gaim-migrate @ 17070]
Daniel Atallah <datallah@pidgin.im>
parents:
14254
diff
changeset
|
482 | #endif |
| 11170 | 483 | |
| 12988 | 484 | if ((key = hv_fetch(plugin_info, "plugin_action_sub", |
| 485 | strlen("plugin_action_sub"), 0))) { | |
| 486 | gps->plugin_action_sub = g_strdup_printf("%s::%s", | |
| 487 | gps->package, | |
|
23980
a38cbb35eecf
Some cleanup and a couple leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
23932
diff
changeset
|
488 | SvPVutf8_nolen(*key)); |
| 15884 | 489 | info->actions = purple_perl_plugin_actions; |
| 11170 | 490 | } |
| 11123 | 491 | |
| 5205 | 492 | plugin->info = info; |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
493 | info->extra_info = gps; |
| 5205 | 494 | |
| 15884 | 495 | status = purple_plugin_register(plugin); |
| 5205 | 496 | } |
| 497 | } | |
| 12871 | 498 | |
|
23932
806fd6e850ed
Add error handling for visiblity to why Perl plugins fail to load.
Daniel Atallah <datallah@pidgin.im>
parents:
23930
diff
changeset
|
499 | cleanup: |
| 11290 | 500 | PL_perl_destruct_level = 1; |
| 12871 | 501 | PERL_SET_CONTEXT(prober); |
| 5205 | 502 | perl_destruct(prober); |
| 503 | perl_free(prober); | |
| 504 | return status; | |
| 505 | } | |
| 506 | ||
| 507 | static gboolean | |
| 15884 | 508 | load_perl_plugin(PurplePlugin *plugin) |
| 5205 | 509 | { |
| 15884 | 510 | PurplePerlScript *gps = (PurplePerlScript *)plugin->info->extra_info; |
|
24241
e6fc766f3e91
Return FALSE when a perl plugin cannot be loaded.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23980
diff
changeset
|
511 | gboolean loaded = TRUE; |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
512 | char *atmp[3] = { plugin->path, NULL, NULL }; |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
513 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
514 | if (gps == NULL || gps->load_sub == NULL) |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
515 | return FALSE; |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
516 | |
| 15884 | 517 | purple_debug(PURPLE_DEBUG_INFO, "perl", "Loading perl script\n"); |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
518 | |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
519 | if (my_perl == NULL) |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
520 | perl_init(); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
521 | |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
522 | plugin->handle = gps; |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
523 | |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
524 | atmp[1] = gps->package; |
| 12871 | 525 | |
| 526 | PERL_SET_CONTEXT(my_perl); | |
| 15884 | 527 | execute_perl("Purple::PerlLoader::load_n_eval", 2, atmp); |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
528 | |
|
6536
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
529 | { |
|
11318
13fa1d5134f3
[gaim-migrate @ 13521]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11290
diff
changeset
|
530 | dSP; |
| 11290 | 531 | PERL_SET_CONTEXT(my_perl); |
|
11318
13fa1d5134f3
[gaim-migrate @ 13521]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11290
diff
changeset
|
532 | SPAGAIN; |
|
6536
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
533 | ENTER; |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
534 | SAVETMPS; |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
535 | PUSHMARK(sp); |
| 15884 | 536 | XPUSHs(sv_2mortal(purple_perl_bless_object(plugin, |
| 537 | "Purple::Plugin"))); | |
|
6536
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
538 | PUTBACK; |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
539 | |
|
6536
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
540 | perl_call_pv(gps->load_sub, G_EVAL | G_SCALAR); |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
541 | SPAGAIN; |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
542 | |
|
6536
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
543 | if (SvTRUE(ERRSV)) { |
| 15884 | 544 | purple_debug(PURPLE_DEBUG_ERROR, "perl", |
| 12871 | 545 | "Perl function %s exited abnormally: %s\n", |
|
23980
a38cbb35eecf
Some cleanup and a couple leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
23932
diff
changeset
|
546 | gps->load_sub, SvPVutf8_nolen(ERRSV)); |
|
24241
e6fc766f3e91
Return FALSE when a perl plugin cannot be loaded.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23980
diff
changeset
|
547 | loaded = FALSE; |
|
6536
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
548 | } |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
549 | |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
550 | PUTBACK; |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
551 | FREETMPS; |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
552 | LEAVE; |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
553 | } |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
554 | |
|
24241
e6fc766f3e91
Return FALSE when a perl plugin cannot be loaded.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23980
diff
changeset
|
555 | return loaded; |
| 5205 | 556 | } |
| 557 | ||
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
558 | static void |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
559 | destroy_package(const char *package) |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
560 | { |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
561 | dSP; |
|
11318
13fa1d5134f3
[gaim-migrate @ 13521]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11290
diff
changeset
|
562 | PERL_SET_CONTEXT(my_perl); |
|
13fa1d5134f3
[gaim-migrate @ 13521]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11290
diff
changeset
|
563 | SPAGAIN; |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
564 | |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
565 | ENTER; |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
566 | SAVETMPS; |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
567 | |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
568 | PUSHMARK(SP); |
|
23980
a38cbb35eecf
Some cleanup and a couple leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
23932
diff
changeset
|
569 | XPUSHs(sv_2mortal(newSVpv(package, 0))); |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
570 | PUTBACK; |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
571 | |
| 15884 | 572 | perl_call_pv("Purple::PerlLoader::destroy_package", |
| 12871 | 573 | G_VOID | G_EVAL | G_DISCARD); |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
574 | |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
575 | SPAGAIN; |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
576 | |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
577 | PUTBACK; |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
578 | FREETMPS; |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
579 | LEAVE; |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
580 | } |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
581 | |
| 5205 | 582 | static gboolean |
| 15884 | 583 | unload_perl_plugin(PurplePlugin *plugin) |
| 5205 | 584 | { |
| 15884 | 585 | PurplePerlScript *gps = (PurplePerlScript *)plugin->info->extra_info; |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
586 | |
|
9578
d02c3d247fb7
[gaim-migrate @ 10421]
Christian Hammond <chipx86@chipx86.com>
parents:
8993
diff
changeset
|
587 | if (gps == NULL) |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
588 | return FALSE; |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
589 | |
| 15884 | 590 | purple_debug(PURPLE_DEBUG_INFO, "perl", "Unloading perl script\n"); |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
591 | |
| 12871 | 592 | if (gps->unload_sub != NULL) { |
|
6536
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
593 | dSP; |
|
11318
13fa1d5134f3
[gaim-migrate @ 13521]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11290
diff
changeset
|
594 | PERL_SET_CONTEXT(my_perl); |
|
13fa1d5134f3
[gaim-migrate @ 13521]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11290
diff
changeset
|
595 | SPAGAIN; |
|
6536
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
596 | ENTER; |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
597 | SAVETMPS; |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
598 | PUSHMARK(sp); |
| 15884 | 599 | XPUSHs(sv_2mortal(purple_perl_bless_object(plugin, |
| 600 | "Purple::Plugin"))); | |
|
6536
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
601 | PUTBACK; |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
602 | |
|
6536
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
603 | perl_call_pv(gps->unload_sub, G_EVAL | G_SCALAR); |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
604 | SPAGAIN; |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
605 | |
|
6536
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
606 | if (SvTRUE(ERRSV)) { |
| 15884 | 607 | purple_debug(PURPLE_DEBUG_ERROR, "perl", |
| 12871 | 608 | "Perl function %s exited abnormally: %s\n", |
|
23980
a38cbb35eecf
Some cleanup and a couple leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
23932
diff
changeset
|
609 | gps->unload_sub, SvPVutf8_nolen(ERRSV)); |
|
6536
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
610 | } |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
611 | |
|
6536
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
612 | PUTBACK; |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
613 | FREETMPS; |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
614 | LEAVE; |
|
b91ae5d45371
[gaim-migrate @ 7053]
Christian Hammond <chipx86@chipx86.com>
parents:
6531
diff
changeset
|
615 | } |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
616 | |
| 15884 | 617 | purple_perl_cmd_clear_for_plugin(plugin); |
| 618 | purple_perl_signal_clear_for_plugin(plugin); | |
| 619 | purple_perl_timeout_clear_for_plugin(plugin); | |
|
23930
c1c3d7cab338
Add support to the Perl plugin loader for listing for pref changes.
Daniel Atallah <datallah@pidgin.im>
parents:
23917
diff
changeset
|
620 | purple_perl_pref_cb_clear_for_plugin(plugin); |
| 5205 | 621 | |
|
6636
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
622 | destroy_package(gps->package); |
|
e906c663da5c
[gaim-migrate @ 7161]
Christian Hammond <chipx86@chipx86.com>
parents:
6575
diff
changeset
|
623 | |
| 5205 | 624 | return TRUE; |
| 625 | } | |
| 626 | ||
| 627 | static void | |
| 15884 | 628 | destroy_perl_plugin(PurplePlugin *plugin) |
| 5205 | 629 | { |
| 12873 | 630 | if (plugin->info != NULL) { |
| 15884 | 631 | PurplePerlScript *gps; |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
632 | |
| 15884 | 633 | gps = (PurplePerlScript *)plugin->info->extra_info; |
| 12871 | 634 | if (gps != NULL) { |
|
33906
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
635 | perl_infostrings_free(gps->info_strings); |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
636 | gps->info_strings = NULL; |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
28642
diff
changeset
|
637 | |
|
23980
a38cbb35eecf
Some cleanup and a couple leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
23932
diff
changeset
|
638 | g_free(gps->package); |
| 12871 | 639 | g_free(gps->load_sub); |
| 640 | g_free(gps->unload_sub); | |
| 12872 | 641 | g_free(gps->prefs_sub); |
| 15884 | 642 | #ifdef PURPLE_GTKPERL |
| 12872 | 643 | g_free(gps->gtk_prefs_sub); |
|
14426
8d4f164c4979
[gaim-migrate @ 17070]
Daniel Atallah <datallah@pidgin.im>
parents:
14254
diff
changeset
|
644 | #endif |
|
23980
a38cbb35eecf
Some cleanup and a couple leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
23932
diff
changeset
|
645 | g_free(gps->plugin_action_sub); |
|
6508
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
646 | g_free(gps); |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
647 | plugin->info->extra_info = NULL; |
|
57d1df1ca3a0
[gaim-migrate @ 7025]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
648 | } |
|
28642
b23df5d1387e
Leak fix for perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27664
diff
changeset
|
649 | |
|
b23df5d1387e
Leak fix for perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27664
diff
changeset
|
650 | g_free(plugin->info); |
|
b23df5d1387e
Leak fix for perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27664
diff
changeset
|
651 | plugin->info = NULL; |
| 5205 | 652 | } |
| 653 | } | |
| 654 | ||
| 655 | static gboolean | |
| 15884 | 656 | plugin_load(PurplePlugin *plugin) |
| 11033 | 657 | { |
| 658 | return TRUE; | |
| 659 | } | |
| 660 | ||
| 661 | static gboolean | |
| 15884 | 662 | plugin_unload(PurplePlugin *plugin) |
| 5205 | 663 | { |
| 664 | perl_end(); | |
| 665 | ||
| 666 | return TRUE; | |
| 667 | } | |
| 668 | ||
| 15884 | 669 | static PurplePluginLoaderInfo loader_info = |
| 5205 | 670 | { |
| 671 | NULL, /**< exts */ | |
| 672 | probe_perl_plugin, /**< probe */ | |
| 673 | load_perl_plugin, /**< load */ | |
| 674 | unload_perl_plugin, /**< unload */ | |
|
16750
a568944eee52
Updating the loaders since I missed them since I'm not building any of them right now
Gary Kramlich <grim@reaperworld.com>
parents:
16529
diff
changeset
|
675 | destroy_perl_plugin, /**< destroy */ |
|
23915
b62601fd6e7d
Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <datallah@pidgin.im>
parents:
20288
diff
changeset
|
676 | |
|
16750
a568944eee52
Updating the loaders since I missed them since I'm not building any of them right now
Gary Kramlich <grim@reaperworld.com>
parents:
16529
diff
changeset
|
677 | /* padding */ |
|
a568944eee52
Updating the loaders since I missed them since I'm not building any of them right now
Gary Kramlich <grim@reaperworld.com>
parents:
16529
diff
changeset
|
678 | NULL, |
|
a568944eee52
Updating the loaders since I missed them since I'm not building any of them right now
Gary Kramlich <grim@reaperworld.com>
parents:
16529
diff
changeset
|
679 | NULL, |
|
a568944eee52
Updating the loaders since I missed them since I'm not building any of them right now
Gary Kramlich <grim@reaperworld.com>
parents:
16529
diff
changeset
|
680 | NULL, |
|
a568944eee52
Updating the loaders since I missed them since I'm not building any of them right now
Gary Kramlich <grim@reaperworld.com>
parents:
16529
diff
changeset
|
681 | NULL |
| 5205 | 682 | }; |
| 683 | ||
| 15884 | 684 | static PurplePluginInfo info = |
| 5205 | 685 | { |
| 15884 | 686 | PURPLE_PLUGIN_MAGIC, |
| 687 | PURPLE_MAJOR_VERSION, | |
| 688 | PURPLE_MINOR_VERSION, | |
|
16529
1d0da9270ff9
This is mostly moving Purple::GtkUI:: -> Pidgin:: which has the side effect of
Etan Reisner <deryni@pidgin.im>
parents:
16528
diff
changeset
|
689 | PURPLE_PLUGIN_LOADER, /**< type */ |
| 5205 | 690 | NULL, /**< ui_requirement */ |
| 691 | 0, /**< flags */ | |
| 692 | NULL, /**< dependencies */ | |
|
16529
1d0da9270ff9
This is mostly moving Purple::GtkUI:: -> Pidgin:: which has the side effect of
Etan Reisner <deryni@pidgin.im>
parents:
16528
diff
changeset
|
693 | PURPLE_PRIORITY_DEFAULT, /**< priority */ |
| 5205 | 694 | |
| 695 | PERL_PLUGIN_ID, /**< id */ | |
| 696 | N_("Perl Plugin Loader"), /**< name */ | |
|
20288
5ca925a094e2
applied changes from 03b709ec2a153e7e82719df0ba4635108bb1d3c6
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
697 | DISPLAY_VERSION, /**< version */ |
| 5205 | 698 | N_("Provides support for loading perl plugins."), /**< summary */ |
| 699 | N_("Provides support for loading perl plugins."), /**< description */ | |
| 700 | "Christian Hammond <chipx86@gnupdate.org>", /**< author */ | |
|
16529
1d0da9270ff9
This is mostly moving Purple::GtkUI:: -> Pidgin:: which has the side effect of
Etan Reisner <deryni@pidgin.im>
parents:
16528
diff
changeset
|
701 | PURPLE_WEBSITE, /**< homepage */ |
| 5205 | 702 | |
| 11033 | 703 | plugin_load, /**< load */ |
| 5205 | 704 | plugin_unload, /**< unload */ |
| 705 | NULL, /**< destroy */ | |
| 706 | ||
| 707 | NULL, /**< ui_info */ | |
| 8993 | 708 | &loader_info, /**< extra_info */ |
| 709 | NULL, | |
|
16750
a568944eee52
Updating the loaders since I missed them since I'm not building any of them right now
Gary Kramlich <grim@reaperworld.com>
parents:
16529
diff
changeset
|
710 | NULL, |
|
a568944eee52
Updating the loaders since I missed them since I'm not building any of them right now
Gary Kramlich <grim@reaperworld.com>
parents:
16529
diff
changeset
|
711 | |
|
a568944eee52
Updating the loaders since I missed them since I'm not building any of them right now
Gary Kramlich <grim@reaperworld.com>
parents:
16529
diff
changeset
|
712 | /* padding */ |
|
a568944eee52
Updating the loaders since I missed them since I'm not building any of them right now
Gary Kramlich <grim@reaperworld.com>
parents:
16529
diff
changeset
|
713 | NULL, |
|
a568944eee52
Updating the loaders since I missed them since I'm not building any of them right now
Gary Kramlich <grim@reaperworld.com>
parents:
16529
diff
changeset
|
714 | NULL, |
|
a568944eee52
Updating the loaders since I missed them since I'm not building any of them right now
Gary Kramlich <grim@reaperworld.com>
parents:
16529
diff
changeset
|
715 | NULL, |
| 8993 | 716 | NULL |
| 5205 | 717 | }; |
| 718 | ||
| 719 | static void | |
| 15884 | 720 | init_plugin(PurplePlugin *plugin) |
| 5205 | 721 | { |
| 722 | loader_info.exts = g_list_append(loader_info.exts, "pl"); | |
| 723 | } | |
| 724 | ||
|
16528
6cd4a90e0970
Kill the libpurpleperl hack library and move the init stuff to perl.so itself.
Etan Reisner <deryni@pidgin.im>
parents:
15884
diff
changeset
|
725 | #ifdef __SUNPRO_C |
|
6cd4a90e0970
Kill the libpurpleperl hack library and move the init stuff to perl.so itself.
Etan Reisner <deryni@pidgin.im>
parents:
15884
diff
changeset
|
726 | #pragma init (my_init) |
|
6cd4a90e0970
Kill the libpurpleperl hack library and move the init stuff to perl.so itself.
Etan Reisner <deryni@pidgin.im>
parents:
15884
diff
changeset
|
727 | #else |
|
6cd4a90e0970
Kill the libpurpleperl hack library and move the init stuff to perl.so itself.
Etan Reisner <deryni@pidgin.im>
parents:
15884
diff
changeset
|
728 | void __attribute__ ((constructor)) my_init(void); |
|
6cd4a90e0970
Kill the libpurpleperl hack library and move the init stuff to perl.so itself.
Etan Reisner <deryni@pidgin.im>
parents:
15884
diff
changeset
|
729 | #endif |
|
6cd4a90e0970
Kill the libpurpleperl hack library and move the init stuff to perl.so itself.
Etan Reisner <deryni@pidgin.im>
parents:
15884
diff
changeset
|
730 | |
|
6cd4a90e0970
Kill the libpurpleperl hack library and move the init stuff to perl.so itself.
Etan Reisner <deryni@pidgin.im>
parents:
15884
diff
changeset
|
731 | void |
|
6cd4a90e0970
Kill the libpurpleperl hack library and move the init stuff to perl.so itself.
Etan Reisner <deryni@pidgin.im>
parents:
15884
diff
changeset
|
732 | my_init(void) |
|
6cd4a90e0970
Kill the libpurpleperl hack library and move the init stuff to perl.so itself.
Etan Reisner <deryni@pidgin.im>
parents:
15884
diff
changeset
|
733 | { |
|
6cd4a90e0970
Kill the libpurpleperl hack library and move the init stuff to perl.so itself.
Etan Reisner <deryni@pidgin.im>
parents:
15884
diff
changeset
|
734 | /* Mostly evil hack... puts perl.so's symbols in the global table but |
|
6cd4a90e0970
Kill the libpurpleperl hack library and move the init stuff to perl.so itself.
Etan Reisner <deryni@pidgin.im>
parents:
15884
diff
changeset
|
735 | * does not create a circular dependency because g_module_open will |
|
6cd4a90e0970
Kill the libpurpleperl hack library and move the init stuff to perl.so itself.
Etan Reisner <deryni@pidgin.im>
parents:
15884
diff
changeset
|
736 | * only open the library once. */ |
|
6cd4a90e0970
Kill the libpurpleperl hack library and move the init stuff to perl.so itself.
Etan Reisner <deryni@pidgin.im>
parents:
15884
diff
changeset
|
737 | /* Do we need to keep track of the returned GModule here so that we |
|
6cd4a90e0970
Kill the libpurpleperl hack library and move the init stuff to perl.so itself.
Etan Reisner <deryni@pidgin.im>
parents:
15884
diff
changeset
|
738 | * can g_module_close it when this plugin gets unloaded? |
|
6cd4a90e0970
Kill the libpurpleperl hack library and move the init stuff to perl.so itself.
Etan Reisner <deryni@pidgin.im>
parents:
15884
diff
changeset
|
739 | * At the moment I don't think this plugin can ever get unloaded but |
|
6cd4a90e0970
Kill the libpurpleperl hack library and move the init stuff to perl.so itself.
Etan Reisner <deryni@pidgin.im>
parents:
15884
diff
changeset
|
740 | * in case that becomes possible this wants to get noted. */ |
|
6cd4a90e0970
Kill the libpurpleperl hack library and move the init stuff to perl.so itself.
Etan Reisner <deryni@pidgin.im>
parents:
15884
diff
changeset
|
741 | g_module_open("perl.so", 0); |
|
6cd4a90e0970
Kill the libpurpleperl hack library and move the init stuff to perl.so itself.
Etan Reisner <deryni@pidgin.im>
parents:
15884
diff
changeset
|
742 | } |
|
6cd4a90e0970
Kill the libpurpleperl hack library and move the init stuff to perl.so itself.
Etan Reisner <deryni@pidgin.im>
parents:
15884
diff
changeset
|
743 | |
| 15884 | 744 | PURPLE_INIT_PLUGIN(perl, init_plugin, info) |