]> err.no Git - scalable-opengroupware.org/commitdiff
fixed a bug with nested multiparts
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 6 Jul 2005 21:21:38 +0000 (21:21 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 6 Jul 2005 21:21:38 +0000 (21:21 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@677 d1b88da0-ebda-0310-925b-ed51d893ca5b

SOGo/UI/MailPartViewers/ChangeLog
SOGo/UI/MailPartViewers/UIxMailRenderingContext.h
SOGo/UI/MailPartViewers/UIxMailRenderingContext.m
SOGo/UI/MailPartViewers/Version

index b3fc742dac0424ff0043f200d9a3fb5b99c25498..3fd993450238fe76f3b0fb8e6b2501d9e8cddf51 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-06  Helge Hess  <helge.hess@opengroupware.org>
+
+       * UIxMailRenderingContext.m: fixed a bug when rendering nested
+         multiparts (cannot be cached) (v0.9.5)
+
 2005-06-24  Helge Hess  <helge.hess@opengroupware.org>
 
        * UIxMailPartLinkViewer.m: fixed an exception on Cocoa when a mail is
index fa1fbffcd2b0e6603fa1ecfeac53ab2d3d376d8f..13c92f539b53e485c8e04ba7657d5830bf982b59 100644 (file)
   WOContext    *context;      /* non-retained! */
   NSDictionary *flatContents; /* IMAP4 name to NSData */
 
-  WOComponent *alternativeViewer;
-  WOComponent *mixedViewer;
-  WOComponent *textViewer;
-  WOComponent *imageViewer;
-  WOComponent *linkViewer;
-  WOComponent *messageViewer;
-  WOComponent *iCalViewer;
-  WOComponent *htmlViewer;
+  WOComponent  *textViewer;
+  WOComponent  *imageViewer;
+  WOComponent  *linkViewer;
+  WOComponent  *messageViewer;
+  WOComponent  *iCalViewer;
+  WOComponent  *htmlViewer;
 }
 
 - (id)initWithViewer:(WOComponent *)_viewer context:(WOContext *)_ctx;
index 2ee998f59b4b7b13a1852c2bdedae1ee57c95ff5..a058fc9f7e98743a48d3f063a03405f75f15eb2b 100644 (file)
 }
 
 - (void)dealloc {
-  [self->alternativeViewer release];
-  [self->iCalViewer        release];
-  [self->htmlViewer        release];
-  [self->mixedViewer   release];
+  [self->iCalViewer    release];
+  [self->htmlViewer    release];
   [self->textViewer    release];
   [self->imageViewer   release];
   [self->linkViewer    release];
 /* resetting state */
 
 - (void)reset {
-  [self->flatContents      release]; self->flatContents      = nil;
-  [self->alternativeViewer release]; self->alternativeViewer = nil;
-  [self->mixedViewer       release]; self->mixedViewer       = nil;
-  [self->textViewer        release]; self->textViewer        = nil;
-  [self->htmlViewer        release]; self->htmlViewer        = nil;
-  [self->imageViewer       release]; self->imageViewer       = nil;
-  [self->linkViewer        release]; self->linkViewer        = nil;
-  [self->messageViewer     release]; self->messageViewer     = nil;
-  [self->iCalViewer        release]; self->iCalViewer        = nil;
+  [self->flatContents  release]; self->flatContents  = nil;
+  [self->textViewer    release]; self->textViewer    = nil;
+  [self->htmlViewer    release]; self->htmlViewer    = nil;
+  [self->imageViewer   release]; self->imageViewer   = nil;
+  [self->linkViewer    release]; self->linkViewer    = nil;
+  [self->messageViewer release]; self->messageViewer = nil;
+  [self->iCalViewer    release]; self->iCalViewer    = nil;
 }
 
 /* fetching */
 /* viewer components */
 
 - (WOComponent *)mixedViewer {
-  if (self->mixedViewer == nil) {
-    self->mixedViewer =
-      [[self->viewer pageWithName:@"UIxMailPartMixedViewer"] retain];
-  }
-  return self->mixedViewer;
+  /* Note: we cannot cache the multipart viewers, because it can be nested */
+  return [self->viewer pageWithName:@"UIxMailPartMixedViewer"];
+}
+
+- (WOComponent *)signedViewer {
+  /* Note: we cannot cache the multipart viewers, because it can be nested */
+  // TODO: temporary workaround (treat it like a plain mixed part)
+  return [self mixedViewer];
 }
 
 - (WOComponent *)alternativeViewer {
-  if (self->alternativeViewer == nil) {
-    self->alternativeViewer =
-      [[self->viewer pageWithName:@"UIxMailPartAlternativeViewer"] retain];
-  }
-  return self->alternativeViewer;
+  /* Note: we cannot cache the multipart viewers, because it can be nested */
+  return [self->viewer pageWithName:@"UIxMailPartAlternativeViewer"];
 }
 
 - (WOComponent *)textViewer {
   if ([mt isEqualToString:@"multipart"]) {
     if ([st isEqualToString:@"mixed"])
       return [self mixedViewer];
-    if ([st isEqualToString:@"signed"]) // TODO: temporary workaround
-      return [self mixedViewer];
+    if ([st isEqualToString:@"signed"])
+      return [self signedViewer];
     if ([st isEqualToString:@"alternative"])
       return [self alternativeViewer];
   }
   else if ([mt isEqualToString:@"message"] && [st isEqualToString:@"rfc822"])
     return [self messageViewer];
   else if ([mt isEqualToString:@"application"]) {
-    /*
-      octet-stream (generate download link?, autodetect type?)
-      pgp-viewer
-    */
+    // octet-stream (generate download link?, autodetect type?)
+    
+#if 0 /* the link viewer looks better than plain text ;-) */
+    if ([st isEqualToString:@"pgp-signature"]) // TODO: real PGP viewer
+      return [self textViewer];
+#endif
   }
 
   // TODO: always fallback to octet viewer?!
-#if 0
+#if 1
   [self errorWithFormat:@"found no viewer for MIME type: %@/%@", mt, st];
 #endif
   return [self linkViewer];
index 8c2f39ca00706901a3c707d87173d97ddab61262..abdb91ce265dc308b82c246aad050519240f0733 100644 (file)
@@ -1,5 +1,5 @@
 # version file
 
-SUBMINOR_VERSION:=4
+SUBMINOR_VERSION:=5
 
 # v0.9.1 requires libNGMime v4.5.213