// Path: src/main/java/netention/web/Bus.java
// final public class Bus {
//     /** status of interactive sessions */
//     public final static String SESSION = "session";
//     
//     /** declared interest in a topic, passively requests for more information */
//     public final static String INTEREST = "interest";
//     public final static String INTEREST_WIKIPEDIA = "interest.wikipedia";
// 
//     /** permanent knowledge to share */
//     public final static String PUBLISH = "publish";
//  
//     /** transient knowledge to share */
//     public final static String SAY = "say";
// }


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.Socket;
import netention.web.Bus;
import org.vertx.java.core.eventbus.EventBus;
        writer.write("USER " + login + " 8 * : Java IRC Hacks Bot\r\n");
        writer.flush( );
        
        // Read lines from the server until it tells us we have connected.
        String line = null;
        while ((line = reader.readLine( )) != null) {
            if (line.indexOf("004") >= 0) {
                // We are now logged in.
                break;
            }
            else if (line.indexOf("433") >= 0) {
                System.out.println("Nickname is already in use.");
                return;
            }
        }
        
        // Join the channel.
        writer.write("JOIN " + channel + "\r\n");
        writer.flush( );
        
        // Keep reading lines from the server.
        while ((line = reader.readLine( )) != null) {
            if (line.toLowerCase( ).startsWith("PING ")) {
                // We must respond to PINGs to avoid being disconnected.
                writer.write("PONG " + line.substring(5) + "\r\n");
                writer.write("PRIVMSG " + channel + " :I got pinged!\r\n");
                writer.flush( );
            }
            else {
                // Print the raw line received by the bot.
// Path: src/main/java/netention/web/Bus.java
// final public class Bus {
//     /** status of interactive sessions */
//     public final static String SESSION = "session";
//     
//     /** declared interest in a topic, passively requests for more information */
//     public final static String INTEREST = "interest";
//     public final static String INTEREST_WIKIPEDIA = "interest.wikipedia";
// 
//     /** permanent knowledge to share */
//     public final static String PUBLISH = "publish";
//  
//     /** transient knowledge to share */
//     public final static String SAY = "say";
// }


// Path: src/main/java/netention/util/IRC.java
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.Socket;
import netention.web.Bus;
import org.vertx.java.core.eventbus.EventBus;

        writer.write("USER " + login + " 8 * : Java IRC Hacks Bot\r\n");
        writer.flush( );
        
        // Read lines from the server until it tells us we have connected.
        String line = null;
        while ((line = reader.readLine( )) != null) {
            if (line.indexOf("004") >= 0) {
                // We are now logged in.
                break;
            }
            else if (line.indexOf("433") >= 0) {
                System.out.println("Nickname is already in use.");
                return;
            }
        }
        
        // Join the channel.
        writer.write("JOIN " + channel + "\r\n");
        writer.flush( );
        
        // Keep reading lines from the server.
        while ((line = reader.readLine( )) != null) {
            if (line.toLowerCase( ).startsWith("PING ")) {
                // We must respond to PINGs to avoid being disconnected.
                writer.write("PONG " + line.substring(5) + "\r\n");
                writer.write("PRIVMSG " + channel + " :I got pinged!\r\n");
                writer.flush( );
            }
            else {
                // Print the raw line received by the bot.
                eventBus.publish(Bus.SAY, line);