changeset 17570:b142c090eaf7

Remove the following SILC account options, as suggested by Pekka Riikonen on devel@pidgin.im: Reject watching by other users (and not reject by default) Reject online status attribute reqs (and not reject by default) Block invites (and not block by default)
author Stu Tomlinson <stu@nosnilmot.com>
date Sat, 09 Jun 2007 17:58:26 +0000
parents b5fdfb305f20
children 6b11b1398c2b
files libpurple/protocols/silc/silc.c libpurple/protocols/silc10/ops.c libpurple/protocols/silc10/silc.c
diffstat 3 files changed, 77 insertions(+), 127 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/silc/silc.c	Sat Jun 09 17:33:07 2007 +0000
+++ b/libpurple/protocols/silc/silc.c	Sat Jun 09 17:58:26 2007 +0000
@@ -143,7 +143,14 @@
 {
 	PurpleConnection *gc = context;
 	SilcPurple sg;
-	gboolean reject_watch, block_invites, block_ims;
+	SilcUInt32 mask;
+	char tz[16];
+#ifdef SILC_ATTRIBUTE_USER_ICON
+	PurpleStoredImage *img;
+#endif
+#ifdef HAVE_SYS_UTSNAME_H
+	struct utsname u;
+#endif
 
 	sg = gc->proto_data;
 
@@ -161,42 +168,24 @@
 		g_unlink(silcpurple_session_file(purple_account_get_username(sg->account)));
 
 		/* Send any UMODEs configured for account */
-		reject_watch = purple_account_get_bool(sg->account, "reject-watch", FALSE);
-		block_invites = purple_account_get_bool(sg->account, "block-invites", FALSE);
-		block_ims = purple_account_get_bool(sg->account, "block-ims", FALSE);
-		if (reject_watch || block_invites || block_ims) {
-			char m[5];
-			g_snprintf(m, sizeof(m), "+%s%s%s",
-				   reject_watch ? "w" : "",
-				   block_invites ? "I" : "",
-				   block_ims ? "P" : "");
+		if (purple_account_get_bool(sg->account, "block-ims", FALSE)) {
 			silc_client_command_call(sg->client, sg->conn, NULL,
-						 "UMODE", m, NULL);
+						 "UMODE", "+P", NULL);
 		}
 
 		/* Set default attributes */
-		if (!purple_account_get_bool(sg->account, "reject-attrs", FALSE)) {
-		  SilcUInt32 mask;
-		  char tz[16];
-#ifdef SILC_ATTRIBUTE_USER_ICON
-		  PurpleStoredImage *img;
-#endif
+		mask = SILC_ATTRIBUTE_MOOD_NORMAL;
+		silc_client_attribute_add(client, conn,
+					  SILC_ATTRIBUTE_STATUS_MOOD,
+					  SILC_32_TO_PTR(mask),
+					  sizeof(SilcUInt32));
+		mask = SILC_ATTRIBUTE_CONTACT_CHAT;
+		silc_client_attribute_add(client, conn,
+					  SILC_ATTRIBUTE_PREFERRED_CONTACT,
+					  SILC_32_TO_PTR(mask),
+					  sizeof(SilcUInt32));
 #ifdef HAVE_SYS_UTSNAME_H
-		  struct utsname u;
-#endif
-
-		  mask = SILC_ATTRIBUTE_MOOD_NORMAL;
-		  silc_client_attribute_add(client, conn,
-					    SILC_ATTRIBUTE_STATUS_MOOD,
-					    SILC_32_TO_PTR(mask),
-					    sizeof(SilcUInt32));
-		  mask = SILC_ATTRIBUTE_CONTACT_CHAT;
-		  silc_client_attribute_add(client, conn,
-					    SILC_ATTRIBUTE_PREFERRED_CONTACT,
-					    SILC_32_TO_PTR(mask),
-					    sizeof(SilcUInt32));
-#ifdef HAVE_SYS_UTSNAME_H
-		  if (!uname(&u)) {
+		if (!uname(&u)) {
 			SilcAttributeObjDevice dev;
 			memset(&dev, 0, sizeof(dev));
 			dev.type = SILC_ATTRIBUTE_DEVICE_COMPUTER;
@@ -205,20 +194,19 @@
 			silc_client_attribute_add(client, conn,
 						  SILC_ATTRIBUTE_DEVICE_INFO,
 						  (void *)&dev, sizeof(dev));
-		  }
+		}
 #endif
-		  silc_timezone(tz, sizeof(tz));
-		  silc_client_attribute_add(client, conn,
-					    SILC_ATTRIBUTE_TIMEZONE,
-					    (void *)tz, strlen(tz));
+		silc_timezone(tz, sizeof(tz));
+		silc_client_attribute_add(client, conn,
+					  SILC_ATTRIBUTE_TIMEZONE,
+					  (void *)tz, strlen(tz));
 
 #ifdef SILC_ATTRIBUTE_USER_ICON
-		  /* Set our buddy icon */
-		  img = purple_buddy_icons_find_account_icon(sg->account);
-		  silcpurple_buddy_set_icon(gc, img);
-		  purple_imgstore_unref(img);
+		/* Set our buddy icon */
+		img = purple_buddy_icons_find_account_icon(sg->account);
+		silcpurple_buddy_set_icon(gc, img);
+		purple_imgstore_unref(img);
 #endif
-		}
 
 		return;
 		break;
@@ -302,8 +290,7 @@
 	params.detach_data = (unsigned char *)silc_file_readfile(dfile, &params.detach_data_len);
 	if (params.detach_data)
 		params.detach_data[params.detach_data_len] = 0;
-	params.ignore_requested_attributes =
-		purple_account_get_bool(sg->account, "reject-attrs", FALSE);
+	params.ignore_requested_attributes = FALSE;
 	params.pfs = purple_account_get_bool(sg->account, "pfs", FALSE);
 
 	/* Perform SILC Key Exchange. */
@@ -1086,15 +1073,12 @@
 static GList *
 silcpurple_actions(PurplePlugin *plugin, gpointer context)
 {
-	PurpleConnection *gc = context;
 	GList *list = NULL;
 	PurplePluginAction *act;
 
-	if (!purple_account_get_bool(gc->account, "reject-attrs", FALSE)) {
-		act = purple_plugin_action_new(_("Online Status"),
-				silcpurple_attrs);
-		list = g_list_append(list, act);
-	}
+	act = purple_plugin_action_new(_("Online Status"),
+			silcpurple_attrs);
+	list = g_list_append(list, act);
 
 	act = purple_plugin_action_new(_("Detach From Server"),
 			silcpurple_detach);
@@ -1994,18 +1978,9 @@
 	option = purple_account_option_bool_new(_("Public key authentication"),
 						"pubkey-auth", FALSE);
 	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
-	option = purple_account_option_bool_new(_("Reject watching by other users"),
-						"reject-watch", FALSE);
-	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
-	option = purple_account_option_bool_new(_("Block invites"),
-						"block-invites", FALSE);
-	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
 	option = purple_account_option_bool_new(_("Block IMs without Key Exchange"),
 						"block-ims", FALSE);
 	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
-	option = purple_account_option_bool_new(_("Reject online status attribute requests"),
-						"reject-attrs", FALSE);
-	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
 	option = purple_account_option_bool_new(_("Block messages to whiteboard"),
 						"block-wb", FALSE);
 	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
--- a/libpurple/protocols/silc10/ops.c	Sat Jun 09 17:33:07 2007 +0000
+++ b/libpurple/protocols/silc10/ops.c	Sat Jun 09 17:58:26 2007 +0000
@@ -1671,7 +1671,6 @@
 {
 	PurpleConnection *gc = client->application;
 	SilcPurple sg;
-	gboolean reject_watch, block_invites, block_ims;
 
 	if (gc == NULL) {
 		silc_client_close_connection(client, conn);
@@ -1690,17 +1689,9 @@
 		g_unlink(silcpurple_session_file(purple_account_get_username(sg->account)));
 
 		/* Send any UMODEs configured for account */
-		reject_watch = purple_account_get_bool(sg->account, "reject-watch", FALSE);
-		block_invites = purple_account_get_bool(sg->account, "block-invites", FALSE);
-		block_ims = purple_account_get_bool(sg->account, "block-ims", FALSE);
-		if (reject_watch || block_invites || block_ims) {
-			char m[5];
-			g_snprintf(m, sizeof(m), "+%s%s%s",
-					   reject_watch ? "w" : "",
-					   block_invites ? "I" : "",
-					   block_ims ? "P" : "");
+		if (purple_account_get_bool(sg->account, "block-ims", FALSE)) {
 			silc_client_command_call(sg->client, sg->conn, NULL,
-					"UMODE", m, NULL);
+					"UMODE", "+P", NULL);
 		}
 
 		return;
--- a/libpurple/protocols/silc10/silc.c	Sat Jun 09 17:33:07 2007 +0000
+++ b/libpurple/protocols/silc10/silc.c	Sat Jun 09 17:58:26 2007 +0000
@@ -143,7 +143,15 @@
 	SilcClientConnection conn;
 	PurpleAccount *account;
 	SilcClientConnectionParams params;
-	const char *dfile;
+	SilcUInt32 mask;
+	const char *dfile, *tmp;
+#ifdef SILC_ATTRIBUTE_USER_ICON
+	PurpleStoredImage *img;
+#endif
+#ifdef HAVE_SYS_UTSNAME_H
+	struct utsname u;
+#endif
+
 
 	g_return_if_fail(gc != NULL);
 
@@ -190,54 +198,43 @@
 	silc_client_start_key_exchange(sg->client, sg->conn, source);
 
 	/* Set default attributes */
-	if (!purple_account_get_bool(account, "reject-attrs", FALSE)) {
-		SilcUInt32 mask;
-		const char *tmp;
-#ifdef SILC_ATTRIBUTE_USER_ICON
-		PurpleStoredImage *img;
-#endif
+	mask = SILC_ATTRIBUTE_MOOD_NORMAL;
+	silc_client_attribute_add(client, conn,
+				  SILC_ATTRIBUTE_STATUS_MOOD,
+				  SILC_32_TO_PTR(mask),
+				  sizeof(SilcUInt32));
+	mask = SILC_ATTRIBUTE_CONTACT_CHAT;
+	silc_client_attribute_add(client, conn,
+				  SILC_ATTRIBUTE_PREFERRED_CONTACT,
+				  SILC_32_TO_PTR(mask),
+				  sizeof(SilcUInt32));
 #ifdef HAVE_SYS_UTSNAME_H
-		struct utsname u;
-#endif
-
-		mask = SILC_ATTRIBUTE_MOOD_NORMAL;
+	if (!uname(&u)) {
+		SilcAttributeObjDevice dev;
+		memset(&dev, 0, sizeof(dev));
+		dev.type = SILC_ATTRIBUTE_DEVICE_COMPUTER;
+		dev.version = u.release;
+		dev.model = u.sysname;
 		silc_client_attribute_add(client, conn,
-					  SILC_ATTRIBUTE_STATUS_MOOD,
-					  SILC_32_TO_PTR(mask),
-					  sizeof(SilcUInt32));
-		mask = SILC_ATTRIBUTE_CONTACT_CHAT;
-		silc_client_attribute_add(client, conn,
-					  SILC_ATTRIBUTE_PREFERRED_CONTACT,
-					  SILC_32_TO_PTR(mask),
-					  sizeof(SilcUInt32));
-#ifdef HAVE_SYS_UTSNAME_H
-		if (!uname(&u)) {
-			SilcAttributeObjDevice dev;
-			memset(&dev, 0, sizeof(dev));
-			dev.type = SILC_ATTRIBUTE_DEVICE_COMPUTER;
-			dev.version = u.release;
-			dev.model = u.sysname;
-			silc_client_attribute_add(client, conn,
-						  SILC_ATTRIBUTE_DEVICE_INFO,
-						  (void *)&dev, sizeof(dev));
-		}
+					  SILC_ATTRIBUTE_DEVICE_INFO,
+					  (void *)&dev, sizeof(dev));
+	}
 #endif
 #ifdef _WIN32
-		tmp = _tzname[0];
+	tmp = _tzname[0];
 #else
-		tmp = tzname[0];
+	tmp = tzname[0];
 #endif
-		silc_client_attribute_add(client, conn,
-					  SILC_ATTRIBUTE_TIMEZONE,
-					  (void *)tmp, strlen(tmp));
+	silc_client_attribute_add(client, conn,
+				  SILC_ATTRIBUTE_TIMEZONE,
+				  (void *)tmp, strlen(tmp));
 
 #ifdef SILC_ATTRIBUTE_USER_ICON
-		/* Set our buddy icon */
-		img = purple_buddy_icons_find_account_icon(account);
-		silcpurple_buddy_set_icon(gc, img);
-		purple_imgstore_unref(img);
+	/* Set our buddy icon */
+	img = purple_buddy_icons_find_account_icon(account);
+	silcpurple_buddy_set_icon(gc, img);
+	purple_imgstore_unref(img);
 #endif
-	}
 
 	silc_free(params.detach_data);
 }
@@ -262,8 +259,7 @@
 	memset(&params, 0, sizeof(params));
 	strcat(params.nickname_format, "%n@%h%a");
 	params.nickname_parse = silcpurple_nickname_parse;
-	params.ignore_requested_attributes =
-		purple_account_get_bool(account, "reject-attrs", FALSE);
+	params.ignore_requested_attributes = FALSE;
 
 	/* Allocate SILC client */
 	client = silc_client_alloc(&ops, &params, gc, NULL);
@@ -982,15 +978,12 @@
 static GList *
 silcpurple_actions(PurplePlugin *plugin, gpointer context)
 {
-	PurpleConnection *gc = context;
 	GList *list = NULL;
 	PurplePluginAction *act;
 
-	if (!purple_account_get_bool(gc->account, "reject-attrs", FALSE)) {
-		act = purple_plugin_action_new(_("Online Status"),
-				silcpurple_attrs);
-		list = g_list_append(list, act);
-	}
+	act = purple_plugin_action_new(_("Online Status"),
+			silcpurple_attrs);
+	list = g_list_append(list, act);
 
 	act = purple_plugin_action_new(_("Detach From Server"),
 			silcpurple_detach);
@@ -1896,18 +1889,9 @@
 	option = purple_account_option_bool_new(_("Public key authentication"),
 					      "pubkey-auth", FALSE);
 	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
-	option = purple_account_option_bool_new(_("Reject watching by other users"),
-					      "reject-watch", FALSE);
-	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
-	option = purple_account_option_bool_new(_("Block invites"),
-					      "block-invites", FALSE);
-	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
 	option = purple_account_option_bool_new(_("Block IMs without Key Exchange"),
 					      "block-ims", FALSE);
 	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
-	option = purple_account_option_bool_new(_("Reject online status attribute requests"),
-					      "reject-attrs", FALSE);
-	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
 	option = purple_account_option_bool_new(_("Block messages to whiteboard"),
 					      "block-wb", FALSE);
 	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);