summaryrefslogtreecommitdiffstats
path: root/EssentialsUpdate/src/f00f/net/irc/martyr/commands/InviteCommand.java
diff options
context:
space:
mode:
Diffstat (limited to 'EssentialsUpdate/src/f00f/net/irc/martyr/commands/InviteCommand.java')
-rw-r--r--EssentialsUpdate/src/f00f/net/irc/martyr/commands/InviteCommand.java90
1 files changed, 90 insertions, 0 deletions
diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/commands/InviteCommand.java b/EssentialsUpdate/src/f00f/net/irc/martyr/commands/InviteCommand.java
new file mode 100644
index 000000000..9010a4322
--- /dev/null
+++ b/EssentialsUpdate/src/f00f/net/irc/martyr/commands/InviteCommand.java
@@ -0,0 +1,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;
+ }
+}
+