| 54 #include "ping.h" |
54 #include "ping.h" |
| 55 #include "si.h" |
55 #include "si.h" |
| 56 #include "xdata.h" |
56 #include "xdata.h" |
| 57 #include "pep.h" |
57 #include "pep.h" |
| 58 #include "adhoccommands.h" |
58 #include "adhoccommands.h" |
| |
59 #include "jingle.h" |
| |
60 |
| |
61 #ifdef USE_VV |
| |
62 #include <gst/farsight/fs-conference-iface.h> |
| |
63 |
| |
64 #define XEP_0167_AUDIO_CAP "urn:xmpp:tmp:jingle:apps:rtp#audio" |
| |
65 #define XEP_0167_VIDEO_CAP "urn:xmpp:tmp:jingle:apps:rtp#video" |
| |
66 #define GTALK_CAP "http://www.google.com/session/phone" |
| |
67 |
| |
68 #endif |
| 59 |
69 |
| 60 #define JABBER_CONNECT_STEPS (js->gsc ? 9 : 5) |
70 #define JABBER_CONNECT_STEPS (js->gsc ? 9 : 5) |
| 61 |
71 |
| 62 static PurplePlugin *my_protocol = NULL; |
72 static PurplePlugin *my_protocol = NULL; |
| 63 GList *jabber_features = NULL; |
73 GList *jabber_features = NULL; |
| 656 js->next_id = g_random_int(); |
666 js->next_id = g_random_int(); |
| 657 js->write_buffer = purple_circ_buffer_new(512); |
667 js->write_buffer = purple_circ_buffer_new(512); |
| 658 js->old_length = 0; |
668 js->old_length = 0; |
| 659 js->keepalive_timeout = -1; |
669 js->keepalive_timeout = -1; |
| 660 js->certificate_CN = g_strdup(connect_server[0] ? connect_server : js->user ? js->user->domain : NULL); |
670 js->certificate_CN = g_strdup(connect_server[0] ? connect_server : js->user ? js->user->domain : NULL); |
| |
671 |
| |
672 #ifdef USE_VV |
| |
673 js->sessions = NULL; |
| |
674 #endif |
| 661 |
675 |
| 662 if(!js->user) { |
676 if(!js->user) { |
| 663 purple_connection_error_reason (gc, |
677 purple_connection_error_reason (gc, |
| 664 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, |
678 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, |
| 665 _("Invalid XMPP ID")); |
679 _("Invalid XMPP ID")); |
| 1267 |
1281 |
| 1268 void jabber_close(PurpleConnection *gc) |
1282 void jabber_close(PurpleConnection *gc) |
| 1269 { |
1283 { |
| 1270 JabberStream *js = gc->proto_data; |
1284 JabberStream *js = gc->proto_data; |
| 1271 |
1285 |
| |
1286 #ifdef USE_VV |
| |
1287 /* Close all of the open Jingle sessions on this stream */ |
| |
1288 jabber_jingle_session_terminate_sessions(js); |
| |
1289 #endif |
| |
1290 |
| 1272 /* Don't perform any actions on the ssl connection |
1291 /* Don't perform any actions on the ssl connection |
| 1273 * if we were forcibly disconnected because it will crash |
1292 * if we were forcibly disconnected because it will crash |
| 1274 * on some SSL backends. |
1293 * on some SSL backends. |
| 1275 */ |
1294 */ |
| 1276 if (!gc->disconnect_timeout) |
1295 if (!gc->disconnect_timeout) |
| 1896 JabberBuddyResource *jbr; |
1915 JabberBuddyResource *jbr; |
| 1897 |
1916 |
| 1898 if(!(jid = jabber_id_new(who))) |
1917 if(!(jid = jabber_id_new(who))) |
| 1899 return; |
1918 return; |
| 1900 |
1919 |
| |
1920 #ifdef USE_VV |
| |
1921 jabber_jingle_session_terminate_session_media(js, who); |
| |
1922 #endif |
| 1901 if((jb = jabber_buddy_find(js, who, TRUE)) && |
1923 if((jb = jabber_buddy_find(js, who, TRUE)) && |
| 1902 (jbr = jabber_buddy_find_resource(jb, jid->resource))) { |
1924 (jbr = jabber_buddy_find_resource(jb, jid->resource))) { |
| 1903 if(jbr->thread_id) { |
1925 if(jbr->thread_id) { |
| 1904 g_free(jbr->thread_id); |
1926 g_free(jbr->thread_id); |
| 1905 jbr->thread_id = NULL; |
1927 jbr->thread_id = NULL; |
| 2372 |
2394 |
| 2373 gboolean jabber_offline_message(const PurpleBuddy *buddy) |
2395 gboolean jabber_offline_message(const PurpleBuddy *buddy) |
| 2374 { |
2396 { |
| 2375 return TRUE; |
2397 return TRUE; |
| 2376 } |
2398 } |
| |
2399 |
| |
2400 #ifdef USE_VV |
| |
2401 |
| |
2402 PurpleMedia * |
| |
2403 jabber_initiate_media(PurpleConnection *gc, const char *who, |
| |
2404 PurpleMediaStreamType type) |
| |
2405 { |
| |
2406 return jabber_jingle_session_initiate_media(gc->proto_data, who, type); |
| |
2407 } |
| |
2408 |
| |
2409 gboolean jabber_can_do_media(PurpleConnection *gc, const char *who, |
| |
2410 PurpleMediaStreamType type) |
| |
2411 { |
| |
2412 JabberStream *js = (JabberStream *) gc->proto_data; |
| |
2413 JabberBuddy *jb; |
| |
2414 |
| |
2415 if (!js) { |
| |
2416 purple_debug_error("jabber", "jabber_can_do_media: NULL stream\n"); |
| |
2417 return FALSE; |
| |
2418 } |
| |
2419 |
| |
2420 jb = jabber_buddy_find(js, who, FALSE); |
| |
2421 |
| |
2422 if (!jb) { |
| |
2423 purple_debug_error("jabber", "Could not find buddy\n"); |
| |
2424 return FALSE; |
| |
2425 } |
| |
2426 /* XMPP will only support two-way media, AFAIK... */ |
| |
2427 if (type == (PURPLE_MEDIA_AUDIO | PURPLE_MEDIA_VIDEO)) { |
| |
2428 purple_debug_info("jabber", |
| |
2429 "Checking audio/video XEP support for %s\n", who); |
| |
2430 return (jabber_buddy_has_capability(jb, XEP_0167_AUDIO_CAP) || |
| |
2431 jabber_buddy_has_capability(jb, GTALK_CAP)) && |
| |
2432 jabber_buddy_has_capability(jb, XEP_0167_VIDEO_CAP); |
| |
2433 } else if (type == (PURPLE_MEDIA_AUDIO)) { |
| |
2434 purple_debug_info("jabber", |
| |
2435 "Checking audio XEP support for %s\n", who); |
| |
2436 return jabber_buddy_has_capability(jb, XEP_0167_AUDIO_CAP) || |
| |
2437 jabber_buddy_has_capability(jb, GTALK_CAP); |
| |
2438 } else if (type == (PURPLE_MEDIA_VIDEO)) { |
| |
2439 purple_debug_info("jabber", |
| |
2440 "Checking video XEP support for %s\n", who); |
| |
2441 return jabber_buddy_has_capability(jb, XEP_0167_VIDEO_CAP); |
| |
2442 } |
| |
2443 |
| |
2444 return FALSE; |
| |
2445 } |
| |
2446 |
| |
2447 #endif |
| 2377 |
2448 |
| 2378 void jabber_register_commands(void) |
2449 void jabber_register_commands(void) |
| 2379 { |
2450 { |
| 2380 purple_cmd_register("config", "", PURPLE_CMD_P_PRPL, |
2451 purple_cmd_register("config", "", PURPLE_CMD_P_PRPL, |
| 2381 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, |
2452 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, |