예제 #1
0
        void Avatars_OnAvatarProperties(LLUUID avatarID, Avatar.AvatarProperties properties)
        {
            lock (ReceivedProfileEvent)
            {
                Properties = properties;
                ReceivedProperties = true;

                if (ReceivedInterests && ReceivedProperties && ReceivedGroups)
                    ReceivedProfileEvent.Set();
            }
        }
예제 #2
0
        /// <summary>
        /// Process incoming avatar properties (profile data)
        /// </summary>
        /// <param name="packet"></param>
        /// <param name="sim"></param>
        private void AvatarPropertiesHandler(Packet packet, Simulator sim)
        {
            if (OnAvatarProperties != null)
            {
                AvatarPropertiesReplyPacket reply      = (AvatarPropertiesReplyPacket)packet;
                Avatar.AvatarProperties     properties = new Avatar.AvatarProperties();

                properties.ProfileImage   = reply.PropertiesData.ImageID;
                properties.FirstLifeImage = reply.PropertiesData.FLImageID;
                properties.Partner        = reply.PropertiesData.PartnerID;
                properties.AboutText      = Helpers.FieldToUTF8String(reply.PropertiesData.AboutText);
                properties.FirstLifeText  = Helpers.FieldToUTF8String(reply.PropertiesData.FLAboutText);
                properties.BornOn         = Helpers.FieldToUTF8String(reply.PropertiesData.BornOn);
                //properties.CharterMember = Helpers.FieldToUTF8String(reply.PropertiesData.CharterMember);
                uint charter = Helpers.BytesToUInt(reply.PropertiesData.CharterMember);
                if (charter == 0)
                {
                    properties.CharterMember = "Resident";
                }
                else if (charter == 2)
                {
                    properties.CharterMember = "Charter";
                }
                else if (charter == 3)
                {
                    properties.CharterMember = "Linden";
                }
                else
                {
                    properties.CharterMember = Helpers.FieldToUTF8String(reply.PropertiesData.CharterMember);
                }
                properties.Flags      = (Avatar.ProfileFlags)reply.PropertiesData.Flags;
                properties.ProfileURL = Helpers.FieldToUTF8String(reply.PropertiesData.ProfileURL);

                OnAvatarProperties(reply.AgentData.AvatarID, properties);
            }
        }
예제 #3
0
        /// <summary>
        /// Handles incoming avatar statistics, such as ratings
        /// </summary>
        /// <param name="packet"></param>
        /// <param name="simulator"></param>
/*        private void AvatarStatisticsHandler(Packet packet, Simulator simulator)
        {
            if (OnAvatarStatistics != null)
            {
                AvatarStatisticsReplyPacket asr = (AvatarStatisticsReplyPacket)packet;
                Avatar.Statistics stats = new Avatar.Statistics();

                foreach (AvatarStatisticsReplyPacket.StatisticsDataBlock b in asr.StatisticsData)
                {
                    string n = Helpers.FieldToUTF8String(b.Name);

                    switch (n)
                    {
                        case "Behavior":
                            stats.BehaviorPositive = b.Positive;
                            stats.BehaviorNegative = b.Negative;
                            break;
                        case "Appearance":
                            stats.AppearancePositive = b.Positive;
                            stats.AppearanceNegative = b.Negative;
                            break;
                        case "Building":
                            stats.AppearancePositive = b.Positive;
                            stats.AppearanceNegative = b.Negative;
                            break;
                        case "Given":
                            stats.GivenPositive = b.Positive;
                            stats.GivenNegative = b.Negative;
                            break;
                        default:
                            Client.Log("Got an AvatarStatistics block with the name " + n, Helpers.LogLevel.Warning);
                            break;
                    }
                }

                OnAvatarStatistics(asr.AvatarData.AvatarID, stats);
            }
        } */

        /// <summary>
        /// Process incoming avatar properties (profile data)
        /// </summary>
        /// <param name="packet"></param>
        /// <param name="sim"></param>
        private void AvatarPropertiesHandler(Packet packet, Simulator sim)
        {
            if (OnAvatarProperties != null)
            {
                AvatarPropertiesReplyPacket reply = (AvatarPropertiesReplyPacket)packet;
                Avatar.AvatarProperties properties = new Avatar.AvatarProperties();

                properties.ProfileImage = reply.PropertiesData.ImageID;
                properties.FirstLifeImage = reply.PropertiesData.FLImageID;
                properties.Partner = reply.PropertiesData.PartnerID;
                properties.AboutText = Helpers.FieldToUTF8String(reply.PropertiesData.AboutText);
                properties.FirstLifeText = Helpers.FieldToUTF8String(reply.PropertiesData.FLAboutText);
                properties.BornOn = Helpers.FieldToUTF8String(reply.PropertiesData.BornOn);
                properties.CharterMember = Helpers.FieldToUTF8String(reply.PropertiesData.CharterMember);
                // FIXME: These have been converted in to a Flags field, build an enum and fix this!
                //properties.AllowPublish = reply.PropertiesData.AllowPublish;
                //properties.MaturePublish = reply.PropertiesData.MaturePublish;
                //properties.Identified = reply.PropertiesData.Identified;
                //properties.Transacted = reply.PropertiesData.Transacted;
                properties.ProfileURL = Helpers.FieldToUTF8String(reply.PropertiesData.ProfileURL);

                OnAvatarProperties(reply.AgentData.AvatarID, properties);
            }
        }
예제 #4
0
 void onAvatarProperties(LLUUID avatarID, Avatar.AvatarProperties properties)
 {
     lock (ReceivedAvatarPropertiesEvent)
     {
         avatarProperties = properties;
         ReceivedAvatarPropertiesEvent.Set();
     }
 }
예제 #5
0
        /// <summary>
        /// Process incoming avatar properties (profile data)
        /// </summary>
        /// <param name="packet"></param>
        /// <param name="sim"></param>
        private void AvatarPropertiesHandler(Packet packet, Simulator sim)
        {
            if (OnAvatarProperties != null)
            {
                AvatarPropertiesReplyPacket reply = (AvatarPropertiesReplyPacket)packet;
                Avatar.AvatarProperties properties = new Avatar.AvatarProperties();

                properties.ProfileImage = reply.PropertiesData.ImageID;
                properties.FirstLifeImage = reply.PropertiesData.FLImageID;
                properties.Partner = reply.PropertiesData.PartnerID;
                properties.AboutText = Helpers.FieldToUTF8String(reply.PropertiesData.AboutText);
                properties.FirstLifeText = Helpers.FieldToUTF8String(reply.PropertiesData.FLAboutText);
                properties.BornOn = Helpers.FieldToUTF8String(reply.PropertiesData.BornOn);
                //properties.CharterMember = Helpers.FieldToUTF8String(reply.PropertiesData.CharterMember);
                uint charter = Helpers.BytesToUInt(reply.PropertiesData.CharterMember);
                if ( charter == 0 ) {
                    properties.CharterMember = "Resident";
                } else if ( charter == 2 ) {
                    properties.CharterMember = "Charter";
                } else if ( charter == 3 ) {
                    properties.CharterMember = "Linden";
                } else {
                    properties.CharterMember = Helpers.FieldToUTF8String(reply.PropertiesData.CharterMember);
                }
                properties.Flags = (Avatar.ProfileFlags)reply.PropertiesData.Flags;
                properties.ProfileURL = Helpers.FieldToUTF8String(reply.PropertiesData.ProfileURL);

                OnAvatarProperties(reply.AgentData.AvatarID, properties);
            }
        }
예제 #6
0
        public bool GetAvatarProfile(LLUUID id, out Avatar.Interests interests, out Avatar.AvatarProperties properties,
            out List<LLUUID> groups)
        {
            // Do a local lookup first
            if (avatars.ContainsKey(id) && avatars[id].ProfileProperties.BornOn != null &&
                avatars[id].ProfileProperties.BornOn != String.Empty)
            {
                interests = avatars[id].ProfileInterests;
                properties = avatars[id].ProfileProperties;
                groups = avatars[id].Groups;

                return true;
            }

            // Create the ManualResetEvents
            lock (PropertiesLookupEvents)
                if (!PropertiesLookupEvents.ContainsKey(id))
                    PropertiesLookupEvents[id] = new ManualResetEvent(false);
            lock (InterestsLookupEvents)
                if (!InterestsLookupEvents.ContainsKey(id))
                    InterestsLookupEvents[id] = new ManualResetEvent(false);
            lock (GroupsLookupEvents)
                if (!GroupsLookupEvents.ContainsKey(id))
                    GroupsLookupEvents[id] = new ManualResetEvent(false);

            // Request the avatar profile
            Client.Avatars.RequestAvatarProperties(id);

            // Wait for all of the events to complete
            PropertiesLookupEvents[id].WaitOne(5000, false);
            InterestsLookupEvents[id].WaitOne(5000, false);
            GroupsLookupEvents[id].WaitOne(5000, false);

            // Destroy the ManualResetEvents
            lock (PropertiesLookupEvents)
                PropertiesLookupEvents.Remove(id);
            lock (InterestsLookupEvents)
                InterestsLookupEvents.Remove(id);
            lock (GroupsLookupEvents)
                GroupsLookupEvents.Remove(id);

            // If we got a filled in profile return everything
            if (avatars.ContainsKey(id) && avatars[id].ProfileProperties.BornOn != null &&
                avatars[id].ProfileProperties.BornOn != String.Empty)
            {
                interests = avatars[id].ProfileInterests;
                properties = avatars[id].ProfileProperties;
                groups = avatars[id].Groups;

                return true;
            }
            else
            {
                interests = new Avatar.Interests();
                properties = new Avatar.AvatarProperties();
                groups = null;

                return false;
            }
        }