Merged [15040]: Trying some magic: 5 seconds after the last unreachable host is repor...
[adiumx.git] / Source / AINewMessagePromptController.m
blob9b295a8b5ba9cc3c7a6b8ea6462766b5a3aba33e
1 /* 
2  * Adium is the legal property of its developers, whose names are listed in the copyright file included
3  * with this source distribution.
4  * 
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.
8  * 
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.
12  * 
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.
15  */
17 #import "AINewMessagePromptController.h"
18 #import "AIContentController.h"
19 #import "AIInterfaceController.h"
21 #define NEW_MESSAGE_PROMPT_NIB  @"NewMessagePrompt"
23 static AINewMessagePromptController *sharedNewMessageInstance = nil;
25 /*!
26  * @class AINewMessagePromptController
27  * @brief Controller for the New Message prompt, which allows messaging an arbitrary contact
28  */
29 @implementation AINewMessagePromptController
31 /*!
32  * @brief Return our shared instance
33  * @result The shared instance
34  */
35 + (id)sharedInstance 
37         return sharedNewMessageInstance;
40 /*!
41  * @brief Create the shared instance
42  * @result The shared instance
43  */
44 + (id)createSharedInstance 
46         sharedNewMessageInstance = [[self alloc] initWithWindowNibName:NEW_MESSAGE_PROMPT_NIB];
47         
48         return sharedNewMessageInstance;
51 /*!
52  * @brief Destroy the shared instance
53  */
54 + (void)destroySharedInstance 
56         [sharedNewMessageInstance autorelease]; sharedNewMessageInstance = nil;
59 /*!
60  * @brief Window did load
61  */
62 - (void)windowDidLoad
64         [super windowDidLoad];
65         
66         [label_from setLocalizedString:AILocalizedString(@"From:",nil)];
67         [label_to setLocalizedString:AILocalizedString(@"To:",nil)];
68         
69         [button_okay setLocalizedString:AILocalizedString(@"Message",nil)];
70         
71         [[self window] setTitle:AILocalizedString(@"New Message",nil)];
74 /*!
75  * @brief Open a chat with the desired contact
76  */
77 - (IBAction)okay:(id)sender
79         AIListContact   *contact;
80         
81     if(contact = [self contactFromTextField]){
82         //Initiate the message
83         [[adium interfaceController] setActiveChat:[[adium contentController] openChatWithContact:contact]];
84                 
85                 //Close the prompt
86         [[self class] closeSharedInstance];
87     }
90 @end