Exemplo n.º 1
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;
  }
Exemplo n.º 2
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;
  }
Exemplo n.º 3
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();
 }
Exemplo n.º 4
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;
  }
Exemplo n.º 5
0
 /**
  * Remove a ConnectionInfo
  *
  * @param ci the connect info
  */
 private void removeConnectInfo(ConnectInfo ci) {
   removeConnectInfo(ci.getName());
 }