Mercurial > pidgin.yaz
comparison libpurple/protocols/jabber/jabber.c @ 26190:d6e23439b77c
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
This allows for it to only be called once. From the caps returned you
can then tell which media capabilities a buddy has without having to
call the function for each different type.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Wed, 11 Feb 2009 00:01:20 +0000 |
parents | af42303654a5 |
children | 9fcff08ce726 |
comparison
equal
deleted
inserted
replaced
26189:76104100cb87 | 26190:d6e23439b77c |
---|---|
2589 return jabber_google_session_initiate(gc->proto_data, who, type); | 2589 return jabber_google_session_initiate(gc->proto_data, who, type); |
2590 else | 2590 else |
2591 return jingle_rtp_initiate_media(gc->proto_data, who, type); | 2591 return jingle_rtp_initiate_media(gc->proto_data, who, type); |
2592 } | 2592 } |
2593 | 2593 |
2594 gboolean jabber_can_do_media(PurpleConnection *gc, const char *who, | 2594 PurpleMediaCaps jabber_get_media_caps(PurpleConnection *gc, const char *who) |
2595 PurpleMediaSessionType type) | |
2596 { | 2595 { |
2597 JabberStream *js = (JabberStream *) gc->proto_data; | 2596 JabberStream *js = (JabberStream *) gc->proto_data; |
2598 JabberBuddy *jb; | 2597 JabberBuddy *jb; |
2598 PurpleMediaCaps caps = PURPLE_MEDIA_CAPS_NONE; | |
2599 | 2599 |
2600 if (!js) { | 2600 if (!js) { |
2601 purple_debug_error("jabber", "jabber_can_do_media: NULL stream\n"); | 2601 purple_debug_error("jabber", "jabber_can_do_media: NULL stream\n"); |
2602 return FALSE; | 2602 return FALSE; |
2603 } | 2603 } |
2607 if (!jb) { | 2607 if (!jb) { |
2608 purple_debug_error("jabber", "Could not find buddy\n"); | 2608 purple_debug_error("jabber", "Could not find buddy\n"); |
2609 return FALSE; | 2609 return FALSE; |
2610 } | 2610 } |
2611 | 2611 |
2612 if (!jabber_buddy_has_capability(jb, JINGLE_TRANSPORT_ICEUDP) && | 2612 if (jabber_buddy_has_capability(jb, JINGLE_APP_RTP_SUPPORT_AUDIO)) |
2613 !jabber_buddy_has_capability(jb, | 2613 caps |= PURPLE_MEDIA_CAPS_AUDIO | |
2614 JINGLE_TRANSPORT_RAWUDP) && | 2614 PURPLE_MEDIA_CAPS_AUDIO_SINGLE_DIRECTION; |
2615 !jabber_buddy_has_capability(jb, GTALK_CAP)) { | 2615 if (jabber_buddy_has_capability(jb, JINGLE_APP_RTP_SUPPORT_VIDEO)) |
2616 purple_debug_info("jingle-rtp", "Buddy doesn't support " | 2616 caps |= PURPLE_MEDIA_CAPS_VIDEO | |
2617 "the same transport types\n"); | 2617 PURPLE_MEDIA_CAPS_VIDEO_SINGLE_DIRECTION; |
2618 return FALSE; | 2618 if (caps & PURPLE_MEDIA_CAPS_AUDIO && caps & PURPLE_MEDIA_CAPS_VIDEO) |
2619 } | 2619 caps |= PURPLE_MEDIA_CAPS_AUDIO_VIDEO; |
2620 | 2620 if (caps != PURPLE_MEDIA_CAPS_NONE) { |
2621 /* XMPP will only support two-way media, AFAIK... */ | 2621 if (!jabber_buddy_has_capability(jb, |
2622 if (type == (PURPLE_MEDIA_AUDIO | PURPLE_MEDIA_VIDEO)) { | 2622 JINGLE_TRANSPORT_ICEUDP) && |
2623 purple_debug_info("jabber", | 2623 !jabber_buddy_has_capability(jb, |
2624 "Checking audio/video XEP support for %s\n", who); | 2624 JINGLE_TRANSPORT_RAWUDP)) { |
2625 return (jabber_buddy_has_capability(jb, JINGLE_APP_RTP_SUPPORT_AUDIO) || | 2625 purple_debug_info("jingle-rtp", "Buddy doesn't " |
2626 jabber_buddy_has_capability(jb, GTALK_CAP)) && | 2626 "support the same transport types\n"); |
2627 jabber_buddy_has_capability(jb, JINGLE_APP_RTP_SUPPORT_VIDEO); | 2627 caps = PURPLE_MEDIA_CAPS_NONE; |
2628 } else if (type == (PURPLE_MEDIA_AUDIO)) { | 2628 } else |
2629 purple_debug_info("jabber", | 2629 caps |= PURPLE_MEDIA_CAPS_MODIFY_SESSION | |
2630 "Checking audio XEP support for %s\n", who); | 2630 PURPLE_MEDIA_CAPS_CHANGE_DIRECTION; |
2631 return jabber_buddy_has_capability(jb, JINGLE_APP_RTP_SUPPORT_AUDIO) || | 2631 } |
2632 jabber_buddy_has_capability(jb, GTALK_CAP); | 2632 if (jabber_buddy_has_capability(jb, GTALK_CAP)) |
2633 } else if (type == (PURPLE_MEDIA_VIDEO)) { | 2633 caps |= PURPLE_MEDIA_CAPS_AUDIO; |
2634 purple_debug_info("jabber", | 2634 |
2635 "Checking video XEP support for %s\n", who); | 2635 return caps; |
2636 return jabber_buddy_has_capability(jb, JINGLE_APP_RTP_SUPPORT_VIDEO); | |
2637 } | |
2638 | |
2639 return FALSE; | |
2640 } | 2636 } |
2641 | 2637 |
2642 #endif | 2638 #endif |
2643 | 2639 |
2644 void jabber_register_commands(void) | 2640 void jabber_register_commands(void) |