예제 #1
0
        public virtual void SendWho(IRCUserConnection client, bool only_ops)
        {
            Console.WriteLine(this + ".SendWho()");
            bool is_member, is_visible;

            if (!this.HasConnection(client))
                is_member = false;
            else
                is_member = true;
            #if false
            if (!is_member && this.HasMode('s')) // secret chan
                return; // user is not in the channel -> return
            #endif
            if (is_member || !this.HasMode('s'))
            {
                foreach (SimpleUser usr in this._users)
                {
            //					IRCUserConnection usr = (IRCUserConnection)dict.Value; // TODO: MUSS mal ein SimpleUser sein

                    if (usr.UserMode.HasMode(IRCUserModes.MODE_INVISIBLE))
                        is_visible = false;
                    else
                        is_visible = true;

                    if (is_visible || is_member)
                    {
                    //	if (only_ops && !usr.ChanUserMode.get(this, IRCUserModes.MODE_OP)) // TODO
                    //		continue;

                    //:irc.localhost 352 test #test ~aa localhost irc.localhost test H :0 aa
            //[channel] [user] [host] [server] [nick]( "H" / "G" > ["*"] [ ( "@" / "+" ) ] :[hopcount] [real name]
            //:amd                    352 blackdragon #test    aa    127.0.0.1      amd              blackdragon H :0 aa
            //:example.irc.org 352 blackdragon #test ~aa localhost.tux example.irc.org blackdragon H* :0 aa

                        client.SendCommand(ReplyCodes.RPL_WHOREPLY, client.NickName, this.Name, usr.UserName, "127.0.0.1" /*usr.HostName/*todo*/, this._server.ServerName, usr.NickName, "H"/*( "H" / "G" > ["*"] [ ( "@" / "+" ) ]*/, String.Format("{0} {1}", usr.HopCount, usr.RealName));//, true); // true ein ":" beim letzen parameter
                    }
                }
            }
            client.SendCommand(ReplyCodes.RPL_ENDOFWHO, client.NickName, this.Name, ":End of /WHO list.");
        }
예제 #2
0
        public virtual void SendNames(IRCUserConnection client)
        {
            string line = ":";
            string[] nicks = this.Nicks;
            for (int j = 0; j < nicks.Length; j++)
            {
                if (j == nicks.Length-1)
                    line += nicks[j];
                else
                    line += nicks[j] + ' ';
            }

            client.SendCommand(ReplyCodes.RPL_NAMREPLY, client.NickName, "=", this.Name, line); // TODO: liste kann zu lang werden
            client.SendCommand(ReplyCodes.RPL_ENDOFNAMES, client.NickName, this.Name, ":End of NAMES list");
        }