@Override
	protected void onDisconnect() {
		int reconnectAttempts = 0;

		printLog("Connection to " + getServer() + " dropped, "
											 + "trying to reconnect...");

		// try to reconnect
		while(!isConnected() && reconnectAttempts < 15) {
			try {
				// reconnect
				reconnectAttempts++;
				reconnect();
			} catch (Exception e) {
				// failed to reconnect
				printLog("Error: could not reconnect to " + getServer() + "\n" + e.getMessage());
				try {
						Thread.sleep(4000);
				} catch(InterruptedException exception) {
						Thread.currentThread().interrupt();
				} // catch
			} // catch
		} // while

		// check if it has reconnected
		if(isConnected()) {
			printLog("Reconnected to server: " + getServer());

			if(server.getAddress().equals(getServer())) {
				// rejoin channels
				for(String channel : server.getChannels())
					joinChannel(channel);
			} else {
				printLog("We somehow connected to a different server?");
			} // else
		} else {
			printLog("Unable to reconnect to server: " + getServer() + " - disabling.");
		} // else

	} // onDisconnect