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