Author: sebb
Date: Tue Mar 29 15:01:22 2011
New Revision: 1086616

URL: http://svn.apache.org/viewvc?rev=1086616&view=rev
Log:
All commands should be defined in SMTPCommand

Modified:
    
commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/AuthenticatingSMTPClient.java
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTP.java
    
commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTPCommand.java

Modified: 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/AuthenticatingSMTPClient.java
URL: 
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/AuthenticatingSMTPClient.java?rev=1086616&r1=1086615&r2=1086616&view=diff
==============================================================================
--- 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/AuthenticatingSMTPClient.java
 (original)
+++ 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/AuthenticatingSMTPClient.java
 Tue Mar 29 15:01:22 2011
@@ -38,11 +38,6 @@ import org.apache.commons.net.util.Base6
  */
 public class AuthenticatingSMTPClient extends SMTPSClient
 {
-    /** The AUTH command. */
-    public static final String authCommand = "AUTH";
-    /** The EHLO command. */
-    public static final String ehloCommand = "EHLO";
-
     /**
      * The default AuthenticatingSMTPClient constructor.
      * Creates a new Authenticating SMTP Client.
@@ -78,7 +73,7 @@ public class AuthenticatingSMTPClient ex
      ***/
     public int ehlo(String hostname) throws IOException
     {
-        return sendCommand(ehloCommand, hostname);
+        return sendCommand(SMTPCommand.EHLO, hostname);
     }
 
     /***
@@ -171,8 +166,8 @@ public class AuthenticatingSMTPClient ex
                         throws IOException, NoSuchAlgorithmException,
                         InvalidKeyException, InvalidKeySpecException
     {
-        if (!SMTPReply.isPositiveIntermediate(sendCommand(
-            authCommand + " " + AUTH_METHOD.getAuthName(method)))) return 
false;
+        if (!SMTPReply.isPositiveIntermediate(sendCommand(SMTPCommand.AUTH,
+                AUTH_METHOD.getAuthName(method)))) return false;
 
         if (method.equals(AUTH_METHOD.PLAIN))
         {

Modified: 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTP.java
URL: 
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTP.java?rev=1086616&r1=1086615&r2=1086616&view=diff
==============================================================================
--- 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTP.java 
(original)
+++ 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTP.java 
Tue Mar 29 15:01:22 2011
@@ -124,6 +124,15 @@ public class SMTP extends SocketClient
         this.encoding = encoding;
     }
 
+    /**
+     * Send a command to the server. May also be used to send text data.
+     * 
+     * @param command the command to send (as a plain String)
+     * @param args the command arguments, may be {@code null}
+     * @param includeSpace if {@code true}, add a space between the command 
and its arguments
+     * @return the reply code
+     * @throws IOException
+     */
     private int __sendCommand(String command, String args, boolean 
includeSpace)
     throws IOException
     {
@@ -149,6 +158,14 @@ public class SMTP extends SocketClient
         return _replyCode;
     }
 
+    /**
+     * 
+     * @param command the command to send (as an int defined in {@link 
SMPTCommand})
+     * @param args the command arguments, may be {@code null}
+     * @param includeSpace if {@code true}, add a space between the command 
and its arguments
+     * @return the reply code
+     * @throws IOException
+     */
     private int __sendCommand(int command, String args, boolean includeSpace)
     throws IOException
     {

Modified: 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTPCommand.java
URL: 
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTPCommand.java?rev=1086616&r1=1086615&r2=1086616&view=diff
==============================================================================
--- 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTPCommand.java
 (original)
+++ 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTPCommand.java
 Tue Mar 29 15:01:22 2011
@@ -53,8 +53,20 @@ public final class SMTPCommand
      * @since 3.0 
      */
     public static final int STLS = 14 ;
-    
-    private static final int _NEXT_ = STLS + 1; // update as necessary when 
adding new entries
+
+    /** 
+     * The authorization command
+     * @since 3.0 
+     */
+    public static final int AUTH = 15 ;
+
+    /** 
+     * The extended hello command
+     * @since 3.0 
+     */
+    public static final int EHLO = 16 ;
+
+    private static final int _NEXT_ = EHLO + 1; // update as necessary when 
adding new entries
 
     public static final int HELLO = HELO;
     public static final int LOGIN = HELO;
@@ -80,7 +92,7 @@ public final class SMTPCommand
     private static final String[] _commands = {
                                           "HELO", "MAIL FROM:", "RCPT TO:", 
"DATA", "SEND FROM:", "SOML FROM:",
                                           "SAML FROM:", "RSET", "VRFY", 
"EXPN", "HELP", "NOOP", "TURN", "QUIT",
-                                          "STARTTLS"
+                                          "STARTTLS", "AUTH", "EHLO"
                                       };
 
 


Reply via email to