pidgin.vv: 106c6ba8: Added some preliminary prefs settings fo...

malu at pidgin.im malu at pidgin.im
Fri Jan 9 19:50:33 EST 2009


-----------------------------------------------------------------
Revision: 106c6ba87b3a431f8ec3adad7e4e569f3d008f83
Ancestor: 07557d13ad7bbfd34e6cb96dd34cfb2daea2c20d
Author: malu at pidgin.im
Date: 2009-01-10T00:49:07
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/106c6ba87b3a431f8ec3adad7e4e569f3d008f83

Modified files:
        libpurple/media.c pidgin/gtkprefs.c

ChangeLog: 

Added some preliminary prefs settings for configuring a TURN relay server
Broke out the hostname -> IP lookup code used when setting the stun-ip
property
It doesn't yet set the properties for the TURN relay...

-------------- next part --------------
============================================================
--- libpurple/media.c	0ba55271e26591e8945e7c130a0d1297f8f329b2
+++ libpurple/media.c	aa453673acb28aa529d040f9945e9ccce3c1c00c
@@ -1277,27 +1277,36 @@ purple_media_src_pad_added_cb(FsStream *
 				stream->session->id, stream->participant);
 }
 
+/* this should probably be made IPv6-compatible some time, and made async?
+ maybe this should be a public function in libpurple...*/
 static gchar *
-purple_media_get_stun_pref_ip()
+purple_media_get_ip(const gchar *hostname)
 {
-	const gchar *stun_pref =
-			purple_prefs_get_string("/purple/network/stun_server");
 	struct hostent *host;
 
-	if ((host = gethostbyname(stun_pref)) && host->h_addr) {
-		gchar *stun_ip = g_strdup_printf("%hhu.%hhu.%hhu.%hhu",
+	if ((host = gethostbyname(hostname)) && host->h_addr) {
+		gchar *ip = g_strdup_printf("%hhu.%hhu.%hhu.%hhu",
 				host->h_addr[0], host->h_addr[1],
 				host->h_addr[2], host->h_addr[3]);
 		purple_debug_info("media", "IP address for %s found: %s\n",
-				stun_pref, stun_ip);
-		return stun_ip;
+				hostname, ip);
+		return ip;
 	} else {
 		purple_debug_info("media", "Unable to resolve %s IP address\n",
-				stun_pref);
+				hostname);
 		return NULL;
 	}
 }
 
+static gchar *
+purple_media_get_stun_pref_ip()
+{
+	const gchar *stun_pref =
+			purple_prefs_get_string("/purple/network/stun_server");
+	
+	return purple_media_get_ip(stun_pref);
+}
+
 static gboolean
 purple_media_add_stream_internal(PurpleMedia *media, const gchar *sess_id,
 				 const gchar *who, FsMediaType type,
============================================================
--- pidgin/gtkprefs.c	7a128c9282757c569a277232a06b6f107f539e99
+++ pidgin/gtkprefs.c	7459f4bea8cbf951be3bf717ab67e44c5028db91
@@ -1286,6 +1286,20 @@ network_page(void)
 	g_signal_connect(G_OBJECT(ports_checkbox), "clicked",
 					 G_CALLBACK(pidgin_toggle_sensitive), spin_button);
 
+	/* Relay server (TURN) */
+	vbox = pidgin_make_frame(ret, _("Relay Server"));
+	sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+	pidgin_prefs_labeled_entry(vbox, _("_TURN server:"),
+			"/purple/network/turn_server", sg);
+	spin_button = pidgin_prefs_labeled_spin_button(vbox, _("_Port:"),
+			"/purple/network/turn_port", 0, 65535, sg);
+	pidgin_prefs_labeled_entry(vbox, 
+			_("_Username:"),
+			"/purple/network/turn_username", sg);
+	pidgin_prefs_labeled_entry(vbox, 
+			_("_Password:"),
+			"/purple/network/turn_password", sg);
+	
 	if (purple_running_gnome()) {
 		vbox = pidgin_make_frame(ret, _("Proxy Server & Browser"));
 		prefs_proxy_frame = gtk_vbox_new(FALSE, 0);
@@ -2595,6 +2609,11 @@ pidgin_prefs_init(void)
 	purple_prefs_add_int("/purple/media/audio/volume/input", 10);
 	purple_prefs_add_int("/purple/media/audio/volume/output", 10);
 #endif /* USE_VV */
+	
+	/* set a default port for TURN server */
+	/* currently there is no default port for TURN, one option is to use the
+	 same port as STUN */
+	purple_prefs_add_int("/purple/network/turn_port", 3478);
 
 	pidgin_prefs_update_old();
 }


More information about the Commits mailing list