Mercurial > pidgin.yaz
changeset 14364:338ac096e322
[gaim-migrate @ 17070]
Disabled GTK+ components of the Perl plugin (we'll no longer support gtk-perl prefs frames until this is refactored into a gtkgaim plugin somehow).
Fix gaim_util_fetch_url and plug some leaks.
I haven't successfully tested gaim_util_fetch_url from perl yet - it doesn't seem to actually pass the retrieved text to the plugin sub correctly yet.
The syntax for calling gaim_util_fetch_url() from perl is also funky and should be made more consistent to the C function.
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Mon, 28 Aug 2006 20:27:03 +0000 |
parents | 4558e71a5a34 |
children | 573b36b628f6 |
files | libgaim/plugins/perl/common/Request.xs libgaim/plugins/perl/common/Util.xs libgaim/plugins/perl/common/module.h libgaim/plugins/perl/perl-common.h libgaim/plugins/perl/perl-handlers.c libgaim/plugins/perl/perl.c |
diffstat | 6 files changed, 40 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/libgaim/plugins/perl/common/Request.xs Mon Aug 28 06:15:21 2006 +0000 +++ b/libgaim/plugins/perl/common/Request.xs Mon Aug 28 20:27:03 2006 +0000 @@ -46,6 +46,10 @@ PUTBACK; FREETMPS; LEAVE; + + g_free(gpr->ok_cb); + g_free(gpr->cancel_cb); + g_free(gpr); } static void @@ -67,6 +71,10 @@ PUTBACK; FREETMPS; LEAVE; + + g_free(gpr->ok_cb); + g_free(gpr->cancel_cb); + g_free(gpr); } MODULE = Gaim::Request PACKAGE = Gaim::Request PREFIX = gaim_request_ @@ -89,14 +97,14 @@ CODE: GaimPerlRequestData *gpr; STRLEN len; - char *basename, *package; + char *basename; basename = g_path_get_basename(handle->path); gaim_perl_normalize_script_name(basename); - package = g_strdup_printf("Gaim::Script::%s", basename); gpr = g_new(GaimPerlRequestData, 1); - gpr->ok_cb = g_strdup_printf("%s::%s", package, SvPV(ok_cb, len)); - gpr->cancel_cb = g_strdup_printf("%s::%s", package, SvPV(cancel_cb, len)); + gpr->ok_cb = g_strdup_printf("Gaim::Script::%s::%s", basename, SvPV(ok_cb, len)); + gpr->cancel_cb = g_strdup_printf("Gaim::Script::%s::%s", basename, SvPV(cancel_cb, len)); + g_free(basename); RETVAL = gaim_request_input(handle, title, primary, secondary, default_value, multiline, masked, hint, ok_text, G_CALLBACK(gaim_perl_request_ok_cb), cancel_text, G_CALLBACK(gaim_perl_request_cancel_cb), gpr); OUTPUT: @@ -113,14 +121,14 @@ CODE: GaimPerlRequestData *gpr; STRLEN len; - char *basename, *package; + char *basename; basename = g_path_get_basename(handle->path); gaim_perl_normalize_script_name(basename); - package = g_strdup_printf("Gaim::Script::%s", basename); gpr = g_new(GaimPerlRequestData, 1); - gpr->ok_cb = g_strdup_printf("%s::%s", package, SvPV(ok_cb, len)); - gpr->cancel_cb = g_strdup_printf("%s::%s", package, SvPV(cancel_cb, len)); + gpr->ok_cb = g_strdup_printf("Gaim::Script::%s::%s", basename, SvPV(ok_cb, len)); + gpr->cancel_cb = g_strdup_printf("Gaim::Script::%s::%s", basename, SvPV(cancel_cb, len)); + g_free(basename); RETVAL = gaim_request_file(handle, title, filename, savedialog, G_CALLBACK(gaim_perl_request_ok_cb), G_CALLBACK(gaim_perl_request_cancel_cb), gpr); OUTPUT: @@ -140,14 +148,14 @@ CODE: GaimPerlRequestData *gpr; STRLEN len; - char *basename, *package; + char *basename; basename = g_path_get_basename(handle->path); gaim_perl_normalize_script_name(basename); - package = g_strdup_printf("Gaim::Script::%s", basename); gpr = g_new(GaimPerlRequestData, 1); - gpr->ok_cb = g_strdup_printf("%s::%s", package, SvPV(ok_cb, len)); - gpr->cancel_cb = g_strdup_printf("%s::%s", package, SvPV(cancel_cb, len)); + gpr->ok_cb = g_strdup_printf("Gaim::Script::%s::%s", basename, SvPV(ok_cb, len)); + gpr->cancel_cb = g_strdup_printf("Gaim::Script::%s::%s", basename, SvPV(cancel_cb, len)); + g_free(basename); RETVAL = gaim_request_fields(handle, title, primary, secondary, fields, ok_text, G_CALLBACK(gaim_perl_request_ok_cb), cancel_text, G_CALLBACK(gaim_perl_request_cancel_cb), gpr); OUTPUT:
--- a/libgaim/plugins/perl/common/Util.xs Mon Aug 28 06:15:21 2006 +0000 +++ b/libgaim/plugins/perl/common/Util.xs Mon Aug 28 20:27:03 2006 +0000 @@ -4,19 +4,22 @@ char *cb; } GaimPerlUrlData; -static void gaim_perl_util_url_cb(Gaim::Util::FetchUrlData *url_data, void *user_data, const gchar *url_data, size_t size, const gchar *error_message) { +static void gaim_perl_util_url_cb(GaimUtilFetchUrlData *url_data, void *user_data, const gchar *url_text, size_t size, const gchar *error_message) { GaimPerlUrlData *gpr = (GaimPerlUrlData *)user_data; dSP; ENTER; SAVETMPS; - PUSHMARK(sp); + PUSHMARK(SP); - XPUSHs(sv_2mortal(newSVpv(url_data, 0))); + XPUSHs(sv_2mortal(newSVpvn(url_text, size))); PUTBACK; call_pv(gpr->cb, G_EVAL | G_SCALAR); SPAGAIN; + g_free(gpr->cb); + g_free(gpr); + PUTBACK; FREETMPS; LEAVE; @@ -36,14 +39,14 @@ CODE: GaimPerlUrlData *gpr; STRLEN len; - char *basename, *package; + char *basename; basename = g_path_get_basename(handle->path); gaim_perl_normalize_script_name(basename); - package = g_strdup_printf("Gaim::Script::%s", basename); gpr = g_new(GaimPerlUrlData, 1); - gpr->cb = g_strdup_printf("%s::%s", package, SvPV(cb, len)); + gpr->cb = g_strdup_printf("Gaim::Script::%s::%s", basename, SvPV(cb, len)); + g_free(basename); gaim_util_fetch_url(url, full, user_agent, http11, gaim_perl_util_url_cb, gpr); int
--- a/libgaim/plugins/perl/common/module.h Mon Aug 28 06:15:21 2006 +0000 +++ b/libgaim/plugins/perl/common/module.h Mon Aug 28 20:27:03 2006 +0000 @@ -248,6 +248,7 @@ typedef GaimStringref * Gaim__Stringref; /* util.h */ +typedef GaimInfoFieldFormatCallback Gaim__Util__InfoFieldFormatCallback; typedef GaimUtilFetchUrlData Gaim__Util__FetchUrlData; typedef GaimMenuAction * Gaim__Menu__Action;
--- a/libgaim/plugins/perl/perl-common.h Mon Aug 28 06:15:21 2006 +0000 +++ b/libgaim/plugins/perl/perl-common.h Mon Aug 28 20:27:03 2006 +0000 @@ -31,7 +31,9 @@ char *load_sub; char *unload_sub; char *prefs_sub; +#ifdef GAIM_GTKPERL char *gtk_prefs_sub; +#endif char *plugin_action_sub; } GaimPerlScript;
--- a/libgaim/plugins/perl/perl-handlers.c Mon Aug 28 06:15:21 2006 +0000 +++ b/libgaim/plugins/perl/perl-handlers.c Mon Aug 28 20:27:03 2006 +0000 @@ -103,6 +103,7 @@ return l; } +#ifdef GAIM_GTKPERL GtkWidget * gaim_perl_gtk_get_plugin_frame(GaimPlugin *plugin) { @@ -138,6 +139,7 @@ return ret; } +#endif GaimPluginPrefFrame * gaim_perl_get_plugin_frame(GaimPlugin *plugin)
--- a/libgaim/plugins/perl/perl.c Mon Aug 28 06:15:21 2006 +0000 +++ b/libgaim/plugins/perl/perl.c Mon Aug 28 20:27:03 2006 +0000 @@ -104,11 +104,13 @@ NULL /* frame (Reserved) */ }; +#ifdef GAIM_GTKPERL static GaimGtkPluginUiInfo gtk_ui_info = { gaim_perl_gtk_get_plugin_frame, 0 /* page_num (Reserved) */ }; +#endif static void #ifdef OLD_PERL @@ -366,6 +368,7 @@ info->prefs_info = &ui_info; } +#ifdef GAIM_GTKPERL if ((key = hv_fetch(plugin_info, "gtk_prefs_info", strlen("gtk_prefs_info"), 0))) { /* key now is the name of the Perl sub that @@ -375,6 +378,7 @@ SvPV(*key, len)); info->ui_info = >k_ui_info; } +#endif if ((key = hv_fetch(plugin_info, "plugin_action_sub", strlen("plugin_action_sub"), 0))) { @@ -538,7 +542,9 @@ g_free(gps->unload_sub); g_free(gps->package); g_free(gps->prefs_sub); +#ifdef GAIM_GTKPERL g_free(gps->gtk_prefs_sub); +#endif g_free(gps); plugin->info->extra_info = NULL; }