コード例 #1
0
        public static byte[] CustomPM(String target, String text, CryptoService c)
        {
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteString("cb0t_pm_msg", c);
            packet.WriteString(target, c);
            packet.WriteBytes(PMCrypto.SoftEncrypt(target, Encoding.UTF8.GetBytes(Helpers.FormatAresColorCodes(text))));
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_CUSTOM_DATA));
        }
コード例 #2
0
ファイル: Room.Handler.cs プロジェクト: hollow87/cb0t
        private void Eval_cb0t_pm_msg(User user, byte[] data)
        {
            if (!Settings.GetReg <bool>("can_receive_pms", true))
            {
                return;
            }

            String name = user.Name;
            String text = Encoding.UTF8.GetString(PMCrypto.SoftDecrypt(this.MyName, data));
            User   u    = this.users.Find(x => x.Name == name);

            if (u == null)
            {
                return;
            }

            if (u.Ignored)
            {
                return;
            }

            AresFont font = null;

            if (u.Font != null)
            {
                font = u.Font;
            }

            text = ScriptEvents.OnPmReceiving(this, u, text);

            if (!String.IsNullOrEmpty(text))
            {
                this.Panel.PMTextReceived(this, u, name, text, font, PMTextReceivedType.Text);
                this.Panel.CheckUnreadStatus();
                ScriptEvents.OnPmReceived(this, u, text);
            }
        }