Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            while (true) {
                sqlLogger = new Logger (sql_uid, sql_pass, sql_db, sql_host);
                irc = new IRCHandler (server, port, channels, nick, name, hashAuth);
                Listener = new IRCListener (irc, sqlLogger);

                irc.setListenerAndConnect (Listener);
            }
        }
Exemplo n.º 2
0
        public void ircConnect(IRCListener Listener)
        {
            /*
             * Initiates the streamreader/writing instances
             * and begins a TCP connection to the specified server.
             * Once established, calls the affixed Listener listen
             * event.
             */
            try {

                this.ircConn = new TcpClient (server, port);
                this.ircConn.NoDelay = true;
                this.ircConn.ReceiveTimeout = 180000;
                Console.WriteLine ("Connected!");

                this.netStream = this.ircConn.GetStream ();
                this.strmRead = new StreamReader (this.netStream);
                this.strmWrite = new StreamWriter (this.netStream);

                this.Authenticate (strmWrite, nick, name, hashAuth);

                Console.WriteLine ("Joining channels..");
                foreach (string channel in ircChannels) {
                    sendSrvData ("JOIN " + channel, strmWrite);
                    System.Threading.Thread.Sleep (200);
                }
                Console.WriteLine ("Done!");

                Listener.Listen(strmRead);

            } catch {
                //failed to connect
                Console.WriteLine ("Failed to connect!");
            } finally {
                Console.WriteLine ("Connected to IRC!");

            }
        }
Exemplo n.º 3
0
 public void setListenerAndConnect(IRCListener listener)
 {
     /*
      * Affixes a Listener class to the handler and begins the
      * Listener's listening event. This is the end-purpose of
      * the entire class.
      */
     ear = listener;
     ircConnect (ear);
 }