1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-26 02:42:16 -05:00

Open a new query if it doesnt exist on "external" action (/me)

This commit is contained in:
Sebastian Kaspari 2010-03-10 21:46:12 +01:00
parent 2f97adaf30
commit 94f624360d

View File

@ -89,20 +89,37 @@ public class IRCConnection extends PircBot
// Strip mIRC colors and formatting
action = Colors.removeFormattingAndColors(action);
if (target.equals(this.getNick())) {
// We are the target - this is an action in a query
target = sender;
}
Message message = new Message(sender + " " + action);
message.setIcon(R.drawable.action);
server.getConversation(target).addMessage(message);
if (target.equals(this.getNick())) {
// We are the target - this is an action in a query
Conversation conversation = server.getConversation(sender);
if (conversation == null) {
// Open a query if there's none yet
conversation = new Query(sender);
server.addConversationl(conversation);
conversation.addMessage(message);
Intent intent = new Intent(Broadcast.CHANNEL_MESSAGE);
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
intent.putExtra(Broadcast.EXTRA_CHANNEL, target);
service.sendBroadcast(intent);
Intent intent = new Intent(Broadcast.CHANNEL_NEW);
intent.putExtra(Broadcast.EXTRA_CHANNEL, sender);
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
service.sendBroadcast(intent);
} else {
Intent intent = new Intent(Broadcast.CHANNEL_MESSAGE);
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
intent.putExtra(Broadcast.EXTRA_CHANNEL, sender);
service.sendBroadcast(intent);
}
} else {
// A action in a channel
server.getConversation(target).addMessage(message);
Intent intent = new Intent(Broadcast.CHANNEL_MESSAGE);
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
intent.putExtra(Broadcast.EXTRA_CHANNEL, target);
service.sendBroadcast(intent);
}
}
/**
@ -358,22 +375,21 @@ public class IRCConnection extends PircBot
// Strip mIRC colors and formatting
text = Colors.removeFormattingAndColors(text);
Message message = new Message("<" + sender + "> " + text);
Conversation conversation = server.getConversation(sender);
if (conversation == null) {
// Open a query if there's none yet
conversation = new Query(sender);
server.addConversationl(conversation);
Message message = new Message("<" + sender + "> " + text);
conversation.addMessage(message);
server.addConversationl(conversation);
Intent intent = new Intent(Broadcast.CHANNEL_NEW);
intent.putExtra(Broadcast.EXTRA_CHANNEL, sender);
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
service.sendBroadcast(intent);
} else {
Message message = new Message("<" + sender + "> " + text);
conversation.addMessage(message);
Intent intent = new Intent(Broadcast.CHANNEL_MESSAGE);