//old		private SimpleServer _info;
        public IRCServerConnection(IRCConnection bas, SimpleServer ser)
            : base(bas.Socket, bas.Server)
        {
            if (ser == null)
                throw new ArgumentNullException("ser");

            //			this._info = ser;
            //			ser.UpLink = this;
            //			if (!(bas.SimpleClient is SimpleServer))
            //				throw new ArgumentException("bas.SimpleClient musst be a SimpeServer");

            //			this._simpleClient = bas.SimpleClient;
            this._simpleClient = ser;
            this.SimpleServer.UpLink = this;
        }
        /// <summary>
        /// Add a SimpleServer object
        /// </summary>
        /// <param name="server">SimpleServer to add</param>
        public virtual void AddServer(SimpleServer server)
        {
            if (server == null)
                throw new ArgumentNullException("server");

            lock (this._servers)
            {
                if (this._servers.Contains(server))
                    return;

                this._servers.Add(server);
            }
        }
        public void RegisterServer(IRCConnection con, SimpleServer ser)
        {
            if (con == null)
                throw new ArgumentNullException("con");
            if (ser == null)
                throw new ArgumentNullException("ser");

            // TODO: ircservice mitteilen das zu diesem server keine verbindung mehr hergestellt werden muss
            lock (con)
            {
                if (con is IRCConnection)
                {
                    IRCServerConnection srv;
                    this.RemoveConnection(con);
                    srv = new IRCServerConnection(con, ser);
                    this.AddConnection(srv);
                    // TODO: mal sehen evtl. simpleserver erzeugen und mit AddServer hinzufügen
                    this.AddServer(ser);
                    IRCServerConnection.SendServer(srv);
                }
                else
                {
                    con.SendLine("ERROR: you could not register!; internal error");
                }
            }
        }
        public virtual void m_server(IRCConnection connection, string[] ar)
        {
            // SERVER test.oulu.fi 1 :[tolsun.oulu.fi]
            // test.oulu.fi	== Server-Name
            // 1			== Hop-Count
            // [*]			== IP/DNS-Name

            Console.WriteLine(this + ": server message");
            foreach (string s in ar)
            {
                Console.WriteLine("server-msg: " +s);
            }
            if (connection is IRCUserConnection)
            {
                connection.SendLine("ERROR :already registered as client");
                return;
            }
            if (ar.Length < 4)
            {
                connection.SendLine("ERROR :SERVER needs more params");
                this.CloseLink(connection);
                return;
            }

            /*
            ** The SERVER message must only be accepted from either (a) a connection
            ** which is yet to be registered and is attempting to register as a
            ** server, or (b) an existing connection to another server, in  which
            ** case the SERVER message is introducing a new server behind that
            ** server.
            */
            if (connection is IRCServerConnection) // neu Server; wird uns von einen anderen Server mitgeteilt
            {
                SimpleServer rser = new SimpleServer();
                rser.HopCount = Convert.ToInt32(ar[3]);
                rser.UpLink = (IRCServerConnection)connection;
            }
            else // ein neuer Server versucht sich direkt zu registrieren
            {
                if (this.HasServer(connection.Socket.RemoteEndPoint)) // <-- HACK
                {
                    connection.SendLine("ERROR :Server already exits; Potential Damage To Network Intergrity");
                    this.CloseLink(connection);
                    return;
                }
            /*				if (this.HasServer(ar[2])) veraltet
                {
                    connection.SendLine("hostmask allrady in use");
                    this.CloseLink(connection);
                    return;
                }*/
                if (!((IRCConnection)connection).PassSet)
                {
                    connection.SendLine("ERROR :no permission");
                    this.CloseLink(connection);
                    return;
                }
                // anmerkung: wird nur gemacht wenn er sich direkt registriert
                if (!this.HasServerAccess(ar[2]))
                {
                    connection.SendLine("ERROR :no c/n lines");
                    this.CloseLink(connection);
                    return;
                }

                // all fine, register the new server
                SimpleServer ser = new SimpleServer(); // ausfüllen
                ser.HopCount = Convert.ToInt32(ar[3]);
                this.RegisterServer((IRCConnection)connection, ser);
            }
        }