You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Erik Danielsson <at...@hotmail.com> on 2001/11/18 13:44:35 UTC
New diff as requested in Re: RemoteManager modifications that I find usefull.
diff -u as requested.
//Regards Erik Danielsson
---- Begin diff -u RemoteManagerHandler.java
Index: RemoteManagerHandler.java
===================================================================
RCS file:
/opt/CVSROOT/jakarta-james/src/java/org/apache/james/remotemanager/RemoteManagerHandler.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- RemoteManagerHandler.java 5 Nov 2001 13:27:21 -0000 1.5
+++ RemoteManagerHandler.java 16 Nov 2001 12:42:31 -0000 1.6
@@ -44,8 +44,8 @@
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
* @author <a href="mailto:charles@benett1.demon.co.uk">Charles Benett</a>
*
- * Last changed by: $Author: serge $ on $Date: 2001/11/05 13:27:21 $
- * $Revision: 1.5 $
+ * Last changed by: $Author: erik $ on $Date: 2001/11/16 12:42:31 $
+ * $Revision: 1.6 $
*
*/
public class RemoteManagerHandler
@@ -62,6 +62,8 @@
private PrintWriter out;
private HashMap admaccount = new HashMap();
private Socket socket;
+
+ private String currRepo;
public void configure( final Configuration configuration )
throws ConfigurationException {
@@ -86,10 +88,12 @@
lookup( "org.apache.james.services.MailServer" );
usersStore = (UsersStore)componentManager.
lookup( "org.apache.james.services.UsersStore" );
- users = usersStore.getRepository("LocalUsers");;
- }
+ users = usersStore.getRepository("LocalUsers");
- /**
+ currRepo = "LocalUsers";
+ }
+
+ /**
* Handle a connection.
* This handler is responsible for processing connections as they
occur.
*
@@ -138,11 +142,15 @@
scheduler.resetTrigger(this.toString());
out.println( "Welcome " + login + ". HELP for a list of
commands" );
+ out.write("jakarta-james::" + currRepo + ">");
+ out.flush();
getLogger().info("Login for " + login + " succesful");
try {
while (parseCommand(in.readLine())) {
- scheduler.resetTrigger(this.toString());
+ out.write("jakarta-james::" + currRepo + "> ");
+ out.flush();
+ scheduler.resetTrigger(this.toString());
}
}
catch (Throwable thr) {
@@ -286,7 +294,8 @@
out.println("Currently implemented commans:");
out.println("help display
this help");
out.println("listusers display
existing accounts");
- out.println("countusers display
the number of existing accounts");
+ out.println("listrepo list the
existing repositories");
+ out.println("countusers display the
number of existing accounts");
out.println("adduser [username] [password] add a new
user");
out.println("verify [username] verify if
specified user exist");
out.println("deluser [username] delete
existing user");
@@ -294,7 +303,9 @@
out.println("setalias [username] [alias] sets a
user's alias");
out.println("unsetalias [username] removes a
user's alias");
out.println("setforwarding [username] [emailaddress] forwards a
user's email to another account");
- out.println("user [repositoryname] change to
another user repository");
+ out.println("unsetforwarding [username] removes a
user's forwarding");
+ out.println("checkuser [username] check
aliasing and forwarding for user");
+ out.println("use [repositoryname] change to
another user repository");
out.println("quit close
connection");
out.flush();
} else if (command.equalsIgnoreCase("SETALIAS")) {
@@ -381,6 +392,65 @@
}
out.flush();
return true;
+ } else if (command.equalsIgnoreCase("UNSETFORWARDING")) {
+ if (argument == null) {
+ out.println("usage: unsetforwarding [username]");
+ return true;
+ }
+ String username = argument;
+ if (username.equals("")) {
+ out.println("usage: unsetforwarding [username]");
+ return true;
+ }
+ JamesUser user = (JamesUser) users.getUserByName(username);
+ if (user == null) {
+ out.println("No such user");
+ return true;
+ }
+
+ if (user.getForwarding()){
+ user.setForwarding(false);
+ users.updateUser(user);
+ out.println("Forwarding for " + username + " unset");
+ getLogger().info("Forwarding for " + username + " unset");
+ } else {
+ out.println("Forwarding not active for" + username);
+ getLogger().info("Forwarding not active for" + username);
+ }
+ out.flush();
+ return true;
+ }else if (command.equalsIgnoreCase("CHECKUSER")) {
+ if (argument == null) {
+ out.println("usage: checkuser [username]");
+ return true;
+ }
+ String username = argument;
+ if (username.equals("")) {
+ out.println("usage: checkuser [username]");
+ return true;
+ }
+ JamesUser user = (JamesUser) users.getUserByName(username);
+ if (user == null) {
+ out.println("No such user");
+ return true;
+ }
+
+ if (user.getAliasing()){
+ String alias= user.getAlias();
+ out.println("Alias for " + username + " is set to: " + alias);
+ } else {
+ out.println("Aliasing not active for " + username);
+ }
+
+ MailAddress forwardAddr;
+ if (user.getForwarding()){
+ forwardAddr = user.getForwardingDestination();
+ out.println("Forwarding for " + username + " is set to: " +
forwardAddr );
+ } else {
+ out.println("Forwarding not active for " + username);
+ }
+ out.flush();
+ return true;
} else if (command.equalsIgnoreCase("UNSETALIAS")) {
if (argument == null) {
out.println("usage: unsetalias [username]");
@@ -388,7 +458,7 @@
}
String username = argument;
if (username.equals("")) {
- out.println("usage: adduser [username]");
+ out.println("usage: unsetalias [username]");
return true;
}
JamesUser user = (JamesUser) users.getUserByName(username);
@@ -422,22 +492,34 @@
else {
users = repos;
out.println("Changed to repository '" + repositoryName +
"'.");
+ currRepo = repositoryName;
if ( repositoryName.equalsIgnoreCase("localusers") ) {
inLocalUsers = true;
}
else {
inLocalUsers = false;
}
+ out.flush();
return true;
}
- } else if (command.equalsIgnoreCase("QUIT")) {
+ } else if (command.equalsIgnoreCase("LISTREPO")) {
+ out.println("\nRepositories:");
+ Iterator iterator = usersStore.getRepositoryNames();
+
+ while (iterator.hasNext()) {
+ out.println(iterator.next());
+ }
+ out.println("");
+ return true;
+ } else if (command.equalsIgnoreCase("QUIT")) {
out.println("bye");
return false;
} else {
out.println("unknown command " + command);
}
- return true;
+ return true;
}
}
+
---- End diff -u RemoteManagerHandler.java
>From: "Harmeet" <ha...@kodemuse.com>
>Reply-To: "James Developers List" <ja...@jakarta.apache.org>
>To: "James Developers List" <ja...@jakarta.apache.org>
>Subject: Re: RemoteManager modifications that I find usefull.
>Date: Sat, 17 Nov 2001 08:05:55 -0800
>
> > The modified files are:
> > core/AvalonUsersStore.java (to get the repository names)
> > services/UsersStore.java (to get the repository names)
>committed your chanages to
>
> > remotemanager/RemoteHandlerManager.java (new commands)
>
>Did not commit these changes.
>Could you please send the diff -u against latest RemoteHandlerManager.java.
>
>thanks,
>Harmeet
>
>
>--
>To unsubscribe, e-mail: <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: New diff as requested in Re: RemoteManager modifications that I find usefull.
Posted by Serge Knystautas <se...@lokitech.com>.
(this one too. thanks.)
Serge Knystautas
Loki Technologies - Unstoppable Websites
http://www.lokitech.com
----- Original Message -----
From: "Erik Danielsson" <at...@hotmail.com>
To: <ja...@jakarta.apache.org>
Sent: Sunday, November 18, 2001 7:44 AM
Subject: New diff as requested in Re: RemoteManager modifications that I
find usefull.
>
> diff -u as requested.
> //Regards Erik Danielsson
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>