Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: joist/java/org/joist/mail AddToList.java

Project highlights: Architectural Overview

joist
Discussion topic

Back to topic list

CVS update: joist/java/org/joist/mail AddToList.java

Author commitlogger at hocus dot collab dot net
Full name commitlogger at hocus dot collab dot net
Date 2000-04-17 20:40:40 PDT
Message User: dlr
  Date: 00/04/17 20:40:40

  Modified: java/org/joist/mail AddToList.java
  Log:
  Somebody likes to code Linux kernel sytle.
  
  Revision Changes Path
  1.4 +55 -16 joist/java/org/joist​/mail/AddToList.java​
  
  Index: AddToList.java
  ====================​====================​====================​=======
  RCS file: /cvs/joist/java/org/​joist/mail/AddToList​.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AddToList.java 2000/02/29 01:23:57 1.3
  +++ AddToList.java 2000/04/18 03:40:40 1.4
  @@ -52,43 +52,61 @@
   import org.webmacro.util.*;
   
   /**
  - * Utility for adding registered users to a mail listing, if
  - * they're not already there.
  - *
  - * @author C. Ludewig
  - * @version $Revision: 1.3 $
  - *
  - * Copyright (c) 1999 Collab.Net, Inc.
  - */
  + * Utility for adding registered users to a mail listing, if
  + * they're not already there.
  + *
  + * @author C. Ludewig
  + * @version $Revision: 1.4 $
  + *
  + * Copyright (c) 1999, 2000 Collab.Net, Inc.
  + */
   public class AddToList
   {
       static private Log log = new Log("add2lst", "AddToList");
       static private boolean debug = true;
   
  + /**
  + * Minimum number of arguments accepted by the main() method.
  + */
  + protected static final int MIN_NBR_ARGS = 5;
  +
       private static Emailer emailer = new Emailer();
       private static MailListManager mailMgr = new MailListManager(null);
       private static String sender;
       private static String subject;
       private static String message;
   
  + /**
  + * The program entry point.
  + *
  + * @param args The program arguments, of which there need to be at
  + * least MIN_NBR_ARGS.
  + */
       public static void main(String args[])
           throws IOException, MailListException
       {
  - if (args.length < 5)
  + if (args.length < MIN_NBR_ARGS)
           {
  - System.err.println("usage: AddToList sender subject msgfile list user ...");
  + System.err.println("usage: AddToList sender subject " +
  + "msgfile list user ...");
               System.exit(1);
           }
           sender = args[0];
           subject = args[1];
           message = readFile(args[2]);
           String list = args[3];
  - Vector users = new Vector(args.length-1);
  - for (int i = 4; i < args.length; i++)
  + Vector users = new Vector(args.length - 1);
  + for (int i = MIN_NBR_ARGS - 1; i < args.length; i++)
               users.addElement(args[i]);
           addToList(list, users);
       }
   
  + /**
  + * Adds users to the specified mailing list.
  + *
  + * @param list The mailing list to which to add the users.
  + * @param users The users to add.
  + */
       private static void addToList(String list, Vector users)
           throws MailListException
       {
  @@ -99,16 +117,25 @@
               String user = (String)e.nextElement();
               if (members.get(user) == null)
               {
  - if (debug) System.out.println("Adding " + user);
  + if (debug)
  + System.out.println("Adding " + user);
                   addUser(list, user);
               }
               else
               {
  - if (debug) System.out.println("Already on the list: " + user);
  + if (debug)
  + System.out.println("Already on the " +
  + "list: " + user);
               }
           }
       }
   
  + /**
  + * Adds a single user to the specified mailing list.
  + *
  + * @param list The name of the list to which the user should be added.
  + * @param user The name of the user to add to the list.
  + */
       private static void addUser(String list, String user)
           throws MailListException
       {
  @@ -116,7 +143,7 @@
           sendEmail(user);
       }
   
  -/* MailList.list now returns hashtable directly
  + /* DEPRECATED: MailList.list() now returns hashtable directly
       private static Hashtable getListMembers(String list)
           throws MailListException
       {
  @@ -134,8 +161,14 @@
           }
           return table;
       }
  -*/
  + */
   
  + /**
  + * Gets the contents of the specified file.
  + *
  + * @param fileName The name of the file to read.
  + * @return The file contents.
  + */
       private static String readFile(String fileName)
           throws IOException
       {
  @@ -148,6 +181,12 @@
           return buf.toString();
       }
   
  + /**
  + * Sends an email--with content determined by the current state of the
  + * emailer--to the specified user.
  + *
  + * @param user The name of the user to which to send mail.
  + */
       private static void sendEmail(String user)
       {
           try

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: joist/java/org/joist/mail AddToList.java commitlogger at hocus dot collab dot net commitlogger at hocus dot collab dot net 2000-04-17 20:40:40 PDT
Messages per page: