# HG changeset patch # User Eric Warmenhoven # Date 1003176495 0 # Node ID bf7ec3874810009384fdf30ef8f77e80db01d67b # Parent a83b4a5ffcd64631d83661c923aecc114e7f8caf [gaim-migrate @ 2525] Artem Litvinovich's patch committer: Tailor Script diff -r a83b4a5ffcd6 -r bf7ec3874810 ChangeLog --- a/ChangeLog Mon Oct 15 19:52:44 2001 +0000 +++ b/ChangeLog Mon Oct 15 20:08:15 2001 +0000 @@ -13,6 +13,8 @@ * Event handlers in perl passed arguments as elements of an array rather than all concatenated as a string, making perl much easier to use (thanks Dennis Lambe Jr.) + * Can pass an argument to timeout_handlers in perl + (thanks Artem Litvinovich) version 0.45 (10/04/2001): * New plugin event: event_chat_send_invite diff -r a83b4a5ffcd6 -r bf7ec3874810 plugins/PERL-HOWTO --- a/plugins/PERL-HOWTO Mon Oct 15 19:52:44 2001 +0000 +++ b/plugins/PERL-HOWTO Mon Oct 15 20:08:15 2001 +0000 @@ -136,6 +136,8 @@ and the event itself to never happen (i.e. the user won't see it happen, and _send events won't actually send). -GAIM::add_timeout_handler(integer, function) +GAIM::add_timeout_handler(integer, function, args) This calls function after integer number of seconds. It only calls function once, so if you want to keep calling function, keep readding the handler. + Args is a string that you'd like to have passed to your timeout handler; it's + optional. diff -r a83b4a5ffcd6 -r bf7ec3874810 src/perl.c --- a/src/perl.c Mon Oct 15 19:52:44 2001 +0000 +++ b/src/perl.c Mon Oct 15 20:08:15 2001 +0000 @@ -74,6 +74,7 @@ struct _perl_timeout_handlers { char *handler_name; + char *handler_args; gint iotag; }; @@ -260,6 +261,7 @@ thn = perl_timeout_handlers->data; perl_timeout_handlers = g_list_remove(perl_timeout_handlers, thn); g_source_remove(thn->iotag); + g_free(thn->handler_args); g_free(thn->handler_name); g_free(thn); } @@ -804,8 +806,9 @@ static int perl_timeout(gpointer data) { struct _perl_timeout_handlers *handler = data; - execute_perl(handler->handler_name, ""); + execute_perl(handler->handler_name, escape_quotes(handler->handler_args)); perl_timeout_handlers = g_list_remove(perl_timeout_handlers, handler); + g_free(handler->handler_args); g_free(handler->handler_name); g_free(handler); @@ -824,6 +827,7 @@ timeout = 1000 * SvIV(ST(0)); debug_printf("Adding timeout for %d seconds.\n", timeout/1000); handler->handler_name = g_strdup(SvPV(ST(1), junk)); + handler->handler_args = g_strdup(SvPV(ST(2), junk)); perl_timeout_handlers = g_list_append(perl_timeout_handlers, handler); handler->iotag = g_timeout_add(timeout, perl_timeout, handler); XSRETURN_EMPTY;