public void DeleteFriend(MsgrClient client, Packet packet)
{
var contactId = packet.GetInt();
// Check friend
var friend = client.User.GetFriend(contactId);
if (friend == null)
{
Log.Warning("DeleteFriend: User '{0}' tried to delete non-existent friend.", client.User.AccountId);
client.Kill(); // Out of sync, close connection.
return;
}
client.User.Friends.Remove(friend);
MsgrServer.Instance.Database.DeleteFriend(client.User.Id, contactId);
// Live update
var friendUser = MsgrServer.Instance.UserManager.Get(contactId);
if (friendUser != null)
{
Send.FriendOffline(friendUser, client.User);
}
}