Mercurial > pidgin.yaz
diff libpurple/plugins/perl/common/Util.xs @ 22679:3a41eb457605
Use the same fix for Purple::Util::fetch_url (from 4b6378d5e) for
Purple::Request:: functions as well. This allows the callbacks to be
specified both as coderefs or as strings (name of the callback function).
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Wed, 23 Apr 2008 02:29:39 +0000 |
parents | 4d968d8be5d2 |
children | af603a54ae5a |
line wrap: on
line diff
--- a/libpurple/plugins/perl/common/Util.xs Tue Apr 22 16:47:11 2008 +0000 +++ b/libpurple/plugins/perl/common/Util.xs Wed Apr 23 02:29:39 2008 +0000 @@ -257,29 +257,13 @@ gboolean http11 SV * cb CODE: - SV *sv = NULL; - - - if (SvTYPE(cb) == SVt_RV) { - SV *cbsv = SvRV(cb); - - if (SvTYPE(cbsv) == SVt_PVCV) { - sv = newSVsv(cb); - } else { - purple_debug_warning("perl", "Callback not a valid coderef in purple_util_fetch_url.\n"); - } - } else if (SvTYPE(cb) == SVt_PV) { - PurplePerlScript *gps; - - gps = (PurplePerlScript *)PURPLE_PLUGIN_LOADER_INFO(plugin); - sv = newSVpvf("%s::%s", gps->package, SvPV_nolen(cb)); - } else { - purple_debug_warning("perl", "Callback not a valid type, only strings and coderefs allowed in purple_util_fetch_url.\n"); - } + SV *sv = purple_perl_sv_from_fun(plugin, cb); if (sv != NULL) { purple_util_fetch_url(url, full, user_agent, http11, purple_perl_util_url_cb, sv); + } else { + purple_debug_warning("perl", "Callback not a valid type, only strings and coderefs allowed in purple_util_fetch_url.\n"); } void