comparison src/perl.c @ 3280:c98c1e0281ff

[gaim-migrate @ 3298] Perl can play sounds! committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Wed, 29 May 2002 01:44:40 +0000
parents dab4da8ca29a
children c731327dbc47
comparison
equal deleted inserted replaced
3279:86fdd015f40e 3280:c98c1e0281ff
103 103
104 /* handler commands */ 104 /* handler commands */
105 XS(XS_GAIM_add_event_handler); /* when servers talk */ 105 XS(XS_GAIM_add_event_handler); /* when servers talk */
106 XS(XS_GAIM_add_timeout_handler); /* figure it out */ 106 XS(XS_GAIM_add_timeout_handler); /* figure it out */
107 107
108 /* play sound */
109 XS(XS_GAIM_play_sound); /*play a sound*/
110
108 void xs_init() 111 void xs_init()
109 { 112 {
110 char *file = __FILE__; 113 char *file = __FILE__;
111 newXS ("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); 114 newXS ("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);
112 } 115 }
236 newXS ("GAIM::print_to_chat", XS_GAIM_print_to_chat, "GAIM"); 239 newXS ("GAIM::print_to_chat", XS_GAIM_print_to_chat, "GAIM");
237 newXS ("GAIM::serv_send_im", XS_GAIM_serv_send_im, "GAIM"); 240 newXS ("GAIM::serv_send_im", XS_GAIM_serv_send_im, "GAIM");
238 241
239 newXS ("GAIM::add_event_handler", XS_GAIM_add_event_handler, "GAIM"); 242 newXS ("GAIM::add_event_handler", XS_GAIM_add_event_handler, "GAIM");
240 newXS ("GAIM::add_timeout_handler", XS_GAIM_add_timeout_handler, "GAIM"); 243 newXS ("GAIM::add_timeout_handler", XS_GAIM_add_timeout_handler, "GAIM");
244
245 newXS ("GAIM::play_sound", XS_GAIM_play_sound, "GAIM");
241 } 246 }
242 247
243 void perl_end() 248 void perl_end()
244 { 249 {
245 struct perlscript *scp; 250 struct perlscript *scp;
615 write_to_conv(c, what, WFLAG_SEND | (isauto ? WFLAG_AUTO : 0), NULL, time(NULL), -1); 620 write_to_conv(c, what, WFLAG_SEND | (isauto ? WFLAG_AUTO : 0), NULL, time(NULL), -1);
616 serv_send_im(c->gc, nick, what, -1, isauto ? IM_FLAG_AWAY : 0); 621 serv_send_im(c->gc, nick, what, -1, isauto ? IM_FLAG_AWAY : 0);
617 XSRETURN(0); 622 XSRETURN(0);
618 } 623 }
619 624
625
626
620 XS (XS_GAIM_print_to_chat) 627 XS (XS_GAIM_print_to_chat)
621 { 628 {
622 struct gaim_connection *gc; 629 struct gaim_connection *gc;
623 int id; 630 int id;
624 char *what; 631 char *what;
831 perl_timeout_handlers = g_list_append(perl_timeout_handlers, handler); 838 perl_timeout_handlers = g_list_append(perl_timeout_handlers, handler);
832 handler->iotag = g_timeout_add(timeout, perl_timeout, handler); 839 handler->iotag = g_timeout_add(timeout, perl_timeout, handler);
833 XSRETURN_EMPTY; 840 XSRETURN_EMPTY;
834 } 841 }
835 842
843 XS (XS_GAIM_play_sound)
844 {
845 int id;
846 dXSARGS;
847
848 id = SvIV(ST(0));
849
850 play_sound(id);
851
852 XSRETURN_EMPTY;
853 }
854
836 extern void unload_perl_scripts() 855 extern void unload_perl_scripts()
837 { 856 {
838 perl_end(); 857 perl_end();
839 perl_init(); 858 perl_init();
840 } 859 }