From 860d446d28776ec842fa53e8e08538d4e093d6e9 Mon Sep 17 00:00:00 2001 From: snowleo Date: Wed, 12 Oct 2011 03:14:07 +0200 Subject: EssentialsUpdate WIP --- .../net/irc/martyr/commands/UserModeCommand.java | 99 ++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/commands/UserModeCommand.java (limited to 'EssentialsUpdate/src/f00f/net/irc/martyr/commands/UserModeCommand.java') diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/commands/UserModeCommand.java b/EssentialsUpdate/src/f00f/net/irc/martyr/commands/UserModeCommand.java new file mode 100644 index 000000000..1190ed64a --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/commands/UserModeCommand.java @@ -0,0 +1,99 @@ +package f00f.net.irc.martyr.commands; + +import java.util.HashMap; +import java.util.StringTokenizer; + +import f00f.net.irc.martyr.InCommand; +import f00f.net.irc.martyr.Mode; +import f00f.net.irc.martyr.clientstate.ClientState; +import f00f.net.irc.martyr.modes.user.InvisibleMode; +import f00f.net.irc.martyr.util.FullNick; +import java.util.logging.Logger; + +/** + * Defines a user MODE command. + */ +public class UserModeCommand extends ModeCommand +{ + static Logger log = Logger.getLogger(ModeCommand.class.getName()); + + private FullNick user; + private FullNick sender; + //private List modes; + + private static HashMap modeTypes; + + public UserModeCommand( String prefix, String userStr, StringTokenizer tokens ) + { +// System.out.println( prefix ); + sender = new FullNick( prefix ); + user = new FullNick( userStr ); + + if( !sender.equals( user ) ) + { + log.severe("UserModeCommand: Odd: mode change for a user that isn't us."); + return; + } + + makeModeTypes(); + + //modes = parseModes( modeTypes, tokens ); + +// System.out.println( modes ); + } + + private void makeModeTypes() + { + if( modeTypes == null ) + { + modeTypes = new HashMap(); + + // Add new mode types here + registerMode( modeTypes, new InvisibleMode() ); + } + } + + + /** + * Should not be called, as ModeCommand does the parsing and instantiation + * of this class. + */ + public InCommand parse( String prefix, String identifier, String params ) + { + throw new IllegalStateException( "Don't call this method!" ); + } + + public String render() + { + throw new UnsupportedOperationException("Can't send user modes, yet." ); + } + + public FullNick getUser() + { + return user; + } + + public FullNick getSender() { + return sender; + } + + { + //log.debug("TODO: UserModeCommand: Can't send"); + //log.debug("TODO: UserModeCommand: Does not update client state"); + } + + public boolean updateClientState( ClientState state ) + { + // TODO implement + return false; + } + + public String toString() + { + return "UserModeCommand"; + } + + +} + + -- cgit v1.2.3