aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Communications')
-rw-r--r--OpenSim/Framework/Communications/CommunicationsManager.cs63
-rw-r--r--OpenSim/Framework/Communications/Osp/OspInventoryWrapperPlugin.cs10
-rw-r--r--OpenSim/Framework/Communications/Osp/OspResolver.cs21
3 files changed, 17 insertions, 77 deletions
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs
index 52f6202..d215340 100644
--- a/OpenSim/Framework/Communications/CommunicationsManager.cs
+++ b/OpenSim/Framework/Communications/CommunicationsManager.cs
@@ -135,69 +135,6 @@ namespace OpenSim.Framework.Communications
135 return; 135 return;
136 } 136 }
137 137
138 public void HandleUUIDNameRequest(UUID uuid, IClientAPI remote_client)
139 {
140 if (uuid == m_userProfileCacheService.LibraryRoot.Owner)
141 {
142 remote_client.SendNameReply(uuid, "Mr", "OpenSim");
143 }
144 else
145 {
146 string[] names = doUUIDNameRequest(uuid);
147 if (names.Length == 2)
148 {
149 remote_client.SendNameReply(uuid, names[0], names[1]);
150 }
151
152 }
153 }
154
155 private string[] doUUIDNameRequest(UUID uuid)
156 {
157 lock (m_nameRequestCache)
158 {
159 if (m_nameRequestCache.ContainsKey(uuid))
160 return m_nameRequestCache[uuid];
161 }
162
163 string[] returnstring = new string[0];
164 CachedUserInfo uinfo = UserProfileCacheService.GetUserDetails(uuid);
165
166 if ((uinfo != null) && (uinfo.UserProfile != null))
167 {
168 returnstring = new string[2];
169 returnstring[0] = uinfo.UserProfile.FirstName;
170 returnstring[1] = uinfo.UserProfile.SurName;
171 lock (m_nameRequestCache)
172 {
173 if (!m_nameRequestCache.ContainsKey(uuid))
174 m_nameRequestCache.Add(uuid, returnstring);
175 }
176 }
177
178 return returnstring;
179 }
180
181 public bool UUIDNameCachedTest(UUID uuid)
182 {
183 lock (m_nameRequestCache)
184 return m_nameRequestCache.ContainsKey(uuid);
185 }
186
187 public string UUIDNameRequestString(UUID uuid)
188 {
189 string[] names = doUUIDNameRequest(uuid);
190 if (names.Length == 2)
191 {
192 string firstname = names[0];
193 string lastname = names[1];
194
195 return firstname + " " + lastname;
196
197 }
198 return "(hippos)";
199 }
200
201 public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(UUID queryID, string query) 138 public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(UUID queryID, string query)
202 { 139 {
203 List<AvatarPickerAvatar> pickerlist = m_userService.GenerateAgentPickerRequestResponse(queryID, query); 140 List<AvatarPickerAvatar> pickerlist = m_userService.GenerateAgentPickerRequestResponse(queryID, query);
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 /*