Skip to content

Commit

Permalink
feat(mail): initial support for ms-tnef (winmail.dat) body part
Browse files Browse the repository at this point in the history
Fixes #2242
Fixes #4503
  • Loading branch information
cgx committed Aug 4, 2021
1 parent 7747048 commit 171c186
Show file tree
Hide file tree
Showing 18 changed files with 2,397 additions and 26 deletions.
1 change: 1 addition & 0 deletions SoObjects/Mailer/GNUmakefile
Expand Up @@ -30,6 +30,7 @@ Mailer_OBJC_FILES += \
SOGoImageMailBodyPart.m \
SOGoMessageMailBodyPart.m \
SOGoCalendarMailBodyPart.m \
SOGoTnefMailBodyPart.m \
SOGoVCardMailBodyPart.m \
\
SOGoMailForward.m \
Expand Down
7 changes: 4 additions & 3 deletions SoObjects/Mailer/SOGoMailBodyPart.m
Expand Up @@ -157,8 +157,7 @@ - (id) partInfo
{
if (!partInfo)
{
partInfo
= [[self mailObject] lookupInfoForBodyPart: [self bodyPartPath]];
partInfo = [[self mailObject] lookupInfoForBodyPart: [self bodyPartPath]];
[partInfo retain];
}

Expand Down Expand Up @@ -546,7 +545,7 @@ + (Class) bodyPartClassForKey: (NSString *) _key
return self;

/* hard coded for now */

switch ([pe length]) {
case 3:
if ([pe isEqualToString:@"gif"] ||
Expand Down Expand Up @@ -588,6 +587,8 @@ + (Class) bodyPartClassForMimeType: (NSString *) mimeType
classString = @"SOGoVCardMailBodyPart";
else if ([mimeType isEqualToString: @"message/rfc822"])
classString = @"SOGoMessageMailBodyPart";
else if ([mimeType isEqualToString: @"application/ms-tnef"])
classString = @"SOGoTnefMailBodyPart";
else
{
classString = @"SOGoMailBodyPart";
Expand Down
53 changes: 53 additions & 0 deletions SoObjects/Mailer/SOGoTnefMailBodyPart.h
@@ -0,0 +1,53 @@
/*
Copyright (C) 2005-2017 Inverse inc.
Copyright (C) 2004-2005 SKYRIX Software AG
This file is part of SOGo.
SOGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
SOGo is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public
License along with SOGo; see the file COPYING. If not, write to the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/

#ifndef __Mailer_SOGoTnefMailBodyPart_H__
#define __Mailer_SOGoTnefMailBodyPart_H__

#import "SOGoMailBodyPart.h"

@class NGMimeBodyPart;

@interface SOGoTnefMailBodyPart : SOGoMailBodyPart
{
NSData *part;
NSString *filename;
NGMimeMultipartBody *bodyParts;
}

- (NGMimeMultipartBody *) bodyParts;
- (void) setFilename: (NSString *) newFilename;
- (void) setPart: (NGMimeBodyPart *) newPart;
- (void) setPartInfo: (id) newPartInfo;
- (void) decodeBLOB;
- (NGMimeBodyPart *) bodyPartForData: (NSData *) _data
withType: (NSString *) _type
andSubtype: (NSString *) _subtype;
- (NGMimeBodyPart *) bodyPartForAttachment: (NSData *) _data
withName: (NSString *) _name
andType: (NSString *) _type
andSubtype: (NSString *) _subtype
andContentId: (NSString *) _cid;

@end

#endif /* __Mailer_SOGoTnefMailBodyPart_H__ */

0 comments on commit 171c186

Please sign in to comment.