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
示例#1
0
        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);
        }