Plugins/Purple Service/AIMobileMeService.m
author Zachary West <zacw@adium.im>
Sat Oct 17 17:35:57 2009 -0400 (2009-10-17)
changeset 2632 4e544bf1b994
parent 2103 89a96983d1b7
permissions -rw-r--r--
Add -[AIService pathForDefaultServiceIconOfType:], and use it for replacing %serviceIconImg% in headers. Fixes #12697.
David@0
     1
/* 
David@0
     2
 * Adium is the legal property of its developers, whose names are listed in the copyright file included
David@0
     3
 * with this source distribution.
David@0
     4
 * 
David@0
     5
 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
David@0
     6
 * General Public License as published by the Free Software Foundation; either version 2 of the License,
David@0
     7
 * or (at your option) any later version.
David@0
     8
 * 
David@0
     9
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
David@0
    10
 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
David@0
    11
 * Public License for more details.
David@0
    12
 * 
David@0
    13
 * You should have received a copy of the GNU General Public License along with this program; if not,
David@0
    14
 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
David@0
    15
 */
David@0
    16
David@0
    17
#import "AIMobileMeService.h"
David@0
    18
#import "AIPurpleMobileMeAccount.h"
David@0
    19
#import "AIPurpleMobileMeAccountViewController.h"
David@0
    20
#import <AIUtilities/AIImageAdditions.h>
David@0
    21
David@0
    22
@implementation AIMobileMeService
David@0
    23
David@0
    24
//Account Creation
David@0
    25
- (Class)accountClass{
David@0
    26
	return [AIPurpleMobileMeAccount class];
David@0
    27
}
David@0
    28
David@0
    29
- (AIAccountViewController *)accountViewController{
David@0
    30
    return [AIPurpleMobileMeAccountViewController accountViewController];
David@0
    31
}
David@0
    32
David@0
    33
//Service Description
David@0
    34
- (NSString *)serviceCodeUniqueID{
David@0
    35
	return @"libpurple-oscar-MobileMe";
David@0
    36
}
David@0
    37
- (NSString *)serviceID{
David@0
    38
	return @"MobileMe";
David@0
    39
}
David@0
    40
- (NSString *)shortDescription{
David@0
    41
	return @"MobileMe";
David@0
    42
}
David@0
    43
- (NSString *)longDescription{
David@0
    44
	return @"MobileMe";
David@0
    45
}
David@0
    46
- (NSCharacterSet *)ignoredCharacters{
David@0
    47
	return [NSCharacterSet characterSetWithCharactersInString:@" "];
David@0
    48
}
David@0
    49
- (BOOL)caseSensitive{
David@0
    50
	return NO;
David@0
    51
}
David@0
    52
- (AIServiceImportance)serviceImportance{
David@0
    53
	return AIServiceSecondary;
David@0
    54
}
David@0
    55
- (NSString *)userNameLabel{
David@0
    56
    return AILocalizedString(@"Member Name",nil); //.Mac Member Name
David@0
    57
}
David@0
    58
/*!
David@0
    59
 * @brief Default icon
David@0
    60
 *
David@0
    61
 * Service Icon packs should always include images for all the built-in Adium services.  This method allows external
David@0
    62
 * service plugins to specify an image which will be used when the service icon pack does not specify one.  It will
David@0
    63
 * also be useful if new services are added to Adium itself after a significant number of Service Icon packs exist
David@0
    64
 * which do not yet have an image for this service.  If the active Service Icon pack provides an image for this service,
David@0
    65
 * this method will not be called.
David@0
    66
 *
David@0
    67
 * The service should _not_ cache this icon internally; multiple calls should return unique NSImage objects.
David@0
    68
 *
David@0
    69
 * @param iconType The AIServiceIconType of the icon to return. This specifies the desired size of the icon.
David@0
    70
 * @return NSImage to use for this service by default
David@0
    71
 */
David@0
    72
- (NSImage *)defaultServiceIconOfType:(AIServiceIconType)iconType
David@0
    73
{
David@0
    74
	return [NSImage imageNamed:((iconType == AIServiceIconSmall || iconType == AIServiceIconList) ? @"MobileMe-small" : @"MobileMe-large")
David@0
    75
					  forClass:[self class] loadLazily:YES];
David@0
    76
}
David@0
    77
zacw@2632
    78
/*!
zacw@2632
    79
 * @brief Path for default icon
zacw@2632
    80
 *
zacw@2632
    81
 * For use in message views, this is the path to a default icon as described above.
zacw@2632
    82
 *
zacw@2632
    83
 * @param iconType The AIServiceIconType of the icon to return.
zacw@2632
    84
 * @return The path to the image, otherwise nil.
zacw@2632
    85
 */
zacw@2632
    86
- (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType
zacw@2632
    87
{
zacw@2632
    88
	if ((iconType == AIServiceIconSmall) || (iconType == AIServiceIconList)) {
zacw@2632
    89
		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"MobileMe-small"];
zacw@2632
    90
	} else {
zacw@2632
    91
		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"MobileMe-large"];		
zacw@2632
    92
	}
zacw@2632
    93
}
zacw@2632
    94
David@0
    95
@end