Ejemplo n.º 1
0
        /// <summary>
        /// Loop through all (pending) replies for avatar properties
        /// and do something as yet unknown to me (gwyneth 20220120)
        /// </summary>
        /// <param name="sender">parameter ignored</param>
        /// <param name="e">List of avatar properties</param>
        /// <returns>void</returns>
        /// <remarks>updated for new callbacks</remarks>
        public void AvatarPropertiesReply(
            object?sender,
            AvatarPropertiesReplyEventArgs e
            )
        {
            /*
             * AvatarPropertiesReplyPacket reply = (AvatarPropertiesReplyPacket)packet;
             * bool status = false;
             * if ( (reply.PropertiesData.Flags & 1 << 4 ) != 0 ) {
             *      status = true;
             * } else {
             *      status = false;
             * }
             */
            Avatar.AvatarProperties Properties = new Avatar.AvatarProperties();
            Properties = e.Properties;

            DebugUtilities
            .WriteInfo($"{session} {MethodName} Processing AvatarPropertiesReply for {e.AvatarID.ToString()} is {Properties.Online.ToString()}");
            lock (avatarOnline)
            {
                avatarOnline[e.AvatarID] = Properties.Online;
            }
            if (OnlineLookupEvents.ContainsKey(e.AvatarID))
            {
                OnlineLookupEvents[e.AvatarID].Set();
            }
        }
Ejemplo n.º 2
0
        private void SetProfileProperties(Avatar.AvatarProperties properties)
        {
            txtBornOn.Text    = properties.BornOn;
            anPartner.AgentID = properties.Partner;

            if (fullName.EndsWith("Linden"))
            {
                rtbAccountInfo.AppendText("Linden Lab Employee\n");
            }
            if (properties.Identified)
            {
                rtbAccountInfo.AppendText("Identified\n");
            }
            if (properties.Transacted)
            {
                rtbAccountInfo.AppendText("Transacted\n");
            }

            rtbAbout.AppendText(properties.AboutText);

            txtWebURL.Text     = properties.ProfileURL;
            btnWebView.Enabled = btnWebOpen.Enabled = (txtWebURL.TextLength > 0);

            rtbAboutFL.AppendText(properties.FirstLifeText);
        }
Ejemplo n.º 3
0
        private void Avatars_AvatarPropertiesReply(object sender, AvatarPropertiesReplyEventArgs e)
        {
            Properties_AV = e.Properties;

            profile_get.Set();

            BotSession.Instance.grid.Avatars.AvatarPropertiesReply -= Avatars_AvatarPropertiesReply;
        }
Ejemplo n.º 4
0
 void onAvatarProperties(LLUUID avatarID, Avatar.AvatarProperties properties)
 {
     lock (ReceivedAvatarPropertiesEvent)
     {
         avatarProperties = properties;
         ReceivedAvatarPropertiesEvent.Set();
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Look up the profile for a UUID
        /// </summary>
        /// <param name="b">RESTbot object</param>
        /// <param name="key">UUID of avatar to retrieve profile</param>
        /// <returns>Full profile as a string, or null if profile is empty/does not exist</returns>
        /// <remarks>C# 8+ is stricter when returning nulls, thus the <c>string?</c> method type.</remarks>
        public string?getProfile(RestBot b, UUID key)
        {
            DebugUtilities
            .WriteInfo(session +
                       " " +
                       MethodName +
                       " Looking up profile for " +
                       key.ToString());

            lock (ProfileLookupEvents)
            {
                ProfileLookupEvents.Add(key, new AutoResetEvent(false));
            }
            b.Client.Avatars.RequestAvatarProperties(key);

            ProfileLookupEvents[key].WaitOne(15000, true);

            lock (ProfileLookupEvents)
            {
                ProfileLookupEvents.Remove(key);
            }
            if (avatarProfile.ContainsKey(key))
            {
                Avatar.AvatarProperties p = avatarProfile[key];
                string response           = $@"
	<profile>
		<publish>{p.AllowPublish.ToString()}</publish>
		<firstlife>
			<text>
				{p.FirstLifeText.Replace(">", "%3C").Replace("<", "%3E")}
			</text>
			<image>{p.FirstLifeImage.ToString()}</image>
		</firstlife>
		<partner>{p.Partner.ToString()}</partner>
		<born>{p.BornOn}</born>
		<about>
			{p.AboutText.Replace(">", "%3C").Replace("<", "%3E")}
		</about>
		<charter>{p.CharterMember}</charter>
		<profileimage>{p.ProfileImage.ToString()}</profileimage>
		<mature>{p.MaturePublish.ToString()}</mature>
		<identified>{p.Identified.ToString()}</identified>
		<transacted>{p.Transacted.ToString()}</transacted>
		<url>{p.ProfileURL}</url>
	</profile>"    ;
                lock (avatarProfile)
                {
                    avatarProfile.Remove(key);
                }
                return(response);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 6
0
        void Avatars_OnAvatarProperties(LLUUID avatarID, Avatar.AvatarProperties properties)
        {
            lock (ReceivedProfileEvent)
            {
                Properties         = properties;
                ReceivedProperties = true;

                if (ReceivedInterests && ReceivedProperties && ReceivedGroups)
                {
                    ReceivedProfileEvent.Set();
                }
            }
        }
Ejemplo n.º 7
0
        void Avatars_AvatarPropertiesReply(object sender, AvatarPropertiesReplyEventArgs e)
        {
            lock (ReceivedProfileEvent)
            {
                Properties         = e.Properties;
                ReceivedProperties = true;

                if (ReceivedInterests && ReceivedProperties && ReceivedGroups)
                {
                    ReceivedProfileEvent.Set();
                }
            }
        }
        private void Avatars_AvatarPropertiesReply(object sender, AvatarPropertiesReplyEventArgs e)
        {
            if (e.AvatarID != targetID)
            {
                return;
            }
            lock (ReceivedProfileEvent)
            {
                Properties         = e.Properties;
                ReceivedProperties = true;

                if (ReceivedInterests && ReceivedProperties && ReceivedGroups)
                {
                    ReceivedProfileEvent.Set();
                }
            }
        }
Ejemplo n.º 9
0
 void Avatars_AvatarPropertiesReply(object sender, AvatarPropertiesReplyEventArgs e)
 {
     if (e.AvatarID == Client.Self.AgentID && AimlLoaded)
     {
         MyProfile = e.Properties;
         Alice.GlobalSettings.updateSetting("birthday", MyProfile.BornOn);
         DateTime bd;
         if (DateTime.TryParse(MyProfile.BornOn, Utils.EnUsCulture, System.Globalization.DateTimeStyles.None, out bd))
         {
             DateTime now = DateTime.Today;
             int      age = now.Year - bd.Year;
             if (now.Month < bd.Month || (now.Month == bd.Month && now.Day < bd.Day))
             {
                 --age;
             }
             Alice.GlobalSettings.updateSetting("age", age.ToString());
             Alice.GlobalSettings.updateSetting("birthday", bd.ToLongDateString());
         }
     }
 }
Ejemplo n.º 10
0
        void Avatars_AvatarPropertiesReply(object sender, AvatarPropertiesReplyEventArgs e)
        {
            if (e.AvatarID != agentID)
            {
                return;
            }

            if (InvokeRequired)
            {
                Invoke(new MethodInvoker(() => Avatars_AvatarPropertiesReply(sender, e)));
                return;
            }
            Profile = e.Properties;

            FLImageID = e.Properties.FirstLifeImage;
            SLImageID = e.Properties.ProfileImage;

            if (agentID == client.Self.AgentID || SLImageID != UUID.Zero)
            {
                SLImageHandler pic = new SLImageHandler(instance, SLImageID, "");

                if (agentID == client.Self.AgentID)
                {
                    pic.AllowUpdateImage = true;
                    pic.ImageUpdated    += (usender, ue) =>
                    {
                        Profile.ProfileImage = ue.NewImageID;
                        pic.UpdateImage(ue.NewImageID);
                        client.Self.UpdateProfile(Profile);
                    };
                }

                pic.Dock     = DockStyle.Fill;
                pic.SizeMode = PictureBoxSizeMode.StretchImage;
                slPicPanel.Controls.Add(pic);
                slPicPanel.Show();
            }
            else
            {
                slPicPanel.Hide();
            }

            if (agentID == client.Self.AgentID || FLImageID != UUID.Zero)
            {
                SLImageHandler pic = new SLImageHandler(instance, FLImageID, "");
                pic.Dock = DockStyle.Fill;

                if (agentID == client.Self.AgentID)
                {
                    pic.AllowUpdateImage = true;
                    pic.ImageUpdated    += (usender, ue) =>
                    {
                        Profile.FirstLifeImage = ue.NewImageID;
                        pic.UpdateImage(ue.NewImageID);
                        client.Self.UpdateProfile(Profile);
                    };
                }

                rlPicPanel.Controls.Add(pic);
                rlPicPanel.Show();
            }
            else
            {
                rlPicPanel.Hide();
            }

            this.BeginInvoke(
                new OnSetProfileProperties(SetProfileProperties),
                new object[] { e.Properties });
        }
Ejemplo n.º 11
0
        private void SetProfileProperties(Avatar.AvatarProperties properties)
        {
            try
            {
                txtBornOn.Text = properties.BornOn;
                partner        = properties.Partner;
                if (properties.Partner != UUID.Zero)
                {
                    if (!instance.avnames.ContainsKey(properties.Partner))
                    {
                        client.Avatars.RequestAvatarName(properties.Partner);
                    }
                    else
                    {
                        txtPartner.Text = instance.avnames[properties.Partner].ToString();
                    }
                }

                try
                {
                    if (fullName.EndsWith("Linden", StringComparison.CurrentCulture))
                    {
                        rtbAccountInfo.AppendText("Linden Lab Employee\n");
                    }
                    else
                    {
                        rtbAccountInfo.AppendText("Resident\n");
                    }
                }
                catch {; }

                if (properties.Identified && !properties.Transacted)
                {
                    rtbAccountInfo.AppendText("Payment Info On File\n");
                }
                else if (properties.Transacted)
                {
                    rtbAccountInfo.AppendText("Payment Info Used\n");
                }
                else
                {
                    rtbAccountInfo.AppendText("No Payment Info On File\n");
                }

                if (properties.Online)
                {
                    txtOnline.Text = "Currently Online";
                }
                else
                {
                    txtOnline.Text = "unknown";
                }

                rtbAbout.AppendText(properties.AboutText);

                txtWebURL.Text     = properties.ProfileURL;
                btnWebView.Enabled = btnWebOpen.Enabled = (txtWebURL.TextLength > 0);

                rtbAboutFL.AppendText(properties.FirstLifeText);

                txtUUID.Text = this.agentID.ToString();
            }
            catch (Exception exp)
            {
                OpenMetaverse.Logger.Log(String.Format(CultureInfo.CurrentCulture, "frmProfile.SetProfileProperties: {0}", exp.ToString()), Helpers.LogLevel.Error);
            }
        }
Ejemplo n.º 12
0
        //comes in on separate thread
        private void Avatars_OnAvatarProperties(object sender, AvatarPropertiesReplyEventArgs e)
        {
            if (InvokeRequired)
            {
                Invoke(new MethodInvoker(() => Avatars_OnAvatarProperties(sender, e)));
                return;
            }

            if (e.AvatarID != agentID)
            {
                return;
            }

            props = e.Properties;

            FLImageID = props.FirstLifeImage;
            SLImageID = props.ProfileImage;

            if (instance.avtags.ContainsKey(e.AvatarID))
            {
                try
                {
                    string atag = instance.avtags[e.AvatarID];
                    txtTag.Text = atag;
                }
                catch {; }
            }
            else
            {
                txtTag.Text = "avatar out of range";
            }

            if (SLImageID != UUID.Zero)
            {
                if (!instance.ImageCache.ContainsImage(SLImageID))
                {
                    client.Assets.RequestImage(SLImageID, ImageType.Normal, Assets_OnImageReceived);
                }
                else
                {
                    BeginInvoke(
                        new OnSetProfileImage(SetProfileImage),
                        new object[] { SLImageID, instance.ImageCache.GetImage(SLImageID) });
                }
            }
            else
            {
                BeginInvoke(new MethodInvoker(SetBlankSLImage));
            }

            if (FLImageID != UUID.Zero)
            {
                if (!instance.ImageCache.ContainsImage(FLImageID))
                {
                    client.Assets.RequestImage(FLImageID, ImageType.Normal, Assets_OnImageReceived);
                }
                else
                {
                    BeginInvoke(
                        new OnSetProfileImage(SetProfileImage),
                        new object[] { FLImageID, instance.ImageCache.GetImage(FLImageID) });
                }
            }
            else
            {
                BeginInvoke(new MethodInvoker(SetBlankFLImage));
            }

            this.BeginInvoke(
                new OnSetProfileProperties(SetProfileProperties),
                new object[] { props });
        }