adium 3631:1ef77b317fa1: Added LSApplicationCategoryType value (...
commits at adium.im
commits at adium.im
Thu Jan 27 03:03:05 UTC 2011
details: http://hg.adium.im/adium/rev/1ef77b317fa1
revision: 3631:1ef77b317fa1
author: Evan Schoenberg
date: Wed Jan 26 20:34:07 2011 -0600
Added LSApplicationCategoryType value (Social Networking)
Subject: adium 3632:c7323a40d94f: Added a MessageViewVersion_MinimumCompatible key to message style Info.plist keys. If set, Adium will refuse to load the style if it has a minimum version greater than its latest known version. This way, a message style which depends upon a hypothetical future version 5 message style can gracefully fail to load in Adium 1.4.2 which knows nothing of it; however, a message style using version 5 which is backwards compatible with version 4 can still be loaded. Fixes #7438 (for future iterations of the problem; nothing can be done for the described historical incompatibility).
details: http://hg.adium.im/adium/rev/c7323a40d94f
revision: 3632:c7323a40d94f
author: Evan Schoenberg
date: Wed Jan 26 21:02:18 2011 -0600
Added a MessageViewVersion_MinimumCompatible key to message style Info.plist keys. If set, Adium will refuse to load the style if it has a minimum version greater than its latest known version. This way, a message style which depends upon a hypothetical future version 5 message style can gracefully fail to load in Adium 1.4.2 which knows nothing of it; however, a message style using version 5 which is backwards compatible with version 4 can still be loaded. Fixes #7438 (for future iterations of the problem; nothing can be done for the described historical incompatibility).
diffs (144 lines):
diff -r e820c84b5b98 -r c7323a40d94f Plists/Info.plist
--- a/Plists/Info.plist Tue Jan 25 18:58:45 2011 -0600
+++ b/Plists/Info.plist Wed Jan 26 21:02:18 2011 -0600
@@ -470,8 +470,15 @@
</array>
<key>CFBundleVersion</key>
<string>1.5hg</string>
+ <key>LSApplicationCategoryType</key>
+ <string>public.app-category.social-networking</string>
<key>LSMinimumSystemVersion</key>
<string>10.5.8</string>
+ <key>LSMinimumSystemVersionByArchitecture</key>
+ <dict>
+ <key>x86_64</key>
+ <string>10.6.0</string>
+ </dict>
<key>LSRequiresNativeExecution</key>
<true/>
<key>NSAppleScriptEnabled</key>
@@ -845,10 +852,5 @@
</dict>
</dict>
</array>
- <key>LSMinimumSystemVersionByArchitecture</key>
- <dict>
- <key>x86_64</key>
- <string>10.6.0</string>
- </dict>
</dict>
</plist>
diff -r e820c84b5b98 -r c7323a40d94f Plugins/WebKit Message View/AIWebKitMessageViewPlugin.m
--- a/Plugins/WebKit Message View/AIWebKitMessageViewPlugin.m Tue Jan 25 18:58:45 2011 -0600
+++ b/Plugins/WebKit Message View/AIWebKitMessageViewPlugin.m Wed Jan 26 21:02:18 2011 -0600
@@ -197,11 +197,22 @@
group:loadFromGroup]];
if(!*thisStyle) {
/* If the path isn't cached yet, load the style and then store the path */
- *thisStyle = [AIWebkitMessageViewStyle messageViewStyleFromBundle:[self messageStyleBundleWithIdentifier:[prefs preferenceForKey:KEY_WEBKIT_STYLE
- group:loadFromGroup]]];
- [prefs setPreference:[[[*thisStyle bundle] bundlePath] stringByCollapsingBundlePath]
- forKey:KEY_CURRENT_WEBKIT_STYLE_PATH
- group:loadFromGroup];
+ *thisStyle = [AIWebkitMessageViewStyle messageViewStyleFromBundle:
+ [self messageStyleBundleWithIdentifier:[prefs preferenceForKey:KEY_WEBKIT_STYLE
+ group:loadFromGroup]]];
+ if (*thisStyle) {
+ [prefs setPreference:[[[*thisStyle bundle] bundlePath] stringByCollapsingBundlePath]
+ forKey:KEY_CURRENT_WEBKIT_STYLE_PATH
+ group:loadFromGroup];
+ } else {
+ /* If the style failed to load, clear our preference to fall back to the default */
+ /* XXX An error message could potentially be displayed here */
+ [prefs setPreference:nil forKey:KEY_WEBKIT_STYLE group:loadFromGroup];
+
+ *thisStyle = [AIWebkitMessageViewStyle messageViewStyleFromBundle:
+ [self messageStyleBundleWithIdentifier:[prefs preferenceForKey:KEY_WEBKIT_STYLE
+ group:loadFromGroup]]];
+ }
}
[*thisStyle retain];
}
diff -r e820c84b5b98 -r c7323a40d94f Plugins/WebKit Message View/AIWebkitMessageViewStyle.h
--- a/Plugins/WebKit Message View/AIWebkitMessageViewStyle.h Tue Jan 25 18:58:45 2011 -0600
+++ b/Plugins/WebKit Message View/AIWebkitMessageViewStyle.h Wed Jan 26 21:02:18 2011 -0600
@@ -147,8 +147,10 @@
/*!
* @brief Reloads the content of the style, useful for style authors and updates
+ *
+ * @result YES if the style loaded succesfully; NO if an error (such as an incompatible style version) occurred.
*/
-- (void) reloadStyle;
+- (BOOL) reloadStyle;
/*!
* @brief The name of the active variant.
diff -r e820c84b5b98 -r c7323a40d94f Plugins/WebKit Message View/AIWebkitMessageViewStyle.m
--- a/Plugins/WebKit Message View/AIWebkitMessageViewStyle.m Tue Jan 25 18:58:45 2011 -0600
+++ b/Plugins/WebKit Message View/AIWebkitMessageViewStyle.m Wed Jan 26 21:02:18 2011 -0600
@@ -39,9 +39,11 @@
//
#define LEGACY_VERSION_THRESHOLD 3 //Styles older than this version are considered legacy
+#define MAX_KNOWN_WEBKIT_VERSION 4 //Styles newer than this version are unknown entities
//
#define KEY_WEBKIT_VERSION @"MessageViewVersion"
+#define KEY_WEBKIT_VERSION_MIN @"MessageViewVersion_MinimumCompatible"
//BOM scripts for appending content.
#define APPEND_MESSAGE_WITH_SCROLL @"checkIfScrollToBottomIsNeeded(); appendMessage(\"%@\"); scrollToBottomIfNeeded();"
@@ -146,19 +148,20 @@
if ((self = [super init])) {
styleBundle = [inBundle retain];
stylePath = [[styleBundle resourcePath] retain];
- [self reloadStyle];
+
+ if ([self reloadStyle] == FALSE) {
+ [self release];
+ return nil;
+ }
}
return self;
}
-- (void) reloadStyle
+- (BOOL) reloadStyle
{
[self releaseResources];
- //Default behavior
- allowTextBackgrounds = YES;
-
/* Our styles are versioned so we can change how they work without breaking compatibility.
*
* Version 0: Initial Webkit Version
@@ -177,6 +180,17 @@
*/
styleVersion = [[styleBundle objectForInfoDictionaryKey:KEY_WEBKIT_VERSION] integerValue];
+ /* Refuse to load a version whose minimum compatible version is greater than the latest version we know about; that
+ * indicates this is a style FROM THE FUTURE, and we can't risk corrupting our own timeline.
+ */
+ NSInteger minimumCompatibleVersion = [[styleBundle objectForInfoDictionaryKey:KEY_WEBKIT_VERSION_MIN] integerValue];
+ if (minimumCompatibleVersion && (minimumCompatibleVersion > MAX_KNOWN_WEBKIT_VERSION)) {
+ return NO;
+ }
+
+ //Default behavior
+ allowTextBackgrounds = YES;
+
//Pre-fetch our templates
[self _loadTemplates];
@@ -195,6 +209,8 @@
NSNumber *allowsColorsNumber = [styleBundle objectForInfoDictionaryKey:@"AllowTextColors"];
allowsColors = (allowsColorsNumber ? [allowsColorsNumber boolValue] : YES);
+
+ return YES;
}
/*!
More information about the commits
mailing list