diff -r 8df94bfd3e2f -r a788bf0e1080 src/org/sonews/daemon/NNTPConnection.java --- a/src/org/sonews/daemon/NNTPConnection.java Sun Sep 11 17:01:19 2011 +0200 +++ b/src/org/sonews/daemon/NNTPConnection.java Thu Oct 20 10:50:58 2011 +0200 @@ -59,6 +59,9 @@ private int readLock = 0; private final Object readLockGate = new Object(); private SelectionKey writeSelKey = null; + + private String username; + private boolean userAuthenticated = false; public NNTPConnection(final SocketChannel channel) throws IOException { @@ -360,4 +363,36 @@ void setLastActivity(long timestamp) { this.lastActivity = timestamp; } + + /** + * @return Current username. + * But user may not have been authenticated yet. + * You must check {@link #isUserAuthenticated()} + */ + public String getUsername() { + return username; + } + + /** + * This method is to be called from AUTHINFO USER Command implementation. + * @param username username from AUTHINFO USER username. + */ + public void setUsername(String username) { + this.username = username; + } + + /** + * @return true if current user (see {@link #getUsername()}) has been succesfully authenticated. + */ + public boolean isUserAuthenticated() { + return userAuthenticated; + } + + /** + * This method is to be called from AUTHINFO PASS Command implementation. + * @param userAuthenticated true if user has provided right password in AUTHINFO PASS password. + */ + public void setUserAuthenticated(boolean userAuthenticated) { + this.userAuthenticated = userAuthenticated; + } }