comparison src/perl.c @ 597:3a24fd19ff5f

[gaim-migrate @ 607] print_to_conv in perl. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 03 Aug 2000 19:27:42 +0000
parents 7c75d69a1129
children 9b0717b4a490
comparison
equal deleted inserted replaced
596:2838c9ca0823 597:3a24fd19ff5f
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 * 19 *
20 * This was taken almost exactly from X-Chat. The power of the GPL. 20 * This was taken almost exactly from X-Chat. The power of the GPL.
21 * Translated from X-Chat to Gaim by Eric Warmenhoven. 21 * Translated from X-Chat to Gaim by Eric Warmenhoven.
22 * Originally by Erik Scrafford <eriks@chilisoft.com>. 22 * Originally by Erik Scrafford <eriks@chilisoft.com>.
23 * X-Chat Copyright (C) 1998 Peter Zelezny.
23 * 24 *
24 */ 25 */
25 26
26 #ifdef HAVE_CONFIG_H 27 #ifdef HAVE_CONFIG_H
27 #include "../config.h" 28 #include "../config.h"
59 struct _perl_timeout_handlers { 60 struct _perl_timeout_handlers {
60 char *handler_name; 61 char *handler_name;
61 gint iotag; 62 gint iotag;
62 }; 63 };
63 64
64 static GList *perl_list = NULL; 65 static GList *perl_list = NULL; /* should probably extern this at some point */
65 static GList *perl_timeout_handlers = NULL; 66 static GList *perl_timeout_handlers = NULL;
66 static PerlInterpreter *my_perl = NULL; 67 static PerlInterpreter *my_perl = NULL;
67 68
68 /* dealing with gaim */ 69 /* dealing with gaim */
69 XS(XS_AIM_register); /* set up hooks for script */ 70 XS(XS_AIM_register); /* set up hooks for script */
76 XS(XS_AIM_deny_list); /* also returns permit list */ 77 XS(XS_AIM_deny_list); /* also returns permit list */
77 78
78 /* server stuff */ 79 /* server stuff */
79 XS(XS_AIM_command); /* send command to server */ 80 XS(XS_AIM_command); /* send command to server */
80 XS(XS_AIM_user_info); /* given name, return struct buddy members */ 81 XS(XS_AIM_user_info); /* given name, return struct buddy members */
82 XS(XS_AIM_print_to_conv); /* send message to someone */
81 83
82 /* handler commands */ 84 /* handler commands */
83 XS(XS_AIM_add_message_handler); /* when people talk */ 85 XS(XS_AIM_add_message_handler); /* when people talk */
84 XS(XS_AIM_add_command_handler); /* when servers talk */ 86 XS(XS_AIM_add_command_handler); /* when servers talk */
85 XS(XS_AIM_add_timeout_handler); /* figure it out */ 87 XS(XS_AIM_add_timeout_handler); /* figure it out */
86
87 /* cool stuff */
88 XS(XS_AIM_print_to_conv); /* send message to someone */
89 88
90 void xs_init() 89 void xs_init()
91 { 90 {
92 char *file = __FILE__; 91 char *file = __FILE__;
93 newXS ("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); 92 newXS ("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);
167 newXS ("AIM::online_list", XS_AIM_online_list, "AIM"); 166 newXS ("AIM::online_list", XS_AIM_online_list, "AIM");
168 newXS ("AIM::deny_list", XS_AIM_deny_list, "AIM"); 167 newXS ("AIM::deny_list", XS_AIM_deny_list, "AIM");
169 168
170 newXS ("AIM::command", XS_AIM_command, "AIM"); 169 newXS ("AIM::command", XS_AIM_command, "AIM");
171 newXS ("AIM::user_info", XS_AIM_user_info, "AIM"); 170 newXS ("AIM::user_info", XS_AIM_user_info, "AIM");
171 newXS ("AIM::print_to_conv", XS_AIM_print_to_conv, "AIM");
172 172
173 newXS ("AIM::add_message_handler", XS_AIM_add_message_handler, "AIM"); 173 newXS ("AIM::add_message_handler", XS_AIM_add_message_handler, "AIM");
174 newXS ("AIM::add_command_handler", XS_AIM_add_command_handler, "AIM"); 174 newXS ("AIM::add_command_handler", XS_AIM_add_command_handler, "AIM");
175 newXS ("AIM::add_timeout_handler", XS_AIM_add_timeout_handler, "AIM"); 175 newXS ("AIM::add_timeout_handler", XS_AIM_add_timeout_handler, "AIM");
176 } 176 }
358 XST_mIV(2, buddy->evil); 358 XST_mIV(2, buddy->evil);
359 XST_mIV(3, buddy->signon); 359 XST_mIV(3, buddy->signon);
360 XST_mIV(4, buddy->idle); 360 XST_mIV(4, buddy->idle);
361 XST_mIV(5, buddy->uc); 361 XST_mIV(5, buddy->uc);
362 XST_mIV(6, buddy->caps); 362 XST_mIV(6, buddy->caps);
363 XSRETURN(6); 363 XSRETURN(7);
364 }
365
366 XS (XS_AIM_print_to_conv)
367 {
368 char *nick, *what;
369 struct conversation *c;
370 int junk;
371 dXSARGS;
372 items = 0;
373
374 nick = SvPV(ST(0), junk);
375 what = SvPV(ST(1), junk);
376 c = find_conversation(nick);
377 if (!c)
378 c = new_conversation(nick);
379 write_to_conv(c, what, WFLAG_SEND, NULL);
380 serv_send_im(nick, what, 0);
364 } 381 }
365 382
366 XS (XS_AIM_add_message_handler) 383 XS (XS_AIM_add_message_handler)
367 { 384 {
368 /* FIXME */ 385 /* FIXME */
397 perl_timeout_handlers = g_list_append(perl_timeout_handlers, handler); 414 perl_timeout_handlers = g_list_append(perl_timeout_handlers, handler);
398 handler->iotag = gtk_timeout_add(timeout, (GtkFunction)perl_timeout, handler); 415 handler->iotag = gtk_timeout_add(timeout, (GtkFunction)perl_timeout, handler);
399 XSRETURN_EMPTY; 416 XSRETURN_EMPTY;
400 } 417 }
401 418
402 XS (XS_AIM_print_to_conv)
403 {
404 /* FIXME */
405 }
406
407 #endif /* USE_PERL */ 419 #endif /* USE_PERL */