Example #1
0
 /**
  * Method to ignore all incoming messages from a user
  *
  * @param i the user to ignore
  * @param quite if true will not show confirmation
  * @return true on succes, false on failure
  */
 private boolean ignore(String i, boolean quiet) {
   if (username.equals(i) || i.equals("server") || admins.contains(i)) {
     if (!quiet) {
       error("can't ignore that person");
     }
     return false;
   }
   if (!users.contains(i)) {
     if (!quiet) {
       error("user does not exists");
     }
     return false;
   }
   if (ignores.contains(i)) {
     if (!quiet) {
       error("already ignoring user");
     }
     return false;
   }
   ignores.add(i);
   updateList();
   if (!quiet) {
     serverMessage("ignoring " + i);
   }
   return true;
 }
Example #2
0
 /**
  * removes a user from the user list
  *
  * @param un the name of the user to be removed
  */
 public void userDel(String un) {
   users.remove(users.indexOf(un));
   if (ignores.contains(un)) {
     ignores.remove(ignores.indexOf(un));
   }
   if (afks.contains(un)) {
     afks.remove(afks.indexOf(un));
   }
   if (admins.contains(un)) {
     admins.remove(admins.indexOf(un));
   }
   updateList();
   serverMessage(un + " has left " + server.channel);
   privates.serverMessage(un, un + " has left");
 }
Example #3
0
 private static TreePath[] removeDuplicates(final TreePath[] paths) {
   final ArrayList<TreePath> result = new ArrayList<TreePath>();
   for (final TreePath path : paths) {
     if (!result.contains(path)) result.add(path);
   }
   return result.toArray(new TreePath[result.size()]);
 }
  private void removeProgress(@NotNull InlineProgressIndicator progress) {
    synchronized (myOriginals) {
      if (!myInline2Original.containsKey(progress)) return;

      final boolean last = myOriginals.size() == 1;
      final boolean beforeLast = myOriginals.size() == 2;

      myPopup.removeIndicator(progress);

      final ProgressIndicatorEx original = removeFromMaps(progress);
      if (myOriginals.contains(original)) return;

      if (last) {
        restoreEmptyStatus();
        if (myShouldClosePopupAndOnProcessFinish) {
          hideProcessPopup();
        }
      } else {
        if (myPopup.isShowing() || myOriginals.size() > 1) {
          buildInProcessCount();
        } else if (beforeLast) {
          buildInInlineIndicator(createInlineDelegate(myInfos.get(0), myOriginals.get(0), true));
        } else {
          restoreEmptyStatus();
        }
      }

      runQuery();
    }
  }
Example #5
0
  public boolean moveValid(Square candidateSquare) {
    if (piece == 0) {
      setListForKing();
    }
    if (piece == 1) {
      setListForQueen();
    }
    if (piece == 2) {
      moveList.clear();
      setListForRook();
    }
    if (piece == 3) {
      setListForKnight();
    }
    if (piece == 4) {
      setListForBishop();
    }

    if (piece == 5) {
      setListForPawn();
    }

    if (moveList.contains(candidateSquare.getPosition())) {
      return true;
    }
    return false;
  }
 // ////////////////////////////////////
 // DbRefreshListener SUPPORT
 //
 // Overridden
 public void refreshAfterDbUpdate(DbUpdateEvent evt) throws DbException {
   if (evt.metaField == DbObject.fComponents) { // add, remove, or move to
     // another parent
     if (evt.neighbor instanceof DbGraphicalObjectI) // optimization:
       // discard
       // immediately the
       // graphical objects
       return;
     if (evt.op == Db.REMOVE_FROM_RELN) {
       // DbObject removed or with a new parent: remove the node from
       // its old parent if loaded.
       DynamicNode node = getDynamicNode(evt.neighbor, Db.OLD_VALUE, false);
       if (node != null) removeNode(node);
     } else if (evt.op == Db.ADD_TO_RELN) {
       // DbObject added or with a new parent: if its new parent has
       // its chidren loaded,
       // add a node for the new child.
       getDynamicNode(evt.neighbor, false);
     } else { // Db.REINSERT_IN_RELN
       DynamicNode node = getDynamicNode(evt.neighbor, false);
       if ((node != null && !childrenAreSorted(evt.dbo))
           || (node != null && !node.getGroupParams().sorted)) {
         DynamicNode parentNode = (DynamicNode) node.getParent();
         updateInsertIndexInChildrenOfNode(parentNode);
         removeNodeFromParent(node);
         int index = getInsertionIndex(evt.dbo, evt.neighbor, parentNode, node);
         insertNodeInto(node, parentNode, index);
       }
     }
   }
   // name refresh
   else if (evt.metaField == DbSemanticalObject.fName || tooltipsFields.contains(evt.metaField)) {
     updateNode(evt.dbo);
   }
 }
    protected void writeAuditTrail(String strPath, String strUser, StringBuffer sbValues) {
      BufferedReader reader = WFileUtil.openReadFile(strPath);
      String strLine;
      ArrayList aListData = WUtil.strToAList(sbValues.toString(), false, "\n");
      StringBuffer sbData = sbValues;
      String strPnl = (this instanceof DisplayTemplate) ? "Data Template " : "Data Dir ";
      if (reader == null) {
        Messages.postDebug("Error opening file " + strPath);
        return;
      }

      try {
        while ((strLine = reader.readLine()) != null) {
          // if the line in the file is not in the arraylist,
          // then that line has been deleted
          if (!aListData.contains(strLine))
            WUserUtil.writeAuditTrail(new Date(), strUser, "Deleted " + strPnl + strLine);

          // remove the lines that are also in the file or those which
          // have been deleted.
          aListData.remove(strLine);
        }

        // Traverse through the remaining new lines in the arraylist,
        // and write it to the audit trail
        for (int i = 0; i < aListData.size(); i++) {
          strLine = (String) aListData.get(i);
          WUserUtil.writeAuditTrail(new Date(), strUser, "Added " + strPnl + strLine);
        }
        reader.close();
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
Example #8
0
 private Card genNewCard() {
   Random rand = new Random();
   Card card = new Card(rand.nextInt(52) + 1);
   while (cardUsed.contains(card)) card = new Card(rand.nextInt(52) + 1);
   cardUsed.add(card);
   return card;
 }
Example #9
0
 /**
  * adds a new user to the interal list of users
  *
  * @param un the name of the user to be added
  */
 public void userAdd(String un) {
   if (!users.contains(un)) {
     users.add(un);
     updateList();
     if (!un.equals(username) && showUserStatus)
       serverMessage(un + " has joined " + server.channel);
   }
 }
Example #10
0
 /**
  * changes the name of a user, updating list of admins, afks, ignoes, and master user list
  *
  * @param on old username
  * @param nn new username
  */
 public void rename(String on, String nn) {
   if (admins.contains(on)) {
     admins.remove(admins.indexOf(on));
     admins.add(nn);
   }
   if (afks.contains(on)) {
     afks.remove(afks.indexOf(on));
     afks.add(nn);
   }
   if (ignores.contains(on)) {
     ignores.remove(ignores.indexOf(on));
     ignores.add(nn);
   }
   users.remove(on);
   users.add(nn);
   updateList();
   serverMessage(on + " renamed to " + nn);
 }
 @Override
 protected ArrayList<IdeaPluginDescriptor> toProcess() {
   ArrayList<IdeaPluginDescriptor> toProcess = super.toProcess();
   for (IdeaPluginDescriptor descriptor : myInstalled) {
     if (!toProcess.contains(descriptor)) {
       toProcess.add(descriptor);
     }
   }
   return toProcess;
 }
Example #12
0
 /**
  * Gets the list of the vnmrj users(operators) for the current unix user logged in
  *
  * @return the list of vnmrj users
  */
 protected Object[] getOperators() {
   String strUser = System.getProperty("user.name");
   User user = LoginService.getDefault().getUser(strUser);
   ArrayList<String> aListOperators = user.getOperators();
   if (aListOperators == null || aListOperators.isEmpty())
     aListOperators = new ArrayList<String>();
   Collections.sort(aListOperators);
   if (aListOperators.contains(strUser)) aListOperators.remove(strUser);
   aListOperators.add(0, strUser);
   return (aListOperators.toArray());
 }
  public int getRandomImageNum() {
    if (images.size() <= images_used.size()) return -1;
    else {
      // Calculate, based on random, if we try to get from the new images
      boolean getFromNewImages;
      if (Math.random() * 100 < percentage_of_new_images) {
        getFromNewImages = true;
      } else {
        getFromNewImages = false;
      }

      int i;
      int j = 0;
      int tries = 0;
      while (true && tries < randomImageNum_maxTries) {
        // Always try the last added pictures
        if (images_nevershown.size() > 0
            && tries < (int) (randomImageNum_maxTries / 4) // Only use 1/4 of the tries here
        ) {
          i = images_nevershown.get(0);
          tries++;
        } else if (getFromNewImages
            && images_lastadded.size() > 0
            && tries < (int) (randomImageNum_maxTries / 2) // Only use 1/2 of the tries here
        ) {
          j = (int) (images_lastadded.size() * Math.random());
          i = images_lastadded.get(j);
          tries++;
        } else {
          // Random from the rest of the pictures
          i = (int) (Math.random() * images.size());
          tries++;
        }
        if (!images_used.contains((Integer) i)) return i;
      }

      System.out.println("Max tries in randomImageNum");
      return -1;
    }

    // Original:
    // return (int)(Math.random() * images.size());
  }
Example #14
0
  /**
   * Add the given file name to the list of recent files in the given Properties object, trimming
   * the length of the list to 10. If the given name is already in the list, move it to the top.
   */
  public static void addRecentFile(Properties preferences, String newName) {

    // - if newName isn't already in the list, we add it to the top of the list.
    // - if it's already in the list, we move it to the top.
    ArrayList<String> list = MiscUtilities.parseRecentFiles(preferences);
    if (list.contains(newName)) {
      // move it to the top :
      list.remove(newName);
      list.add(0, newName);
    } else {
      list.add(0, newName);
    }
    // store to preferences :
    for (int i = 0; i < MAX_RECENT_FILES && i < list.size(); i++) {
      String key = KEY_RECENT_FILE + "." + Integer.toString(i + 1); // starts from 1
      String val = list.get(i);
      preferences.setProperty(key, val);
    }
  }
Example #15
0
 /*
  * this method return a new file that contain the new format of the protein sequence.
  */
 private void CreatedTranslatedText(Reader rd) {
   ArrayList<String> allData = new ArrayList<String>();
   Scanner scanner = new Scanner(rd);
   while (scanner.hasNext()) {
     allData.add(scanner.next());
   }
   ArrayList<String> ID = new ArrayList<String>();
   String key = "*";
   for (int i = 0; i < allData.size(); i++) {
     if (i % 8 == 0) {
       key = allData.get(i);
       if (ID.contains(key) != true) {
         ID.add(key);
         ID.add("*");
         ID.add(allData.get(i + 1));
       } else {
       }
     } else {
     }
   }
   /*
    * i want to use array here, because i can actually know the number of elements that store
    * in the array,but the type of the elements is String.if i want to do so,i must create a
    * new class that contain ID.but here i just use arraylist.
    */
   for (int i = 0; i < ID.size() / 3; i++) {
     for (int j = 0; j < allData.size() / 8; j++) {
       if (ID.get(3 * i).equals(allData.get(8 * j))) {
         ID.set(3 * i + 1, ID.get(3 * i + 1) + ";" + allData.get(8 * j + 2));
       }
     }
   }
   try {
     PrintWriter wr = new PrintWriter(new FileWriter("FASTA-R.elm"));
     for (int i = 0; i < ID.size() / 3; i++) {
       wr.println(ID.get(3 * i) + "@" + ID.get((3 * i + 1)));
       wr.println(ID.get(3 * i + 2));
     }
   } catch (IOException ex) {
   }
 }
 @Nullable
 private static DirectoryChooser.ItemWrapper chooseSelection(
     final VirtualFile initialTargetDirectorySourceRoot,
     final ProjectFileIndex fileIndex,
     final ArrayList<DirectoryChooser.ItemWrapper> items,
     final DirectoryChooser.ItemWrapper initial,
     final DirectoryChooser.ItemWrapper oldOne) {
   if (initial != null || items.contains(NULL_WRAPPER) || items.isEmpty()) {
     return initial;
   } else {
     if (oldOne != null) {
       return oldOne;
     } else if (initialTargetDirectorySourceRoot != null) {
       final boolean inTest = fileIndex.isInTestSourceContent(initialTargetDirectorySourceRoot);
       for (DirectoryChooser.ItemWrapper item : items) {
         final VirtualFile virtualFile = item.getDirectory().getVirtualFile();
         if (fileIndex.isInTestSourceContent(virtualFile) == inTest) {
           return item;
         }
       }
     }
   }
   return items.get(0);
 }
Example #17
0
 public void addChangeListener(ChangeListener changeListener) {
   if (!_listeners.contains(changeListener)) {
     _listeners.add(changeListener);
   }
 }
 public boolean contains(Figure f) {
   return children.contains(f);
 }
Example #19
0
 public void setEnabled(String strTxt, boolean bEnabled) {
   if (m_aListValues != null && m_aListValues.contains(strTxt)) {
     setEnabled(m_aListValues.indexOf(strTxt), bEnabled);
   }
 }
 public static boolean isSystemColorName(@NotNull @NonNls final String s) {
   return ourSystemColors.contains(s);
 }
Example #21
0
 /**
  * Recieving method for a chat message
  *
  * @param un the name of the user sending the chat
  * @param message the message that was sent
  */
 public void recieveChat(String un, String message) {
   if (!ignores.contains(un)) {
     sendText(un, message, false);
   }
 }
Example #22
0
 /**
  * Reciving method for a whisper
  *
  * @param un the name of the user sending the whisper
  * @param message the message that was sent
  */
 public void recieveWhisper(String un, String message) {
   if (!ignores.contains(un)) {
     sendText(un, message, true);
   }
 }
Example #23
0
 /**
  * Recieving method for private
  *
  * @param un the name of the user sending the message
  * @param message the message that was sent
  */
 public void recievePrivate(String un, String message) {
   if (!ignores.contains(un)) {
     privates.recievePrivate(un, message);
   }
 }
    /**
     * Write the file by writing the values from the labels, and the values list.
     *
     * @param strFile the file to be written.
     * @param aListLabels arraylist of texfields of labels.
     * @param aListValues arraylist of texfields of values.
     */
    protected void writeFile(
        String strUser, String strFile, ArrayList aListLabels, ArrayList aListValues) {
      String strPath = FileUtil.openPath(strFile);
      String strLabel = "";
      String strValue = "";
      StringBuffer sbValues = new StringBuffer();
      JTextField txfLabel = null;
      JTextField txfValue = null;
      boolean bNewFile = false;
      int nFDAMode = Util.getPart11Mode();

      // if it's the part11 pnl and the mode is nonFDA,
      // then don't write the file for this panel
      // the other way is not true.
      if (this instanceof DisplayParentDirectory) {
        if ((isPart11Pnl() && nFDAMode == Util.NONFDA)) {
          return;
        }
      }

      if (strPath == null) {
        strPath = FileUtil.savePath(strFile);
        bNewFile = true;
      }

      if (strPath == null || aListLabels == null) return;

      if (aListValues == null) aListValues = new ArrayList();

      // Get the list of the textfields for values and labels.
      int nLblSize = aListLabels.size();
      int nValueSize = aListValues.size();
      ArrayList<String> labelList = new ArrayList<String>();

      // Get the value from each textfield, and add it to the buffer.
      for (int i = 0; i < nLblSize; i++) {
        txfLabel = (JTextField) aListLabels.get(i);
        txfValue = (i < nValueSize) ? (JTextField) aListValues.get(i) : null;

        strLabel = (txfLabel != null) ? txfLabel.getText() : null;
        strValue = (txfValue != null) ? txfValue.getText() : "";

        // We need to be sure they don't have two data directories with
        // the same labels.  Save the label list if we are writing to
        // the "data" file.
        if (strFile.indexOf("data") != -1) {
          if (labelList.contains(strLabel)) {
            Messages.postError(
                "The Data Directory specifications "
                    + "must not have duplicate Label names. "
                    + "The Label \""
                    + strLabel
                    + "\" is duplicated.  "
                    + "Skipping the second instance.  Please "
                    + "specify a new Label.");
            continue;
          } else labelList.add(strLabel);
        }

        if (strLabel == null || strLabel.trim().length() <= 0 || strValue.equals(INFOSTR)) continue;

        // for user template tab, don't need to parse the value
        if (!(this instanceof DisplayTemplate)) strValue = getValue(strUser, strValue);
        strLabel = strLabel.trim();
        if (strValue != null) strValue = strValue.trim();

        // sbValues.append("\"");
        sbValues.append(strLabel);
        // sbValues.append("\"  ");

        sbValues.append(File.pathSeparator);
        sbValues.append(strValue);
        sbValues.append("\n");
      }

      if (Util.isPart11Sys()) writeAuditTrail(strPath, strUser, sbValues);

      // write the data to the file.
      BufferedWriter writer = WFileUtil.openWriteFile(strPath);
      WFileUtil.writeAndClose(writer, sbValues);

      // if it's a template file, then make it writable for everyone.
      if (bNewFile) {
        String strCmd = "chmod 755 ";
        if (this instanceof DisplayTemplate) strCmd = "chmod 777 ";
        if (Util.iswindows()) strPath = UtilB.windowsPathToUnix(strPath);
        String[] cmd = {WGlobal.SHTOOLCMD, WGlobal.SHTOOLOPTION, strCmd + strPath};
        WUtil.runScriptInThread(cmd);
      }
    }
  @Override
  public void keyPressed(KeyEvent e) {
    if (e.getKeyCode() == 67) // C
    {
      if (captureWindow) {
        this.openCaptureWindow();
      } else {
        this.captureImage();
      }
    } else if (e.getKeyCode() == 27) // Escape
    {
      System.out.println("Escape pressed, exiting");
      System.exit(0);
    } else if (e.getKeyCode() == 84) // t
    {
      // Testing purpose
      for (int i = 0; i < images.size(); i++) {
        System.out.println("image " + i + ", used? " + images_used.contains((Integer) i));
      }

    } else if (e.getKeyCode() == 89) // y
    {
      // Testing purpose
      System.out.println("getRandomImageNum() = " + getRandomImageNum());
    } else if (e.getKeyCode() == 73) // i
    {
      // Testing purpose
      System.out.println("LAST ADDED");
      for (int i = 0; i < images_lastadded.size(); i++) {
        System.out.println(
            i
                + " - image "
                + images_lastadded.get(i)
                + ", used? "
                + images_used.contains((Integer) images_lastadded.get(i)));
      }
    } else if (e.getKeyCode() == 85) // u
    {
      // Testing purpose
      for (int i = 0; i < imagepanels.length; i++) {
        for (int j = 0; j < imagepanels[i].imagenum_now.length; j++) {
          for (int j2 = 0; j2 < imagepanels[i].imagenum_now[j].length; j2++) {
            String print1;
            if (imagepanels[i].imagenum_now[j][j2] < 10)
              print1 = "  " + imagepanels[i].imagenum_now[j][j2];
            else if (imagepanels[i].imagenum_now[j][j2] < 100)
              print1 = " " + imagepanels[i].imagenum_now[j][j2];
            else print1 = "" + imagepanels[i].imagenum_now[j][j2];
            String print2;
            if (imagepanels[i].imagenum_next[j][j2] < 10)
              print2 = "  " + imagepanels[i].imagenum_next[j][j2];
            else if (imagepanels[i].imagenum_next[j][j2] < 100)
              print2 = " " + imagepanels[i].imagenum_next[j][j2];
            else print2 = "" + imagepanels[i].imagenum_next[j][j2];

            System.out.println(
                "imagepanels["
                    + i
                    + "]."
                    + "imagenum_now["
                    + j
                    + "]["
                    + j2
                    + "] = "
                    + print1
                    + ", next = "
                    + print2);
          }
        }
      }
    } else {
      displayInfo(e, "KEY TYPED: ");
    }
  }
Example #26
0
  /**
   * Method to parse a command and perform the specified action
   *
   * @param cmd the command that the user typed
   * @return a status indicator to tell if the command was valid
   */
  public boolean parseCommand(String cmd) {
    cmd = cmd.intern();
    if (cmd == "help" || cmd == "?") {
      String commands =
          "Listing  available commands:\n"
              + "<pre>\\help or \\? \t\t- display this message<br>"
              + "\\admin &lt;passphrase&gt; \t- become an admin<br>"
              + "\\create &lt;channel&gt; [password]\t- create a new channel with optional password<br>"
              + "\\join &lt;channel&gt;  [password]\t- join channel with optional password<br>"
              + "\\disconnect \t\t- disconnect from server<br>"
              + "\\whisper &lt;user&gt; &lt;message&gt; \t- whisper to a user<br>"
              + "\\private &lt;user&gt; \t- start a private message session<br>"
              + "\\ignore &lt;user&gt; \t- ignores a user<br>"
              + "\\clearignore \t\t- clear list of ignores<br>"
              + "\\reconnect \t\t- attempt to reconnect to server<br>"
              + "\\rename &lt;new name&gt; \t- change your username<br>"
              + "\\invite &lt;user&gt; \t- invite user to join at your channel<br>";
      if (admin) {
        commands +=
            "\\kick &lt;user&gt; \t\t- kick user from room<br>"
                + "\\logstart \t\t- start logging sessoin<br>"
                + "\\logstop \t\t- stop logging session<br>";
      }
      commands += "up or down \t\t- cycle your chat history</pre>";
      sendText("server", commands, false);
      return true;
    } else if (cmd == "disconnect") {
      if (server != null) {
        stop();
      }
      return true;
    } else if (cmd == "reconnect") {
      if (username == null) {
        error(
            "username still invalid. use \\rename &lt;new name&gt; to chose a new name and reconnect");
      } else {
        if (server != null) {
          stop();
        }
        server = new ServerConnection(this);
      }
      return true;
    } else if (cmd == "clearignore") {
      ignores.clear();
      updateList();
      serverMessage("ignore list cleared");
      return true;
    } else if (cmd.startsWith("whisper")) {
      int start = cmd.indexOf(' ');
      if (start < 0) {
        error("usage: \\whisper &lt;user&gt; &lt;message&gt;");
        return false;
      }
      cmd = cmd.substring(start + 1);
      start = cmd.indexOf(' ');
      if (start < 0) {
        error("usage: \\whisper &lt;user&gt; &lt;message&gt;");
        return false;
      }
      String un = cmd.substring(0, start);
      if (username.equals(un) || !users.contains(un)) {
        error("invalid user");
        return false;
      }
      String message = cmd.substring(start + 1);
      if (message.length() < 1) {
        error("usage: \\whisper &lt;user&gt; &lt;message&gt;");
      }
      sendWhisper(un, message);
      sendText(username, message, true);
      return true;
    } else if (cmd.startsWith("invite")) {
      String channel = (String) cboChannels.getSelectedItem();
      int start = cmd.indexOf(' ');
      if (start < 0) {
        error("usage: \\invite &lt;user&gt;");
        return false;
      }

      String un = cmd.substring(start + 1);

      if ((un.length() < 1) || (un.length() > 10) || (!un.matches("[\\w_-]+?"))) {
        error(un + " invalid user");
        return false;
      }

      if (username.equals(un)) {
        error("You cannot invite youself");
        return false;
      }

      if (users.contains(un)) {
        error(un + "  is already in your Channel");
        return false;
      }
      String message = un + " has been invited to join a channel " + channel;
      sendInvite(un, message);
      sendText(username, message, false);
      return true;

    } else if (cmd.startsWith("private")) {
      int start = cmd.indexOf(' ');
      if (start < 0) {
        error("usage: \\private &lt;user&gt;");
        return false;
      }
      String un = cmd.substring(start + 1);
      if (username.equals(un)) {
        error("cannot private message yourself");
        return false;
      }
      privates.newPrivate(un);
      return true;
    } else if (cmd.startsWith("rename")) {
      int start = cmd.indexOf(' ');
      if (start < 0) {
        error("usage: \\rename &lt;newname&gt;");
        return false;
      }
      String newName = cmd.substring(start + 1);
      if ((newName.length() < 1)
          || (newName.length()) > 10
          || (newName.equals("server"))
          || (!newName.matches("[\\w_-]+?"))) {
        error("invalid name");
        return false;
      }
      if (!server.connected) {
        server = new ServerConnection(this);
      }
      if (username == null) {
        username = newName;
        server.writeObject(new SD_UserAdd(newName));
      } else {
        rename(username, newName);
        username = newName;
        server.writeObject(new SD_Rename(null, username));
      }
      return true;
    } else if (cmd.startsWith("ignore")) {
      int start = cmd.indexOf(' ');
      if (start < 0) {
        error("usage: \\ignre &lt;user&gt;");
        return false;
      }
      ignore(cmd.substring(start + 1), false);
      return true;
    } else if (cmd.startsWith("join")) {
      int start = cmd.indexOf(' ');
      if (start < 0) {
        error("usage: \\join &lt;channel&gt; [password]");
        return false;
      }
      String name = cmd.substring(start + 1);
      String pass = null;
      start = name.indexOf(' ');
      if (start > 0) {
        pass = name.substring(start + 1);
        name = name.substring(0, start);
      }
      server.writeObject(new SD_Channel(false, name, pass));
      return true;
    } else if (cmd.startsWith("create")) {
      int start = cmd.indexOf(' ');
      if (start < 0) {
        error("usage: \\create &lt;channel&gt; [password]");
        return false;
      }
      String name = cmd.substring(start + 1);
      String pass = null;
      start = name.indexOf(' ');
      if (start > 0) {
        pass = name.substring(start + 1);
        name = name.substring(0, start);
      }
      server.writeObject(new SD_Channel(true, name, pass));
      return true;
      /*		} else if (cmd.startsWith("proxy")) {
      int start = cmd.indexOf(' ');
      if (start < 0) {
      	error("usage: \\proxy &lt;host&gt; &lt;port&gt;");
      	return false;
      }
      String phost = cmd.substring(start+1);
      start = phost.indexOf(' ');
      if (start < 0) {
      	error("usage: \\proxy &lt;host&gt; &lt;port&gt;");
      	return false;
      }
      String pport = phost.substring(start+1);
      phost = phost.substring(0, start);
      Properties systemSettings = System.getProperties();
      systemSettings.put("proxySet", "true");
      systemSettings.put("proxyHost", phost);
      systemSettings.put("proxyPort", pport);
      System.setProperties(systemSettings);
      serverMessage("Using " + phost + ":" + pport + " as proxy server<br>you can type \\reconnect to reconnect with this proxy");
      return true; */
    } else if (cmd.startsWith("admin")) {
      int start = cmd.indexOf(' ');
      if (start < 0) {
        error("usage: \\admin &lt;password&gt;");
        return false;
      }
      String pass = cmd.substring(start + 1);
      server.writeObject(new SD_AdminAdd(pass));
      return true;
    } else if (admin && cmd.startsWith("kick")) {
      int start = cmd.indexOf(' ');
      if (start < 0) {
        error("usage: \\kick &lt;user&gt;");
        return false;
      }
      String un = cmd.substring(start + 1);
      if (un.equals(username)) {
        error("cannot kick yourself");
        return false;
      }
      server.writeObject(new SD_Kick(un));
      return true;
    } else if (admin && cmd == "logstart") {
      server.writeObject(new SD_Log(true));
      return true;
    } else if (admin && cmd == "logstop") {
      server.writeObject(new SD_Log());
      return true;
    }
    error("unrecognized command, type \\help for help");
    return false;
  }