adium 4133:00c6af1ddca5: Separate the setting of auto-idle and a...
commits at adium.im
commits at adium.im
Wed Aug 10 14:43:44 UTC 2011
details: http://hg.adium.im/adium/rev/00c6af1ddca5
revision: 4133:00c6af1ddca5
branch: (none)
author: Thijs Alkemade <thijsalkemade at gmail.com>
date: Wed Aug 10 16:33:02 2011 +0200
Separate the setting of auto-idle and auto-away, which can both be enabled or disabled by the user. Compare the new idle time with the old idle time only on seconds, the comparison seemed to fail even when using objects that should be identical, causing Adium to send and write to disk every second.
Fixes #15147, fixes #15364
(transplanted from c80f7570db0abfe80623db7435274f02f0634d19)
diffs (61 lines):
diff -r bfe93b6db274 -r 00c6af1ddca5 Source/AIAutomaticStatus.m
--- a/Source/AIAutomaticStatus.m Tue Aug 09 20:51:14 2011 -0700
+++ b/Source/AIAutomaticStatus.m Wed Aug 10 16:33:02 2011 +0200
@@ -225,24 +225,31 @@
} else if ([notificationName isEqualToString:AIMachineIdleUpdateNotification]) {
double duration = [[[notification userInfo] objectForKey:@"Duration"] doubleValue];
- // This is very spammy when we're already idle.
- if (duration >= idleStatusInterval && !(automaticStatusBitMap & AIAwayIdle)) {
+ if (reportIdleEnabled && duration >= idleReportInterval) {
NSDate *idleSince = [[notification userInfo] objectForKey:@"idleSince"];
- if (![[adium.preferenceController preferenceForKey:@"idleSince" group:GROUP_ACCOUNT_STATUS] isEqualToDate:idleSince]) {
- AILogWithSignature(@"Idle (start) detected.");
-
- if (idleStatusEnabled) automaticStatusBitMap |= AIAwayIdle;
+
+ if ((NSInteger)[[adium.preferenceController preferenceForKey:@"idleSince"
+ group:GROUP_ACCOUNT_STATUS] timeIntervalSince1970] !=
+ (NSInteger)[idleSince timeIntervalSince1970]) {
+
+ AILogWithSignature(@"Idle (start) detected. %@ -> %@", [adium.preferenceController preferenceForKey:@"idleSince"
+ group:GROUP_ACCOUNT_STATUS], idleSince);
// Update our idle time
- if (reportIdleEnabled) {
- [adium.preferenceController setPreference:[[notification userInfo] objectForKey:@"idleSince"]
- forKey:@"idleSince"
- group:GROUP_ACCOUNT_STATUS];
- }
+ [adium.preferenceController setPreference:[[notification userInfo] objectForKey:@"idleSince"]
+ forKey:@"idleSince"
+ group:GROUP_ACCOUNT_STATUS];
}
}
+ if (idleStatusEnabled && duration >= idleStatusInterval && !(automaticStatusBitMap & AIAwayIdle)) {
+
+ AILogWithSignature(@"Auto-away (start) detected.");
+
+ automaticStatusBitMap |= AIAwayIdle;
+ }
+
} if ([notificationName isEqualToString:AIScreenLockDidStartNotification]) {
AILogWithSignature(@"Screenlock (start) detected.");
@@ -263,12 +270,13 @@
} else if ([notificationName isEqualToString:AIMachineIsActiveNotification]) {
if (automaticStatusBitMap & AIAwayIdle) {
- AILogWithSignature(@"Idle (end) detected.");
+ AILogWithSignature(@"Auto-away (end) detected.");
automaticStatusBitMap &= ~AIAwayIdle;
}
if (reportIdleEnabled) {
+ AILogWithSignature(@"Idle (end) detected.");
[adium.preferenceController setPreference:nil
forKey:@"idleSince"
group:GROUP_ACCOUNT_STATUS];
More information about the commits
mailing list