コード例 #1
0
ファイル: IrcGateway.java プロジェクト: jkallunki/grtot-2012
 /** Initializes the connection */
 @Override
 public void run() {
   try {
     this.setVerbose(true);
     if (port == null && password == null) {
       this.connect(this.serverAddress);
     } else if (port != null && password == null) {
       this.connect(this.serverAddress, Integer.parseInt(port));
     } else {
       this.connect(this.serverAddress, Integer.parseInt(port), password);
     }
     model.connectedServer(this.serverAddress);
   } catch (NickAlreadyInUseException e) {
     this.setVerbose(true);
     String altNick = model.getConfs().getUserData("secondaryNick");
     this.setName(altNick);
     this.nick = altNick;
     try {
       if (port == null && password == null) {
         this.connect(this.serverAddress);
       } else if (port != null && password == null) {
         this.connect(this.serverAddress, Integer.parseInt(port));
       } else {
         this.connect(this.serverAddress, Integer.parseInt(port), password);
       }
     } catch (Exception ee) {
       System.out.println("Cant connect!");
       model.cantConnect();
     }
   } catch (Exception e) {
     System.out.println("Cant connect!");
     model.cantConnect();
   }
 }