aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs2
-rw-r--r--OpenSim/Framework/Util.cs108
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs77
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs108
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs35
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs16
-rw-r--r--prebuild.xml3
9 files changed, 222 insertions, 136 deletions
diff --git a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs
index 9a6ca86..11a2698 100644
--- a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs
+++ b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs
@@ -435,4 +435,4 @@ namespace OpenSim.Capabilities.Handlers
435 return llsdItem; 435 return llsdItem;
436 } 436 }
437 } 437 }
438} \ No newline at end of file 438}
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 8e325d7..0545365 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -2157,4 +2157,112 @@ namespace OpenSim.Framework
2157 return str.Replace("_", "\\_").Replace("%", "\\%"); 2157 return str.Replace("_", "\\_").Replace("%", "\\%");
2158 } 2158 }
2159 } 2159 }
2160
2161 public class DoubleQueue<T> where T:class
2162 {
2163 private Queue<T> m_lowQueue = new Queue<T>();
2164 private Queue<T> m_highQueue = new Queue<T>();
2165
2166 private object m_syncRoot = new object();
2167 private Semaphore m_s = new Semaphore(0, 1);
2168
2169 public DoubleQueue()
2170 {
2171 }
2172
2173 public virtual int Count
2174 {
2175 get { return m_highQueue.Count + m_lowQueue.Count; }
2176 }
2177
2178 public virtual void Enqueue(T data)
2179 {
2180 Enqueue(m_lowQueue, data);
2181 }
2182
2183 public virtual void EnqueueLow(T data)
2184 {
2185 Enqueue(m_lowQueue, data);
2186 }
2187
2188 public virtual void EnqueueHigh(T data)
2189 {
2190 Enqueue(m_highQueue, data);
2191 }
2192
2193 private void Enqueue(Queue<T> q, T data)
2194 {
2195 lock (m_syncRoot)
2196 {
2197 m_lowQueue.Enqueue(data);
2198 m_s.WaitOne(0);
2199 m_s.Release();
2200 }
2201 }
2202
2203 public virtual T Dequeue()
2204 {
2205 return Dequeue(Timeout.Infinite);
2206 }
2207
2208 public virtual T Dequeue(int tmo)
2209 {
2210 return Dequeue(TimeSpan.FromMilliseconds(tmo));
2211 }
2212
2213 public virtual T Dequeue(TimeSpan wait)
2214 {
2215 T res = null;
2216
2217 if (!Dequeue(wait, ref res))
2218 return null;
2219
2220 return res;
2221 }
2222
2223 public bool Dequeue(int timeout, ref T res)
2224 {
2225 return Dequeue(TimeSpan.FromMilliseconds(timeout), ref res);
2226 }
2227
2228 public bool Dequeue(TimeSpan wait, ref T res)
2229 {
2230 if (!m_s.WaitOne(wait))
2231 return false;
2232
2233 lock (m_syncRoot)
2234 {
2235 if (m_highQueue.Count > 0)
2236 res = m_highQueue.Dequeue();
2237 else
2238 res = m_lowQueue.Dequeue();
2239
2240 if (m_highQueue.Count == 0 && m_lowQueue.Count == 0)
2241 return true;
2242
2243 try
2244 {
2245 m_s.Release();
2246 }
2247 catch
2248 {
2249 }
2250
2251 return true;
2252 }
2253 }
2254
2255 public virtual void Clear()
2256 {
2257
2258 lock (m_syncRoot)
2259 {
2260 // Make sure sem count is 0
2261 m_s.WaitOne(0);
2262
2263 m_lowQueue.Clear();
2264 m_highQueue.Clear();
2265 }
2266 }
2267 }
2160} 2268}
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
index 04cd474..a823dd8 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
@@ -39,10 +39,13 @@ using OpenSim.Framework.Servers;
39using OpenSim.Framework.Servers.HttpServer; 39using OpenSim.Framework.Servers.HttpServer;
40using OpenSim.Region.Framework.Interfaces; 40using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
42using OpenSim.Framework.Capabilities;
42using OpenSim.Services.Interfaces; 43using OpenSim.Services.Interfaces;
43using Caps = OpenSim.Framework.Capabilities.Caps; 44using Caps = OpenSim.Framework.Capabilities.Caps;
44using OpenSim.Capabilities.Handlers; 45using OpenSim.Capabilities.Handlers;
45using OpenSim.Framework.Monitoring; 46using OpenSim.Framework.Monitoring;
47using OpenMetaverse;
48using OpenMetaverse.StructuredData;
46 49
47namespace OpenSim.Region.ClientStack.Linden 50namespace OpenSim.Region.ClientStack.Linden
48{ 51{
@@ -52,11 +55,13 @@ namespace OpenSim.Region.ClientStack.Linden
52 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WebFetchInvDescModule")] 55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WebFetchInvDescModule")]
53 public class WebFetchInvDescModule : INonSharedRegionModule 56 public class WebFetchInvDescModule : INonSharedRegionModule
54 { 57 {
55 struct aPollRequest 58 class aPollRequest
56 { 59 {
57 public PollServiceInventoryEventArgs thepoll; 60 public PollServiceInventoryEventArgs thepoll;
58 public UUID reqID; 61 public UUID reqID;
59 public Hashtable request; 62 public Hashtable request;
63 public ScenePresence presence;
64 public List<UUID> folders;
60 } 65 }
61 66
62 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 67 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -71,8 +76,8 @@ namespace OpenSim.Region.ClientStack.Linden
71 private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>(); 76 private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>();
72 private static Thread[] m_workerThreads = null; 77 private static Thread[] m_workerThreads = null;
73 78
74 private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue = 79 private static DoubleQueue<aPollRequest> m_queue =
75 new OpenMetaverse.BlockingQueue<aPollRequest>(); 80 new DoubleQueue<aPollRequest>();
76 81
77 #region ISharedRegionModule Members 82 #region ISharedRegionModule Members
78 83
@@ -143,12 +148,18 @@ namespace OpenSim.Region.ClientStack.Linden
143 148
144 private class PollServiceInventoryEventArgs : PollServiceEventArgs 149 private class PollServiceInventoryEventArgs : PollServiceEventArgs
145 { 150 {
151 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
152
146 private Dictionary<UUID, Hashtable> responses = 153 private Dictionary<UUID, Hashtable> responses =
147 new Dictionary<UUID, Hashtable>(); 154 new Dictionary<UUID, Hashtable>();
148 155
149 public PollServiceInventoryEventArgs(UUID pId) : 156 private Scene m_scene;
157
158 public PollServiceInventoryEventArgs(Scene scene, UUID pId) :
150 base(null, null, null, null, pId, int.MaxValue) 159 base(null, null, null, null, pId, int.MaxValue)
151 { 160 {
161 m_scene = scene;
162
152 HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); }; 163 HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); };
153 GetEvents = (x, y) => 164 GetEvents = (x, y) =>
154 { 165 {
@@ -167,12 +178,64 @@ namespace OpenSim.Region.ClientStack.Linden
167 178
168 Request = (x, y) => 179 Request = (x, y) =>
169 { 180 {
181 ScenePresence sp = m_scene.GetScenePresence(Id);
182 if (sp == null)
183 {
184 m_log.ErrorFormat("[INVENTORY]: Unable to find ScenePresence for {0}", Id);
185 return;
186 }
187
170 aPollRequest reqinfo = new aPollRequest(); 188 aPollRequest reqinfo = new aPollRequest();
171 reqinfo.thepoll = this; 189 reqinfo.thepoll = this;
172 reqinfo.reqID = x; 190 reqinfo.reqID = x;
173 reqinfo.request = y; 191 reqinfo.request = y;
192 reqinfo.presence = sp;
193 reqinfo.folders = new List<UUID>();
194
195 // Decode the request here
196 string request = y["body"].ToString();
197
198 request = request.Replace("<string>00000000-0000-0000-0000-000000000000</string>", "<uuid>00000000-0000-0000-0000-000000000000</uuid>");
199
200 request = request.Replace("<key>fetch_folders</key><integer>0</integer>", "<key>fetch_folders</key><boolean>0</boolean>");
201 request = request.Replace("<key>fetch_folders</key><integer>1</integer>", "<key>fetch_folders</key><boolean>1</boolean>");
202
203 Hashtable hash = new Hashtable();
204 try
205 {
206 hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request));
207 }
208 catch (LLSD.LLSDParseException e)
209 {
210 m_log.ErrorFormat("[INVENTORY]: Fetch error: {0}{1}" + e.Message, e.StackTrace);
211 m_log.Error("Request: " + request);
212 return;
213 }
214
215 ArrayList foldersrequested = (ArrayList)hash["folders"];
216
217 bool highPriority = false;
218
219 for (int i = 0; i < foldersrequested.Count; i++)
220 {
221 Hashtable inventoryhash = (Hashtable)foldersrequested[i];
222 string folder = inventoryhash["folder_id"].ToString();
223 UUID folderID;
224 if (UUID.TryParse(folder, out folderID))
225 {
226 if (!reqinfo.folders.Contains(folderID))
227 {
228 if (sp.COF != UUID.Zero && sp.COF == folderID)
229 highPriority = true;
230 reqinfo.folders.Add(folderID);
231 }
232 }
233 }
174 234
175 m_queue.Enqueue(reqinfo); 235 if (highPriority)
236 m_queue.EnqueueHigh(reqinfo);
237 else
238 m_queue.EnqueueLow(reqinfo);
176 }; 239 };
177 240
178 NoEvents = (x, y) => 241 NoEvents = (x, y) =>
@@ -208,7 +271,7 @@ namespace OpenSim.Region.ClientStack.Linden
208 response["reusecontext"] = false; 271 response["reusecontext"] = false;
209 272
210 response["str_response_string"] = m_webFetchHandler.FetchInventoryDescendentsRequest( 273 response["str_response_string"] = m_webFetchHandler.FetchInventoryDescendentsRequest(
211 requestinfo.request["body"].ToString(), String.Empty, String.Empty, null, null); 274 requestinfo.request["body"].ToString(), String.Empty, String.Empty, null, null);
212 275
213 lock (responses) 276 lock (responses)
214 responses[requestID] = response; 277 responses[requestID] = response;
@@ -220,7 +283,7 @@ namespace OpenSim.Region.ClientStack.Linden
220 string capUrl = "/CAPS/" + UUID.Random() + "/"; 283 string capUrl = "/CAPS/" + UUID.Random() + "/";
221 284
222 // Register this as a poll service 285 // Register this as a poll service
223 PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(agentID); 286 PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(m_scene, agentID);
224 287
225 args.Type = PollServiceEventArgs.EventType.Inventory; 288 args.Type = PollServiceEventArgs.EventType.Inventory;
226 MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); 289 MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args);
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 6c72edc..d49f1f7 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -1903,112 +1903,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1903 } 1903 }
1904 } 1904 }
1905 } 1905 }
1906
1907 internal class DoubleQueue<T> where T:class
1908 {
1909 private Queue<T> m_lowQueue = new Queue<T>();
1910 private Queue<T> m_highQueue = new Queue<T>();
1911
1912 private object m_syncRoot = new object();
1913 private Semaphore m_s = new Semaphore(0, 1);
1914
1915 public DoubleQueue()
1916 {
1917 }
1918
1919 public virtual int Count
1920 {
1921 get { return m_highQueue.Count + m_lowQueue.Count; }
1922 }
1923
1924 public virtual void Enqueue(T data)
1925 {
1926 Enqueue(m_lowQueue, data);
1927 }
1928
1929 public virtual void EnqueueLow(T data)
1930 {
1931 Enqueue(m_lowQueue, data);
1932 }
1933
1934 public virtual void EnqueueHigh(T data)
1935 {
1936 Enqueue(m_highQueue, data);
1937 }
1938
1939 private void Enqueue(Queue<T> q, T data)
1940 {
1941 lock (m_syncRoot)
1942 {
1943 m_lowQueue.Enqueue(data);
1944 m_s.WaitOne(0);
1945 m_s.Release();
1946 }
1947 }
1948
1949 public virtual T Dequeue()
1950 {
1951 return Dequeue(Timeout.Infinite);
1952 }
1953
1954 public virtual T Dequeue(int tmo)
1955 {
1956 return Dequeue(TimeSpan.FromMilliseconds(tmo));
1957 }
1958
1959 public virtual T Dequeue(TimeSpan wait)
1960 {
1961 T res = null;
1962
1963 if (!Dequeue(wait, ref res))
1964 return null;
1965
1966 return res;
1967 }
1968
1969 public bool Dequeue(int timeout, ref T res)
1970 {
1971 return Dequeue(TimeSpan.FromMilliseconds(timeout), ref res);
1972 }
1973
1974 public bool Dequeue(TimeSpan wait, ref T res)
1975 {
1976 if (!m_s.WaitOne(wait))
1977 return false;
1978
1979 lock (m_syncRoot)
1980 {
1981 if (m_highQueue.Count > 0)
1982 res = m_highQueue.Dequeue();
1983 else
1984 res = m_lowQueue.Dequeue();
1985
1986 if (m_highQueue.Count == 0 && m_lowQueue.Count == 0)
1987 return true;
1988
1989 try
1990 {
1991 m_s.Release();
1992 }
1993 catch
1994 {
1995 }
1996
1997 return true;
1998 }
1999 }
2000
2001 public virtual void Clear()
2002 {
2003
2004 lock (m_syncRoot)
2005 {
2006 // Make sure sem count is 0
2007 m_s.WaitOne(0);
2008
2009 m_lowQueue.Clear();
2010 m_highQueue.Clear();
2011 }
2012 }
2013 }
2014} 1906}
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index 3c6bbe6..208bc9e 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -694,7 +694,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
694 case WearableType.Shape: 694 case WearableType.Shape:
695 case WearableType.Skin: 695 case WearableType.Skin:
696 //case WearableType.Underpants: 696 //case WearableType.Underpants:
697 TryAndRepair((WearableType)i, invService, userID, appearance); 697 TryAndRepairBrokenWearable((WearableType)i, invService, userID, appearance);
698 resetwearable = true; 698 resetwearable = true;
699 m_log.Warn("[AVFACTORY]: UUID.Zero Wearables, passing fake values."); 699 m_log.Warn("[AVFACTORY]: UUID.Zero Wearables, passing fake values.");
700 resetwearable = true; 700 resetwearable = true;
@@ -714,7 +714,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
714 case WearableType.Shape: 714 case WearableType.Shape:
715 case WearableType.Skin: 715 case WearableType.Skin:
716 //case WearableType.Underpants: 716 //case WearableType.Underpants:
717 TryAndRepair((WearableType)i, invService, userID, appearance); 717 TryAndRepairBrokenWearable((WearableType)i, invService, userID, appearance);
718 718
719 m_log.WarnFormat("[AVFACTORY]: {0} Default Wearables, passing existing values.", (WearableType)i); 719 m_log.WarnFormat("[AVFACTORY]: {0} Default Wearables, passing existing values.", (WearableType)i);
720 resetwearable = true; 720 resetwearable = true;
@@ -730,6 +730,17 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
730 if (baseItem != null) 730 if (baseItem != null)
731 { 731 {
732 appearance.Wearables[i].Add(appearance.Wearables[i][j].ItemID, baseItem.AssetID); 732 appearance.Wearables[i].Add(appearance.Wearables[i][j].ItemID, baseItem.AssetID);
733 int unmodifiedWearableIndexForClosure = i;
734 m_scene.AssetService.Get(baseItem.AssetID.ToString(), this,
735 delegate(string x, object y, AssetBase z)
736 {
737 if (z == null)
738 {
739 TryAndRepairBrokenWearable(
740 (WearableType)unmodifiedWearableIndexForClosure, invService,
741 userID, appearance);
742 }
743 });
733 } 744 }
734 else 745 else
735 { 746 {
@@ -737,7 +748,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
737 "[AVFACTORY]: Can't find inventory item {0} for {1}, setting to default", 748 "[AVFACTORY]: Can't find inventory item {0} for {1}, setting to default",
738 appearance.Wearables[i][j].ItemID, (WearableType)i); 749 appearance.Wearables[i][j].ItemID, (WearableType)i);
739 750
740 TryAndRepair((WearableType)i, invService, userID, appearance); 751 TryAndRepairBrokenWearable((WearableType)i, invService, userID, appearance);
741 resetwearable = true; 752 resetwearable = true;
742 753
743 } 754 }
@@ -749,7 +760,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
749 { 760 {
750 m_log.WarnFormat("[AVFACTORY]: {0} Eyes are Null, passing existing values.", (WearableType.Eyes)); 761 m_log.WarnFormat("[AVFACTORY]: {0} Eyes are Null, passing existing values.", (WearableType.Eyes));
751 762
752 TryAndRepair(WearableType.Eyes, invService, userID, appearance); 763 TryAndRepairBrokenWearable(WearableType.Eyes, invService, userID, appearance);
753 resetwearable = true; 764 resetwearable = true;
754 } 765 }
755 else 766 else
@@ -759,7 +770,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
759 m_log.WarnFormat("[AVFACTORY]: Eyes are UUID.Zero are broken, {0} {1}", 770 m_log.WarnFormat("[AVFACTORY]: Eyes are UUID.Zero are broken, {0} {1}",
760 appearance.Wearables[(int) WearableType.Eyes][0].ItemID, 771 appearance.Wearables[(int) WearableType.Eyes][0].ItemID,
761 appearance.Wearables[(int) WearableType.Eyes][0].AssetID); 772 appearance.Wearables[(int) WearableType.Eyes][0].AssetID);
762 TryAndRepair(WearableType.Eyes, invService, userID, appearance); 773 TryAndRepairBrokenWearable(WearableType.Eyes, invService, userID, appearance);
763 resetwearable = true; 774 resetwearable = true;
764 775
765 } 776 }
@@ -770,7 +781,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
770 { 781 {
771 m_log.WarnFormat("[AVFACTORY]: {0} shape is Null, passing existing values.", (WearableType.Shape)); 782 m_log.WarnFormat("[AVFACTORY]: {0} shape is Null, passing existing values.", (WearableType.Shape));
772 783
773 TryAndRepair(WearableType.Shape, invService, userID, appearance); 784 TryAndRepairBrokenWearable(WearableType.Shape, invService, userID, appearance);
774 resetwearable = true; 785 resetwearable = true;
775 } 786 }
776 else 787 else
@@ -780,7 +791,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
780 m_log.WarnFormat("[AVFACTORY]: Shape is UUID.Zero and broken, {0} {1}", 791 m_log.WarnFormat("[AVFACTORY]: Shape is UUID.Zero and broken, {0} {1}",
781 appearance.Wearables[(int)WearableType.Shape][0].ItemID, 792 appearance.Wearables[(int)WearableType.Shape][0].ItemID,
782 appearance.Wearables[(int)WearableType.Shape][0].AssetID); 793 appearance.Wearables[(int)WearableType.Shape][0].AssetID);
783 TryAndRepair(WearableType.Shape, invService, userID, appearance); 794 TryAndRepairBrokenWearable(WearableType.Shape, invService, userID, appearance);
784 resetwearable = true; 795 resetwearable = true;
785 796
786 } 797 }
@@ -791,7 +802,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
791 { 802 {
792 m_log.WarnFormat("[AVFACTORY]: {0} Hair is Null, passing existing values.", (WearableType.Hair)); 803 m_log.WarnFormat("[AVFACTORY]: {0} Hair is Null, passing existing values.", (WearableType.Hair));
793 804
794 TryAndRepair(WearableType.Hair, invService, userID, appearance); 805 TryAndRepairBrokenWearable(WearableType.Hair, invService, userID, appearance);
795 resetwearable = true; 806 resetwearable = true;
796 } 807 }
797 else 808 else
@@ -801,7 +812,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
801 m_log.WarnFormat("[AVFACTORY]: Hair is UUID.Zero and broken, {0} {1}", 812 m_log.WarnFormat("[AVFACTORY]: Hair is UUID.Zero and broken, {0} {1}",
802 appearance.Wearables[(int)WearableType.Hair][0].ItemID, 813 appearance.Wearables[(int)WearableType.Hair][0].ItemID,
803 appearance.Wearables[(int)WearableType.Hair][0].AssetID); 814 appearance.Wearables[(int)WearableType.Hair][0].AssetID);
804 TryAndRepair(WearableType.Hair, invService, userID, appearance); 815 TryAndRepairBrokenWearable(WearableType.Hair, invService, userID, appearance);
805 resetwearable = true; 816 resetwearable = true;
806 817
807 } 818 }
@@ -812,7 +823,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
812 { 823 {
813 m_log.WarnFormat("[AVFACTORY]: {0} Skin is Null, passing existing values.", (WearableType.Skin)); 824 m_log.WarnFormat("[AVFACTORY]: {0} Skin is Null, passing existing values.", (WearableType.Skin));
814 825
815 TryAndRepair(WearableType.Skin, invService, userID, appearance); 826 TryAndRepairBrokenWearable(WearableType.Skin, invService, userID, appearance);
816 resetwearable = true; 827 resetwearable = true;
817 } 828 }
818 else 829 else
@@ -822,7 +833,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
822 m_log.WarnFormat("[AVFACTORY]: Skin is UUID.Zero and broken, {0} {1}", 833 m_log.WarnFormat("[AVFACTORY]: Skin is UUID.Zero and broken, {0} {1}",
823 appearance.Wearables[(int)WearableType.Skin][0].ItemID, 834 appearance.Wearables[(int)WearableType.Skin][0].ItemID,
824 appearance.Wearables[(int)WearableType.Skin][0].AssetID); 835 appearance.Wearables[(int)WearableType.Skin][0].AssetID);
825 TryAndRepair(WearableType.Skin, invService, userID, appearance); 836 TryAndRepairBrokenWearable(WearableType.Skin, invService, userID, appearance);
826 resetwearable = true; 837 resetwearable = true;
827 838
828 } 839 }
@@ -844,7 +855,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
844 m_log.WarnFormat("[AVFACTORY]: user {0} has no inventory, appearance isn't going to work", userID); 855 m_log.WarnFormat("[AVFACTORY]: user {0} has no inventory, appearance isn't going to work", userID);
845 } 856 }
846 } 857 }
847 private void TryAndRepair(WearableType type, IInventoryService invService, UUID userID,AvatarAppearance appearance) 858 private void TryAndRepairBrokenWearable(WearableType type, IInventoryService invService, UUID userID,AvatarAppearance appearance)
848 { 859 {
849 UUID defaultwearable = GetDefaultItem(type); 860 UUID defaultwearable = GetDefaultItem(type);
850 if (defaultwearable != UUID.Zero) 861 if (defaultwearable != UUID.Zero)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index ce055d3..c757147 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2952,6 +2952,13 @@ namespace OpenSim.Region.Framework.Scenes
2952 SubscribeToClientEvents(client); 2952 SubscribeToClientEvents(client);
2953 2953
2954 sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); 2954 sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type);
2955 InventoryFolderBase cof = InventoryService.GetFolderForType(client.AgentId, (AssetType)46);
2956 if (cof == null)
2957 sp.COF = UUID.Zero;
2958 else
2959 sp.COF = cof.ID;
2960
2961 m_log.DebugFormat("[SCENE]: COF for {0} is {1}", client.AgentId, sp.COF);
2955 m_eventManager.TriggerOnNewPresence(sp); 2962 m_eventManager.TriggerOnNewPresence(sp);
2956 2963
2957 sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; 2964 sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index c352465..0bcf480 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -441,6 +441,8 @@ namespace OpenSim.Region.Framework.Scenes
441 get { return (IClientCore)ControllingClient; } 441 get { return (IClientCore)ControllingClient; }
442 } 442 }
443 443
444 public UUID COF { get; set; }
445
444// public Vector3 ParentPosition { get; set; } 446// public Vector3 ParentPosition { get; set; }
445 447
446 /// <summary> 448 /// <summary>
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 19214ec..f9ee590 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4678,7 +4678,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4678 UUID av = new UUID(); 4678 UUID av = new UUID();
4679 if (!UUID.TryParse(agent,out av)) 4679 if (!UUID.TryParse(agent,out av))
4680 { 4680 {
4681 //LSLError("First parameter to llDialog needs to be a key");
4682 return; 4681 return;
4683 } 4682 }
4684 4683
@@ -7175,20 +7174,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7175 } 7174 }
7176 if (buttons.Length > 12) 7175 if (buttons.Length > 12)
7177 { 7176 {
7178 LSLError("No more than 12 buttons can be shown"); 7177 ShoutError("button list too long, must be 12 or fewer entries");
7179 return;
7180 } 7178 }
7181 string[] buts = new string[buttons.Length]; 7179 int length = buttons.Length;
7182 for (int i = 0; i < buttons.Length; i++) 7180 if (length > 12)
7181 length = 12;
7182
7183 string[] buts = new string[length];
7184 for (int i = 0; i < length; i++)
7183 { 7185 {
7184 if (buttons.Data[i].ToString() == String.Empty) 7186 if (buttons.Data[i].ToString() == String.Empty)
7185 { 7187 {
7186 LSLError("button label cannot be blank"); 7188 ShoutError("button label cannot be blank");
7187 return; 7189 return;
7188 } 7190 }
7189 if (buttons.Data[i].ToString().Length > 24) 7191 if (buttons.Data[i].ToString().Length > 24)
7190 { 7192 {
7191 llWhisper(ScriptBaseClass.DEBUG_CHANNEL, "button label cannot be longer than 24 characters"); 7193 ShoutError("button label cannot be longer than 24 characters");
7192 return; 7194 return;
7193 } 7195 }
7194 buts[i] = buttons.Data[i].ToString(); 7196 buts[i] = buttons.Data[i].ToString();
diff --git a/prebuild.xml b/prebuild.xml
index 51a4e8b..2bee760 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -1607,9 +1607,10 @@
1607 <Reference name="System.Drawing"/> 1607 <Reference name="System.Drawing"/>
1608 <Reference name="System.Xml"/> 1608 <Reference name="System.Xml"/>
1609 <Reference name="System.Web"/> 1609 <Reference name="System.Web"/>
1610 <Reference name="OpenMetaverse" path="../../../../../bin/"/>
1610 <Reference name="OpenMetaverseTypes" path="../../../../../bin/"/> 1611 <Reference name="OpenMetaverseTypes" path="../../../../../bin/"/>
1611 <Reference name="OpenMetaverse.StructuredData" path="../../../../../bin/"/> 1612 <Reference name="OpenMetaverse.StructuredData" path="../../../../../bin/"/>
1612 <Reference name="OpenMetaverse" path="../../../../../bin/"/> 1613
1613 <Reference name="OpenSim.Region.Framework"/> 1614 <Reference name="OpenSim.Region.Framework"/>
1614 <Reference name="OpenSim.Capabilities"/> 1615 <Reference name="OpenSim.Capabilities"/>
1615 <Reference name="OpenSim.Capabilities.Handlers"/> 1616 <Reference name="OpenSim.Capabilities.Handlers"/>