Mercurial > pidgin.yaz
comparison libpurple/protocols/jabber/jingle/rtp.c @ 26514:0adf41b3de79
Add a resource selector when initiating media.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Sat, 04 Apr 2009 02:26:49 +0000 |
parents | 2d332d327a0e |
children | 8399b545925c |
comparison
equal
deleted
inserted
replaced
26510:57324f0a0a83 | 26514:0adf41b3de79 |
---|---|
832 JingleTransport *transport; | 832 JingleTransport *transport; |
833 JabberBuddy *jb; | 833 JabberBuddy *jb; |
834 JabberBuddyResource *jbr; | 834 JabberBuddyResource *jbr; |
835 const gchar *transport_type; | 835 const gchar *transport_type; |
836 | 836 |
837 gchar *jid = NULL, *me = NULL, *sid = NULL; | 837 gchar *resource = NULL, *me = NULL, *sid = NULL; |
838 | 838 |
839 /* construct JID to send to */ | 839 /* construct JID to send to */ |
840 jb = jabber_buddy_find(js, who, FALSE); | 840 jb = jabber_buddy_find(js, who, FALSE); |
841 if (!jb) { | 841 if (!jb) { |
842 purple_debug_error("jingle-rtp", "Could not find Jabber buddy\n"); | 842 purple_debug_error("jingle-rtp", "Could not find Jabber buddy\n"); |
843 return FALSE; | 843 return FALSE; |
844 } | 844 } |
845 jbr = jabber_buddy_find_resource(jb, NULL); | 845 |
846 resource = jabber_get_resource(who); | |
847 jbr = jabber_buddy_find_resource(jb, resource); | |
848 g_free(resource); | |
849 | |
846 if (!jbr) { | 850 if (!jbr) { |
847 purple_debug_error("jingle-rtp", "Could not find buddy's resource\n"); | 851 purple_debug_error("jingle-rtp", "Could not find buddy's resource\n"); |
848 } | 852 } |
849 | 853 |
850 if (jabber_resource_has_capability(jbr, JINGLE_TRANSPORT_ICEUDP)) { | 854 if (jabber_resource_has_capability(jbr, JINGLE_TRANSPORT_ICEUDP)) { |
855 purple_debug_error("jingle-rtp", "Resource doesn't support " | 859 purple_debug_error("jingle-rtp", "Resource doesn't support " |
856 "the same transport types\n"); | 860 "the same transport types\n"); |
857 return FALSE; | 861 return FALSE; |
858 } | 862 } |
859 | 863 |
860 if ((strchr(who, '/') == NULL) && jbr && (jbr->name != NULL)) { | |
861 jid = g_strdup_printf("%s/%s", who, jbr->name); | |
862 } else { | |
863 jid = g_strdup(who); | |
864 } | |
865 | |
866 /* set ourselves as initiator */ | 864 /* set ourselves as initiator */ |
867 me = g_strdup_printf("%s@%s/%s", js->user->node, js->user->domain, js->user->resource); | 865 me = g_strdup_printf("%s@%s/%s", js->user->node, js->user->domain, js->user->resource); |
868 | 866 |
869 sid = jabber_get_next_id(js); | 867 sid = jabber_get_next_id(js); |
870 session = jingle_session_create(js, sid, me, jid, TRUE); | 868 session = jingle_session_create(js, sid, me, who, TRUE); |
871 g_free(sid); | 869 g_free(sid); |
872 | 870 |
873 | 871 |
874 if (type & PURPLE_MEDIA_AUDIO) { | 872 if (type & PURPLE_MEDIA_AUDIO) { |
875 transport = jingle_transport_create(transport_type); | 873 transport = jingle_transport_create(transport_type); |
886 jingle_session_add_content(session, content); | 884 jingle_session_add_content(session, content); |
887 JINGLE_RTP(content)->priv->media_type = g_strdup("video"); | 885 JINGLE_RTP(content)->priv->media_type = g_strdup("video"); |
888 jingle_rtp_init_media(content); | 886 jingle_rtp_init_media(content); |
889 } | 887 } |
890 | 888 |
891 g_free(jid); | |
892 g_free(me); | 889 g_free(me); |
893 | 890 |
894 if (jingle_rtp_get_media(session) == NULL) { | 891 if (jingle_rtp_get_media(session) == NULL) { |
895 return FALSE; | 892 return FALSE; |
896 } | 893 } |