Update of /var/cvs/applications/email/src/org/mmbase/applications/email
In directory 
james.mmbase.org:/tmp/cvs-serv25490/src/org/mmbase/applications/email

Modified Files:
        SendMail.java 
Log Message:
some things were ported from Didactor, which uses a field 'type', but the 
default email builder has 'mailtype' instead. wtf.


See also: 
http://cvs.mmbase.org/viewcvs/applications/email/src/org/mmbase/applications/email


Index: SendMail.java
===================================================================
RCS file: 
/var/cvs/applications/email/src/org/mmbase/applications/email/SendMail.java,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- SendMail.java       25 Nov 2008 10:04:25 -0000      1.54
+++ SendMail.java       27 Nov 2008 10:26:28 -0000      1.55
@@ -32,7 +32,7 @@
  * @author Daniel Ockeloen
  * @author Johannes Verelst <[EMAIL PROTECTED]>
  * @since  MMBase-1.6
- * @version $Id: SendMail.java,v 1.54 2008/11/25 10:04:25 michiel Exp $
+ * @version $Id: SendMail.java,v 1.55 2008/11/27 10:26:28 michiel Exp $
  */
 public class SendMail extends AbstractSendMail {
     private static final Logger log = 
Logging.getLoggerInstance(SendMail.class);
@@ -48,6 +48,8 @@
 
     private Pattern onlyToPattern = MATCH_ALL;
 
+    private String typeField = "mailtype";
+
     public SendMail() {
         this(null);
     }
@@ -117,7 +119,7 @@
             NodeList mailboxes = person.getRelatedNodes("mailboxes");
             for (int j = 0; j < mailboxes.size(); j++) {
                 Node mailbox = mailboxes.getNode(j);
-                if (mailbox.getIntValue("type") == 0) {
+                if (mailbox.getIntValue(typeField) == 0) {
                     log.debug("Found mailbox, adding mail now");
                     Node emailNode = emailManager.createNode();
                     emailNode.setValue("to", n.getValue("to"));
@@ -132,7 +134,7 @@
                     if (emailNode.getNodeManager().hasField("mimetype")) {
                         emailNode.setValue("mimetype", n.getValue("mimetype"));
                     }
-                    emailNode.setIntValue("type", 2);
+                    emailNode.setIntValue(typeField, 2);
                     emailNode.commit();
                     log.debug("Appending " + emailNode + " to " + 
mailbox.getNumber());
                     mailbox.createRelation(emailNode, relatedManager).commit();
@@ -199,7 +201,7 @@
                     if (emailManager.hasField("mimetype")) {
                         error.setValue("mimetype", "text/plain");
                     }
-                    error.setIntValue("type", 1);
+                    error.setIntValue(typeField, 1);
                     error.commit();
                     log.debug("Ready sending error mail about " + failedUsers);
                 } catch (Exception e) {
@@ -308,6 +310,12 @@
             }
         }
 
+        {
+            String i = getInitParameter("emailbuilder.typefield");
+            if (i != null && ! "".equals(i)) {
+                typeField = i;
+            }
+        }
         //java.security.Security.addProvider(new 
com.sun.net.ssl.internal.ssl.Provider());
 
         session = null;
@@ -472,6 +480,8 @@
     }
 
 
+
+
     /**
      *  @since MMBase-1.9
      */
@@ -675,7 +685,7 @@
                 errorNode.setStringValue("to", n.getStringValue("from"));
                 errorNode.setStringValue("from", n.getStringValue("from"));
                 errorNode.setStringValue("subject", "****");
-                errorNode.setIntValue("type", 1);
+                errorNode.setIntValue(typeField, 1);
                 errorNode.setStringValue("body", errors.toString());
                 errorNode.commit();
                 log.service("Sent node " + errorNode.getNumber());
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to