2 * Adium is the legal property of its developers, whose names are listed in the copyright file included
3 * with this source distribution.
5 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
6 * General Public License as published by the Free Software Foundation; either version 2 of the License,
7 * or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
10 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11 * Public License for more details.
13 * You should have received a copy of the GNU General Public License along with this program; if not,
14 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 #import "AINewMessagePromptController.h"
18 #import "AIContentController.h"
19 #import "AIInterfaceController.h"
21 #define NEW_MESSAGE_PROMPT_NIB @"NewMessagePrompt"
23 static AINewMessagePromptController *sharedNewMessageInstance = nil;
26 * @class AINewMessagePromptController
27 * @brief Controller for the New Message prompt, which allows messaging an arbitrary contact
29 @implementation AINewMessagePromptController
32 * @brief Return our shared instance
33 * @result The shared instance
37 return sharedNewMessageInstance;
41 * @brief Create the shared instance
42 * @result The shared instance
44 + (id)createSharedInstance
46 sharedNewMessageInstance = [[self alloc] initWithWindowNibName:NEW_MESSAGE_PROMPT_NIB];
48 return sharedNewMessageInstance;
52 * @brief Destroy the shared instance
54 + (void)destroySharedInstance
56 [sharedNewMessageInstance autorelease]; sharedNewMessageInstance = nil;
60 * @brief Window did load
64 [super windowDidLoad];
66 [label_from setLocalizedString:AILocalizedString(@"From:",nil)];
67 [label_to setLocalizedString:AILocalizedString(@"To:",nil)];
69 [button_okay setLocalizedString:AILocalizedString(@"Message",nil)];
71 [[self window] setTitle:AILocalizedString(@"New Message",nil)];
75 * @brief Open a chat with the desired contact
77 - (IBAction)okay:(id)sender
79 AIListContact *contact;
81 if(contact = [self contactFromTextField]){
82 //Initiate the message
83 [[adium interfaceController] setActiveChat:[[adium contentController] openChatWithContact:contact]];
86 [[self class] closeSharedInstance];