William Bowling is sharing code with you

Bitbucket is a code hosting site. Unlimited public and private repositories. Free for small teams.

Don't show this again

wbowling / adium (fork of adium / adium)

Fork of Adium for patches/improvements

Clone this repository (size: 338.7 MB): HTTPS / SSH
hg clone https://bitbucket.org/wbowling/adium
hg clone ssh://hg@bitbucket.org/wbowling/adium

adium / Plugins / Purple Service / ESPurpleRequestAbstractWindowController.m

//
//  ESPurpleRequestAbstractWindowController.m
//  Adium
//
//  Created by Evan Schoenberg on 9/22/05.
//

#import "ESPurpleRequestAbstractWindowController.h"
#import "adiumPurpleRequest.h"

@implementation ESPurpleRequestAbstractWindowController

- (id)initWithWindowNibName:(NSString *)windowNibName
{
        if ((self = [super initWithWindowNibName:windowNibName])) {
                windowIsClosing = NO;
        }
        
        return self;
}

/*!
 * @brief This is where subclasses should generally perform actions they would normally do in windowWillClose:
 *
 * ESPurpleRequestAbstractWindowController calls this method only when windowWillClose: is triggered by user action
 * as opposed to libpurple closing the window.
 */
- (void)doWindowWillClose {};

- (void)windowWillClose:(id)sender
{
        [super windowWillClose:sender];
        
        if (!windowIsClosing) {
                windowIsClosing = YES;
                [self doWindowWillClose];
                
                //Inform libpurple that the request window closed
                [ESPurpleRequestAdapter requestCloseWithHandle:self];
        }
}       

/*!
 * @brief libpurple has been made aware we closed or has informed us we should close
 *
 * Close our requestController's window if it's open; then release (we returned without autoreleasing initially).
 */
- (void)purpleRequestClose
{
        if (!windowIsClosing) {
                windowIsClosing = YES;
                [self closeWindow:nil];
        }
        
        [self release];
}

@end