org/sonews/mlgw/MailPoller.java
changeset 6 dcc7e491fbc9
parent 1 6fceb66e1ad7
child 8 b62fe6ed39d3
     1.1 --- a/org/sonews/mlgw/MailPoller.java	Fri Jun 26 16:48:50 2009 +0200
     1.2 +++ b/org/sonews/mlgw/MailPoller.java	Thu Aug 06 18:41:34 2009 +0200
     1.3 @@ -19,6 +19,7 @@
     1.4  package org.sonews.mlgw;
     1.5  
     1.6  import java.util.Properties;
     1.7 +import javax.mail.Address;
     1.8  import javax.mail.AuthenticationFailedException;
     1.9  import javax.mail.Authenticator;
    1.10  import javax.mail.Flags.Flag;
    1.11 @@ -29,7 +30,7 @@
    1.12  import javax.mail.PasswordAuthentication;
    1.13  import javax.mail.Session;
    1.14  import javax.mail.Store;
    1.15 -import org.sonews.daemon.Config;
    1.16 +import org.sonews.config.Config;
    1.17  import org.sonews.daemon.AbstractDaemon;
    1.18  import org.sonews.util.Log;
    1.19  import org.sonews.util.Stats;
    1.20 @@ -49,9 +50,9 @@
    1.21      public PasswordAuthentication getPasswordAuthentication()
    1.22      {
    1.23        final String username = 
    1.24 -        Config.getInstance().get(Config.MLPOLL_USER, "user");
    1.25 +        Config.inst().get(Config.MLPOLL_USER, "user");
    1.26        final String password = 
    1.27 -        Config.getInstance().get(Config.MLPOLL_PASSWORD, "mysecret");
    1.28 +        Config.inst().get(Config.MLPOLL_PASSWORD, "mysecret");
    1.29  
    1.30        return new PasswordAuthentication(username, password);
    1.31      }
    1.32 @@ -72,11 +73,11 @@
    1.33          Thread.sleep(60000 * (errors + 1)); // one minute * errors
    1.34          
    1.35          final String host     = 
    1.36 -          Config.getInstance().get(Config.MLPOLL_HOST, "samplehost");
    1.37 +          Config.inst().get(Config.MLPOLL_HOST, "samplehost");
    1.38          final String username = 
    1.39 -          Config.getInstance().get(Config.MLPOLL_USER, "user");
    1.40 +          Config.inst().get(Config.MLPOLL_USER, "user");
    1.41          final String password = 
    1.42 -          Config.getInstance().get(Config.MLPOLL_PASSWORD, "mysecret");
    1.43 +          Config.inst().get(Config.MLPOLL_PASSWORD, "mysecret");
    1.44          
    1.45          Stats.getInstance().mlgwRunStart();
    1.46          
    1.47 @@ -101,10 +102,8 @@
    1.48          // Dispatch messages and delete it afterwards on the inbox
    1.49          for(Message message : messages)
    1.50          {
    1.51 -          String subject = message.getSubject();
    1.52 -          System.out.println("MLGateway: message with subject \"" + subject + "\" received.");
    1.53            if(Dispatcher.toGroup(message)
    1.54 -            || Config.getInstance().get(Config.MLPOLL_DELETEUNKNOWN, false))
    1.55 +            || Config.inst().get(Config.MLPOLL_DELETEUNKNOWN, false))
    1.56            {
    1.57              // Delete the message
    1.58              message.setFlag(Flag.DELETED, true);
    1.59 @@ -132,7 +131,7 @@
    1.60        }
    1.61        catch(InterruptedException ex)
    1.62        {
    1.63 -        System.out.println("sonews: " + this + " returns.");
    1.64 +        System.out.println("sonews: " + this + " returns: " + ex);
    1.65          return;
    1.66        }
    1.67        catch(MessagingException ex)