Add -[AIService pathForDefaultServiceIconOfType:], and use it for replacing %serviceIconImg% in headers. Fixes #12697.
5 // Created by Evan Schoenberg on 3/4/06.
8 #import "ESIRCService.h"
9 #import "ESIRCAccount.h"
10 #import "ESIRCAccountViewController.h"
11 #import "ESIRCJoinChatViewController.h"
12 #import <AIUtilities/AIImageAdditions.h>
13 #import <AIUtilities/AIImageDrawingAdditions.h>
14 #import <AIUtilities/AICharacterSetAdditions.h>
16 @implementation ESIRCService
18 - (Class)accountClass{
19 return [ESIRCAccount class];
22 - (AIAccountViewController *)accountViewController{
23 return [ESIRCAccountViewController accountViewController];
26 - (DCJoinChatViewController *)joinChatView{
27 return [ESIRCJoinChatViewController joinChatView];
31 - (NSString *)serviceCodeUniqueID{
32 return @"libpurple-IRC";
34 - (NSString *)serviceID{
37 - (NSString *)serviceClass{
40 - (NSString *)shortDescription{
43 - (NSString *)longDescription{
44 return AILocalizedString(@"IRC (Internet Relay Chat)", nil);
46 - (NSCharacterSet *)allowedCharacters{
47 //Per RFC-2812: http://www.ietf.org/rfc/rfc2812.txt
48 NSMutableCharacterSet *allowedCharacters = [[NSCharacterSet alphanumericCharacterSet] mutableCopy];
49 NSCharacterSet *returnSet;
51 [allowedCharacters addCharactersInString:@"[]\\`_^{|}-"];
52 returnSet = [allowedCharacters immutableCopy];
53 [allowedCharacters release];
55 return [returnSet autorelease];
57 - (BOOL)caseSensitive{
60 - (BOOL)canCreateGroupChats{
63 - (BOOL)supportsPassword{
66 //Passwords are supported but optional
67 - (BOOL)requiresPassword
71 - (AIServiceImportance)serviceImportance{
72 return AIServiceSecondary;
75 * @brief Placeholder string for the UID field
77 - (NSString *)UIDPlaceholder
79 return AILocalizedString(@"nickname","Sample name and server for new IRC accounts");
82 * @brief Username label
84 - (NSString *)userNameLabel
86 return AILocalizedString(@"Nickname", "Name for IRC user names");
92 * Service Icon packs should always include images for all the built-in Adium services. This method allows external
93 * service plugins to specify an image which will be used when the service icon pack does not specify one. It will
94 * also be useful if new services are added to Adium itself after a significant number of Service Icon packs exist
95 * which do not yet have an image for this service. If the active Service Icon pack provides an image for this service,
96 * this method will not be called.
98 * The service should _not_ cache this icon internally; multiple calls should return unique NSImage objects.
100 * @param iconType The AIServiceIconType of the icon to return. This specifies the desired size of the icon.
101 * @return NSImage to use for this service by default
103 - (NSImage *)defaultServiceIconOfType:(AIServiceIconType)iconType
105 NSImage *baseImage = [NSImage imageNamed:@"irc" forClass:[self class] loadLazily:YES];
107 if (iconType == AIServiceIconSmall || iconType == AIServiceIconList) {
108 baseImage = [baseImage imageByScalingToSize:NSMakeSize(16, 16)];
115 * @brief Path for default icon
117 * For use in message views, this is the path to a default icon as described above.
119 * @param iconType The AIServiceIconType of the icon to return.
120 * @return The path to the image, otherwise nil.
122 - (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType
124 if ((iconType == AIServiceIconSmall) || (iconType == AIServiceIconList)) {
125 return nil; //xxx add small IRC icon
127 return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"irc"];