comparison libpurple/protocols/msn/slp.c @ 30448:911ca152210c

Remove old code that was commented out, but is really just not necessary.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Mon, 19 Apr 2010 08:05:55 +0000
parents e7d298d270bc
children 5be6177e369e
comparison
equal deleted inserted replaced
30447:e7d298d270bc 30448:911ca152210c
35 #include "smiley.h" 35 #include "smiley.h"
36 36
37 /* ms to delay between sending buddy icon requests to the server. */ 37 /* ms to delay between sending buddy icon requests to the server. */
38 #define BUDDY_ICON_DELAY 20 38 #define BUDDY_ICON_DELAY 20
39 39
40 /*
41 static void msn_slp_send_ok(MsnSlpCall *slpcall, const char *branch,
42 const char *type, const char *content);
43
44 static void msn_slp_send_decline(MsnSlpCall *slpcall, const char *branch,
45 const char *type, const char *content);
46 */
47 static void request_user_display(MsnUser *user); 40 static void request_user_display(MsnUser *user);
48 41
49 42
50 /************************************************************************** 43 /**************************************************************************
51 * Util 44 * Util
110 103
111 g_return_if_fail(xfer != NULL); 104 g_return_if_fail(xfer != NULL);
112 g_return_if_fail(xfer->data != NULL); 105 g_return_if_fail(xfer->data != NULL);
113 106
114 slpcall = xfer->data; 107 slpcall = xfer->data;
115
116 108
117 if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL) 109 if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL)
118 { 110 {
119 if (slpcall->started) 111 if (slpcall->started)
120 { 112 {
188 } 180 }
189 181
190 void 182 void
191 msn_xfer_end_cb(MsnSlpCall *slpcall, MsnSession *session) 183 msn_xfer_end_cb(MsnSlpCall *slpcall, MsnSession *session)
192 { 184 {
193 purple_debug_info("msn", "msn_xfer_end_cb\n");
194
195 if ((purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_DONE) && 185 if ((purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_DONE) &&
196 (purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_CANCEL_REMOTE) && 186 (purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_CANCEL_REMOTE) &&
197 (purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_CANCEL_LOCAL)) 187 (purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_CANCEL_LOCAL))
198 { 188 {
199 purple_xfer_cancel_remote(slpcall->xfer); 189 purple_xfer_cancel_remote(slpcall->xfer);
668 g_free(euf_guid); 658 g_free(euf_guid);
669 } 659 }
670 else if (!strcmp(type, "application/x-msnmsgr-transreqbody")) 660 else if (!strcmp(type, "application/x-msnmsgr-transreqbody"))
671 { 661 {
672 /* A direct connection negotiation request */ 662 /* A direct connection negotiation request */
673 char *bridges; 663 char *bridges;
674 664
675 purple_debug_info("msn", "got_invite: transreqbody received\n"); 665 purple_debug_info("msn", "got_invite: transreqbody received\n");
676 666
677 g_return_if_fail(slpcall->xfer != NULL); 667 g_return_if_fail(slpcall->xfer != NULL);
678 668
683 if(bridges && strstr(bridges, "TCPv1") != NULL) { 673 if(bridges && strstr(bridges, "TCPv1") != NULL) {
684 /* 674 /*
685 * Ok, the client supports direct TCP connection 675 * Ok, the client supports direct TCP connection
686 * Try to create a listening port 676 * Try to create a listening port
687 */ 677 */
688 char *content; 678 char *content;
689 MsnDirectConn *dc; 679 MsnDirectConn *dc;
690 680
691 dc = msn_dc_new(slpcall); 681 dc = msn_dc_new(slpcall);
692 682
693 dc->listen_data = purple_network_listen_range( 683 dc->listen_data = purple_network_listen_range(
694 0, 0, 684 0, 0,
736 { 726 {
737 /* A direct connection negotiation response */ 727 /* A direct connection negotiation response */
738 g_return_if_fail(slpcall->xfer != NULL); 728 g_return_if_fail(slpcall->xfer != NULL);
739 729
740 msn_slp_process_transresp(slpcall, content); 730 msn_slp_process_transresp(slpcall, content);
741 #if 0
742 char *ip_addrs;
743 char *temp;
744 char *nonce;
745 int port;
746
747 nonce = get_token(content, "Nonce: {", "}\r\n");
748 if (ip_addrs == NULL)
749 return;
750
751 ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n");
752
753 temp = get_token(content, "IPv4Internal-Port: ", "\r\n");
754 if (temp != NULL)
755 port = atoi(temp);
756 else
757 port = -1;
758 g_free(temp);
759
760 if (port > 0)
761 got_transresp(slpcall, nonce, ip_addrs, port);
762
763 g_free(nonce);
764 g_free(ip_addrs);
765 #endif
766 } 731 }
767 } 732 }
768 733
769 static void 734 static void
770 got_ok(MsnSlpCall *slpcall, 735 got_ok(MsnSlpCall *slpcall,
773 g_return_if_fail(slpcall != NULL); 738 g_return_if_fail(slpcall != NULL);
774 g_return_if_fail(type != NULL); 739 g_return_if_fail(type != NULL);
775 740
776 if (!strcmp(type, "application/x-msnmsgr-sessionreqbody")) 741 if (!strcmp(type, "application/x-msnmsgr-sessionreqbody"))
777 { 742 {
778 char *content; 743 char *content;
779 char *header; 744 char *header;
780 MsnSlpMessage *msg; 745 MsnSlpMessage *msg;
781 MsnDirectConn *dc; 746 MsnDirectConn *dc;
782 747
783 g_return_if_fail(slpcall->xfer != NULL); 748 g_return_if_fail(slpcall->xfer != NULL);
784 749
785 if(slpcall->slplink->dc != NULL) { 750 if (slpcall->slplink->dc != NULL) {
786 /* 751 /*
787 * If we already have an estabilished direct connection 752 * If we already have an established direct connection
788 * then just start the transfer. 753 * then just start the transfer.
789 */ 754 */
790 msn_slpcall_session_init(slpcall); 755 msn_slpcall_session_init(slpcall);
791 return; 756 return;
792 } 757 }
853 ); 818 );
854 g_free(header); 819 g_free(header);
855 g_free(content); 820 g_free(content);
856 821
857 msn_slplink_queue_slpmsg(slpcall->slplink, msg); 822 msn_slplink_queue_slpmsg(slpcall->slplink, msg);
858 #if 0 823
859 if (slpcall->type == MSN_SLPCALL_DC)
860 {
861 /* First let's try a DirectConnection. */
862
863 MsnSlpLink *slplink;
864 MsnSlpMessage *slpmsg;
865 char *header;
866 char *content;
867 char *branch;
868
869 slplink = slpcall->slplink;
870
871 branch = rand_guid();
872
873 content = g_strdup_printf(
874 "Bridges: TRUDPv1 TCPv1\r\n"
875 "NetID: 0\r\n"
876 "Conn-Type: Direct-Connect\r\n"
877 "UPnPNat: false\r\n"
878 "ICF: false\r\n"
879 );
880
881 header = g_strdup_printf("INVITE MSNMSGR:%s MSNSLP/1.0",
882 slplink->remote_user);
883
884 slpmsg = msn_slp_sipmsg_new(slpcall, 0, header, branch,
885 "application/x-msnmsgr-transreqbody",
886 content);
887
888 slpmsg->info = "SLP INVITE";
889 slpmsg->text_body = TRUE;
890 msn_slplink_send_slpmsg(slplink, slpmsg);
891
892 g_free(header);
893 g_free(content);
894
895 g_free(branch);
896 }
897 else
898 {
899 msn_slpcall_session_init(slpcall);
900 }
901 #else
902 /* 824 /*
903 * Removed because it messes up direct connection by 825 * Removed because it messes up direct connection by
904 * starting p2p transfer 826 * starting p2p transfer
905 */ 827 */
906 828
907 /* msn_slpcall_session_init(slpcall); */ 829 /* msn_slpcall_session_init(slpcall); */
908 #endif
909 } 830 }
910 else if (!strcmp(type, "application/x-msnmsgr-transreqbody")) 831 else if (!strcmp(type, "application/x-msnmsgr-transreqbody"))
911 { 832 {
912 /* Do we get this? */ 833 /* Do we get this? */
913 purple_debug_info("msn", "OK with transreqbody\n"); 834 purple_debug_info("msn", "OK with transreqbody\n");
914 } 835 }
915 else if (!strcmp(type, "application/x-msnmsgr-transrespbody")) 836 else if (!strcmp(type, "application/x-msnmsgr-transrespbody"))
916 { 837 {
917 msn_slp_process_transresp(slpcall, content); 838 msn_slp_process_transresp(slpcall, content);
918 #if 0
919 char *ip_addrs;
920 char *temp;
921 char *nonce;
922 int port;
923
924 nonce = get_token(content, "Nonce: {", "}\r\n");
925 if (ip_addrs == NULL)
926 return;
927
928 ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n");
929
930 temp = get_token(content, "IPv4Internal-Port: ", "\r\n");
931 if (temp != NULL)
932 port = atoi(temp);
933 else
934 port = -1;
935 g_free(temp);
936
937 if (port > 0)
938 got_transresp(slpcall, nonce, ip_addrs, port);
939
940 g_free(nonce);
941 g_free(ip_addrs);
942 #endif
943 } 839 }
944 } 840 }
945 841
946 MsnSlpCall * 842 MsnSlpCall *
947 msn_slp_sip_recv(MsnSlpLink *slplink, const char *body) 843 msn_slp_sip_recv(MsnSlpLink *slplink, const char *body)