William Bowling is sharing code with you
Bitbucket is a code hosting site. Unlimited public and private repositories. Free for small teams.
Don't show this againadium / Plugins / Purple Service / PurpleMySpaceService.m
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | //
// PurpleMySpaceService.m
// Adium
//
// Created by Evan Schoenberg on 9/11/07.
//
#import "PurpleMySpaceService.h"
#import "PurpleMySpaceAccount.h"
#import "PurpleMySpaceAccountViewController.h"
#import <Adium/AIStatusControllerProtocol.h>
#import <AIUtilities/AIImageAdditions.h>
@implementation PurpleMySpaceService
//Account Creation
- (Class)accountClass{
return [PurpleMySpaceAccount class];
}
- (AIAccountViewController *)accountViewController{
return [PurpleMySpaceAccountViewController accountViewController];
}
- (DCJoinChatViewController *)joinChatView{
return nil;
}
//Service Description
- (NSString *)serviceCodeUniqueID{
return @"libpurple-MySpace";
}
- (NSString *)serviceID{
return @"MySpace";
}
- (NSString *)serviceClass{
return @"MySpace";
}
- (NSString *)shortDescription{
return @"MySpace";
}
- (NSString *)longDescription{
return @"MySpaceIM";
}
- (NSCharacterSet *)allowedCharacters{
return [NSCharacterSet characterSetWithCharactersInString:@"+abcdefghijklmnopqrstuvwxyz0123456789@._-"];
}
- (NSUInteger)allowedLength{
return 999;
}
- (BOOL)caseSensitive{
return NO;
}
- (AIServiceImportance)serviceImportance{
return AIServiceSecondary;
}
- (NSString *)userNameLabel{
return AILocalizedString(@"Email", "Used as a label for a username specified by email address");
}
- (NSString *)contactUserNameLabel{
return AILocalizedString(@"MySpace ID", "Label for the username for a MySpace contact");
}
- (void)registerStatuses{
[adium.statusController registerStatus:STATUS_NAME_AVAILABLE
withDescription:[adium.statusController localizedDescriptionForCoreStatusName:STATUS_NAME_AVAILABLE]
ofType:AIAvailableStatusType
forService:self];
[adium.statusController registerStatus:STATUS_NAME_AWAY
withDescription:[adium.statusController localizedDescriptionForCoreStatusName:STATUS_NAME_AWAY]
ofType:AIAwayStatusType
forService:self];
[adium.statusController registerStatus:STATUS_NAME_INVISIBLE
withDescription:[adium.statusController localizedDescriptionForCoreStatusName:STATUS_NAME_INVISIBLE]
ofType:AIInvisibleStatusType
forService:self];
}
/*!
* @brief Default icon
*
* Service Icon packs should always include images for all the built-in Adium services. This method allows external
* service plugins to specify an image which will be used when the service icon pack does not specify one. It will
* also be useful if new services are added to Adium itself after a significant number of Service Icon packs exist
* which do not yet have an image for this service. If the active Service Icon pack provides an image for this service,
* this method will not be called.
*
* The service should _not_ cache this icon internally; multiple calls should return unique NSImage objects.
*
* @param iconType The AIServiceIconType of the icon to return. This specifies the desired size of the icon.
* @return NSImage to use for this service by default
*/
- (NSImage *)defaultServiceIconOfType:(AIServiceIconType)iconType
{
//If we're going to do it this way, we've got to return the small icon for both AIServiceIconSmall and the AIServiceIconList icons.
return [NSImage imageNamed:((iconType == AIServiceIconSmall || iconType == AIServiceIconList) ? @"MySpace-small" : @"MySpace-large")
forClass:[self class] loadLazily:YES];
}
/*!
* @brief Path for default icon
*
* For use in message views, this is the path to a default icon as described above.
*
* @param iconType The AIServiceIconType of the icon to return.
* @return The path to the image, otherwise nil.
*/
- (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType
{
if ((iconType == AIServiceIconSmall) || (iconType == AIServiceIconList)) {
return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"MySpace-small"];
} else {
return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"MySpace-large"];
}
}
@end
|