adium-1.4 2675:f4ba67614e13: Examine any open chats when a bookm...
commits at adium.im
commits at adium.im
Thu Oct 29 00:48:22 UTC 2009
details: http://hg.adium.im/adium-1.4/rev/f4ba67614e13
revision: 2675:f4ba67614e13
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 (46 lines):
diff -r 4d6e6d868870 -r f4ba67614e13 Frameworks/Adium Framework/Source/AIListBookmark.m
--- a/Frameworks/Adium Framework/Source/AIListBookmark.m Wed Oct 28 20:35:26 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