comparison src/perl.c @ 2261:e243bf60f2d6

[gaim-migrate @ 2271] Stefan Weyergraf and Artem Litvinovich both submitted patches that do similar things. I ended up taking Stefan's patch because it did more things than Artem's did. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Mon, 10 Sep 2001 22:27:47 +0000
parents 8c4ff1a368bd
children a6d0edc31554
comparison
equal deleted inserted replaced
2260:aa69e80298bb 2261:e243bf60f2d6
85 85
86 /* dealing with gaim */ 86 /* dealing with gaim */
87 XS(XS_GAIM_register); /* set up hooks for script */ 87 XS(XS_GAIM_register); /* set up hooks for script */
88 XS(XS_GAIM_get_info); /* version, last to attempt signon, protocol */ 88 XS(XS_GAIM_get_info); /* version, last to attempt signon, protocol */
89 XS(XS_GAIM_print); /* lemme figure this one out... */ 89 XS(XS_GAIM_print); /* lemme figure this one out... */
90 XS(XS_GAIM_write_to_conv); /* write into conversation window */
90 91
91 /* list stuff */ 92 /* list stuff */
92 XS(XS_GAIM_buddy_list); /* all buddies */ 93 XS(XS_GAIM_buddy_list); /* all buddies */
93 XS(XS_GAIM_online_list); /* online buddies */ 94 XS(XS_GAIM_online_list); /* online buddies */
94 95
95 /* server stuff */ 96 /* server stuff */
96 XS(XS_GAIM_command); /* send command to server */ 97 XS(XS_GAIM_command); /* send command to server */
97 XS(XS_GAIM_user_info); /* given name, return struct buddy members */ 98 XS(XS_GAIM_user_info); /* given name, return struct buddy members */
98 XS(XS_GAIM_print_to_conv); /* send message to someone */ 99 XS(XS_GAIM_print_to_conv); /* send message to someone */
99 XS(XS_GAIM_print_to_chat); /* send message to chat room */ 100 XS(XS_GAIM_print_to_chat); /* send message to chat room */
101 XS(XS_GAIM_serv_send_im); /* send message to someone (but do not display) */
100 102
101 /* handler commands */ 103 /* handler commands */
102 XS(XS_GAIM_add_event_handler); /* when servers talk */ 104 XS(XS_GAIM_add_event_handler); /* when servers talk */
103 XS(XS_GAIM_add_timeout_handler); /* figure it out */ 105 XS(XS_GAIM_add_timeout_handler); /* figure it out */
104 106
214 #endif 216 #endif
215 217
216 newXS ("GAIM::register", XS_GAIM_register, "GAIM"); 218 newXS ("GAIM::register", XS_GAIM_register, "GAIM");
217 newXS ("GAIM::get_info", XS_GAIM_get_info, "GAIM"); 219 newXS ("GAIM::get_info", XS_GAIM_get_info, "GAIM");
218 newXS ("GAIM::print", XS_GAIM_print, "GAIM"); 220 newXS ("GAIM::print", XS_GAIM_print, "GAIM");
221 newXS ("GAIM::write_to_conv", XS_GAIM_write_to_conv, "GAIM");
219 222
220 newXS ("GAIM::buddy_list", XS_GAIM_buddy_list, "GAIM"); 223 newXS ("GAIM::buddy_list", XS_GAIM_buddy_list, "GAIM");
221 newXS ("GAIM::online_list", XS_GAIM_online_list, "GAIM"); 224 newXS ("GAIM::online_list", XS_GAIM_online_list, "GAIM");
222 225
223 newXS ("GAIM::command", XS_GAIM_command, "GAIM"); 226 newXS ("GAIM::command", XS_GAIM_command, "GAIM");
224 newXS ("GAIM::user_info", XS_GAIM_user_info, "GAIM"); 227 newXS ("GAIM::user_info", XS_GAIM_user_info, "GAIM");
225 newXS ("GAIM::print_to_conv", XS_GAIM_print_to_conv, "GAIM"); 228 newXS ("GAIM::print_to_conv", XS_GAIM_print_to_conv, "GAIM");
226 newXS ("GAIM::print_to_chat", XS_GAIM_print_to_chat, "GAIM"); 229 newXS ("GAIM::print_to_chat", XS_GAIM_print_to_chat, "GAIM");
230 newXS ("GAIM::serv_send_im", XS_GAIM_serv_send_im, "GAIM");
227 231
228 newXS ("GAIM::add_event_handler", XS_GAIM_add_event_handler, "GAIM"); 232 newXS ("GAIM::add_event_handler", XS_GAIM_add_event_handler, "GAIM");
229 newXS ("GAIM::add_timeout_handler", XS_GAIM_add_timeout_handler, "GAIM"); 233 newXS ("GAIM::add_timeout_handler", XS_GAIM_add_timeout_handler, "GAIM");
230 } 234 }
231 235
500 XST_mIV(6, buddy->uc); 504 XST_mIV(6, buddy->uc);
501 XST_mIV(7, buddy->caps); 505 XST_mIV(7, buddy->caps);
502 XSRETURN(8); 506 XSRETURN(8);
503 } 507 }
504 508
509 XS (XS_GAIM_write_to_conv)
510 {
511 char *nick, *who, *what;
512 struct conversation *c;
513 int junk;
514 int send, wflags;
515 dXSARGS;
516 items = 0;
517
518 nick = SvPV(ST(0), junk);
519 send = atoi(SvPV(ST(1), junk));
520 what = SvPV(ST(2), junk);
521 who = SvPV(ST(3), junk);
522
523 if (!*who) who=NULL;
524
525 switch (send) {
526 case 0: wflags=WFLAG_SEND; break;
527 case 1: wflags=WFLAG_RECV; break;
528 case 2: wflags=WFLAG_SYSTEM; break;
529 default: wflags=WFLAG_RECV;
530 }
531
532 c = find_conversation(nick);
533 if (!c)
534 c = new_conversation(nick);
535
536 write_to_conv(c, what, wflags, who, time((time_t)NULL));
537 }
538
539 XS (XS_GAIM_serv_send_im)
540 {
541 char *nick, *what, *isauto;
542 int junk;
543 dXSARGS;
544 items = 0;
545
546 nick = SvPV(ST(0), junk);
547 what = SvPV(ST(1), junk);
548 isauto = SvPV(ST(2), junk);
549
550 if (!connections)
551 return;
552 serv_send_im(connections->data, nick, what, atoi(isauto));
553 }
554
505 XS (XS_GAIM_print_to_conv) 555 XS (XS_GAIM_print_to_conv)
506 { 556 {
507 char *nick, *what, *isauto; 557 char *nick, *what, *isauto;
508 struct conversation *c; 558 struct conversation *c;
509 unsigned int junk; 559 unsigned int junk;