public override string Execute(string[] args, LLUUID fromAgentID)
        {
            if (args.Length != 1)
                return "Usage: downloadtexture [texture-uuid]";

            TextureID = LLUUID.Zero;
            DownloadHandle.Reset();
            Image = null;
            Asset = null;

            if (LLUUID.TryParse(args[0], out TextureID))
            {
                Client.Assets.RequestImage(TextureID, ImageType.Normal);
                if (DownloadHandle.WaitOne(120 * 1000, false))
                {
                    if (Image != null && Image.Success)
                    {
                        if (Asset != null && Asset.Decode())
                        {
                            try { File.WriteAllBytes(Image.ID.ToString() + ".jp2", Asset.AssetData); }
                            catch (Exception ex) { Logger.Log(ex.Message, Helpers.LogLevel.Error, Client, ex); }

                            return String.Format("Saved {0}.jp2 ({1}x{2})", Image.ID, Asset.Image.Width, Asset.Image.Height);
                        }
                        else
                        {
                            return "Failed to decode texture " + TextureID.ToString();
                        }
                    }
                    else if (Image != null && Image.NotFound)
                    {
                        return "Simulator reported texture not found: " + TextureID.ToString();
                    }
                    else
                    {
                        return "Download failed for texture " + TextureID.ToString();
                    }
                }
                else
                {
                    return "Timed out waiting for texture download";
                }
            }
            else
            {
                return "Usage: downloadtexture [texture-uuid]";
            }
        }
Esempio n. 2
0
        public SimProfile LoadFromGrid(LLUUID UUID, string GridURL, string SendKey, string RecvKey)
        {
            try
            {
                Hashtable GridReqParams = new Hashtable();
                GridReqParams["UUID"] = UUID.ToString();
                GridReqParams["authkey"] = SendKey;
                ArrayList SendParams = new ArrayList();
                SendParams.Add(GridReqParams);
                XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);

                XmlRpcResponse GridResp = GridReq.Send(GridURL, 3000);

                Hashtable RespData = (Hashtable)GridResp.Value;
                this.UUID = new LLUUID((string)RespData["UUID"]);
                this.regionhandle = Helpers.UIntsToLong(((uint)Convert.ToUInt32(RespData["region_locx"]) * 256), ((uint)Convert.ToUInt32(RespData["region_locy"]) * 256));
                this.regionname = (string)RespData["regionname"];
                this.sim_ip = (string)RespData["sim_ip"];
                this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]);
                this.caps_url = "http://" + ((string)RespData["sim_ip"]) + ":" + (string)RespData["sim_port"] + "/";
                this.RegionLocX = (uint)Convert.ToUInt32(RespData["region_locx"]);
                this.RegionLocY = (uint)Convert.ToUInt32(RespData["region_locy"]);
                this.sendkey = SendKey;
                this.recvkey = RecvKey;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            return this;
        }
Esempio n. 3
0
        void Groups_OnGroupLeft(LLUUID groupID, bool success)
        {
            Console.WriteLine(Client.ToString() + (success ? " has left group " : " failed to left group ") + groupID.ToString());

            leftGroup = success;
            GroupsEvent.Set();
        }
Esempio n. 4
0
        /// <summary>
        /// By using the bracket operator on this class, the program can get the
        /// InventoryObject designated by the specified uuid. If the value for the corresponding
        /// UUID is null, the call is equivelant to a call to <code>RemoveNodeFor(this[uuid])</code>.
        /// If the value is non-null, it is equivelant to a call to <code>UpdateNodeFor(value)</code>,
        /// the uuid parameter is ignored.
        /// </summary>
        /// <param name="uuid">The UUID of the InventoryObject to get or set, ignored if set to non-null value.</param>
        /// <returns>The InventoryObject corresponding to <code>uuid</code>.</returns>
        public InventoryBase this[LLUUID uuid]
        {
            get
            {
                InventoryNode node = Items[uuid];
                return(node.Data);
            }
            set
            {
                if (value != null)
                {
                    // Log a warning if there is a UUID mismatch, this will cause problems
                    if (value.UUID != uuid)
                    {
                        Client.Log("Inventory[uuid]: uuid " + uuid.ToString() + " is not equal to value.UUID " +
                                   value.UUID.ToString(), Helpers.LogLevel.Warning);
                    }

                    UpdateNodeFor(value);
                }
                else
                {
                    InventoryNode node;
                    if (Items.TryGetValue(uuid, out node))
                    {
                        RemoveNodeFor(node.Data);
                    }
                }
            }
        }
        public override string Execute(string[] args, LLUUID fromAgentID)
        {
            if (args.Length != 2)
                return "Usage: exportoutfit avataruuid outputfile.xml";

            LLUUID id;

            try
            {
                id = new LLUUID(args[0]);
            }
            catch (Exception)
            {
                return "Usage: exportoutfit avataruuid outputfile.xml";
            }

            lock (TestClient.Appearances)
            {
                if (TestClient.Appearances.ContainsKey(id))
                {
                    try
                    {
                        XmlWriterSettings settings = new XmlWriterSettings();
                        settings.Indent = true;
                        XmlWriter writer = XmlWriter.Create(args[1], settings);
                        try
                        {
                            TestClient.Appearances[id].ToXml(writer);
                        }
                        finally
                        {
                            writer.Close();
                        }
                    }
                    catch (Exception e)
                    {
                        return e.ToString();
                    }

                    return "Exported appearance for avatar " + id.ToString() + " to " + args[1];
                }
                else
                {
                    return "Couldn't find an appearance for avatar " + id.ToString();
                }
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Send an avatar back to their home location
        /// </summary>
        /// <param name="pest">Key of avatar to send home</param>
        public void TeleportHomeUser(LLUUID pest)
        {
            List <string> listParams = new List <string>();

            listParams.Add(Client.Self.AgentID.ToString());
            listParams.Add(pest.ToString());
            EstateOwnerMessage("teleporthomeuser", listParams);
        }
 private void Avatars_OnLookAt(LLUUID sourceID, LLUUID targetID, LLVector3d targetPos, 
     LookAtType lookType, float duration, LLUUID id)
 {
     if (ShowEffects)
         Console.WriteLine(
         "ViewerEffect [LookAt]: SourceID: {0} TargetID: {1} TargetPos: {2} Type: {3} Duration: {4} ID: {5}",
         sourceID.ToString(), targetID.ToString(), targetPos, lookType, duration,
         id.ToString());
 }
 private void Avatars_OnEffect(EffectType type, LLUUID sourceID, LLUUID targetID, 
     LLVector3d targetPos, float duration, LLUUID id)
 {
     if (ShowEffects)
         Console.WriteLine(
         "ViewerEffect [{0}]: SourceID: {1} TargetID: {2} TargetPos: {3} Duration: {4} ID: {5}",
         type, sourceID.ToString(), targetID.ToString(), targetPos, duration,
         id.ToString());
 }
Esempio n. 9
0
        /// <summary>Unban an avatar from an estate</summary>
        /// <param name="userID">Key of Agent to remove</param>
        public void UnbanUser(LLUUID userID)
        {
            List <string> listParams = new List <string>();
            uint          flag       = (uint)EstateAccessDelta.UnbanUser;

            listParams.Add(Client.Self.AgentID.ToString());
            listParams.Add(flag.ToString());
            listParams.Add(userID.ToString());
            EstateOwnerMessage("estateaccessdelta", listParams);
        }
 void Avatars_OnAvatarAppearance(LLUUID avatarID, bool isTrial, LLObject.TextureEntryFace defaultTexture, LLObject.TextureEntryFace[] faceTextures, System.Collections.Generic.List<byte> visualParams)
 {
     if (IsNullOrZero(faceTextures[(int)AppearanceManager.TextureIndex.EyesBaked]) &&
         IsNullOrZero(faceTextures[(int)AppearanceManager.TextureIndex.HeadBaked]) &&
         IsNullOrZero(faceTextures[(int)AppearanceManager.TextureIndex.LowerBaked]) &&
         IsNullOrZero(faceTextures[(int)AppearanceManager.TextureIndex.SkirtBaked]) &&
         IsNullOrZero(faceTextures[(int)AppearanceManager.TextureIndex.UpperBaked]))
     {
         Console.WriteLine("Avatar " + avatarID.ToString() + " may be a bot");
     }
 }
Esempio n. 11
0
        public override string Execute(string[] args, LLUUID fromAgentID)
        {
			LLUUID landmark = new LLUUID();
			if ( ! LLUUID.TryParse(args[0], out landmark) ) {
				return "Invalid LLUID";
			} else {
				Console.WriteLine("Teleporting to " + landmark.ToString());
			}
			if ( Client.Self.Teleport(landmark) ) {
				return "Teleport Succesful";
			} else {
				return "Teleport Failed";
			}
        }
Esempio n. 12
0
        public void LLUUIDs()
        {
            // Creation
            LLUUID a = new LLUUID();
            byte[] bytes = a.GetBytes();
            for (int i = 0; i < 16; i++)
                Assert.IsTrue(bytes[i] == 0x00);

            // Comparison
            a = new LLUUID(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
                0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0xFF, 0xFF }, 0);
            LLUUID b = new LLUUID(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
                0x0B, 0x0C, 0x0D, 0x0E, 0x0F }, 0);

            Assert.IsTrue(a == b, "LLUUID comparison operator failed, " + a.ToString() + " should equal " + 
                b.ToString());

            // From string
            a = new LLUUID(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
                0x0B, 0x0C, 0x0D, 0x0E, 0x0F }, 0);
            string zeroonetwo = "00010203-0405-0607-0809-0a0b0c0d0e0f";
            b = new LLUUID(zeroonetwo);

            Assert.IsTrue(a == b, "LLUUID hyphenated string constructor failed, should have " + a.ToString() + 
                " but we got " + b.ToString());

            // ToString()
            string one = a.ToString();
            string two = b.ToString();
            Assert.IsTrue(a == b);
            one = a.ToString();
            two = b.ToString();
            Assert.IsTrue(a == b);
            Assert.IsTrue(a == zeroonetwo);

            // TODO: CRC test
        }
Esempio n. 13
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            StringBuilder output = new StringBuilder("GridRegion: ");

            output.Append(Name); output.Append(Helpers.NewLine);
            output.Append("RegionHandle: " + RegionHandle); output.Append(Helpers.NewLine);
            output.Append(String.Format("X: {0} Y: {1}", X, Y)); output.Append(Helpers.NewLine);
            output.Append("MapImageID: " + MapImageID.ToString()); output.Append(Helpers.NewLine);
            output.Append("Access: " + Access); output.Append(Helpers.NewLine);
            output.Append("RegionFlags: " + RegionFlags); output.Append(Helpers.NewLine);
            output.Append("WaterHeight: " + WaterHeight); output.Append(Helpers.NewLine);
            output.Append("Agents: " + Agents);

            return(output.ToString());
        }
Esempio n. 14
0
        /// <summary>
        /// Offer friendship to an avatar.
        /// </summary>
        /// <param name="agentID">System ID of the avatar you are offering friendship to</param>
        public void OfferFriendship(LLUUID agentID)
        {
            // HACK: folder id stored as "message"
            LLUUID callingCardFolder = Client.Inventory.FindFolderForType(AssetType.CallingCard);

            Client.Self.InstantMessage(Client.Self.Name,
                                       agentID,
                                       callingCardFolder.ToString(),
                                       LLUUID.Random(),
                                       InstantMessageDialog.FriendshipOffered,
                                       InstantMessageOnline.Online,
                                       Client.Self.SimPosition,
                                       Client.Network.CurrentSim.ID,
                                       new byte[0]);
        }
Esempio n. 15
0
        /// <summary>
        /// Start a request for Avatar Picks
        /// </summary>
        /// <param name="avatarid">UUID of the avatar</param>
        public void RequestAvatarPicks(LLUUID avatarid)
        {
            GenericMessagePacket gmp = new GenericMessagePacket();

            gmp.AgentData.AgentID       = Client.Self.AgentID;
            gmp.AgentData.SessionID     = Client.Self.SessionID;
            gmp.AgentData.TransactionID = LLUUID.Zero;

            gmp.MethodData.Method      = Helpers.StringToField("avatarpicksrequest");
            gmp.MethodData.Invoice     = LLUUID.Zero;
            gmp.ParamList              = new GenericMessagePacket.ParamListBlock[1];
            gmp.ParamList[0]           = new GenericMessagePacket.ParamListBlock();
            gmp.ParamList[0].Parameter = Helpers.StringToField(avatarid.ToString());

            Client.Network.SendPacket(gmp);
        }
        public override string Execute(string[] args, LLUUID fromAgentID)
        {
            if (args.Length != 1)
                return Description;

            LLUUID targetID;
            ReceivedProperties = false;
            ReceivedInterests = false;
            ReceivedGroups = false;

            try
            {
                targetID = new LLUUID(args[0]);
            }
            catch (Exception)
            {
                return Description;
            }

            // Request all of the packets that make up an avatar profile
            Client.Avatars.RequestAvatarProperties(targetID);

            // Wait for all the packets to arrive
            ReceivedProfileEvent.Reset();
            ReceivedProfileEvent.WaitOne(5000, false);

            // Check if everything showed up
            if (!ReceivedInterests || !ReceivedProperties || !ReceivedGroups)
                return "Failed to retrieve a complete profile for that UUID";

            // Synchronize our profile
            Client.Self.UpdateInterests(Interests);
            Client.Self.UpdateProfile(Properties);

            // TODO: Leave all the groups we're currently a member of? This could
            // break TestClient connectivity that might be relying on group authentication

            // Attempt to join all the groups
            foreach (LLUUID groupID in Groups)
            {
                Client.Groups.RequestJoinGroup(groupID);
            }

            return "Synchronized our profile to the profile of " + targetID.ToString();
        }
Esempio n. 17
0
        public override void Encode()
        {
            const string NL = "\n";

            StringBuilder data = new StringBuilder("LLWearable version 22\n");

            data.Append(Name); data.Append(NL); data.Append(NL);
            data.Append("\tpermissions 0\n\t{\n");
            data.Append("\t\tbase_mask\t"); data.Append(Helpers.UIntToHexString((uint)Permissions.BaseMask)); data.Append(NL);
            data.Append("\t\towner_mask\t"); data.Append(Helpers.UIntToHexString((uint)Permissions.OwnerMask)); data.Append(NL);
            data.Append("\t\tgroup_mask\t"); data.Append(Helpers.UIntToHexString((uint)Permissions.GroupMask)); data.Append(NL);
            data.Append("\t\teveryone_mask\t"); data.Append(Helpers.UIntToHexString((uint)Permissions.EveryoneMask)); data.Append(NL);
            data.Append("\t\tnext_owner_mask\t"); data.Append(Helpers.UIntToHexString((uint)Permissions.NextOwnerMask)); data.Append(NL);
            data.Append("\t\tcreator_id\t"); data.Append(Creator.ToString()); data.Append(NL);
            data.Append("\t\towner_id\t"); data.Append(Owner.ToString()); data.Append(NL);
            data.Append("\t\tlast_owner_id\t"); data.Append(LastOwner.ToString()); data.Append(NL);
            data.Append("\t\tgroup_id\t"); data.Append(Group.ToString()); data.Append(NL);
            if (GroupOwned)
            {
                data.Append("\t\tgroup_owned\t1\n");
            }
            data.Append("\t}\n");
            data.Append("\tsale_info\t0\n");
            data.Append("\t{\n");
            data.Append("\t\tsale_type\t"); data.Append(InventoryManager.SaleTypeToString(ForSale)); data.Append(NL);
            data.Append("\t\tsale_price\t"); data.Append(SalePrice); data.Append(NL);
            data.Append("\t}\n");
            data.Append("type "); data.Append((int)WearableType); data.Append(NL);

            data.Append("parameters "); data.Append(Params.Count); data.Append(NL);
            foreach (KeyValuePair <int, float> param in Params)
            {
                data.Append(param.Key); data.Append(" "); data.Append(Helpers.FloatToTerseString(param.Value)); data.Append(NL);
            }

            data.Append("textures "); data.Append(Textures.Count); data.Append(NL);
            foreach (KeyValuePair <AppearanceManager.TextureIndex, LLUUID> texture in Textures)
            {
                data.Append(texture.Key); data.Append(" "); data.Append(texture.Value.ToString()); data.Append(NL);
            }

            AssetData = Helpers.StringToField(data.ToString());
        }
        public void LLUUIDs()
        {
            // Comparison
            LLUUID a = new LLUUID(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
                0x0B, 0x0C, 0x0D, 0x0E, 0x0F }, 0);
            LLUUID b = new LLUUID(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
                0x0B, 0x0C, 0x0D, 0x0E, 0x0F }, 0);

            Assert.IsTrue(a == b, "LLUUID comparison operator failed, " + a.ToString() + " should equal " +
                b.ToString());

            // From string
            a = new LLUUID(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
                0x0B, 0x0C, 0x0D, 0x0E, 0x0F }, 0);
            b = new LLUUID("00010203-0405-0607-0809-0a0b0c0d0e0f");

            Assert.IsTrue(a == b, "LLUUID hyphenated string constructor failed, should have " + a.ToString() +
                " but we got " + b.ToString());

            // TODO: CRC test
        }
Esempio n. 19
0
        void Groups_OnGroupJoined(LLUUID groupID, bool success)
        {
            Console.WriteLine(Client.ToString() + (success ? " joined " : " failed to join ") + groupID.ToString());

            /* A.Biondi 
             * This code is not necessary because it is yet present in the 
             * GroupCommand.cs as well. So the new group will be activated by 
             * the mentioned command. If the GroupCommand.cs would change, 
             * just uncomment the following two lines.
                
            if (success)
            {
                Console.WriteLine(Client.ToString() + " setting " + groupID.ToString() + " as the active group");
                Client.Groups.ActivateGroup(groupID);
            }
                
            */

            joinedGroup = success;
            GetGroupsSearchEvent.Set();
        }
Esempio n. 20
0
        static void Main(string[] args)
        {
            if (args.Length < 4)
            {
                Console.WriteLine("Usage: Key2Name [loginfirstname] [loginlastname] [password] [key]");
                return;
            }

            SecondLife client = new SecondLife();
            client.Avatars.OnAvatarNames += new AvatarManager.AvatarNamesCallback(Avatars_OnAvatarNames);

            Console.WriteLine("Attempting to connect and login to Second Life.");

            // Login to Second Life
            if (!client.Network.Login(args[0], args[1], args[2], "key2name", "*****@*****.**"))
            {
                // Login failed
                Console.WriteLine("Error logging in: " + client.Network.LoginMessage);
                return;
            }

            LLUUID lookup = new LLUUID();
            LLUUID.TryParse(args[3], out lookup);

            Console.WriteLine("Looking up name for " + lookup.ToString());

            client.Avatars.RequestAvatarName(lookup);

            if (!NameEvent.WaitOne(15 * 1000, false))
                Console.WriteLine("Name lookup timed out.");

            Console.WriteLine("Press enter to logout.");
            Console.ReadLine();

            client.Network.Logout();
        }
Esempio n. 21
0
        bool clone(LLUUID target)
        {
            if (appearances.ContainsKey(target))
            {
                #region AvatarAppearance to AgentSetAppearance

                AvatarAppearancePacket appearance = appearances[target];

                AgentSetAppearancePacket set = new AgentSetAppearancePacket();
                set.AgentData.AgentID = Self.AgentID;
                set.AgentData.SessionID = Self.SessionID;
                set.AgentData.SerialNum = SerialNum++;
                set.AgentData.Size = new LLVector3(2f, 2f, 2f); // HACK

                set.WearableData = new AgentSetAppearancePacket.WearableDataBlock[0];
                set.VisualParam = new AgentSetAppearancePacket.VisualParamBlock[appearance.VisualParam.Length];

                for (int i = 0; i < appearance.VisualParam.Length; i++)
                {
                    set.VisualParam[i] = new AgentSetAppearancePacket.VisualParamBlock();
                    set.VisualParam[i].ParamValue = appearance.VisualParam[i].ParamValue;
                }

                set.ObjectData.TextureEntry = appearance.ObjectData.TextureEntry;

                #endregion AvatarAppearance to AgentSetAppearance

                // Detach everything we are currently wearing
                Appearance.AddAttachments(new List<InventoryBase>(), true);

                // Send the new appearance packet
                Network.SendPacket(set);

                #if DEBUG
                Console.Out.WriteLine("Cloned {0}", target.ToString());
                #endif

                return true;
            }
            else
            {
                #if DEBUG
                Console.Out.WriteLine("Don't know the appearance of avatar {0}", target.ToString());
                #endif
                return false;
            }
        
        }
Esempio n. 22
0
 /// <summary>Unban an avatar from an estate</summary>
 /// <param name="userID">Key of Agent to remove</param>
 public void UnbanUser(LLUUID userID)
 {
     List<string> listParams = new List<string>();
     uint flag = (uint)EstateAccessDelta.UnbanUser;
     listParams.Add(Client.Self.AgentID.ToString());
     listParams.Add(flag.ToString());
     listParams.Add(userID.ToString());
     EstateOwnerMessage("estateaccessdelta", listParams);
 }
Esempio n. 23
0
 /// <summary>
 /// Send an avatar back to their home location
 /// </summary>
 /// <param name="pest">Key of avatar to send home</param>
 public void TeleportHomeUser(LLUUID pest)
 {
     List<string> listParams = new List<string>();
     listParams.Add(Client.Self.AgentID.ToString());
     listParams.Add(pest.ToString());
     EstateOwnerMessage("teleporthomeuser", listParams);
 }
Esempio n. 24
0
        /// <summary>
        /// By using the bracket operator on this class, the program can get the 
        /// InventoryObject designated by the specified uuid. If the value for the corresponding
        /// UUID is null, the call is equivelant to a call to <code>RemoveNodeFor(this[uuid])</code>.
        /// If the value is non-null, it is equivelant to a call to <code>UpdateNodeFor(value)</code>,
        /// the uuid parameter is ignored.
        /// </summary>
        /// <param name="uuid">The UUID of the InventoryObject to get or set, ignored if set to non-null value.</param>
        /// <returns>The InventoryObject corresponding to <code>uuid</code>.</returns>
        public InventoryBase this[LLUUID uuid]
        {
            get
            {
                InventoryNode node = Items[uuid];
                return node.Data;
            }
            set
            {
                if (value != null)
                {
                    // Log a warning if there is a UUID mismatch, this will cause problems
                    if (value.UUID != uuid)
                        Client.Log("Inventory[uuid]: uuid " + uuid.ToString() + " is not equal to value.UUID " +
                            value.UUID.ToString(), Helpers.LogLevel.Warning);

                    UpdateNodeFor(value);
                }
                else
                {
                    InventoryNode node;
                    if (Items.TryGetValue(uuid, out node))
                    {
                        RemoveNodeFor(node.Data);
                    }
                }
            }
        }
Esempio n. 25
0
        /// <summary>
        /// Kick an avatar from an estate
        /// </summary>
        /// <param name="userID">Key of Agent to remove</param>
		public void KickUser(LLUUID userID) 
		{
            EstateOwnerMessage("kickestate", userID.ToString());
		}
Esempio n. 26
0
 /// <summary>
 /// Kick an avatar from an estate
 /// </summary>
 /// <param name="userID">Key of Agent to remove</param>
 public void KickUser(LLUUID userID)
 {
     EstateOwnerMessage("kickestate", userID.ToString());
 }
        private void Self_OnInstantMessage(LLUUID fromAgentID, string fromAgentName, LLUUID toAgentID, uint parentEstateID, 
            LLUUID regionID, LLVector3 position, byte dialog, bool groupIM, LLUUID imSessionID, DateTime timestamp,
            string message, byte offline, byte[] binaryBucket)
        {
            if (Master.Length > 0)
            {
                if (fromAgentName.ToLower().Trim() != Master.ToLower().Trim())
                {
                    // Received an IM from someone that is not the bot's master, ignore
                    Console.WriteLine("<IM>" + fromAgentName + " (not master): " + message + "@"  + regionID.ToString() + ":" + position.ToString() );
                    return;
                }
            }
            else
            {
                if (GroupMembers != null && !GroupMembers.ContainsKey(fromAgentID))
                {
                    // Received an IM from someone outside the bot's group, ignore
                    Console.WriteLine("<IM>" + fromAgentName + " (not in group): " + message + "@" + regionID.ToString() + ":" + position.ToString());
                    return;
                }
            }

            Console.WriteLine("<IM>" + fromAgentName + ": " + message);

            if (Self.ID == toAgentID)
            {
                if (dialog == 22)
                {
                    Console.WriteLine("Accepting teleport lure");
                    Self.TeleportLureRespond(fromAgentID, true);
                }
                else
                {
                    DoCommand(message, fromAgentID, imSessionID);
                }
            }
            else
            {
                // This shouldn't happen
                Console.WriteLine("A bot that we aren't tracking received an IM?");
            }
        }
        void Groups_OnGroupJoined(LLUUID groupID, bool success)
        {
            Console.WriteLine(Client.ToString() + (success ? " joined " : " failed to join ") +
                groupID.ToString());

            if (success)
            {
                Console.WriteLine(Client.ToString() + " setting " + groupID.ToString() +
                    " as the active group");
                Client.Groups.ActivateGroup(groupID);
            }
        }
Esempio n. 29
0
        private void Self_OnInstantMessage(LLUUID fromAgentID, string fromAgentName, LLUUID toAgentID, 
            uint parentEstateID, LLUUID regionID, LLVector3 position, MainAvatar.InstantMessageDialog dialog, 
            bool groupIM, LLUUID imSessionID, DateTime timestamp, string message, 
            MainAvatar.InstantMessageOnline offline, byte[] binaryBucket)
        {
            if (MasterKey != LLUUID.Zero)
            {
                if (fromAgentID != MasterKey)
                {
                    // Received an IM from someone that is not the bot's master, ignore
                    Console.WriteLine("<IM>" + fromAgentName + " (not master): " + message + "@"  + regionID.ToString() + ":" + position.ToString() );
                    return;
                }
            }
            else
            {
                if (GroupMembers != null && !GroupMembers.ContainsKey(fromAgentID))
                {
                    // Received an IM from someone outside the bot's group, ignore
                    Console.WriteLine("<IM>" + fromAgentName + " (not in group): " + message + "@" + regionID.ToString() + ":" + position.ToString());
                    return;
                }
            }

            Console.WriteLine("<IM>" + fromAgentName + ": " + message);

            if (dialog == MainAvatar.InstantMessageDialog.RequestTeleport)
            {
                Console.WriteLine("Accepting teleport lure.");
                Self.TeleportLureRespond(fromAgentID, true);
            }
            else
            {
                if (dialog == MainAvatar.InstantMessageDialog.InventoryOffered)
                {
                    Console.WriteLine("Accepting inventory offer.");

                    Self.InstantMessage(Self.FirstName + " " + Self.LastName, fromAgentID, String.Empty,
                        imSessionID, MainAvatar.InstantMessageDialog.InventoryAccepted,
                        MainAvatar.InstantMessageOnline.Offline, Self.Position, LLUUID.Zero,
                        Self.InventoryRootFolderUUID.GetBytes());
                }
                else
                {
                    DoCommand(message, fromAgentID, imSessionID);
                }
            }
        }
        public override string Execute(string[] args, LLUUID fromAgentID)
        {
            if (args.Length != 2)
                return "Usage: export uuid outputfile.xml";

            LLUUID id;
            uint localid = 0;
            int count = 0;
            string file = args[1];

            try
            {
                id = new LLUUID(args[0]);
            }
            catch (Exception)
            {
                return "Usage: export uuid outputfile.xml";
            }

            lock (TestClient.SimPrims)
            {
                if (TestClient.SimPrims.ContainsKey(Client.Network.CurrentSim))
                {
                    foreach (PrimObject prim in TestClient.SimPrims[Client.Network.CurrentSim].Values)
                    {
                        if (prim.ID == id)
                        {
                            if (prim.ParentID != 0)
                            {
                                localid = prim.ParentID;
                            }
                            else
                            {
                                localid = prim.LocalID;
                            }

                            break;
                        }
                    }
                }
            }

            if (localid != 0)
            {
                // Check for export permission first
                Client.Objects.RequestObjectPropertiesFamily(Client.Network.CurrentSim, id);
                GotPermissionsEvent.WaitOne(5000, false);

                if (!GotPermissions)
                {
                    return "Couldn't fetch permissions for the requested object, try again";
                }
                else
                {
                    GotPermissions = false;

                    if (Properties == null)
                    {
                        return "Null object properties returned, may be a bug. Try again";
                    }

                    if (Properties.OwnerID != Client.Network.AgentID)
                    {
                        // We need a MasterID field, those exports should be allowed as well
                        return "That object is owned by " + Properties.OwnerID + ", we don't have permission " +
                            "to export it";
                    }
                }

                try
                {
                    XmlWriterSettings settings = new XmlWriterSettings();
                    settings.Indent = true;
                    XmlWriter writer = XmlWriter.Create(file, settings);

                    try
                    {
                        List<PrimObject> prims = new List<PrimObject>();

                        lock (TestClient.SimPrims)
                        {
                            if (TestClient.SimPrims.ContainsKey(Client.Network.CurrentSim))
                            {
                                foreach (PrimObject prim in TestClient.SimPrims[Client.Network.CurrentSim].Values)
                                {
                                    if (prim.LocalID == localid || prim.ParentID == localid)
                                    {
                                        prims.Add(prim);
                                        count++;
                                    }
                                }
                            }
                        }
                        //Serialize it!
                        Helpers.PrimListToXml(prims, writer);
                    }
                    finally
                    {
                        writer.Close();
                    }
                }
                catch (Exception e)
                {
                    string ret = "Failed to write to " + file + ":" + e.ToString();
                    if (ret.Length > 1000)
                    {
                        ret = ret.Remove(1000);
                    }
                    return ret;
                }

                return "Exported " + count + " prims to " + file;
            }
            else
            {
                return "Couldn't find UUID " + id.ToString() + " in the " +
                    TestClient.SimPrims[Client.Network.CurrentSim].Count +
                    "objects currently indexed in the current simulator";
            }
        }
Esempio n. 31
0
        /// <summary>
        /// Start a request for details of a specific profile pick
        /// </summary>
        /// <param name="avatarid">UUID of the avatar</param>
        /// <param name="pickid">UUID of the profile pick</param>
        public void RequestPickInfo(LLUUID avatarid, LLUUID pickid)
        {
            GenericMessagePacket gmp = new GenericMessagePacket();

            gmp.AgentData.AgentID = Client.Self.AgentID;
            gmp.AgentData.SessionID = Client.Self.SessionID;
            gmp.AgentData.TransactionID = LLUUID.Zero;

            gmp.MethodData.Method = Helpers.StringToField("pickinforequest");
            gmp.MethodData.Invoice = LLUUID.Zero;
            gmp.ParamList = new GenericMessagePacket.ParamListBlock[2];
            gmp.ParamList[0] = new GenericMessagePacket.ParamListBlock();
            gmp.ParamList[0].Parameter = Helpers.StringToField(avatarid.ToString());
            gmp.ParamList[1] = new GenericMessagePacket.ParamListBlock();
            gmp.ParamList[1].Parameter = Helpers.StringToField(pickid.ToString());

            Client.Network.SendPacket(gmp);
        }
Esempio n. 32
0
        public void OnFileRequested(HttpRequest request, IDirectory directory)
        {
            //request.Response.SetHeader("Content-Type", "text/plain; charset=utf-8");
            request.Response.ResponseContent = new MemoryStream();
            StreamWriter textwriter = new StreamWriter(request.Response.ResponseContent);
            SecondLife client;
            AvatarTracker avatars;
            Events events;
            StreamReader reader = new StreamReader(request.PostData);
            string qstring = reader.ReadToEnd();
            reader.Dispose();
            Dictionary<string,string> POST = AjaxLife.PostDecode(qstring);
            // Pull out the session.
            if (!POST.ContainsKey("sid"))
            {
                textwriter.WriteLine("Need an SID.");
                textwriter.Flush();
                return;
            }
            Guid guid = new Guid(POST["sid"]);
            User user = new User();
            lock (this.users)
            {
                if (!this.users.ContainsKey(guid))
                {
                    textwriter.WriteLine("Error: invalid SID");
                    textwriter.Flush();
                    return;
                }
                user = this.users[guid];
                client = user.Client;
                avatars = user.Avatars;
                events = user.Events;
                user.LastRequest = DateTime.Now;
            }
            // Get the message type.
            string messagetype = POST["MessageType"];

            // Check that the message is signed if it should be.
            if (Array.IndexOf(REQUIRED_SIGNATURES, messagetype) > -1)
            {
                if (!VerifySignature(user, qstring))
                {
                    textwriter.WriteLine("Error: Received hash and expected hash do not match.");
                    textwriter.Flush();
                    return;
                }
            }

            // Right. This file is fun. It takes information in POST paramaters and sends them to
            // the server in the appropriate format. Some will return data immediately, some will return
            // keys to data that will arrive in the message queue, some return nothing but you get
            // something in the message queue later, and some return nother ever.
            //
            // The joys of dealing with multiple bizarre message types.

            switch (messagetype)
            {
                case "SpatialChat":
                    client.Self.Chat(POST["Message"], int.Parse(POST["Channel"]), (ChatType)((byte)int.Parse(POST["Type"])));
                    break;
                case "SimpleInstantMessage":
                    if (POST.ContainsKey("IMSessionID"))
                    {
                        client.Self.InstantMessage(new LLUUID(POST["Target"]), POST["Message"], new LLUUID(POST["IMSessionID"]));
                    }
                    else
                    {
                        client.Self.InstantMessage(new LLUUID(POST["Target"]), POST["Message"]);
                    }
                    break;
                case "GenericInstantMessage":
                    client.Self.InstantMessage(
                        client.Self.FirstName + " " + client.Self.LastName,
                        new LLUUID(POST["Target"]),
                        POST["Message"],
                        new LLUUID(POST["IMSessionID"]),
                        (InstantMessageDialog)((byte)int.Parse(POST["Dialog"])),
                        (InstantMessageOnline)int.Parse(POST["Online"]),
                        client.Self.SimPosition,
                        client.Network.CurrentSim.ID,
                        new byte[0]);
                    break;
                case "NameLookup":
                    client.Avatars.RequestAvatarName(new LLUUID(POST["ID"]));
                    break;
                case "Teleport":
                    {
                        Hashtable hash = new Hashtable();
                        bool status;
                        if (POST.ContainsKey("Landmark"))
                        {
                            status = client.Self.Teleport(new LLUUID(POST["Landmark"]));
                        }
                        else
                        {
                            status = client.Self.Teleport(POST["Sim"], new LLVector3(float.Parse(POST["X"]), float.Parse(POST["Y"]), float.Parse(POST["Z"])));
                        }
                        if (status)
                        {
                            hash.Add("Success", true);
                            hash.Add("Sim", client.Network.CurrentSim.Name);
                            hash.Add("Position", client.Self.SimPosition);
                        }
                        else
                        {
                            hash.Add("Success", false);
                            hash.Add("Reason", client.Self.TeleportMessage);
                        }
                        textwriter.WriteLine(MakeJson.FromHashtable(hash));
                    }
                    break;
                case "GoHome":
                    client.Self.GoHome();
                    break;
                case "GetPosition":
                    {
                        Hashtable hash = new Hashtable();
                        hash.Add("Sim", client.Network.CurrentSim.Name);
                        hash.Add("Position", client.Self.SimPosition);
                        textwriter.WriteLine(JavaScriptConvert.SerializeObject(hash));
                    }
                    break;
                case "RequestBalance":
                    client.Self.RequestBalance();
                    break;
                case "GetStats":
                    {
                        Hashtable hash = new Hashtable();
                        hash.Add("FPS", client.Network.CurrentSim.Stats.FPS);
                        hash.Add("TimeDilation", client.Network.CurrentSim.Stats.Dilation);
                        hash.Add("LSLIPS", client.Network.CurrentSim.Stats.LSLIPS);
                        hash.Add("Objects", client.Network.CurrentSim.Stats.Objects);
                        hash.Add("ActiveScripts", client.Network.CurrentSim.Stats.ActiveScripts);
                        hash.Add("Agents", client.Network.CurrentSim.Stats.Agents);
                        hash.Add("ChildAgents", client.Network.CurrentSim.Stats.ChildAgents);
                        hash.Add("AjaxLifeSessions", users.Count);
                        hash.Add("TextureCacheCount", AjaxLife.TextureCacheCount);
                        hash.Add("TextureCacheSize", AjaxLife.TextureCacheSize);
                        textwriter.WriteLine(MakeJson.FromHashtable(hash));
                    }
                    break;
                case "TeleportLureRespond":
                    client.Self.TeleportLureRespond(new LLUUID(POST["RequesterID"]), bool.Parse(POST["Accept"]));
                    break;
                case "GodlikeTeleportLureRespond":
                    {
                        LLUUID lurer = new LLUUID(POST["RequesterID"]);
                        LLUUID session = new LLUUID(POST["SessionID"]);
                        client.Self.InstantMessage(client.Self.Name, lurer, "", LLUUID.Random(), InstantMessageDialog.AcceptTeleport, InstantMessageOnline.Offline, client.Self.SimPosition, LLUUID.Zero, new byte[0]);
                        TeleportLureRequestPacket lure = new TeleportLureRequestPacket();
                        lure.Info.AgentID = client.Self.AgentID;
                        lure.Info.SessionID = client.Self.SessionID;
                        lure.Info.LureID = session;
                        lure.Info.TeleportFlags = (uint)AgentManager.TeleportFlags.ViaGodlikeLure;
                        client.Network.SendPacket(lure);
                    }
                    break;
                case "FindPeople":
                    {
                        Hashtable hash = new Hashtable();
                        hash.Add("QueryID", client.Directory.StartPeopleSearch(DirectoryManager.DirFindFlags.People, POST["Search"], int.Parse(POST["Start"])));
                        textwriter.WriteLine(MakeJson.FromHashtable(hash));
                    }
                    break;
                case "FindGroups":
                    {
                        Hashtable hash = new Hashtable();
                        hash.Add("QueryID", client.Directory.StartGroupSearch(DirectoryManager.DirFindFlags.Groups, POST["Search"], int.Parse(POST["Start"])));
                        textwriter.WriteLine(MakeJson.FromHashtable(hash));
                    }
                    break;
                case "GetAgentData":
                    client.Avatars.RequestAvatarProperties(new LLUUID(POST["AgentID"]));
                    break;
                case "StartAnimation":
                    client.Self.AnimationStart(new LLUUID(POST["Animation"]), false);
                    break;
                case "StopAnimation":
                    client.Self.AnimationStop(new LLUUID(POST["Animation"]), true);
                    break;
                case "SendAppearance":
                    client.Appearance.SetPreviousAppearance(false);
                    break;
                case "GetMapItems":
                    {
                        MapItemRequestPacket req = new MapItemRequestPacket();
                        req.AgentData.AgentID = client.Self.AgentID;
                        req.AgentData.SessionID = client.Self.SessionID;
                        GridRegion region;
                        client.Grid.GetGridRegion(POST["Region"], GridLayerType.Objects, out region);
                        req.RequestData.RegionHandle = region.RegionHandle;
                        req.RequestData.ItemType = uint.Parse(POST["ItemType"]);
                        client.Network.SendPacket((Packet)req);
                    }
                    break;
                case "GetMapBlocks":
                    {
                        MapBlockRequestPacket req = new MapBlockRequestPacket();
                        req.AgentData.AgentID = client.Self.AgentID;
                        req.AgentData.SessionID = client.Self.SessionID;
                        req.PositionData.MinX = 0;
                        req.PositionData.MinY = 0;
                        req.PositionData.MaxX = ushort.MaxValue;
                        req.PositionData.MaxY = ushort.MaxValue;
                        client.Network.SendPacket((Packet)req);
                    }
                    break;
                case "GetMapBlock":
                    {
                        ushort x = ushort.Parse(POST["X"]);
                        ushort y = ushort.Parse(POST["Y"]);
                        MapBlockRequestPacket req = new MapBlockRequestPacket();
                        req.AgentData.AgentID = client.Self.AgentID;
                        req.AgentData.SessionID = client.Self.SessionID;
                        req.PositionData.MinX = x;
                        req.PositionData.MinY = y;
                        req.PositionData.MaxX = x;
                        req.PositionData.MaxY = y;
                        client.Network.SendPacket((Packet)req);
                    }
                    break;
                case "GetOfflineMessages":
                    {
                        RetrieveInstantMessagesPacket req = new RetrieveInstantMessagesPacket();
                        req.AgentData.AgentID = client.Self.AgentID;
                        req.AgentData.SessionID = client.Self.SessionID;
                        client.Network.SendPacket((Packet)req);
                    }
                    break;
                case "GetFriendList":
                    {
                        InternalDictionary<LLUUID, FriendInfo> friends = client.Friends.FriendList;
                        List<Hashtable> friendlist = new List<Hashtable>();
                        friends.ForEach(delegate(FriendInfo friend)
                        {
                            Hashtable friendhash = new Hashtable();
                            friendhash.Add("ID", friend.UUID.ToString());
                            friendhash.Add("Name", friend.Name);
                            friendhash.Add("Online", friend.IsOnline);
                            friendhash.Add("MyRights", friend.MyFriendRights);
                            friendhash.Add("TheirRights", friend.TheirFriendRights);
                            friendlist.Add(friendhash);
                        });
                        textwriter.Write(MakeJson.FromObject(friendlist));
                    }
                    break;
                case "ChangeRights":
                    {
                        LLUUID uuid = new LLUUID(POST["Friend"]);
                        client.Friends.GrantRights(uuid, (FriendRights)int.Parse(POST["Rights"]));
                    }
                    break;
                case "RequestLocation":
                    client.Friends.MapFriend(new LLUUID(POST["Friend"]));
                    break;
                case "RequestTexture":
                    {
                        // This one's confusing, so it gets some comments.
                        // First, we get the image's UUID.
                        LLUUID image = new LLUUID(POST["ID"]);
                        // We prepare a query to ask if S3 has it. HEAD only to avoid wasting
                        // GET requests and bandwidth.
                        bool exists = false;
                        // If we already know we have it, note this.
                        if (AjaxLife.CachedTextures.Contains(image))
                        {
                            exists = true;
                        }
                        else
                        {
                            // If we're using S3, check the S3 bucket
                            if (AjaxLife.USE_S3)
                            {
                                // Otherwise, make that HEAD request and find out.
                                try
                                {
                                    IThreeSharp query = new ThreeSharpQuery(AjaxLife.S3Config);
                                    Affirma.ThreeSharp.Model.ObjectGetRequest s3request = new Affirma.ThreeSharp.Model.ObjectGetRequest(AjaxLife.TEXTURE_BUCKET, image.ToString() + ".png");
                                    s3request.Method = "HEAD";
                                    Affirma.ThreeSharp.Model.ObjectGetResponse s3response = query.ObjectGet(s3request);
                                    if (s3response.StatusCode == System.Net.HttpStatusCode.OK)
                                    {
                                        exists = true;
                                    }
                                    s3response.DataStream.Close();
                                }
                                catch { }
                            }
                            // If we aren't using S3, just check the texture cache.
                            else
                            {
                                exists = File.Exists(AjaxLife.TEXTURE_CACHE + image.ToString() + ".png");
                            }
                        }
                        // If it exists, reply with Ready = true and the URL to find it at.
                        if (exists)
                        {
                            textwriter.Write("{Ready: true, URL: \"" + AjaxLife.TEXTURE_ROOT + image + ".png\"}");
                        }
                        // If it doesn't, request the image from SL and note its lack of readiness.
                        // Notification will arrive later in the message queue.
                        else
                        {

                            client.Assets.RequestImage(image, ImageType.Normal, 125000.0f, 0);
                            textwriter.Write("{Ready: false}");
                        }
                    }
                    break;
                case "AcceptFriendship":
                    client.Friends.AcceptFriendship(client.Self.AgentID, POST["IMSessionID"]);
                    break;
                case "DeclineFriendship":
                    client.Friends.DeclineFriendship(client.Self.AgentID, POST["IMSessionID"]);
                    break;
                case "OfferFriendship":
                    client.Friends.OfferFriendship(new LLUUID(POST["Target"]));
                    break;
                case "TerminateFriendship":
                    client.Friends.TerminateFriendship(new LLUUID(POST["Target"]));
                    break;
                case "SendAgentMoney":
                    client.Self.GiveAvatarMoney(new LLUUID(POST["Target"]), int.Parse(POST["Amount"]));
                    break;
                case "RequestAvatarList":
                    {
                        List<Hashtable> list = new List<Hashtable>();
                        foreach (KeyValuePair<uint, Avatar> pair in avatars.Avatars)
                        {
                            Avatar avatar = pair.Value;
                            Hashtable hash = new Hashtable();
                            hash.Add("Name", avatar.Name);
                            hash.Add("ID", avatar.ID);
                            hash.Add("LocalID", avatar.LocalID);
                            hash.Add("Position", avatar.Position);
                            //hash.Add("Rotation", avatar.Rotation);
                            hash.Add("Scale", avatar.Scale);
                            hash.Add("GroupName", avatar.GroupName);
                            list.Add(hash);
                        }
                        textwriter.Write(MakeJson.FromObject(list));
                    }
                    break;
                case "LoadInventoryFolder":
                    client.Inventory.RequestFolderContents(new LLUUID(POST["UUID"]), client.Self.AgentID, true, true, InventorySortOrder.ByDate | InventorySortOrder.SystemFoldersToTop);
                    break;
                case "RequestAsset":
                    {
                        try
                        {
                            LLUUID transferid = client.Assets.RequestInventoryAsset(new LLUUID(POST["AssetID"]), new LLUUID(POST["InventoryID"]),
                                LLUUID.Zero, new LLUUID(POST["OwnerID"]), (AssetType)int.Parse(POST["AssetType"]), false);
                            textwriter.Write("{TransferID: \"" + transferid + "\"}");
                        }
                        catch // Try catching the error that sometimes gets thrown... but sometimes doesn't.
                        {

                        }
                    }
                    break;
                case "SendTeleportLure":
                    client.Self.SendTeleportLure(new LLUUID(POST["Target"]), POST["Message"]);
                    break;
                case "ScriptPermissionResponse":
                    client.Self.ScriptQuestionReply(client.Network.CurrentSim, new LLUUID(POST["ItemID"]), new LLUUID(POST["TaskID"]), (ScriptPermission)int.Parse(POST["Permissions"]));
                    break;
                case "ScriptDialogReply":
                    {
                        ScriptDialogReplyPacket packet = new ScriptDialogReplyPacket();
                        packet.AgentData.AgentID = client.Self.AgentID;
                        packet.AgentData.SessionID = client.Self.SessionID;
                        packet.Data.ButtonIndex = int.Parse(POST["ButtonIndex"]);
                        packet.Data.ButtonLabel = Helpers.StringToField(POST["ButtonLabel"]);
                        packet.Data.ChatChannel = int.Parse(POST["ChatChannel"]);
                        packet.Data.ObjectID = new LLUUID(POST["ObjectID"]);
                        client.Network.SendPacket((Packet)packet);
                    }
                    break;
                case "SaveNotecard":
                    client.Inventory.RequestUploadNotecardAsset(Helpers.StringToField(POST["AssetData"]), new LLUUID(POST["ItemID"]), new InventoryManager.NotecardUploadedAssetCallback(events.Inventory_OnNoteUploaded));
                    break;
                case "CreateInventory":
                    client.Inventory.RequestCreateItem(new LLUUID(POST["Folder"]), POST["Name"], POST["Description"], (AssetType)int.Parse(POST["AssetType"]), LLUUID.Random(), (InventoryType)int.Parse(POST["InventoryType"]), PermissionMask.All, new InventoryManager.ItemCreatedCallback(events.Inventory_OnItemCreated));
                    break;
                case "CreateFolder":
                    {
                        LLUUID folder = client.Inventory.CreateFolder(new LLUUID(POST["Parent"]), POST["Name"]);
                        textwriter.Write("{FolderID: \"" + folder + "\"}");
                    }
                    break;
                case "EmptyTrash":
                    client.Inventory.EmptyTrash();
                    break;
                case "MoveItem":
                    client.Inventory.MoveItem(new LLUUID(POST["Item"]), new LLUUID(POST["TargetFolder"]), POST["NewName"]);
                    break;
                case "MoveFolder":
                    client.Inventory.MoveFolder(new LLUUID(POST["Folder"]), new LLUUID(POST["NewParent"]));
                    break;
                case "MoveItems":
                case "MoveFolders":
                    {
                        Dictionary<LLUUID, LLUUID> dict = new Dictionary<LLUUID, LLUUID>();
                        string[] moves = POST["ToMove"].Split(',');
                        for (int i = 0; i < moves.Length; ++i)
                        {
                            string[] move = moves[i].Split(' ');
                            dict.Add(new LLUUID(move[0]), new LLUUID(move[1]));
                        }
                        if (messagetype == "MoveItems")
                        {
                            client.Inventory.MoveItems(dict);
                        }
                        else if (messagetype == "MoveFolders")
                        {
                            client.Inventory.MoveFolders(dict);
                        }
                    }
                    break;
                case "DeleteItem":
                    client.Inventory.RemoveItem(new LLUUID(POST["Item"]));
                    break;
                case "DeleteFolder":
                    client.Inventory.RemoveFolder(new LLUUID(POST["Folder"]));
                    break;
                case "DeleteMultiple":
                    {
                        string[] items = POST["Items"].Split(',');
                        List<LLUUID> itemlist = new List<LLUUID>();
                        for (int i = 0; i < items.Length; ++i)
                        {
                            itemlist.Add(new LLUUID(items[i]));
                        }
                        string[] folders = POST["Folders"].Split(',');
                        List<LLUUID> folderlist = new List<LLUUID>();
                        for (int i = 0; i < items.Length; ++i)
                        {
                            folderlist.Add(new LLUUID(folders[i]));
                        }
                        client.Inventory.Remove(itemlist, folderlist);
                    }
                    break;
                case "GiveInventory":
                    {
                        client.Inventory.GiveItem(new LLUUID(POST["ItemID"]), POST["ItemName"], (AssetType)int.Parse(POST["AssetType"]), new LLUUID(POST["Recipient"]), true);
                    }
                    break;
                case "UpdateItem":
                    {
                        InventoryItem item = client.Inventory.FetchItem(new LLUUID(POST["ItemID"]), new LLUUID(POST["OwnerID"]), 1000);
                        if (POST.ContainsKey("Name")) item.Name = POST["Name"];
                        if (POST.ContainsKey("Description")) item.Description = POST["Description"];
                        if (POST.ContainsKey("NextOwnerMask")) item.Permissions.NextOwnerMask = (PermissionMask)uint.Parse(POST["NextOwnerMask"]);
                        if (POST.ContainsKey("SalePrice")) item.SalePrice = int.Parse(POST["SalePrice"]);
                        if (POST.ContainsKey("SaleType")) item.SaleType = (SaleType)int.Parse(POST["SaleType"]); // This should be byte.Parse, but this upsets mono's compiler (CS1002)
                        client.Inventory.RequestUpdateItem(item);
                    }
                    break;
                case "UpdateFolder":
                    {
                        UpdateInventoryFolderPacket packet = new UpdateInventoryFolderPacket();
                        packet.AgentData.AgentID = client.Self.AgentID;
                        packet.AgentData.SessionID = client.Self.SessionID;
                        packet.FolderData = new UpdateInventoryFolderPacket.FolderDataBlock[1];
                        packet.FolderData[0] = new UpdateInventoryFolderPacket.FolderDataBlock();
                        packet.FolderData[0].FolderID = new LLUUID(POST["FolderID"]);
                        packet.FolderData[0].ParentID = new LLUUID(POST["ParentID"]);
                        packet.FolderData[0].Type = sbyte.Parse(POST["Type"]);
                        packet.FolderData[0].Name = Helpers.StringToField(POST["Name"]);
                        client.Network.SendPacket((Packet)packet);
                    }
                    break;
                case "FetchItem":
                    client.Inventory.FetchItem(new LLUUID(POST["Item"]), new LLUUID(POST["Owner"]), 5000);
                    break;
                case "ReRotate":
                    user.Rotation = -Math.PI;
                    break;
                case "StartGroupIM":
                    AjaxLife.Debug("SendMessage", "RequestJoinGroupChat(" + POST["Group"] + ")");
                    client.Self.RequestJoinGroupChat(new LLUUID(POST["Group"]));
                    break;
                case "GroupInstantMessage":
                    client.Self.InstantMessageGroup(new LLUUID(POST["Group"]), POST["Message"]);
                    break;
                case "RequestGroupProfile":
                    client.Groups.RequestGroupProfile(new LLUUID(POST["Group"]));
                    break;
                case "RequestGroupMembers":
                    client.Groups.RequestGroupMembers(new LLUUID(POST["Group"]));
                    break;
                case "RequestGroupName":
                    client.Groups.RequestGroupName(new LLUUID(POST["ID"]));
                    break;
                case "JoinGroup":
                    client.Groups.RequestJoinGroup(new LLUUID(POST["Group"]));
                    break;
                case "LeaveGroup":
                    client.Groups.LeaveGroup(new LLUUID(POST["Group"]));
                    break;
                case "RequestCurrentGroups":
                    client.Groups.RequestCurrentGroups();
                    break;
                case "GetParcelID":
                    textwriter.Write("{LocalID: "+client.Parcels.GetParcelLocalID(client.Network.CurrentSim, new LLVector3(float.Parse(POST["X"]), float.Parse(POST["Y"]), float.Parse(POST["Z"])))+"}");
                    break;
                case "RequestParcelProperties":
                    client.Parcels.PropertiesRequest(client.Network.CurrentSim, int.Parse(POST["LocalID"]), int.Parse(POST["SequenceID"]));
                    break;
            }
            textwriter.Flush();
        }