/cpw/tomkiewicz/gg11: 70fb82cea2a7: Make it possible to select p...

Tomasz Wasilczyk tomkiewicz at cpw.pidgin.im
Thu May 30 05:53:29 EDT 2013


Changeset: 70fb82cea2a7aa473c4b151de9febb05334309ec
Author:	 Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
Date:	 2013-05-30 11:53 +0200
Branch:	 default
URL: https://hg.pidgin.im/cpw/tomkiewicz/gg11/rev/70fb82cea2a7

Description:

Make it possible to select protocol version

diffstat:

 libpurple/protocols/gg/gg.c |  25 ++++++++++++++++++++++---
 1 files changed, 22 insertions(+), 3 deletions(-)

diffs (62 lines):

diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c
--- a/libpurple/protocols/gg/gg.c
+++ b/libpurple/protocols/gg/gg.c
@@ -636,14 +636,14 @@ static void ggp_login(PurpleAccount *acc
 	struct gg_login_params *glp;
 	GGPInfo *info;
 	const char *address;
-	const gchar *encryption_type;
+	const gchar *encryption_type, *protocol_version;
 
 	if (!ggp_deprecated_setup_proxy(gc))
 		return;
 
 	purple_connection_set_flags(gc, PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_URLDESC);
 
-	glp = g_new0(struct gg_login_params, 1);
+	glp = g_new0(struct gg_login_params, 1); // TODO: definitely lost
 	info = g_new0(GGPInfo, 1);
 
 	purple_connection_set_protocol_data(gc, info);
@@ -700,7 +700,16 @@ static void ggp_login(PurpleAccount *acc
 	}
 	else /* encryption_type == "none" */
 		glp->tls = GG_SSL_DISABLED;
-	purple_debug_info("gg", "TLS mode: %d\n", glp->tls);
+	purple_debug_misc("gg", "TLS mode: %d\n", glp->tls);
+
+	protocol_version = purple_account_get_string(account,
+		"protocol_version", "default");
+	purple_debug_info("gg", "Requested protocol version: %s\n",
+		protocol_version);
+	if (g_strcmp0(protocol_version, "gg10") == 0)
+		glp->protocol_version = GG_PROTOCOL_VERSION_100;
+	else if (g_strcmp0(protocol_version, "gg11") == 0)
+		glp->protocol_version = GG_PROTOCOL_VERSION_110;
 
 	ggp_status_set_initial(gc, glp);
 	
@@ -1035,6 +1044,7 @@ static void init_plugin(PurplePlugin *pl
 {
 	PurpleAccountOption *option;
 	GList *encryption_options = NULL;
+	GList *protocol_version = NULL;
 
 	purple_prefs_add_none("/plugins/prpl/gg");
 
@@ -1061,6 +1071,15 @@ static void init_plugin(PurplePlugin *pl
 	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
 		option);
 
+	ADD_VALUE(protocol_version, _("Default"), "default");
+	ADD_VALUE(protocol_version, "GG 10", "gg10");
+	ADD_VALUE(protocol_version, "GG 11", "gg11");
+
+	option = purple_account_option_list_new(_("Protocol version"),
+		"protocol_version", protocol_version);
+	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
+		option);
+
 	option = purple_account_option_bool_new(_("Show links from strangers"),
 		"show_links_from_strangers", 1);
 	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,



More information about the Commits mailing list