Plugins/Twitter Plugin/AILaconicaService.m
author Zachary West <zacw@adium.im>
Sat Oct 17 17:35:57 2009 -0400 (2009-10-17)
changeset 2743 df2c24e3844c
parent 2723 82dcdf0db1b0
permissions -rw-r--r--
Add -[AIService pathForDefaultServiceIconOfType:], and use it for replacing %serviceIconImg% in headers. Fixes #12697.
zacw@1033
     1
/* 
zacw@1033
     2
 * Adium is the legal property of its developers, whose names are listed in the copyright file included
zacw@1033
     3
 * with this source distribution.
zacw@1033
     4
 * 
zacw@1033
     5
 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
zacw@1033
     6
 * General Public License as published by the Free Software Foundation; either version 2 of the License,
zacw@1033
     7
 * or (at your option) any later version.
zacw@1033
     8
 * 
zacw@1033
     9
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
zacw@1033
    10
 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
zacw@1033
    11
 * Public License for more details.
zacw@1033
    12
 * 
zacw@1033
    13
 * You should have received a copy of the GNU General Public License along with this program; if not,
zacw@1033
    14
 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
zacw@1033
    15
 */
zacw@1033
    16
zacw@1033
    17
#import "AILaconicaService.h"
zacw@1033
    18
#import <Adium/AIStatusControllerProtocol.h>
zacw@1033
    19
#import <AIUtilities/AIImageAdditions.h>
zacw@1033
    20
#import "AILaconicaAccount.h"
zacw@1033
    21
#import "AILaconicaAccountViewController.h"
zacw@1033
    22
zacw@1033
    23
@implementation AILaconicaService
zacw@1033
    24
- (Class)accountClass
zacw@1033
    25
{
zacw@1033
    26
	return [AILaconicaAccount class];
zacw@1033
    27
}
zacw@1033
    28
zacw@1033
    29
- (AIAccountViewController *)accountViewController
zacw@1033
    30
{
zacw@1033
    31
	return [AILaconicaAccountViewController accountViewController];
zacw@1033
    32
}
zacw@1033
    33
zacw@1033
    34
- (DCJoinChatViewController *)joinChatView
zacw@1033
    35
{
zacw@1033
    36
	return nil;
zacw@1033
    37
}
zacw@1033
    38
zacw@1033
    39
// Service description
zacw@1033
    40
- (NSString *)serviceCodeUniqueID{
zacw@1033
    41
	return @"laconica";
zacw@1033
    42
}
zacw@1033
    43
- (NSString *)serviceID{
zacw@1033
    44
	return @"Laconica";
zacw@1033
    45
}
zacw@1033
    46
- (NSString *)serviceClass{
zacw@1235
    47
	return @"Laconica";
zacw@1033
    48
}
zacw@1033
    49
- (NSString *)shortDescription{
zacw@2723
    50
	return @"StatusNet";
zacw@1033
    51
}
zacw@1033
    52
- (NSString *)longDescription{
zacw@2723
    53
	return @"StatusNet";
zacw@1033
    54
}
zacw@1033
    55
- (NSCharacterSet *)allowedCharacters{
zacw@1033
    56
	return [NSCharacterSet characterSetWithCharactersInString:@"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_"];
zacw@1033
    57
}
zacw@1033
    58
- (NSUInteger)allowedLength{
zacw@1033
    59
	return 999;
zacw@1033
    60
}
zacw@1033
    61
- (BOOL)caseSensitive{
zacw@1033
    62
	return NO;
zacw@1033
    63
}
zacw@1033
    64
- (AIServiceImportance)serviceImportance{
zacw@1033
    65
	return AIServiceSecondary;
zacw@1033
    66
}
zacw@1033
    67
- (BOOL)supportsProxySettings{
zacw@1033
    68
	return NO;
zacw@1033
    69
}
zacw@1033
    70
- (void)registerStatuses{
zacw@1033
    71
	[adium.statusController registerStatus:STATUS_NAME_AVAILABLE
zacw@1033
    72
	 withDescription:[adium.statusController localizedDescriptionForCoreStatusName:STATUS_NAME_AVAILABLE]
zacw@1033
    73
	 ofType:AIAvailableStatusType
zacw@1033
    74
	 forService:self];
zacw@1033
    75
}
zacw@1033
    76
zacw@1033
    77
- (BOOL)isSocialNetworkingService
zacw@1033
    78
{
zacw@1033
    79
	return YES;
zacw@1033
    80
}
zacw@1033
    81
zacw@1033
    82
/*!
zacw@1033
    83
 * @brief Default icon
zacw@1033
    84
 *
zacw@1033
    85
 * Service Icon packs should always include images for all the built-in Adium services.  This method allows external
zacw@1033
    86
 * service plugins to specify an image which will be used when the service icon pack does not specify one.  It will
zacw@1033
    87
 * also be useful if new services are added to Adium itself after a significant number of Service Icon packs exist
zacw@1033
    88
 * which do not yet have an image for this service.  If the active Service Icon pack provides an image for this service,
zacw@1033
    89
 * this method will not be called.
zacw@1033
    90
 *
zacw@1033
    91
 * The service should _not_ cache this icon internally; multiple calls should return unique NSImage objects.
zacw@1033
    92
 *
zacw@1033
    93
 * @param iconType The AIServiceIconType of the icon to return. This specifies the desired size of the icon.
zacw@1033
    94
 * @return NSImage to use for this service by default
zacw@1033
    95
 */
zacw@1033
    96
- (NSImage *)defaultServiceIconOfType:(AIServiceIconType)iconType
zacw@1033
    97
{
zacw@1033
    98
	if ((iconType == AIServiceIconSmall) || (iconType == AIServiceIconList)) {
zacw@1033
    99
		return [NSImage imageNamed:@"laconica-small" forClass:[self class] loadLazily:YES];
zacw@1033
   100
	} else {
zacw@1033
   101
		return [NSImage imageNamed:@"laconica" forClass:[self class] loadLazily:YES];
zacw@1033
   102
	}
zacw@1033
   103
}
zacw@1033
   104
zacw@2743
   105
/*!
zacw@2743
   106
 * @brief Path for default icon
zacw@2743
   107
 *
zacw@2743
   108
 * For use in message views, this is the path to a default icon as described above.
zacw@2743
   109
 *
zacw@2743
   110
 * @param iconType The AIServiceIconType of the icon to return.
zacw@2743
   111
 * @return The path to the image, otherwise nil.
zacw@2743
   112
 */
zacw@2743
   113
- (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType
zacw@2743
   114
{
zacw@2743
   115
	if ((iconType == AIServiceIconSmall) || (iconType == AIServiceIconList)) {
zacw@2743
   116
		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"laconica-small"];
zacw@2743
   117
	} else {
zacw@2743
   118
		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"laconica"];		
zacw@2743
   119
	}
zacw@2743
   120
}
zacw@1033
   121
zacw@1033
   122
@end