Example usage for org.apache.commons.net.nntp NNTPReply AUTHENTICATION_ACCEPTED

List of usage examples for org.apache.commons.net.nntp NNTPReply AUTHENTICATION_ACCEPTED

Introduction

In this page you can find the example usage for org.apache.commons.net.nntp NNTPReply AUTHENTICATION_ACCEPTED.

Prototype

int AUTHENTICATION_ACCEPTED

To view the source code for org.apache.commons.net.nntp NNTPReply AUTHENTICATION_ACCEPTED.

Click Source Link

Usage

From source file:net.longfalcon.newsj.nntp.client.CustomNNTPClient.java

/**
 * Log into a news server by sending the AUTHINFO USER/AUTHINFO
 * PASS command sequence. This is usually sent in response to a
 * 480 reply code from the NNTP server./*from w  w  w.  j  a v  a 2 s.c o  m*/
 * <p>
 * @param username a valid username
 * @param password the corresponding password
 * @return True for successful login, false for a failure
 * @throws IOException
 */
@Override
public boolean authenticate(String username, String password) throws IOException {
    int replyCode = authinfoUser(username);

    if (replyCode == NNTPReply.MORE_AUTH_INFO_REQUIRED) {
        replyCode = authinfoPass(password);

        if (replyCode == NNTPReply.AUTHENTICATION_ACCEPTED) {
            //_isAllowedToPost = true; Posting disabled. i think this will probably be OK for our purposes.
            return true;
        }
    }
    return false;
}