コード例 #1
0
  public void commandAction(Command c, Displayable d) {
    if (c == cmdCancel) {
      destroyView();
    }
    // if (c==cmdBookmarks) { new Bookmarks(display, null); }
    if (c == cmdJoin || c == cmdAdd) {
      String nick = nickField.getString().trim();
      String host = hostField.getString().trim();
      String room = roomField.getString().trim();
      String pass = passField.getString();
      int msgLimit = msgLimitField.getValue();

      if (nick.length() == 0) return;
      if (room.length() == 0) return;
      if (host.length() == 0) return;
      StringBuffer gchat = new StringBuffer(room.trim());
      gchat.append('@');
      gchat.append(host.trim());
      // sd.roster.mucContact(gchat.toString(), Contact.ORIGIN_GROUPCHAT);
      if (c == cmdAdd) new Bookmarks(display, new BookmarkItem(gchat.toString(), nick, pass));
      else {
        try {
          gchat.append('/');
          gchat.append(nick);
          join(gchat.toString(), pass, msgLimit);

          display.setCurrent(sd.roster);
        } catch (Exception e) {
          e.printStackTrace();
          // display.setCurrent(new Alert("Exception", e.toString(), null, AlertType.ERROR),
          // sd.roster);
        }
      }
    }
  }
コード例 #2
0
  public void commandAction(Command c, Displayable d) {
    if (c == cmdCancel) {
      destroyView();
      return;
    }
    if (c == cmdOk) {
      try {
        int type = choiseType.getSelectedIndex();
        String value = textValue.getString();
        if (type == 2) value = PrivacyItem.subscrs[choiceSubscr.getSelectedIndex()];
        if (type != PrivacyItem.ITEM_ANY) if (value.length() == 0) return;
        // int order=Integer.parseInt(textOrder.getString());

        item.action = choiceAction.getSelectedIndex();
        item.type = type;
        item.value = value;
        // item.order=order;
        choiseStanzas.getSelectedFlags(item.stanzasSet);

        if (targetList != null)
          if (!targetList.rules.contains(item)) {
            targetList.addRule(item);
            item.order = targetList.rules.indexOf(item) * 10;
          }
        destroyView();
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }