diff -r 08c9fb6fb017 -r d54786065fa3 src/org/sonews/daemon/NNTPConnection.java --- a/src/org/sonews/daemon/NNTPConnection.java Wed Oct 19 17:23:53 2011 +0200 +++ b/src/org/sonews/daemon/NNTPConnection.java Wed Oct 19 21:40:51 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; + } }