comparison src/perl.c @ 806:67bdecdecbb7

[gaim-migrate @ 816] yay, i think perl is finally working well committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 31 Aug 2000 01:40:58 +0000
parents 2f0655e185b8
children 2876c40108cd
comparison
equal deleted inserted replaced
805:2f0655e185b8 806:67bdecdecbb7
483 if (!c) 483 if (!c)
484 XSRETURN(0); 484 XSRETURN(0);
485 serv_chat_send(c->id, what); 485 serv_chat_send(c->id, what);
486 } 486 }
487 487
488 int perl_event(enum gaim_event event, char *args) 488 int perl_event(char *event, char *args)
489 { 489 {
490 GList *handler; 490 GList *handler;
491 struct _perl_event_handlers *data; 491 struct _perl_event_handlers *data;
492 492
493 for (handler = perl_event_handlers; handler != NULL; handler = handler->next) { 493 for (handler = perl_event_handlers; handler != NULL; handler = handler->next) {
494 data = handler->data; 494 data = handler->data;
495 if (!strcmp(event_name(event), data->event_type)) 495 if (!strcmp(event, data->event_type))
496 execute_perl(data->handler_name, args); 496 execute_perl(data->handler_name, args);
497 } 497 }
498 498
499 return 0; 499 return 0;
500 } 500 }
508 508
509 handler = g_new0(struct _perl_event_handlers, 1); 509 handler = g_new0(struct _perl_event_handlers, 1);
510 handler->event_type = g_strdup(SvPV(ST(0), junk)); 510 handler->event_type = g_strdup(SvPV(ST(0), junk));
511 handler->handler_name = g_strdup(SvPV(ST(1), junk)); 511 handler->handler_name = g_strdup(SvPV(ST(1), junk));
512 perl_event_handlers = g_list_append(perl_event_handlers, handler); 512 perl_event_handlers = g_list_append(perl_event_handlers, handler);
513 sprintf(debug_buff, "registered perl event handler for %s\n", handler->event_type);
514 debug_print(debug_buff);
513 XSRETURN_EMPTY; 515 XSRETURN_EMPTY;
514 } 516 }
515 517
516 static int perl_timeout(struct _perl_timeout_handlers *handler) 518 static int perl_timeout(struct _perl_timeout_handlers *handler)
517 { 519 {
530 struct _perl_timeout_handlers *handler; 532 struct _perl_timeout_handlers *handler;
531 dXSARGS; 533 dXSARGS;
532 items = 0; 534 items = 0;
533 535
534 handler = g_new0(struct _perl_timeout_handlers, 1); 536 handler = g_new0(struct _perl_timeout_handlers, 1);
535 timeout = atol(SvPV(ST(0), junk)); 537 timeout = 1000 * atol(SvPV(ST(0), junk));
536 handler->handler_name = g_strdup(SvPV(ST(1), junk)); 538 handler->handler_name = g_strdup(SvPV(ST(1), junk));
537 perl_timeout_handlers = g_list_append(perl_timeout_handlers, handler); 539 perl_timeout_handlers = g_list_append(perl_timeout_handlers, handler);
538 handler->iotag = gtk_timeout_add(timeout, (GtkFunction)perl_timeout, handler); 540 handler->iotag = gtk_timeout_add(timeout, (GtkFunction)perl_timeout, handler);
539 XSRETURN_EMPTY; 541 XSRETURN_EMPTY;
540 } 542 }