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);
}