From: helge Date: Fri, 15 Jul 2005 14:26:17 +0000 (+0000) Subject: added special ical/vcard part subclasses X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d53b13d780fcd858ee660df3325306b31c95efc3;p=scalable-opengroupware.org added special ical/vcard part subclasses git-svn-id: http://svn.opengroupware.org/SOGo/trunk@778 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/SoObjects/Mailer/ChangeLog b/SOGo/SoObjects/Mailer/ChangeLog index 58cda747..2e7ab97f 100644 --- a/SOGo/SoObjects/Mailer/ChangeLog +++ b/SOGo/SoObjects/Mailer/ChangeLog @@ -1,14 +1,22 @@ 2005-07-15 Helge Hess - * SOGoMailFolder.m: fixed a stupid bug in permission parsing (v0.9.106) + * v0.9.107 -2005-07-15 Helge Hess + * SOGoMailBodyPart.m: check lookup key path extension to determine the + part subclass to instantiate (note: the link generator in the UI + must generate proper links including the extension to make this work) + + * added special part subclasses SOGoVCardMailBodyPart and + SOGoCalendarMailBodyPart + + * SOGoMailObject.m: map vcf extension to vcard mime type, added some + debug logging + + * SOGoMailFolder.m: fixed a stupid bug in permission parsing (v0.9.106) * SOGoMailFolder.m: added support for more Cyrus permission flags (v0.9.105) -2005-07-15 Helge Hess - * SOGoMailObject.m, SOGoMailBodyPart.m, SOGoDraftObject.m: fixed gcc4.0 warnings (v0.9.104) diff --git a/SOGo/SoObjects/Mailer/GNUmakefile b/SOGo/SoObjects/Mailer/GNUmakefile index 916836d1..cdb90d47 100644 --- a/SOGo/SoObjects/Mailer/GNUmakefile +++ b/SOGo/SoObjects/Mailer/GNUmakefile @@ -24,6 +24,8 @@ Mailer_OBJC_FILES += \ SOGoMailBodyPart.m \ SOGoImageMailBodyPart.m \ SOGoMessageMailBodyPart.m \ + SOGoCalendarMailBodyPart.m \ + SOGoVCardMailBodyPart.m \ \ SOGoDraftsFolder.m \ SOGoDraftObject.m \ diff --git a/SOGo/SoObjects/Mailer/SOGoCalendarMailBodyPart.m b/SOGo/SoObjects/Mailer/SOGoCalendarMailBodyPart.m new file mode 100644 index 00000000..50d0a28e --- /dev/null +++ b/SOGo/SoObjects/Mailer/SOGoCalendarMailBodyPart.m @@ -0,0 +1,42 @@ +/* + Copyright (C) 2005 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo 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. + + OGo 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 OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ + +#include + +/* + SOGoCalendarMailBodyPart + + A specialized SOGoMailBodyPart subclass for text/calendar attachments. Can + be used to attach special SoMethods. + + See the superclass for more information on part objects. +*/ + +@interface SOGoCalendarMailBodyPart : SOGoMailBodyPart +{ +} + +@end + +#include "common.h" + +@implementation SOGoCalendarMailBodyPart +@end /* SOGoCalendarMailBodyPart */ diff --git a/SOGo/SoObjects/Mailer/SOGoMailBodyPart.m b/SOGo/SoObjects/Mailer/SOGoMailBodyPart.m index 286d5925..b9884fb5 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailBodyPart.m +++ b/SOGo/SoObjects/Mailer/SOGoMailBodyPart.m @@ -130,7 +130,8 @@ static BOOL debugOn = NO; return self; /* return 404 to stop acquisition */ - return [NSException exceptionWithHTTPStatus:404 /* Not Found */]; + return [NSException exceptionWithHTTPStatus:404 /* Not Found */ + reason:@"Did not find a subpart for the given name!"]; } /* fetch */ @@ -265,12 +266,19 @@ static BOOL debugOn = NO; [pe isEqualToString:@"png"] || [pe isEqualToString:@"jpg"]) return NSClassFromString(@"SOGoImageMailBodyPart"); + if ([pe isEqualToString:@"ics"]) + return NSClassFromString(@"SOGoCalendarMailBodyPart"); + if ([pe isEqualToString:@"vcf"]) + return NSClassFromString(@"SOGoVCardMailBodyPart"); + break; case 4: if ([pe isEqualToString:@"mail"]) return NSClassFromString(@"SOGoMessageMailBodyPart"); + break; default: return self; } + return self; } /* debugging */ diff --git a/SOGo/SoObjects/Mailer/SOGoMailFolder.m b/SOGo/SoObjects/Mailer/SOGoMailFolder.m index 38e4de4e..c8009fef 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailFolder.m +++ b/SOGo/SoObjects/Mailer/SOGoMailFolder.m @@ -119,6 +119,8 @@ return; } + // [self logWithFormat:@"GOT PERM: %@", rights]; + self->somfFlags.didCheckMyRights = 1; /* reset flags */ diff --git a/SOGo/SoObjects/Mailer/SOGoMailObject.m b/SOGo/SoObjects/Mailer/SOGoMailObject.m index 47832c8a..6cbfc51a 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailObject.m +++ b/SOGo/SoObjects/Mailer/SOGoMailObject.m @@ -31,9 +31,10 @@ @implementation SOGoMailObject static NSArray *coreInfoKeys = nil; -static BOOL heavyDebug = NO; -static BOOL debugOn = NO; +static BOOL heavyDebug = NO; +static BOOL debugOn = NO; static BOOL debugBodyStructure = NO; +static BOOL debugSoParts = NO; + (void)initialize { /* Note: see SOGoMailManager.m for allowed IMAP4 keys */ @@ -73,12 +74,10 @@ static BOOL debugBodyStructure = NO; mt = [_partInfo valueForKey:@"type"]; st = [[_partInfo valueForKey:@"subtype"] lowercaseString]; if ([mt isEqualToString:@"text"]) { - if ([st isEqualToString:@"plain"]) - return @".txt"; - if ([st isEqualToString:@"html"]) - return @".html"; - if ([st isEqualToString:@"calendar"]) - return @".ics"; + if ([st isEqualToString:@"plain"]) return @".txt"; + if ([st isEqualToString:@"html"]) return @".html"; + if ([st isEqualToString:@"calendar"]) return @".ics"; + if ([st isEqualToString:@"x-vcard"]) return @".vcf"; } else if ([mt isEqualToString:@"image"]) return [@"." stringByAppendingString:st]; @@ -542,12 +541,16 @@ static BOOL debugBodyStructure = NO; /* lookup body part */ if ([self isBodyPartKey:_key inContext:_ctx]) { - if ((obj = [self lookupImap4BodyPartKey:_key inContext:_ctx]) != nil) + if ((obj = [self lookupImap4BodyPartKey:_key inContext:_ctx]) != nil) { + if (debugSoParts) + [self logWithFormat:@"mail looked up part %@: %@", _key, obj]; return obj; + } } /* return 404 to stop acquisition */ - return [NSException exceptionWithHTTPStatus:404 /* Not Found */]; + return [NSException exceptionWithHTTPStatus:404 /* Not Found */ + reason:@"Did not find mail method or part-reference!"]; } /* WebDAV */ diff --git a/SOGo/SoObjects/Mailer/SOGoVCardMailBodyPart.m b/SOGo/SoObjects/Mailer/SOGoVCardMailBodyPart.m new file mode 100644 index 00000000..8dabfc86 --- /dev/null +++ b/SOGo/SoObjects/Mailer/SOGoVCardMailBodyPart.m @@ -0,0 +1,42 @@ +/* + Copyright (C) 2005 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo 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. + + OGo 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 OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ + +#include + +/* + SOGoVCardMailBodyPart + + A specialized SOGoMailBodyPart subclass for text/x-vcard attachments. Can + be used to attach special SoMethods. + + See the superclass for more information on part objects. +*/ + +@interface SOGoVCardMailBodyPart : SOGoMailBodyPart +{ +} + +@end + +#include "common.h" + +@implementation SOGoVCardMailBodyPart +@end /* SOGoVCardMailBodyPart */ diff --git a/SOGo/SoObjects/Mailer/Version b/SOGo/SoObjects/Mailer/Version index ab4f6814..db945487 100644 --- a/SOGo/SoObjects/Mailer/Version +++ b/SOGo/SoObjects/Mailer/Version @@ -1,6 +1,6 @@ # Version file -SUBMINOR_VERSION:=106 +SUBMINOR_VERSION:=107 # v0.9.96 requires libNGMime v4.5.223 # v0.9.91 requires libNGMime v4.5.222 diff --git a/SOGo/SoObjects/Mailer/product.plist b/SOGo/SoObjects/Mailer/product.plist index 1171c1ae..31eacb15 100644 --- a/SOGo/SoObjects/Mailer/product.plist +++ b/SOGo/SoObjects/Mailer/product.plist @@ -50,6 +50,15 @@ SOGoImageMailBodyPart = { superclass = "SOGoMailBodyPart"; }; + SOGoMessageMailBodyPart = { + superclass = "SOGoMailBodyPart"; + }; + SOGoCalendarMailBodyPart = { + superclass = "SOGoMailBodyPart"; + }; + SOGoVCardMailBodyPart = { + superclass = "SOGoMailBodyPart"; + }; SOGoDraftsFolder = { superclass = "SOGoMailBaseObject";