예제 #1
0
        private static void DirChatPush(AresClient client, TCPPacketReader packet)
        {
            if (client.Quarantined)
            {
                return;
            }

            String name = packet.ReadString(client);

            if (Encoding.UTF8.GetByteCount(name) < 2)
            {
                client.SendPacket(new byte[] { 1, 0, (byte)TCPMsg.MSG_CHAT_CLIENT_DIRCHATPUSH, 4 });
            }
            else if (packet.Remaining != 16)
            {
                client.SendPacket(new byte[] { 1, 0, (byte)TCPMsg.MSG_CHAT_CLIENT_DIRCHATPUSH, 3 });
            }
            else
            {
                byte[]     cookie = packet;
                AresClient target = UserPool.AUsers.Find(x => x.Name == name);

                if (target == null)
                {
                    client.SendPacket(new byte[] { 1, 0, (byte)TCPMsg.MSG_CHAT_CLIENT_DIRCHATPUSH, 1 });
                }
                else if (target.IgnoreList.Contains(client.Name))
                {
                    client.SendPacket(new byte[] { 1, 0, (byte)TCPMsg.MSG_CHAT_CLIENT_DIRCHATPUSH, 2 });
                }
                else
                {
                    client.SendPacket(new byte[] { 1, 0, (byte)TCPMsg.MSG_CHAT_CLIENT_DIRCHATPUSH, 0 });
                    target.SendPacket(TCPOutbound.DirectChatPush(target, client, cookie));
                }
            }
        }