- Timestamp:
- 2009-12-12T00:19:02Z (15 years ago)
- Branches:
- master
- Children:
- 1f4fc80
- Parents:
- 111fade
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
skype/skype.c
r111fade rc213d6b 27 27 #define SKYPE_DEFAULT_SERVER "localhost" 28 28 #define SKYPE_DEFAULT_PORT "2727" 29 #define IRC_LINE_SIZE 1024 29 30 #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) 30 31 … … 491 492 { 492 493 struct skype_data *sd = ic->proto_data; 493 char buf[ 1024];494 char buf[IRC_LINE_SIZE]; 494 495 char *id = strchr(line, ' '); 495 496 … … 509 510 * (4) Query chatname 510 511 */ 511 g_snprintf(buf, 1024, "GET CHATMESSAGE %s FROM_HANDLE\n", id);512 skype_write(ic, buf); 513 g_snprintf(buf, 1024, "GET CHATMESSAGE %s BODY\n", id);514 skype_write(ic, buf); 515 g_snprintf(buf, 1024, "GET CHATMESSAGE %s TYPE\n", id);516 skype_write(ic, buf); 517 g_snprintf(buf, 1024, "GET CHATMESSAGE %s CHATNAME\n", id);512 g_snprintf(buf, IRC_LINE_SIZE, "GET CHATMESSAGE %s FROM_HANDLE\n", id); 513 skype_write(ic, buf); 514 g_snprintf(buf, IRC_LINE_SIZE, "GET CHATMESSAGE %s BODY\n", id); 515 skype_write(ic, buf); 516 g_snprintf(buf, IRC_LINE_SIZE, "GET CHATMESSAGE %s TYPE\n", id); 517 skype_write(ic, buf); 518 g_snprintf(buf, IRC_LINE_SIZE, "GET CHATMESSAGE %s CHATNAME\n", id); 518 519 skype_write(ic, buf); 519 520 } else if (!strncmp(info, "FROM_HANDLE ", 12)) { … … 551 552 !strcmp(sd->type, "EMOTED")) { 552 553 if (!strcmp(sd->type, "SAID")) 553 g_snprintf(buf, 1024, "%s",554 g_snprintf(buf, IRC_LINE_SIZE, "%s", 554 555 body); 555 556 else 556 g_snprintf(buf, 1024, "/me %s",557 g_snprintf(buf, IRC_LINE_SIZE, "/me %s", 557 558 body); 558 559 if (!gc) … … 581 582 struct skype_data *sd = ic->proto_data; 582 583 char *id = strchr(line, ' '); 583 char buf[ 1024];584 char buf[IRC_LINE_SIZE]; 584 585 585 586 if (!++id) … … 597 598 g_free(sd->call_id); 598 599 sd->call_id = g_strdup(id); 599 g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id);600 g_snprintf(buf, IRC_LINE_SIZE, "GET CALL %s PARTNER_HANDLE\n", id); 600 601 skype_write(ic, buf); 601 602 sd->call_status = SKYPE_CALL_RINGING; 602 603 } else if (!strcmp(info, "STATUS MISSED")) { 603 g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id);604 g_snprintf(buf, IRC_LINE_SIZE, "GET CALL %s PARTNER_HANDLE\n", id); 604 605 skype_write(ic, buf); 605 606 sd->call_status = SKYPE_CALL_MISSED; 606 607 } else if (!strcmp(info, "STATUS CANCELLED")) { 607 g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id);608 g_snprintf(buf, IRC_LINE_SIZE, "GET CALL %s PARTNER_HANDLE\n", id); 608 609 skype_write(ic, buf); 609 610 sd->call_status = SKYPE_CALL_CANCELLED; 610 611 } else if (!strcmp(info, "STATUS FINISHED")) { 611 g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id);612 g_snprintf(buf, IRC_LINE_SIZE, "GET CALL %s PARTNER_HANDLE\n", id); 612 613 skype_write(ic, buf); 613 614 sd->call_status = SKYPE_CALL_FINISHED; 614 615 } else if (!strcmp(info, "STATUS REFUSED")) { 615 g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id);616 g_snprintf(buf, IRC_LINE_SIZE, "GET CALL %s PARTNER_HANDLE\n", id); 616 617 skype_write(ic, buf); 617 618 sd->call_status = SKYPE_CALL_REFUSED; … … 640 641 "the user %s.", info); 641 642 else { 642 g_snprintf(buf, 1024,643 g_snprintf(buf, IRC_LINE_SIZE, 643 644 "The user %s is currently ringing you.", 644 645 info); … … 689 690 { 690 691 struct skype_data *sd = ic->proto_data; 691 char buf[ 1024];692 char buf[IRC_LINE_SIZE]; 692 693 char *id = strchr(line, ' '); 693 694 … … 701 702 info++; 702 703 if (!strcmp(info, "STATUS NEW")) { 703 g_snprintf(buf, 1024, "GET FILETRANSFER %s PARTNER_HANDLE\n",704 g_snprintf(buf, IRC_LINE_SIZE, "GET FILETRANSFER %s PARTNER_HANDLE\n", 704 705 id); 705 706 skype_write(ic, buf); 706 707 sd->filetransfer_status = SKYPE_FILETRANSFER_NEW; 707 708 } else if (!strcmp(info, "STATUS FAILED")) { 708 g_snprintf(buf, 1024, "GET FILETRANSFER %s PARTNER_HANDLE\n",709 g_snprintf(buf, IRC_LINE_SIZE, "GET FILETRANSFER %s PARTNER_HANDLE\n", 709 710 id); 710 711 skype_write(ic, buf); … … 731 732 { 732 733 struct skype_data *sd = ic->proto_data; 733 char buf[ 1024];734 char buf[IRC_LINE_SIZE]; 734 735 char *id = strchr(line, ' '); 735 736 … … 749 750 if (!strcmp(info, "STATUS MULTI_SUBSCRIBED")) { 750 751 imcb_chat_new(ic, id); 751 g_snprintf(buf, 1024, "GET CHAT %s ADDER\n", id);752 skype_write(ic, buf); 753 g_snprintf(buf, 1024, "GET CHAT %s TOPIC\n", id);752 g_snprintf(buf, IRC_LINE_SIZE, "GET CHAT %s ADDER\n", id); 753 skype_write(ic, buf); 754 g_snprintf(buf, IRC_LINE_SIZE, "GET CHAT %s TOPIC\n", id); 754 755 skype_write(ic, buf); 755 756 } else if (!strcmp(info, "STATUS DIALOG") && sd->groupchat_with) { … … 761 762 * window on our client, so 762 763 * just leave it out. */ 763 /*g_snprintf(buf, 1024, "OPEN CHAT %s\n", id);764 /*g_snprintf(buf, IRC_LINE_SIZE, "OPEN CHAT %s\n", id); 764 765 skype_write(ic, buf);*/ 765 g_snprintf(buf, 1024, "%s@skype.com", sd->groupchat_with);766 g_snprintf(buf, IRC_LINE_SIZE, "%s@skype.com", sd->groupchat_with); 766 767 imcb_chat_add_buddy(gc, buf); 767 768 imcb_chat_add_buddy(gc, sd->username); 768 769 g_free(sd->groupchat_with); 769 770 sd->groupchat_with = NULL; 770 g_snprintf(buf, 1024, "GET CHAT %s ADDER\n", id);771 skype_write(ic, buf); 772 g_snprintf(buf, 1024, "GET CHAT %s TOPIC\n", id);771 g_snprintf(buf, IRC_LINE_SIZE, "GET CHAT %s ADDER\n", id); 772 skype_write(ic, buf); 773 g_snprintf(buf, IRC_LINE_SIZE, "GET CHAT %s TOPIC\n", id); 773 774 skype_write(ic, buf); 774 775 } else if (!strcmp(info, "STATUS UNSUBSCRIBED")) { … … 806 807 if (!strcmp(members[i], sd->username)) 807 808 continue; 808 g_snprintf(buf, 1024, "%s@skype.com", members[i]);809 g_snprintf(buf, IRC_LINE_SIZE, "%s@skype.com", members[i]); 809 810 if (!g_list_find_custom(gc->in_room, buf, 810 811 (GCompareFunc)strcmp)) … … 838 839 static void skype_parse_chats(struct im_connection *ic, char *line) 839 840 { 840 char buf[ 1024];841 char buf[IRC_LINE_SIZE]; 841 842 char **i; 842 843 char **chats = g_strsplit(line + 6, ", ", 0); … … 844 845 i = chats; 845 846 while (*i) { 846 g_snprintf(buf, 1024, "GET CHAT %s STATUS\n", *i);847 skype_write(ic, buf); 848 g_snprintf(buf, 1024, "GET CHAT %s ACTIVEMEMBERS\n", *i);847 g_snprintf(buf, IRC_LINE_SIZE, "GET CHAT %s STATUS\n", *i); 848 skype_write(ic, buf); 849 g_snprintf(buf, IRC_LINE_SIZE, "GET CHAT %s ACTIVEMEMBERS\n", *i); 849 850 skype_write(ic, buf); 850 851 i++; … … 860 861 struct im_connection *ic = data; 861 862 struct skype_data *sd = ic->proto_data; 862 char buf[ 1024];863 char buf[IRC_LINE_SIZE]; 863 864 int st, i; 864 865 char **lines, **lineptr, *line;
Note: See TracChangeset
for help on using the changeset viewer.