/// <summary> /// This handles the asynchronous response of a RequestAvatarNames call. /// </summary> /// <param name="sender"></param> /// <param name="e">names cooresponding to the the list of IDs sent the the RequestAvatarNames call.</param> private void Avatars_OnAvatarNames(object sender, UUIDNameReplyEventArgs e) { Dictionary <UUID, string> newNames = new Dictionary <UUID, string>(); foreach (KeyValuePair <UUID, string> kvp in e.Names) { FriendInfo friend; lock (FriendList.Dictionary) { if (FriendList.TryGetValue(kvp.Key, out friend)) { if (friend.Name == null) { newNames.Add(kvp.Key, e.Names[kvp.Key]); } friend.Name = e.Names[kvp.Key]; FriendList[kvp.Key] = friend; } } } if (newNames.Count > 0 && m_FriendNames != null) { OnFriendNames(new FriendNamesEventArgs(newNames)); } }
/// <summary> /// Handle notifications sent when a friend rights change. This notification is also received /// when my own rights change. /// </summary> /// <param name="packet"></param> /// <param name="simulator"></param> private void ChangeUserRightsHandler(Packet packet, Simulator simulator) { if (packet.Type == PacketType.ChangeUserRights) { FriendInfo friend; ChangeUserRightsPacket rights = (ChangeUserRightsPacket)packet; foreach (ChangeUserRightsPacket.RightsBlock block in rights.Rights) { FriendRights newRights = (FriendRights)block.RelatedRights; if (FriendList.TryGetValue(block.AgentRelated, out friend)) { friend.TheirFriendRights = newRights; if (OnFriendRights != null) { try { OnFriendRights(friend); } catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); } } } else if (block.AgentRelated == Client.Self.AgentID) { if (FriendList.TryGetValue(rights.AgentData.AgentID, out friend)) { friend.MyFriendRights = newRights; if (OnFriendRights != null) { try { OnFriendRights(friend); } catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); } } } } } } }