This patch adds the /back command, which turns off the away status.
This should close issue #89, https://github.com/pocmo/Yaaic/issues/89.
---
diff -Nur a/application/res/values/strings.xml 
b/application/res/values/strings.xml
--- a/application/res/values/strings.xml        2011-08-18 01:44:38.000000000 
+0200
+++ b/application/res/values/strings.xml        2011-08-28 19:47:50.000000000 
+0200
@@ -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>
diff -Nur a/application/res/values-it/strings.xml 
b/application/res/values-it/strings.xml
--- a/application/res/values-it/strings.xml     2011-08-18 01:44:38.000000000 
+0200
+++ b/application/res/values-it/strings.xml     2011-08-28 20:19:49.000000000 
+0200
@@ -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>
diff -Nur a/application/src/org/yaaic/command/CommandParser.java 
b/application/src/org/yaaic/command/CommandParser.java
--- a/application/src/org/yaaic/command/CommandParser.java      2011-08-18 
01:44:38.000000000 +0200
+++ b/application/src/org/yaaic/command/CommandParser.java      2011-08-28 
19:53:10.000000000 +0200
@@ -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;
@@ -94,6 +95,7 @@
         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());
diff -Nur a/application/src/org/yaaic/command/handler/BackHandler.java 
b/application/src/org/yaaic/command/handler/BackHandler.java
--- a/application/src/org/yaaic/command/handler/BackHandler.java        
1970-01-01 01:00:00.000000000 +0100
+++ b/application/src/org/yaaic/command/handler/BackHandler.java        
2011-08-28 19:46:04.000000000 +0200
@@ -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 <[email protected]>
+ */
+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";
+    }
+}


Reply via email to