summaryrefslogtreecommitdiffstats
path: root/EssentialsUpdate/src/f00f/net/irc/martyr/replies/UnknownReply.java
blob: f4ebc14d651d5bf400e5d24efe6ce8e618548c56 (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
package f00f.net.irc.martyr.replies;

import f00f.net.irc.martyr.InCommand;
import f00f.net.irc.martyr.State;
import f00f.net.irc.martyr.commands.UnknownCommand;


/**
 * A container for unknown replies.
 */
public class UnknownReply extends UnknownCommand
{
	private String replyStr;
	private int replyCode;

	public UnknownReply( String ident )
	{
		replyStr = ident;
		replyCode = Integer.parseInt( ident );
	}

	public int getReplyCode()
	{
		return replyCode;
	}

	public String getReply()
	{
		return replyStr;
	}

	public static boolean isReply( String ident )
	{
		char c = ident.charAt(0);
		return ( c == '0' || c == '2' || c == '3' );
	}

	public State getState()
	{
		return State.UNKNOWN;
	}

	/** 
	 * Never parsed.
	 */
	public InCommand parse( String prefix, String identifier, String params )
	{
		throw new UnsupportedOperationException("UnknownReply does no parsing.");
	}

	/**
	 * Unknown, so we don't know what the identifier is ahead of time.
	 */
	public String getIrcIdentifier()
	{
		return replyStr;
	}

	public String toString()
	{
		return "UnknownReply[" + replyStr + "]";
	}

}