Add /back command (issue #89)

This patch adds the /back command, which turns off the away status.
This should close issue #89, https://github.com/pocmo/Yaaic/issues/89.
This commit is contained in:
Francesco Lavra 2011-08-28 21:23:07 +02:00 committed by Sebastian Kaspari
parent d155e86cd1
commit 0a8e75feff
4 changed files with 71 additions and 0 deletions

View File

@ -91,6 +91,7 @@
<string name="command_desc_amsg">Invia un messaggio a tutti i canali</string>
<string name="command_desc_away">Imposta il tuo stato \'assente\'</string>
<string name="command_desc_back">Disattiva il tuo stato \'assente\'</string>
<string name="command_desc_close">Chiude la finestra corrente</string>
<string name="command_desc_dcc">Invia un file ad un utente</string>
<string name="command_desc_deop">Rimuovi lo stato di operatore ad un utente</string>

View File

@ -98,6 +98,7 @@
<string name="command_desc_amsg">Send a message to all channels</string>
<string name="command_desc_away">Sets you away</string>
<string name="command_desc_back">Turn off the away status</string>
<string name="command_desc_close">Closes the current window</string>
<string name="command_desc_dcc">Send a file to a user</string>
<string name="command_desc_deop">Remove operator status from a user</string>

View File

@ -24,6 +24,7 @@ import java.util.HashMap;
import org.yaaic.command.handler.AMsgHandler;
import org.yaaic.command.handler.AwayHandler;
import org.yaaic.command.handler.BackHandler;
import org.yaaic.command.handler.CloseHandler;
import org.yaaic.command.handler.DCCHandler;
import org.yaaic.command.handler.DeopHandler;
@ -94,6 +95,7 @@ public class CommandParser
commands.put("mode", new ModeHandler());
commands.put("help", new HelpHandler());
commands.put("away", new AwayHandler());
commands.put("back", new BackHandler());
commands.put("whois", new WhoisHandler());
commands.put("msg", new MsgHandler());
commands.put("quote", new RawHandler());

View File

@ -0,0 +1,67 @@
/*
Yaaic - Yet Another Android IRC Client
Copyright 2009-2011 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.R;
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;
import android.content.Context;
/**
* Command: /back
*
* Turn off the away status
*
* @author Francesco Lavra <francescola...@interfree.it>
*/
public class BackHandler extends BaseHandler
{
/**
* Execute /back
*/
@Override
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
{
service.getConnection(server.getId()).sendRawLineViaQueue("AWAY");
}
/**
* Get description of /back
*/
@Override
public String getDescription(Context context)
{
return context.getString(R.string.command_desc_back);
}
/**
* Get usage of /back
*/
@Override
public String getUsage()
{
return "/back";
}
}