Mercurial > pidgin
comparison libpurple/protocols/jabber/jingle/jingle.c @ 26080:88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Is used for STUN candidate genration, unless a STUN server is set in prefs
Does not handle GTalk relay setup yet
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Tue, 03 Feb 2009 21:37:27 +0000 |
parents | db517c55c508 |
children | 0a5737e1e969 |
comparison
equal
deleted
inserted
replaced
26079:2b843d38d1f2 | 26080:88f183f7dfc7 |
---|---|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA | 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
19 * | 19 * |
20 */ | 20 */ |
21 | 21 |
22 #include "internal.h" | 22 #include "internal.h" |
23 #include "network.h" | |
23 | 24 |
24 #include "content.h" | 25 #include "content.h" |
25 #include "debug.h" | 26 #include "debug.h" |
26 #include "jingle.h" | 27 #include "jingle.h" |
27 #include <string.h> | 28 #include <string.h> |
436 if (js->sessions) | 437 if (js->sessions) |
437 g_hash_table_foreach(js->sessions, | 438 g_hash_table_foreach(js->sessions, |
438 jingle_terminate_sessions_gh, NULL); | 439 jingle_terminate_sessions_gh, NULL); |
439 } | 440 } |
440 | 441 |
442 GParameter * | |
443 jingle_get_params(JabberStream *js, guint *num) | |
444 { | |
445 /* don't set a STUN server if one is set globally in prefs, in that case | |
446 this will be handled in media.c */ | |
447 gboolean has_account_stun = js->stun_ip && !purple_network_get_stun_ip(); | |
448 guint num_params = has_account_stun ? 2 : 0; | |
449 GParameter *params = NULL; | |
450 | |
451 if (num_params > 0) { | |
452 params = g_new0(GParameter, num_params); | |
453 | |
454 purple_debug_info("jabber", | |
455 "setting param stun-ip for stream using Google auto-config: %s\n", | |
456 js->stun_ip); | |
457 params[0].name = "stun-ip"; | |
458 g_value_init(¶ms[0].value, G_TYPE_STRING); | |
459 g_value_set_string(¶ms[0].value, js->stun_ip); | |
460 purple_debug_info("jabber", | |
461 "setting param stun-port for stream using Google auto-config: %d\n", | |
462 js->stun_port); | |
463 params[1].name = "stun-port"; | |
464 g_value_init(¶ms[1].value, G_TYPE_UINT); | |
465 g_value_set_uint(¶ms[1].value, js->stun_port); | |
466 } | |
467 | |
468 *num = num_params; | |
469 return params; | |
470 } |