summaryrefslogtreecommitdiffstats
path: root/EssentialsUpdate/src/f00f/net/irc/martyr/commands/UserModeCommand.java
blob: 1190ed64a8585838bcddd71d554eed0a6d881fab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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<Character,Mode> 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<Character,Mode>();
			
			// 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";
	}
	

}