Strip mIRC colors and formatting from messages

This commit is contained in:
Sebastian Kaspari 2010-03-06 21:05:23 +01:00
parent 9fb8460b6d
commit 808f56d978
2 changed files with 14 additions and 0 deletions

View File

@ -23,6 +23,7 @@ package org.yaaic.irc;
import android.content.Intent;
import android.util.Log;
import org.jibble.pircbot.Colors;
import org.jibble.pircbot.PircBot;
import org.jibble.pircbot.User;
@ -81,6 +82,9 @@ public class IRCConnection extends PircBot
{
debug("Action", target + " " + sender + " " + action);
// Strip mIRC colors and formatting
action = Colors.removeFormattingAndColors(action);
Message message = new Message(sender + " " + action);
message.setIcon(R.drawable.action);
server.getChannel(target).addMessage(message);
@ -219,6 +223,9 @@ public class IRCConnection extends PircBot
protected void onMessage(String target, String sender, String login, String hostname, String text)
{
debug("Message", target + " " + sender + " " + text);
// Strip mIRC colors and formatting
text = Colors.removeFormattingAndColors(text);
Message message = new Message("<" + sender + "> " + text);
server.getChannel(target).addMessage(message);
@ -267,6 +274,9 @@ public class IRCConnection extends PircBot
{
debug("Notice", sourceNick + " " + notice);
// Strip mIRC colors and formatting
notice = Colors.removeFormattingAndColors(notice);
// XXX: Where should notices be shown? Current window? All windows? Server window?
}
@ -326,6 +336,9 @@ public class IRCConnection extends PircBot
{
debug("PrivateMessage", sender + " " + message);
// Strip mIRC colors and formatting
message = Colors.removeFormattingAndColors(message);
// XXX: Open a query if there's none yet
}

View File

@ -274,5 +274,6 @@ public class ServerActivity extends Activity implements ServiceConnection, Chann
*/
public void onRemoveChannel(String target)
{
// XXX: Implement me :)
}
}