diff options
* Added some more experimental code; nothing wired in so far.
Diffstat (limited to 'OpenSim/Framework/Communications/Cache')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/AssetCache.cs | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index b571c0b..cbb2a5a 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs | |||
@@ -393,22 +393,26 @@ namespace OpenSim.Framework.Communications.Cache | |||
393 | 393 | ||
394 | protected void ProcessReceivedAsset(bool IsTexture, AssetInfo assetInf) | 394 | protected void ProcessReceivedAsset(bool IsTexture, AssetInfo assetInf) |
395 | { | 395 | { |
396 | if(!IsTexture && assetInf.ContainsReferences && false ) | ||
397 | { | ||
398 | assetInf.Data = ProcessAssetData(assetInf.Data); | ||
399 | } | ||
396 | } | 400 | } |
397 | 401 | ||
398 | // See IAssetReceiver | 402 | // See IAssetReceiver |
399 | public virtual void AssetNotFound(UUID assetID, bool IsTexture) | 403 | public virtual void AssetNotFound(UUID assetId, bool isTexture) |
400 | { | 404 | { |
401 | // m_log.WarnFormat("[ASSET CACHE]: AssetNotFound for {0}", assetID); | 405 | // m_log.WarnFormat("[ASSET CACHE]: AssetNotFound for {0}", assetId); |
402 | 406 | ||
403 | // Remember the fact that this asset could not be found to prevent delays from repeated requests | 407 | // Remember the fact that this asset could not be found to prevent delays from repeated requests |
404 | m_memcache.Add(assetID, null, TimeSpan.FromHours(24)); | 408 | m_memcache.Add(assetId, null, TimeSpan.FromHours(24)); |
405 | 409 | ||
406 | // Notify requesters for this asset | 410 | // Notify requesters for this asset |
407 | AssetRequestsList reqList; | 411 | AssetRequestsList reqList; |
408 | lock (RequestLists) | 412 | lock (RequestLists) |
409 | { | 413 | { |
410 | if (RequestLists.TryGetValue(assetID, out reqList)) | 414 | if (RequestLists.TryGetValue(assetId, out reqList)) |
411 | RequestLists.Remove(assetID); | 415 | RequestLists.Remove(assetId); |
412 | } | 416 | } |
413 | 417 | ||
414 | if (reqList != null) | 418 | if (reqList != null) |
@@ -418,7 +422,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
418 | 422 | ||
419 | foreach (NewAssetRequest req in reqList.Requests) | 423 | foreach (NewAssetRequest req in reqList.Requests) |
420 | { | 424 | { |
421 | req.Callback(assetID, null); | 425 | req.Callback(assetId, null); |
422 | } | 426 | } |
423 | } | 427 | } |
424 | } | 428 | } |
@@ -554,12 +558,12 @@ namespace OpenSim.Framework.Communications.Cache | |||
554 | { | 558 | { |
555 | string data = Encoding.ASCII.GetString(assetData); | 559 | string data = Encoding.ASCII.GetString(assetData); |
556 | 560 | ||
557 | data = ProcessAssetDataString(data); | 561 | data = ProcessAssetDataString(data, null); |
558 | 562 | ||
559 | return Encoding.ASCII.GetBytes( data ); | 563 | return Encoding.ASCII.GetBytes( data ); |
560 | } | 564 | } |
561 | 565 | ||
562 | public string ProcessAssetDataString(string data) | 566 | public string ProcessAssetDataString(string data, IUserService userService) |
563 | { | 567 | { |
564 | Regex regex = new Regex("(creator_url|owner_url)\\s+(\\S+)"); | 568 | Regex regex = new Regex("(creator_url|owner_url)\\s+(\\S+)"); |
565 | 569 | ||
@@ -571,16 +575,18 @@ namespace OpenSim.Framework.Communications.Cache | |||
571 | 575 | ||
572 | string value = m.Groups[2].Captures[0].Value; | 576 | string value = m.Groups[2].Captures[0].Value; |
573 | 577 | ||
574 | Guid id = Util.GetHashGuid(value, AssetInfo.Secret); | 578 | Uri userUri; |
575 | 579 | ||
576 | switch (key) | 580 | switch (key) |
577 | { | 581 | { |
578 | case "creator_url": | 582 | case "creator_url": |
579 | result = "creator_id " + id; | 583 | userUri = new Uri(value); |
584 | result = "creator_id " + ResolveUserUri(userService, userUri); | ||
580 | break; | 585 | break; |
581 | 586 | ||
582 | case "owner_url": | 587 | case "owner_url": |
583 | result = "owner_id " + id; | 588 | userUri = new Uri(value); |
589 | result = "owner_id " + ResolveUserUri(userService, userUri); | ||
584 | break; | 590 | break; |
585 | } | 591 | } |
586 | 592 | ||
@@ -590,6 +596,21 @@ namespace OpenSim.Framework.Communications.Cache | |||
590 | return data; | 596 | return data; |
591 | } | 597 | } |
592 | 598 | ||
599 | private Guid ResolveUserUri(IUserService userService, Uri userUri) | ||
600 | { | ||
601 | Guid id; | ||
602 | UserProfileData userProfile = userService.GetUserProfile(userUri); | ||
603 | if( userProfile == null ) | ||
604 | { | ||
605 | id = Guid.Empty; | ||
606 | } | ||
607 | else | ||
608 | { | ||
609 | id = userProfile.ID.Guid; | ||
610 | } | ||
611 | return id; | ||
612 | } | ||
613 | |||
593 | 614 | ||
594 | public class AssetRequest | 615 | public class AssetRequest |
595 | { | 616 | { |