/** * Checks if there is a highlight in the message and then sets the flag of that message to * highlight * * @param buffer the buffer the message belongs to * @param message the message to check */ public void checkMessageForHighlight(Buffer buffer, IrcMessage message) { if (message.type == IrcMessage.Type.Plain) { String nick = coreConn.getNick(buffer.getInfo().networkId); if (nick == null) { Log.e(TAG, "Nick is null in check message for highlight"); return; } else if (nick.equals("")) return; Pattern regexHighlight = Pattern.compile( ".*(?<!(\\w|\\d))" + coreConn.getNick(buffer.getInfo().networkId) + "(?!(\\w|\\d)).*", Pattern.CASE_INSENSITIVE); Matcher matcher = regexHighlight.matcher(message.content); if (matcher.find()) { message.setFlag(IrcMessage.Flag.Highlight); // FIXME: move to somewhere proper } } }