Mercurial > pidgin
comparison libpurple/protocols/jabber/jabber.c @ 24946:46387cbfaf85
propagate from branch 'im.pidgin.pidgin' (head 0e036cef0f8a3bdfd1d7f7fc082edca43d3153df)
to branch 'im.pidgin.maiku.vv' (head e27dec62113f7fa6c149e927bef4838231e7315a)
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Sun, 19 Oct 2008 04:59:51 +0000 |
parents | a61c017d3a99 8bfa1f01f035 |
children | 70ae1029bb70 |
comparison
equal
deleted
inserted
replaced
24264:c35bb090d1f3 | 24946:46387cbfaf85 |
---|---|
56 #include "si.h" | 56 #include "si.h" |
57 #include "xdata.h" | 57 #include "xdata.h" |
58 #include "pep.h" | 58 #include "pep.h" |
59 #include "adhoccommands.h" | 59 #include "adhoccommands.h" |
60 | 60 |
61 #include "jingle/jingle.h" | |
62 #include "jingle/rtp.h" | |
63 | |
64 #ifdef USE_VV | |
65 #include <gst/farsight/fs-conference-iface.h> | |
66 | |
67 #define GTALK_CAP "http://www.google.com/session/phone" | |
68 | |
69 #endif | |
61 | 70 |
62 #define JABBER_CONNECT_STEPS (js->gsc ? 9 : 5) | 71 #define JABBER_CONNECT_STEPS (js->gsc ? 9 : 5) |
63 | 72 |
64 static PurplePlugin *my_protocol = NULL; | 73 static PurplePlugin *my_protocol = NULL; |
65 GList *jabber_features = NULL; | 74 GList *jabber_features = NULL; |
662 js->next_id = g_random_int(); | 671 js->next_id = g_random_int(); |
663 js->write_buffer = purple_circ_buffer_new(512); | 672 js->write_buffer = purple_circ_buffer_new(512); |
664 js->old_length = 0; | 673 js->old_length = 0; |
665 js->keepalive_timeout = -1; | 674 js->keepalive_timeout = -1; |
666 js->certificate_CN = g_strdup(connect_server[0] ? connect_server : js->user ? js->user->domain : NULL); | 675 js->certificate_CN = g_strdup(connect_server[0] ? connect_server : js->user ? js->user->domain : NULL); |
676 #ifdef USE_VV | |
677 js->sessions = NULL; | |
678 #endif | |
667 | 679 |
668 if(!js->user) { | 680 if(!js->user) { |
669 purple_connection_error_reason (gc, | 681 purple_connection_error_reason (gc, |
670 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, | 682 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, |
671 _("Invalid XMPP ID")); | 683 _("Invalid XMPP ID")); |
1273 | 1285 |
1274 void jabber_close(PurpleConnection *gc) | 1286 void jabber_close(PurpleConnection *gc) |
1275 { | 1287 { |
1276 JabberStream *js = gc->proto_data; | 1288 JabberStream *js = gc->proto_data; |
1277 | 1289 |
1290 #ifdef USE_VV | |
1291 /* Close all of the open Jingle sessions on this stream */ | |
1292 jingle_terminate_sessions(js); | |
1293 #endif | |
1294 | |
1278 /* Don't perform any actions on the ssl connection | 1295 /* Don't perform any actions on the ssl connection |
1279 * if we were forcibly disconnected because it will crash | 1296 * if we were forcibly disconnected because it will crash |
1280 * on some SSL backends. | 1297 * on some SSL backends. |
1281 */ | 1298 */ |
1282 if (!gc->disconnect_timeout) | 1299 if (!gc->disconnect_timeout) |
1903 { | 1920 { |
1904 JabberStream *js = gc->proto_data; | 1921 JabberStream *js = gc->proto_data; |
1905 JabberID *jid; | 1922 JabberID *jid; |
1906 JabberBuddy *jb; | 1923 JabberBuddy *jb; |
1907 JabberBuddyResource *jbr; | 1924 JabberBuddyResource *jbr; |
1908 | 1925 |
1909 if(!(jid = jabber_id_new(who))) | 1926 if(!(jid = jabber_id_new(who))) |
1910 return; | 1927 return; |
1911 | 1928 |
1929 #ifdef USE_VV | |
1930 jingle_rtp_terminate_session(js, who); | |
1931 #endif | |
1912 if((jb = jabber_buddy_find(js, who, TRUE)) && | 1932 if((jb = jabber_buddy_find(js, who, TRUE)) && |
1913 (jbr = jabber_buddy_find_resource(jb, jid->resource))) { | 1933 (jbr = jabber_buddy_find_resource(jb, jid->resource))) { |
1914 if(jbr->thread_id) { | 1934 if(jbr->thread_id) { |
1915 g_free(jbr->thread_id); | 1935 g_free(jbr->thread_id); |
1916 jbr->thread_id = NULL; | 1936 jbr->thread_id = NULL; |
2383 | 2403 |
2384 gboolean jabber_offline_message(const PurpleBuddy *buddy) | 2404 gboolean jabber_offline_message(const PurpleBuddy *buddy) |
2385 { | 2405 { |
2386 return TRUE; | 2406 return TRUE; |
2387 } | 2407 } |
2408 #ifdef USE_VV | |
2409 | |
2410 PurpleMedia * | |
2411 jabber_initiate_media(PurpleConnection *gc, const char *who, | |
2412 PurpleMediaSessionType type) | |
2413 { | |
2414 return jingle_rtp_initiate_media(gc->proto_data, who, type); | |
2415 } | |
2416 | |
2417 gboolean jabber_can_do_media(PurpleConnection *gc, const char *who, | |
2418 PurpleMediaSessionType type) | |
2419 { | |
2420 JabberStream *js = (JabberStream *) gc->proto_data; | |
2421 JabberBuddy *jb; | |
2422 | |
2423 if (!js) { | |
2424 purple_debug_error("jabber", "jabber_can_do_media: NULL stream\n"); | |
2425 return FALSE; | |
2426 } | |
2427 | |
2428 jb = jabber_buddy_find(js, who, FALSE); | |
2429 | |
2430 if (!jb) { | |
2431 purple_debug_error("jabber", "Could not find buddy\n"); | |
2432 return FALSE; | |
2433 } | |
2434 /* XMPP will only support two-way media, AFAIK... */ | |
2435 if (type == (PURPLE_MEDIA_AUDIO | PURPLE_MEDIA_VIDEO)) { | |
2436 purple_debug_info("jabber", | |
2437 "Checking audio/video XEP support for %s\n", who); | |
2438 return (jabber_buddy_has_capability(jb, JINGLE_APP_RTP_SUPPORT_AUDIO) || | |
2439 jabber_buddy_has_capability(jb, GTALK_CAP)) && | |
2440 jabber_buddy_has_capability(jb, JINGLE_APP_RTP_SUPPORT_VIDEO); | |
2441 } else if (type == (PURPLE_MEDIA_AUDIO)) { | |
2442 purple_debug_info("jabber", | |
2443 "Checking audio XEP support for %s\n", who); | |
2444 return jabber_buddy_has_capability(jb, JINGLE_APP_RTP_SUPPORT_AUDIO) || | |
2445 jabber_buddy_has_capability(jb, GTALK_CAP); | |
2446 } else if (type == (PURPLE_MEDIA_VIDEO)) { | |
2447 purple_debug_info("jabber", | |
2448 "Checking video XEP support for %s\n", who); | |
2449 return jabber_buddy_has_capability(jb, JINGLE_APP_RTP_SUPPORT_VIDEO); | |
2450 } | |
2451 | |
2452 return FALSE; | |
2453 } | |
2454 | |
2455 #endif | |
2388 | 2456 |
2389 void jabber_register_commands(void) | 2457 void jabber_register_commands(void) |
2390 { | 2458 { |
2391 purple_cmd_register("config", "", PURPLE_CMD_P_PRPL, | 2459 purple_cmd_register("config", "", PURPLE_CMD_P_PRPL, |
2392 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | 2460 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, |