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

import f00f.net.irc.martyr.InCommand;
import f00f.net.irc.martyr.util.ParameterIterator;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

//import org.apache.log4j.Logger;

public class WhoisChannelsReply extends AbstractWhoisReply
{
    //static Logger log = Logger.getLogger(WhoisChannelsReply.class);

    private String channels;

	/**
	 * Factory constructor.
	 * */
	public WhoisChannelsReply()
	{
	}

	public WhoisChannelsReply( String params )
	{
		super( params );
	}

	public String getIrcIdentifier()
	{
		return "319";
	}

	/**
	 * @return a space-delimited list of channels
	 * */
	public String getChannels()
	{
		return channels;
	}

	/**
	 * @return a set of Strings of channels
	 * */
	public Set<String> getChannelSet()
	{
		StringTokenizer tokens = new StringTokenizer( channels );
		Set<String> set = new HashSet<String>();
		while( tokens.hasMoreTokens() )
		{
			set.add( tokens.nextToken() );
		}

		return set;
	}

	protected void parseParams( ParameterIterator pi )
	{
		channels = pi.last(); // Channels

		//log.debug("WhoisChannelsReply: channels: " + channels);
	}

	public InCommand parse( String prefix, String identifier, String params )
	{
		return new WhoisChannelsReply( params );
	}

}