示例#1
0
  private void registerAction(String uin, String laction, String msg) {
    if (!profile.getBoolean(Profile.OPTION_ENABLE_MM)) {
      return;
    }
    boolean needAddCommands = uins.size() == 0;
    uins.addElement(uin);

    if (uins.size() >= 1 && needAddCommands) {
      addCommandEx(JimmUI.cmdMenu, MENU_TYPE_LEFT_BAR);
    }
    ContactItem contact = profile.getItemByUIN(uin);
    String action = ResourceBundle.getString(laction);
    int counter = idx++;
    String date = DateAndTime.getDateString(true, false);
    int color = getColor(COLOR_CAP2);
    lock();

    if (contact == null) {
      addBigText(
          "[" + counter + "]: " + uin + " (" + date + ")\n", color, Font.STYLE_BOLD, counter);
    } else {
      addBigText(
          "[" + counter + "]: " + contact.name + " (" + date + ")\n",
          color,
          Font.STYLE_BOLD,
          counter);
    }
    color = getColor(COLOR_TEXT);

    if (contact != null) {
      if ((contact.getIntValue(ContactItem.CONTACTITEM_STATUS) == ContactItem.STATUS_OFFLINE)
          && (action.equals(ResourceBundle.getString("read xtraz"))
              || action.equals(ResourceBundle.getString("read status message")))
          && !contact.getBooleanValue(ContactItem.CONTACTITEM_IS_TEMP)) {
        addBigText(ResourceBundle.getString("status_invisible"), color, Font.STYLE_PLAIN, counter);
        contact.setStatus(ContactItem.STATUS_INVISIBLE, true);
      } else {
        addBigText(action, color, Font.STYLE_PLAIN, counter);
      }
    } else {
      addBigText(action, color, Font.STYLE_PLAIN, counter);
    }

    if (msg != null) {
      doCRLF(counter);
      addBigText(msg, color, Font.STYLE_PLAIN, counter);
    }

    doCRLF(counter);
    unlock();
  }