From 7c44c868839047863fd156b46ba2f4b6f99dcb6d Mon Sep 17 00:00:00 2001 From: helge Date: Sat, 30 Jul 2005 13:22:07 +0000 Subject: [PATCH] added some Kolab mail detection git-svn-id: http://svn.opengroupware.org/SOGo/trunk@921 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SoObjects/Mailer/ChangeLog | 3 ++ SoObjects/Mailer/SOGoMailObject.m | 35 +++++++++++++ SoObjects/Mailer/Version | 2 +- UI/MailPartViewers/ChangeLog | 5 ++ UI/MailPartViewers/README.txt | 17 ++++++ UI/MailPartViewers/UIxMailRenderingContext.m | 55 ++++++++++++++++++-- UI/MailPartViewers/Version | 2 +- 7 files changed, 112 insertions(+), 7 deletions(-) create mode 100644 UI/MailPartViewers/README.txt diff --git a/SoObjects/Mailer/ChangeLog b/SoObjects/Mailer/ChangeLog index c8651eac..c9701a4f 100644 --- a/SoObjects/Mailer/ChangeLog +++ b/SoObjects/Mailer/ChangeLog @@ -1,5 +1,8 @@ 2005-07-30 Helge Hess + * SOGoMailObject.m: added 'outlookMessageClass' property with some + mail tagging for Kolab entities (v0.9.125) + * SOGoMailBodyPart.m, SOGoMailObject.m: added default to disable etag delivery/checks for mail objects (SOGoMailDisableETag) (v0.9.124) diff --git a/SoObjects/Mailer/SOGoMailObject.m b/SoObjects/Mailer/SOGoMailObject.m index 3e60fc73..9fc1978f 100644 --- a/SoObjects/Mailer/SOGoMailObject.m +++ b/SoObjects/Mailer/SOGoMailObject.m @@ -808,6 +808,17 @@ static BOOL debugSoParts = NO; /* some mail classification */ +- (BOOL)isKolabObject { + NSDictionary *h; + + if ((h = [self mailHeaders]) != nil) + return [[h objectForKey:@"x-kolab-type"] isNotEmpty]; + + // TODO: we could check the body structure? + + return NO; +} + - (BOOL)isMailingListMail { NSDictionary *h; @@ -902,6 +913,30 @@ static BOOL debugSoParts = NO; */ return mailETag; } +- (int)zlGenerationCount { + return 0; /* mails never change */ +} + +/* Outlook mail tagging */ + +- (NSString *)outlookMessageClass { + NSString *type; + + if ((type = [[self mailHeaders] objectForKey:@"x-kolab-type"]) != nil) { + if ([type isEqualToString:@"application/x-vnd.kolab.contact"]) + return @"IPM.Contact"; + if ([type isEqualToString:@"application/x-vnd.kolab.task"]) + return @"IPM.Task"; + if ([type isEqualToString:@"application/x-vnd.kolab.event"]) + return @"IPM.Appointment"; + if ([type isEqualToString:@"application/x-vnd.kolab.note"]) + return @"IPM.Note"; + if ([type isEqualToString:@"application/x-vnd.kolab.journal"]) + return @"IPM.Journal"; + } + + return @"IPM.Message"; /* email, default class */ +} /* debugging */ diff --git a/SoObjects/Mailer/Version b/SoObjects/Mailer/Version index 31b0a460..49ff5609 100644 --- a/SoObjects/Mailer/Version +++ b/SoObjects/Mailer/Version @@ -1,6 +1,6 @@ # Version file -SUBMINOR_VERSION:=124 +SUBMINOR_VERSION:=125 # v0.9.114 requires libNGMime v4.5.229 # v0.9.114 requires libNGExtensions v4.5.165 diff --git a/UI/MailPartViewers/ChangeLog b/UI/MailPartViewers/ChangeLog index 30c45401..ae458aad 100644 --- a/UI/MailPartViewers/ChangeLog +++ b/UI/MailPartViewers/ChangeLog @@ -1,3 +1,8 @@ +2005-07-30 Helge Hess + + * UIxMailRenderingContext.m: prepared some support for Kolab types in + IMAP4 (v0.9.19) + 2005-07-27 Helge Hess * English.lproj/Localizable.strings: added a missing semicolon diff --git a/UI/MailPartViewers/README.txt b/UI/MailPartViewers/README.txt new file mode 100644 index 00000000..26a97fa9 --- /dev/null +++ b/UI/MailPartViewers/README.txt @@ -0,0 +1,17 @@ +SOGo MailPartViewers +==================== + +TODO + +This product bundle contains components for displaying certain parts of an +email, like the text content, attachments or embedded images. + +All the contained classes inherit from UIxMailPartViewer which provides the +majority of the functionality. Subclasses usually only add methods for the +presentation of the content (which in turn is usually done in the templates). + +The "master object" which selects appropriate classes and coordinates the +rendering is the UIxMailRenderingContext. The context also maintains a cache +of components for rendering which can then be reused for similiar parts in the +mail. Note that this only works for leaf-content (eg not for recursive ones +like multipart/* viewers). diff --git a/UI/MailPartViewers/UIxMailRenderingContext.m b/UI/MailPartViewers/UIxMailRenderingContext.m index 9b96d296..e3f3f411 100644 --- a/UI/MailPartViewers/UIxMailRenderingContext.m +++ b/UI/MailPartViewers/UIxMailRenderingContext.m @@ -145,6 +145,29 @@ static BOOL showNamedTextAttachmentsInline = NO; return self->iCalViewer; } +/* Kolab viewers */ + +- (WOComponent *)kolabContactViewer { + return [self linkViewer]; +} +- (WOComponent *)kolabEventViewer { + return [self linkViewer]; +} +- (WOComponent *)kolabTodoViewer { + return [self linkViewer]; +} +- (WOComponent *)kolabNoteViewer { + return [self linkViewer]; +} +- (WOComponent *)kolabJournalViewer { + return [self linkViewer]; +} +- (WOComponent *)kolabDistributionListViewer { + return [self linkViewer]; +} + +/* main viewer selection */ + - (WOComponent *)viewerForBodyInfo:(id)_info { NSString *mt, *st; @@ -185,12 +208,15 @@ static BOOL showNamedTextAttachmentsInline = NO; if ([st isEqualToString:@"calendar"]) return [self iCalViewer]; } - else if ([mt isEqualToString:@"image"]) + + if ([mt isEqualToString:@"image"]) return [self imageViewer]; - else if ([mt isEqualToString:@"message"] && [st isEqualToString:@"rfc822"]) + + if ([mt isEqualToString:@"message"] && [st isEqualToString:@"rfc822"]) return [self messageViewer]; - else if ([mt isEqualToString:@"message"] && - [st isEqualToString:@"delivery-status"]) { + + if ([mt isEqualToString:@"message"] && + [st isEqualToString:@"delivery-status"]) { /* Content-Description: Delivery error report Content-Type: message/delivery-status @@ -207,9 +233,28 @@ static BOOL showNamedTextAttachmentsInline = NO; // Note: we cannot use the text viewer because the body is not pre-fetched return [self linkViewer]; } - else if ([mt isEqualToString:@"application"]) { + + if ([mt isEqualToString:@"application"]) { // octet-stream (generate download link?, autodetect type?) + if ([st hasPrefix:@"x-vnd.kolab."]) { + if ([st isEqualToString:@"x-vnd.kolab.contact"]) + return [self kolabContactViewer]; + if ([st isEqualToString:@"x-vnd.kolab.event"]) + return [self kolabEventViewer]; + if ([st isEqualToString:@"x-vnd.kolab.task"]) + return [self kolabTodoViewer]; + if ([st isEqualToString:@"x-vnd.kolab.note"]) + return [self kolabNoteViewer]; + if ([st isEqualToString:@"x-vnd.kolab.journal"]) + return [self kolabJournalViewer]; + if ([st isEqualToString:@"x-vnd.kolab.contact.distlist"]) + return [self kolabDistributionListViewer]; + + [self errorWithFormat:@"found no viewer for Kolab type: %@/%@", mt, st]; + return [self linkViewer]; + } + #if 0 /* the link viewer looks better than plain text ;-) */ if ([st isEqualToString:@"pgp-signature"]) // TODO: real PGP viewer return [self textViewer]; diff --git a/UI/MailPartViewers/Version b/UI/MailPartViewers/Version index a07ad46a..4d6c8a33 100644 --- a/UI/MailPartViewers/Version +++ b/UI/MailPartViewers/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=18 +SUBMINOR_VERSION:=19 # v0.9.0 requires libNGiCal v4.5.53 # v0.9.1 requires libNGMime v4.5.213 -- 2.39.5