示例#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);
 }