Пример #1
0
  /** On Kick */
  @Override
  protected void onKick(
      String target,
      String kickerNick,
      String kickerLogin,
      String kickerHostname,
      String recipientNick,
      String reason) {
    if (recipientNick.equals(getNick())) {
      // We are kicked
      service.ackNewMentions(server.getId(), target);
      server.removeConversation(target);

      Intent intent =
          Broadcast.createConversationIntent(Broadcast.CONVERSATION_REMOVE, server.getId(), target);
      service.sendBroadcast(intent);
    } else {
      Message message =
          new Message(service.getString(R.string.message_kick, kickerNick, recipientNick));
      message.setColor(Message.COLOR_GREEN);
      server.getConversation(target).addMessage(message);

      Intent intent =
          Broadcast.createConversationIntent(
              Broadcast.CONVERSATION_MESSAGE, server.getId(), target);
      service.sendBroadcast(intent);
    }
  }
Пример #2
0
  /** On Part */
  @Override
  protected void onPart(String target, String sender, String login, String hostname) {
    if (sender.equals(getNick())) {
      // We parted a channel
      service.ackNewMentions(server.getId(), target);
      server.removeConversation(target);

      Intent intent =
          Broadcast.createConversationIntent(Broadcast.CONVERSATION_REMOVE, server.getId(), target);
      service.sendBroadcast(intent);
    } else if (service.getSettings().showJoinPartAndQuit()) {
      Message message =
          new Message(service.getString(R.string.message_part, sender), Message.TYPE_MISC);

      message.setColor(Message.COLOR_GREEN);
      message.setIcon(R.drawable.part);
      server.getConversation(target).addMessage(message);

      Intent intent =
          Broadcast.createConversationIntent(
              Broadcast.CONVERSATION_MESSAGE, server.getId(), target);
      service.sendBroadcast(intent);
    }
  }