blob: 9010a432260d13c1852851a099340b1095ec2a56 (
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
|
package f00f.net.irc.martyr.commands;
import f00f.net.irc.martyr.InCommand;
import f00f.net.irc.martyr.util.FullNick;
import f00f.net.irc.martyr.util.ParameterIterator;
/**
* @author <a href="mailto:martyr@mog.se">Morgan Christiansson</a>
*/
public class InviteCommand extends AbstractCommand {
private String _channel;
private String _nick;
private FullNick _user;
/** For use as a factory */
public InviteCommand()
{
_channel = null;
_nick = null;
_user = null;
}
private InviteCommand(FullNick user, String nick, String channel)
{
_user = user;
_nick = nick;
_channel = channel;
}
public InviteCommand(String nick, String channel)
{
_nick = nick;
_channel = channel;
}
public InviteCommand(FullNick nick, String channel)
{
this(nick.getNick(), channel);
}
/* (non-Javadoc)
* @see f00f.net.irc.martyr.Command#parse(java.lang.String, java.lang.String, java.lang.String)
*/
public InCommand parse(String prefix, String identifier, String params)
{
ParameterIterator iter = new ParameterIterator(params);
return new InviteCommand( new FullNick( prefix ), (String)iter.next(), (String)iter.next() );
}
/* (non-Javadoc)
* @see f00f.net.irc.martyr.commands.AbstractCommand#getIrcIdentifier()
*/
public String getIrcIdentifier()
{
return "INVITE";
}
/* (non-Javadoc)
* @see f00f.net.irc.martyr.commands.AbstractCommand#renderParams()
*/
public String renderParams()
{
return _nick+" "+_channel;
}
/**
* @return The channel invited to. */
public String getChannel()
{
return _channel;
}
/**
* @return The nick sending the invite.
*/
public String getNick()
{
return _nick;
}
/**
* @return The user the invite is sent to.
*/
public FullNick getUser()
{
return _user;
}
}
|