1 18 package net.sf.drftpd.master.command.plugins; 19 20 import net.sf.drftpd.event.InviteEvent; 21 import net.sf.drftpd.master.BaseFtpConnection; 22 import net.sf.drftpd.master.FtpReply; 23 import net.sf.drftpd.master.command.CommandManager; 24 import net.sf.drftpd.master.command.CommandManagerFactory; 25 26 import org.drftpd.commands.CommandHandler; 27 import org.drftpd.commands.CommandHandlerFactory; 28 import org.drftpd.commands.UnhandledCommandException; 29 30 35 public class Invite implements CommandHandlerFactory, CommandHandler { 36 public Invite() { 37 } 38 39 public FtpReply execute(BaseFtpConnection conn) 40 throws UnhandledCommandException { 41 String cmd = conn.getRequest().getCommand(); 42 if (!"SITE INVITE".equals(cmd)) { 43 throw UnhandledCommandException.create( 44 Invite.class, 45 conn.getRequest()); 46 } 47 if (!conn.getRequest().hasArgument()) 48 return new FtpReply( 49 501, 50 conn.jprintf(Invite.class, "invite.usage")); 51 String user = conn.getRequest().getArgument(); 52 InviteEvent invite = new InviteEvent(cmd, user); 53 conn.getConnectionManager().dispatchFtpEvent(invite); 54 return new FtpReply(200, "Inviting " + user); 55 } 56 57 public String [] getFeatReplies() { 58 return null; 59 } 60 public CommandHandler initialize( 61 BaseFtpConnection conn, 62 CommandManager initializer) { 63 return this; 64 } 65 public void load(CommandManagerFactory initializer) { 66 } 67 public void unload() { 68 } 69 } 70 | Popular Tags |