/* 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;
*/
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 */
--- /dev/null
+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).
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;
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
// 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];