plugins/perl/perl.c

changeset 5470
2c97aae0f2fb
parent 5445
161029ee66a6
child 5586
6be7bfb9b97d
equal deleted inserted replaced
5469:69a720258fd1 5470:2c97aae0f2fb
533 scp = g_new0(struct perlscript, 1); 533 scp = g_new0(struct perlscript, 1);
534 scp->name = g_strdup(name); 534 scp->name = g_strdup(name);
535 scp->version = g_strdup(ver); 535 scp->version = g_strdup(ver);
536 scp->shutdowncallback = g_strdup(callback); 536 scp->shutdowncallback = g_strdup(callback);
537 scp->plug = plug; 537 scp->plug = plug;
538
539 perl_list = g_list_append(perl_list, scp); 538 perl_list = g_list_append(perl_list, scp);
540
541 XST_mPV(0, plug->path); 539 XST_mPV(0, plug->path);
542 } 540 }
543 else 541 else
544 XST_mPV(0, NULL); 542 XST_mPV(0, NULL);
545 543
558 i = 1; 556 i = 1;
559 break; 557 break;
560 558
561 case 1: 559 case 1:
562 { 560 {
563 GSList *c = connections; 561 GSList *c = gaim_get_connections();
564 struct gaim_connection *gc; 562 struct gaim_connection *gc;
565 563
566 while (c) { 564 while (c) {
567 gc = (struct gaim_connection *)c->data; 565 gc = (struct gaim_connection *)c->data;
568 XST_mIV(i++, (guint)gc); 566 XST_mIV(i++, (guint)gc);
574 case 2: 572 case 2:
575 { 573 {
576 struct gaim_connection *gc = 574 struct gaim_connection *gc =
577 (struct gaim_connection *)SvIV(ST(1)); 575 (struct gaim_connection *)SvIV(ST(1));
578 576
579 if (g_slist_find(connections, gc)) 577 if (g_slist_find(gaim_get_connections(), gc))
580 XST_mIV(i++, gc->protocol); 578 XST_mIV(i++, gc->protocol);
581 else 579 else
582 XST_mIV(i++, -1); 580 XST_mIV(i++, -1);
583 } 581 }
584 break; 582 break;
586 case 3: 584 case 3:
587 { 585 {
588 struct gaim_connection *gc = 586 struct gaim_connection *gc =
589 (struct gaim_connection *)SvIV(ST(1)); 587 (struct gaim_connection *)SvIV(ST(1));
590 588
591 if (g_slist_find(connections, gc)) 589 if (g_slist_find(gaim_get_connections(), gc))
592 XST_mPV(i++, gc->username); 590 XST_mPV(i++, gc->username);
593 else 591 else
594 XST_mPV(i++, ""); 592 XST_mPV(i++, "");
595 } 593 }
596 break; 594 break;
598 case 4: 596 case 4:
599 { 597 {
600 struct gaim_connection *gc = 598 struct gaim_connection *gc =
601 (struct gaim_connection *)SvIV(ST(1)); 599 (struct gaim_connection *)SvIV(ST(1));
602 600
603 if (g_slist_find(connections, gc)) 601 if (g_slist_find(gaim_get_connections(), gc))
604 XST_mIV(i++, g_slist_index(gaim_accounts, gc->account)); 602 XST_mIV(i++, g_slist_index(gaim_accounts, gc->account));
605 else 603 else
606 XST_mIV(i++, -1); 604 XST_mIV(i++, -1);
607 } 605 }
608 break; 606 break;
632 case 7: 630 case 7:
633 { 631 {
634 struct gaim_connection *gc = 632 struct gaim_connection *gc =
635 (struct gaim_connection *)SvIV(ST(1)); 633 (struct gaim_connection *)SvIV(ST(1));
636 634
637 if (g_slist_find(connections, gc)) 635 if (g_slist_find(gaim_get_connections(), gc))
638 XST_mPV(i++, gc->prpl->info->name); 636 XST_mPV(i++, gc->prpl->info->name);
639 else 637 else
640 XST_mPV(i++, "Unknown"); 638 XST_mPV(i++, "Unknown");
641 } 639 }
642 break; 640 break;
729 int index = SvIV(ST(1)); 727 int index = SvIV(ST(1));
730 if (g_slist_nth_data(gaim_accounts, index)) 728 if (g_slist_nth_data(gaim_accounts, index))
731 serv_login(g_slist_nth_data(gaim_accounts, index)); 729 serv_login(g_slist_nth_data(gaim_accounts, index));
732 } else if (!strncasecmp(command, "signoff", 7)) { 730 } else if (!strncasecmp(command, "signoff", 7)) {
733 struct gaim_connection *gc = (struct gaim_connection *)SvIV(ST(1)); 731 struct gaim_connection *gc = (struct gaim_connection *)SvIV(ST(1));
734 if (g_slist_find(connections, gc)) signoff(gc); 732 if (g_slist_find(gaim_get_connections(), gc)) signoff(gc);
735 else signoff_all(NULL, NULL); 733 else signoff_all(NULL, NULL);
736 } else if (!strncasecmp(command, "info", 4)) { 734 } else if (!strncasecmp(command, "info", 4)) {
737 struct gaim_connection *gc = (struct gaim_connection *)SvIV(ST(1)); 735 struct gaim_connection *gc = (struct gaim_connection *)SvIV(ST(1));
738 if (g_slist_find(connections, gc)) 736 if (g_slist_find(gaim_get_connections(), gc))
739 serv_set_info(gc, SvPV(ST(2), junk)); 737 serv_set_info(gc, SvPV(ST(2), junk));
740 } else if (!strncasecmp(command, "away", 4)) { 738 } else if (!strncasecmp(command, "away", 4)) {
741 char *message = SvPV(ST(1), junk); 739 char *message = SvPV(ST(1), junk);
742 static struct away_message a; 740 static struct away_message a;
743 g_snprintf(a.message, sizeof(a.message), "%s", message); 741 g_snprintf(a.message, sizeof(a.message), "%s", message);
744 do_away_message(NULL, &a); 742 do_away_message(NULL, &a);
745 } else if (!strncasecmp(command, "back", 4)) { 743 } else if (!strncasecmp(command, "back", 4)) {
746 do_im_back(); 744 do_im_back();
747 } else if (!strncasecmp(command, "idle", 4)) { 745 } else if (!strncasecmp(command, "idle", 4)) {
748 GSList *c = connections; 746 GSList *c = gaim_get_connections();
749 struct gaim_connection *gc; 747 struct gaim_connection *gc;
750 748
751 while (c) { 749 while (c) {
752 gc = (struct gaim_connection *)c->data; 750 gc = (struct gaim_connection *)c->data;
753 serv_set_idle(gc, SvIV(ST(1))); 751 serv_set_idle(gc, SvIV(ST(1)));
754 c = c->next; 752 c = c->next;
755 } 753 }
756 } else if (!strncasecmp(command, "warn", 4)) { 754 } else if (!strncasecmp(command, "warn", 4)) {
757 GSList *c = connections; 755 GSList *c = gaim_get_connections();
758 struct gaim_connection *gc; 756 struct gaim_connection *gc;
759 757
760 while (c) { 758 while (c) {
761 gc = (struct gaim_connection *)c->data; 759 gc = (struct gaim_connection *)c->data;
762 serv_warn(gc, SvPV(ST(1), junk), SvIV(ST(2))); 760 serv_warn(gc, SvPV(ST(1), junk), SvIV(ST(2)));
774 struct buddy *buddy = NULL; 772 struct buddy *buddy = NULL;
775 dXSARGS; 773 dXSARGS;
776 items = 0; 774 items = 0;
777 775
778 gc = (struct gaim_connection *)SvIV(ST(0)); 776 gc = (struct gaim_connection *)SvIV(ST(0));
779 if (g_slist_find(connections, gc)) 777 if (g_slist_find(gaim_get_connections(), gc))
780 buddy = gaim_find_buddy(gc->account, SvPV(ST(1), junk)); 778 buddy = gaim_find_buddy(gc->account, SvPV(ST(1), junk));
781 779
782 if (!buddy) 780 if (!buddy)
783 XSRETURN(0); 781 XSRETURN(0);
784 XST_mPV(0, buddy->name); 782 XST_mPV(0, buddy->name);
834 gc = (struct gaim_connection *)SvIV(ST(0)); 832 gc = (struct gaim_connection *)SvIV(ST(0));
835 nick = SvPV(ST(1), junk); 833 nick = SvPV(ST(1), junk);
836 what = SvPV(ST(2), junk); 834 what = SvPV(ST(2), junk);
837 isauto = SvIV(ST(3)); 835 isauto = SvIV(ST(3));
838 836
839 if (!g_slist_find(connections, gc)) { 837 if (!g_slist_find(gaim_get_connections(), gc)) {
840 XSRETURN(0); 838 XSRETURN(0);
841 return; 839 return;
842 } 840 }
843 serv_send_im(gc, nick, what, -1, isauto); 841 serv_send_im(gc, nick, what, -1, isauto);
844 XSRETURN(0); 842 XSRETURN(0);
856 854
857 gc = (struct gaim_connection *)SvIV(ST(0)); 855 gc = (struct gaim_connection *)SvIV(ST(0));
858 nick = SvPV(ST(1), junk); 856 nick = SvPV(ST(1), junk);
859 what = SvPV(ST(2), junk); 857 what = SvPV(ST(2), junk);
860 isauto = SvIV(ST(3)); 858 isauto = SvIV(ST(3));
861 if (!g_slist_find(connections, gc)) { 859 if (!g_slist_find(gaim_get_connections(), gc)) {
862 XSRETURN(0); 860 XSRETURN(0);
863 return; 861 return;
864 } 862 }
865 863
866 c = gaim_find_conversation(nick); 864 c = gaim_find_conversation(nick);
891 889
892 gc = (struct gaim_connection *)SvIV(ST(0)); 890 gc = (struct gaim_connection *)SvIV(ST(0));
893 id = SvIV(ST(1)); 891 id = SvIV(ST(1));
894 what = SvPV(ST(2), junk); 892 what = SvPV(ST(2), junk);
895 893
896 if (!g_slist_find(connections, gc)) { 894 if (!g_slist_find(gaim_get_connections(), gc)) {
897 XSRETURN(0); 895 XSRETURN(0);
898 return; 896 return;
899 } 897 }
900 bcs = gc->buddy_chats; 898 bcs = gc->buddy_chats;
901 while (bcs) { 899 while (bcs) {

mercurial