/** * Register a resultReceiver with this server, that will get notification when a change happens * with the connection to the core Like when the connection is lost. * * @param resultReceiver - Receiver that will get the status updates */ public void registerStatusReceiver(ResultReceiver resultReceiver) { statusReceivers.add(resultReceiver); if (coreConn != null && coreConn.isConnected()) { resultReceiver.send(CoreConnService.CONNECTION_CONNECTED, null); } else { resultReceiver.send(CoreConnService.CONNECTION_DISCONNECTED, null); } }
/** * 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 } } }
public boolean isConnected() { return coreConn.isConnected(); }
public void disconnectFromCore() { notifyManager.cancel(R.id.NOTIFICATION); if (coreConn != null) coreConn.disconnect(); }
public void getMoreBacklog(int bufferId, int amount) { Log.d(TAG, "Fetching more backlog"); coreConn.requestMoreBacklog(bufferId, amount); }
public void setMarkerLine(int bufferId, int msgId) { coreConn.requestSetMarkerLine(bufferId, msgId); bufferCollection.getBuffer(bufferId).setMarkerLineMessage(msgId); }
public void setLastSeen(int bufferId, int msgId) { coreConn.requestSetLastMsgRead(bufferId, msgId); bufferCollection.getBuffer(bufferId).setLastSeenMessage(msgId); }
public void markBufferAsRead(int bufferId) { coreConn.requestMarkBufferAsRead(bufferId); }
public void sendMessage(int bufferId, String message) { coreConn.sendMessage(bufferId, message); }