Add -[AIService pathForDefaultServiceIconOfType:], and use it for replacing %serviceIconImg% in headers. Fixes #12697.
authorZachary West <zacw@adium.im>
Sat Oct 17 17:35:57 2009 -0400 (2009-10-17)
changeset 26324e544bf1b994
parent 2631 b8941b8c037c
child 2633 3ae33caf4352
Add -[AIService pathForDefaultServiceIconOfType:], and use it for replacing %serviceIconImg% in headers. Fixes #12697.
Frameworks/Adium Framework/Source/AIService.h
Frameworks/Adium Framework/Source/AIService.m
Frameworks/Adium Framework/Source/AIServiceIcons.m
Plugins/Purple Service/AIMobileMeService.m
Plugins/Purple Service/ESIRCService.m
Plugins/Purple Service/ESSimpleService.m
Plugins/Purple Service/PurpleFacebookService.m
Plugins/Purple Service/PurpleMySpaceService.m
Plugins/Twitter Plugin/AILaconicaService.m
Plugins/Twitter Plugin/AITwitterService.m
     1.1 --- a/Frameworks/Adium Framework/Source/AIService.h	Sat Oct 17 17:22:17 2009 -0400
     1.2 +++ b/Frameworks/Adium Framework/Source/AIService.h	Sat Oct 17 17:35:57 2009 -0400
     1.3 @@ -53,6 +53,7 @@
     1.4  @property (readonly, nonatomic) NSString *UIDPlaceholder;
     1.5  @property (readonly, nonatomic) AIServiceImportance serviceImportance;
     1.6  - (NSImage *)defaultServiceIconOfType:(AIServiceIconType)iconType;
     1.7 +- (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType;
     1.8  
     1.9  //Service Properties
    1.10  @property (readonly, nonatomic) NSCharacterSet *allowedCharacters;
     2.1 --- a/Frameworks/Adium Framework/Source/AIService.m	Sat Oct 17 17:22:17 2009 -0400
     2.2 +++ b/Frameworks/Adium Framework/Source/AIService.m	Sat Oct 17 17:35:57 2009 -0400
     2.3 @@ -238,6 +238,19 @@
     2.4  	return nil;
     2.5  }
     2.6  
     2.7 +/*!
     2.8 + * @brief Path for default icon
     2.9 + *
    2.10 + * For use in message views, this is the path to a default icon as described above.
    2.11 + *
    2.12 + * @param iconType The AIServiceIconType of the icon to return.
    2.13 + * @return The path to the image, otherwise nil.
    2.14 + */
    2.15 +- (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType
    2.16 +{
    2.17 +	return nil;
    2.18 +}
    2.19 +
    2.20  //Service Properties ---------------------------------------------------------------------------------------------------
    2.21  #pragma mark Service Properties
    2.22  /*!
     3.1 --- a/Frameworks/Adium Framework/Source/AIServiceIcons.m	Sat Oct 17 17:22:17 2009 -0400
     3.2 +++ b/Frameworks/Adium Framework/Source/AIServiceIcons.m	Sat Oct 17 17:35:57 2009 -0400
     3.3 @@ -74,7 +74,12 @@
     3.4  	if (iconName) {
     3.5  		return [serviceIconBasePath stringByAppendingPathComponent:iconName];
     3.6  	} else {
     3.7 -		return nil;
     3.8 +		AIService *service = [adium.accountController firstServiceWithServiceID:serviceID];
     3.9 +		if (service) {
    3.10 +			return [service pathForDefaultServiceIconOfType:iconType];
    3.11 +		} else {
    3.12 +			return nil;
    3.13 +		}
    3.14  	}
    3.15  }
    3.16  
     4.1 --- a/Plugins/Purple Service/AIMobileMeService.m	Sat Oct 17 17:22:17 2009 -0400
     4.2 +++ b/Plugins/Purple Service/AIMobileMeService.m	Sat Oct 17 17:35:57 2009 -0400
     4.3 @@ -75,4 +75,21 @@
     4.4  					  forClass:[self class] loadLazily:YES];
     4.5  }
     4.6  
     4.7 +/*!
     4.8 + * @brief Path for default icon
     4.9 + *
    4.10 + * For use in message views, this is the path to a default icon as described above.
    4.11 + *
    4.12 + * @param iconType The AIServiceIconType of the icon to return.
    4.13 + * @return The path to the image, otherwise nil.
    4.14 + */
    4.15 +- (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType
    4.16 +{
    4.17 +	if ((iconType == AIServiceIconSmall) || (iconType == AIServiceIconList)) {
    4.18 +		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"MobileMe-small"];
    4.19 +	} else {
    4.20 +		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"MobileMe-large"];		
    4.21 +	}
    4.22 +}
    4.23 +
    4.24  @end
     5.1 --- a/Plugins/Purple Service/ESIRCService.m	Sat Oct 17 17:22:17 2009 -0400
     5.2 +++ b/Plugins/Purple Service/ESIRCService.m	Sat Oct 17 17:35:57 2009 -0400
     5.3 @@ -111,4 +111,21 @@
     5.4  	return baseImage;
     5.5  }
     5.6  
     5.7 +/*!
     5.8 + * @brief Path for default icon
     5.9 + *
    5.10 + * For use in message views, this is the path to a default icon as described above.
    5.11 + *
    5.12 + * @param iconType The AIServiceIconType of the icon to return.
    5.13 + * @return The path to the image, otherwise nil.
    5.14 + */
    5.15 +- (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType
    5.16 +{
    5.17 +	if ((iconType == AIServiceIconSmall) || (iconType == AIServiceIconList)) {
    5.18 +		return nil; //xxx add small IRC icon
    5.19 +	} else {
    5.20 +		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"irc"];		
    5.21 +	}
    5.22 +}
    5.23 +
    5.24  @end
     6.1 --- a/Plugins/Purple Service/ESSimpleService.m	Sat Oct 17 17:22:17 2009 -0400
     6.2 +++ b/Plugins/Purple Service/ESSimpleService.m	Sat Oct 17 17:35:57 2009 -0400
     6.3 @@ -83,4 +83,17 @@
     6.4  	return [NSImage imageNamed:@"simple" forClass:[self class] loadLazily:YES];
     6.5  }
     6.6  
     6.7 +/*!
     6.8 + * @brief Path for default icon
     6.9 + *
    6.10 + * For use in message views, this is the path to a default icon as described above.
    6.11 + *
    6.12 + * @param iconType The AIServiceIconType of the icon to return.
    6.13 + * @return The path to the image, otherwise nil.
    6.14 + */
    6.15 +- (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType
    6.16 +{
    6.17 +	return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"simple"];		
    6.18 +}
    6.19 +
    6.20  @end
     7.1 --- a/Plugins/Purple Service/PurpleFacebookService.m	Sat Oct 17 17:22:17 2009 -0400
     7.2 +++ b/Plugins/Purple Service/PurpleFacebookService.m	Sat Oct 17 17:35:57 2009 -0400
     7.3 @@ -93,4 +93,21 @@
     7.4  	}
     7.5  }
     7.6  
     7.7 +/*!
     7.8 + * @brief Path for default icon
     7.9 + *
    7.10 + * For use in message views, this is the path to a default icon as described above.
    7.11 + *
    7.12 + * @param iconType The AIServiceIconType of the icon to return.
    7.13 + * @return The path to the image, otherwise nil.
    7.14 + */
    7.15 +- (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType
    7.16 +{
    7.17 +	if ((iconType == AIServiceIconSmall) || (iconType == AIServiceIconList)) {
    7.18 +		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"facebook-small"];
    7.19 +	} else {
    7.20 +		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"facebook"];		
    7.21 +	}
    7.22 +}
    7.23 +
    7.24  @end
     8.1 --- a/Plugins/Purple Service/PurpleMySpaceService.m	Sat Oct 17 17:22:17 2009 -0400
     8.2 +++ b/Plugins/Purple Service/PurpleMySpaceService.m	Sat Oct 17 17:35:57 2009 -0400
     8.3 @@ -98,4 +98,21 @@
     8.4  					  forClass:[self class] loadLazily:YES];
     8.5  }
     8.6  
     8.7 +/*!
     8.8 + * @brief Path for default icon
     8.9 + *
    8.10 + * For use in message views, this is the path to a default icon as described above.
    8.11 + *
    8.12 + * @param iconType The AIServiceIconType of the icon to return.
    8.13 + * @return The path to the image, otherwise nil.
    8.14 + */
    8.15 +- (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType
    8.16 +{
    8.17 +	if ((iconType == AIServiceIconSmall) || (iconType == AIServiceIconList)) {
    8.18 +		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"MySpace-small"];
    8.19 +	} else {
    8.20 +		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"MySpace-large"];		
    8.21 +	}
    8.22 +}
    8.23 +
    8.24  @end
     9.1 --- a/Plugins/Twitter Plugin/AILaconicaService.m	Sat Oct 17 17:22:17 2009 -0400
     9.2 +++ b/Plugins/Twitter Plugin/AILaconicaService.m	Sat Oct 17 17:35:57 2009 -0400
     9.3 @@ -102,5 +102,21 @@
     9.4  	}
     9.5  }
     9.6  
     9.7 +/*!
     9.8 + * @brief Path for default icon
     9.9 + *
    9.10 + * For use in message views, this is the path to a default icon as described above.
    9.11 + *
    9.12 + * @param iconType The AIServiceIconType of the icon to return.
    9.13 + * @return The path to the image, otherwise nil.
    9.14 + */
    9.15 +- (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType
    9.16 +{
    9.17 +	if ((iconType == AIServiceIconSmall) || (iconType == AIServiceIconList)) {
    9.18 +		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"laconica-small"];
    9.19 +	} else {
    9.20 +		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"laconica"];		
    9.21 +	}
    9.22 +}
    9.23  
    9.24  @end
    10.1 --- a/Plugins/Twitter Plugin/AITwitterService.m	Sat Oct 17 17:22:17 2009 -0400
    10.2 +++ b/Plugins/Twitter Plugin/AITwitterService.m	Sat Oct 17 17:35:57 2009 -0400
    10.3 @@ -107,5 +107,21 @@
    10.4  	}
    10.5  }
    10.6  
    10.7 +/*!
    10.8 + * @brief Path for default icon
    10.9 + *
   10.10 + * For use in message views, this is the path to a default icon as described above.
   10.11 + *
   10.12 + * @param iconType The AIServiceIconType of the icon to return.
   10.13 + * @return The path to the image, otherwise nil.
   10.14 + */
   10.15 +- (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType
   10.16 +{
   10.17 +	if ((iconType == AIServiceIconSmall) || (iconType == AIServiceIconList)) {
   10.18 +		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"twitter-small"];
   10.19 +	} else {
   10.20 +		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"twitter"];		
   10.21 +	}
   10.22 +}
   10.23  
   10.24  @end