adium 5169:67694405be1a: Make sure the Rejoin bar disappears if ...
commits at adium.im
commits at adium.im
Mon Oct 22 13:59:09 UTC 2012
details: http://hg.adium.im/adium/rev/67694405be1a
revision: 5169:67694405be1a
branch: adium-1.6
author: Thijs Alkemade <thijsalkemade at gmail.com>
date: Mon Oct 22 15:57:40 2012 +0200
Make sure the Rejoin bar disappears if the user rejoins the chat in any way.
diffs (227 lines):
diff -r 927c13685c9e -r 67694405be1a Plugins/Dual Window Interface/AIAccountSelectionViewController.h
--- a/Plugins/Dual Window Interface/AIAccountSelectionViewController.h Mon Oct 22 15:37:49 2012 +0200
+++ b/Plugins/Dual Window Interface/AIAccountSelectionViewController.h Mon Oct 22 15:57:40 2012 +0200
@@ -32,12 +32,9 @@
AIAccountMenu *accountMenu;
AIContactMenu *contactMenu;
- AIChat *chat;
BOOL choicesForContact;
BOOL choicesForAccount;
}
-- (void)setChat:(AIChat *)chat;
-
@end
diff -r 927c13685c9e -r 67694405be1a Plugins/Dual Window Interface/AIMessageViewController.m
--- a/Plugins/Dual Window Interface/AIMessageViewController.m Mon Oct 22 15:37:49 2012 +0200
+++ b/Plugins/Dual Window Interface/AIMessageViewController.m Mon Oct 22 15:57:40 2012 +0200
@@ -157,7 +157,6 @@
[sourceDestination.view setHidden:TRUE];
[self addTopBarController:sourceDestination];
- [sourceDestination setChat:chat];
[sourceDestination release];
@@ -1351,6 +1350,7 @@
[topBarControllers addObject:newController];
[view_topBars addSubview:newController.view];
newController.owner = self;
+ newController.chat = self.chat;
[self didResizeTopbarController:newController];
}
diff -r 927c13685c9e -r 67694405be1a Plugins/Dual Window Interface/AIRejoinGroupChatTopBar.xib
--- a/Plugins/Dual Window Interface/AIRejoinGroupChatTopBar.xib Mon Oct 22 15:37:49 2012 +0200
+++ b/Plugins/Dual Window Interface/AIRejoinGroupChatTopBar.xib Mon Oct 22 15:57:40 2012 +0200
@@ -43,15 +43,16 @@
<reference key="NSNextResponder" ref="323709103"/>
<int key="NSvFlags">290</int>
<array class="NSMutableArray" key="NSSubviews">
- <object class="NSButton" id="275886502">
+ <object class="NSButton" id="296306315">
<reference key="NSNextResponder" ref="1005"/>
- <int key="NSvFlags">268</int>
- <string key="NSFrame">{{180, 4}, {51, 19}}</string>
+ <int key="NSvFlags">265</int>
+ <string key="NSFrame">{{422, 4}, {51, 19}}</string>
<reference key="NSSuperview" ref="1005"/>
<reference key="NSWindow"/>
+ <reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="703427298">
+ <object class="NSButtonCell" key="NSCell" id="16184171">
<int key="NSCellFlags">-2080374784</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents">Rejoin</string>
@@ -61,7 +62,7 @@
<int key="NSfFlags">16</int>
</object>
<string key="NSCellIdentifier">_NS:9</string>
- <reference key="NSControlView" ref="275886502"/>
+ <reference key="NSControlView" ref="296306315"/>
<int key="NSButtonFlags">-2038153216</int>
<int key="NSButtonFlags2">164</int>
<string key="NSAlternateContents"/>
@@ -76,7 +77,7 @@
<string key="NSFrame">{{7, 7}, {168, 17}}</string>
<reference key="NSSuperview" ref="1005"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="275886502"/>
+ <reference key="NSNextKeyView" ref="296306315"/>
<string key="NSReuseIdentifierKey">_NS:1535</string>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="898766195">
@@ -164,7 +165,7 @@
<object class="IBOutletConnection" key="connection">
<string key="label">button_rejoin</string>
<reference key="source" ref="1001"/>
- <reference key="destination" ref="275886502"/>
+ <reference key="destination" ref="296306315"/>
</object>
<int key="connectionID">39</int>
</object>
@@ -172,7 +173,7 @@
<object class="IBActionConnection" key="connection">
<string key="label">rejoin:</string>
<reference key="source" ref="1001"/>
- <reference key="destination" ref="275886502"/>
+ <reference key="destination" ref="296306315"/>
</object>
<int key="connectionID">40</int>
</object>
@@ -216,7 +217,7 @@
<reference key="object" ref="1005"/>
<array class="NSMutableArray" key="children">
<reference ref="476591228"/>
- <reference ref="275886502"/>
+ <reference ref="296306315"/>
</array>
<reference key="parent" ref="323709103"/>
</object>
@@ -235,16 +236,16 @@
</object>
<object class="IBObjectRecord">
<int key="objectID">36</int>
- <reference key="object" ref="275886502"/>
+ <reference key="object" ref="296306315"/>
<array class="NSMutableArray" key="children">
- <reference ref="703427298"/>
+ <reference ref="16184171"/>
</array>
<reference key="parent" ref="1005"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">37</int>
- <reference key="object" ref="703427298"/>
- <reference key="parent" ref="275886502"/>
+ <reference key="object" ref="16184171"/>
+ <reference key="parent" ref="296306315"/>
</object>
</array>
</object>
diff -r 927c13685c9e -r 67694405be1a Plugins/Dual Window Interface/AIRejoinGroupChatViewController.m
--- a/Plugins/Dual Window Interface/AIRejoinGroupChatViewController.m Mon Oct 22 15:37:49 2012 +0200
+++ b/Plugins/Dual Window Interface/AIRejoinGroupChatViewController.m Mon Oct 22 15:57:40 2012 +0200
@@ -37,14 +37,46 @@
return self;
}
+- (void)dealloc
+{
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+
+ [super dealloc];
+}
+
- (IBAction)rejoin:(id)sender
{
- AIGroupChat *chat = (AIGroupChat *)owner.chat;
-
[chat.account setShouldBeOnline:YES];
- if ([chat.account rejoinChat:chat])
+ [chat.account rejoinChat:chat];
+}
+
+- (void)chatStatusChanged:(NSNotification *)notification
+{
+ NSArray *keys = [[notification userInfo] objectForKey:@"Keys"];
+
+ // Remove ourselves if the chat rejoined.
+ if ([keys containsObject:@"accountJoined"] &&
+ [chat boolValueForProperty:@"accountJoined"]) {
[owner removeTopBarController:self];
+ }
+}
+
+- (void)setChat:(AIChat *)inChat
+{
+ if (chat) {
+ [[NSNotificationCenter defaultCenter] removeObserver:self
+ name:Chat_StatusChanged
+ object:chat];
+ }
+
+ [chat release];
+
+ chat = [inChat retain];
+
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(chatStatusChanged:)
+ name:Chat_StatusChanged
+ object:chat];
}
@end
diff -r 927c13685c9e -r 67694405be1a Source/AIMessageViewTopBarController.h
--- a/Source/AIMessageViewTopBarController.h Mon Oct 22 15:37:49 2012 +0200
+++ b/Source/AIMessageViewTopBarController.h Mon Oct 22 15:57:40 2012 +0200
@@ -15,14 +15,19 @@
*/
#import <Cocoa/Cocoa.h>
+#import <Adium/AIChat.h>
@class AIMessageViewController;
@interface AIMessageViewTopBarController : NSViewController {
AIMessageViewController *owner;
+
+ AIChat *chat;
}
@property (assign) AIMessageViewController *owner;
+ at property (retain) AIChat *chat;
+
- (IBAction)close:(id)sender;
@end
diff -r 927c13685c9e -r 67694405be1a Source/AIMessageViewTopBarController.m
--- a/Source/AIMessageViewTopBarController.m Mon Oct 22 15:37:49 2012 +0200
+++ b/Source/AIMessageViewTopBarController.m Mon Oct 22 15:57:40 2012 +0200
@@ -19,7 +19,7 @@
@implementation AIMessageViewTopBarController
- at synthesize owner;
+ at synthesize owner, chat;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
@@ -31,6 +31,13 @@
return self;
}
+- (void)dealloc
+{
+ [chat release];
+
+ [super dealloc];
+}
+
- (IBAction)close:(id)sender
{
[owner hideTopBarController:self];
More information about the commits
mailing list