Plugins/Purple Service/AIMobileMeService.m
author Zachary West <zacw@adium.im>
Sat Oct 17 17:35:57 2009 -0400 (2009-10-17)
changeset 2743 df2c24e3844c
parent 2103 89a96983d1b7
permissions -rw-r--r--
Add -[AIService pathForDefaultServiceIconOfType:], and use it for replacing %serviceIconImg% in headers. Fixes #12697.
     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  */
    16 
    17 #import "AIMobileMeService.h"
    18 #import "AIPurpleMobileMeAccount.h"
    19 #import "AIPurpleMobileMeAccountViewController.h"
    20 #import <AIUtilities/AIImageAdditions.h>
    21 
    22 @implementation AIMobileMeService
    23 
    24 //Account Creation
    25 - (Class)accountClass{
    26 	return [AIPurpleMobileMeAccount class];
    27 }
    28 
    29 - (AIAccountViewController *)accountViewController{
    30     return [AIPurpleMobileMeAccountViewController accountViewController];
    31 }
    32 
    33 //Service Description
    34 - (NSString *)serviceCodeUniqueID{
    35 	return @"libpurple-oscar-MobileMe";
    36 }
    37 - (NSString *)serviceID{
    38 	return @"MobileMe";
    39 }
    40 - (NSString *)shortDescription{
    41 	return @"MobileMe";
    42 }
    43 - (NSString *)longDescription{
    44 	return @"MobileMe";
    45 }
    46 - (NSCharacterSet *)ignoredCharacters{
    47 	return [NSCharacterSet characterSetWithCharactersInString:@" "];
    48 }
    49 - (BOOL)caseSensitive{
    50 	return NO;
    51 }
    52 - (AIServiceImportance)serviceImportance{
    53 	return AIServiceSecondary;
    54 }
    55 - (NSString *)userNameLabel{
    56     return AILocalizedString(@"Member Name",nil); //.Mac Member Name
    57 }
    58 /*!
    59  * @brief Default icon
    60  *
    61  * Service Icon packs should always include images for all the built-in Adium services.  This method allows external
    62  * service plugins to specify an image which will be used when the service icon pack does not specify one.  It will
    63  * also be useful if new services are added to Adium itself after a significant number of Service Icon packs exist
    64  * which do not yet have an image for this service.  If the active Service Icon pack provides an image for this service,
    65  * this method will not be called.
    66  *
    67  * The service should _not_ cache this icon internally; multiple calls should return unique NSImage objects.
    68  *
    69  * @param iconType The AIServiceIconType of the icon to return. This specifies the desired size of the icon.
    70  * @return NSImage to use for this service by default
    71  */
    72 - (NSImage *)defaultServiceIconOfType:(AIServiceIconType)iconType
    73 {
    74 	return [NSImage imageNamed:((iconType == AIServiceIconSmall || iconType == AIServiceIconList) ? @"MobileMe-small" : @"MobileMe-large")
    75 					  forClass:[self class] loadLazily:YES];
    76 }
    77 
    78 /*!
    79  * @brief Path for default icon
    80  *
    81  * For use in message views, this is the path to a default icon as described above.
    82  *
    83  * @param iconType The AIServiceIconType of the icon to return.
    84  * @return The path to the image, otherwise nil.
    85  */
    86 - (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType
    87 {
    88 	if ((iconType == AIServiceIconSmall) || (iconType == AIServiceIconList)) {
    89 		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"MobileMe-small"];
    90 	} else {
    91 		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"MobileMe-large"];		
    92 	}
    93 }
    94 
    95 @end