From 808f56d9784d6a7b17bb21d8fa00cac6254bd685 Mon Sep 17 00:00:00 2001 From: Sebastian Kaspari Date: Sat, 6 Mar 2010 21:05:23 +0100 Subject: [PATCH] Strip mIRC colors and formatting from messages --- src/org/yaaic/irc/IRCConnection.java | 13 +++++++++++++ src/org/yaaic/view/ServerActivity.java | 1 + 2 files changed, 14 insertions(+) diff --git a/src/org/yaaic/irc/IRCConnection.java b/src/org/yaaic/irc/IRCConnection.java index 6782ba5..3a06985 100644 --- a/src/org/yaaic/irc/IRCConnection.java +++ b/src/org/yaaic/irc/IRCConnection.java @@ -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 } diff --git a/src/org/yaaic/view/ServerActivity.java b/src/org/yaaic/view/ServerActivity.java index a2eab52..c181975 100644 --- a/src/org/yaaic/view/ServerActivity.java +++ b/src/org/yaaic/view/ServerActivity.java @@ -274,5 +274,6 @@ public class ServerActivity extends Activity implements ServiceConnection, Chann */ public void onRemoveChannel(String target) { + // XXX: Implement me :) } }