Exemplo n.º 1
0
  private void connectToServer() {
    try {
      if (config.getServerSsl()) {
        this.connect(
            config.getServerAddress(),
            config.getServerPort(),
            config.getServerPassword(),
            config.getAcceptInvalidSsl()
                ? new UtilSSLSocketFactory().trustAllCertificates().disableDiffieHellman()
                : SSLSocketFactory.getDefault());
      } else {
        this.connect(config.getServerAddress(), config.getServerPort(), config.getServerPassword());
      }

      if (config.useNickserv()) {
        this.identify(config.getNickservPassword());
      }
    } catch (IOException | IrcException ex) {
      Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);
    }

    for (String channel : config.getChannels()) {
      this.joinChannel(channel);
    }
  }