Aura.Msgr.Network.Send.ReadNoteR C# (CSharp) Method

ReadNoteR() public static method

Sends note to client.
public static ReadNoteR ( MsgrClient client, Note note ) : void
client MsgrClient
note Note Set to null for negative response.
return void
		public static void ReadNoteR(MsgrClient client, Note note)
		{
			var packet = new Packet(Op.Msgr.ReadNoteR, 0);

			packet.PutByte(note != null);
			if (note != null)
			{
				packet.PutLong(note.Id);
				packet.PutString(note.FromCharacterName);
				packet.PutString(note.FromServer);
				packet.PutLong(note.GetLongTime());
				packet.PutByte(0); // Notification note? (reply disabled)
				packet.PutString(note.Message);
			}

			client.Send(packet);
		}

Usage Example

コード例 #1
0
ファイル: MsgrHandlers.cs プロジェクト: anjhony6778/aura
        public void ReadNote(MsgrClient client, Packet packet)
        {
            var noteId = packet.GetLong();

            // TODO: Cache everything in memory?
            var note = MsgrServer.Instance.Database.GetNote(noteId);

            // Check note
            if (note == null)
            {
                Log.Warning("User '{0}' requested a non-existent note.", client.User.AccountId);
                Send.ReadNoteR(client, null);
                return;
            }

            // Check receiver
            if (note.Receiver != client.User.FullName)
            {
                Log.Warning("User '{0}' tried to read a note that's not his.", client.User.AccountId);
                Send.ReadNoteR(client, null);
                return;
            }

            MsgrServer.Instance.Database.SetNoteRead(noteId);

            Send.ReadNoteR(client, note);
        }