The TruePreviewPreferenceValueTransformerDelay class is the
+subclass of NSValueTransformer that provides a value appropriate
+to display in controls in the TruePreview preferences panel.
+
+
The TruePreviewPreferenceValueTransformer class is the subclass
+of NSValueTransformer that selects the correct radio button in
+the TruePreview preferences panel.
+
+
Returns an NSNumber equivalent to the provided value if the
+value is TRUEPREVIEW_DELAY_IMMEDIATE,
+TRUEPREVIEW_DELAY_DEFAULT,
+TRUEPREVIEW_DELAY_NEVER, or > 0 to
+TRUEPREVIEW_DELAY_MAX; otherwise,
+TRUEPREVIEW_DELAY_DEFAULT is returned.
+
+
The TruePreviewPreferenceValueTransformerDelayEditIndicator
+class is the subclass of NSValueTransformer that indicates
+whether or not delay controls should be enabled in the TruePreview
+preferences panel.
+
+
The Class to which this class's methods should be added.
+
+
+
+Discussion
+
+
Adds the methods from this class to the specified class. This is in essence
+adding a category, but we do it through the objective-c runtime, because of
+the "hiding" of classes in >= 10.6.
+
+
The NSMutableDictionary containing the NSTimer
+for each instance of this class. The key is an NSNumber
+(unsigned long) of the address of each instance.
+
+
+
+Discussion
+
+
Returns the timers for instances of this class.
+
+
Marks the displayed message as viewed, sets a timer to mark the displayed
+message as viewed, and/or adds a notification observer to mark the message as
+viewed when it is scrolled as appropriate.
+
+
The TruePreviewPreferencesModule class is the subclass of
+NSPreferencesModule that displays and manages preferences
+specific to the TruePreview plugin.
+
+
An NSMutableDictionary containing the keys delay,
+window, and scroll and their respective values
+based on the default settings and/or the settings for this message's
+account.
+
+
+
+Discussion
+
+
Returns the TruePreview settings appropriate for this message.
+
+
+
+
Last Updated: Friday, October 09, 2009
+
+
+
+
TruePreview-1.4/headerdoc/TruePreviewLibraryMessage_h/Classes/TruePreviewLibraryMessage/index.html
Property changes :
Added: svn:mime-type
## -0,0 +1 ##
+text/html
\ No newline at end of property
Index: TruePreview-1.4/Source/TruePreviewMessageViewer.m
===================================================================
--- TruePreview-1.4/Source/TruePreviewMessageViewer.m (revision 0)
+++ TruePreview-1.4/Source/TruePreviewMessageViewer.m (revision 35)
@@ -0,0 +1,268 @@
+/*
+ * Copyright (c) 2009, Jim Riggs, Christian Serving, L.L.C.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Christian Serving, L.L.C. nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "TruePreviewMessageViewer.h"
+
+@implementation TruePreviewMessageViewer
+
+#pragma mark Class methods
+
++ (NSMutableDictionary*)truePreviewTimers {
+ static NSMutableDictionary* sTimers = nil;
+
+ if (sTimers == nil) {
+ sTimers = [[NSMutableDictionary alloc] initWithCapacity:1];
+ }
+
+ return sTimers;
+}
+
+#pragma mark Swizzled instance methods
+
+- (void)truePreviewDealloc {
+ [self truePreviewReset];
+ [[[self class] truePreviewTimers]
+ removeObjectForKey:[NSNumber numberWithUnsignedLong:(unsigned long)self]
+ ];
+ [self truePreviewDealloc];
+}
+
+- (void)truePreviewForwardAsAttachment:(id)inSender {
+ id theMessage = [self currentDisplayedMessage];
+
+ if ([theMessage isKindOfClass:NSClassFromString(@"LibraryMessage")]) {
+ NSDictionary* theSettings = [theMessage truePreviewSettings];
+
+ if ([[theSettings objectForKey:@"forward"] boolValue]) {
+ [self truePreviewReset];
+ [theMessage truePreviewMarkAsViewed];
+ }
+ }
+
+ [self truePreviewForwardAsAttachment:inSender];
+}
+
+- (void)truePreviewForwardMessage:(id)inSender {
+ id theMessage = [self currentDisplayedMessage];
+
+ if ([theMessage isKindOfClass:NSClassFromString(@"LibraryMessage")]) {
+ NSDictionary* theSettings = [theMessage truePreviewSettings];
+
+ if ([[theSettings objectForKey:@"forward"] boolValue]) {
+ [self truePreviewReset];
+ [theMessage truePreviewMarkAsViewed];
+ }
+ }
+
+ [self truePreviewForwardMessage:inSender];
+}
+
+- (void)truePreviewMarkAsRead:(id)inSender {
+ [self truePreviewReset];
+ [self truePreviewMarkAsRead:inSender];
+}
+
+- (void)truePreviewMarkAsUnread:(id)inSender {
+ [self truePreviewReset];
+ [self truePreviewMarkAsUnread:inSender];
+}
+
+- (void)truePreviewMessageNoLongerDisplayedInTextView:(NSNotification*)inNotification {
+ [self truePreviewMessageNoLongerDisplayedInTextView:inNotification];
+
+ // we receive notifications from all MessageContentControllers
+ if ([inNotification object] != object_getIvar(self, class_getInstanceVariable([self class], "_contentController"))) {
+ return;
+ }
+
+ [self truePreviewReset];
+}
+
+- (void)truePreviewMessageWasDisplayedInTextView:(NSNotification*)inNotification {
+ [self truePreviewMessageWasDisplayedInTextView:inNotification];
+
+ // we receive notifications from all MessageContentControllers
+ if ([inNotification object] != object_getIvar(self, class_getInstanceVariable([self class], "_contentController"))) {
+ return;
+ }
+
+ id theMessage = [[inNotification userInfo] objectForKey:@"MessageKey"];
+
+ if ([theMessage isKindOfClass:NSClassFromString(@"LibraryMessage")]) {
+ NSDictionary* theSettings = [theMessage truePreviewSettings];
+
+ if (
+ ([[theSettings objectForKey:@"delay"] floatValue] == TRUEPREVIEW_DELAY_IMMEDIATE)
+ || (
+ [[theSettings objectForKey:@"window"] boolValue]
+ && [self isKindOfClass:NSClassFromString(@"SingleMessageViewer")]
+ )
+ ) {
+ [self truePreviewReset];
+ [theMessage truePreviewMarkAsViewed];
+
+ return;
+ }
+
+ float theDelay = [[theSettings objectForKey:@"delay"] floatValue];
+
+ if (theDelay > TRUEPREVIEW_DELAY_IMMEDIATE) {
+ [self truePreviewReset];
+ [self
+ truePreviewSetTimer:[NSTimer
+ scheduledTimerWithTimeInterval:theDelay
+ target:self
+ selector:@selector(truePreviewTimerFired:)
+ userInfo:nil
+ repeats:NO
+ ]
+ ];
+ }
+
+ if (
+ ![self isKindOfClass:NSClassFromString(@"SingleMessageViewer")]
+ && [[theSettings objectForKey:@"scroll"] boolValue]
+ ) {
+ // listen for selection change (mouse down) on message content view
+ [[NSNotificationCenter defaultCenter]
+ addObserver:self
+ selector:@selector(truePreviewMessageClickedOrScrolled:)
+ name:@"WebViewDidChangeSelectionNotification"
+ object:[[object_getIvar(self, class_getInstanceVariable([self class], "_contentController")) currentDisplay] contentView]
+ ];
+
+ // listen for bounds change notification on the message's clip view
+ [[NSNotificationCenter defaultCenter]
+ addObserver:self
+ selector:@selector(truePreviewMessageClickedOrScrolled:)
+ name:NSViewBoundsDidChangeNotification
+ object:[[[[object_getIvar(self, class_getInstanceVariable([self class], "_contentController")) currentDisplay] contentView] enclosingScrollView] contentView]
+ ];
+ }
+ }
+}
+
+- (void)truePreviewReplyAllMessage:(id)inSender {
+ id theMessage = [self currentDisplayedMessage];
+
+ if ([theMessage isKindOfClass:NSClassFromString(@"LibraryMessage")]) {
+ NSDictionary* theSettings = [theMessage truePreviewSettings];
+
+ if ([[theSettings objectForKey:@"reply"] boolValue]) {
+ [self truePreviewReset];
+ [theMessage truePreviewMarkAsViewed];
+ }
+ }
+
+ [self truePreviewReplyAllMessage:inSender];
+}
+
+- (void)truePreviewReplyMessage:(id)inSender {
+ id theMessage = [self currentDisplayedMessage];
+
+ if ([theMessage isKindOfClass:NSClassFromString(@"LibraryMessage")]) {
+ NSDictionary* theSettings = [theMessage truePreviewSettings];
+
+ if ([[theSettings objectForKey:@"reply"] boolValue]) {
+ [self truePreviewReset];
+ [theMessage truePreviewMarkAsViewed];
+ }
+ }
+
+ [self truePreviewReplyMessage:inSender];
+}
+
+#pragma mark Accessors
+
+- (NSTimer*)truePreviewTimer {
+ return [[[self class] truePreviewTimers]
+ objectForKey:[NSNumber numberWithUnsignedLong:(unsigned long)self]
+ ];
+}
+
+- (void)truePreviewSetTimer:(NSTimer*)inTimer {
+ [[[self class] truePreviewTimers]
+ setObject:inTimer
+ forKey:[NSNumber numberWithUnsignedLong:(unsigned long)self]
+ ];
+}
+
+#pragma mark Instance methods
+
+- (void)truePreviewReset {
+ NSTimer* theTimer = [self truePreviewTimer];
+
+ if ((theTimer != nil) && [theTimer isValid]) {
+ [theTimer invalidate];
+ }
+
+ // stop observing when changed
+ [[NSNotificationCenter defaultCenter]
+ removeObserver:self
+ name:@"WebViewDidChangeSelectionNotification"
+ object:[[object_getIvar(self, class_getInstanceVariable([self class], "_contentController")) currentDisplay] contentView]
+ ];
+ [[NSNotificationCenter defaultCenter]
+ removeObserver:self
+ name:NSViewBoundsDidChangeNotification
+ object:[[[[object_getIvar(self, class_getInstanceVariable([self class], "_contentController")) currentDisplay] contentView] enclosingScrollView] contentView]
+ ];
+}
+
+- (void)truePreviewTimerFired:(NSTimer*)inTimer {
+ [self truePreviewReset];
+
+ if ([[self currentDisplayedMessage] isKindOfClass:NSClassFromString(@"LibraryMessage")]) {
+ [[self currentDisplayedMessage] truePreviewMarkAsViewed];
+ }
+}
+
+- (void)truePreviewMessageClickedOrScrolled:(NSNotification*)inNotification {
+ // ignore the first time we get the notification; it may be an initial scroll
+ // to the origin after changing messages
+ static BOOL sIsFirstTime = YES;
+
+ if ([NSViewBoundsDidChangeNotification isEqualToString:[inNotification name]] && sIsFirstTime) {
+ sIsFirstTime = NO;
+
+ return;
+ }
+
+ sIsFirstTime = YES;
+
+ [self truePreviewReset];
+
+ if ([[self currentDisplayedMessage] isKindOfClass:NSClassFromString(@"LibraryMessage")]) {
+ [[self currentDisplayedMessage] truePreviewMarkAsViewed];
+ }
+}
+
+@end
Index: TruePreview-1.4/Source/TruePreviewPreferencesModule.m
===================================================================
--- TruePreview-1.4/Source/TruePreviewPreferencesModule.m (revision 0)
+++ TruePreview-1.4/Source/TruePreviewPreferencesModule.m (revision 35)
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2009, Jim Riggs, Christian Serving, L.L.C.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Christian Serving, L.L.C. nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "TruePreviewPreferencesModule.h"
+
+@implementation TruePreviewPreferencesModule
+
+#pragma mark NSPreferencesModule instance methods
+
+- (NSString*)preferencesNibName {
+ return @"TruePreviewPreferencesPanel";
+}
+
+- (void)willBeDisplayed {
+ [super willBeDisplayed];
+
+ // build the list of accounts
+ NSDictionary* theAccountDict = [[NSUserDefaults standardUserDefaults] objectForKey:@"TruePreviewAccountSettings"];
+ NSMutableArray* theAccounts = [NSMutableArray array];
+ NSEnumerator* theEnum = [[[NSClassFromString(@"MailAccount") remoteAccounts] valueForKey:@"displayName"] objectEnumerator];
+ NSString* theDisplayName = nil;
+
+ while (theDisplayName = [theEnum nextObject]) {
+ NSMutableDictionary* theAccount = [NSMutableDictionary dictionaryWithObjectsAndKeys:
+ theDisplayName, @"displayName",
+ [NSNumber numberWithInt:TRUEPREVIEW_DELAY_DEFAULT], @"delay",
+ [NSNumber numberWithInt:TRUEPREVIEW_DELAY_DEFAULT], @"reply",
+ [NSNumber numberWithInt:TRUEPREVIEW_DELAY_DEFAULT], @"forward",
+ [NSNumber numberWithInt:TRUEPREVIEW_DELAY_DEFAULT], @"window",
+ [NSNumber numberWithInt:TRUEPREVIEW_DELAY_DEFAULT], @"scroll",
+ nil
+ ];
+
+ [theAccount addEntriesFromDictionary:[theAccountDict objectForKey:theDisplayName]];
+ [theAccounts addObject:theAccount];
+ }
+
+ // watch the array for changes to save the user defaults
+ [theAccounts
+ addObserver:self
+ toObjectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [theAccounts count])]
+ forKeyPath:@"delay"
+ options:0
+ context:theAccounts
+ ];
+ [theAccounts
+ addObserver:self
+ toObjectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [theAccounts count])]
+ forKeyPath:@"reply"
+ options:0
+ context:theAccounts
+ ];
+ [theAccounts
+ addObserver:self
+ toObjectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [theAccounts count])]
+ forKeyPath:@"forward"
+ options:0
+ context:theAccounts
+ ];
+ [theAccounts
+ addObserver:self
+ toObjectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [theAccounts count])]
+ forKeyPath:@"window"
+ options:0
+ context:theAccounts
+ ];
+ [theAccounts
+ addObserver:self
+ toObjectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [theAccounts count])]
+ forKeyPath:@"scroll"
+ options:0
+ context:theAccounts
+ ];
+
+ [fldAccountArrayController setContent:theAccounts];
+}
+
+#pragma mark NSKeyValueObserving instance methods
+
+- (void)observeValueForKeyPath:(NSString*)inPath
+ ofObject:(id)inObject
+ change:(NSDictionary*)inChange
+ context:(void*)inContext {
+ NSMutableDictionary* theAccountDict = [NSMutableDictionary dictionary];
+
+ // build the account settings dictionary to save in the user defaults
+ for (NSDictionary* theAccount in (NSArray*)inContext) {
+ [theAccountDict setObject:theAccount forKey:[theAccount objectForKey:@"displayName"]];
+ }
+
+ [[NSUserDefaults standardUserDefaults] setObject:theAccountDict forKey:@"TruePreviewAccountSettings"];
+ [[NSUserDefaults standardUserDefaults] synchronize];
+}
+
+@end
TruePreview-1.4/Source/TruePreviewPreferencesModule.m
Property changes :
Added: svn:keywords
## -0,0 +1 ##
+Author Date Revision Id
\ No newline at end of property
Index: TruePreview-1.4/Source/TruePreviewLibraryMessage.m
===================================================================
--- TruePreview-1.4/Source/TruePreviewLibraryMessage.m (revision 0)
+++ TruePreview-1.4/Source/TruePreviewLibraryMessage.m (revision 35)
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2009, Jim Riggs, Christian Serving, L.L.C.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Christian Serving, L.L.C. nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "TruePreviewLibraryMessage.h"
+
+@implementation TruePreviewLibraryMessage
+
+#pragma mark Swizzled instance methods
+
+- (void)truePreviewMarkAsViewed {
+ /* nothing */
+}
+
+#pragma mark Instance methods
+
+- (NSMutableDictionary*)truePreviewSettings {
+ NSMutableDictionary* theSettings = [NSMutableDictionary dictionaryWithObjectsAndKeys:
+ [[NSUserDefaults standardUserDefaults] objectForKey:@"TruePreviewDelay"], @"delay",
+ [[NSUserDefaults standardUserDefaults] objectForKey:@"TruePreviewReply"], @"reply",
+ [[NSUserDefaults standardUserDefaults] objectForKey:@"TruePreviewForward"], @"forward",
+ [[NSUserDefaults standardUserDefaults] objectForKey:@"TruePreviewWindow"], @"window",
+ [[NSUserDefaults standardUserDefaults] objectForKey:@"TruePreviewScroll"], @"scroll",
+ nil
+ ];
+ NSMutableDictionary* theAccountSettings = [
+ [[NSUserDefaults standardUserDefaults] objectForKey:@"TruePreviewAccountSettings"]
+ objectForKey:[[self account] displayName]
+ ];
+
+ if (theAccountSettings != nil) {
+ for (id theKey in [NSArray arrayWithObjects:@"delay", @"reply", @"forward", @"window", @"scroll", nil]) {
+ id theValue = [theAccountSettings objectForKey:theKey];
+
+ if ((theValue != nil) && ([theValue intValue] != TRUEPREVIEW_DELAY_DEFAULT)) {
+ [theSettings setObject:theValue forKey:theKey];
+ }
+ }
+ }
+
+ return theSettings;
+}
+
+@end
TruePreview-1.4/Source/TruePreviewLibraryMessage.m
Property changes :
Added: svn:keywords
## -0,0 +1 ##
+Author Date Revision Id
\ No newline at end of property
Index: TruePreview-1.4/Source/TruePreviewPreferenceValueTransformer.h
===================================================================
--- TruePreview-1.4/Source/TruePreviewPreferenceValueTransformer.h (revision 0)
+++ TruePreview-1.4/Source/TruePreviewPreferenceValueTransformer.h (revision 35)
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2009, Jim Riggs, Christian Serving, L.L.C.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Christian Serving, L.L.C. nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*!
+ * @header
+ * Defines the TruePreviewPreferenceValueTransformer
+ * NSValueTransformer subclasses.
+ * @copyright Copyright (c) 2009 Jim Riggs, Christian Serving, L.L.C. All rights reserved.
+ * @version \@(#) $Id: TruePreviewPreferencesModule.h 2 2009-06-27 07:02:45Z jhriggs $
+ * @updated $Date: 2009-06-27 02:02:45 -0500 (Sat, 27 Jun 2009) $
+ */
+
+/*!
+ * @class
+ * The TruePreviewPreferenceValueTransformer class is the subclass
+ * of NSValueTransformer that selects the correct radio button in
+ * the TruePreview preferences panel.
+ * @version \@(#) $Id: TruePreviewPreferencesModule.h 2 2009-06-27 07:02:45Z jhriggs $
+ * @updated $Date: 2009-06-27 02:02:45 -0500 (Sat, 27 Jun 2009) $
+ */
+@interface TruePreviewPreferenceValueTransformer : NSValueTransformer {
+}
+
+#pragma mark NSValueTransformer class methods
+/*! @group NSValueTransformer class methods */
+
+/*!
+ * Returns the class of transformed values for this value transformer
+ * (NSNumber).
+ * @result
+ * [NSNumber class].
+ */
++ (Class)transformedValueClass;
+
+#pragma mark NSValueTransformer instance methods
+/*! @group NSValueTransformer instance methods */
+
+/*!
+ * Returns an NSNumber equivalent to the provided value if the
+ * value is TRUEPREVIEW_DELAY_IMMEDIATE,
+ * TRUEPREVIEW_DELAY_DEFAULT,
+ * TRUEPREVIEW_DELAY_NEVER, or > 0 to
+ * TRUEPREVIEW_DELAY_MAX; otherwise,
+ * TRUEPREVIEW_DELAY_DEFAULT is returned.
+ * @param inValue
+ * The value being transformed.
+ * @result
+ * An NSNumber containing the transformed value.
+ */
+- (id)transformedValue:(id)inValue;
+
+@end
+
+/*!
+ * @class
+ * The TruePreviewPreferenceValueTransformerDelay class is the
+ * subclass of NSValueTransformer that provides a value appropriate
+ * to display in controls in the TruePreview preferences panel.
+ * @version \@(#) $Id: TruePreviewPreferencesModule.h 2 2009-06-27 07:02:45Z jhriggs $
+ * @updated $Date: 2009-06-27 02:02:45 -0500 (Sat, 27 Jun 2009) $
+ */
+@interface TruePreviewPreferenceValueTransformerDelay : NSValueTransformer {
+}
+
+#pragma mark NSValueTransformer class methods
+/*! @group NSValueTransformer class methods */
+
+/*!
+ * Returns the class of transformed values for this value transformer
+ * (NSNumber).
+ * @result
+ * [NSNumber class].
+ */
++ (Class)transformedValueClass;
+
+#pragma mark NSValueTransformer instance methods
+/*! @group NSValueTransformer instance methods */
+
+/*!
+ * Returns an NSNumber for displaying the delay in controls (i.e.
+ * > 0 to TRUEPREVIEW_DELAY_MAX or nil).
+ * @param inValue
+ * The value being transformed.
+ * @result
+ * An NSNumber containing the transformed value.
+ */
+- (id)transformedValue:(id)inValue;
+
+@end
+
+/*!
+ * @class
+ * The TruePreviewPreferenceValueTransformerDelayEditIndicator
+ * class is the subclass of NSValueTransformer that indicates
+ * whether or not delay controls should be enabled in the TruePreview
+ * preferences panel.
+ * @version \@(#) $Id: TruePreviewPreferencesModule.h 2 2009-06-27 07:02:45Z jhriggs $
+ * @updated $Date: 2009-06-27 02:02:45 -0500 (Sat, 27 Jun 2009) $
+ */
+@interface TruePreviewPreferenceValueTransformerDelayEditIndicator : NSValueTransformer {
+}
+
+#pragma mark NSValueTransformer class methods
+/*! @group NSValueTransformer class methods */
+
+/*!
+ * Returns the class of transformed values for this value transformer
+ * (NSNumber).
+ * @result
+ * [NSNumber class].
+ */
++ (Class)transformedValueClass;
+
+#pragma mark NSValueTransformer instance methods
+/*! @group NSValueTransformer instance methods */
+
+/*!
+ * Returns an NSNumber indicating whether or not delay controls
+ * should be enabled (i.e. delay is > 0 to
+ * TRUEPREVIEW_DELAY_MAX).
+ * @param inValue
+ * The value being transformed.
+ * @result
+ * An NSNumber containing the transformed value.
+ */
+- (id)transformedValue:(id)inValue;
+
+@end
TruePreview-1.4/Source/TruePreviewPreferenceValueTransformer.h
Property changes :
Added: svn:mime-type
## -0,0 +1 ##
+text/x-c
\ No newline at end of property
Index: TruePreview-1.4/Source/TruePreview.h
===================================================================
--- TruePreview-1.4/Source/TruePreview.h (revision 0)
+++ TruePreview-1.4/Source/TruePreview.h (revision 35)
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2009, Jim Riggs, Christian Serving, L.L.C.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Christian Serving, L.L.C. nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*!
+ * @header
+ * Defines the TruePreview Mail bundler (the entrypoint for the
+ * plugin) and the TruePreviewObject category for
+ * NSObject.
+ * @copyright Copyright (c) 2009 Jim Riggs, Christian Serving, L.L.C. All rights reserved.
+ * @version \@(#) $Id$
+ * @updated $Date$
+ */
+
+#import
+
+#import "TruePreviewLibraryMessage.h"
+#import "TruePreviewMessageViewer.h"
+#import "TruePreviewPreferences.h"
+#import "TruePreviewPreferencesModule.h"
+#import "TruePreviewPreferenceValueTransformer.h"
+
+/*!
+ * @class
+ * The TruePreview class is the subclass of
+ * MVMailBundle that provides the plugin entrypoint for the
+ * TruePreview plugin.
+ * @version \@(#) $Id$
+ * @updated $Date$
+ */
+@interface TruePreview : NSObject {
+}
+
+#pragma mark Class initialization
+/*! @group Class initialization */
+
+/*!
+ * Registers this plugin and swizzles the methods necessary for TruePreview's
+ * functionality.
+ */
++ (void)initialize;
+
+#pragma mark MVMailBundle class methods
+/*! @group MVMailBundle class methods */
+
+/*!
+ * Indicates that this plugin has a preference panel.
+ * @result
+ * YES.
+ */
++ (BOOL)hasPreferencesPanel;
+
+/*!
+ * Returns the class name for this plugin's preference panel owner.
+ * @result
+ * TruePreviewPreferencesModule.
+ */
++ (NSString*)preferencesOwnerClassName;
+
+/*!
+ * Returns the name for this plugin's preferences panel.
+ * @result
+ * TruePreview.
+ */
++ (NSString*)preferencesPanelName;
+
+@end
+
+/*!
+ * @category
+ * Adds a method for method swizzling to NSObject instances.
+ * @version \@(#) $Id$
+ * @updated $Date$
+ */
+@interface NSObject (TruePreviewObject)
+
+#pragma mark Class methods
+/*! @group Class methods */
+
+/*!
+ * Adds the methods from this class to the specified class. This is in essence
+ * adding a category, but we do it through the objective-c runtime, because of
+ * the "hiding" of classes in >= 10.6.
+ * @param inClass
+ * The Class to which this class's methods should be added.
+ */
++ (void)truePreviewAddAsCategoryToClass:(Class)inClass;
+
+/*!
+ * Swaps ("swizzles") two methods. Based on
+ * http://www.cocoadev.com/index.pl?MethodSwizzling.
+ * @param inOriginalSelector
+ * The selector specifying the method being replaced.
+ * @param inReplacementSelector
+ * The selector specifying the replacement method.
+ * @param inIsClassMethod
+ * The BOOL indicating whether or not the methods being swizzled
+ * are class methods.
+ */
++ (void)truePreviewSwizzleMethod:(SEL)inOriginalSelector withMethod:(SEL)inReplacementSelector isClassMethod:(BOOL)inIsClassMethod;
+
+@end
\ No newline at end of file
TruePreview-1.4/Source/TruePreview.h
Property changes :
Added: svn:keywords
## -0,0 +1 ##
+Author Date Revision Id
\ No newline at end of property
Index: TruePreview-1.4/Source/TruePreview_Prefix.pch
===================================================================
--- TruePreview-1.4/Source/TruePreview_Prefix.pch (revision 0)
+++ TruePreview-1.4/Source/TruePreview_Prefix.pch (revision 35)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2009, Jim Riggs, Christian Serving, L.L.C.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Christian Serving, L.L.C. nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef __OBJC__
+#import
+
+#define TRUEPREVIEW_DELAY_MAX 30
+#define TRUEPREVIEW_DELAY_IMMEDIATE 0
+#define TRUEPREVIEW_DELAY_DEFAULT -1
+#define TRUEPREVIEW_DELAY_NEVER -2
+
+#endif
TruePreview-1.4/Source/TruePreview_Prefix.pch
Property changes :
Added: svn:keywords
## -0,0 +1 ##
+Author Date Revision Id
\ No newline at end of property
Index: TruePreview-1.4/Source/AppKit/NSPreferencesModule.h
===================================================================
--- TruePreview-1.4/Source/AppKit/NSPreferencesModule.h (revision 0)
+++ TruePreview-1.4/Source/AppKit/NSPreferencesModule.h (revision 35)
@@ -0,0 +1,45 @@
+/*
+ * Generated by class-dump 3.3.1 (64 bit).
+ *
+ * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2009 by Steve Nygard.
+ */
+
+/*#import "NSObject.h"*/
+
+/*#import */
+
+@protocol NSPreferencesModule;
+@class NSBox;
+
+@interface NSPreferencesModule : NSObject
+{
+ NSBox *_preferencesView;
+ struct CGSize _minSize;
+ BOOL _hasChanges;
+ void *_reserved;
+}
+
++ (id)sharedInstance;
+- (void)dealloc;
+- (void)finalize;
+- (id)init;
+- (id)preferencesNibName;
+- (void)setPreferencesView:(id)arg1;
+- (id)viewForPreferenceNamed:(id)arg1;
+- (id)imageForPreferenceNamed:(id)arg1;
+- (id)titleForIdentifier:(id)arg1;
+- (BOOL)hasChangesPending;
+- (void)saveChanges;
+- (void)willBeDisplayed;
+- (void)initializeFromDefaults;
+- (void)didChange;
+- (struct CGSize)minSize;
+- (void)setMinSize:(struct CGSize)arg1;
+- (void)moduleWillBeRemoved;
+- (void)moduleWasInstalled;
+- (BOOL)moduleCanBeRemoved;
+- (BOOL)preferencesWindowShouldClose;
+- (BOOL)isResizable;
+
+@end
+
Index: TruePreview-1.4/Source/TruePreviewPreferences.h
===================================================================
--- TruePreview-1.4/Source/TruePreviewPreferences.h (revision 0)
+++ TruePreview-1.4/Source/TruePreviewPreferences.h (revision 35)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2009, Jim Riggs, Christian Serving, L.L.C.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Christian Serving, L.L.C. nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*!
+ * @header
+ * Defines the TruePreviewPreferences category for
+ * NSPreferences.
+ * @copyright Copyright (c) 2009 Jim Riggs, Christian Serving, L.L.C. All rights reserved.
+ * @version \@(#) $Id$
+ * @updated $Date$
+ */
+
+#import "TruePreview.h"
+
+/*!
+ * @class
+ * Adds a method for overriding the preference-loading behavior of
+ * NSPreferences.
+ * @version \@(#) $Id$
+ * @updated $Date$
+ */
+@interface TruePreviewPreferences : NSObject {
+}
+
+#pragma mark Swizzled class methods
+/*! @group Swizzled class methods */
+
+/*!
+ * Adds the TruePreview preferences.
+ * @result
+ * The shared NSPreferences for this application.
+ */
++ (id)truePreviewSharedPreferences;
+
+@end
TruePreview-1.4/Source/TruePreviewPreferences.h
Property changes :
Added: svn:keywords
## -0,0 +1 ##
+Author Date Revision Id
\ No newline at end of property
Index: TruePreview-1.4/Source/TruePreviewPreferenceValueTransformer.m
===================================================================
--- TruePreview-1.4/Source/TruePreviewPreferenceValueTransformer.m (revision 0)
+++ TruePreview-1.4/Source/TruePreviewPreferenceValueTransformer.m (revision 35)
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2009, Jim Riggs, Christian Serving, L.L.C.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Christian Serving, L.L.C. nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "TruePreviewPreferenceValueTransformer.h"
+
+@implementation TruePreviewPreferenceValueTransformer
+
+#pragma mark NSValueTransformer class methods
+
++ (Class)transformedValueClass {
+ return [NSNumber class];
+}
+
+#pragma mark NSValueTransformer instance methods
+
+- (id)transformedValue:(id)inValue {
+ float theValue = [inValue floatValue];
+
+ if ((theValue > 0) && (theValue <= TRUEPREVIEW_DELAY_MAX)) {
+ return [NSNumber numberWithInt:1];
+ }
+ else if (
+ (theValue == TRUEPREVIEW_DELAY_IMMEDIATE)
+ || (theValue == TRUEPREVIEW_DELAY_DEFAULT)
+ || (theValue == TRUEPREVIEW_DELAY_NEVER)
+ ) {
+ return [NSNumber numberWithInt:theValue];
+ }
+ else {
+ return [NSNumber numberWithInt:TRUEPREVIEW_DELAY_DEFAULT];
+ }
+}
+
+@end
+
+@implementation TruePreviewPreferenceValueTransformerDelay
+
+#pragma mark NSValueTransformer class methods
+
++ (Class)transformedValueClass {
+ return [NSNumber class];
+}
+
+#pragma mark NSValueTransformer instance methods
+
+- (id)transformedValue:(id)inValue {
+ float theValue = [inValue floatValue];
+
+ if ((theValue <= 0) || (theValue > TRUEPREVIEW_DELAY_MAX)) {
+ return nil;
+ }
+ else {
+ return [NSNumber numberWithFloat:theValue];
+ }
+}
+
+@end
+
+@implementation TruePreviewPreferenceValueTransformerDelayEditIndicator
+
+#pragma mark NSValueTransformer class methods
+
++ (Class)transformedValueClass {
+ return [NSNumber class];
+}
+
+#pragma mark NSValueTransformer instance methods
+
+- (id)transformedValue:(id)inValue {
+ float theValue = [inValue floatValue];
+
+ return [NSNumber numberWithInt:((theValue > 0) && (theValue <= TRUEPREVIEW_DELAY_MAX))];
+}
+
+@end
Index: TruePreview-1.4/Source/TruePreview.m
===================================================================
--- TruePreview-1.4/Source/TruePreview.m (revision 0)
+++ TruePreview-1.4/Source/TruePreview.m (revision 35)
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2009, Jim Riggs, Christian Serving, L.L.C.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Christian Serving, L.L.C. nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "TruePreview.h"
+
+@implementation TruePreview
+
+#pragma mark Class initialization
+
++ (void)initialize {
+ if (self == [TruePreview class]) {
+ class_setSuperclass(self, NSClassFromString(@"MVMailBundle"));
+ }
+
+ [super registerBundle];
+
+ // register the preferences value transformers
+ [NSValueTransformer
+ setValueTransformer:[[TruePreviewPreferenceValueTransformer alloc] init]
+ forName:@"TruePreviewPreferenceValueTransformer"
+ ];
+ [NSValueTransformer
+ setValueTransformer:[[TruePreviewPreferenceValueTransformerDelay alloc] init]
+ forName:@"TruePreviewPreferenceValueTransformerDelay"
+ ];
+ [NSValueTransformer
+ setValueTransformer:[[TruePreviewPreferenceValueTransformerDelayEditIndicator alloc] init]
+ forName:@"TruePreviewPreferenceValueTransformerDelayEditIndicator"
+ ];
+
+ // add our "categories"
+ [TruePreviewLibraryMessage truePreviewAddAsCategoryToClass:NSClassFromString(@"LibraryMessage")];
+ [TruePreviewMessageViewer truePreviewAddAsCategoryToClass:NSClassFromString(@"MessageViewer")];
+ [TruePreviewPreferences truePreviewAddAsCategoryToClass:NSClassFromString(@"NSPreferences")];
+
+ // do our swizzles
+ [NSClassFromString(@"LibraryMessage")
+ truePreviewSwizzleMethod:@selector(markAsViewed)
+ withMethod:@selector(truePreviewMarkAsViewed)
+ isClassMethod:NO
+ ];
+ [NSClassFromString(@"MessageViewer")
+ truePreviewSwizzleMethod:@selector(dealloc)
+ withMethod:@selector(truePreviewDealloc)
+ isClassMethod:NO
+ ];
+ [NSClassFromString(@"MessageViewer")
+ truePreviewSwizzleMethod:@selector(forwardAsAttachment:)
+ withMethod:@selector(truePreviewForwardAsAttachment:)
+ isClassMethod:NO
+ ];
+ [NSClassFromString(@"MessageViewer")
+ truePreviewSwizzleMethod:@selector(forwardMessage:)
+ withMethod:@selector(truePreviewForwardMessage:)
+ isClassMethod:NO
+ ];
+ [NSClassFromString(@"MessageViewer")
+ truePreviewSwizzleMethod:@selector(markAsRead:)
+ withMethod:@selector(truePreviewMarkAsRead:)
+ isClassMethod:NO
+ ];
+ [NSClassFromString(@"MessageViewer")
+ truePreviewSwizzleMethod:@selector(markAsUnread:)
+ withMethod:@selector(truePreviewMarkAsUnread:)
+ isClassMethod:NO
+ ];
+ [NSClassFromString(@"MessageViewer")
+ truePreviewSwizzleMethod:@selector(messageNoLongerDisplayedInTextView:)
+ withMethod:@selector(truePreviewMessageNoLongerDisplayedInTextView:)
+ isClassMethod:NO
+ ];
+ [NSClassFromString(@"MessageViewer")
+ truePreviewSwizzleMethod:@selector(messageWasDisplayedInTextView:)
+ withMethod:@selector(truePreviewMessageWasDisplayedInTextView:)
+ isClassMethod:NO
+ ];
+ [NSClassFromString(@"MessageViewer")
+ truePreviewSwizzleMethod:@selector(replyAllMessage:)
+ withMethod:@selector(truePreviewReplyAllMessage:)
+ isClassMethod:NO
+ ];
+ [NSClassFromString(@"MessageViewer")
+ truePreviewSwizzleMethod:@selector(replyMessage:)
+ withMethod:@selector(truePreviewReplyMessage:)
+ isClassMethod:NO
+ ];
+ [NSClassFromString(@"NSPreferences")
+ truePreviewSwizzleMethod:@selector(sharedPreferences)
+ withMethod:@selector(truePreviewSharedPreferences)
+ isClassMethod:YES
+ ];
+
+ // set defaults
+ [[NSUserDefaults standardUserDefaults]
+ registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
+ [NSNumber numberWithInt:TRUEPREVIEW_DELAY_IMMEDIATE], @"TruePreviewDelay",
+ [NSNumber numberWithInt:NSOnState], @"TruePreviewReply",
+ [NSNumber numberWithInt:NSOnState], @"TruePreviewForward",
+ [NSNumber numberWithInt:NSOnState], @"TruePreviewWindow",
+ [NSNumber numberWithInt:NSOffState], @"TruePreviewScroll",
+ nil
+ ]
+ ];
+
+ // we're all set
+ NSLog(
+ @"Loaded TruePreview plugin %@",
+ [[NSBundle bundleForClass:[TruePreview class]] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey]
+ );
+}
+
+#pragma mark MVMailBundle class methods
+
++ (BOOL)hasPreferencesPanel {
+ return YES;
+}
+
++ (NSString*)preferencesOwnerClassName {
+ return @"TruePreviewPreferencesModule";
+}
+
++ (NSString*)preferencesPanelName {
+ return @"TruePreview";
+}
+
+@end
+
+@implementation NSObject (TruePreviewObject)
+
+#pragma mark Class methods
+
++ (void)truePreviewAddAsCategoryToClass:(Class)inClass {
+ unsigned int theCount = 0;
+ Method* theMethods = class_copyMethodList(object_getClass([self class]), &theCount);
+ Class theClass = object_getClass(inClass);
+ unsigned int i = 0;
+
+ while (YES) {
+ for (i = 0; i < theCount; i++) {
+ if (
+ !class_addMethod(
+ theClass,
+ method_getName(theMethods[i]),
+ method_getImplementation(theMethods[i]),
+ method_getTypeEncoding(theMethods[i])
+ )
+ ) {
+ NSLog(
+ @"truePreviewAddAsCategoryToClass: could not add %@ to %@",
+ NSStringFromSelector(method_getName(theMethods[i])),
+ inClass
+ );
+ }
+ }
+
+ if (theMethods != nil) {
+ free(theMethods);
+ }
+
+ if (theClass != inClass) {
+ theClass = inClass;
+ theMethods = class_copyMethodList([self class], &theCount);
+ }
+ else {
+ break;
+ }
+ }
+}
+
++ (void)truePreviewSwizzleMethod:(SEL)inOriginalSelector withMethod:(SEL)inReplacementSelector isClassMethod:(BOOL)inIsClassMethod {
+ Method theOriginalMethod = (!inIsClassMethod
+ ? class_getInstanceMethod([self class], inOriginalSelector)
+ : class_getClassMethod([self class], inOriginalSelector)
+ );
+ Method theReplacementMethod = (!inIsClassMethod
+ ? class_getInstanceMethod([self class], inReplacementSelector)
+ : class_getClassMethod([self class], inReplacementSelector)
+ );
+
+ method_exchangeImplementations(theOriginalMethod, theReplacementMethod);
+}
+
+@end
TruePreview-1.4/Source/TruePreview.m
Property changes :
Added: svn:keywords
## -0,0 +1 ##
+Author Date Revision Id
\ No newline at end of property
Index: TruePreview-1.4/Source/TruePreviewMessageViewer.h
===================================================================
--- TruePreview-1.4/Source/TruePreviewMessageViewer.h (revision 0)
+++ TruePreview-1.4/Source/TruePreviewMessageViewer.h (revision 35)
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2009, Jim Riggs, Christian Serving, L.L.C.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Christian Serving, L.L.C. nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*!
+ * @header
+ * Defines the TruePreviewMessageViewer category for
+ * MessageViewer.
+ * @copyright Copyright (c) 2009 Jim Riggs, Christian Serving, L.L.C. All rights reserved.
+ * @version \@(#) $Id: TruePreviewLibraryMessage.h 2 2009-06-27 07:02:45Z jhriggs $
+ * @updated $Date: 2009-06-27 02:02:45 -0500 (Sat, 27 Jun 2009) $
+ */
+
+#import "TruePreviewLibraryMessage.h"
+
+/*!
+ * @class
+ * Adds a method for overriding the "mark as viewed" behavior of
+ * MessageViewer.
+ * @version \@(#) $Id: TruePreviewLibraryMessage.h 2 2009-06-27 07:02:45Z jhriggs $
+ * @updated $Date: 2009-06-27 02:02:45 -0500 (Sat, 27 Jun 2009) $
+ */
+@interface TruePreviewMessageViewer : NSObject {
+}
+
+#pragma mark Class methods
+/*! @group Class methods */
+
+/*!
+ * Returns the timers for instances of this class.
+ * @result
+ * The NSMutableDictionary containing the NSTimer
+ * for each instance of this class. The key is an NSNumber
+ * (unsigned long) of the address of each instance.
+ */
++ (NSMutableDictionary*)truePreviewTimers;
+
+#pragma mark Swizzled instance methods
+/*! @group Swizzled instance methods */
+
+/*!
+ * Invalidates this instance's timer and stops observing scroll changes before
+ * deallocating.
+ */
+- (void)truePreviewDealloc;
+
+/*!
+ * Marks the currently-displayed message as read if configured to do so when
+ * forwarding.
+ * @param inSender
+ * Unused.
+ */
+- (void)truePreviewForwardAsAttachment:(id)inSender;
+
+/*!
+ * Marks the currently-displayed message as read if configured to do so when
+ * forwarding.
+ * @param inSender
+ * Unused.
+ */
+- (void)truePreviewForwardMessage:(id)inSender;
+
+/*!
+ * Invalidates this instance's timer and stops observing scroll changes when a
+ * message is explicitly marked as read.
+ * @param inSender
+ * Unused.
+ */
+- (void)truePreviewMarkAsRead:(id)inSender;
+
+/*!
+ * Invalidates this instance's timer and stops observing scroll changes when a
+ * message is explicitly marked as unread.
+ * @param inSender
+ * Unused.
+ */
+- (void)truePreviewMarkAsUnread:(id)inSender;
+
+/*!
+ * Invalidates this instance's timer and stops observing scroll changes.
+ * @param inNotification
+ * The NSNotification describing the event.
+ */
+- (void)truePreviewMessageNoLongerDisplayedInTextView:(NSNotification*)inNotification;
+
+/*!
+ * Marks the displayed message as viewed, sets a timer to mark the displayed
+ * message as viewed, and/or adds a notification observer to mark the message as
+ * viewed when it is scrolled as appropriate.
+ * @param inNotification
+ * The NSNotification describing the event.
+ */
+- (void)truePreviewMessageWasDisplayedInTextView:(id)inNotification;
+
+/*!
+ * Marks the currently-displayed message as read if configured to do so when
+ * replying.
+ * @param inSender
+ * Unused.
+ */
+- (void)truePreviewReplyAllMessage:(id)inSender;
+
+/*!
+ * Marks the currently-displayed message as read if configured to do so when
+ * replying.
+ * @param inSender
+ * Unused.
+ */
+- (void)truePreviewReplyMessage:(id)inSender;
+
+#pragma mark Accessors
+/*! @group Accessors */
+
+/*!
+ * Returns the timer for this instance.
+ * @result
+ * The NSTimer for this instance.
+ */
+- (NSTimer*)truePreviewTimer;
+
+/*!
+ * Sets the timer for this instance.
+ * @param inTimer
+ * The NSTimer for this instance.
+ */
+- (void)truePreviewSetTimer:(NSTimer*)inTimer;
+
+#pragma mark Instance methods
+/*! @group Instance methods */
+
+/*!
+ * Invalidates this instance's timer and stops observing scroll changes.
+ */
+- (void)truePreviewReset;
+
+/*!
+ * Marks the currently-displayed message as read.
+ * @param inTimer
+ * Unused.
+ */
+- (void)truePreviewTimerFired:(NSTimer*)inTimer;
+
+/*!
+ * Marks the currently-displayed message as read.
+ * @param inNotification
+ * Unused.
+ */
+- (void)truePreviewMessageClickedOrScrolled:(NSNotification*)inNotification;
+
+@end
TruePreview-1.4/Source/TruePreviewMessageViewer.h
Property changes :
Added: svn:mime-type
## -0,0 +1 ##
+text/x-c
\ No newline at end of property
Index: TruePreview-1.4/Source/TruePreviewPreferences.m
===================================================================
--- TruePreview-1.4/Source/TruePreviewPreferences.m (revision 0)
+++ TruePreview-1.4/Source/TruePreviewPreferences.m (revision 35)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2009, Jim Riggs, Christian Serving, L.L.C.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Christian Serving, L.L.C. nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "TruePreviewPreferences.h"
+
+@implementation TruePreviewPreferences
+
+#pragma mark Swizzled class methods
+
++ (id)truePreviewSharedPreferences {
+ static BOOL sAdded = NO;
+ id thePreferences = [NSClassFromString(@"NSPreferences") truePreviewSharedPreferences];
+
+ if ((thePreferences != nil) && !sAdded) {
+ sAdded = YES;
+
+ [[NSClassFromString(@"NSPreferences") truePreviewSharedPreferences]
+ addPreferenceNamed:[TruePreview preferencesPanelName]
+ owner:[TruePreviewPreferencesModule sharedInstance]
+ ];
+ }
+
+ return [NSClassFromString(@"NSPreferences") truePreviewSharedPreferences];
+}
+
+@end
TruePreview-1.4/Source/TruePreviewPreferences.m
Property changes :
Added: svn:keywords
## -0,0 +1 ##
+Author Date Revision Id
\ No newline at end of property
Index: TruePreview-1.4/Source/TruePreviewPreferencesModule.h
===================================================================
--- TruePreview-1.4/Source/TruePreviewPreferencesModule.h (revision 0)
+++ TruePreview-1.4/Source/TruePreviewPreferencesModule.h (revision 35)
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2009, Jim Riggs, Christian Serving, L.L.C.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Christian Serving, L.L.C. nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*!
+ * @header
+ * Defines the TruePreviewPreferencesModule
+ * NSPreferencesModule subclass.
+ * @copyright Copyright (c) 2009 Jim Riggs, Christian Serving, L.L.C. All rights reserved.
+ * @version \@(#) $Id$
+ * @updated $Date$
+ */
+
+#import
+
+/*!
+ * @class
+ * The TruePreviewPreferencesModule class is the subclass of
+ * NSPreferencesModule that displays and manages preferences
+ * specific to the TruePreview plugin.
+ * @version \@(#) $Id$
+ * @updated $Date$
+ */
+@interface TruePreviewPreferencesModule : NSPreferencesModule {
+#pragma mark IBOutlets
+ /*! @group IBOutlets */
+
+ /*!
+ * The NSArrayController containing the account information
+ * displayed in the TruePreview preferences panel.
+ */
+ IBOutlet NSArrayController* fldAccountArrayController;
+}
+
+#pragma mark NSPreferencesModule instance methods
+/*! @group NSPreferencesModule instance methods */
+
+/*!
+ * Returns the name of the nib file containing the TruePreview preferences
+ * panel.
+ * @result
+ * TruePreviewPreferencesPanel.
+ */
+- (NSString*)preferencesNibName;
+
+/*!
+ * Loads the account information for the TruePreview preferences panel.
+ */
+- (void)willBeDisplayed;
+
+#pragma mark NSKeyValueObserving instance methods
+/*! @group NSKeyValueObserving instance methods */
+
+/*!
+ * Converts the account settings from the TruePreview preferences panel to a
+ * dictionary and saves the dictionary into the user defaults.
+ * @param inPath
+ * Unused.
+ * @param inObject
+ * Unused.
+ * @param inChange
+ * Unused.
+ * @param inContext
+ * The NSArray containing the account settings from the
+ * TruePreview preferences panel.
+ */
+- (void)observeValueForKeyPath:(NSString*)inPath
+ ofObject:(id)inObject
+ change:(NSDictionary*)inChange
+ context:(void*)inContext;
+
+@end
TruePreview-1.4/Source/TruePreviewPreferencesModule.h
Property changes :
Added: svn:keywords
## -0,0 +1 ##
+Author Date Revision Id
\ No newline at end of property
Index: TruePreview-1.4/Source/TruePreviewLibraryMessage.h
===================================================================
--- TruePreview-1.4/Source/TruePreviewLibraryMessage.h (revision 0)
+++ TruePreview-1.4/Source/TruePreviewLibraryMessage.h (revision 35)
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2009, Jim Riggs, Christian Serving, L.L.C.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Christian Serving, L.L.C. nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*!
+ * @header
+ * Defines the TruePreviewLibraryMessage category for
+ * LibraryMessage.
+ * @copyright Copyright (c) 2009 Jim Riggs, Christian Serving, L.L.C. All rights reserved.
+ * @version \@(#) $Id$
+ * @updated $Date$
+ */
+
+#import "TruePreview.h"
+
+/*!
+ * @class
+ * Adds a method for overriding the "mark as viewed" behavior of
+ * LibraryMessage.
+ * @version \@(#) $Id$
+ * @updated $Date$
+ */
+@interface TruePreviewLibraryMessage : NSObject {
+}
+
+#pragma mark Swizzled instance methods
+/*! @group Swizzled instance methods */
+
+/*!
+ * Does nothing. The replacement behavior is handled in
+ * TruePreviewMessageViewer.
+ */
+- (void)truePreviewMarkAsViewed;
+
+#pragma mark Instance methods
+/*! @group Instance methods */
+
+/*!
+ * Returns the TruePreview settings appropriate for this message.
+ * @result
+ * An NSMutableDictionary containing the keys delay,
+ * window, and scroll and their respective values
+ * based on the default settings and/or the settings for this message's
+ * account.
+ */
+- (NSMutableDictionary*)truePreviewSettings;
+
+@end