aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Osp
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Communications/Osp')
-rw-r--r--OpenSim/Framework/Communications/Osp/OspInventoryWrapperPlugin.cs10
-rw-r--r--OpenSim/Framework/Communications/Osp/OspResolver.cs21
2 files changed, 17 insertions, 14 deletions
diff --git a/OpenSim/Framework/Communications/Osp/OspInventoryWrapperPlugin.cs b/OpenSim/Framework/Communications/Osp/OspInventoryWrapperPlugin.cs
index e96c5e8..bcd1eee 100644
--- a/OpenSim/Framework/Communications/Osp/OspInventoryWrapperPlugin.cs
+++ b/OpenSim/Framework/Communications/Osp/OspInventoryWrapperPlugin.cs
@@ -28,6 +28,7 @@
28using System.Collections.Generic; 28using System.Collections.Generic;
29using OpenSim.Data; 29using OpenSim.Data;
30using OpenMetaverse; 30using OpenMetaverse;
31using OpenSim.Services.Interfaces;
31 32
32namespace OpenSim.Framework.Communications.Osp 33namespace OpenSim.Framework.Communications.Osp
33{ 34{
@@ -37,12 +38,13 @@ namespace OpenSim.Framework.Communications.Osp
37 public class OspInventoryWrapperPlugin : IInventoryDataPlugin 38 public class OspInventoryWrapperPlugin : IInventoryDataPlugin
38 { 39 {
39 protected IInventoryDataPlugin m_wrappedPlugin; 40 protected IInventoryDataPlugin m_wrappedPlugin;
40 protected CommunicationsManager m_commsManager; 41 //protected CommunicationsManager m_commsManager;
42 protected IUserAccountService m_userAccountService;
41 43
42 public OspInventoryWrapperPlugin(IInventoryDataPlugin wrappedPlugin, CommunicationsManager commsManager) 44 public OspInventoryWrapperPlugin(IInventoryDataPlugin wrappedPlugin, IUserAccountService userService)
43 { 45 {
44 m_wrappedPlugin = wrappedPlugin; 46 m_wrappedPlugin = wrappedPlugin;
45 m_commsManager = commsManager; 47 m_userAccountService = userService;
46 } 48 }
47 49
48 public string Name { get { return "OspInventoryWrapperPlugin"; } } 50 public string Name { get { return "OspInventoryWrapperPlugin"; } }
@@ -81,7 +83,7 @@ namespace OpenSim.Framework.Communications.Osp
81 83
82 protected InventoryItemBase PostProcessItem(InventoryItemBase item) 84 protected InventoryItemBase PostProcessItem(InventoryItemBase item)
83 { 85 {
84 item.CreatorIdAsUuid = OspResolver.ResolveOspa(item.CreatorId, m_commsManager); 86 item.CreatorIdAsUuid = OspResolver.ResolveOspa(item.CreatorId, m_userAccountService);
85 return item; 87 return item;
86 } 88 }
87 89
diff --git a/OpenSim/Framework/Communications/Osp/OspResolver.cs b/OpenSim/Framework/Communications/Osp/OspResolver.cs
index 4013896..14f813a 100644
--- a/OpenSim/Framework/Communications/Osp/OspResolver.cs
+++ b/OpenSim/Framework/Communications/Osp/OspResolver.cs
@@ -31,6 +31,7 @@ using log4net;
31using OpenMetaverse; 31using OpenMetaverse;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Framework.Communications.Cache; 33using OpenSim.Framework.Communications.Cache;
34using OpenSim.Services.Interfaces;
34 35
35namespace OpenSim.Framework.Communications.Osp 36namespace OpenSim.Framework.Communications.Osp
36{ 37{
@@ -55,11 +56,11 @@ namespace OpenSim.Framework.Communications.Osp
55 /// <param name="userId"></param> 56 /// <param name="userId"></param>
56 /// <param name="commsManager"></param> 57 /// <param name="commsManager"></param>
57 /// <returns>The OSPA. Null if a user with the given UUID could not be found.</returns> 58 /// <returns>The OSPA. Null if a user with the given UUID could not be found.</returns>
58 public static string MakeOspa(UUID userId, CommunicationsManager commsManager) 59 public static string MakeOspa(UUID userId, IUserAccountService userService)
59 { 60 {
60 CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId); 61 UserAccount account = userService.GetUserAccount(UUID.Zero, userId);
61 if (userInfo != null) 62 if (account != null)
62 return MakeOspa(userInfo.UserProfile.FirstName, userInfo.UserProfile.SurName); 63 return MakeOspa(account.FirstName, account.LastName);
63 64
64 return null; 65 return null;
65 } 66 }
@@ -88,7 +89,7 @@ namespace OpenSim.Framework.Communications.Osp
88 /// A suitable UUID for use in Second Life client communication. If the string was not a valid ospa, then UUID.Zero 89 /// A suitable UUID for use in Second Life client communication. If the string was not a valid ospa, then UUID.Zero
89 /// is returned. 90 /// is returned.
90 /// </returns> 91 /// </returns>
91 public static UUID ResolveOspa(string ospa, CommunicationsManager commsManager) 92 public static UUID ResolveOspa(string ospa, IUserAccountService userService)
92 { 93 {
93 if (!ospa.StartsWith(OSPA_PREFIX)) 94 if (!ospa.StartsWith(OSPA_PREFIX))
94 return UUID.Zero; 95 return UUID.Zero;
@@ -112,7 +113,7 @@ namespace OpenSim.Framework.Communications.Osp
112 string value = tuple.Substring(tupleSeparatorIndex + 1).Trim(); 113 string value = tuple.Substring(tupleSeparatorIndex + 1).Trim();
113 114
114 if (OSPA_NAME_KEY == key) 115 if (OSPA_NAME_KEY == key)
115 return ResolveOspaName(value, commsManager); 116 return ResolveOspaName(value, userService);
116 } 117 }
117 118
118 return UUID.Zero; 119 return UUID.Zero;
@@ -137,7 +138,7 @@ namespace OpenSim.Framework.Communications.Osp
137 /// <returns> 138 /// <returns>
138 /// An OpenSim internal identifier for the name given. Returns null if the name was not valid 139 /// An OpenSim internal identifier for the name given. Returns null if the name was not valid
139 /// </returns> 140 /// </returns>
140 protected static UUID ResolveOspaName(string name, CommunicationsManager commsManager) 141 protected static UUID ResolveOspaName(string name, IUserAccountService userService)
141 { 142 {
142 int nameSeparatorIndex = name.IndexOf(OSPA_NAME_VALUE_SEPARATOR); 143 int nameSeparatorIndex = name.IndexOf(OSPA_NAME_VALUE_SEPARATOR);
143 144
@@ -150,9 +151,9 @@ namespace OpenSim.Framework.Communications.Osp
150 string firstName = name.Remove(nameSeparatorIndex).TrimEnd(); 151 string firstName = name.Remove(nameSeparatorIndex).TrimEnd();
151 string lastName = name.Substring(nameSeparatorIndex + 1).TrimStart(); 152 string lastName = name.Substring(nameSeparatorIndex + 1).TrimStart();
152 153
153 CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(firstName, lastName); 154 UserAccount account = userService.GetUserAccount(UUID.Zero, firstName, lastName);
154 if (userInfo != null) 155 if (account != null)
155 return userInfo.UserProfile.ID; 156 return account.PrincipalID;
156 157
157 // XXX: Disable temporary user profile creation for now as implementation is incomplete - justincc 158 // XXX: Disable temporary user profile creation for now as implementation is incomplete - justincc
158 /* 159 /*