+ this.log.append(Html.fromHtml("<b>*** " + text + "</b><br />"));
+ }
+
+ private void display(Message msg)
+ {
+ String when = DateFormat.format("hh:mm:ss", msg.time).toString();
+ String from = String.format("<font color=\"#ff88ff\">%s</font>", msg.from);
+ String text = msg.msg;
+ String fmt = null;
+
+ // Do IRC Colors - only partly works
+ String fg = "<font color=\"<$1>\">";
+ text = text
+ .replaceAll("&", "&")
+ .replaceAll("<", "<")
+ .replaceAll(">", ">");
+ text = text
+ .replaceAll("\\002", "<b>") // bold
+ .replaceAll("\\011", "<i>") // italic
+ .replaceAll("\\025", "<u>"); // underline
+ text = text
+ .replaceAll("\\003(\\d+)(,\\d+)?", fg) // color
+ .replaceAll("\\013(\\d+)(,\\d+)?", fg); // color
+ text = text
+ .replaceAll("<0?0>", "#000000") // White
+ .replaceAll("<0?1>", "#000000") // Black
+ .replaceAll("<0?2>", "#000080") // Navy Blue
+ .replaceAll("<0?3>", "#008000") // Green
+ .replaceAll("<0?4>", "#FF0000") // Red
+ .replaceAll("<0?5>", "#804040") // Brown
+ .replaceAll("<0?6>", "#8000FF") // Purple
+ .replaceAll("<0?7>", "#808000") // Olive
+ .replaceAll("<0?8>", "#FFFF00") // Yellow
+ .replaceAll("<0?9>", "#00FF00") // Lime Green
+ .replaceAll("<10>", "#008080") // Teal
+ .replaceAll("<11>", "#00FFFF") // Aqua Light
+ .replaceAll("<12>", "#0000FF") // Royal Blue
+ .replaceAll("<13>", "#FF00FF") // Hot Pink
+ .replaceAll("<14>", "#808080") // Dark Gray
+ .replaceAll("<15>", "#C0C0C0"); // Light Gray
+
+ // Message formatting
+ switch (msg.how) {
+ case DIRECT:
+ case MENTION:
+ case PRIVMSG:
+ fmt = "<b>(%s) %s: %s</b>";
+ break;
+ case SENT:
+ fmt = "(%s) <b>%s</b>: %s";
+ break;
+ default:
+ fmt = "(%s) %s: %s";
+ break;
+ }
+
+ String html = String.format(fmt, when, from, text);
+ this.log.append(Html.fromHtml(html + "<br />"));