comparison libpurple/protocols/jabber/jabber.c @ 25664:d0ac3c438b71

Check remote JID's capabilities for audio and video XEP support.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Sat, 31 May 2008 20:15:34 +0000
parents 28ab41065172
children 1f085713c281
comparison
equal deleted inserted replaced
25663:de644f7e3958 25664:d0ac3c438b71
58 #include "adhoccommands.h" 58 #include "adhoccommands.h"
59 #include "jingle.h" 59 #include "jingle.h"
60 60
61 #ifdef USE_VV 61 #ifdef USE_VV
62 #include <gst/farsight/fs-conference-iface.h> 62 #include <gst/farsight/fs-conference-iface.h>
63
64 #define XEP_0167_CAP "http://www.xmpp.org/extensions/xep-0167.html"
65 #define XEP_0180_CAP "http://www.xmpp.org/extensions/xep-0180.html"
66 #define GTALK_CAP "http://www.google.com/session/phone"
67
63 #endif 68 #endif
64 69
65 #define JABBER_CONNECT_STEPS (js->gsc ? 9 : 5) 70 #define JABBER_CONNECT_STEPS (js->gsc ? 9 : 5)
66 71
67 static PurplePlugin *my_protocol = NULL; 72 static PurplePlugin *my_protocol = NULL;
2638 } 2643 }
2639 2644
2640 gboolean jabber_can_do_media(PurpleConnection *gc, const char *who, 2645 gboolean jabber_can_do_media(PurpleConnection *gc, const char *who,
2641 PurpleMediaStreamType type) 2646 PurpleMediaStreamType type)
2642 { 2647 {
2643 if (type == PURPLE_MEDIA_AUDIO) 2648 JabberStream *js = (JabberStream *) gc->proto_data;
2644 return TRUE; 2649 JabberBuddy *jb = jabber_buddy_find(js, who, FALSE);
2645 else 2650
2651 if (!jb) {
2652 purple_debug_error("jabber", "Could not find buddy\n");
2646 return FALSE; 2653 return FALSE;
2654 }
2655 #if 0 /* These can be added once we support video */
2656 /* XMPP will only support two-way media, AFAIK... */
2657 if (type == (PURPLE_MEDIA_AUDIO | PURPLE_MEDIA_VIDEO)) {
2658 purple_debug_info("jabber",
2659 "Checking audio/video XEP support for %s\n", who);
2660 return (jabber_buddy_has_capability(jb, XEP_0167_CAP) ||
2661 jabber_buddy_has_capability(jb, GTALK_CAP)) &&
2662 jabber_buddy_has_capability(jb, XEP_0180_CAP);
2663 } else
2664 #endif
2665 if (type == (PURPLE_MEDIA_AUDIO)) {
2666 purple_debug_info("jabber",
2667 "Checking audio XEP support for %s\n", who);
2668 return jabber_buddy_has_capability(jb, XEP_0167_CAP) ||
2669 jabber_buddy_has_capability(jb, GTALK_CAP);
2670 }
2671 #if 0
2672 else if (type == (PURPLE_MEDIA_VIDEO)) {
2673 purple_debug_info("jabber",
2674 "Checking video XEP support for %s\n", who);
2675 return jabber_buddy_has_capability(jb, XEP_0180_CAP);
2676 }
2677 #endif
2678 return FALSE;
2647 } 2679 }
2648 2680
2649 2681
2650 void 2682 void
2651 jabber_handle_session_accept(JabberStream *js, xmlnode *packet) 2683 jabber_handle_session_accept(JabberStream *js, xmlnode *packet)