]> err.no Git - sope/commitdiff
NGImap4Envelope constructor
authorhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Thu, 28 Oct 2004 15:07:35 +0000 (15:07 +0000)
committerhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Thu, 28 Oct 2004 15:07:35 +0000 (15:07 +0000)
git-svn-id: http://svn.opengroupware.org/SOPE/trunk@324 e4a50df8-12e2-0310-a44c-efbce7f8a7e3

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

index 0bf3cfb09bc17a798a143c928309ffb711af71a9..89d2eb4aa040f368c81161f8600970b607a0ec17 100644 (file)
@@ -1,3 +1,7 @@
+2004-10-28  Helge Hess  <helge.hess@skyrix.com>
+
+       * NGImap4: added a constructor to NGImap4Envelope (v4.3.194)
+
 2004-10-27  Helge Hess  <helge.hess@opengroupware.org>
 
        * NGImap4: enhanced NGImap4EnvelopeAddress (v4.3.193)
index bdf16d5a4ebb5a9f130e7e5dce58dee926b31908..283277ae76bf99fbf59d484759a5aeaaef07ad3e 100644 (file)
@@ -1,3 +1,8 @@
+2004-10-28  Helge Hess  <helge.hess@skyrix.com>
+       
+       * NGImap4Envelope.m: added constructor method:
+         -initWithMessageID:subject:sender:replyTo:to:cc:bcc:
+       
 2004-10-27  Helge Hess  <helge.hess@opengroupware.org>
 
        * NGImap4EnvelopeAddress.m: added -initWithString: method (not properly
index 8a0e5ea2b4393aa3879440c76e099be928a8c4a1..4777db83ab3939c116e0cf0e1c537eeb0e8bebd4 100644 (file)
   NSArray *bcc;
 }
 
+- (id)initWithMessageID:(NSString *)_msgID subject:(NSString *)_subject
+  sender:(id)_sender replyTo:(id)_replyTo
+  to:(NSArray *)_to cc:(NSArray *)_cc bcc:(NSArray *)_bcc;
+
 /* accessors */
 
 - (NSCalendarDate *)date;
index cbeb169024807e4b446e1a3117500e7994aa53af..8b24928e3104909080f687cf54b6e94ae6a98ae3 100644 (file)
 
 @implementation NGImap4Envelope
 
+- (id)newEnvelopeAddressForEMail:(id)_email {
+  if (![_email isNotNull])
+    return nil;
+  
+  if ([_email isKindOfClass:[NGImap4EnvelopeAddress class]])
+    return [_email copy];
+  
+  _email = [_email stringValue];
+  if ([_email length] == 0)
+    return nil;
+  return [[NGImap4EnvelopeAddress alloc] initWithString:_email];
+}
+- (NSArray *)envelopeAddressesForEMails:(NSArray *)_emails {
+  NSMutableArray *ma;
+  unsigned i, count;
+  
+  if (_emails == nil)
+    return nil;
+  if ((count = [_emails count]) == 0)
+    return [NSArray array];
+  
+  ma = [NSMutableArray arrayWithCapacity:count];
+  for (i = 0; i < count; i++) {
+    NGImap4EnvelopeAddress *envaddr;
+    
+    envaddr = [self newEnvelopeAddressForEMail:[_emails objectAtIndex:i]];
+    if (![envaddr isNotNull])
+      continue;
+    
+    [ma addObject:envaddr];
+    [envaddr release];
+  }
+  return ma;
+}
+
+- (id)initWithMessageID:(NSString *)_msgID subject:(NSString *)_subject
+  sender:(id)_sender replyTo:(id)_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];
+  }
+  return self;
+}
+
 - (void)dealloc {
   [self->date      release];
   [self->subject   release];
index 4be618feb31d062b8c8af15f901f64e0983ef9f1..a1f50532ebf1d34862486870d3c976d2da3b0b53 100644 (file)
@@ -2,6 +2,6 @@
 
 MAJOR_VERSION:=4
 MINOR_VERSION:=3
-SUBMINOR_VERSION:=193
+SUBMINOR_VERSION:=194
 
 # v4.2.149 requires libNGStreams v4.2.34