Skip to content

Commit

Permalink
Add /back command (issue #89)
Browse files Browse the repository at this point in the history
This patch adds the /back command, which turns off the away status.
This should close issue #89, #89.
  • Loading branch information
Francesco Lavra authored and pocmo committed Sep 5, 2011
1 parent d155e86 commit 0a8e75f
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 0 deletions.
1 change: 1 addition & 0 deletions application/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions application/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 2 additions & 0 deletions application/src/org/yaaic/command/CommandParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

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;
Expand Down Expand Up @@ -94,6 +95,7 @@ private 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());
Expand Down
67 changes: 67 additions & 0 deletions application/src/org/yaaic/command/handler/BackHandler.java
Original file line number Diff line number Diff line change
@@ -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";
}
}

0 comments on commit 0a8e75f

Please sign in to comment.