Author: rdonkin
Date: Sun Oct 28 12:27:42 2007
New Revision: 589398

URL: http://svn.apache.org/viewvc?rev=589398&view=rev
Log:
Bug fixes

Modified:
    
james/server/trunk/imapmailbox-library/src/main/java/org/apache/james/imapserver/store/SimpleMessageAttributes.java

Modified: 
james/server/trunk/imapmailbox-library/src/main/java/org/apache/james/imapserver/store/SimpleMessageAttributes.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/imapmailbox-library/src/main/java/org/apache/james/imapserver/store/SimpleMessageAttributes.java?rev=589398&r1=589397&r2=589398&view=diff
==============================================================================
--- 
james/server/trunk/imapmailbox-library/src/main/java/org/apache/james/imapserver/store/SimpleMessageAttributes.java
 (original)
+++ 
james/server/trunk/imapmailbox-library/src/main/java/org/apache/james/imapserver/store/SimpleMessageAttributes.java
 Sun Oct 28 12:27:42 2007
@@ -210,6 +210,18 @@
             // default value.
             if ( contentEncoding == null ) {
                 contentEncoding = "7BIT";
+            } else if (contentEncoding.equalsIgnoreCase("binary")) {
+                // IMAP specifies upper case
+                contentEncoding = "BINARY";
+            } else if (contentEncoding.equalsIgnoreCase("base64")) {
+                // IMAP specifies upper case
+                contentEncoding = "BASE64";
+            } else if (contentEncoding.equalsIgnoreCase("quoted-printable")) {
+                // IMAP specifies upper case
+                contentEncoding = "QUOTED-PRINTABLE";
+            } else if (contentEncoding.equalsIgnoreCase("7bit")) {
+                // IMAP specifies upper case
+                contentEncoding = "7BIT";
             }
         } catch (MessagingException me) {
             getLogger().debug("Messaging Exception for getEncoding(): " + me, 
me);
@@ -225,6 +237,9 @@
         try {
             // TODO this doesn't work
             lineCount = part.getLineCount();
+            if (lineCount < 1) {
+                lineCount = 1;
+            }
         } catch (MessagingException me) {
             getLogger().debug("Messaging Exception for getLineCount(): " + me, 
me);
         } catch (Exception e) {
@@ -522,7 +537,16 @@
             buf.append(Q + contentEncoding + Q);
         }
         buf.append(SP);
-        buf.append(size);
+        if (size < 1)
+        {
+            buf.append(1); 
+        }
+        else
+        {
+            // TODO This uses the total size of the message. 
+            // This should be the octet count of the mime part
+            buf.append(size);
+        }
         return buf.toString();
     }
 
@@ -559,7 +583,17 @@
                     setupLogger(parts[i]); // reset transient getLogger()
                     buf.append(parts[i].getBodyStructure( false ));
                 }
-                buf.append(SP + secondaryType);
+                buf.append(SP);
+                buf.append('"');
+                buf.append(secondaryType.toUpperCase());
+                buf.append('"');
+            } else {
+                // TODO: the specification requires that we handle other types
+                // TODO: including APPLICATION AUDIO IMAGE 
+                // TODO: should also include messages not in RFC288 meethinks
+                getLogger().info("Ignoring unknown type");
+                getLogger().debug(primaryType);
+                getLogger().debug(secondaryType);
             }
             buf.append(RB);
             return buf.toString();



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to