adium-1.4 2632:4e544bf1b994: Add -[AIService pathForDefaultServi...
commits at adium.im
commits at adium.im
Sat Oct 17 21:36:02 UTC 2009
details: http://hg.adium.im/adium-1.4/rev/4e544bf1b994
revision: 2632:4e544bf1b994
author: Zachary West <zacw at adium.im>
date: Sat Oct 17 17:35:57 2009 -0400
Add -[AIService pathForDefaultServiceIconOfType:], and use it for replacing %serviceIconImg% in headers. Fixes #12697.
diffs (222 lines):
diff -r b8941b8c037c -r 4e544bf1b994 Frameworks/Adium Framework/Source/AIService.h
--- a/Frameworks/Adium Framework/Source/AIService.h Sat Oct 17 17:22:17 2009 -0400
+++ b/Frameworks/Adium Framework/Source/AIService.h Sat Oct 17 17:35:57 2009 -0400
@@ -53,6 +53,7 @@
@property (readonly, nonatomic) NSString *UIDPlaceholder;
@property (readonly, nonatomic) AIServiceImportance serviceImportance;
- (NSImage *)defaultServiceIconOfType:(AIServiceIconType)iconType;
+- (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType;
//Service Properties
@property (readonly, nonatomic) NSCharacterSet *allowedCharacters;
diff -r b8941b8c037c -r 4e544bf1b994 Frameworks/Adium Framework/Source/AIService.m
--- a/Frameworks/Adium Framework/Source/AIService.m Sat Oct 17 17:22:17 2009 -0400
+++ b/Frameworks/Adium Framework/Source/AIService.m Sat Oct 17 17:35:57 2009 -0400
@@ -238,6 +238,19 @@
return nil;
}
+/*!
+ * @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
+{
+ return nil;
+}
+
//Service Properties ---------------------------------------------------------------------------------------------------
#pragma mark Service Properties
/*!
diff -r b8941b8c037c -r 4e544bf1b994 Frameworks/Adium Framework/Source/AIServiceIcons.m
--- a/Frameworks/Adium Framework/Source/AIServiceIcons.m Sat Oct 17 17:22:17 2009 -0400
+++ b/Frameworks/Adium Framework/Source/AIServiceIcons.m Sat Oct 17 17:35:57 2009 -0400
@@ -74,7 +74,12 @@
if (iconName) {
return [serviceIconBasePath stringByAppendingPathComponent:iconName];
} else {
- return nil;
+ AIService *service = [adium.accountController firstServiceWithServiceID:serviceID];
+ if (service) {
+ return [service pathForDefaultServiceIconOfType:iconType];
+ } else {
+ return nil;
+ }
}
}
diff -r b8941b8c037c -r 4e544bf1b994 Plugins/Purple Service/AIMobileMeService.m
--- a/Plugins/Purple Service/AIMobileMeService.m Sat Oct 17 17:22:17 2009 -0400
+++ b/Plugins/Purple Service/AIMobileMeService.m Sat Oct 17 17:35:57 2009 -0400
@@ -75,4 +75,21 @@
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:@"MobileMe-small"];
+ } else {
+ return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"MobileMe-large"];
+ }
+}
+
@end
diff -r b8941b8c037c -r 4e544bf1b994 Plugins/Purple Service/ESIRCService.m
--- a/Plugins/Purple Service/ESIRCService.m Sat Oct 17 17:22:17 2009 -0400
+++ b/Plugins/Purple Service/ESIRCService.m Sat Oct 17 17:35:57 2009 -0400
@@ -111,4 +111,21 @@
return baseImage;
}
+/*!
+ * @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 nil; //xxx add small IRC icon
+ } else {
+ return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"irc"];
+ }
+}
+
@end
diff -r b8941b8c037c -r 4e544bf1b994 Plugins/Purple Service/ESSimpleService.m
--- a/Plugins/Purple Service/ESSimpleService.m Sat Oct 17 17:22:17 2009 -0400
+++ b/Plugins/Purple Service/ESSimpleService.m Sat Oct 17 17:35:57 2009 -0400
@@ -83,4 +83,17 @@
return [NSImage imageNamed:@"simple" 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
+{
+ return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"simple"];
+}
+
@end
diff -r b8941b8c037c -r 4e544bf1b994 Plugins/Purple Service/PurpleFacebookService.m
--- a/Plugins/Purple Service/PurpleFacebookService.m Sat Oct 17 17:22:17 2009 -0400
+++ b/Plugins/Purple Service/PurpleFacebookService.m Sat Oct 17 17:35:57 2009 -0400
@@ -93,4 +93,21 @@
}
}
+/*!
+ * @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:@"facebook-small"];
+ } else {
+ return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"facebook"];
+ }
+}
+
@end
diff -r b8941b8c037c -r 4e544bf1b994 Plugins/Purple Service/PurpleMySpaceService.m
--- a/Plugins/Purple Service/PurpleMySpaceService.m Sat Oct 17 17:22:17 2009 -0400
+++ b/Plugins/Purple Service/PurpleMySpaceService.m Sat Oct 17 17:35:57 2009 -0400
@@ -98,4 +98,21 @@
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
diff -r b8941b8c037c -r 4e544bf1b994 Plugins/Twitter Plugin/AILaconicaService.m
--- a/Plugins/Twitter Plugin/AILaconicaService.m Sat Oct 17 17:22:17 2009 -0400
+++ b/Plugins/Twitter Plugin/AILaconicaService.m Sat Oct 17 17:35:57 2009 -0400
@@ -102,5 +102,21 @@
}
}
+/*!
+ * @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:@"laconica-small"];
+ } else {
+ return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"laconica"];
+ }
+}
@end
diff -r b8941b8c037c -r 4e544bf1b994 Plugins/Twitter Plugin/AITwitterService.m
--- a/Plugins/Twitter Plugin/AITwitterService.m Sat Oct 17 17:22:17 2009 -0400
+++ b/Plugins/Twitter Plugin/AITwitterService.m Sat Oct 17 17:35:57 2009 -0400
@@ -107,5 +107,21 @@
}
}
+/*!
+ * @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:@"twitter-small"];
+ } else {
+ return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"twitter"];
+ }
+}
@end
More information about the commits
mailing list