aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
diff options
context:
space:
mode:
authorTeravus Ovares2008-09-06 07:52:41 +0000
committerTeravus Ovares2008-09-06 07:52:41 +0000
commit7d89e122930be39e84a6d174548fa2d12ac0484a (patch)
treee5aa5752f988a9aba2a969f49e5e208985eda80c /OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
parent* minor: speculatively try a change to bamboo.build to see if this generates ... (diff)
downloadopensim-SC-7d89e122930be39e84a6d174548fa2d12ac0484a.zip
opensim-SC-7d89e122930be39e84a6d174548fa2d12ac0484a.tar.gz
opensim-SC-7d89e122930be39e84a6d174548fa2d12ac0484a.tar.bz2
opensim-SC-7d89e122930be39e84a6d174548fa2d12ac0484a.tar.xz
* This is the fabled LibOMV update with all of the libOMV types from JHurliman
* This is a HUGE OMG update and will definitely have unknown side effects.. so this is really only for the strong hearted at this point. Regular people should let the dust settle. * This has been tested to work with most basic functions. However.. make sure you back up 'everything' before using this. It's that big! * Essentially we're back at square 1 in the testing phase.. so lets identify things that broke.
Diffstat (limited to 'OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs')
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs98
1 files changed, 50 insertions, 48 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
index 82e9a13..d352655 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
@@ -31,12 +31,12 @@ using System.IO;
31using System.Threading; 31using System.Threading;
32using System.Xml; 32using System.Xml;
33using System.Drawing; 33using System.Drawing;
34using OpenJPEGNet;
35using OpenSim.Framework; 34using OpenSim.Framework;
36using OpenSim.Framework.Servers; 35using OpenSim.Framework.Servers;
37using OpenSim.Framework.Communications; 36using OpenSim.Framework.Communications;
38using OpenSim.Framework.Communications.Cache; 37using OpenSim.Framework.Communications.Cache;
39using libsecondlife; 38using OpenMetaverse;
39using OpenMetaverse.Imaging;
40using Nini.Config; 40using Nini.Config;
41 41
42namespace OpenSim.ApplicationPlugins.Rest.Inventory 42namespace OpenSim.ApplicationPlugins.Rest.Inventory
@@ -189,7 +189,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
189 189
190 // We can only get here if we are authorized 190 // We can only get here if we are authorized
191 // 191 //
192 // The requestor may have specified an LLUUID or 192 // The requestor may have specified an UUID or
193 // a conjoined FirstName LastName string. We'll 193 // a conjoined FirstName LastName string. We'll
194 // try both. If we fail with the first, UUID, 194 // try both. If we fail with the first, UUID,
195 // attempt, we try the other. As an example, the 195 // attempt, we try the other. As an example, the
@@ -202,6 +202,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
202 // required to designate a GET for an entire 202 // required to designate a GET for an entire
203 // inventory. 203 // inventory.
204 // 204 //
205
206
205 // Do we have at least a user agent name? 207 // Do we have at least a user agent name?
206 208
207 if (rdata.Parameters.Length < 1) 209 if (rdata.Parameters.Length < 1)
@@ -210,15 +212,15 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
210 rdata.Fail(Rest.HttpStatusCodeBadRequest, "no user identity specified"); 212 rdata.Fail(Rest.HttpStatusCodeBadRequest, "no user identity specified");
211 } 213 }
212 214
213 // The first parameter MUST be the agent identification, either an LLUUID 215 // The first parameter MUST be the agent identification, either an UUID
214 // or a space-separated First-name Last-Name specification. We check for 216 // or a space-separated First-name Last-Name specification. We check for
215 // an LLUUID first, if anyone names their character using a valid LLUUID 217 // an UUID first, if anyone names their character using a valid UUID
216 // that identifies another existing avatar will cause this a problem... 218 // that identifies another existing avatar will cause this a problem...
217 219
218 try 220 try
219 { 221 {
220 rdata.uuid = new LLUUID(rdata.Parameters[PARM_USERID]); 222 rdata.uuid = new UUID(rdata.Parameters[PARM_USERID]);
221 Rest.Log.DebugFormat("{0} LLUUID supplied", MsgId); 223 Rest.Log.DebugFormat("{0} UUID supplied", MsgId);
222 rdata.userProfile = Rest.UserServices.GetUserProfile(rdata.uuid); 224 rdata.userProfile = Rest.UserServices.GetUserProfile(rdata.uuid);
223 } 225 }
224 catch 226 catch
@@ -490,7 +492,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
490 // may have already set the parent ID explicitly, in which 492 // may have already set the parent ID explicitly, in which
491 // case we don't have to do it here. 493 // case we don't have to do it here.
492 494
493 if (folder.ParentID == LLUUID.Zero || folder.ParentID == context.ID) 495 if (folder.ParentID == UUID.Zero || folder.ParentID == context.ID)
494 { 496 {
495 if (newnode != String.Empty) 497 if (newnode != String.Empty)
496 { 498 {
@@ -550,7 +552,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
550 // If the parentID is zero, then this is going 552 // If the parentID is zero, then this is going
551 // directly into the root identified by the URI. 553 // directly into the root identified by the URI.
552 554
553 if (item.Folder == LLUUID.Zero) 555 if (item.Folder == UUID.Zero)
554 { 556 {
555 item.Folder = context.ID; 557 item.Folder = context.ID;
556 } 558 }
@@ -719,7 +721,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
719 { 721 {
720 if ((rfound = (folder.Name == PRIVATE_ROOT_NAME))) 722 if ((rfound = (folder.Name == PRIVATE_ROOT_NAME)))
721 { 723 {
722 if ((rfound = (folder.ParentID == LLUUID.Zero))) 724 if ((rfound = (folder.ParentID == UUID.Zero)))
723 break; 725 break;
724 } 726 }
725 } 727 }
@@ -746,7 +748,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
746 foreach (InventoryFolderBase folder in entity.Folders) 748 foreach (InventoryFolderBase folder in entity.Folders)
747 { 749 {
748 if (folder.ParentID == uri.ParentID || 750 if (folder.ParentID == uri.ParentID ||
749 folder.ParentID == LLUUID.Zero) 751 folder.ParentID == UUID.Zero)
750 { 752 {
751 folder.ParentID = uri.ParentID; 753 folder.ParentID = uri.ParentID;
752 xml = folder; 754 xml = folder;
@@ -778,9 +780,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
778 // All went well, so we generate a UUID is one is 780 // All went well, so we generate a UUID is one is
779 // needed. 781 // needed.
780 782
781 if (xml.ID == LLUUID.Zero) 783 if (xml.ID == UUID.Zero)
782 { 784 {
783 xml.ID = LLUUID.Random(); 785 xml.ID = UUID.Random();
784 } 786 }
785 787
786 uri.ParentID = TrashCan.ID; 788 uri.ParentID = TrashCan.ID;
@@ -834,9 +836,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
834 836
835 xml = entity.Items[0]; 837 xml = entity.Items[0];
836 838
837 if (xml.ID == LLUUID.Zero) 839 if (xml.ID == UUID.Zero)
838 { 840 {
839 xml.ID = LLUUID.Random(); 841 xml.ID = UUID.Random();
840 } 842 }
841 843
842 // If the folder reference has changed, then this item is 844 // If the folder reference has changed, then this item is
@@ -1336,7 +1338,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1336 { 1338 {
1337 TrashCan = new InventoryFolderBase(); 1339 TrashCan = new InventoryFolderBase();
1338 TrashCan.Name = "tmp"; 1340 TrashCan.Name = "tmp";
1339 TrashCan.ID = LLUUID.Random(); 1341 TrashCan.ID = UUID.Random();
1340 TrashCan.Version = 1; 1342 TrashCan.Version = 1;
1341 TrashCan.Type = (short) AssetType.TrashFolder; 1343 TrashCan.Type = (short) AssetType.TrashFolder;
1342 TrashCan.ParentID = f.ID; 1344 TrashCan.ParentID = f.ID;
@@ -1556,9 +1558,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1556 // Default values 1558 // Default values
1557 1559
1558 result.Name = String.Empty; 1560 result.Name = String.Empty;
1559 result.ID = LLUUID.Zero; 1561 result.ID = UUID.Zero;
1560 result.Owner = ic.UserID; 1562 result.Owner = ic.UserID;
1561 result.ParentID = LLUUID.Zero; // Context 1563 result.ParentID = UUID.Zero; // Context
1562 result.Type = (short) AssetType.Folder; 1564 result.Type = (short) AssetType.Folder;
1563 result.Version = 1; 1565 result.Version = 1;
1564 1566
@@ -1573,13 +1575,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1573 result.Name = ic.xml.Value; 1575 result.Name = ic.xml.Value;
1574 break; 1576 break;
1575 case "uuid" : 1577 case "uuid" :
1576 result.ID = new LLUUID(ic.xml.Value); 1578 result.ID = new UUID(ic.xml.Value);
1577 break; 1579 break;
1578 case "parent" : 1580 case "parent" :
1579 result.ParentID = new LLUUID(ic.xml.Value); 1581 result.ParentID = new UUID(ic.xml.Value);
1580 break; 1582 break;
1581 case "owner" : 1583 case "owner" :
1582 result.Owner = new LLUUID(ic.xml.Value); 1584 result.Owner = new UUID(ic.xml.Value);
1583 break; 1585 break;
1584 case "type" : 1586 case "type" :
1585 result.Type = Int16.Parse(ic.xml.Value); 1587 result.Type = Int16.Parse(ic.xml.Value);
@@ -1604,7 +1606,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1604 // is necessary where a new folder may have been 1606 // is necessary where a new folder may have been
1605 // introduced. 1607 // introduced.
1606 1608
1607 if (result.ParentID == LLUUID.Zero) 1609 if (result.ParentID == UUID.Zero)
1608 { 1610 {
1609 result.ParentID = ic.Parent(); 1611 result.ParentID = ic.Parent();
1610 } 1612 }
@@ -1632,9 +1634,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1632 // This is a new folder, so no existing UUID is available 1634 // This is a new folder, so no existing UUID is available
1633 // or appropriate 1635 // or appropriate
1634 1636
1635 if (result.ID == LLUUID.Zero) 1637 if (result.ID == UUID.Zero)
1636 { 1638 {
1637 result.ID = LLUUID.Random(); 1639 result.ID = UUID.Random();
1638 } 1640 }
1639 1641
1640 // Treat this as a new context. Any other information is 1642 // Treat this as a new context. Any other information is
@@ -1664,12 +1666,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1664 1666
1665 result.Name = String.Empty; 1667 result.Name = String.Empty;
1666 result.Description = String.Empty; 1668 result.Description = String.Empty;
1667 result.ID = LLUUID.Zero; 1669 result.ID = UUID.Zero;
1668 result.Folder = LLUUID.Zero; 1670 result.Folder = UUID.Zero;
1669 result.Owner = ic.UserID; 1671 result.Owner = ic.UserID;
1670 result.Creator = ic.UserID; 1672 result.Creator = ic.UserID;
1671 result.AssetID = LLUUID.Zero; 1673 result.AssetID = UUID.Zero;
1672 result.GroupID = LLUUID.Zero; 1674 result.GroupID = UUID.Zero;
1673 result.GroupOwned = false; 1675 result.GroupOwned = false;
1674 result.InvType = (int) InventoryType.Unknown; 1676 result.InvType = (int) InventoryType.Unknown;
1675 result.AssetType = (int) AssetType.Unknown; 1677 result.AssetType = (int) AssetType.Unknown;
@@ -1689,19 +1691,19 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1689 result.Description = ic.xml.Value; 1691 result.Description = ic.xml.Value;
1690 break; 1692 break;
1691 case "uuid" : 1693 case "uuid" :
1692 result.ID = new LLUUID(ic.xml.Value); 1694 result.ID = new UUID(ic.xml.Value);
1693 break; 1695 break;
1694 case "folder" : 1696 case "folder" :
1695 result.Folder = new LLUUID(ic.xml.Value); 1697 result.Folder = new UUID(ic.xml.Value);
1696 break; 1698 break;
1697 case "owner" : 1699 case "owner" :
1698 result.Owner = new LLUUID(ic.xml.Value); 1700 result.Owner = new UUID(ic.xml.Value);
1699 break; 1701 break;
1700 case "invtype" : 1702 case "invtype" :
1701 result.InvType = Int32.Parse(ic.xml.Value); 1703 result.InvType = Int32.Parse(ic.xml.Value);
1702 break; 1704 break;
1703 case "creator" : 1705 case "creator" :
1704 result.Creator = new LLUUID(ic.xml.Value); 1706 result.Creator = new UUID(ic.xml.Value);
1705 break; 1707 break;
1706 case "assettype" : 1708 case "assettype" :
1707 result.AssetType = Int32.Parse(ic.xml.Value); 1709 result.AssetType = Int32.Parse(ic.xml.Value);
@@ -1710,7 +1712,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1710 result.GroupOwned = Boolean.Parse(ic.xml.Value); 1712 result.GroupOwned = Boolean.Parse(ic.xml.Value);
1711 break; 1713 break;
1712 case "groupid" : 1714 case "groupid" :
1713 result.GroupID = new LLUUID(ic.xml.Value); 1715 result.GroupID = new UUID(ic.xml.Value);
1714 break; 1716 break;
1715 case "flags" : 1717 case "flags" :
1716 result.Flags = UInt32.Parse(ic.xml.Value); 1718 result.Flags = UInt32.Parse(ic.xml.Value);
@@ -1776,7 +1778,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1776 // This is not a persistent attribute 1778 // This is not a persistent attribute
1777 bool inline = true; 1779 bool inline = true;
1778 1780
1779 LLUUID uuid = LLUUID.Zero; 1781 UUID uuid = UUID.Zero;
1780 1782
1781 // Attribute is optional 1783 // Attribute is optional
1782 if (ic.xml.HasAttributes) 1784 if (ic.xml.HasAttributes)
@@ -1804,7 +1806,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1804 break; 1806 break;
1805 1807
1806 case "uuid" : 1808 case "uuid" :
1807 uuid = new LLUUID(ic.xml.Value); 1809 uuid = new UUID(ic.xml.Value);
1808 break; 1810 break;
1809 1811
1810 case "inline" : 1812 case "inline" :
@@ -1834,7 +1836,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1834 { 1836 {
1835 if (ic.Item != null) 1837 if (ic.Item != null)
1836 { 1838 {
1837 ic.Item.AssetID = new LLUUID(ic.xml.ReadElementContentAsString()); 1839 ic.Item.AssetID = new UUID(ic.xml.ReadElementContentAsString());
1838 Rest.Log.DebugFormat("{0} Asset ID supplied: {1}", MsgId, ic.Item.AssetID); 1840 Rest.Log.DebugFormat("{0} Asset ID supplied: {1}", MsgId, ic.Item.AssetID);
1839 } 1841 }
1840 else 1842 else
@@ -1855,9 +1857,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1855 // Generate a UUID of none were given, and generally none should 1857 // Generate a UUID of none were given, and generally none should
1856 // be. Ever. 1858 // be. Ever.
1857 1859
1858 if (uuid == LLUUID.Zero) 1860 if (uuid == UUID.Zero)
1859 { 1861 {
1860 uuid = LLUUID.Random(); 1862 uuid = UUID.Random();
1861 } 1863 }
1862 1864
1863 // Create AssetBase entity to hold the inlined asset 1865 // Create AssetBase entity to hold the inlined asset
@@ -1887,7 +1889,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1887 // If this is in the context of an item, establish 1889 // If this is in the context of an item, establish
1888 // a link with the item in context. 1890 // a link with the item in context.
1889 1891
1890 if (ic.Item != null && ic.Item.AssetID == LLUUID.Zero) 1892 if (ic.Item != null && ic.Item.AssetID == UUID.Zero)
1891 { 1893 {
1892 ic.Item.AssetID = uuid; 1894 ic.Item.AssetID = uuid;
1893 } 1895 }
@@ -1970,7 +1972,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1970 // here. It should always get set from the information stored 1972 // here. It should always get set from the information stored
1971 // when the Asset element was processed. 1973 // when the Asset element was processed.
1972 1974
1973 if (ic.Item.AssetID == LLUUID.Zero) 1975 if (ic.Item.AssetID == UUID.Zero)
1974 { 1976 {
1975 Rest.Log.ErrorFormat("{0} Unable to complete request", MsgId); 1977 Rest.Log.ErrorFormat("{0} Unable to complete request", MsgId);
1976 Rest.Log.InfoFormat("{0} Asset information is missing", MsgId); 1978 Rest.Log.InfoFormat("{0} Asset information is missing", MsgId);
@@ -1979,16 +1981,16 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1979 1981
1980 // If the item is new, then assign it an ID 1982 // If the item is new, then assign it an ID
1981 1983
1982 if (ic.Item.ID == LLUUID.Zero) 1984 if (ic.Item.ID == UUID.Zero)
1983 { 1985 {
1984 ic.Item.ID = LLUUID.Random(); 1986 ic.Item.ID = UUID.Random();
1985 } 1987 }
1986 1988
1987 // If the context is being implied, obtain the current 1989 // If the context is being implied, obtain the current
1988 // folder item's ID. If it was specified explicitly, make 1990 // folder item's ID. If it was specified explicitly, make
1989 // sure that theparent folder exists. 1991 // sure that theparent folder exists.
1990 1992
1991 if (ic.Item.Folder == LLUUID.Zero) 1993 if (ic.Item.Folder == UUID.Zero)
1992 { 1994 {
1993 ic.Item.Folder = ic.Parent(); 1995 ic.Item.Folder = ic.Parent();
1994 } 1996 }
@@ -2113,8 +2115,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
2113 Bitmap temp; 2115 Bitmap temp;
2114 Stream tgadata = new MemoryStream(ic.Asset.Data); 2116 Stream tgadata = new MemoryStream(ic.Asset.Data);
2115 2117
2116 temp = OpenJPEGNet.LoadTGAClass.LoadTGA(tgadata); 2118 temp = LoadTGAClass.LoadTGA(tgadata);
2117 ic.Asset.Data = OpenJPEGNet.OpenJPEG.EncodeFromImage(temp, true); 2119 ic.Asset.Data = OpenJPEG.EncodeFromImage(temp, true);
2118 } 2120 }
2119 2121
2120 ic.reset(); 2122 ic.reset();
@@ -2129,7 +2131,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
2129 /// extensions. 2131 /// extensions.
2130 /// </summary> 2132 /// </summary>
2131 2133
2132 internal LLUUID uuid = LLUUID.Zero; 2134 internal UUID uuid = UUID.Zero;
2133 internal bool HaveInventory = false; 2135 internal bool HaveInventory = false;
2134 internal ICollection<InventoryFolderImpl> folders = null; 2136 internal ICollection<InventoryFolderImpl> folders = null;
2135 internal ICollection<InventoryItemBase> items = null; 2137 internal ICollection<InventoryItemBase> items = null;
@@ -2214,7 +2216,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
2214 EveryOnePermissions = DefaultEveryOne; 2216 EveryOnePermissions = DefaultEveryOne;
2215 } 2217 }
2216 2218
2217 internal LLUUID Parent() 2219 internal UUID Parent()
2218 { 2220 {
2219 if (stk.Count != 0) 2221 if (stk.Count != 0)
2220 { 2222 {
@@ -2222,7 +2224,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
2222 } 2224 }
2223 else 2225 else
2224 { 2226 {
2225 return LLUUID.Zero; 2227 return UUID.Zero;
2226 } 2228 }
2227 } 2229 }
2228 2230