[Commits] (bkirsch) Update account and mail logic

commits at osafoundation.org commits at osafoundation.org
Tue Aug 17 14:47:59 PDT 2004


Commit by: bkirsch
Modified files:
chandler/parcels/osaf/mail/common.py 1.3 1.4
chandler/parcels/osaf/mail/imap.py 1.9 1.10
chandler/parcels/osaf/mail/message.py 1.10 1.11
chandler/parcels/osaf/mail/parcel.xml 1.14 1.15

Log message:
Update account and mail logic

ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/mail/common.py.diff?r1=text&tr1=1.3&r2=text&tr2=1.4
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/mail/imap.py.diff?r1=text&tr1=1.9&r2=text&tr2=1.10
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/mail/message.py.diff?r1=text&tr1=1.10&r2=text&tr2=1.11
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/mail/parcel.xml.diff?r1=text&tr1=1.14&r2=text&tr2=1.15

Index: chandler/parcels/osaf/mail/common.py
diff -u chandler/parcels/osaf/mail/common.py:1.3 chandler/parcels/osaf/mail/common.py:1.4
--- chandler/parcels/osaf/mail/common.py:1.3	Mon Aug 16 16:50:54 2004
+++ chandler/parcels/osaf/mail/common.py	Tue Aug 17 14:47:57 2004
@@ -1,5 +1,5 @@
-__revision__  = "$Revision: 1.3 $"
-__date__      = "$Date: 2004/08/16 23:50:54 $"
+__revision__  = "$Revision: 1.4 $"
+__date__      = "$Date: 2004/08/17 21:47:57 $"
 __copyright__ = "Copyright (c) 2004 Open Source Applications Foundation"
 __license__   = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -12,10 +12,20 @@
 
 CHANDLER_USERAGENT = "Open Source Applications Foundation Chandler .4B Release"
 CHANDLER_HEADER_PREFIX = "X-Chandler-"
-ATTACHMENT_BODY_WARNING = "The body of this message consists of Multiple Mime Parts.\nFor .4B Chandler does not support MIME Parts"
+ATTACHMENT_BODY_WARNING = "\tThe body of this message consists of Multiple Mime Parts.\n\tFor .4B Chandler does not support MIME Parts"
+
+"""MIME TYPE SPECS"""
 
 MIME_TEXT_PLAIN = "text/plain"
 
+MIME_TEXT = ["plain", "html", "enriched", "sgml", "richtext", "rfc-headers"]
+MIME_BINARY = ["image", "application", "audio", "video"]
+MIME_SECURITY = ["encrypted", "signed"]
+MIME_CONTAINER = ["alternative", "parallel", "related", "report", "partial", "digest"]
+
+class MailException(Exception):
+    pass
+
 def getChandlerTransportMessage():
     message = """Subject: ***FOR CHANDLER INTERNAL USE - DO NOT DELETE ***
 

Index: chandler/parcels/osaf/mail/imap.py
diff -u chandler/parcels/osaf/mail/imap.py:1.9 chandler/parcels/osaf/mail/imap.py:1.10
--- chandler/parcels/osaf/mail/imap.py:1.9	Mon Aug 16 16:50:54 2004
+++ chandler/parcels/osaf/mail/imap.py	Tue Aug 17 14:47:57 2004
@@ -1,5 +1,5 @@
-__revision__  = "$Revision: 1.9 $"
-__date__      = "$Date: 2004/08/16 23:50:54 $"
+__revision__  = "$Revision: 1.10 $"
+__date__      = "$Date: 2004/08/17 21:47:57 $"
 __copyright__ = "Copyright (c) 2004 Open Source Applications Foundation"
 __license__   = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -17,6 +17,7 @@
 import email.Utils as Utils
 import logging as logging
 import repository.util.UUID as UUID
+import common as common
 
 #XXX: Need to make sure all the flags are in place to prevent a non-ssl session if 
 #     ssl required
@@ -97,7 +98,7 @@
         logging.error("Unable to connect to server; reason: '%s'", reason)
 
 
-class MailException(Exception):
+class IMAPMailException(common.MailException):
     pass
 
 class IMAPDownloader(RepositoryView.AbstractRepositoryViewManager):
@@ -111,7 +112,7 @@
         """
 
         if account is None:
-            raise MailException("You must pass in a Mail Account instance")
+            raise IMAPMailException("You must pass in a Mail Account instance")
 
         viewName = "%s_%s" % (account.displayName, str(UUID.UUID()))
         super(IMAPDownloader, self).__init__(Globals.repository, viewName)
@@ -326,10 +327,15 @@
 
             for msg in msgs:
                 repMessage = message.messageTextToKind(msgs[msg]['RFC822'])
-                self.account.downloadedMail.append(repMessage)
-
                 uid = long(msgs[msg]['UID'])
 
+                repMessage.incomingMessage(account=self.account)
+
+                repMessage.deliveryExtension.folder = "INBOX"
+                repMessage.deliveryExtension.uid = uid
+
+                self.account.downloadedMail.append(repMessage)
+
                 if uid > self.__getLastUID():
                     self.__setLastUID(uid)
                     totalDownloaded += 1

Index: chandler/parcels/osaf/mail/parcel.xml
diff -u chandler/parcels/osaf/mail/parcel.xml:1.14 chandler/parcels/osaf/mail/parcel.xml:1.15
--- chandler/parcels/osaf/mail/parcel.xml:1.14	Fri Aug 13 14:08:59 2004
+++ chandler/parcels/osaf/mail/parcel.xml	Tue Aug 17 14:47:57 2004
@@ -1,20 +1,39 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<core:Parcel itsName="mail"
-             xmlns:core="http://osafoundation.org/parcels/core"
+<Parcel itsName="mail"
+             xmlns="http://osafoundation.org/parcels/core"
              xmlns:content="http://osafoundation.org/parcels/osaf/contentmodel/mail"
              xmlns:mail="http://osafoundation.org/parcels/osaf/mail"
              xmlns:task="http://osafoundation.org/parcels/osaf/framework/tasks">
 
-  <content:IMAPAccount itsName="IMAPAccount One">
-    <content:displayName>IMAP Server Account One</content:displayName>
-    <content:host>code-bear.com</content:host>
-    <content:username>osafuser</content:username>
-    <content:password>chandler</content:password>
-    <content:port>143</content:port>
-    <content:useSSL>NoSSL</content:useSSL>
+  <content:IMAPAccount itsName="IMAPAccountOne">
+    <displayName>IMAP Server Account One</displayName>
+    <host>code-bear.com</host>
+    <username>osafuser</username>
+    <password>chandler</password>
+    <useSSL>NoSSL</useSSL>
+    <!-- This points replyToAddress to the email address item below-->
+    <replyToAddress ref="mail:ReplyAddress" />
+    <!-- This points to the SMTPAccount item below -->
+    <defaultSMTPAccount ref="mail:SMTPAccountOne" />
   </content:IMAPAccount>
 
+  <content:EmailAddress itsName="ReplyAddress">
+    <emailAddress value="osafuser at code-bear.com" />
+    <fullName value="OSAFTest Account" />
+  </content:EmailAddress>
+
+
+  <content:SMTPAccount itsName="SMTPAccountOne">
+    <displayName>SMTP Server Account One</displayName>
+    <host>code-bear.com</host>
+    <username>osafuser</username>
+    <password>chandler</password>
+    <useSSL>NoSSL</useSSL>
+    <useAuth>False</useAuth>
+  </content:SMTPAccount>
+
+
   <task:Task itsName="IMAPMailClient">
     <task:Schedule itsName="MailSchedule">
       <task:startTime>2003-11-11 11:11:11+0800</task:startTime>
@@ -38,4 +57,4 @@
     <task:actions itemref="mail:SMTPClient/sendmail"/-->
   </task:Task>
 
-</core:Parcel>
+</Parcel>

Index: chandler/parcels/osaf/mail/message.py
diff -u chandler/parcels/osaf/mail/message.py:1.10 chandler/parcels/osaf/mail/message.py:1.11
--- chandler/parcels/osaf/mail/message.py:1.10	Mon Aug 16 16:50:54 2004
+++ chandler/parcels/osaf/mail/message.py	Tue Aug 17 14:47:57 2004
@@ -1,5 +1,5 @@
-__revision__  = "$Revision: 1.10 $"
-__date__      = "$Date: 2004/08/16 23:50:54 $"
+__revision__  = "$Revision: 1.11 $"
+__date__      = "$Date: 2004/08/17 21:47:57 $"
 __copyright__ = "Copyright (c) 2004 Open Source Applications Foundation"
 __license__   = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -209,12 +209,16 @@
     if messageObject.is_multipart():
         mimeParts = messageObject.get_payload()
         found = False
+        m.hasMimeParts = True
+        m.mimeParts = []
 
         for mimePart in mimeParts:
             if isPlainTextContentType(mimePart.get_content_type()):
                 m.body = strToText(m, "body",  mimePart.get_payload())
                 found = True
 
+
+
         if not found:
             m.body = strToText(m, "body", common.ATTACHMENT_BODY_WARNING)
 



More information about the Commits mailing list