adium 2803:4eb14b524627: Fix the logic a tad here; we need to co...
commits at adium.im
commits at adium.im
Thu Oct 29 00:50:07 UTC 2009
details: http://hg.adium.im/adium/rev/4eb14b524627
revision: 2803:4eb14b524627
author: Zachary West <zacw at adium.im>
date: Wed Oct 28 20:35:26 2009 -0400
Fix the logic a tad here; we need to commit a trimmed string in all cases, not just where AM/PM is not shown.
Subject: adium 2804:2b6a6cd8c92f: Examine any open chats when a bookmark is initialized to set its defaults. Fixes #12771.
details: http://hg.adium.im/adium/rev/2b6a6cd8c92f
revision: 2804:2b6a6cd8c92f
author: Zachary West <zacw at adium.im>
date: Wed Oct 28 20:48:18 2009 -0400
Examine any open chats when a bookmark is initialized to set its defaults. Fixes #12771.
This was occurring since the "saved chats" were opened/created before the AIListBookmark.
diffs (71 lines):
diff -r 755b7d1984ea -r 2b6a6cd8c92f Frameworks/AIUtilities Framework/Source/AIDateFormatterAdditions.m
--- a/Frameworks/AIUtilities Framework/Source/AIDateFormatterAdditions.m Wed Oct 28 16:46:55 2009 -0400
+++ b/Frameworks/AIUtilities Framework/Source/AIDateFormatterAdditions.m Wed Oct 28 20:48:18 2009 -0400
@@ -171,15 +171,16 @@
options:NSBackwardsSearch | NSLiteralSearch
range:NSMakeRange(0,[newFormat length])];
- formatString = [newFormat stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
- [newFormat release];
-
- if (setFormat)
- [*cachePointer setDateFormat:formatString];
+ formatString = [newFormat autorelease];
} else {
formatString = [*cachePointer dateFormat];
}
+ formatString = [formatString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
+
+ if (setFormat)
+ [*cachePointer setDateFormat:formatString];
+
return formatString;
}
diff -r 755b7d1984ea -r 2b6a6cd8c92f Frameworks/Adium Framework/Source/AIListBookmark.m
--- a/Frameworks/Adium Framework/Source/AIListBookmark.m Wed Oct 28 16:46:55 2009 -0400
+++ b/Frameworks/Adium Framework/Source/AIListBookmark.m Wed Oct 28 20:48:18 2009 -0400
@@ -28,6 +28,8 @@
- (BOOL)chatIsOurs:(AIChat *)chat;
- (AIChat *)openChatWithoutActivating;
- (void)restoreGrouping;
+
+- (void)claimChatIfOurs:(AIChat *)chat;
@end
@implementation AIListBookmark
@@ -58,6 +60,11 @@
name:Chat_DidOpen
object:nil];
+ // Scan all open chats to claim them, if we loaded after they were available.
+ for (AIChat *chat in adium.interfaceController.openChats) {
+ [self claimChatIfOurs:chat];
+ }
+
AILog(@"Created %@", self);
}
@@ -293,8 +300,19 @@
- (void)chatDidOpen:(NSNotification *)notification
{
AIChat *chat = [notification object];
-
- // If this is our chat, we should set it up appropriately.
+
+ [self claimChatIfOurs:chat];
+}
+
+/*!
+ * @brief Claim a chat
+ *
+ * Has no effect if the chat is not ours.
+ *
+ * Establishes any defaults we wish for our chats to have. Called when they are created.
+ */
+- (void)claimChatIfOurs:(AIChat *)chat
+{
if ([self chatIsOurs:chat]) {
chat.displayName = self.displayName;
}
More information about the commits
mailing list