public static FriendBlockR ( Aura.Msgr.Database.User user, bool success, int friendId ) : void | ||
user | Aura.Msgr.Database.User | |
success | bool | |
friendId | int | Only required on success. |
return | void |
public void FriendBlock(MsgrClient client, Packet packet) { var contactId = packet.GetInt(); // Check friend var friend = client.User.GetFriend(contactId); if (friend == null) { Log.Warning("FriendBlock: User '{0}' tried to block invalid friend.", client.User.AccountId); return; } // Check status if (friend.FriendshipStatus != FriendshipStatus.Normal) { Send.FriendBlockR(client.User, false, contactId); return; } // Change status friend.FriendshipStatus = FriendshipStatus.Blocked; MsgrServer.Instance.Database.SetFriendshipStatusOneSided(client.User.Id, contactId, friend.FriendshipStatus); Send.FriendBlockR(client.User, true, contactId); // Live update var friendUser = MsgrServer.Instance.UserManager.Get(contactId); if (friendUser != null) { // Show as offline from now on Send.FriendOffline(friendUser, client.User); } }