diff --git a/LibreMetaverse/AvatarManager.cs b/LibreMetaverse/AvatarManager.cs index 2d59de49..55763854 100644 --- a/LibreMetaverse/AvatarManager.cs +++ b/LibreMetaverse/AvatarManager.cs @@ -279,6 +279,29 @@ public event EventHandler AvatarInterestsReply remove { lock (m_AvatarInterestsReplyLock) { m_AvatarInterestsReply -= value; } } } + /// The event subscribers, null of no subscribers + private EventHandler m_AvatarNotesReply; + + ///Raises the AvatarNotesReply Event + /// A AvatarNotesReplyEventArgs object containing + /// the data sent from the simulator + protected virtual void OnAvatarNotesReply(AvatarNotesReplyEventArgs e) + { + EventHandler handler = m_AvatarNotesReply; + handler?.Invoke(this, e); + } + + /// Thread sync lock object + private readonly object m_AvatarNotesReplyLock = new object(); + + /// Raised when the simulator sends us data containing + /// the private notes listed in an agents profile + public event EventHandler AvatarNotesReply + { + add { lock (m_AvatarNotesReplyLock) { m_AvatarNotesReply += value; } } + remove { lock (m_AvatarNotesReplyLock) { m_AvatarNotesReply -= value; } } + } + /// The event subscribers, null of no subscribers private EventHandler m_AvatarPropertiesReply; @@ -561,6 +584,7 @@ public AvatarManager(GridClient client) Client.Network.RegisterCallback(PacketType.AvatarPropertiesReply, AvatarPropertiesHandler); // Client.Network.RegisterCallback(PacketType.AvatarStatisticsReply, AvatarStatisticsHandler); Client.Network.RegisterCallback(PacketType.AvatarInterestsReply, AvatarInterestsHandler); + Client.Network.RegisterCallback(PacketType.AvatarNotesReply, AvatarNotesHandler); // Avatar group callback Client.Network.RegisterCallback(PacketType.AvatarGroupsReply, AvatarGroupsReplyHandler); @@ -1038,6 +1062,19 @@ protected void AvatarInterestsHandler(object sender, PacketReceivedEventArgs e) } } + protected void AvatarNotesHandler(object sender, PacketReceivedEventArgs e) + { + if (m_AvatarNotesReply != null) + { + Packet packet = e.Packet; + AvatarNotesReplyPacket anrp = (AvatarNotesReplyPacket)packet; + UUID target = anrp.Data.TargetID; + string notes = Utils.BytesToString(anrp.Data.Notes); + + OnAvatarNotesReply(new AvatarNotesReplyEventArgs(anrp.Data.TargetID, notes)); + } + } + /// /// EQ Message fired when someone nearby changes their display name /// @@ -1492,6 +1529,22 @@ public AvatarInterestsReplyEventArgs(UUID avatarID, Avatar.Interests interests) } } + /// Represents the private notes from the profile of an agent + public class AvatarNotesReplyEventArgs : EventArgs + { + /// Get the ID of the agent + public UUID AvatarID { get; } + + /// Get the interests of the agent + public string Notes { get; } + + public AvatarNotesReplyEventArgs(UUID avatarID, string notes) + { + this.AvatarID = avatarID; + this.Notes = notes; + } + } + /// The properties of an agent public class AvatarPropertiesReplyEventArgs : EventArgs {