mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-11-29 12:22:21 -05:00
Renamed Broadcast constants from CHANNEL_* to CONVERSATION_*
This commit is contained in:
parent
ab18588c9b
commit
b87501622c
@ -31,6 +31,7 @@ import org.yaaic.command.handler.MeHandler;
|
|||||||
import org.yaaic.command.handler.NamesHandler;
|
import org.yaaic.command.handler.NamesHandler;
|
||||||
import org.yaaic.command.handler.NickHandler;
|
import org.yaaic.command.handler.NickHandler;
|
||||||
import org.yaaic.command.handler.OpHandler;
|
import org.yaaic.command.handler.OpHandler;
|
||||||
|
import org.yaaic.command.handler.PartHandler;
|
||||||
import org.yaaic.command.handler.QueryHandler;
|
import org.yaaic.command.handler.QueryHandler;
|
||||||
import org.yaaic.command.handler.QuitHandler;
|
import org.yaaic.command.handler.QuitHandler;
|
||||||
import org.yaaic.command.handler.TopicHandler;
|
import org.yaaic.command.handler.TopicHandler;
|
||||||
@ -76,6 +77,7 @@ public class CommandParser
|
|||||||
commands.put("devoice", new DevoiceHandler());
|
commands.put("devoice", new DevoiceHandler());
|
||||||
commands.put("kick", new KickHandler());
|
commands.put("kick", new KickHandler());
|
||||||
commands.put("query", new QueryHandler());
|
commands.put("query", new QueryHandler());
|
||||||
|
commands.put("part", new PartHandler());
|
||||||
|
|
||||||
// Aliases
|
// Aliases
|
||||||
commands.put("j", commands.get("join"));
|
commands.put("j", commands.get("join"));
|
||||||
@ -132,9 +134,9 @@ public class CommandParser
|
|||||||
Message usageMessage = new Message("Syntax: " + command.getUsage());
|
Message usageMessage = new Message("Syntax: " + command.getUsage());
|
||||||
conversation.addMessage(usageMessage);
|
conversation.addMessage(usageMessage);
|
||||||
|
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_MESSAGE);
|
Intent intent = new Intent(Broadcast.CONVERSATION_MESSAGE);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, conversation.getName());
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, conversation.getName());
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -145,9 +147,9 @@ public class CommandParser
|
|||||||
message.setColor(Message.COLOR_RED);
|
message.setColor(Message.COLOR_RED);
|
||||||
conversation.addMessage(message);
|
conversation.addMessage(message);
|
||||||
|
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_MESSAGE);
|
Intent intent = new Intent(Broadcast.CONVERSATION_MESSAGE);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, conversation.getName());
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, conversation.getName());
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,9 +47,9 @@ public class EchoHandler extends BaseHandler
|
|||||||
Message message = new Message(BaseHandler.mergeParams(params));
|
Message message = new Message(BaseHandler.mergeParams(params));
|
||||||
conversation.addMessage(message);
|
conversation.addMessage(message);
|
||||||
|
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_MESSAGE);
|
Intent intent = new Intent(Broadcast.CONVERSATION_MESSAGE);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, conversation.getName());
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, conversation.getName());
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
} else {
|
} else {
|
||||||
throw new CommandException("Text is missing");
|
throw new CommandException("Text is missing");
|
||||||
|
@ -56,9 +56,9 @@ public class MeHandler extends BaseHandler
|
|||||||
message.setIcon(R.drawable.action);
|
message.setIcon(R.drawable.action);
|
||||||
server.getConversation(conversation.getName()).addMessage(message);
|
server.getConversation(conversation.getName()).addMessage(message);
|
||||||
|
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_MESSAGE);
|
Intent intent = new Intent(Broadcast.CONVERSATION_MESSAGE);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, conversation.getName());
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, conversation.getName());
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
|
|
||||||
service.getConnection(server.getId()).sendAction(conversation.getName(), action);
|
service.getConnection(server.getId()).sendAction(conversation.getName(), action);
|
||||||
|
@ -60,9 +60,9 @@ public class NamesHandler extends BaseHandler
|
|||||||
message.setColor(Message.COLOR_YELLOW);
|
message.setColor(Message.COLOR_YELLOW);
|
||||||
conversation.addMessage(message);
|
conversation.addMessage(message);
|
||||||
|
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_MESSAGE);
|
Intent intent = new Intent(Broadcast.CONVERSATION_MESSAGE);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, conversation.getName());
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, conversation.getName());
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
65
src/org/yaaic/command/handler/PartHandler.java
Normal file
65
src/org/yaaic/command/handler/PartHandler.java
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
Yaaic - Yet Another Android IRC Client
|
||||||
|
|
||||||
|
Copyright 2009 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.command.CommandException;
|
||||||
|
import org.yaaic.irc.IRCService;
|
||||||
|
import org.yaaic.model.Conversation;
|
||||||
|
import org.yaaic.model.Server;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command: /part [<channel>]
|
||||||
|
*
|
||||||
|
* Leave the current or the given channel
|
||||||
|
*
|
||||||
|
* @author Sebastian Kaspari <sebastian@yaaic.org>
|
||||||
|
*/
|
||||||
|
public class PartHandler extends BaseHandler
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Execute /part
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||||
|
{
|
||||||
|
if (params.length == 1) {
|
||||||
|
if (conversation.getType() != Conversation.TYPE_CHANNEL) {
|
||||||
|
throw new CommandException("Only usable from within a channel");
|
||||||
|
}
|
||||||
|
|
||||||
|
service.getConnection(server.getId()).partChannel(conversation.getName());
|
||||||
|
} else if (params.length == 2) {
|
||||||
|
service.getConnection(server.getId()).partChannel(params[1]);
|
||||||
|
} else {
|
||||||
|
throw new CommandException("Invalid number of params");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Usage of /part
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getUsage()
|
||||||
|
{
|
||||||
|
return "/part [<channel>]";
|
||||||
|
}
|
||||||
|
}
|
@ -59,9 +59,9 @@ public class QueryHandler extends BaseHandler
|
|||||||
|
|
||||||
server.addConversationl(new Query(params[1]));
|
server.addConversationl(new Query(params[1]));
|
||||||
|
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_NEW);
|
Intent intent = new Intent(Broadcast.CONVERSATION_NEW);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, params[1]);
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, params[1]);
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
} else {
|
} else {
|
||||||
throw new CommandException("Invalid number of params");
|
throw new CommandException("Invalid number of params");
|
||||||
|
@ -81,9 +81,9 @@ public class IRCConnection extends PircBot
|
|||||||
message.setColor(Message.COLOR_GREEN);
|
message.setColor(Message.COLOR_GREEN);
|
||||||
server.getConversation(ServerInfo.DEFAULT_NAME).addMessage(message);
|
server.getConversation(ServerInfo.DEFAULT_NAME).addMessage(message);
|
||||||
|
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_MESSAGE);
|
Intent intent = new Intent(Broadcast.CONVERSATION_MESSAGE);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, ServerInfo.DEFAULT_NAME);
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, ServerInfo.DEFAULT_NAME);
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,23 +110,23 @@ public class IRCConnection extends PircBot
|
|||||||
server.addConversationl(conversation);
|
server.addConversationl(conversation);
|
||||||
conversation.addMessage(message);
|
conversation.addMessage(message);
|
||||||
|
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_NEW);
|
Intent intent = new Intent(Broadcast.CONVERSATION_NEW);
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, sender);
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, sender);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
} else {
|
} else {
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_MESSAGE);
|
Intent intent = new Intent(Broadcast.CONVERSATION_MESSAGE);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, sender);
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, sender);
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// A action in a channel
|
// A action in a channel
|
||||||
server.getConversation(target).addMessage(message);
|
server.getConversation(target).addMessage(message);
|
||||||
|
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_MESSAGE);
|
Intent intent = new Intent(Broadcast.CONVERSATION_MESSAGE);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, target);
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, target);
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -153,9 +153,9 @@ public class IRCConnection extends PircBot
|
|||||||
message.setColor(Message.COLOR_BLUE);
|
message.setColor(Message.COLOR_BLUE);
|
||||||
server.getConversation(target).addMessage(message);
|
server.getConversation(target).addMessage(message);
|
||||||
|
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_MESSAGE);
|
Intent intent = new Intent(Broadcast.CONVERSATION_MESSAGE);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, target);
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, target);
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,9 +172,9 @@ public class IRCConnection extends PircBot
|
|||||||
message.setIcon(R.drawable.voice);
|
message.setIcon(R.drawable.voice);
|
||||||
server.getConversation(target).addMessage(message);
|
server.getConversation(target).addMessage(message);
|
||||||
|
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_MESSAGE);
|
Intent intent = new Intent(Broadcast.CONVERSATION_MESSAGE);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, target);
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, target);
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,9 +189,9 @@ public class IRCConnection extends PircBot
|
|||||||
Message message = new Message(sourceNick + " invited " + targetNick);
|
Message message = new Message(sourceNick + " invited " + targetNick);
|
||||||
server.getConversation(target).addMessage(message);
|
server.getConversation(target).addMessage(message);
|
||||||
|
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_MESSAGE);
|
Intent intent = new Intent(Broadcast.CONVERSATION_MESSAGE);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, target);
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, target);
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,8 +207,8 @@ public class IRCConnection extends PircBot
|
|||||||
// We joined a new channel
|
// We joined a new channel
|
||||||
server.addConversationl(new Channel(target));
|
server.addConversationl(new Channel(target));
|
||||||
|
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_NEW);
|
Intent intent = new Intent(Broadcast.CONVERSATION_NEW);
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, target);
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, target);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
} else {
|
} else {
|
||||||
@ -217,9 +217,9 @@ public class IRCConnection extends PircBot
|
|||||||
message.setColor(Message.COLOR_GREEN);
|
message.setColor(Message.COLOR_GREEN);
|
||||||
server.getConversation(target).addMessage(message);
|
server.getConversation(target).addMessage(message);
|
||||||
|
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_MESSAGE);
|
Intent intent = new Intent(Broadcast.CONVERSATION_MESSAGE);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, target);
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, target);
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -236,18 +236,18 @@ public class IRCConnection extends PircBot
|
|||||||
// We are kicked
|
// We are kicked
|
||||||
server.removeConversation(target);
|
server.removeConversation(target);
|
||||||
|
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_REMOVE);
|
Intent intent = new Intent(Broadcast.CONVERSATION_REMOVE);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, target);
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, target);
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
} else {
|
} else {
|
||||||
Message message = new Message(kickerNick + " kicked " + recipientNick);
|
Message message = new Message(kickerNick + " kicked " + recipientNick);
|
||||||
message.setColor(Message.COLOR_GREEN);
|
message.setColor(Message.COLOR_GREEN);
|
||||||
server.getConversation(target).addMessage(message);
|
server.getConversation(target).addMessage(message);
|
||||||
|
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_MESSAGE);
|
Intent intent = new Intent(Broadcast.CONVERSATION_MESSAGE);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, target);
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, target);
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -266,9 +266,9 @@ public class IRCConnection extends PircBot
|
|||||||
Message message = new Message("<" + sender + "> " + text);
|
Message message = new Message("<" + sender + "> " + text);
|
||||||
server.getConversation(target).addMessage(message);
|
server.getConversation(target).addMessage(message);
|
||||||
|
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_MESSAGE);
|
Intent intent = new Intent(Broadcast.CONVERSATION_MESSAGE);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, target);
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, target);
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,9 +304,9 @@ public class IRCConnection extends PircBot
|
|||||||
message.setColor(Message.COLOR_GREEN);
|
message.setColor(Message.COLOR_GREEN);
|
||||||
server.getConversation(target).addMessage(message);
|
server.getConversation(target).addMessage(message);
|
||||||
|
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_MESSAGE);
|
Intent intent = new Intent(Broadcast.CONVERSATION_MESSAGE);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, target);
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, target);
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -334,9 +334,9 @@ public class IRCConnection extends PircBot
|
|||||||
message.setIcon(R.drawable.info);
|
message.setIcon(R.drawable.info);
|
||||||
conversation.addMessage(message);
|
conversation.addMessage(message);
|
||||||
|
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_MESSAGE);
|
Intent intent = new Intent(Broadcast.CONVERSATION_MESSAGE);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, conversation.getName());
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, conversation.getName());
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,9 +353,9 @@ public class IRCConnection extends PircBot
|
|||||||
message.setIcon(R.drawable.op);
|
message.setIcon(R.drawable.op);
|
||||||
server.getConversation(target).addMessage(message);
|
server.getConversation(target).addMessage(message);
|
||||||
|
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_MESSAGE);
|
Intent intent = new Intent(Broadcast.CONVERSATION_MESSAGE);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, target);
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, target);
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,9 +371,9 @@ public class IRCConnection extends PircBot
|
|||||||
// We pareted a channel
|
// We pareted a channel
|
||||||
server.removeConversation(target);
|
server.removeConversation(target);
|
||||||
|
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_REMOVE);
|
Intent intent = new Intent(Broadcast.CONVERSATION_REMOVE);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, target);
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, target);
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
} else {
|
} else {
|
||||||
Message message = new Message(sender + " parted");
|
Message message = new Message(sender + " parted");
|
||||||
@ -381,9 +381,9 @@ public class IRCConnection extends PircBot
|
|||||||
message.setIcon(R.drawable.part);
|
message.setIcon(R.drawable.part);
|
||||||
server.getConversation(target).addMessage(message);
|
server.getConversation(target).addMessage(message);
|
||||||
|
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_MESSAGE);
|
Intent intent = new Intent(Broadcast.CONVERSATION_MESSAGE);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, target);
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, target);
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -409,16 +409,16 @@ public class IRCConnection extends PircBot
|
|||||||
conversation.addMessage(message);
|
conversation.addMessage(message);
|
||||||
server.addConversationl(conversation);
|
server.addConversationl(conversation);
|
||||||
|
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_NEW);
|
Intent intent = new Intent(Broadcast.CONVERSATION_NEW);
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, sender);
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, sender);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
} else {
|
} else {
|
||||||
conversation.addMessage(message);
|
conversation.addMessage(message);
|
||||||
|
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_MESSAGE);
|
Intent intent = new Intent(Broadcast.CONVERSATION_MESSAGE);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, sender);
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, sender);
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -438,9 +438,9 @@ public class IRCConnection extends PircBot
|
|||||||
message.setIcon(R.drawable.quit);
|
message.setIcon(R.drawable.quit);
|
||||||
server.getConversation(target).addMessage(message);
|
server.getConversation(target).addMessage(message);
|
||||||
|
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_MESSAGE);
|
Intent intent = new Intent(Broadcast.CONVERSATION_MESSAGE);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, target);
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, target);
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -469,9 +469,9 @@ public class IRCConnection extends PircBot
|
|||||||
// remember channel's topic
|
// remember channel's topic
|
||||||
((Channel) server.getConversation(target)).setTopic(topic);
|
((Channel) server.getConversation(target)).setTopic(topic);
|
||||||
|
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_MESSAGE);
|
Intent intent = new Intent(Broadcast.CONVERSATION_MESSAGE);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, target);
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, target);
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -499,9 +499,9 @@ public class IRCConnection extends PircBot
|
|||||||
message.setColor(Message.COLOR_BLUE);
|
message.setColor(Message.COLOR_BLUE);
|
||||||
server.getConversation(target).addMessage(message);
|
server.getConversation(target).addMessage(message);
|
||||||
|
|
||||||
Intent intent = new Intent(Broadcast.CHANNEL_MESSAGE);
|
Intent intent = new Intent(Broadcast.CONVERSATION_MESSAGE);
|
||||||
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
intent.putExtra(Broadcast.EXTRA_CHANNEL, target);
|
intent.putExtra(Broadcast.EXTRA_CONVERSATION, target);
|
||||||
service.sendBroadcast(intent);
|
service.sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,14 +20,19 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
*/
|
*/
|
||||||
package org.yaaic.model;
|
package org.yaaic.model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constants and helpers for Broadcasts
|
||||||
|
*
|
||||||
|
* @author Sebastian Kaspari <sebastian@yaaic.org>
|
||||||
|
*/
|
||||||
public class Broadcast
|
public class Broadcast
|
||||||
{
|
{
|
||||||
public static final String SERVER_UPDATE = "org.yaaic.server.status";
|
public static final String SERVER_UPDATE = "org.yaaic.server.status";
|
||||||
|
|
||||||
public static final String CHANNEL_MESSAGE = "org.yaaic.channel.message";
|
public static final String CONVERSATION_MESSAGE = "org.yaaic.conversation.message";
|
||||||
public static final String CHANNEL_NEW = "org.yaaic.channel.new";
|
public static final String CONVERSATION_NEW = "org.yaaic.conversation.new";
|
||||||
public static final String CHANNEL_REMOVE = "org.yaaic.channel.remove";
|
public static final String CONVERSATION_REMOVE = "org.yaaic.conversation.remove";
|
||||||
|
|
||||||
public static final String EXTRA_CHANNEL = "channel";
|
public static final String EXTRA_SERVER = "server";
|
||||||
public static final String EXTRA_SERVER = "server";
|
public static final String EXTRA_CONVERSATION = "conversation";
|
||||||
}
|
}
|
||||||
|
@ -56,12 +56,12 @@ public class ChannelReceiver extends BroadcastReceiver
|
|||||||
|
|
||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
|
|
||||||
if (action.equals(Broadcast.CHANNEL_MESSAGE)) {
|
if (action.equals(Broadcast.CONVERSATION_MESSAGE)) {
|
||||||
listener.onConversationMessage(intent.getExtras().getString(Broadcast.EXTRA_CHANNEL));
|
listener.onConversationMessage(intent.getExtras().getString(Broadcast.EXTRA_CONVERSATION));
|
||||||
} else if (action.equals(Broadcast.CHANNEL_NEW)) {
|
} else if (action.equals(Broadcast.CONVERSATION_NEW)) {
|
||||||
listener.onNewConversation(intent.getExtras().getString(Broadcast.EXTRA_CHANNEL));
|
listener.onNewConversation(intent.getExtras().getString(Broadcast.EXTRA_CONVERSATION));
|
||||||
} else if (action.equals(Broadcast.CHANNEL_REMOVE)) {
|
} else if (action.equals(Broadcast.CONVERSATION_REMOVE)) {
|
||||||
intent.getExtras().getString(Broadcast.EXTRA_CHANNEL);
|
intent.getExtras().getString(Broadcast.EXTRA_CONVERSATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -126,9 +126,9 @@ public class ConversationActivity extends Activity implements ServiceConnection,
|
|||||||
bindService(intent, this, 0);
|
bindService(intent, this, 0);
|
||||||
|
|
||||||
channelReceiver = new ChannelReceiver(server.getId(), this);
|
channelReceiver = new ChannelReceiver(server.getId(), this);
|
||||||
registerReceiver(channelReceiver, new IntentFilter(Broadcast.CHANNEL_MESSAGE));
|
registerReceiver(channelReceiver, new IntentFilter(Broadcast.CONVERSATION_MESSAGE));
|
||||||
registerReceiver(channelReceiver, new IntentFilter(Broadcast.CHANNEL_NEW));
|
registerReceiver(channelReceiver, new IntentFilter(Broadcast.CONVERSATION_NEW));
|
||||||
registerReceiver(channelReceiver, new IntentFilter(Broadcast.CHANNEL_REMOVE));
|
registerReceiver(channelReceiver, new IntentFilter(Broadcast.CONVERSATION_REMOVE));
|
||||||
|
|
||||||
serverReceiver = new ServerReceiver(this);
|
serverReceiver = new ServerReceiver(this);
|
||||||
registerReceiver(serverReceiver, new IntentFilter(Broadcast.SERVER_UPDATE));
|
registerReceiver(serverReceiver, new IntentFilter(Broadcast.SERVER_UPDATE));
|
||||||
|
Loading…
Reference in New Issue
Block a user