adium 4043:a92441004e19: -hash has no guarantee to be unique. Us...

commits at adium.im commits at adium.im
Sun Jul 10 23:34:08 UTC 2011


details:	http://hg.adium.im/adium/rev/a92441004e19
revision:	4043:a92441004e19
branch:		(none)
author:		Thijs Alkemade <thijsalkemade at gmail.com>
date:		Mon Jul 11 01:30:53 2011 +0200

-hash has no guarantee to be unique. Use [account UID] here instead.
(transplanted from 84fb6840e22c37c2f8ad53ac9de3631e60bb1390)

diffs (30 lines):

diff -r ef04e5b56748 -r a92441004e19 Source/AIAutomaticStatus.m
--- a/Source/AIAutomaticStatus.m	Tue Jul 05 19:20:27 2011 +0200
+++ b/Source/AIAutomaticStatus.m	Mon Jul 11 01:30:53 2011 +0200
@@ -328,7 +328,7 @@
 		AIStatus	*currentStatusState = account.statusState;
 		
 		// Store the state of the account if there is no previous one saved
-		if (![previousStatus objectForKey:[NSNumber numberWithUnsignedInteger:[account hash]]]) {
+		if (![previousStatus objectForKey:[account UID]]) {
 			
 			// Don't modify or store the status of (originally!) non-available accounts
 			if (currentStatusState.statusType != AIAvailableStatusType) {
@@ -336,7 +336,7 @@
 			}
 			
 			[previousStatus setObject:currentStatusState
-							   forKey:[NSNumber numberWithUnsignedInteger:[account hash]]];
+							   forKey:[account UID]];
 		}
 		
 		AILogWithSignature(@"Setting %@ to status %@", account, targetStatusState);
@@ -366,7 +366,7 @@
 - (void)returnFromAutoAway
 {
 	for (AIAccount *account in adium.accountController.accounts) {
-		AIStatus *previousStatusState = [previousStatus objectForKey:[NSNumber numberWithUnsignedInteger:[account hash]]];
+		AIStatus *previousStatusState = [previousStatus objectForKey:[account UID]];
 		
 		// Skip accounts without stored information.
 		if (!previousStatusState) {




More information about the commits mailing list