Mercurial > pidgin.yaz
diff src/perl.c @ 3456:b48065e52337
[gaim-migrate @ 3503]
A few patches. Brian--tell me what your last name is, and I'll put it in. ;)
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Wed, 28 Aug 2002 02:38:19 +0000 |
parents | 8fa61405af2b |
children | e23909729192 |
line wrap: on
line diff
--- a/src/perl.c Tue Aug 27 22:22:55 2002 +0000 +++ b/src/perl.c Wed Aug 28 02:38:19 2002 +0000 @@ -106,6 +106,7 @@ /* handler commands */ XS(XS_GAIM_add_event_handler); /* when servers talk */ +XS(XS_GAIM_remove_event_handler); /* remove a handler */ XS(XS_GAIM_add_timeout_handler); /* figure it out */ /* play sound */ @@ -244,6 +245,7 @@ newXS ("GAIM::serv_send_im", XS_GAIM_serv_send_im, "GAIM"); newXS ("GAIM::add_event_handler", XS_GAIM_add_event_handler, "GAIM"); + newXS ("GAIM::remove_event_handler", XS_GAIM_remove_event_handler, "GAIM"); newXS ("GAIM::add_timeout_handler", XS_GAIM_add_timeout_handler, "GAIM"); newXS ("GAIM::play_sound", XS_GAIM_play_sound, "GAIM"); @@ -814,6 +816,30 @@ XSRETURN_EMPTY; } +XS (XS_GAIM_remove_event_handler) +{ + unsigned int junk; + struct _perl_event_handlers *ehn; + GList *cur = perl_event_handlers; + dXSARGS; + + while (cur) { + GList *next = cur->next; + ehn = cur->data; + + if (!strcmp(ehn->event_type, SvPV(ST(0), junk)) && + !strcmp(ehn->handler_name, SvPV(ST(1), junk))) + { + perl_event_handlers = g_list_remove(perl_event_handlers, ehn); + g_free(ehn->event_type); + g_free(ehn->handler_name); + g_free(ehn); + } + + cur = next; + } +} + static int perl_timeout(gpointer data) { struct _perl_timeout_handlers *handler = data;