2005-01-30 Helge Hess <helge.hess@opengroupware.org>
-
+
+ * v0.9.61
+
+ * SOGoMailObject.m, SOGoMailBodyPart.m, product.plist: added type
+ specific SOGoMailBodyPart controller objects, reduced debug logs
+
* v0.9.60
* SOGoDraftObject.m: added -content and -contentAsString methods (Note:
SOGoMailAccount.m \
SOGoMailFolder.m \
SOGoMailObject.m \
+ \
SOGoMailBodyPart.m \
+ SOGoImageMailBodyPart.m \
+ SOGoMessageMailBodyPart.m \
\
SOGoDraftsFolder.m \
SOGoDraftObject.m \
--- /dev/null
+/*
+ Copyright (C) 2004-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 <Mailer/SOGoMailBodyPart.h>
+
+/*
+ SOGoImageMailBodyPart
+
+ A specialized SOGoMailBodyPart subclass for image attachments. Can be used
+ to attach special SoMethods.
+
+ See the superclass for more information on part objects.
+*/
+
+@interface SOGoImageMailBodyPart : SOGoMailBodyPart
+{
+}
+
+@end
+
+#include "common.h"
+
+@implementation SOGoImageMailBodyPart
+@end /* SOGoImageMailBodyPart */
- (id)partInfo;
+/* factory */
+
++ (Class)bodyPartClassForKey:(NSString *)_key inContext:(id)_ctx;
+
@end
#endif /* __Mailer_SOGoMailBodyPart_H__ */
@implementation SOGoMailBodyPart
+static BOOL debugOn = NO;
+
- (void)dealloc {
[self->partInfo release];
[self->identifier release];
- (id)lookupImap4BodyPartKey:(NSString *)_key inContext:(id)_ctx {
// TODO: we might want to check for existence prior controller creation
- // TODO: we might(should?) want to create type-specific body-part objects
- return [[[SOGoMailBodyPart alloc] initWithName:_key
- inContainer:self] autorelease];
+ Class clazz;
+
+ clazz = [SOGoMailBodyPart bodyPartClassForKey:_key inContext:_ctx];
+ return [[[clazz alloc] initWithName:_key inContainer:self] autorelease];
}
- (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag {
return r;
}
+/* factory */
+
++ (Class)bodyPartClassForKey:(NSString *)_key inContext:(id)_ctx {
+ NSString *pe;
+
+ pe = [_key pathExtension];
+ if (![pe isNotNull] || [pe length] == 0)
+ return self;
+
+ /* hard coded for now */
+
+ switch ([pe length]) {
+ case 3:
+ if ([pe isEqualToString:@"gif"] ||
+ [pe isEqualToString:@"png"] ||
+ [pe isEqualToString:@"jpg"])
+ return NSClassFromString(@"SOGoImageMailBodyPart");
+ case 4:
+ if ([pe isEqualToString:@"mail"])
+ return NSClassFromString(@"SOGoMessageMailBodyPart");
+ default:
+ return self;
+ }
+}
+
+/* debugging */
+
+- (BOOL)isDebuggingEnabled {
+ return debugOn;
+}
+
@end /* SOGoMailBodyPart */
static NSArray *coreInfoKeys = nil;
static BOOL heavyDebug = NO;
+static BOOL debugOn = NO;
+ (void)initialize {
/* Note: see SOGoMailManager.m for allowed IMAP4 keys */
unsigned idx;
NSArray *parts;
- [self logWithFormat:@"check PATH: %@", p];
+ [self debugWithFormat:@"check PATH: %@", p];
idx = [p intValue] - 1;
parts = [info valueForKey:@"parts"];
- (id)lookupImap4BodyPartKey:(NSString *)_key inContext:(id)_ctx {
// TODO: we might want to check for existence prior controller creation
- return [[[SOGoMailBodyPart alloc] initWithName:_key
- inContainer:self] autorelease];
+ Class clazz;
+
+ clazz = [SOGoMailBodyPart bodyPartClassForKey:_key inContext:_ctx];
+ return [[[clazz alloc] initWithName:_key inContainer:self] autorelease];
}
- (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag {
password:[self imap4Password]];
}
+/* debugging */
+
+- (BOOL)isDebuggingEnabled {
+ return debugOn;
+}
+
@end /* SOGoMailObject */
--- /dev/null
+/*
+ Copyright (C) 2004-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 <Mailer/SOGoMailBodyPart.h>
+
+/*
+ SOGoMessageMailBodyPart
+
+ A specialized SOGoMailBodyPart subclass for message attachments. Can be used
+ to attach special SoMethods.
+
+ See the superclass for more information on part objects.
+*/
+
+@interface SOGoMessageMailBodyPart : SOGoMailBodyPart
+{
+}
+
+@end
+
+#include "common.h"
+
+@implementation SOGoMessageMailBodyPart
+@end /* SOGoMessageMailBodyPart */
# Version file
-SUBMINOR_VERSION:=59
+SUBMINOR_VERSION:=61
# v0.9.55 requires NGExtensions v4.5.136
# v0.9.44 requires libNGMime v4.3.194
SOGoMailBodyPart = {
superclass = "SOGoMailBaseObject";
};
+ SOGoImageMailBodyPart = {
+ superclass = "SOGoMailBodyPart";
+ };
SOGoDraftsFolder = {
superclass = "SOGoMailBaseObject";
/* Note: valueForKey:@"reason" does not work?! */
reason = [[_result valueForKey:@"RawResponse"] objectForKey:@"reason"];
- [self logWithFormat:@"REASON: %@", reason];
if (![reason isNotNull])
reason = @"Failed to upload Sieve script.";
2005-01-30 Helge Hess <helge.hess@opengroupware.org>
+
+ * v0.9.82
+
+ * UIxMailPartLinkViewer.m: prefix filenames which start with a digit,
+ properly escape attachment names
+
+ * UIxMailPartImageViewer.m (UIxMailPartViewer): append image extension
+ to attachments
* v0.9.81
@implementation UIxMailPartImageViewer
-- (void)dealloc {
- [super dealloc];
-}
-
/* URLs */
- (NSString *)pathToImage {
NSString *url;
+ NSString *s;
url = [[self clientObject] baseURLInContext:[self context]];
if (![url hasSuffix:@"/"]) url = [url stringByAppendingString:@"/"];
- return [url stringByAppendingString:
- [[self partPath] componentsJoinedByString:@"/"]];
+
+ s = [[self partPath] componentsJoinedByString:@"/"];
+ url = [url stringByAppendingString:s];
+
+ if ((s = [self preferredPathExtension]) != nil) {
+ url = [url stringByAppendingString:@"."];
+ url = [url stringByAppendingString:s];
+ }
+
+ return url;
}
@end /* UIxMailPartImageViewer */
/* URLs */
- (NSString *)pathToAttachment {
- NSString *url, *n;
+ NSString *url, *n, *pext;
+
+ pext = [self preferredPathExtension];
/* path to mail controller object */
n = [[self partPath] componentsJoinedByString:@"/"];
url = [url stringByAppendingString:n];
+ if ([pext isNotNull] && [pext length] > 0) {
+ /* attach extension */
+ url = [url stringByAppendingString:@"."];
+ url = [url stringByAppendingString:pext];
+ }
/*
If we have an attachment name, we attach it, this is properly handled by
SOGoMailBodyPart.
*/
- n = [[[self bodyInfo] valueForKey:@"parameterList"] valueForKey:@"name"];
+ n = [self filenameForDisplay];
if ([n isNotNull] && [n length] > 0) {
url = [url stringByAppendingString:@"/"];
- url = [url stringByAppendingString:n];
- }
- else if ([(n = [[self bodyInfo] valueForKey:@"type"]) isNotNull]) {
- /* attach extension */
- url = [url stringByAppendingString:@"."];
- url = [url stringByAppendingString:[self preferredPathExtension]];
+ if (isdigit([n characterAtIndex:0]))
+ url = [url stringByAppendingString:@"fn-"];
+ url = [url stringByAppendingString:[n stringByEscapingURL]];
+
+ // TODO: should we check for a proper extension?
}
return url;
if ([_st isEqualToString:@"plain"]) return @"txt";
if ([_st isEqualToString:@"xml"]) return @"xml";
}
+ else if ([_mt isEqualToString:@"message"]) {
+ if ([_st isEqualToString:@"rfc822"]) return @"mail";
+ }
else if ([_mt isEqualToString:@"application"]) {
if ([_st isEqualToString:@"pdf"]) return @"pdf";
}
tmp = [tmp valueForKey:@"name"];
if (![tmp isNotNull])
return nil;
+ if ([tmp length] == 0)
+ return nil;
- return [tmp length] > 0 ? tmp : nil;
+ return tmp;
}
- (NSString *)filenameForDisplay {
# version file
-SUBMINOR_VERSION:=81
+SUBMINOR_VERSION:=82
# v0.9.81 requires SoObjects/Sieve v0.9.5
# v0.9.80 requires SoObjects/Mailer v0.9.59