Merged [13632]: Patch from Gayle Laakmann to not append @gmail.com if @googlemail...
[adiumx.git] / Source / AIStandardToolbarItemsPlugin.m
blobfd03297afbc490e23eb264fd111e794a6df0e4f5
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 "AIContactController.h"
18 #import "AIContentController.h"
19 #import "AIInterfaceController.h"
20 #import "AIStandardToolbarItemsPlugin.h"
21 #import "AIToolbarController.h"
22 #import <AIUtilities/AIToolbarUtilities.h>
23 #import <AIUtilities/ESImageAdditions.h>
24 #import <Adium/AIListContact.h>
25 #import <Adium/AIListObject.h>
27 #define MESSAGE AILocalizedString(@"Message", nil)
29 /*!
30  * @class AIStandardToolbarItemsPlugin
31  * @brief Component to provide general-use toolbar items
32  *
33  * Just provides a Message toolbar item at present.
34  */
35 @implementation AIStandardToolbarItemsPlugin
37 /*!
38  * @brief Install
39  */
40 - (void)installPlugin
42     //New Message
43     NSToolbarItem   *toolbarItem = 
44         [AIToolbarUtilities toolbarItemWithIdentifier:@"NewMessage"
45                                                                                         label:MESSAGE
46                                                                          paletteLabel:MESSAGE
47                                                                                   toolTip:MESSAGE
48                                                                                    target:self
49                                                                   settingSelector:@selector(setImage:)
50                                                                           itemContent:[NSImage imageNamed:@"message" forClass:[self class]]
51                                                                                    action:@selector(newMessage:)
52                                                                                          menu:nil];
53     [[adium toolbarController] registerToolbarItem:toolbarItem forToolbarType:@"ListObject"];
56 /*!
57  * @brief New chat with the selected list object
58  */
59 - (IBAction)newMessage:(NSToolbarItem *)toolbarItem
61     AIListObject        *object = [[adium contactController] selectedListObject];
63     if([object isKindOfClass:[AIListContact class]]){
64                 AIChat  *chat = [[adium contentController] openChatWithContact:(AIListContact *)object];
65         [[adium interfaceController] setActiveChat:chat];
66     }
67         
70 @end