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