adium 2318:eb4e00ea03d8: When editing an account, let the accoun...

commits at adium.im commits at adium.im
Mon May 25 16:39:52 UTC 2009


details:	http://hg.adium.im/adium/rev/eb4e00ea03d8
revision:	2318:eb4e00ea03d8
author:		Zachary West <zacw at adium.im>
date:		Mon May 25 12:39:32 2009 -0400

When editing an account, let the account know when editing is fully completed.

For libpurple accounts, this will cause the account to re-configure its libpurple options, which makes them all take affect immediately instead of the (very confusing) next connect.

diffstat:

 ChangeLogs/Changes Between Betas.txt                  |   1 +
 ChangeLogs/Changes.txt                                |   1 +
 Frameworks/Adium Framework/Source/AIAbstractAccount.h |   5 +++++
 Frameworks/Adium Framework/Source/AIAbstractAccount.m |   8 ++++++++
 Plugins/Purple Service/CBPurpleAccount.m              |  12 ++++++++++++
 Source/AIEditAccountWindowController.m                |   2 ++
 6 files changed, 29 insertions(+), 0 deletions(-)

diffs (87 lines):

diff -r 8cbd61f26a47 -r eb4e00ea03d8 ChangeLogs/Changes Between Betas.txt
--- a/ChangeLogs/Changes Between Betas.txt	Mon May 25 01:10:51 2009 -0700
+++ b/ChangeLogs/Changes Between Betas.txt	Mon May 25 12:39:32 2009 -0400
@@ -1,4 +1,5 @@
 Adium 1.4 b3
+ * Changed behavior for account options: a lot were only changing when reconnecting, now all that are able to (i.e., non-connect options) take affect immediately.
  * Moved the Status Menu Item and Dock preferences to a new "Message Alerts" advanced preference.
  * Clarified the option to only count the number of highlights/mentions in the dock/status menu item in its wording. (#12080)
  * Status icon packs can now specify "Idle And Away" icons to use for contacts. (#872)
diff -r 8cbd61f26a47 -r eb4e00ea03d8 ChangeLogs/Changes.txt
--- a/ChangeLogs/Changes.txt	Mon May 25 01:10:51 2009 -0700
+++ b/ChangeLogs/Changes.txt	Mon May 25 12:39:32 2009 -0400
@@ -128,6 +128,7 @@
  
  Accounts 
   * Fixed setting a global user icon. Previously, if you didn't have an account icon set but did set a global one, you would have no icon.
+  * Changed behavior for account options: a lot were only changing when reconnecting, now all that are able to (i.e., non-connect options) take affect immediately.
 
  Bonjour
   * Bonjour accounts now disconnect if we receive an error message.
diff -r 8cbd61f26a47 -r eb4e00ea03d8 Frameworks/Adium Framework/Source/AIAbstractAccount.h
--- a/Frameworks/Adium Framework/Source/AIAbstractAccount.h	Mon May 25 01:10:51 2009 -0700
+++ b/Frameworks/Adium Framework/Source/AIAbstractAccount.h	Mon May 25 12:39:32 2009 -0400
@@ -56,6 +56,11 @@
  */
 - (void)setAccountUserImage:(NSImage *)image withData:(NSData *)originalData;
 
+/*!
+ * @brief Called when the account was edited.
+ */
+- (void)accountEdited;
+
 //Auto-Refreshing Status String
 - (NSAttributedString *)autoRefreshingOutgoingContentForStatusKey:(NSString *)key;
 - (void)autoRefreshingOutgoingContentForStatusKey:(NSString *)key selector:(SEL)selector context:(id)originalContext;
diff -r 8cbd61f26a47 -r eb4e00ea03d8 Frameworks/Adium Framework/Source/AIAbstractAccount.m
--- a/Frameworks/Adium Framework/Source/AIAbstractAccount.m	Mon May 25 01:10:51 2009 -0700
+++ b/Frameworks/Adium Framework/Source/AIAbstractAccount.m	Mon May 25 12:39:32 2009 -0400
@@ -305,6 +305,14 @@
 	}
 }
 
+/*!
+ * @brief Called when the account was edited.
+ */
+- (void)accountEdited
+{
+	// Do nothing by default.
+}
+
 //Status ---------------------------------------------------------------------------------------------------------------
 #pragma mark Status
 - (NSString *)effectiveStatusKeyForKey:(NSString *)key
diff -r 8cbd61f26a47 -r eb4e00ea03d8 Plugins/Purple Service/CBPurpleAccount.m
--- a/Plugins/Purple Service/CBPurpleAccount.m	Mon May 25 01:10:51 2009 -0700
+++ b/Plugins/Purple Service/CBPurpleAccount.m	Mon May 25 12:39:32 2009 -0400
@@ -3102,6 +3102,18 @@
 	}
 }
 
+/*!
+ * @brief When the account is edited, update our libpurple preferences.
+ */
+- (void)accountEdited
+{
+	// We only need to re-configure if we're online or connecting. If we're offline, our next connect will do this.
+	if (self.online || [self boolValueForProperty:@"Connecting"]) {
+		AILog(@"Re-configuring purple account due to preference changes.");
+		[self configurePurpleAccount];
+	}
+}
+
 #pragma mark Actions for chats
 
 /***************************/
diff -r 8cbd61f26a47 -r eb4e00ea03d8 Source/AIEditAccountWindowController.m
--- a/Source/AIEditAccountWindowController.m	Mon May 25 01:10:51 2009 -0700
+++ b/Source/AIEditAccountWindowController.m	Mon May 25 12:39:32 2009 -0400
@@ -203,6 +203,8 @@
 	[self saveConfiguration];
 	[accountViewController saveConfiguration];
 	[accountProxyController saveConfiguration];
+	
+	[account accountEdited];
 
 	if (notifyTarget) [notifyTarget editAccountSheetDidEndForAccount:account withSuccess:YES];
 	[self closeWindow:nil];




More information about the commits mailing list