aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs94
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs6
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs6
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs18
4 files changed, 86 insertions, 38 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index d0c8b73..be15e1b 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -414,27 +414,36 @@ namespace OpenSim.Framework
414 /// </summary> 414 /// </summary>
415 public List<AvatarAttachment> GetAttachments() 415 public List<AvatarAttachment> GetAttachments()
416 { 416 {
417 List<AvatarAttachment> alist = new List<AvatarAttachment>(); 417 lock (m_attachments)
418 foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments)
419 { 418 {
420 foreach (AvatarAttachment attach in kvp.Value) 419 List<AvatarAttachment> alist = new List<AvatarAttachment>();
421 alist.Add(new AvatarAttachment(attach)); 420 foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments)
422 } 421 {
422 foreach (AvatarAttachment attach in kvp.Value)
423 alist.Add(new AvatarAttachment(attach));
424 }
423 425
424 return alist; 426 return alist;
427 }
425 } 428 }
426 429
427 internal void AppendAttachment(AvatarAttachment attach) 430 internal void AppendAttachment(AvatarAttachment attach)
428 { 431 {
429 if (! m_attachments.ContainsKey(attach.AttachPoint)) 432 lock (m_attachments)
430 m_attachments[attach.AttachPoint] = new List<AvatarAttachment>(); 433 {
431 m_attachments[attach.AttachPoint].Add(attach); 434 if (!m_attachments.ContainsKey(attach.AttachPoint))
435 m_attachments[attach.AttachPoint] = new List<AvatarAttachment>();
436 m_attachments[attach.AttachPoint].Add(attach);
437 }
432 } 438 }
433 439
434 internal void ReplaceAttachment(AvatarAttachment attach) 440 internal void ReplaceAttachment(AvatarAttachment attach)
435 { 441 {
436 m_attachments[attach.AttachPoint] = new List<AvatarAttachment>(); 442 lock (m_attachments)
437 m_attachments[attach.AttachPoint].Add(attach); 443 {
444 m_attachments[attach.AttachPoint] = new List<AvatarAttachment>();
445 m_attachments[attach.AttachPoint].Add(attach);
446 }
438 } 447 }
439 448
440 /// <summary> 449 /// <summary>
@@ -450,9 +459,12 @@ namespace OpenSim.Framework
450 459
451 if (item == UUID.Zero) 460 if (item == UUID.Zero)
452 { 461 {
453 if (m_attachments.ContainsKey(attachpoint)) 462 lock (m_attachments)
454 m_attachments.Remove(attachpoint); 463 {
455 return; 464 if (m_attachments.ContainsKey(attachpoint))
465 m_attachments.Remove(attachpoint);
466 return;
467 }
456 } 468 }
457 469
458 // check if this is an append or a replace, 0x80 marks it as an append 470 // check if this is an append or a replace, 0x80 marks it as an append
@@ -470,37 +482,46 @@ namespace OpenSim.Framework
470 482
471 public int GetAttachpoint(UUID itemID) 483 public int GetAttachpoint(UUID itemID)
472 { 484 {
473 foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) 485 lock (m_attachments)
474 { 486 {
475 int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); 487 foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments)
476 if (index >= 0) 488 {
477 return kvp.Key; 489 int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; });
478 } 490 if (index >= 0)
491 return kvp.Key;
492 }
479 493
480 return 0; 494 return 0;
495 }
481 } 496 }
482 497
483 public void DetachAttachment(UUID itemID) 498 public void DetachAttachment(UUID itemID)
484 { 499 {
485 foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) 500 lock (m_attachments)
486 { 501 {
487 int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); 502 foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments)
488 if (index >= 0)
489 { 503 {
490 // Remove it from the list of attachments at that attach point 504 int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; });
491 m_attachments[kvp.Key].RemoveAt(index); 505 if (index >= 0)
506 {
507 // Remove it from the list of attachments at that attach point
508 m_attachments[kvp.Key].RemoveAt(index);
492 509
493 // And remove the list if there are no more attachments here 510 // And remove the list if there are no more attachments here
494 if (m_attachments[kvp.Key].Count == 0) 511 if (m_attachments[kvp.Key].Count == 0)
495 m_attachments.Remove(kvp.Key); 512 m_attachments.Remove(kvp.Key);
496 return; 513 return;
514 }
497 } 515 }
498 } 516 }
499 } 517 }
500 518
501 public void ClearAttachments() 519 public void ClearAttachments()
502 { 520 {
503 m_attachments.Clear(); 521 lock (m_attachments)
522 {
523 m_attachments.Clear();
524 }
504 } 525 }
505 526
506 #region Packing Functions 527 #region Packing Functions
@@ -537,11 +558,14 @@ namespace OpenSim.Framework
537 OSDBinary visualparams = new OSDBinary(m_visualparams); 558 OSDBinary visualparams = new OSDBinary(m_visualparams);
538 data["visualparams"] = visualparams; 559 data["visualparams"] = visualparams;
539 560
540 // Attachments 561 lock (m_attachments)
541 OSDArray attachs = new OSDArray(m_attachments.Count); 562 {
542 foreach (AvatarAttachment attach in GetAttachments()) 563 // Attachments
543 attachs.Add(attach.Pack()); 564 OSDArray attachs = new OSDArray(m_attachments.Count);
544 data["attachments"] = attachs; 565 foreach (AvatarAttachment attach in GetAttachments())
566 attachs.Add(attach.Pack());
567 data["attachments"] = attachs;
568 }
545 569
546 return data; 570 return data;
547 } 571 }
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 05fa331..b74a392 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -222,6 +222,12 @@ namespace OpenSim
222 m_moduleLoader = new ModuleLoader(m_config.Source); 222 m_moduleLoader = new ModuleLoader(m_config.Source);
223 223
224 LoadPlugins(); 224 LoadPlugins();
225
226 if (m_plugins.Count == 0) // We failed to load any modules. Mono Addins glitch!
227 {
228 Environment.Exit(1);
229 }
230
225 foreach (IApplicationPlugin plugin in m_plugins) 231 foreach (IApplicationPlugin plugin in m_plugins)
226 { 232 {
227 plugin.PostInitialise(); 233 plugin.PostInitialise();
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
index 85e1c99..d7f3f2c 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
@@ -167,6 +167,9 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
167 { 167 {
168 if (XferUploaders.ContainsKey(transactionID)) 168 if (XferUploaders.ContainsKey(transactionID))
169 { 169 {
170 m_log.DebugFormat("[XFER]: Asked to update item {0} ({1})",
171 item.Name, item.ID);
172
170 // Here we need to get the old asset to extract the 173 // Here we need to get the old asset to extract the
171 // texture UUIDs if it's a wearable. 174 // texture UUIDs if it's a wearable.
172 if (item.AssetType == (int)AssetType.Bodypart || 175 if (item.AssetType == (int)AssetType.Bodypart ||
@@ -191,6 +194,9 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
191 194
192 IInventoryService invService = m_Scene.InventoryService; 195 IInventoryService invService = m_Scene.InventoryService;
193 invService.UpdateItem(item); 196 invService.UpdateItem(item);
197
198 m_log.DebugFormat("[XFER]: Updated item {0} ({1}) with asset {2}",
199 item.Name, item.ID, asset.FullID);
194 } 200 }
195 } 201 }
196 } 202 }
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
index b8c8c85..a5dcdcc 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
@@ -40,7 +40,12 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
40 public class AssetXferUploader 40 public class AssetXferUploader
41 { 41 {
42 // Viewer's notion of the default texture 42 // Viewer's notion of the default texture
43 private UUID defaultID = new UUID("5748decc-f629-461c-9a36-a35a221fe21f"); 43 private List<UUID> defaultIDs = new List<UUID> {
44 new UUID("5748decc-f629-461c-9a36-a35a221fe21f"),
45 new UUID("7ca39b4c-bd19-4699-aff7-f93fd03d3e7b"),
46 new UUID("6522e74d-1660-4e7f-b601-6f48c1659a77"),
47 new UUID("c228d1cf-4b5d-4ba8-84f4-899a0796aa97")
48 };
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 50
46 private AssetBase m_asset; 51 private AssetBase m_asset;
@@ -244,6 +249,9 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
244 item.Flags = (uint) wearableType; 249 item.Flags = (uint) wearableType;
245 item.CreationDate = Util.UnixTimeSinceEpoch(); 250 item.CreationDate = Util.UnixTimeSinceEpoch();
246 251
252 m_log.DebugFormat("[XFER]: Created item {0} with asset {1}",
253 item.ID, item.AssetID);
254
247 if (m_Scene.AddInventoryItem(item)) 255 if (m_Scene.AddInventoryItem(item))
248 ourClient.SendInventoryItemCreateUpdate(item, callbackID); 256 ourClient.SendInventoryItemCreateUpdate(item, callbackID);
249 else 257 else
@@ -280,7 +288,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
280 UUID tx = new UUID(parts[1]); 288 UUID tx = new UUID(parts[1]);
281 int id = Convert.ToInt32(parts[0]); 289 int id = Convert.ToInt32(parts[0]);
282 290
283 if (tx == defaultID || tx == UUID.Zero || 291 if (defaultIDs.Contains(tx) || tx == UUID.Zero ||
284 (allowed.ContainsKey(id) && allowed[id] == tx)) 292 (allowed.ContainsKey(id) && allowed[id] == tx))
285 { 293 {
286 validated.Add(parts[0] + " " + tx.ToString()); 294 validated.Add(parts[0] + " " + tx.ToString());
@@ -293,7 +301,11 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
293 if ((perms & full) != full) 301 if ((perms & full) != full)
294 { 302 {
295 m_log.ErrorFormat("[ASSET UPLOADER]: REJECTED update with texture {0} from {1} because they do not own the texture", tx, ourClient.AgentId); 303 m_log.ErrorFormat("[ASSET UPLOADER]: REJECTED update with texture {0} from {1} because they do not own the texture", tx, ourClient.AgentId);
296 validated.Add(parts[0] + " " + defaultID.ToString()); 304 validated.Add(parts[0] + " " + UUID.Zero.ToString());
305 }
306 else
307 {
308 validated.Add(line);
297 } 309 }
298 } 310 }
299 textures--; 311 textures--;