Skip to content

Commit

Permalink
#68 - addressing strange behaviour caused by Yosemite support impleme…
Browse files Browse the repository at this point in the history
…ntation
  • Loading branch information
jeevatkm committed Sep 12, 2014
1 parent fea5e16 commit 462c56e
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<PathRunnable
FilePath = "/Applications/Mail.app">
</PathRunnable>
<AdditionalOptions>
<AdditionalOption
key = "DYLD_INSERT_LIBRARIES"
Expand Down
42 changes: 37 additions & 5 deletions ReplyWithHeader/MHQuotedMailOriginal.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ - (void)insertForHTMLMail:(DOMDocumentFragment *)headerFragment
{
if (isBlockquotePresent)
{
DOMNode *nodeRef = [self getElementByName:TAG_BLOCKQUOTE];
DOMNode *nodeRef = [self getBlockquoteTagNode];
[nodeRef insertBefore:headerFragment refChild:[nodeRef firstChild]];
[nodeRef insertBefore:headerBorder refChild:[nodeRef firstChild]];
}
Expand All @@ -83,11 +83,11 @@ - (void)insertForHTMLMail:(DOMDocumentFragment *)headerFragment

- (void)insertForPlainMail:(DOMDocumentFragment *)headerFragment
{
if ( textNodeLocation >= 0 )
if (textNodeLocation >= 0)
{
if (isBlockquotePresent) // include inside blockquote
{
DOMNode *nodeRef = [self getElementByName:TAG_BLOCKQUOTE];
DOMNode *nodeRef = [self getBlockquoteTagNode];
[nodeRef insertBefore:headerFragment refChild:[nodeRef firstChild]];
[nodeRef insertBefore:headerBorder refChild:[nodeRef firstChild]];
}
Expand Down Expand Up @@ -164,7 +164,7 @@ - (id)initWithMailMessage:(id)mailMessage msgComposeType:(int)composeType
dhc = [originalEmail childNodes];

//identifying blockquote tag
isBlockquotePresent = [self isTagPresent:TAG_BLOCKQUOTE];
isBlockquotePresent = [self isBlockquoteTagPresent]; //[self isTagPresent:TAG_BLOCKQUOTE];

//now get the quoted content and remove the first part (where it says "On ... X wrote"
// "... message"
Expand Down Expand Up @@ -295,7 +295,7 @@ - (void)removeHTMLHeaderPrefix

while ( textRange.location == NSNotFound )
{
[emailDocument removeChild:[nodeList item:0]];
[emailDocument removeChild:[emailDocument firstChild]];
textRange = [[[emailDocument firstChild] stringValue] rangeOfString:searchString];
}
}
Expand Down Expand Up @@ -365,6 +365,38 @@ - (void)prepareQuotedPlainText
}
}

- (BOOL)isBlockquoteTagPresent
{
BOOL present = FALSE;

for (int i=0; i < dhc.length; i++)
{
if ([[[dhc item:i] nodeName] isEqualToString:TAG_BLOCKQUOTE])
{
present = TRUE;
MHLog(@"%@ Node found at %d", TAG_BLOCKQUOTE, i);
break;
}
}

return present;
}

- (DOMNode *)getBlockquoteTagNode
{
MHLog(@"No of child nodes: %d", dhc.length);
for (int i=0; i < dhc.length; i++)
{
if ([[[dhc item:i] nodeName] isEqualToString:TAG_BLOCKQUOTE])
{
MHLog(@"getBlockquoteTagNode:: %@ Node found at %d", TAG_BLOCKQUOTE, i);
return [dhc item:i];
}
}

return nil;
}

- (BOOL)isTagPresent:(NSString *)tagName
{
BOOL tag = FALSE;
Expand Down
4 changes: 2 additions & 2 deletions ReplyWithHeader/Resources/en.lproj/MailHeader-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>4.6</string>
<string>4.7</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>4.6</string>
<string>4.7</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>MHAppCastURL</key>
Expand Down

0 comments on commit 462c56e

Please sign in to comment.