diff -r 8df94bfd3e2f -r b723308e1359 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 Tue Oct 25 10:16:13 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; + } }