private void init(String botname, String botIP, int listenPort, int UDP_listenPort, String password, String description,
			String conn_type, String email, String sharesize, int uploadSlots, int downloadSlots, boolean passive,
			ShareManager share_manager, DownloadCentral dc) throws IOException, BotException {

		if(!GlobalFunctions.isUserNameValid(botname)) {
			throw new BotException(BotException.Error.INVALID_USERNAME);
		}
		
		if (isInMultiHubsMode()) {
			miscDir = multiHubsAdapter.miscDir;
			incompleteDir = multiHubsAdapter.incompleteDir;
		}

		_botname = botname;
		_password = password;
		_conn_type = conn_type;
		_email = email;
		_sharesize = sharesize;
		_maxUploadSlots = uploadSlots;
		_maxDownloadSlots = downloadSlots;
		_botIP = botIP;
		_listenPort = listenPort;
		_passive = passive;
		_udp_port = UDP_listenPort;

		um = new UserManager(this);
		downloadManager = new DownloadManager(this);
		uploadManager = new UploadManager(this);
		dispatchThread = new BotEventDispatchThread(this);
		setShareManager(share_manager, _sharesize);
		setDownloadCentral(dc);

		if (_sharesize == null || _sharesize.isEmpty())
			_sharesize = "0";
		
		setDescription(description);

		//Creating Listen port for clients to contact this.
		if (isInMultiHubsMode())
			socketServer = multiHubsAdapter.socketServer;
		if (socketServer == null || socketServer.isClosed()) {
			socketServer = new BufferedServerSocket(_listenPort);
			socketServer.setSoTimeout(60000); // Wait for 60s before timing out.
		}

		initiateUDPListening();
		outThread = new JobThread();
		outThread.setDaemon(true);
		outThread.start();
		searchThread = new JobThread();
		searchThread.setDaemon(true);
		searchThread.start();
	}