/** Uninit the application. */
  public synchronized void uninit() {
    Enumeration<Server> en = _servers.keys();
    while (en.hasMoreElements()) {
      Server s = (Server) en.nextElement();
      s.leave();
    }

    if (_ident != null) _ident.stop();
    _interface.removeIRCInterfaceListener(this);

    if (_frame != null) _frame.removeWindowListener(this);
    _frame = null;

    while (_plugins.size() > 0) {
      unloadPlugin((Plugin) _plugins.elementAt(_plugins.size() - 1));
    }
    _pluginsTable = new Hashtable<String, Plugin>();

    if (_container != null) _container.removeAll();

    EventDispatcher.clearCache();
  }
  /** Init the application. */
  public synchronized void init() {
    loadPlugin(_interface);

    String[] plugins = _start.getPlugins();
    for (int i = 0; i < plugins.length; i++) loadPlugin(plugins[i]); // uses string

    _interface.addIRCInterfaceListener(this);
    if (_container == null) {
      _frame = new JFrame();
      _frame.addWindowListener(this);
      if (_interface.getComponent() != null) _frame.add(_interface.getComponent());
      _frame.setFont(new Font("", Font.PLAIN, 12));
      _frame.setSize(640, 400);
      _frame.setVisible(true);
    } else {
      _frame = null;
      _container.removeAll();
      _container.setLayout(new GridLayout(1, 1));
      if (_interface.getComponent() != null) _container.add(_interface.getComponent());
    }

    _inter = new CTCPInterpretor(_ircConfiguration, _defaultSource.getInterpretor(), this);
    _inter.addLast(_interface.getInterpretor());

    if (_ircConfiguration.getB("useidentserver")) {
      try {
        _ident = new IdentWrapper(_ircConfiguration);
        Exception e = _ident.start(_start.getName(), this);
        if (e != null) {
          _defaultSource.report(
              "\3" + "6" + "*** " + getText(IRCTextProvider.IDENT_FAILED_LAUNCH, e.getMessage()));
        }
      } catch (Throwable ex) {
        _ircConfiguration.internalError("ident error", ex, "*****@*****.**");
      }
    } else {
      _ident = null;
    }

    String[] init = _ircConfiguration.getInitialization();
    for (int i = 0; i < init.length; i++) _defaultSource.sendString(init[i]);

    IRCServer server =
        new IRCServer(
            _ircConfiguration,
            this,
            _start.getNick(),
            _start.getAltNick(),
            _start.getName(),
            _start.getAlias());
    server.setServers(_start.getHost(), _start.getPort(), _start.getPass());

    newServer(server, _ircConfiguration.getB("autoconnection"));

    if (_start.getSmileysSupport() == false) {
      _ircConfiguration.resetSmileyTable(); // _defaultSource.sendString("/dsmileys");
      System.out.println("Smileys should be DISABLED!");
    } else {
      _ircConfiguration.restoreSmileyTable();
      System.out.println("Smileys should be ACTIVE!");
    }
    requestSourceFocus();
  }