From 1dea85c545d54dc33f7cf8462feef2a2794a8012 Mon Sep 17 00:00:00 2001 From: Sebastian Kaspari Date: Mon, 12 Apr 2010 22:20:26 +0200 Subject: [PATCH] Implemented command handler: /away [] --- src/org/yaaic/command/CommandParser.java | 4 +- .../yaaic/command/handler/AwayHandler.java | 64 +++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 src/org/yaaic/command/handler/AwayHandler.java diff --git a/src/org/yaaic/command/CommandParser.java b/src/org/yaaic/command/CommandParser.java index 30ddeb0..40cef1e 100644 --- a/src/org/yaaic/command/CommandParser.java +++ b/src/org/yaaic/command/CommandParser.java @@ -24,6 +24,7 @@ import java.util.HashMap; import android.content.Intent; +import org.yaaic.command.handler.AwayHandler; import org.yaaic.command.handler.CloseHandler; import org.yaaic.command.handler.DCCHandler; import org.yaaic.command.handler.DeopHandler; @@ -62,7 +63,7 @@ public class CommandParser private static CommandParser instance; private final static String[] serverCommands = { - "admin", "motd", "version", "away", "knock", "rules", + "admin", "motd", "version", "knock", "rules", "vhost", "credits", "license", "setname", "watch", "pong", "cycle", "links", "silence", "who", "dalinfo", "userhost", "list", "stats", "whois", "invite", "lusers", "ping", @@ -96,6 +97,7 @@ public class CommandParser commands.put("dcc", new DCCHandler()); commands.put("mode", new ModeHandler()); commands.put("help", new HelpHandler()); + commands.put("away", new AwayHandler()); aliases = new HashMap(); // Aliases diff --git a/src/org/yaaic/command/handler/AwayHandler.java b/src/org/yaaic/command/handler/AwayHandler.java new file mode 100644 index 0000000..acea6f0 --- /dev/null +++ b/src/org/yaaic/command/handler/AwayHandler.java @@ -0,0 +1,64 @@ +/* +Yaaic - Yet Another Android IRC Client + +Copyright 2009-2010 Sebastian Kaspari + +This file is part of Yaaic. + +Yaaic is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Yaaic is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Yaaic. If not, see . +*/ +package org.yaaic.command.handler; + +import org.yaaic.command.BaseHandler; +import org.yaaic.exception.CommandException; +import org.yaaic.irc.IRCService; +import org.yaaic.model.Conversation; +import org.yaaic.model.Server; + +/** + * Command: /away [] + * + * Sets you away + * + * @author Sebastian Kaspari + */ +public class AwayHandler extends BaseHandler +{ + /** + * Execute /away + */ + @Override + public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException + { + service.getConnection(server.getId()).sendRawLineViaQueue("AWAY " + BaseHandler.mergeParams(params)); + } + + /** + * Get description of /away + */ + @Override + public String getDescription() + { + return "Sets you away"; + } + + /** + * Get usage of /away + */ + @Override + public String getUsage() + { + return "/away []"; + } +}