Mercurial > pidgin
diff plugins/perl/perl-handlers.c @ 11123:4315bb5f427b
[gaim-migrate @ 13179]
Time to make perl start working again
committer: Tailor Script <tailor@pidgin.im>
author | John H. Kelm <johnkelm@gmail.com> |
---|---|
date | Mon, 18 Jul 2005 16:27:53 +0000 |
parents | 414c701ef1ff |
children | 0e9e2b923d09 |
line wrap: on
line diff
--- a/plugins/perl/perl-handlers.c Mon Jul 18 15:49:12 2005 +0000 +++ b/plugins/perl/perl-handlers.c Mon Jul 18 16:27:53 2005 +0000 @@ -6,8 +6,56 @@ static GList *timeout_handlers = NULL; static GList *signal_handlers = NULL; +static char *perl_plugin_pref_cb; +extern PerlInterpreter *my_perl; -extern PerlInterpreter *my_perl; + +/* Called to create a pointer to GaimPluginUiInfo for the GaimPluginInfo */ +/* It will then inturn create ui_info with the C function pointer */ +/* that will eventually do a call_pv to call a perl functions so users */ +/* can create their own frames in the prefs */ +GaimPluginUiInfo *gaim_perl_plugin_pref(char * frame_cb) { + GaimPluginUiInfo *ui_info; + + ui_info = g_new0(GaimPluginUiInfo, 1); + + perl_plugin_pref_cb = frame_cb; + + ui_info->get_plugin_pref_frame = gaim_perl_get_plugin_frame; + + return ui_info; +} + +GaimPluginPrefFrame *gaim_perl_get_plugin_frame(GaimPlugin *plugin) { + /* Sets up the Perl Stack for our call back into the script to run the */ + /* plugin_pref... sub */ + GaimPluginPrefFrame *ret_frame; + dSP; + int count; + + ENTER; + SAVETMPS; + /* Some perl magic to run perl_plugin_pref_frame_SV perl sub and return */ + /* the frame */ + PUSHMARK(SP); + PUTBACK; + + count = call_pv(perl_plugin_pref_cb, G_SCALAR | G_NOARGS); + + SPAGAIN; + + if (count != 1) + croak("call_pv: Did not return the correct number of values.\n"); + /* the frame was created in a perl sub and is returned */ + ret_frame = (GaimPluginPrefFrame *)gaim_perl_ref_object(POPs); + + /* Tidy up the Perl stack */ + PUTBACK; + FREETMPS; + LEAVE; + + return ret_frame; +} static void destroy_timeout_handler(GaimPerlTimeoutHandler *handler)