Examples of IRCConnection


Examples of com.briman0094.irc.IRCConnection

  private HashMap<String, IModule>  registeredModules;
  private String            username;
 
  public BriBot(String server, int port, PrintStream out) throws UnknownHostException, IOException
  {
    irc = new IRCConnection(server, port);
    irc.setReadHandler(this);
    irc.setDebug(false);
    this.out = out;
    curChannel = null;
    joinedChannels = new ArrayList<String>();
View Full Code Here

Examples of org.schwering.irc.lib.IRCConnection

  private void createConnection() throws IOException {
    if (connection == null) {
      logger.debug(
          "Creating new connection to hostname:{} port:{}",
          hostname, port);
      connection = new IRCConnection(hostname, new int[] { port },
          password, nick, user, name);
      connection.addIRCEventListener(new IRCConnectionListener());
      connection.setEncoding("UTF-8");
      connection.setPong(true);
      connection.setDaemon(false);
View Full Code Here

Examples of org.schwering.irc.lib.IRCConnection

    public void setConfiguration(IrcConfiguration configuration) {
        this.configuration = configuration;
    }

    public synchronized IRCConnection getIRCConnection(IrcConfiguration configuration) {
        final IRCConnection connection;
        if (connectionCache.containsKey(configuration.getCacheKey())) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Returning Cached Connection to " + configuration.getHostname() + " " + configuration.getTarget());
            }
            connection = connectionCache.get(configuration.getCacheKey());
View Full Code Here

Examples of org.schwering.irc.lib.IRCConnection

    protected IRCConnection createConnection(IrcConfiguration configuration) {
        LOG.debug("Creating Connection to " + configuration.getHostname() + " destination: " + configuration.getTarget() + " nick: " + configuration.getNickname() + " user: "
                  + configuration.getUsername());

        final IRCConnection conn = new IRCConnection(configuration.getHostname(), configuration.getPorts(), configuration.getPassword(), configuration.getNickname(), configuration.getUsername(),
                                                     configuration.getRealname());
        conn.setEncoding("UTF-8");
        // conn.setDaemon(true);
        conn.setColors(configuration.isColors());
        conn.setPong(true);

        try {
            conn.connect();
        } catch (Exception e) {
            LOG.error("Failed to connect: " + e, e);

            // TODO use checked exceptions?
            throw new RuntimeCamelException(e);
View Full Code Here

Examples of org.schwering.irc.lib.IRCConnection

    }

    public static void main(String[] args) throws InterruptedException {
        final IrcConfiguration config = new IrcConfiguration("irc.codehaus.org", "camel-irc", "Camel IRC Component", "#camel-test");

        final IRCConnection conn = new IRCConnection(config.getHostname(), config.getPorts(), config.getPassword(), config.getNickname(), config.getUsername(), config.getRealname());

        conn.addIRCEventListener(new CodehausIRCEventAdapter());
        conn.setEncoding("UTF-8");
        // conn.setDaemon(true);
        conn.setColors(false);
        conn.setPong(true);

        try {
            conn.connect();
        } catch (IOException e) {
            e.printStackTrace();
        }
        // while (!conn.isConnected()) {
        // Thread.sleep(1000);
        // System.out.println("Sleeping");
        // }
        System.out.println("Connected");
        // conn.send("/JOIN #camel-test");

        // System.out.println("Joining Channel: " + config.getTarget());
        conn.doJoin(config.getTarget());

        conn.doPrivmsg("#camel-test", "hi!");
        Thread.sleep(Integer.MAX_VALUE);
    }
View Full Code Here

Examples of org.schwering.irc.lib.IRCConnection

        boolean isSsl = Boolean.parseBoolean( configuration.get( "ssl" ) );

        try
        {
            IRCConnection ircConnection = getIRConnection( host, port, password, nickName, alternateNickName, userName,
                                                           fullName, channel, isSsl );
            ircConnection.doPrivmsg( channel, message );
        }
        catch ( IOException e )
        {
            throw new NotificationException( "Exception while checkConnection to irc ." + host, e );
        }
View Full Code Here

Examples of org.schwering.irc.lib.IRCConnection

    public void dispose()
    {
        // cleanup connections
        for ( String key : hostConnections.keySet() )
        {
            IRCConnection connection = hostConnections.get( key );
            if ( connection.isConnected() )
            {
                connection.doQuit( "Continuum shutting down" );
                connection.close();
            }
        }

    }
View Full Code Here

Examples of org.schwering.irc.lib.IRCConnection

    private IRCConnection getIRConnection( String host, int port, String password, String nick, String alternateNick,
                                           String userName, String realName, String channel, boolean ssl )
        throws IOException
    {
        String key = getConnectionKey( host, port, nick, alternateNick );
        IRCConnection conn = hostConnections.get( key );
        if ( conn != null )
        {
            checkConnection( conn, key );
            return conn;
        }

        if ( !ssl )
        {
            conn = new IRCConnection( host, new int[]{port}, password, nick, userName, realName );
        }
        else
        {
            conn = new SSLIRCConnection( host, new int[]{port}, password, nick, userName, realName );
            ( (SSLIRCConnection) conn ).addTrustManager( new SSLDefaultTrustManager() );
        }

        conn.addIRCEventListener( new Listener( conn, nick, alternateNick ) );
        checkConnection( conn, key );
        checkChannel( conn, key, channel );
        hostConnections.put( key, conn );
        return conn;
    }
View Full Code Here

Examples of org.schwering.irc.lib.IRCConnection

    public void setConfiguration(IrcConfiguration configuration) {
        this.configuration = configuration;
    }

    public synchronized IRCConnection getIRCConnection(IrcConfiguration configuration) {
        final IRCConnection connection;
        if (connectionCache.containsKey(configuration.getCacheKey())) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Returning Cached Connection to " + configuration.getHostname() + " " + configuration.getTarget());
            }
            connection = connectionCache.get(configuration.getCacheKey());
View Full Code Here

Examples of org.schwering.irc.lib.IRCConnection

    protected IRCConnection createConnection(IrcConfiguration configuration) {
        LOG.debug("Creating Connection to " + configuration.getHostname() + " destination: " + configuration.getTarget() + " nick: " + configuration.getNickname() + " user: "
                  + configuration.getUsername());

        final IRCConnection conn = new IRCConnection(configuration.getHostname(), configuration.getPorts(), configuration.getPassword(), configuration.getNickname(), configuration.getUsername(),
                                                     configuration.getRealname());
        conn.setEncoding("UTF-8");
        // conn.setDaemon(true);
        conn.setColors(configuration.isColors());
        conn.setPong(true);

        try {
            conn.connect();
        } catch (Exception e) {
            LOG.error("Failed to connect: " + e, e);
            throw new RuntimeCamelException(e);
        }
        return conn;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.