private void ChangeUserRightsHandler(Object sender, PacketReceivedEventArgs e)
{
Packet packet = e.getPacket();
if (packet.Type == PacketType.ChangeUserRights)
{
FriendInfo friend;
ChangeUserRightsPacket rights = (ChangeUserRightsPacket)packet;
for (ChangeUserRightsPacket.RightsBlock block : rights.Rights)
{
EnumSet<FriendRights> newRights = FriendRights.get(block.RelatedRights);
if ((friend = FriendList.get(block.AgentRelated) )!= null)
{
friend.setTheirFriendRights(newRights);
if (onFriendRightsUpdate != null)
{
onFriendRightsUpdate.raiseEvent(new FriendInfoEventArgs(friend));
}
}
else if (block.AgentRelated.equals(Client.self.getAgentID()))
{
if (( friend = FriendList.get(rights.AgentData.AgentID))!=null)
{
friend.setMyFriendRights(newRights);
if (onFriendRightsUpdate != null)
{
onFriendRightsUpdate.raiseEvent(new FriendInfoEventArgs(friend));
}
}