+2005-02-08 Helge Hess <helge.hess@opengroupware.org>
+
+ * v0.9.69
+
+ * reworked for new NGImap4 v4.5.210 API
+
+ * SOGoMailObject.m: removed fromEnvelopeAddress in favor of
+ fromEnvelopeAddresses to match the new NGImap4 v4.5.210 API
+
2005-02-07 Helge Hess <helge.hess@opengroupware.org>
* v0.9.68
/* accessors */
- (NSString *)sender {
- return [[self fetchInfo] objectForKey:@"from"];
+ id tmp;
+
+ if ((tmp = [[self fetchInfo] objectForKey:@"from"]) == nil)
+ return nil;
+ if ([tmp isKindOfClass:[NSArray class]])
+ return [tmp count] > 0 ? [tmp objectAtIndex:0] : nil;
+ return tmp;
}
/* attachments */
}
}
+- (BOOL)isEmptyValue:(id)_value {
+ if (![_value isNotNull])
+ return YES;
+
+ if ([_value isKindOfClass:[NSArray class]])
+ return [_value count] == 0 ? YES : NO;
+
+ if ([_value isKindOfClass:[NSString class]])
+ return [_value length] == 0 ? YES : NO;
+
+ return NO;
+}
+
- (NGMutableHashMap *)mimeHeaderMapWithHeaders:(NSDictionary *)_headers {
NGMutableHashMap *map;
NSDictionary *lInfo; // TODO: this should be some kind of object?
NSArray *emails;
NSString *s;
+ id from, replyTo;
if ((lInfo = [self fetchInfo]) == nil)
return nil;
/* add senders */
- if ([(s = [lInfo objectForKey:@"from"]) length] > 0)
- [map setObject:s forKey:@"from"];
+ from = [lInfo objectForKey:@"from"];
+ replyTo = [lInfo objectForKey:@"replyTo"];
- if ([(s = [lInfo objectForKey:@"replyTo"]) length] > 0)
- [map setObject:s forKey:@"reply-to"];
- else if ([(s = [lInfo objectForKey:@"from"]) length] > 0)
- [map setObject:s forKey:@"reply-to"];
+ if (![self isEmptyValue:from]) {
+ if ([from isKindOfClass:[NSArray class]])
+ [map setObjects:from forKey:@"from"];
+ else
+ [map setObject:from forKey:@"from"];
+ }
+
+ if (![self isEmptyValue:replyTo]) {
+ if ([from isKindOfClass:[NSArray class]])
+ [map setObjects:from forKey:@"reply-to"];
+ else
+ [map setObject:from forKey:@"reply-to"];
+ }
+ else if (![self isEmptyValue:from])
+ [map setObjects:[map objectsForKey:@"from"] forKey:@"reply-to"];
/* add subject */
- (NGImap4Envelope *)envelope {
NSDictionary *lInfo;
+ id from, replyTo;
if (self->envelope != nil)
return self->envelope;
if ((lInfo = [self fetchInfo]) == nil)
return nil;
+ if ((from = [self sender]) != nil)
+ from = [NSArray arrayWithObjects:&from count:1];
+
+ if ((replyTo = [lInfo objectForKey:@"replyTo"]) != nil) {
+ if (![replyTo isKindOfClass:[NSArray class]])
+ replyTo = [NSArray arrayWithObjects:&replyTo count:1];
+ }
+
self->envelope =
[[NGImap4Envelope alloc] initWithMessageID:[self nameInContainer]
subject:[lInfo objectForKey:@"subject"]
- sender:[self sender]
- replyTo:[lInfo objectForKey:@"replyTo"]
+ from:from replyTo:replyTo
to:[lInfo objectForKey:@"to"]
cc:[lInfo objectForKey:@"cc"]
bcc:[lInfo objectForKey:@"bcc"]];
- (NGImap4Envelope *)envelope;
- (NSString *)subject;
- (NSCalendarDate *)date;
-- (NGImap4EnvelopeAddress *)fromEnvelopeAddress;
+- (NSArray *)fromEnvelopeAddresses;
- (NSArray *)toEnvelopeAddresses;
- (NSArray *)ccEnvelopeAddresses;
- (NSCalendarDate *)date {
return [[self envelope] date];
}
-- (NGImap4EnvelopeAddress *)fromEnvelopeAddress {
+- (NSArray *)fromEnvelopeAddresses {
return [[self envelope] from];
}
- (NSArray *)toEnvelopeAddresses {
# Version file
-SUBMINOR_VERSION:=68
+SUBMINOR_VERSION:=69
-# v0.9.55 requires NGExtensions v4.5.136
-# v0.9.44 requires libNGMime v4.3.194
-# v0.9.41 requires libNGMime v4.3.190
-# v0.9.35 requires libSOGoLogic v0.9.24
-# v0.9.34 requires libSOGoLogic v0.9.22
+# v0.9.69 requires libNGMime v4.5.210
+# v0.9.55 requires libNGExtensions v4.5.136
+# v0.9.44 requires libNGMime v4.3.194
+# v0.9.41 requires libNGMime v4.3.190
+# v0.9.35 requires libSOGoLogic v0.9.24
+# v0.9.34 requires libSOGoLogic v0.9.22
2005-02-08 Helge Hess <helge.hess@opengroupware.org>
+ * v0.9.94
+
+ * UIxMailListView.m: properly show "to" address in tableview for
+ Sent folder
+
+ * UIxMailView.m: fixed for new 'from' API
+
* v0.9.93
* mailer.js: work on the read-mail marking code, properly change the
return r;
}
-/* response actions */
+/* reply */
+
+- (BOOL)hasReplyPrefix:(NSString *)_subject {
+ static NSString *replyPrefixes[] = {
+ @"Re:", // regular
+ @"RE:", // Outlook v11 (English?)
+ @"AW:", // German Outlook v11
+ @"Re[", // numbered Re, eg "Re[2]:"
+ nil
+ };
+ unsigned i;
+ for (i = 0; replyPrefixes[i] != nil; i++) {
+ if ([_subject hasPrefix:replyPrefixes[i]])
+ return YES;
+ }
+ return NO;
+}
+
+- (NSString *)replySubject:(NSString *)_subject {
+ if (![_subject isNotNull] || [_subject length] == 0)
+ return _subject;
+
+ if ([self hasReplyPrefix:_subject]) {
+ /* do not do: "Re: Re: Re: My Mail" - a single Re is sufficient ;-) */
+ return _subject;
+ }
+
+ return [@"Re: " stringByAppendingString:_subject];
+}
+
+- (void)fillInReplyAddresses:(NSMutableDictionary *)_info
+ replyToAll:(BOOL)_replyToAll
+ envelope:(NGImap4Envelope *)_envelope
+{
+ /*
+ The rules (as checked against Thunderbird):
+ - if there is a 'reply-to' header, only include that (as TO)
+ - if we reply to all, all non-from addresses are added as CC
+ - the from is always the lone TO (except for reply-to)
+
+ TODO: what about sender (RFC 822 3.6.2)
+ */
+ [self logWithFormat:@"env: %@", _envelope];
+}
- (id)replyToAll:(BOOL)_replyToAll {
+ NSMutableDictionary *info;
NSException *error;
+ id result;
id tmp;
/* ensure mail exists and is filled */
if ((error = [self _setupNewDraft]) != nil)
return error;
+ /* fill draft info */
+
+ info = [NSMutableDictionary dictionaryWithCapacity:16];
+
+ [info setObject:[self replySubject:[[self clientObject] subject]]
+ forKey:@"subject"];
+ [self fillInReplyAddresses:info replyToAll:_replyToAll
+ envelope:[[self clientObject] envelope]];
+
+ /* fill content */
+
+ /* save draft info */
+
+ [self logWithFormat:@"INFO: %@", info];
+
+#if 0
+ if ((error = [self->newDraft storeInfo:info]) != nil)
+ return error;
+#endif
+
#if 0
- [self logWithFormat:@"CORE: %@", [[self clientObject] fetchCoreInfos]];
+ // TODO: we might want to pass the original URL to the editor for a final
+ // redirect back to the message?
+ result = [self redirectToEditNewDraft];
+#else
+ result = [NSException exceptionWithHTTPStatus:501 /* Not Implemented */
+ reason:@"Sorry, reply is not yet implemented!"];
#endif
[self reset];
- return [NSException exceptionWithHTTPStatus:501 /* Not Implemented */
- reason:@"Sorry, reply is not yet implemented!"];
+ return result;
}
- (id)replyAction {
return [self replyToAll:YES];
}
+/* forwarding */
+
- (NSString *)getAttachmentNameForSubject:(NSString *)_subject {
/* SOGoDraftObject disallows some strings - anything else required? */
static NSString *sescape[] = {
return error;
/* set subject (do we need to set anything else?) */
-
+
info = [NSDictionary dictionaryWithObjectsAndKeys:
[self forwardSubject:[[self clientObject] subject]],
@"subject",
}
- (BOOL)showToAddress {
- // TODO: switch for Sent folder
- return NO;
+ NSString *ftype;
+
+ ftype = [[self clientObject] valueForKey:@"outlookFolderClass"];
+ return [ftype isEqual:@"IPF.Sent"];
}
/* title */
return [@"mailto:" stringByAppendingString:[_address baseEMail]];
}
-- (NSString *)fromLink {
- return [self linkToEnvelopeAddress:
- [[self clientObject] fromEnvelopeAddress]];
-}
- (NSString *)currentAddressLink {
return [self linkToEnvelopeAddress:[self currentAddress]];
}
title="panelTitle"
const:hideFolderTree="1"
>
+ <!-- TODO: refactor address rendering into an own component -->
+
<!--
Note: We cannot make this section static (like the toolbar) because the CC
list has a dynamic height (would require some tricky JavaScript).
<tr class="mailer_fieldrow">
<td class="mailer_fieldname" ><var:string label:value="From"/>:</td>
<td class="mailer_fieldvalue">
- <a var:href="fromLink">
- <var:string value="clientObject.fromEnvelopeAddress"
- formatter="context.mailEnvelopeFullAddressFormatter" /></a>
+ <var:foreach list="clientObject.fromEnvelopeAddresses"
+ item="currentAddress">
+ <a var:href="currentAddressLink">
+ <var:string value="currentAddress"
+ formatter="context.mailEnvelopeFullAddressFormatter" /></a>
+ </var:foreach>
</td>
</tr>
<tr class="mailer_fieldrow">
# version file
-SUBMINOR_VERSION:=93
+SUBMINOR_VERSION:=94
+# v0.9.94 requires SoObjects/Mailer v0.9.69
+# v0.9.94 requires libNGMime v4.5.210
# v0.9.91 requires SoObjects/Mailer v0.9.68
# v0.9.89 requires SoObjects/Mailer v0.9.67
# v0.9.87 requires SoObjects/Mailer v0.9.65