2010-03-09 17:58:53 -05:00
|
|
|
/*
|
2010-03-12 14:35:25 -05:00
|
|
|
Yaaic - Yet Another Android IRC Client
|
2010-03-09 17:58:53 -05:00
|
|
|
|
2010-03-13 10:52:20 -05:00
|
|
|
Copyright 2009-2010 Sebastian Kaspari
|
2010-03-09 17:58:53 -05:00
|
|
|
|
|
|
|
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/>.
|
|
|
|
*/
|
2010-03-10 03:01:49 -05:00
|
|
|
package org.yaaic.command.handler;
|
2010-03-09 17:58:53 -05:00
|
|
|
|
2010-03-10 03:01:49 -05:00
|
|
|
import org.yaaic.command.BaseHandler;
|
|
|
|
import org.yaaic.command.CommandException;
|
2010-03-09 17:58:53 -05:00
|
|
|
import org.yaaic.irc.IRCService;
|
2010-03-10 15:06:18 -05:00
|
|
|
import org.yaaic.model.Conversation;
|
2010-03-09 17:58:53 -05:00
|
|
|
import org.yaaic.model.Server;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Command: /devoice <nickname>
|
|
|
|
*
|
|
|
|
* @author Sebastian Kaspari <sebastian@yaaic.org>
|
|
|
|
*/
|
2010-03-10 03:01:49 -05:00
|
|
|
public class DevoiceHandler extends BaseHandler
|
2010-03-09 17:58:53 -05:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Execute /devoice
|
|
|
|
*/
|
|
|
|
@Override
|
2010-03-10 15:06:18 -05:00
|
|
|
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
2010-03-09 17:58:53 -05:00
|
|
|
{
|
2010-03-10 15:14:20 -05:00
|
|
|
if (conversation.getType() != Conversation.TYPE_CHANNEL) {
|
|
|
|
throw new CommandException("Only usable from within a channel");
|
|
|
|
}
|
|
|
|
|
2010-03-09 17:58:53 -05:00
|
|
|
if (params.length == 2) {
|
2010-03-10 15:06:18 -05:00
|
|
|
service.getConnection(server.getId()).deVoice(conversation.getName(), params[1]);
|
2010-03-09 17:58:53 -05:00
|
|
|
} else {
|
|
|
|
throw new CommandException("Invalid number of params");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Usage of /devoice
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public String getUsage()
|
|
|
|
{
|
|
|
|
return "/devoice <nickname>";
|
|
|
|
}
|
|
|
|
}
|