Пример #1
0
  /**
   * Get the complete ConnectInfo
   *
   * @param ConnectInfo the user
   * @return the complete ConnectInfo
   */
  private ConnectInfo getCompleteConnectInfo(ConnectInfo ci) {
    Iterator i = this.connections.iterator();

    while (i.hasNext()) {
      ConnectInfo tmp = (ConnectInfo) i.next();
      if (ci.getName().equals(tmp.getName())) return tmp;
    }

    return ci;
  }
Пример #2
0
  /**
   * Check if a user is already known
   *
   * @param ConnectInfo the user
   * @return true or false
   */
  private boolean isAlreadyKnown(ConnectInfo ci) {
    boolean result = false;
    Iterator i = this.connections.iterator();

    while (i.hasNext() && !result) {
      ConnectInfo tmp = (ConnectInfo) i.next();
      result = ci.getName().equals(tmp.getName());
    }

    return result;
  }
Пример #3
0
  /**
   * Get a user connection infos
   *
   * @param userName the user
   * @return the ConnectInfo
   */
  public ConnectInfo getConnectInfo(String userName) {
    for (int i = 0; i < this.connections.size(); i++) {
      ConnectInfo ci = (ConnectInfo) this.connections.get(i);
      if (ci.getName().equals(userName)) return ci;
    }

    return null;
  }
Пример #4
0
 /**
  * Remove a ConnectionInfo
  *
  * @param user the user name
  */
 private void removeConnectInfo(String user) {
   for (int i = 0; i < this.connections.size(); i++) {
     ConnectInfo ci = (ConnectInfo) this.connections.get(i);
     if (ci.getName().equals(user)) {
       this.connections.remove(ci);
       break;
     }
   }
   sendUserList();
 }
Пример #5
0
 /**
  * Remove a ConnectionInfo
  *
  * @param ci the connect info
  */
 private void removeConnectInfo(ConnectInfo ci) {
   removeConnectInfo(ci.getName());
 }