adium-1.4 3008:95453e2162d6: Update Credits.rtf.

commits at adium.im commits at adium.im
Mon Aug 16 02:14:36 UTC 2010


details:	http://hg.adium.im/adium-1.4/rev/95453e2162d6
revision:	3008:95453e2162d6
author:		Robert Vehse
date:		Mon Aug 16 04:09:20 2010 +0200

Update Credits.rtf.
Subject: adium-1.4 3009:46dc399b3169: Merge

details:	http://hg.adium.im/adium-1.4/rev/46dc399b3169
revision:	3009:46dc399b3169
author:		Robert Vehse
date:		Mon Aug 16 04:12:55 2010 +0200

Merge

diffs (781 lines):

diff -r e63789abc563 -r 46dc399b3169 Resources/Credits.rtf
--- a/Resources/Credits.rtf	Sun Aug 15 21:34:25 2010 -0400
+++ b/Resources/Credits.rtf	Mon Aug 16 04:12:55 2010 +0200
@@ -1,4 +1,6 @@
-{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf290
+{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf540
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
 \pard\tx440\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li100\slleading40\sb40\ql\qnatural
 
 \f0\fs20 \cf0 \
@@ -30,13 +32,14 @@
 \b \cf0 Lead Developers
 \b0 \
 	Evan Schoenberg, M.D.
-\fs20 \cf2 \
+\fs20 \
 \pard\tx440\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li100\slleading40\sb40\ql\qnatural
 
 \fs24 \cf0 	Zachary West\
 \pard\tx440\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li100\slleading40\sb40\ql\qnatural
 
-\fs20 \cf2 \
+\fs20 \cf0 \
+\pard\tx440\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li100\slleading40\sb40\ql\qnatural
 
 \b\fs24 \cf0 Project Manager\
 \pard\tx440\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li100\slleading40\sb40\ql\qnatural
@@ -44,36 +47,36 @@
 \b0 \cf0 	Eric Richie\
 \pard\tx440\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li100\slleading40\sb40\ql\qnatural
 
-\fs20 \cf2 \
+\fs20 \cf0 \
+\pard\tx440\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li100\slleading40\sb40\ql\qnatural
 
 \b\fs24 \cf0 Developers
 \b0 \
 	Colin Barrett\
+	Frank Dowsett\
 	Ryan Govostes\
 	Stephen Holt\
 	Peter Hosey\
 	Alan Humpherys\
 	Andreas Monitzer\
+	Matthew Needham\
 	David Smith\
 \
 
 \b Contributors\
 	
 \b0 Adam Betts  
-\fs20 \cf2 (Adiumy iconset) 
-\fs24 \cf0 \
-	Matthew Needham  
-\fs20 \cf2 (Message Styles)
-\fs24 \cf0 \
+\fs20 (Adiumy iconset) 
+\fs24 \
 	Jordan Schelew\
 	Robert Vehse\
 	Andrew "proton" Wellington  
-\fs20 \cf2 (libezv Bonjour support) \
+\fs20 (libezv Bonjour support) \
 \pard\tx440\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li100\slleading40\sb40\ql\qnatural
 
 \fs24 \cf0 	Paul Wilde  
-\fs20 \cf2 (Interface Icons)
-\fs24 \cf0 \
+\fs20 (Interface Icons)
+\fs24 \
 \
 \pard\tx440\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li100\slleading40\sb40\ql\qnatural
 
@@ -103,92 +106,107 @@
 \b Translators\
 \pard\tx440\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li100\slleading40\sb40\ql\qnatural
 
-\b0 \cf0 	Daniel Bergman  
-\fs20 \cf2 (Swedish)\
+\b0 \cf0 	Tomas Arnason  
+\fs20 (Icelandic)\
+	
+\fs24 Armas  
+\fs20 (French)
+\fs24 \
+	Daniel Bergman  
+\fs20 (Swedish)\
 
-\fs24 \cf0 	biglittledragoon  
-\fs20 \cf2 (French)
-\b\fs24 \cf0 \
+\fs24 	biglittledragoon  
+\fs20 (French)\
+
+\fs24 	Ponthus Blomquist
+\fs20   (Swedish)
+\b\fs24 \
 
 \b0 	Remko Brugman
-\fs20 \cf2   (Dutch)
-\fs24 \cf0 \
+\fs20   (Dutch)
+\fs24 \
 	\uc0\u1040 \u1083 \u1077 \u1082 \u1089 \u1072 \u1085 \u1076 \u1088  \u1041 \u1099 \u1082 \u1086 \u1074   
-\fs20 \cf2 (Russian)
-\fs24 \cf0 \
+\fs20 (Russian)
+\fs24 \
 	Ariel "yelly" Chinn  
-\fs20 \cf2 (Commonwealth English)
-\fs24 \cf0 \
+\fs20 (Commonwealth English)
+\fs24 \
 	Piotr Chyli\uc0\u324 ski
-\fs20 \cf2   (Polish)
-\fs24 \cf0 \
+\fs20   (Polish)
+\fs24 \
 	Frantisek Erben
-\fs20 \cf2   (Czech)
-\fs24 \cf0 \
+\fs20   (Czech)
+\fs24 \
 	Marcos Fraz\'e3o  
-\fs20 \cf2 (Brazilian Portuguese)\
+\fs20 (Brazilian Portuguese)\
 
-\fs24 \cf0 	Daniel Ramos  
-\fs20 \cf2 (Portugal Portuguese)
-\fs24 \cf0 \
+\fs24 	Daniel Ramos  
+\fs20 (Portugal Portuguese)
+\fs24 \
 	Bu\uc0\u287 ra Henden  
-\fs20 \cf2 (Turkish)
-\fs24 \cf0 \
+\fs20 (Turkish)
+\fs24 \
 	Thomas Kunze
-\fs20 \cf2   (German)\
+\fs20   (German)\
 	
-\fs24 \cf0 JT Lee
-\fs20 \cf2   (Simplified Chinese)\
+\fs24 JT Lee
+\fs20   (Simplified Chinese)\
 
-\fs24 \cf0 	Ronald Leroux  
-\fs20 \cf2 (French Canadian)
-\fs24 \cf0 \
+\fs24 	Ronald Leroux  
+\fs20 (French Canadian)
+\fs24 \
 	Jack M.H. Lin
-\fs20 \cf2   (Traditional Chinese)\
+\fs20   (Traditional Chinese)\
 
-\fs24 \cf0 	Nicola "ATMB" Del Monaco  
-\fs20 \cf2 (Italian)\
+\fs24 	Michal Moravcik 
+\fs20 (Slovakian)
+\fs24  \
+	Nicola "ATMB" Del Monaco  
+\fs20 (Italian)\
 
-\fs24 \cf0 	Pietro Modi  
-\fs20 \cf2 (Italian)
-\fs24 \cf0 \
+\fs24 	Pietro Modi  
+\fs20 (Italian)
+\fs24 \
 	David Munch
-\fs20 \cf2   (Danish)
-\fs24 \cf0 \
+\fs20   (Danish)
+\fs24 \
 	Daisuke Okada  
-\fs20 \cf2 (Japanese)\
+\fs20 (Japanese)\
 
-\fs24 \cf0 	Bastian Olea 
-\fs20 \cf2 (Spanish)
-\fs24 \cf0 \
+\fs24 	Bastian Olea 
+\fs20 (Spanish)
+\fs24 \
 	James Panther  
-\fs20 \cf2 (Australian English)
-\fs24 \cf0 \
+\fs20 (Australian English)
+\fs24 \
 	Gareth Potter  
-\fs20 \cf2 (Japanese)
-\fs24 \cf0 \
+\fs20 (Japanese)
+\fs24 \
 	Albert Samaniego  
-\fs20 \cf2 (Catalan)
-\fs24 \cf0 \
+\fs20 (Catalan)
+\fs24 \
 	Sebastian Sebus\'e6ter  
-\fs20 \cf2 (Norwegian Bokm\'e5l)
-\fs24 \cf0 \
+\fs20 (Norwegian Bokm\'e5l)
+\fs24 \
 	\uc0\u1040 \u1085 \u1090 \u1086 \u1085  \u1057 \u1086 \u1090 \u1082 \u1086 \u1074   
-\fs20 \cf2 (Russian)
-\fs24 \cf0 \
+\fs20 (Russian)
+\fs24 \
 	Stef\'e1n Vignir Skarph\'e9\'f0insson  
-\fs20 \cf2 (Icelandic)
-\fs24 \cf0 \
+\fs20 (Icelandic)
+\fs24 \
 	P\'e9ter Tutervai  
-\fs20 \cf2 (Hungarian)
-\fs24 \cf0 	\
+\fs20 (Hungarian)\
+	
+\fs24 tzikis  
+\fs20 (Greek)
+\fs24 \
 	Lassi Veikkonen  
-\fs20 \cf2 (Finnish)
-\fs24 \cf0 \
+\fs20 (Finnish)
+\fs24 \
 	Markus Wulftange  
-\fs20 \cf2 (German)\
+\fs20 (German)\
 
-\fs24 \cf0 \
+\fs24 \
 \pard\tx440\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li100\slleading40\sb40\ql\qnatural
 
 \b \cf0 Retired Lead Developer
@@ -227,8 +245,8 @@
 	Sam McCandlish\
 \pard\tx440\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li100\slleading40\sb40\ql\qnatural
 \cf0 	Jeffrey Melloy
-\fs20 \cf2   (SQL Logger)
-\fs24 \cf0 \
+\fs20   (SQL Logger)
+\fs24 \
 \pard\tx440\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\li100\slleading40\sb40\ql\qnatural
 \cf0 	Chris Serino\
 \
@@ -243,52 +261,52 @@
 \b \
 
 \b0 	Benjamin Costello
-\fs20 \cf2   (Site Design, Original Xtras site)
-\f1\b\fs28 \cf0 \
+\fs20   (Site Design, Original Xtras site)
+\b\fs28 \
 
-\f0\b0\fs24 	ender\
+\b0\fs24 	ender\
 	Patrick Gibson\
 	Kiel Gillard
-\f1\b\fs28 \
+\b\fs28 \
 	
-\f0\b0\fs24 Asher Haig
-\fs20 \cf2   (Build scripts)
-\f1\b\fs28 \cf0 \
+\b0\fs24 Asher Haig
+\fs20   (Build scripts)
+\b\fs28 \
 
-\f0\b0\fs24 	Andrew Harvey
-\f1\b\fs28 \
+\b0\fs24 	Andrew Harvey
+\b\fs28 \
 	
-\f0\b0\fs24 Jasper Hauser
-\fs20 \cf2   (Interface Icons)
-\fs24 \cf0 \
+\b0\fs24 Jasper Hauser
+\fs20   (Interface Icons)
+\fs24 \
 	Mathieu "mathieuma" Masseboeuf\
 	Laura Natcher
-\fs20 \cf2   (Duck Icon Variants, Crash Reporter Art)
-\f1\b\fs28 \cf0 \
+\fs20   (Duck Icon Variants, Crash Reporter Art)
+\b\fs28 \
 
-\f0\b0\fs24 	Nick Peshek
-\f1\b\fs28 \
+\b0\fs24 	Nick Peshek
+\b\fs28 \
 
-\f0\b0\fs24 	Nick "taktile" Pisarro
-\f1\b\fs28 \
+\b0\fs24 	Nick "taktile" Pisarro
+\b\fs28 \
 
-\f0\b0\fs24 	Brent "berhr" Redeker
-\f1\b\fs28 \
+\b0\fs24 	Brent "berhr" Redeker
+\b\fs28 \
 	
-\f0\b0\fs24 Phill Ryu
-\fs20 \cf2   (Feedback and Testing)
-\f1\b\fs28 \cf0 \
+\b0\fs24 Phill Ryu
+\fs20   (Feedback and Testing)
+\b\fs28 \
 
-\f0\b0\fs24 	Steven "steventamm" Tamm
-\f1\b\fs28 \
+\b0\fs24 	Steven "steventamm" Tamm
+\b\fs28 \
 
-\f0\b0\fs24 	Andrew Tennant  
-\fs20 \cf2 (Adium 1.0 help system) 
-\f1\b\fs28 \cf0 \
+\b0\fs24 	Andrew Tennant  
+\fs20 (Adium 1.0 help system) 
+\b\fs28 \
 	
-\f0\b0\fs24 Wesley Underwood
-\fs20 \cf2   (Interface Icons)
-\fs24 \cf0 \
+\b0\fs24 Wesley Underwood
+\fs20   (Interface Icons)
+\fs24 \
 	Trevin "TJ" Ward\
 	Robert Wenger\
 	Ofri Wolfus\
@@ -299,55 +317,55 @@
 \pard\tx440\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li100\slleading40\sb40\ql\qnatural
 
 \b0 \cf0 	Max Bertrand
-\fs20 \cf2   (French)
-\b\fs24 \cf0 \
+\fs20   (French)
+\b\fs24 \
 
 \b0 	Juan Jes\'fas Cervera
-\fs20 \cf2   (Spanish)
-\fs24 \cf0 \
+\fs20   (Spanish)
+\fs24 \
 	Mat\'edas Cuadros
-\fs20 \cf2   (Spanish)
-\fs24 \cf0 \
+\fs20   (Spanish)
+\fs24 \
 	Flyttbar Johansen  
-\fs20 \cf2 (Norweigan)
-\fs24 \cf0 \
+\fs20 (Norweigan)
+\fs24 \
 	Jamie Kirkpatrick
-\fs20 \cf2   (Brazilian Portuguese)
-\fs24 \cf0 \
+\fs20   (Brazilian Portuguese)
+\fs24 \
 	Helv\'e9cio Mafra
-\fs20 \cf2   (Brazilian Portuguese)
-\fs24 \cf0 \
+\fs20   (Brazilian Portuguese)
+\fs24 \
 	Magnus Markling 
-\fs20 \cf2 (Swedish)\
+\fs20 (Swedish)\
 
-\fs24 \cf0 	Roeland Nas
-\fs20 \cf2   (Dutch)\
+\fs24 	Roeland Nas
+\fs20   (Dutch)\
 
-\fs24 \cf0 	Lex Nicolaes
-\fs20 \cf2   (Dutch)	
-\fs24 \cf0 \
+\fs24 	Lex Nicolaes
+\fs20   (Dutch)	
+\fs24 \
 	Alberto N\'fa\'f1ez 
-\fs20 \cf2 (Spanish)
-\fs24 \cf0 \
+\fs20 (Spanish)
+\fs24 \
 \pard\tx440\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li100\slleading40\sb40\ql\qnatural
 
-\fs20 \cf2 	
-\fs24 \cf0 \uc0\u1042 \u1072 \u1083 \u1077 \u1085 \u1090 \u1080 \u1085  \u1055 \u1072 \u1088 \u1085 \u1072 \u1093   
-\fs20 \cf2 (Russian)
-\fs24 \cf0 \
+\fs20 \cf0 	
+\fs24 \uc0\u1042 \u1072 \u1083 \u1077 \u1085 \u1090 \u1080 \u1085  \u1055 \u1072 \u1088 \u1085 \u1072 \u1093   
+\fs20 (Russian)
+\fs24 \
 	Peter Piln\'e4s 
-\fs20 \cf2 (Swedish)\
+\fs20 (Swedish)\
 \pard\tx440\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li100\slleading40\sb40\ql\qnatural
 
 \fs24 \cf0 	Marc S. Re\'dfl  
-\fs20 \cf2 (Catalan)\
+\fs20 (Catalan)\
 
-\fs24 \cf0 	Martin Srebotnjak  
-\fs20 \cf2 (Slovenian)
-\fs24 \cf0 \
+\fs24 	Martin Srebotnjak  
+\fs20 (Slovenian)
+\fs24 \
 	Adam Weinberger  
-\fs20 \cf2 (Canadian English)
-\fs24 \cf0 \
+\fs20 (Canadian English)
+\fs24 \
 \
 \pard\tx440\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li100\slleading40\sb40\qc
 
@@ -360,16 +378,16 @@
 \pard\tx440\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li100\slleading40\sb40\ql\qnatural
 
 \b0 \cf0 	The Pidgin Team
-\fs20 \cf2  \'a0(libpurple) \
+\fs20  \'a0(libpurple) \
 	
-\fs24 \cf0 NetworkRedux.com 
-\fs20 \cf2 \'a0(Subversion, Trac, Site and Adiumxtras.com Hosting) \
+\fs24 NetworkRedux.com 
+\fs20 \'a0(Subversion, Trac, Site and Adiumxtras.com Hosting) \
 	
-\fs24 \cf0 CocoaForge.com 
-\fs20 \cf2 \'a0(CocoaForge Adium Forums Hosting) \
+\fs24 CocoaForge.com 
+\fs20 \'a0(CocoaForge Adium Forums Hosting) \
 
-\fs24 \cf0 	Noah Kantrowitz 
-\fs20 \cf2 (major assistance with ticket system) \
+\fs24 	Noah Kantrowitz 
+\fs20 (major assistance with ticket system) \
 \
 \pard\tx440\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li100\slleading40\sb40\ql\qnatural
 
@@ -377,29 +395,29 @@
 \pard\tx440\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li100\slleading40\sb40\ql\qnatural
 
 \b0 \cf0 	Erik J. Barzeski
-\fs20 \cf2  \'a0(Code Contributions) 
-\fs24 \cf0 \
+\fs20  \'a0(Code Contributions) 
+\fs24 \
 	Jeremy Knickerbocker
-\fs20 \cf2  \'a0(Build Hosting)
-\fs24 \cf0 \
+\fs20  \'a0(Build Hosting)
+\fs24 \
 	Greg Smith
-\fs20 \cf2  \'a0(Code Contributions) \
+\fs20  \'a0(Code Contributions) \
 
-\fs24 \cf0 	Vinay Venkatesh
-\fs20 \cf2  \'a0(Code Contributions)\
+\fs24 	Vinay Venkatesh
+\fs20  \'a0(Code Contributions)\
 	
-\fs24 \cf0 AmbitiousLemon.com
-\fs20 \cf2  \'a0(FunMac Adium Forums Hosting) 
-\fs24 \cf0 \
+\fs24 AmbitiousLemon.com
+\fs20  \'a0(FunMac Adium Forums Hosting) 
+\fs24 \
 	New York Internet
-\fs20 \cf2  \'a0(1.x Site Hosting)\
+\fs20  \'a0(1.x Site Hosting)\
 	
-\fs24 \cf0 Penguinmilitia.net
-\fs20 \cf2  \'a0(SVN Project Hosting and Email Hosting) \
+\fs24 Penguinmilitia.net
+\fs20  \'a0(SVN Project Hosting and Email Hosting) \
 	
-\fs24 \cf0 SourceForge.net
-\fs20 \cf2  \'a0(Project Hosting) 
-\fs24 \cf0 \
+\fs24 SourceForge.net
+\fs20  \'a0(Project Hosting) 
+\fs24 \
 \
 \pard\tx440\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li100\slleading40\sb40\ql\qnatural
 
diff -r e63789abc563 -r 46dc399b3169 Source/AIAutomaticStatus.h
--- a/Source/AIAutomaticStatus.h	Sun Aug 15 21:34:25 2010 -0400
+++ b/Source/AIAutomaticStatus.h	Mon Aug 16 04:12:55 2010 +0200
@@ -18,11 +18,16 @@
 #define	AIScreensaverDidStartNotification		@"com.apple.screensaver.didstart"
 #define AIScreensaverDidStopNotification		@"com.apple.screensaver.didstop"
 
+#define AIScreenLockDidStartNotification		@"com.apple.screenIsLocked"
+#define AIScreenLockDidStopNotification			@"com.apple.screenIsUnlocked"
+
 @interface AIAutomaticStatus : AIPlugin {
 	NSNumber						*fastUserSwitchID;
 	NSNumber						*screenSaverID;
 	NSNumber						*idleID;
 	
+	NSNumber						*oldStatusID;
+	
 	NSMutableDictionary				*previousStatus;
 	NSMutableSet					*accountsToReconnect;
 	
@@ -34,9 +39,7 @@
 	double							idleReportInterval;
 	double							idleStatusInterval;
 	
-	BOOL							automaticStatusSet;
-	BOOL							automaticIdleSet;
-	BOOL							confirmReturn;
+	unsigned						automaticStatusBitMap;
 }
 
 @end
diff -r e63789abc563 -r 46dc399b3169 Source/AIAutomaticStatus.m
--- a/Source/AIAutomaticStatus.m	Sun Aug 15 21:34:25 2010 -0400
+++ b/Source/AIAutomaticStatus.m	Mon Aug 16 04:12:55 2010 +0200
@@ -23,6 +23,13 @@
 #import <Adium/AIStatus.h>
 #import <Adium/AIStatusGroup.h>
 
+typedef enum {
+	AIAwayIdle = (1 << 1),
+	AIAwayScreenSaved = (1 << 2),
+	AIAwayScreenLocked = (1 << 3),
+	AIAwayFastUserSwitched = (1 << 4)
+} AIAwayAutomaticType;
+
 @interface AIAutomaticStatus ()
 - (void)notificationHandler:(NSNotification *)notification;
 - (void)triggerAutoAwayWithStatusID:(NSNumber *)statusID;
@@ -34,7 +41,7 @@
  *
  * Automatically set accounts to certain statuses when events occur. Currently this handles:
  *  - Fast user switching
- *  - Screensaver activation
+ *  - Screen(saver|lock) activation
  *  - Idle time
  */
 @implementation AIAutomaticStatus
@@ -82,6 +89,16 @@
 							   name:AIScreensaverDidStopNotification
 							 object:nil];
 	
+	[notificationCenter addObserver:self
+						   selector:@selector(notificationHandler:)
+							   name:AIScreenLockDidStartNotification
+							 object:nil];
+	
+	[notificationCenter addObserver:self
+						   selector:@selector(notificationHandler:)
+							   name:AIScreenLockDidStopNotification
+							 object:nil];
+	
 	// Idle events are in the Adium notification center, posted by the AdiumIdleManager
 	notificationCenter = [NSNotificationCenter defaultCenter];
 
@@ -116,7 +133,7 @@
 	[adium.preferenceController unregisterPreferenceObserver:self];
 	
 	// Revert to our stored statuses
-	if (automaticStatusSet) {
+	if (automaticStatusBitMap != 0) {
 		[self returnFromAutoAway];
 	}
 }
@@ -135,6 +152,8 @@
 	[screenSaverID release];
 	[idleID release];
 	
+	[oldStatusID release];
+	
 	[super dealloc];
 }
 
@@ -181,76 +200,99 @@
  *
  * When a notification comes in, this checks if it's a start or end event
  *
- * A start event will set the status, and the end will revert to the previous status.
+ * If this event changes one of the automatic statusses, the user is set again
+ * to the highest priority automatic away status, or if none, returns from autoaway.
+ *
+ * Priorities: Fast User Switch'ed > Screen(saver|lock) > Idle.
  */
 - (void)notificationHandler:(NSNotification *)notification
 {
 	NSString	*notificationName = [notification name];
-	NSNumber	*statusID = nil;
-	BOOL		startEvent = NO, endEvent = NO;
+	unsigned	oldBitMap = automaticStatusBitMap;
 	
 	// Start events
 	if ([notificationName isEqualToString:NSWorkspaceSessionDidResignActiveNotification]) {
 		AILogWithSignature(@"Fast user switch (start) detected");
-
-		startEvent = fastUserSwitchEnabled;
-		statusID = fastUserSwitchID;
+		
+		if (fastUserSwitchEnabled) automaticStatusBitMap |= AIAwayFastUserSwitched;
+		
 	} else if ([notificationName isEqualToString:AIScreensaverDidStartNotification]) {
 		AILogWithSignature(@"Screensaver (start) detected.");
 		
-		startEvent = screenSaverEnabled;
-		statusID = screenSaverID;
+		if (screenSaverEnabled) automaticStatusBitMap |= AIAwayScreenSaved;
+		
 	} else if ([notificationName isEqualToString:AIMachineIdleUpdateNotification]) {
 		double duration = [[[notification userInfo] objectForKey:@"Duration"] doubleValue];
 		
-		// Update our idle time
-		if (!automaticIdleSet && reportIdleEnabled && duration >= idleReportInterval) {
-			AILogWithSignature(@"Idle (report) detected.");
+		// This is very spammy when we're already idle.
+		if (duration >= idleStatusInterval && !(automaticStatusBitMap & AIAwayIdle)) {
+			AILogWithSignature(@"Idle (start) detected.");
 			
-			automaticIdleSet = YES;
+			if (idleEnabled) automaticStatusBitMap |= AIAwayIdle;
 			
-			[adium.preferenceController setPreference:[[notification userInfo] objectForKey:@"IdleSince"]
-											   forKey:@"IdleSince"
-												group:GROUP_ACCOUNT_STATUS];
+			// Update our idle time
+			if (reportIdleEnabled) {
+				[adium.preferenceController setPreference:[[notification userInfo] objectForKey:@"IdleSince"]
+												   forKey:@"IdleSince"
+													group:GROUP_ACCOUNT_STATUS];
+			}
 		}
+	} if ([notificationName isEqualToString:AIScreenLockDidStartNotification]) {
+		AILogWithSignature(@"Screenlock (start) detected.");
 		
-		// Idle events require that we've been idle longer than required
-		startEvent = (idleEnabled && duration >= idleStatusInterval);
-		statusID = idleID;
-
-		// This is very spammy when we're already idle.
-		if (startEvent && !automaticStatusSet) {
-			AILogWithSignature(@"Idle (start) detected.");
-		}
+		if (screenSaverEnabled) automaticStatusBitMap |= AIAwayScreenLocked;
 	}
 	
 	// End events
 	if ([notificationName isEqualToString:NSWorkspaceSessionDidBecomeActiveNotification]) {
 		AILogWithSignature(@"Fast user switch (end) detected.");
 		
-		endEvent = fastUserSwitchEnabled;
+		automaticStatusBitMap &= ~AIAwayFastUserSwitched;
+		
 	} else if ([notificationName isEqualToString:AIScreensaverDidStopNotification]) {
 		AILogWithSignature(@"Screensaver (end) detected.");
+
+		automaticStatusBitMap &= ~AIAwayScreenSaved;
 		
-		endEvent = screenSaverEnabled;
 	} else if ([notificationName isEqualToString:AIMachineIsActiveNotification]) {
-		AILogWithSignature(@"Idle (end) detected.");
 		
-		if (automaticIdleSet) {	
-			automaticIdleSet = NO;
+		if (automaticStatusBitMap & AIAwayIdle) {
+			AILogWithSignature(@"Idle (end) detected.");
 			
+			automaticStatusBitMap &= ~AIAwayIdle;
+		}
+		
+		if (reportIdleEnabled) {
 			[adium.preferenceController setPreference:nil
 											   forKey:@"IdleSince"
-											     group:GROUP_ACCOUNT_STATUS];
+												group:GROUP_ACCOUNT_STATUS];
 		}
 		
-		endEvent = idleEnabled;
+	} else if ([notificationName isEqualToString:AIScreenLockDidStopNotification]) {
+		AILogWithSignature(@"Screenlock (end) detected.");
+		
+		automaticStatusBitMap &= ~AIAwayScreenLocked;
 	}
 	
-	if (startEvent && statusID && !automaticStatusSet) {
-		[self triggerAutoAwayWithStatusID:statusID];
-	} else if (endEvent && automaticStatusSet) {
-		[self returnFromAutoAway];
+	// Check if a change in status is required: if so, look for the one with the highest priority
+	if (oldBitMap != automaticStatusBitMap) {
+		NSNumber *statusID = nil;
+		
+		if (automaticStatusBitMap & AIAwayFastUserSwitched)
+			statusID = fastUserSwitchID;
+
+		else if ((automaticStatusBitMap & AIAwayScreenLocked)
+				 || (automaticStatusBitMap & AIAwayScreenSaved))
+			statusID = screenSaverID;
+			
+		else if (automaticStatusBitMap & AIAwayIdle)	
+			statusID = idleID;
+			
+		else
+			[self returnFromAutoAway];
+		
+		if (statusID)
+			[self triggerAutoAwayWithStatusID:statusID];
 	}
 	
 }
@@ -266,27 +308,30 @@
 {
 	AIStatusItem *targetStatusState = [adium.statusController statusStateWithUniqueStatusID:statusID];
 	
-	// Grab any group memeber if possible
+	// Grab any group member if possible
 	if ([targetStatusState isKindOfClass:[AIStatusGroup class]]) {
 		targetStatusState = [(AIStatusGroup *)targetStatusState anyContainedStatus];
 	}
 	
-	// If we weren't given a valid state, fail.
-	if (!targetStatusState) {
+	// If we weren't given a valid and new state, fail.
+	if (!targetStatusState || [oldStatusID isEqualToNumber:statusID]) {
 		return;
 	}
 	
 	for (AIAccount *account in adium.accountController.accounts) {
 		AIStatus	*currentStatusState = account.statusState;
 		
-		// Don't modify or store the status of non-available accounts
-		if (currentStatusState.statusType != AIAvailableStatusType) {
-			continue;
-		}
-		
-		// Store the state of the account
-		[previousStatus setObject:currentStatusState
-						   forKey:[NSNumber numberWithUnsignedInt:[account hash]]];
+// Store the state of the account if there is no previous one saved
+		if (![previousStatus objectForKey:[NSNumber numberWithUnsignedInteger:[account hash]]]) {
+			
+			// Don't modify or store the status of (originally!) non-available accounts
+			if (currentStatusState.statusType != AIAvailableStatusType) {
+				continue;
+			}
+			
+			[previousStatus setObject:currentStatusState
+							   forKey:[NSNumber numberWithUnsignedInteger:[account hash]]];
+ 		}
 		
 		AILogWithSignature(@"Setting %@ to status %@", account, targetStatusState);
 		
@@ -303,7 +348,8 @@
 		}
 	}
 	
-	automaticStatusSet = YES;
+	[oldStatusID release];
+	oldStatusID = [statusID retain];
 }
 
 /*!
@@ -335,7 +381,10 @@
 	[accountsToReconnect removeAllObjects];
 	[previousStatus removeAllObjects];
 	
-	automaticStatusSet = NO;
+	automaticStatusBitMap = 0;
+	
+	[oldStatusID release];
+	oldStatusID = nil;
 }
 
 @end




More information about the commits mailing list