public void identRequested(String source, Integer result, String reply) { _defaultSource.report("\3" + "6" + "*** " + getText(IRCTextProvider.IDENT_REQUEST, source)); String s = ""; switch (result.intValue()) { case IdentListener.IDENT_ERROR: s = getText(IRCTextProvider.IDENT_ERROR); break; case IdentListener.IDENT_OK: s = getText(IRCTextProvider.IDENT_REPLIED, reply); break; case IdentListener.IDENT_DEFAULT: s = getText( IRCTextProvider.IDENT_REPLIED, getText(IRCTextProvider.IDENT_DEFAULT_USER) + " : " + reply); break; case IdentListener.IDENT_NOT_FOUND: s = getText(IRCTextProvider.IDENT_NO_USER); break; default: s = getText(IRCTextProvider.IDENT_UNDEFINED); break; } _defaultSource.report("\3" + "6" + "*** " + s); }
/** * Create a new IRCApplication. * * @param config the IRC configuration. * @param startupConfig the startup configuration. * @param source a container in wich the application will display. Maybe null. If null, a new * Frame will be opened. */ public IRCApplication( IRCConfiguration config, StartupConfiguration startupConfig, Container source) { super(config); _container = source; _start = startupConfig; _plugins = new Vector<Plugin>(); _pluginsTable = new Hashtable<String, Plugin>(); String gui = config.getS("gui"); try { Class<?> cl = Class.forName("irc.gui." + gui + ".Interface"); java.lang.reflect.Constructor<?> ctr = cl.getDeclaredConstructor(new Class[] {config.getClass()}); _interface = (IRCInterface) ctr.newInstance(new Object[] {config}); } catch (java.lang.reflect.InvocationTargetException iex) { iex.getTargetException().printStackTrace(); throw new Error("Unable to load interface " + gui + " : " + iex.getTargetException()); } catch (Throwable ex) { ex.printStackTrace(); throw new Error("Unable to load interface " + gui + " : " + ex); } _servers = new Hashtable<Server, Server>(); _defaultSource = new DefaultSource(_ircConfiguration); DefaultInterpretor defaultInter = new DefaultInterpretor(_ircConfiguration, _start, this, this); _defaultSource.setInterpretor(defaultInter); }
/** 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(); }
public void identLeaving(String message) { _defaultSource.report("\3" + "6" + "*** " + getText(IRCTextProvider.IDENT_LEAVING, message)); }
public void identRunning(Integer port) { _defaultSource.report( "\3" + "6" + "*** " + getText(IRCTextProvider.IDENT_RUNNING_ON_PORT, port + "")); }