pidgin: 58446e07: Allow Gadu-Gadu accounts to specify Conn...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Fri Jun 5 01:45:22 EDT 2009


-----------------------------------------------------------------
Revision: 58446e074cca7b8a7348254c03cfce2c5534fd63
Ancestor: d99389c7a3c660aa7a54362dd26e7b3e103a05c8
Author: darkrain42 at pidgin.im
Date: 2009-06-05T05:42:05
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/58446e074cca7b8a7348254c03cfce2c5534fd63

Modified files:
        libpurple/protocols/gg/gg.c

ChangeLog: 

Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.

Modified patch from kreez. Awaiting name for COPYRIGHT/ChangeLog.

-------------- next part --------------
============================================================
--- libpurple/protocols/gg/gg.c	d1ca49f1ab4d2d081e01e1d2a443f66927d322e6
+++ libpurple/protocols/gg/gg.c	5dad39f9101aa6be05d1be6a5404fc8ede6f9c5d
@@ -1759,6 +1759,7 @@ static void ggp_login(PurpleAccount *acc
 	PurpleStatus *status;
 	struct gg_login_params *glp;
 	GGPInfo *info;
+	const char *address;
 
 	if (ggp_setup_proxy(account) == -1)
 		return;
@@ -1789,6 +1790,26 @@ static void ggp_login(PurpleAccount *acc
 	glp->status = ggp_to_gg_status(status, &glp->status_descr);
 	glp->tls = 0;
 
+	address = purple_account_get_string(account, "gg_server", "");
+	if (address && *address) {
+		struct in_addr *addr = gg_gethostbyname(address);
+
+		purple_debug_info("gg", "Using gg server given by user (%s)\n", address);
+
+		if (addr == NULL) {
+			purple_debug_error("gg", "gg_gethostbyname returned error (%d): %s\n",
+			                   errno, g_strerror(errno));
+			purple_connection_error_reason(gc,
+				PURPLE_CONNECTION_ERROR_NETWORK_ERROR, /* should this be a settings error? */
+				_("Unable to resolve server"));
+			return;
+		}
+
+		glp->server_addr = inet_addr(inet_ntoa(*addr));
+		glp->server_port = 8074;
+	} else
+		purple_debug_info("gg", "Trying to retrieve address from gg appmsg service\n");
+
 	info->session = gg_login(glp);
 	if (info->session == NULL) {
 		purple_connection_error_reason (gc,
@@ -2367,6 +2388,11 @@ static void init_plugin(PurplePlugin *pl
 	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
 						   option);
 
+	option = purple_account_option_string_new(_("GG server"),
+			"gg_server", "");
+	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
+			option);
+
 	my_protocol = plugin;
 
 	gg_debug_handler = purple_gg_debug_handler;


More information about the Commits mailing list