Plugins/Purple Service/ESSimpleService.m
author Zachary West <zacw@adium.im>
Sat Oct 17 17:35:57 2009 -0400 (2009-10-17)
changeset 2743 df2c24e3844c
parent 717 6d91840f8298
child 3679 f4294bb53b0f
permissions -rw-r--r--
Add -[AIService pathForDefaultServiceIconOfType:], and use it for replacing %serviceIconImg% in headers. Fixes #12697.
David@0
     1
//
David@0
     2
//  ESSimpleService.m
David@0
     3
//  Adium
David@0
     4
//
David@0
     5
//  Created by Evan Schoenberg on 12/17/05.
David@0
     6
//
David@0
     7
David@0
     8
#import "ESSimpleService.h"
David@0
     9
#import "ESPurpleSimpleAccount.h"
David@0
    10
#import "ESPurpleSimpleAccountViewController.h"
David@0
    11
#import <Adium/AIStatusControllerProtocol.h>
David@0
    12
#import <AIUtilities/AIImageAdditions.h>
David@0
    13
David@0
    14
@implementation ESSimpleService
David@0
    15
//Account Creation
David@0
    16
- (Class)accountClass{
David@0
    17
	return [ESPurpleSimpleAccount class];
David@0
    18
}
David@0
    19
David@0
    20
- (AIAccountViewController *)accountViewController{
David@0
    21
    return [ESPurpleSimpleAccountViewController accountViewController];
David@0
    22
}
David@0
    23
David@0
    24
- (DCJoinChatViewController *)joinChatView{
David@0
    25
	return nil;
David@0
    26
}
David@0
    27
David@0
    28
//Service Description
David@0
    29
- (NSString *)serviceCodeUniqueID{
David@0
    30
	return @"libpurple-simple";
David@0
    31
}
David@0
    32
- (NSString *)serviceID{
David@0
    33
	return @"SIMPLE";
David@0
    34
}
David@0
    35
- (NSString *)serviceClass{
David@0
    36
	return @"SIMPLE";
David@0
    37
}
David@0
    38
- (NSString *)shortDescription{
David@0
    39
	return @"SIMPLE";
David@0
    40
}
David@0
    41
- (NSString *)longDescription{
David@0
    42
	return @"SIP / SIMPLE";
David@0
    43
}
David@0
    44
- (NSCharacterSet *)allowedCharacters{
Evan@209
    45
	return [NSCharacterSet characterSetWithCharactersInString:@"+abcdefghijklmnopqrstuvwxyz0123456789._-@\\"];
David@0
    46
}
David@60
    47
- (NSUInteger)allowedLength{
David@0
    48
	return 255;
David@0
    49
}
David@0
    50
- (BOOL)caseSensitive{
David@0
    51
	return NO;
David@0
    52
}
David@0
    53
- (AIServiceImportance)serviceImportance{
David@0
    54
	return AIServiceSecondary;
David@0
    55
}
David@0
    56
- (BOOL)canCreateGroupChats{
David@0
    57
	return NO;
David@0
    58
}
David@0
    59
David@0
    60
- (void)registerStatuses{
David@100
    61
	[adium.statusController registerStatus:STATUS_NAME_AVAILABLE
David@100
    62
							 withDescription:[adium.statusController localizedDescriptionForCoreStatusName:STATUS_NAME_AVAILABLE]
David@0
    63
									  ofType:AIAvailableStatusType
David@0
    64
								  forService:self];
David@0
    65
}
David@0
    66
David@0
    67
/*!
David@0
    68
 * @brief Default icon
David@0
    69
 *
David@0
    70
 * Service Icon packs should always include images for all the built-in Adium services.  This method allows external
David@0
    71
 * service plugins to specify an image which will be used when the service icon pack does not specify one.  It will
David@0
    72
 * also be useful if new services are added to Adium itself after a significant number of Service Icon packs exist
David@0
    73
 * which do not yet have an image for this service.  If the active Service Icon pack provides an image for this service,
David@0
    74
 * this method will not be called.
David@0
    75
 *
David@0
    76
 * The service should _not_ cache this icon internally; multiple calls should return unique NSImage objects.
David@0
    77
 *
David@0
    78
 * @param iconType The AIServiceIconType of the icon to return. This specifies the desired size of the icon.
David@0
    79
 * @return NSImage to use for this service by default
David@0
    80
 */
David@0
    81
- (NSImage *)defaultServiceIconOfType:(AIServiceIconType)iconType
David@0
    82
{
David@0
    83
	return [NSImage imageNamed:@"simple" forClass:[self class] loadLazily:YES];
David@0
    84
}
David@0
    85
zacw@2743
    86
/*!
zacw@2743
    87
 * @brief Path for default icon
zacw@2743
    88
 *
zacw@2743
    89
 * For use in message views, this is the path to a default icon as described above.
zacw@2743
    90
 *
zacw@2743
    91
 * @param iconType The AIServiceIconType of the icon to return.
zacw@2743
    92
 * @return The path to the image, otherwise nil.
zacw@2743
    93
 */
zacw@2743
    94
- (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType
zacw@2743
    95
{
zacw@2743
    96
	return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"simple"];		
zacw@2743
    97
}
zacw@2743
    98
David@0
    99
@end