Beispiel #1
0
        private void Eval_Redirect(TCPPacketReader packet, uint time)
        {
            if (Settings.GetReg <bool>("block_redirect", false))
            {
                return;
            }

            Redirect redirect = new Redirect();

            redirect.IP   = packet;
            redirect.Port = packet;
            packet.SkipBytes(4);
            redirect.Name     = packet.ReadString(this.crypto);
            redirect.Hashlink = Hashlink.EncodeHashlink(redirect);

            if (ScriptEvents.OnRedirecting(this, redirect))
            {
                this.Credentials.IP   = redirect.IP;
                this.Credentials.Port = redirect.Port;
                this.Credentials.Name = redirect.Name;
                this.ticks            = (time - 19);
                this.state            = SessionState.Sleeping;
                this.sock.Disconnect();
                this.Panel.AnnounceText(StringTemplate.Get(STType.Messages, 15).Replace("+x", redirect.Name));
            }
        }
Beispiel #2
0
        public static String EncodeHashlink(Redirect room)
        {
            List <byte> list = new List <byte>();

            list.AddRange(new byte[20]);
            list.AddRange(Encoding.UTF8.GetBytes("CHATCHANNEL"));
            list.Add(0);
            list.AddRange(room.IP.GetAddressBytes());
            list.AddRange(BitConverter.GetBytes(room.Port));
            list.AddRange(room.IP.GetAddressBytes());
            list.AddRange(Encoding.UTF8.GetBytes(room.Name));
            list.Add(0);
            list.Add(0);

            byte[] buf = list.ToArray();
            buf = Zip.Compress(buf);
            buf = e67(buf, 28435);

            return(Convert.ToBase64String(buf));
        }