/soc/2013/ankitkv/gobjectification: 7b581b0a96d4: Initialize osc...

Ankit Vani a at nevitus.org
Sun Sep 1 18:12:10 EDT 2013


Changeset: 7b581b0a96d46d48cfca5f044dfc81ffbd773bb4
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-09-02 03:40 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/7b581b0a96d4

Description:

Initialize oscar protocol options in libaim and libicq so that they know who they are

diffstat:

 libpurple/protocols/oscar/libaim.c |  39 ++++++++++++++++++++++++++++++++++
 libpurple/protocols/oscar/libicq.c |  35 ++++++++++++++++++++++++++++++
 libpurple/protocols/oscar/oscar.c  |  43 --------------------------------------
 3 files changed, 74 insertions(+), 43 deletions(-)

diffs (164 lines):

diff --git a/libpurple/protocols/oscar/libaim.c b/libpurple/protocols/oscar/libaim.c
--- a/libpurple/protocols/oscar/libaim.c
+++ b/libpurple/protocols/oscar/libaim.c
@@ -38,10 +38,49 @@ aim_protocol_base_init(AIMProtocolClass 
 {
 	PurpleProtocolClass *proto_class = PURPLE_PROTOCOL_CLASS(klass);
 	PurpleAccountOption *option;
+	static const gchar *encryption_keys[] = {
+		N_("Use encryption if available"),
+		N_("Require encryption"),
+		N_("Don't use encryption"),
+		NULL
+	};
+	static const gchar *encryption_values[] = {
+		OSCAR_OPPORTUNISTIC_ENCRYPTION,
+		OSCAR_REQUIRE_ENCRYPTION,
+		OSCAR_NO_ENCRYPTION,
+		NULL
+	};
+	GList *encryption_options = NULL;
+	int i;
 
 	proto_class->id        = "aim";
 	proto_class->name      = "AIM";
 
+	option = purple_account_option_int_new(_("Port"), "port", OSCAR_DEFAULT_LOGIN_PORT);
+	proto_class->protocol_options = g_list_append(proto_class->protocol_options, option);
+
+	for (i = 0; encryption_keys[i]; i++) {
+		PurpleKeyValuePair *kvp = g_new0(PurpleKeyValuePair, 1);
+		kvp->key = g_strdup(_(encryption_keys[i]));
+		kvp->value = g_strdup(encryption_values[i]);
+		encryption_options = g_list_append(encryption_options, kvp);
+	}
+	option = purple_account_option_list_new(_("Connection security"), "encryption", encryption_options);
+	proto_class->protocol_options = g_list_append(proto_class->protocol_options, option);
+
+	option = purple_account_option_bool_new(_("Use clientLogin"), "use_clientlogin",
+			OSCAR_DEFAULT_USE_CLIENTLOGIN);
+	proto_class->protocol_options = g_list_append(proto_class->protocol_options, option);
+
+	option = purple_account_option_bool_new(
+		_("Always use AIM proxy server for\nfile transfers and direct IM (slower,\nbut does not reveal your IP address)"), "always_use_rv_proxy",
+		OSCAR_DEFAULT_ALWAYS_USE_RV_PROXY);
+	proto_class->protocol_options = g_list_append(proto_class->protocol_options, option);
+
+	option = purple_account_option_bool_new(_("Allow multiple simultaneous logins"), "allow_multiple_logins",
+											OSCAR_DEFAULT_ALLOW_MULTIPLE_LOGINS);
+	proto_class->protocol_options = g_list_append(proto_class->protocol_options, option);
+
 	option = purple_account_option_string_new(_("Server"), "server", oscar_get_login_server(FALSE, TRUE));
 	proto_class->protocol_options = g_list_append(proto_class->protocol_options, option);
 }
diff --git a/libpurple/protocols/oscar/libicq.c b/libpurple/protocols/oscar/libicq.c
--- a/libpurple/protocols/oscar/libicq.c
+++ b/libpurple/protocols/oscar/libicq.c
@@ -54,10 +54,45 @@ icq_protocol_base_init(ICQProtocolClass 
 {
 	PurpleProtocolClass *proto_class = PURPLE_PROTOCOL_CLASS(klass);
 	PurpleAccountOption *option;
+	static const gchar *encryption_keys[] = {
+		N_("Use encryption if available"),
+		N_("Require encryption"),
+		N_("Don't use encryption"),
+		NULL
+	};
+	static const gchar *encryption_values[] = {
+		OSCAR_OPPORTUNISTIC_ENCRYPTION,
+		OSCAR_REQUIRE_ENCRYPTION,
+		OSCAR_NO_ENCRYPTION,
+		NULL
+	};
+	GList *encryption_options = NULL;
+	int i;
 
 	proto_class->id        = "icq";
 	proto_class->name      = "ICQ";
 
+	option = purple_account_option_int_new(_("Port"), "port", OSCAR_DEFAULT_LOGIN_PORT);
+	proto_class->protocol_options = g_list_append(proto_class->protocol_options, option);
+
+	for (i = 0; encryption_keys[i]; i++) {
+		PurpleKeyValuePair *kvp = g_new0(PurpleKeyValuePair, 1);
+		kvp->key = g_strdup(_(encryption_keys[i]));
+		kvp->value = g_strdup(encryption_values[i]);
+		encryption_options = g_list_append(encryption_options, kvp);
+	}
+	option = purple_account_option_list_new(_("Connection security"), "encryption", encryption_options);
+	proto_class->protocol_options = g_list_append(proto_class->protocol_options, option);
+
+	option = purple_account_option_bool_new(_("Use clientLogin"), "use_clientlogin",
+			OSCAR_DEFAULT_USE_CLIENTLOGIN);
+	proto_class->protocol_options = g_list_append(proto_class->protocol_options, option);
+
+	option = purple_account_option_bool_new(
+		_("Always use ICQ proxy server for\nfile transfers and direct IM (slower,\nbut does not reveal your IP address)"), "always_use_rv_proxy",
+		OSCAR_DEFAULT_ALWAYS_USE_RV_PROXY);
+	proto_class->protocol_options = g_list_append(proto_class->protocol_options, option);
+
 	option = purple_account_option_string_new(_("Server"), "server", oscar_get_login_server(TRUE, TRUE));
 	proto_class->protocol_options = g_list_append(proto_class->protocol_options, option);
 
diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c
--- a/libpurple/protocols/oscar/oscar.c
+++ b/libpurple/protocols/oscar/oscar.c
@@ -5536,58 +5536,15 @@ static void
 oscar_protocol_base_init(OscarProtocolClass *klass)
 {
 	PurpleProtocolClass *proto_class = PURPLE_PROTOCOL_CLASS(klass);
-	PurpleAccountOption *option;
-	static const gchar *encryption_keys[] = {
-		N_("Use encryption if available"),
-		N_("Require encryption"),
-		N_("Don't use encryption"),
-		NULL
-	};
-	static const gchar *encryption_values[] = {
-		OSCAR_OPPORTUNISTIC_ENCRYPTION,
-		OSCAR_REQUIRE_ENCRYPTION,
-		OSCAR_NO_ENCRYPTION,
-		NULL
-	};
-	GList *encryption_options = NULL;
-	int i;
 
 	proto_class->options   = OPT_PROTO_MAIL_CHECK | OPT_PROTO_IM_IMAGE |
 	                         OPT_PROTO_INVITE_MESSAGE |
 	                         OPT_PROTO_AUTHORIZATION_DENIED_MESSAGE;
-
 	proto_class->icon_spec = purple_buddy_icon_spec_new("gif,jpeg,bmp,ico",
 	                                                 0, 0, 64, 64, 7168,
 	                                                 PURPLE_ICON_SCALE_SEND |
 	                                                 PURPLE_ICON_SCALE_DISPLAY);
 
-	option = purple_account_option_int_new(_("Port"), "port", OSCAR_DEFAULT_LOGIN_PORT);
-	proto_class->protocol_options = g_list_append(proto_class->protocol_options, option);
-
-	for (i = 0; encryption_keys[i]; i++) {
-		PurpleKeyValuePair *kvp = g_new0(PurpleKeyValuePair, 1);
-		kvp->key = g_strdup(_(encryption_keys[i]));
-		kvp->value = g_strdup(encryption_values[i]);
-		encryption_options = g_list_append(encryption_options, kvp);
-	}
-	option = purple_account_option_list_new(_("Connection security"), "encryption", encryption_options);
-	proto_class->protocol_options = g_list_append(proto_class->protocol_options, option);
-
-	option = purple_account_option_bool_new(_("Use clientLogin"), "use_clientlogin",
-			OSCAR_DEFAULT_USE_CLIENTLOGIN);
-	proto_class->protocol_options = g_list_append(proto_class->protocol_options, option);
-
-	option = purple_account_option_bool_new(
-		_("Always use AIM/ICQ proxy server for\nfile transfers and direct IM (slower,\nbut does not reveal your IP address)"), "always_use_rv_proxy",
-		OSCAR_DEFAULT_ALWAYS_USE_RV_PROXY);
-	proto_class->protocol_options = g_list_append(proto_class->protocol_options, option);
-
-	if (proto_class->id && g_str_equal(proto_class->id, "aim")) {
-		option = purple_account_option_bool_new(_("Allow multiple simultaneous logins"), "allow_multiple_logins",
-												OSCAR_DEFAULT_ALLOW_MULTIPLE_LOGINS);
-		proto_class->protocol_options = g_list_append(proto_class->protocol_options, option);
-	}
-
 	/* Preferences */
 	purple_prefs_add_none("/protocols/oscar");
 	purple_prefs_add_bool("/protocols/oscar/recent_buddies", FALSE);



More information about the Commits mailing list