adium-1.4 3364:7b536350c104: Add a preference to turn off direct...

commits at adium.im commits at adium.im
Fri Feb 18 20:42:39 UTC 2011


details:	http://hg.adium.im/adium-1.4/rev/7b536350c104
revision:	3364:7b536350c104
author:		Thijs Alkemade <thijsalkemade at gmail.com>
date:		Fri Feb 18 21:42:09 2011 +0100

Add a preference to turn off direct connections on MSN.

Fixes #14602

diffs (73 lines):

diff -r 14431c821fe6 -r 7b536350c104 Plugins/Purple Service/ESPurpleMSNAccount.h
--- a/Plugins/Purple Service/ESPurpleMSNAccount.h	Thu Feb 17 16:10:59 2011 -0600
+++ b/Plugins/Purple Service/ESPurpleMSNAccount.h	Fri Feb 18 21:42:09 2011 +0100
@@ -17,8 +17,9 @@
 #import "CBPurpleAccount.h"
 #import "ESMSNService.h"
 
-#define KEY_MSN_HTTP_CONNECT_METHOD		@"MSN:HTTP Connect Method"
-#define KEY_MSN_DISPLAY_NAMED_CHANGED	@"MSN:Display Name Changed"
+#define KEY_MSN_HTTP_CONNECT_METHOD			@"MSN:HTTP Connect Method"
+#define KEY_MSN_DISPLAY_NAMED_CHANGED		@"MSN:Display Name Changed"
+#define KEY_MSN_BLOCK_DIRECT_CONNECTIONS	@"MSN:Block Direct Connections"
 
 @interface ESPurpleMSNAccount : CBPurpleAccount <AIAccount_Files>{
 	NSDate		*lastFriendlyNameChange;
diff -r 14431c821fe6 -r 7b536350c104 Plugins/Purple Service/ESPurpleMSNAccount.m
--- a/Plugins/Purple Service/ESPurpleMSNAccount.m	Thu Feb 17 16:10:59 2011 -0600
+++ b/Plugins/Purple Service/ESPurpleMSNAccount.m	Fri Feb 18 21:42:09 2011 +0100
@@ -145,6 +145,9 @@
 	
 	BOOL HTTPConnect = [[self preferenceForKey:KEY_MSN_HTTP_CONNECT_METHOD group:GROUP_ACCOUNT_STATUS] boolValue];
 	purple_account_set_bool(account, "http_method", HTTPConnect);
+	
+	BOOL blockDirectConnections = [[self preferenceForKey:KEY_MSN_BLOCK_DIRECT_CONNECTIONS group:GROUP_ACCOUNT_STATUS] boolValue];
+	purple_account_set_bool(account, "direct_connect", !blockDirectConnections);
 }
 
 - (NSString *)connectionStringForStep:(int)step
diff -r 14431c821fe6 -r 7b536350c104 Plugins/Purple Service/ESPurpleMSNAccountViewController.h
--- a/Plugins/Purple Service/ESPurpleMSNAccountViewController.h	Thu Feb 17 16:10:59 2011 -0600
+++ b/Plugins/Purple Service/ESPurpleMSNAccountViewController.h	Fri Feb 18 21:42:09 2011 +0100
@@ -20,6 +20,7 @@
     IBOutlet		NSTextField		*textField_friendlyName;
 	
 	IBOutlet		NSButton		*checkBox_HTTPConnectMethod;
+	IBOutlet		NSButton		*checkbox_allowDirectConnections;
 }
 
 @end
diff -r 14431c821fe6 -r 7b536350c104 Plugins/Purple Service/ESPurpleMSNAccountViewController.m
--- a/Plugins/Purple Service/ESPurpleMSNAccountViewController.m	Thu Feb 17 16:10:59 2011 -0600
+++ b/Plugins/Purple Service/ESPurpleMSNAccountViewController.m	Fri Feb 18 21:42:09 2011 +0100
@@ -32,6 +32,10 @@
 	
 	[checkBox_HTTPConnectMethod setState:[[account preferenceForKey:KEY_MSN_HTTP_CONNECT_METHOD 
 															  group:GROUP_ACCOUNT_STATUS] boolValue]];
+	
+	// negated preference, default => allowed
+	[checkbox_allowDirectConnections setState:![[account preferenceForKey:KEY_MSN_BLOCK_DIRECT_CONNECTIONS
+																   group:GROUP_ACCOUNT_STATUS] boolValue]];
 }
 
 //Save controls
@@ -40,6 +44,9 @@
 	[account setPreference:[NSNumber numberWithBool:[checkBox_HTTPConnectMethod state]] 
 					forKey:KEY_MSN_HTTP_CONNECT_METHOD group:GROUP_ACCOUNT_STATUS];
 	
+	[account setPreference:[NSNumber numberWithBool:![checkbox_allowDirectConnections state]]
+					forKey:KEY_MSN_BLOCK_DIRECT_CONNECTIONS group:GROUP_ACCOUNT_STATUS];
+	
 	//Alias
 	if (!account.online &&
 		![[textField_alias stringValue] isEqualToString:[[NSAttributedString stringWithData:[account preferenceForKey:KEY_ACCOUNT_DISPLAY_NAME
@@ -47,6 +54,7 @@
 		[account setPreference:[NSNumber numberWithBool:YES]
 						forKey:KEY_DISPLAY_CUSTOM_EMOTICONS
 						 group:GROUP_ACCOUNT_STATUS];
+		
 	}
 
 	[super saveConfiguration];
diff -r 14431c821fe6 -r 7b536350c104 Plugins/Purple Service/en.lproj/ESPurpleMSNAccountView.nib/keyedobjects.nib
Binary file Plugins/Purple Service/en.lproj/ESPurpleMSNAccountView.nib/keyedobjects.nib has changed




More information about the commits mailing list