Exemplo n.º 1
0
        private ArrayList _users; // SimpleUser objects

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Create a new Channel
        /// </summary>
        public Channel(string name, IRCServer server, SimpleUser op)
        {
            Console.WriteLine("new {0} with name: {1}, is available", this, name);
            this._modes = new IRCChannelMode();
            this._name = name;
            this._topic = String.Empty;
            this._members = new ArrayList();
            this._users = new ArrayList();
            this._server = server;
        }
        // todo. parsen
        // HACK: minimaler code zum testen
        public static bool ConnectToServer(IRCServer server, IPEndPoint ep)
        {
            Console.WriteLine("Verbinde zu " + ep.Address +":"+ep.Port);
            IRCConnection tmp = null;
            try
            {
                //IPEndPoint ep = new IPEndPoint(/*IPAddress.Loopback*/IPAddress.Parse("10.0.1.1"), 9000); // HACK: connect to dancer
                tmp = new IRCConnection(ep, server); // TODO: hängt wenn es die zielip nicht gibt zb "10.0.1.1"
            }
            catch (Exception e)
            {
                Console.WriteLine("konnte keine verbindung zu server herstellen: "+e.Message);
                return false;
            }

            server.AddConnection(tmp);
            // TODO: nachsehen um welchen typ von server es sich handelt
            IRCServerConnection.SendServer(tmp);
            return true;
        }
Exemplo n.º 3
0
        public void Load()
        {
            try
            {
                if (this._loaded)
                    return;

                this._server = new IRCServer();
                this._loaded = true;
            /*
                foreach (int port in this._ports)
                {
                    _server.StartListening(new IPEndPoint(IPAddress.Parse("127.0.0.1"),port)); // <-- hack
                }
            */
                foreach (BindObject obj in this._bindObjects)
                {
                    IPHostEntry hostInfo = Dns.Resolve(obj.HostName);
                    IPAddress[] addresses = hostInfo.AddressList;

                    this._server.StartListening(new IPEndPoint(addresses[0], obj.Port));
                }
                this.ConnectToServers();
            }
            catch (Exception e)
            {
                Console.WriteLine("fatal error in "+ this +" :" + e.ToString() + "\n\naborting ...");
                Environment.Exit(1);
            }
        }
 /// <summary>
 /// </summary>
 public IRCInterpretor(IRCServer server)
 {
     this._parser = new StringParser();
     this._server = server;
 }
 // HACK:
 public IRCConnection(IPEndPoint ep, IRCServer server)
     : base(ep, server)
 {
     Debug.WriteLine("IRCConnection Konstruktor");
     this._lastping = DateTime.Now;
 }