1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2025-01-09 20:58:02 -05:00

Implemented command handler: /away [<reason>]

This commit is contained in:
Sebastian Kaspari 2010-04-12 22:20:26 +02:00
parent accc655bd7
commit 1dea85c545
2 changed files with 67 additions and 1 deletions

View File

@ -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<String, String>();
// Aliases

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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 [<reason>]
*
* Sets you away
*
* @author Sebastian Kaspari <sebastian@yaaic.org>
*/
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 [<reason>]";
}
}