Mercurial > pidgin
comparison libpurple/protocols/jabber/jingle.c @ 23822:a7be3074923b
Corrected debug labels s/"jabber"/"jingle"/
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Fri, 06 Jun 2008 08:04:37 +0000 |
parents | e73b03097664 |
children | 9983353706b8 |
comparison
equal
deleted
inserted
replaced
23816:e73b03097664 | 23822:a7be3074923b |
---|---|
510 xmlnode_set_attrib(result->node, "to", | 510 xmlnode_set_attrib(result->node, "to", |
511 jabber_jingle_session_get_remote_jid(session)); | 511 jabber_jingle_session_get_remote_jid(session)); |
512 | 512 |
513 xmlnode_insert_child(result->node, jingle); | 513 xmlnode_insert_child(result->node, jingle); |
514 jabber_iq_send(result); | 514 jabber_iq_send(result); |
515 purple_debug_info("jabber", "Sent session accept, starting stream\n"); | 515 purple_debug_info("jingle", "Sent session accept, starting stream\n"); |
516 gst_element_set_state(purple_media_get_audio_pipeline(session->media), GST_STATE_PLAYING); | 516 gst_element_set_state(purple_media_get_audio_pipeline(session->media), GST_STATE_PLAYING); |
517 | 517 |
518 session->session_started = TRUE; | 518 session->session_started = TRUE; |
519 } | 519 } |
520 | 520 |
554 if (!jabber_jingle_session_is_initiator(session)) { | 554 if (!jabber_jingle_session_is_initiator(session)) { |
555 /* create transport-info package */ | 555 /* create transport-info package */ |
556 JabberIq *result = jabber_iq_new(jabber_jingle_session_get_js(session), | 556 JabberIq *result = jabber_iq_new(jabber_jingle_session_get_js(session), |
557 JABBER_IQ_SET); | 557 JABBER_IQ_SET); |
558 xmlnode *jingle = jabber_jingle_session_create_transport_info(session); | 558 xmlnode *jingle = jabber_jingle_session_create_transport_info(session); |
559 purple_debug_info("jabber", "jabber_session_candidates_prepared: %d candidates\n", | 559 purple_debug_info("jingle", "jabber_session_candidates_prepared: %d candidates\n", |
560 g_list_length(purple_media_get_local_audio_candidates(session->media))); | 560 g_list_length(purple_media_get_local_audio_candidates(session->media))); |
561 xmlnode_set_attrib(result->node, "to", | 561 xmlnode_set_attrib(result->node, "to", |
562 jabber_jingle_session_get_remote_jid(session)); | 562 jabber_jingle_session_get_remote_jid(session)); |
563 | 563 |
564 xmlnode_insert_child(result->node, jingle); | 564 xmlnode_insert_child(result->node, jingle); |
572 jabber_jingle_session_candidate_pair_established(PurpleMedia *media, | 572 jabber_jingle_session_candidate_pair_established(PurpleMedia *media, |
573 FsCandidate *native_candidate, | 573 FsCandidate *native_candidate, |
574 FsCandidate *remote_candidate, | 574 FsCandidate *remote_candidate, |
575 JingleSession *session) | 575 JingleSession *session) |
576 { | 576 { |
577 purple_debug_info("jabber", "jabber_candidate_pair_established called\n"); | 577 purple_debug_info("jingle", "jabber_candidate_pair_established called\n"); |
578 /* if we are the initiator, we should send a content-modify message */ | 578 /* if we are the initiator, we should send a content-modify message */ |
579 if (jabber_jingle_session_is_initiator(session)) { | 579 if (jabber_jingle_session_is_initiator(session)) { |
580 JabberIq *result; | 580 JabberIq *result; |
581 xmlnode *jingle; | 581 xmlnode *jingle; |
582 | 582 |
583 purple_debug_info("jabber", "we are the initiator, let's send content-modify\n"); | 583 purple_debug_info("jingle", "we are the initiator, let's send content-modify\n"); |
584 | 584 |
585 result = jabber_iq_new(jabber_jingle_session_get_js(session), JABBER_IQ_SET); | 585 result = jabber_iq_new(jabber_jingle_session_get_js(session), JABBER_IQ_SET); |
586 | 586 |
587 /* shall change this to a "content-replace" */ | 587 /* shall change this to a "content-replace" */ |
588 jingle = jabber_jingle_session_create_content_replace(session, | 588 jingle = jabber_jingle_session_create_content_replace(session, |
604 | 604 |
605 media = purple_media_manager_create_media(purple_media_manager_get(), | 605 media = purple_media_manager_create_media(purple_media_manager_get(), |
606 session->js->gc, "fsrtpconference", remote_jid); | 606 session->js->gc, "fsrtpconference", remote_jid); |
607 | 607 |
608 if (!media) { | 608 if (!media) { |
609 purple_debug_error("jabber", "Couldn't create fsrtpconference\n"); | 609 purple_debug_error("jingle", "Couldn't create fsrtpconference\n"); |
610 return FALSE; | 610 return FALSE; |
611 } | 611 } |
612 | 612 |
613 /* this will need to be changed to "nice" once the libnice transmitter is finished */ | 613 /* this will need to be changed to "nice" once the libnice transmitter is finished */ |
614 if (!purple_media_add_stream(media, remote_jid, PURPLE_MEDIA_AUDIO, "rawudp")) { | 614 if (!purple_media_add_stream(media, remote_jid, PURPLE_MEDIA_AUDIO, "rawudp")) { |
615 purple_debug_error("jabber", "Couldn't create audio stream\n"); | 615 purple_debug_error("jingle", "Couldn't create audio stream\n"); |
616 purple_media_reject(media); | 616 purple_media_reject(media); |
617 return FALSE; | 617 return FALSE; |
618 } | 618 } |
619 | 619 |
620 jabber_jingle_session_set_remote_jid(session, remote_jid); | 620 jabber_jingle_session_set_remote_jid(session, remote_jid); |
659 } | 659 } |
660 | 660 |
661 /* create transport-info package */ | 661 /* create transport-info package */ |
662 result = jabber_iq_new(jabber_jingle_session_get_js(session), JABBER_IQ_SET); | 662 result = jabber_iq_new(jabber_jingle_session_get_js(session), JABBER_IQ_SET); |
663 jingle = jabber_jingle_session_create_transport_info(session); | 663 jingle = jabber_jingle_session_create_transport_info(session); |
664 purple_debug_info("jabber", "jabber_session_candidates_prepared: %d candidates\n", | 664 purple_debug_info("jingle", "jabber_session_candidates_prepared: %d candidates\n", |
665 g_list_length(purple_media_get_local_audio_candidates(session->media))); | 665 g_list_length(purple_media_get_local_audio_candidates(session->media))); |
666 xmlnode_set_attrib(result->node, "to", | 666 xmlnode_set_attrib(result->node, "to", |
667 jabber_jingle_session_get_remote_jid(session)); | 667 jabber_jingle_session_get_remote_jid(session)); |
668 | 668 |
669 xmlnode_insert_child(result->node, jingle); | 669 xmlnode_insert_child(result->node, jingle); |
686 char *jid = NULL, *me = NULL; | 686 char *jid = NULL, *me = NULL; |
687 | 687 |
688 /* construct JID to send to */ | 688 /* construct JID to send to */ |
689 jb = jabber_buddy_find(js, who, FALSE); | 689 jb = jabber_buddy_find(js, who, FALSE); |
690 if (!jb) { | 690 if (!jb) { |
691 purple_debug_error("jabber", "Could not find Jabber buddy\n"); | 691 purple_debug_error("jingle", "Could not find Jabber buddy\n"); |
692 return NULL; | 692 return NULL; |
693 } | 693 } |
694 jbr = jabber_buddy_find_resource(jb, NULL); | 694 jbr = jabber_buddy_find_resource(jb, NULL); |
695 if (!jbr) { | 695 if (!jbr) { |
696 purple_debug_error("jabber", "Could not find buddy's resource\n"); | 696 purple_debug_error("jingle", "Could not find buddy's resource\n"); |
697 } | 697 } |
698 | 698 |
699 if ((strchr(who, '/') == NULL) && jbr && (jbr->name != NULL)) { | 699 if ((strchr(who, '/') == NULL) && jbr && (jbr->name != NULL)) { |
700 jid = g_strdup_printf("%s/%s", who, jbr->name); | 700 jid = g_strdup_printf("%s/%s", who, jbr->name); |
701 } else { | 701 } else { |
800 | 800 |
801 description = xmlnode_get_child(content, "description"); | 801 description = xmlnode_get_child(content, "description"); |
802 transport = xmlnode_get_child(content, "transport"); | 802 transport = xmlnode_get_child(content, "transport"); |
803 | 803 |
804 /* fetch codecs from remote party */ | 804 /* fetch codecs from remote party */ |
805 purple_debug_info("jabber", "get codecs from session-accept\n"); | 805 purple_debug_info("jingle", "get codecs from session-accept\n"); |
806 remote_codecs = jabber_jingle_get_codecs(description); | 806 remote_codecs = jabber_jingle_get_codecs(description); |
807 purple_debug_info("jabber", "get transport candidates from session accept\n"); | 807 purple_debug_info("jingle", "get transport candidates from session accept\n"); |
808 remote_transports = jabber_jingle_get_candidates(transport); | 808 remote_transports = jabber_jingle_get_candidates(transport); |
809 | 809 |
810 purple_debug_info("jabber", "Got %d codecs from responder\n", | 810 purple_debug_info("jingle", "Got %d codecs from responder\n", |
811 g_list_length(remote_codecs)); | 811 g_list_length(remote_codecs)); |
812 purple_debug_info("jabber", "Got %d transport candidates from responder\n", | 812 purple_debug_info("jingle", "Got %d transport candidates from responder\n", |
813 g_list_length(remote_transports)); | 813 g_list_length(remote_transports)); |
814 | 814 |
815 purple_debug_info("jabber", "Setting remote codecs on stream\n"); | 815 purple_debug_info("jingle", "Setting remote codecs on stream\n"); |
816 | 816 |
817 purple_media_set_remote_audio_codecs(session->media, | 817 purple_media_set_remote_audio_codecs(session->media, |
818 jabber_jingle_session_get_remote_jid(session), | 818 jabber_jingle_session_get_remote_jid(session), |
819 remote_codecs); | 819 remote_codecs); |
820 | 820 |
821 codec_intersection = purple_media_get_negotiated_audio_codecs(session->media); | 821 codec_intersection = purple_media_get_negotiated_audio_codecs(session->media); |
822 purple_debug_info("jabber", "codec_intersection contains %d elems\n", | 822 purple_debug_info("jingle", "codec_intersection contains %d elems\n", |
823 g_list_length(codec_intersection)); | 823 g_list_length(codec_intersection)); |
824 /* get the top codec */ | 824 /* get the top codec */ |
825 if (g_list_length(codec_intersection) > 0) { | 825 if (g_list_length(codec_intersection) > 0) { |
826 top = (FsCodec *) codec_intersection->data; | 826 top = (FsCodec *) codec_intersection->data; |
827 purple_debug_info("jabber", "Found a suitable codec on stream = %d\n", | 827 purple_debug_info("jingle", "Found a suitable codec on stream = %d\n", |
828 top->id); | 828 top->id); |
829 | 829 |
830 /* we have found a suitable codec, but we will not start the stream | 830 /* we have found a suitable codec, but we will not start the stream |
831 just yet, wait for transport negotiation to complete... */ | 831 just yet, wait for transport negotiation to complete... */ |
832 } | 832 } |
848 | 848 |
849 g_list_free(codec_intersection); | 849 g_list_free(codec_intersection); |
850 | 850 |
851 if (!strcmp(action, "session-accept")) { | 851 if (!strcmp(action, "session-accept")) { |
852 purple_media_got_accept(jabber_jingle_session_get_media(session)); | 852 purple_media_got_accept(jabber_jingle_session_get_media(session)); |
853 purple_debug_info("jabber", "Got session-accept, starting stream\n"); | 853 purple_debug_info("jingle", "Got session-accept, starting stream\n"); |
854 gst_element_set_state(purple_media_get_audio_pipeline(session->media), | 854 gst_element_set_state(purple_media_get_audio_pipeline(session->media), |
855 GST_STATE_PLAYING); | 855 GST_STATE_PLAYING); |
856 } | 856 } |
857 | 857 |
858 jabber_iq_send(result); | 858 jabber_iq_send(result); |
871 const char *initiator = NULL; | 871 const char *initiator = NULL; |
872 GList *codecs = NULL; | 872 GList *codecs = NULL; |
873 JabberIq *result = NULL; | 873 JabberIq *result = NULL; |
874 | 874 |
875 if (!jingle) { | 875 if (!jingle) { |
876 purple_debug_error("jabber", "Malformed request"); | 876 purple_debug_error("jingle", "Malformed request"); |
877 return; | 877 return; |
878 } | 878 } |
879 | 879 |
880 sid = xmlnode_get_attrib(jingle, "sid"); | 880 sid = xmlnode_get_attrib(jingle, "sid"); |
881 initiator = xmlnode_get_attrib(jingle, "initiator"); | 881 initiator = xmlnode_get_attrib(jingle, "initiator"); |
882 | 882 |
883 if (jabber_jingle_session_find_by_id(js, sid)) { | 883 if (jabber_jingle_session_find_by_id(js, sid)) { |
884 /* This should only happen if you start a session with yourself */ | 884 /* This should only happen if you start a session with yourself */ |
885 purple_debug_error("jabber", "Jingle session with id={%s} already exists\n", sid); | 885 purple_debug_error("jingle", "Jingle session with id={%s} already exists\n", sid); |
886 return; | 886 return; |
887 } | 887 } |
888 session = jabber_jingle_session_create_by_id(js, sid); | 888 session = jabber_jingle_session_create_by_id(js, sid); |
889 | 889 |
890 /* init media */ | 890 /* init media */ |
891 content = xmlnode_get_child(jingle, "content"); | 891 content = xmlnode_get_child(jingle, "content"); |
892 if (!content) { | 892 if (!content) { |
893 purple_debug_error("jabber", "jingle tag must contain content tag\n"); | 893 purple_debug_error("jingle", "jingle tag must contain content tag\n"); |
894 /* should send error here */ | 894 /* should send error here */ |
895 return; | 895 return; |
896 } | 896 } |
897 | 897 |
898 description = xmlnode_get_child(content, "description"); | 898 description = xmlnode_get_child(content, "description"); |
899 | 899 |
900 if (!description) { | 900 if (!description) { |
901 purple_debug_error("jabber", "content tag must contain description tag\n"); | 901 purple_debug_error("jingle", "content tag must contain description tag\n"); |
902 /* we should create an error iq here */ | 902 /* we should create an error iq here */ |
903 return; | 903 return; |
904 } | 904 } |
905 | 905 |
906 if (!jabber_jingle_session_initiate_media_internal(session, initiator, initiator)) { | 906 if (!jabber_jingle_session_initiate_media_internal(session, initiator, initiator)) { |
907 purple_debug_error("jabber", "Couldn't start media session with %s\n", initiator); | 907 purple_debug_error("jingle", "Couldn't start media session with %s\n", initiator); |
908 jabber_jingle_session_destroy(session); | 908 jabber_jingle_session_destroy(session); |
909 /* we should create an error iq here */ | 909 /* we should create an error iq here */ |
910 return; | 910 return; |
911 } | 911 } |
912 | 912 |
927 xmlnode *jingle = xmlnode_get_child(packet, "jingle"); | 927 xmlnode *jingle = xmlnode_get_child(packet, "jingle"); |
928 const char *sid = xmlnode_get_attrib(jingle, "sid"); | 928 const char *sid = xmlnode_get_attrib(jingle, "sid"); |
929 JingleSession *session = jabber_jingle_session_find_by_id(js, sid); | 929 JingleSession *session = jabber_jingle_session_find_by_id(js, sid); |
930 | 930 |
931 if (!session) { | 931 if (!session) { |
932 purple_debug_error("jabber", "jabber_handle_session_terminate couldn't find session\n"); | 932 purple_debug_error("jingle", "jabber_handle_session_terminate couldn't find session\n"); |
933 return; | 933 return; |
934 } | 934 } |
935 | 935 |
936 xmlnode_set_attrib(result->node, "to", | 936 xmlnode_set_attrib(result->node, "to", |
937 jabber_jingle_session_get_remote_jid(session)); | 937 jabber_jingle_session_get_remote_jid(session)); |
958 GList *remote_candidates = jabber_jingle_get_candidates(transport); | 958 GList *remote_candidates = jabber_jingle_get_candidates(transport); |
959 const char *sid = xmlnode_get_attrib(jingle, "sid"); | 959 const char *sid = xmlnode_get_attrib(jingle, "sid"); |
960 JingleSession *session = jabber_jingle_session_find_by_id(js, sid); | 960 JingleSession *session = jabber_jingle_session_find_by_id(js, sid); |
961 | 961 |
962 if (!session) | 962 if (!session) |
963 purple_debug_error("jabber", "jabber_handle_session_candidates couldn't find session\n"); | 963 purple_debug_error("jingle", "jabber_handle_session_candidates couldn't find session\n"); |
964 | 964 |
965 /* send acknowledement */ | 965 /* send acknowledement */ |
966 xmlnode_set_attrib(result->node, "id", xmlnode_get_attrib(packet, "id")); | 966 xmlnode_set_attrib(result->node, "id", xmlnode_get_attrib(packet, "id")); |
967 xmlnode_set_attrib(result->node, "to", xmlnode_get_attrib(packet, "from")); | 967 xmlnode_set_attrib(result->node, "to", xmlnode_get_attrib(packet, "from")); |
968 jabber_iq_send(result); | 968 jabber_iq_send(result); |