public boolean prepareConnection(String name,String password,String channel,String server,String ports){
  fixServer=false;
  if (c.getState() > Irc.STATE_OFFLINE) {
    g.showMessage("Cannot connect: Already connected.");
    return false;
  }
  if (name == null || name.isEmpty() || password == null || password.isEmpty()) {
    g.showMessage("Cannot connect: Incomplete login data.");
    return false;
  }
  String[] autojoin;
  Set<String> openChannels=c.getOpenChannels();
  if (channel == null) {
    autojoin=new String[openChannels.size()];
    openChannels.toArray(autojoin);
  }
 else {
    autojoin=Helper.parseChannels(channel);
  }
  if (autojoin.length == 0) {
    g.showMessage("A channel to join has to be specified.");
    return false;
  }
  if (server == null || server.isEmpty()) {
    g.showMessage("Invalid server specified.");
    return false;
  }
  closeAllChannelsExcept(autojoin);
  settings.setString("username",name);
  if (channel != null) {
    settings.setString("channel",channel);
  }
  c.connect(server,ports,name,password,autojoin);
  return true;
}

public boolean prepareConnection ( String name , String password , String channel , String server , String ports ) { fixServer = false ; if ( c . getState ( ) > Irc . STATE_OFFLINE ) { g . showMessage ( "Cannot connect: Already connected." ) ; return false ; } if ( name == null || name . isEmpty ( ) || password == null || password . isEmpty ( ) ) { g . showMessage ( "Cannot connect: Incomplete login data." ) ; return false ; } String [ ] autojoin ; Set < String > openChannels = c . getOpenChannels ( ) ; if ( channel == null ) { autojoin = new String [ openChannels . size ( ) ] ; openChannels . toArray ( autojoin ) ; } else { autojoin = Helper . parseChannels ( channel ) ; } if ( autojoin . length == 0 ) { g . showMessage ( "A channel to join has to be specified." ) ; return false ; } if ( server == null || server . isEmpty ( ) ) { g . showMessage ( "Invalid server specified." ) ; return false ; } closeAllChannelsExcept ( autojoin ) ; settings . setString ( "username" , name ) ; if ( channel != null ) { settings . setString ( "channel" , channel ) ; } c . connect ( server , ports , name , password , autojoin ) ; return true ; }
prepares the connection to the given channel with the given credentials . this does stuff that should only be done once , unless the given parameters change . so this shouldn ' t be repeated for just reconnecting .
