예제 #1
0
 /**
  * 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);
   }
 }
예제 #2
0
  /**
   * 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
      }
    }
  }
예제 #3
0
 public boolean isConnected() {
   return coreConn.isConnected();
 }
예제 #4
0
 public void disconnectFromCore() {
   notifyManager.cancel(R.id.NOTIFICATION);
   if (coreConn != null) coreConn.disconnect();
 }
예제 #5
0
 public void getMoreBacklog(int bufferId, int amount) {
   Log.d(TAG, "Fetching more backlog");
   coreConn.requestMoreBacklog(bufferId, amount);
 }
예제 #6
0
 public void setMarkerLine(int bufferId, int msgId) {
   coreConn.requestSetMarkerLine(bufferId, msgId);
   bufferCollection.getBuffer(bufferId).setMarkerLineMessage(msgId);
 }
예제 #7
0
 public void setLastSeen(int bufferId, int msgId) {
   coreConn.requestSetLastMsgRead(bufferId, msgId);
   bufferCollection.getBuffer(bufferId).setLastSeenMessage(msgId);
 }
예제 #8
0
 public void markBufferAsRead(int bufferId) {
   coreConn.requestMarkBufferAsRead(bufferId);
 }
예제 #9
0
 public void sendMessage(int bufferId, String message) {
   coreConn.sendMessage(bufferId, message);
 }