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

FriendUnblockR() public static method

Response to FriendUnblock request.
public static FriendUnblockR ( 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 static void FriendUnblockR(User user, bool success, int friendId)
		{
			var packet = new Packet(Op.Msgr.FriendUnblockR, 0);

			packet.PutByte(success);
			if (success)
				packet.PutInt(friendId);

			user.Client.Send(packet);
		}

Usage Example

Ejemplo n.º 1
0
        public void FriendUnblock(MsgrClient client, Packet packet)
        {
            var contactId = packet.GetInt();

            // Check friend
            var friend = client.User.GetFriend(contactId);

            if (friend == null)
            {
                Log.Warning("FriendUnblock: User '{0}' tried to block invalid friend.", client.User.AccountId);
                return;
            }

            // Check status
            if (friend.FriendshipStatus != FriendshipStatus.Blocked)
            {
                Send.FriendUnblockR(client.User, false, contactId);
                return;
            }

            // Change status
            friend.FriendshipStatus = FriendshipStatus.Normal;
            MsgrServer.Instance.Database.SetFriendshipStatusOneSided(client.User.Id, contactId, friend.FriendshipStatus);

            Send.FriendUnblockR(client.User, true, contactId);

            // Live update
            var friendUser = MsgrServer.Instance.UserManager.Get(contactId);

            if (friendUser != null)
            {
                Send.FriendOnline(friendUser, client.User);
            }
        }