Mercurial > pidgin.yaz
diff plugins/perl/common/Util.xs @ 11290:b284c703d398
[gaim-migrate @ 13490]
Did some house cleaning on the code finished up some of the "TODO" stuff
that was left over from when I originally did the XSUBs. Furthermore,
the dynamically loaded Perl package problems should be corrected now that
the context is set before one of the concurrent perl interpreters is run.
committer: Tailor Script <tailor@pidgin.im>
author | John H. Kelm <johnkelm@gmail.com> |
---|---|
date | Thu, 18 Aug 2005 01:35:14 +0000 |
parents | 134d0001983d |
children | 52f27ffe68a5 |
line wrap: on
line diff
--- a/plugins/perl/common/Util.xs Wed Aug 17 21:42:28 2005 +0000 +++ b/plugins/perl/common/Util.xs Thu Aug 18 01:35:14 2005 +0000 @@ -1,25 +1,51 @@ - - #include "module.h" -/* TODO +typedef struct { + char *cb; +} GaimPerlUrlData; + +void gaim_perl_util_url_cb(void *data, const char *url_data, size_t size) { + GaimPerlUrlData *gpr = (GaimPerlUrlData *)data; + dSP; + ENTER; + SAVETMPS; + PUSHMARK(sp); -void -gaim_url_fetch(url, full, user_agent, http11, void *, char *, size_t), data) - const char *url - gboolean full - const char *user_agent - gboolean http11 - - const char * - size_t) + XPUSHs(sv_2mortal(newSVpv(url_data, 0))); + PUTBACK; + + call_pv(gpr->cb, G_EVAL | G_SCALAR); + SPAGAIN; -*/ + PUTBACK; + FREETMPS; + LEAVE; +} -/**********************XS Code for Account.xs*********************************/ + MODULE = Gaim::Util PACKAGE = Gaim::Util PREFIX = gaim_ PROTOTYPES: ENABLE - + +void +gaim_url_fetch(handle, url, full, user_agent, http11, cb) + Gaim::Plugin handle + const char *url + gboolean full + const char *user_agent + gboolean http11 + SV * cb +CODE: + GaimPerlUrlData *gpr; + STRLEN len; + char *basename, *package; + + 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)); + gaim_url_fetch(url, full, user_agent, http11, gaim_perl_util_url_cb, gpr); int gaim_build_dir(path, mode)