]> err.no Git - sope/commitdiff
fixed API of the NGImap4Envelope (from/reply-to are multivalue fields!)
authorhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Tue, 8 Feb 2005 17:04:34 +0000 (17:04 +0000)
committerhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Tue, 8 Feb 2005 17:04:34 +0000 (17:04 +0000)
git-svn-id: http://svn.opengroupware.org/SOPE/trunk@542 e4a50df8-12e2-0310-a44c-efbce7f8a7e3

sope-mime/ChangeLog
sope-mime/NGImap4/ChangeLog
sope-mime/NGImap4/NGImap4Envelope.h
sope-mime/NGImap4/NGImap4Envelope.m
sope-mime/NGImap4/NGImap4ResponseParser.m
sope-mime/Version

index a86a36317ef8d3f1eb757ba0b7b2834f0701a046..e10fe0157cf8818db6d17420a255056f6ff87ec3 100644 (file)
@@ -1,3 +1,8 @@
+2005-02-08  Helge Hess  <helge.hess@opengroupware.org>
+
+       * NGImap4: change in API: NGImap4Envelope now uses lists for 'from'
+         and 'reply-to' headers (v4.5.210)
+
 2005-01-31  Helge Hess  <helge.hess@opengroupware.org>
 
        * NGImap4: added support for creating envelope objects from body
index 4f5e08b1292c7669d7c09f584c7f9ea66b74c5a0..16d4b69110b31a9713f88905420687d75dc629e9 100644 (file)
@@ -1,3 +1,11 @@
+2005-02-08  Helge Hess  <helge.hess@opengroupware.org>
+
+       * NGImap4ResponseParser.m: properly parse from/reply-to as lists
+
+       * NGImap4Envelope.m: properly use NSArray for 'from' and 'reply-to',
+         both can be multi valued (only 'sender' is a single mailbox in RFC
+         2822, 3.6.2) - Note: might break API!
+       
 2005-01-31  Helge Hess  <helge.hess@opengroupware.org>
 
        * NGImap4Envelope.m, NGImap4EnvelopeAddress.m: added support for
index 484f218ffafdb85a9791440d31f454cbcc6d75f0..c5e2dbcd028a183e60c47dd5dbe8bb888e186de7 100644 (file)
   id                     subject; /* can be either NSData or NSString */
   NSString               *inReplyTo;
   NSString               *msgId;
-  NGImap4EnvelopeAddress *from;
   NGImap4EnvelopeAddress *sender;
-  NGImap4EnvelopeAddress *replyTo;
+  NSArray *from;
+  NSArray *replyTo;
   NSArray *to;
   NSArray *cc;
   NSArray *bcc;
 }
 
 - (id)initWithMessageID:(NSString *)_msgID subject:(NSString *)_subject
-  sender:(id)_sender replyTo:(id)_replyTo
+  from:(NSArray *)_sender replyTo:(NSArray *)_replyTo
   to:(NSArray *)_to cc:(NSArray *)_cc bcc:(NSArray *)_bcc;
 
 - (id)initWithBodyStructureInfo:(NSDictionary *)_info;
@@ -60,9 +60,9 @@
 - (id)subject;
 - (NSString *)inReplyTo;
 - (NSString *)messageID;
-- (NGImap4EnvelopeAddress *)from;
 - (NGImap4EnvelopeAddress *)sender;
-- (NGImap4EnvelopeAddress *)replyTo;
+- (NSArray *)from;
+- (NSArray *)replyTo;
 - (NSArray *)to;
 - (NSArray *)cc;
 - (NSArray *)bcc;
index d774dfe5c84c1d51141daf7fdb19598e88bb912b..2590d1dfb341b04c458822bb4bf50058f33840cd 100644 (file)
@@ -76,42 +76,34 @@ static NGMimeRFC822DateHeaderFieldParser *dateParser = nil;
 }
 
 - (id)initWithMessageID:(NSString *)_msgID subject:(NSString *)_subject
-  sender:(id)_sender replyTo:(id)_replyTo
+  from:(NSArray *)_from replyTo:(NSArray *)_replyTo
   to:(NSArray *)_to cc:(NSArray *)_cc bcc:(NSArray *)_bcc
 {
   if ((self = [self init])) {
     self->msgId   = [_msgID copy];
     self->subject = [_subject copy];
     
-    self->from    = [self newEnvelopeAddressForEMail:_sender];
-    self->replyTo = [self newEnvelopeAddressForEMail:_replyTo];
-    
-    self->to  = [[self envelopeAddressesForEMails:_to]  copy];
-    self->cc  = [[self envelopeAddressesForEMails:_cc]  copy];
-    self->bcc = [[self envelopeAddressesForEMails:_bcc] copy];
+    self->from    = [[self envelopeAddressesForEMails:_from]    copy];
+    self->replyTo = [[self envelopeAddressesForEMails:_replyTo] copy];
+    self->to      = [[self envelopeAddressesForEMails:_to]      copy];
+    self->cc      = [[self envelopeAddressesForEMails:_cc]      copy];
+    self->bcc     = [[self envelopeAddressesForEMails:_bcc]     copy];
   }
   return self;
 }
 
 - (id)initWithBodyStructureInfo:(NSDictionary *)_info {
-  id lFrom, lReplyTo, lDate;
+  id lDate;
   
   if (![_info isNotNull]) {
     [self release];
     return nil;
   }
-
-  lFrom    = [_info valueForKey:@"from"];
-  lReplyTo = [_info valueForKey:@"reply-to"];
-
-  if ([lFrom isKindOfClass:[NSArray class]])
-    lFrom = [lFrom count] > 0 ? [lFrom objectAtIndex:0] : nil;
-  if ([lReplyTo isKindOfClass:[NSArray class]])
-    lReplyTo = [lReplyTo count] > 0 ? [lReplyTo objectAtIndex:0] : nil;
   
   self = [self initWithMessageID:[_info valueForKey:@"messageId"]
               subject:[_info valueForKey:@"subject"]
-              sender:lFrom replyTo:lReplyTo
+              from:[_info valueForKey:@"from"]
+              replyTo:[_info valueForKey:@"reply-to"]
               to:[_info valueForKey:@"to"]
               cc:[_info valueForKey:@"cc"]
               bcc:[_info valueForKey:@"bcc"]];
@@ -159,13 +151,13 @@ static NGMimeRFC822DateHeaderFieldParser *dateParser = nil;
 - (NSString *)messageID {
   return self->msgId;
 }
-- (NGImap4EnvelopeAddress *)from {
+- (NSArray *)from {
   return self->from;
 }
 - (NGImap4EnvelopeAddress *)sender {
   return self->sender;
 }
-- (NGImap4EnvelopeAddress *)replyTo {
+- (NSArray *)replyTo {
   return self->replyTo;
 }
 - (NSArray *)to {
@@ -203,8 +195,9 @@ static NGMimeRFC822DateHeaderFieldParser *dateParser = nil;
   if (self->msgId)     [ms appendFormat:@" msgid='%@'",     self->msgId];
   if (self->inReplyTo) [ms appendFormat:@" inreplyto='%@'", self->inReplyTo];
   
-  if (self->from)   [ms appendFormat:@" from=%@",   [self->from   email]];
-  if (self->sender) [ms appendFormat:@" sender=%@", [self->sender email]];
+  if (self->from)    [ms appendFormat:@" from=%@",     self->from];
+  if (self->replyTo) [ms appendFormat:@" reply-to=%@", self->replyTo];
+  if (self->sender)  [ms appendFormat:@" sender=%@",   [self->sender email]];
   
   if (self->to)  [ms appendFormat:@" to=%@",  self->to];
   if (self->cc)  [ms appendFormat:@" cc=%@",  self->cc];
index 7fd988d7955a30229f7cb8a6ecef51ed422d492e..561f247d4b215d157f88382e3710bc5c4f88aa2b 100644 (file)
@@ -1179,7 +1179,7 @@ static BOOL _parseThreadResponse(NGImap4ResponseParser *self,
   /* parse addresses */
   
   if ((tmp = [self _parseEnvelopeAddressStructures]) != nil) {
-    env->from = [tmp isNotNull] ? [[tmp lastObject] copy] : nil;
+    env->from = [tmp isNotNull] ? [tmp copy] : nil;
     [self _consumeOptionalSpace];
   }
   else {
@@ -1195,7 +1195,7 @@ static BOOL _parseThreadResponse(NGImap4ResponseParser *self,
     return nil;
   }
   if ((tmp = [self _parseEnvelopeAddressStructures]) != nil) {
-    env->replyTo = [tmp isNotNull] ? [[tmp lastObject] copy] : nil;
+    env->replyTo = [tmp isNotNull] ? [tmp copy] : nil;
     [self _consumeOptionalSpace];
   }
   
index 87dde2f4fa0d2e5a4bf075edbb0b1f8ba9f765d8..4d323dc011b99fca82a9297168614895541a3557 100644 (file)
@@ -2,6 +2,6 @@
 
 MAJOR_VERSION:=4
 MINOR_VERSION:=5
-SUBMINOR_VERSION:=209
+SUBMINOR_VERSION:=210
 
 # v4.2.149 requires libNGStreams v4.2.34