diff options
author | lbsa71 | 2009-04-09 16:45:22 +0000 |
---|---|---|
committer | lbsa71 | 2009-04-09 16:45:22 +0000 |
commit | d2a412e94bf3ef1e332d44b7106c606f26b1636b (patch) | |
tree | ba7535b2a55edf538e067d7ac72a1ee55943215e | |
parent | * Moved the DatabaseTestAttribute to Test.Common, and thus included ref to th... (diff) | |
download | opensim-SC_OLD-d2a412e94bf3ef1e332d44b7106c606f26b1636b.zip opensim-SC_OLD-d2a412e94bf3ef1e332d44b7106c606f26b1636b.tar.gz opensim-SC_OLD-d2a412e94bf3ef1e332d44b7106c606f26b1636b.tar.bz2 opensim-SC_OLD-d2a412e94bf3ef1e332d44b7106c606f26b1636b.tar.xz |
* Added some more experimental code; nothing wired in so far.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/AssetBase.cs | 31 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Cache/AssetCache.cs | 43 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs | 98 | ||||
-rw-r--r-- | OpenSim/Framework/Tests/AssetBaseTest.cs | 49 | ||||
-rw-r--r-- | OpenSim/Grid/UserServer.Modules/UserManager.cs | 108 |
5 files changed, 272 insertions, 57 deletions
diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs index 8e7e059..4e43cb7 100644 --- a/OpenSim/Framework/AssetBase.cs +++ b/OpenSim/Framework/AssetBase.cs | |||
@@ -49,6 +49,19 @@ namespace OpenSim.Framework | |||
49 | m_metadata.Name = name; | 49 | m_metadata.Name = name; |
50 | } | 50 | } |
51 | 51 | ||
52 | public bool ContainsReferences | ||
53 | { | ||
54 | get | ||
55 | { | ||
56 | return | ||
57 | IsTextualAsset && ( | ||
58 | Type != (sbyte)AssetType.Notecard | ||
59 | && Type != (sbyte)AssetType.CallingCard | ||
60 | && Type != (sbyte)AssetType.LSLText | ||
61 | && Type != (sbyte)AssetType.Landmark); | ||
62 | } | ||
63 | } | ||
64 | |||
52 | public bool IsTextualAsset | 65 | public bool IsTextualAsset |
53 | { | 66 | { |
54 | get | 67 | get |
@@ -62,10 +75,22 @@ namespace OpenSim.Framework | |||
62 | { | 75 | { |
63 | get | 76 | get |
64 | { | 77 | { |
65 | return | 78 | return |
66 | (Type == (sbyte) AssetType.Animation || | 79 | (Type == (sbyte) AssetType.Animation || |
67 | Type == (sbyte) AssetType.Gesture || | 80 | Type == (sbyte)AssetType.Gesture || |
68 | Type == (sbyte) AssetType.ImageJPEG || | 81 | Type == (sbyte)AssetType.Simstate || |
82 | Type == (sbyte)AssetType.Unknown || | ||
83 | Type == (sbyte)AssetType.Object || | ||
84 | Type == (sbyte)AssetType.Sound || | ||
85 | Type == (sbyte)AssetType.SoundWAV || | ||
86 | Type == (sbyte)AssetType.Texture || | ||
87 | Type == (sbyte)AssetType.TextureTGA || | ||
88 | Type == (sbyte)AssetType.Folder || | ||
89 | Type == (sbyte)AssetType.RootFolder || | ||
90 | Type == (sbyte)AssetType.LostAndFoundFolder || | ||
91 | Type == (sbyte)AssetType.SnapshotFolder || | ||
92 | Type == (sbyte)AssetType.TrashFolder || | ||
93 | Type == (sbyte)AssetType.ImageJPEG || | ||
69 | Type == (sbyte) AssetType.ImageTGA || | 94 | Type == (sbyte) AssetType.ImageTGA || |
70 | Type == (sbyte) AssetType.LSLBytecode); | 95 | Type == (sbyte) AssetType.LSLBytecode); |
71 | } | 96 | } |
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 | { |
diff --git a/OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs b/OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs index 70a398e..3779f55 100644 --- a/OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs +++ b/OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs | |||
@@ -25,6 +25,8 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
28 | using System.Threading; | 30 | using System.Threading; |
29 | using NUnit.Framework; | 31 | using NUnit.Framework; |
30 | using NUnit.Framework.SyntaxHelpers; | 32 | using NUnit.Framework.SyntaxHelpers; |
@@ -85,15 +87,105 @@ namespace OpenSim.Framework.Communications.Tests | |||
85 | } | 87 | } |
86 | } | 88 | } |
87 | 89 | ||
90 | private class FakeUserService : IUserService | ||
91 | { | ||
92 | public UserProfileData GetUserProfile(string firstName, string lastName) | ||
93 | { | ||
94 | throw new NotImplementedException(); | ||
95 | } | ||
96 | |||
97 | public UserProfileData GetUserProfile(UUID userId) | ||
98 | { | ||
99 | throw new NotImplementedException(); | ||
100 | } | ||
101 | |||
102 | public UserProfileData GetUserProfile(Uri uri) | ||
103 | { | ||
104 | UserProfileData userProfile = new UserProfileData(); | ||
105 | |||
106 | userProfile.ID = new UUID( Util.GetHashGuid( uri.ToString(), AssetCache.AssetInfo.Secret )); | ||
107 | |||
108 | return userProfile; | ||
109 | } | ||
110 | |||
111 | public UserAgentData GetAgentByUUID(UUID userId) | ||
112 | { | ||
113 | throw new NotImplementedException(); | ||
114 | } | ||
115 | |||
116 | public void ClearUserAgent(UUID avatarID) | ||
117 | { | ||
118 | throw new NotImplementedException(); | ||
119 | } | ||
120 | |||
121 | public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(UUID QueryID, string Query) | ||
122 | { | ||
123 | throw new NotImplementedException(); | ||
124 | } | ||
125 | |||
126 | public UserProfileData SetupMasterUser(string firstName, string lastName) | ||
127 | { | ||
128 | throw new NotImplementedException(); | ||
129 | } | ||
130 | |||
131 | public UserProfileData SetupMasterUser(string firstName, string lastName, string password) | ||
132 | { | ||
133 | throw new NotImplementedException(); | ||
134 | } | ||
135 | |||
136 | public UserProfileData SetupMasterUser(UUID userId) | ||
137 | { | ||
138 | throw new NotImplementedException(); | ||
139 | } | ||
140 | |||
141 | public bool UpdateUserProfile(UserProfileData data) | ||
142 | { | ||
143 | throw new NotImplementedException(); | ||
144 | } | ||
145 | |||
146 | public void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) | ||
147 | { | ||
148 | throw new NotImplementedException(); | ||
149 | } | ||
150 | |||
151 | public void RemoveUserFriend(UUID friendlistowner, UUID friend) | ||
152 | { | ||
153 | throw new NotImplementedException(); | ||
154 | } | ||
155 | |||
156 | public void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) | ||
157 | { | ||
158 | throw new NotImplementedException(); | ||
159 | } | ||
160 | |||
161 | public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat) | ||
162 | { | ||
163 | throw new NotImplementedException(); | ||
164 | } | ||
165 | |||
166 | public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz) | ||
167 | { | ||
168 | throw new NotImplementedException(); | ||
169 | } | ||
170 | |||
171 | public List<FriendListItem> GetUserFriendList(UUID friendlistowner) | ||
172 | { | ||
173 | throw new NotImplementedException(); | ||
174 | } | ||
175 | } | ||
176 | |||
88 | [Test] | 177 | [Test] |
89 | public void ProcessAssetDataTest() | 178 | public void TestProcessAssetData() |
90 | { | 179 | { |
91 | string url = "http://host/dir/"; | 180 | string url = "http://host/dir/"; |
92 | string data = " creator_url " + url + " "; | 181 | string creatorData = " creator_url " + url + " "; |
182 | string ownerData = " owner_url " + url + " "; | ||
93 | 183 | ||
94 | AssetCache assetCache = new AssetCache(); | 184 | AssetCache assetCache = new AssetCache(); |
185 | FakeUserService fakeUserService = new FakeUserService(); | ||
95 | 186 | ||
96 | Assert.AreEqual(" creator_id "+Util.GetHashGuid( url, AssetCache.AssetInfo.Secret )+" ", assetCache.ProcessAssetDataString( data )); | 187 | Assert.AreEqual(" creator_id " + Util.GetHashGuid(url, AssetCache.AssetInfo.Secret) + " ", assetCache.ProcessAssetDataString(creatorData, fakeUserService)); |
188 | Assert.AreEqual(" owner_id " + Util.GetHashGuid(url, AssetCache.AssetInfo.Secret) + " ", assetCache.ProcessAssetDataString(ownerData, fakeUserService)); | ||
97 | } | 189 | } |
98 | } | 190 | } |
99 | } | 191 | } |
diff --git a/OpenSim/Framework/Tests/AssetBaseTest.cs b/OpenSim/Framework/Tests/AssetBaseTest.cs new file mode 100644 index 0000000..800b41b --- /dev/null +++ b/OpenSim/Framework/Tests/AssetBaseTest.cs | |||
@@ -0,0 +1,49 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using NUnit.Framework; | ||
5 | using OpenMetaverse; | ||
6 | |||
7 | namespace OpenSim.Framework.Tests | ||
8 | { | ||
9 | [TestFixture] | ||
10 | public class AssetBaseTest | ||
11 | { | ||
12 | [Test] | ||
13 | public void TestContainsReferences() | ||
14 | { | ||
15 | TestContainsReferences(AssetType.Bodypart, true); | ||
16 | TestContainsReferences(AssetType.Clothing, true); | ||
17 | |||
18 | TestContainsReferences(AssetType.Animation, false); | ||
19 | TestContainsReferences(AssetType.CallingCard, false); | ||
20 | TestContainsReferences(AssetType.Folder , false); | ||
21 | TestContainsReferences(AssetType.Gesture , false); | ||
22 | TestContainsReferences(AssetType.ImageJPEG , false); | ||
23 | TestContainsReferences(AssetType.ImageTGA , false); | ||
24 | TestContainsReferences(AssetType.Landmark , false); | ||
25 | TestContainsReferences(AssetType.LostAndFoundFolder, false); | ||
26 | TestContainsReferences(AssetType.LSLBytecode, false); | ||
27 | TestContainsReferences(AssetType.LSLText, false); | ||
28 | TestContainsReferences(AssetType.Notecard, false); | ||
29 | TestContainsReferences(AssetType.Object, false); | ||
30 | TestContainsReferences(AssetType.RootFolder, false); | ||
31 | TestContainsReferences(AssetType.Simstate, false); | ||
32 | TestContainsReferences(AssetType.SnapshotFolder, false); | ||
33 | TestContainsReferences(AssetType.Sound, false); | ||
34 | TestContainsReferences(AssetType.SoundWAV, false); | ||
35 | TestContainsReferences(AssetType.Texture, false); | ||
36 | TestContainsReferences(AssetType.TextureTGA, false); | ||
37 | TestContainsReferences(AssetType.TrashFolder, false); | ||
38 | TestContainsReferences(AssetType.Unknown, false); | ||
39 | } | ||
40 | |||
41 | private void TestContainsReferences(AssetType assetType, bool expected) | ||
42 | { | ||
43 | AssetBase asset = new AssetBase(); | ||
44 | asset.Type = (sbyte)assetType; | ||
45 | bool actual = asset.ContainsReferences; | ||
46 | Assert.AreEqual(expected, actual, "Expected "+assetType+".ContainsReferences to be "+expected+" but was "+actual+"."); | ||
47 | } | ||
48 | } | ||
49 | } | ||
diff --git a/OpenSim/Grid/UserServer.Modules/UserManager.cs b/OpenSim/Grid/UserServer.Modules/UserManager.cs index c40201e..515c2bf 100644 --- a/OpenSim/Grid/UserServer.Modules/UserManager.cs +++ b/OpenSim/Grid/UserServer.Modules/UserManager.cs | |||
@@ -41,7 +41,7 @@ namespace OpenSim.Grid.UserServer.Modules | |||
41 | { | 41 | { |
42 | public delegate void logOffUser(UUID AgentID); | 42 | public delegate void logOffUser(UUID AgentID); |
43 | 43 | ||
44 | public class UserManager | 44 | public class UserManager |
45 | { | 45 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
@@ -50,12 +50,12 @@ namespace OpenSim.Grid.UserServer.Modules | |||
50 | 50 | ||
51 | private UserDataBaseService m_userDataBaseService; | 51 | private UserDataBaseService m_userDataBaseService; |
52 | private BaseHttpServer m_httpServer; | 52 | private BaseHttpServer m_httpServer; |
53 | 53 | ||
54 | /// <summary> | 54 | /// <summary> |
55 | /// | 55 | /// |
56 | /// </summary> | 56 | /// </summary> |
57 | /// <param name="userDataBaseService"></param> | 57 | /// <param name="userDataBaseService"></param> |
58 | public UserManager( UserDataBaseService userDataBaseService) | 58 | public UserManager(UserDataBaseService userDataBaseService) |
59 | { | 59 | { |
60 | m_userDataBaseService = userDataBaseService; | 60 | m_userDataBaseService = userDataBaseService; |
61 | } | 61 | } |
@@ -70,10 +70,38 @@ namespace OpenSim.Grid.UserServer.Modules | |||
70 | 70 | ||
71 | } | 71 | } |
72 | 72 | ||
73 | private string RESTGetUserProfile(string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
74 | { | ||
75 | UUID id; | ||
76 | UserProfileData userProfile; | ||
77 | |||
78 | try | ||
79 | { | ||
80 | id = new UUID(param); | ||
81 | } | ||
82 | catch (Exception) | ||
83 | { | ||
84 | httpResponse.StatusCode = 500; | ||
85 | return "Malformed Param [" + param + "]"; | ||
86 | } | ||
87 | |||
88 | userProfile = m_userDataBaseService.GetUserProfile(id); | ||
89 | |||
90 | if (userProfile == null) | ||
91 | { | ||
92 | httpResponse.StatusCode = 404; | ||
93 | return "Not Found."; | ||
94 | } | ||
95 | |||
96 | return ProfileToXmlRPCResponse(userProfile).ToString(); | ||
97 | } | ||
98 | |||
73 | public void RegisterHandlers(BaseHttpServer httpServer) | 99 | public void RegisterHandlers(BaseHttpServer httpServer) |
74 | { | 100 | { |
75 | m_httpServer = httpServer; | 101 | m_httpServer = httpServer; |
76 | 102 | ||
103 | m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/users/", RESTGetUserProfile)); | ||
104 | |||
77 | m_httpServer.AddXmlRPCHandler("get_user_by_name", XmlRPCGetUserMethodName); | 105 | m_httpServer.AddXmlRPCHandler("get_user_by_name", XmlRPCGetUserMethodName); |
78 | m_httpServer.AddXmlRPCHandler("get_user_by_uuid", XmlRPCGetUserMethodUUID); | 106 | m_httpServer.AddXmlRPCHandler("get_user_by_uuid", XmlRPCGetUserMethodUUID); |
79 | m_httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", XmlRPCGetAvatarPickerAvatar); | 107 | m_httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", XmlRPCGetAvatarPickerAvatar); |
@@ -191,24 +219,24 @@ namespace OpenSim.Grid.UserServer.Modules | |||
191 | public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request) | 219 | public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request) |
192 | { | 220 | { |
193 | // XmlRpcResponse response = new XmlRpcResponse(); | 221 | // XmlRpcResponse response = new XmlRpcResponse(); |
194 | Hashtable requestData = (Hashtable) request.Params[0]; | 222 | Hashtable requestData = (Hashtable)request.Params[0]; |
195 | List<AvatarPickerAvatar> returnAvatar = new List<AvatarPickerAvatar>(); | 223 | List<AvatarPickerAvatar> returnAvatar = new List<AvatarPickerAvatar>(); |
196 | UUID queryID = new UUID(UUID.Zero.ToString()); | 224 | UUID queryID = new UUID(UUID.Zero.ToString()); |
197 | 225 | ||
198 | if (requestData.Contains("avquery") && requestData.Contains("queryid")) | 226 | if (requestData.Contains("avquery") && requestData.Contains("queryid")) |
199 | { | 227 | { |
200 | queryID = new UUID((string) requestData["queryid"]); | 228 | queryID = new UUID((string)requestData["queryid"]); |
201 | returnAvatar = m_userDataBaseService.GenerateAgentPickerRequestResponse(queryID, (string) requestData["avquery"]); | 229 | returnAvatar = m_userDataBaseService.GenerateAgentPickerRequestResponse(queryID, (string)requestData["avquery"]); |
202 | } | 230 | } |
203 | 231 | ||
204 | m_log.InfoFormat("[AVATARINFO]: Servicing Avatar Query: " + (string) requestData["avquery"]); | 232 | m_log.InfoFormat("[AVATARINFO]: Servicing Avatar Query: " + (string)requestData["avquery"]); |
205 | return AvatarPickerListtoXmlRPCResponse(queryID, returnAvatar); | 233 | return AvatarPickerListtoXmlRPCResponse(queryID, returnAvatar); |
206 | } | 234 | } |
207 | 235 | ||
208 | public XmlRpcResponse XmlRPCAtRegion(XmlRpcRequest request) | 236 | public XmlRpcResponse XmlRPCAtRegion(XmlRpcRequest request) |
209 | { | 237 | { |
210 | XmlRpcResponse response = new XmlRpcResponse(); | 238 | XmlRpcResponse response = new XmlRpcResponse(); |
211 | Hashtable requestData = (Hashtable) request.Params[0]; | 239 | Hashtable requestData = (Hashtable)request.Params[0]; |
212 | Hashtable responseData = new Hashtable(); | 240 | Hashtable responseData = new Hashtable(); |
213 | string returnstring = "FALSE"; | 241 | string returnstring = "FALSE"; |
214 | 242 | ||
@@ -219,14 +247,14 @@ namespace OpenSim.Grid.UserServer.Modules | |||
219 | UUID regionUUID; | 247 | UUID regionUUID; |
220 | UUID avatarUUID; | 248 | UUID avatarUUID; |
221 | 249 | ||
222 | UUID.TryParse((string) requestData["avatar_id"], out avatarUUID); | 250 | UUID.TryParse((string)requestData["avatar_id"], out avatarUUID); |
223 | UUID.TryParse((string) requestData["region_uuid"], out regionUUID); | 251 | UUID.TryParse((string)requestData["region_uuid"], out regionUUID); |
224 | 252 | ||
225 | if (avatarUUID != UUID.Zero) | 253 | if (avatarUUID != UUID.Zero) |
226 | { | 254 | { |
227 | UserProfileData userProfile = m_userDataBaseService.GetUserProfile(avatarUUID); | 255 | UserProfileData userProfile = m_userDataBaseService.GetUserProfile(avatarUUID); |
228 | userProfile.CurrentAgent.Region = regionUUID; | 256 | userProfile.CurrentAgent.Region = regionUUID; |
229 | userProfile.CurrentAgent.Handle = (ulong) Convert.ToInt64((string) requestData["region_handle"]); | 257 | userProfile.CurrentAgent.Handle = (ulong)Convert.ToInt64((string)requestData["region_handle"]); |
230 | //userProfile.CurrentAgent. | 258 | //userProfile.CurrentAgent. |
231 | m_userDataBaseService.CommitAgent(ref userProfile); | 259 | m_userDataBaseService.CommitAgent(ref userProfile); |
232 | //setUserProfile(userProfile); | 260 | //setUserProfile(userProfile); |
@@ -243,11 +271,11 @@ namespace OpenSim.Grid.UserServer.Modules | |||
243 | public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request) | 271 | public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request) |
244 | { | 272 | { |
245 | // XmlRpcResponse response = new XmlRpcResponse(); | 273 | // XmlRpcResponse response = new XmlRpcResponse(); |
246 | Hashtable requestData = (Hashtable) request.Params[0]; | 274 | Hashtable requestData = (Hashtable)request.Params[0]; |
247 | UserProfileData userProfile; | 275 | UserProfileData userProfile; |
248 | if (requestData.Contains("avatar_name")) | 276 | if (requestData.Contains("avatar_name")) |
249 | { | 277 | { |
250 | string query = (string) requestData["avatar_name"]; | 278 | string query = (string)requestData["avatar_name"]; |
251 | 279 | ||
252 | if (null == query) | 280 | if (null == query) |
253 | return CreateUnknownUserErrorResponse(); | 281 | return CreateUnknownUserErrorResponse(); |
@@ -280,7 +308,7 @@ namespace OpenSim.Grid.UserServer.Modules | |||
280 | public XmlRpcResponse XmlRPCGetUserMethodUUID(XmlRpcRequest request) | 308 | public XmlRpcResponse XmlRPCGetUserMethodUUID(XmlRpcRequest request) |
281 | { | 309 | { |
282 | // XmlRpcResponse response = new XmlRpcResponse(); | 310 | // XmlRpcResponse response = new XmlRpcResponse(); |
283 | Hashtable requestData = (Hashtable) request.Params[0]; | 311 | Hashtable requestData = (Hashtable)request.Params[0]; |
284 | UserProfileData userProfile; | 312 | UserProfileData userProfile; |
285 | //CFK: this clogs the UserServer log and is not necessary at this time. | 313 | //CFK: this clogs the UserServer log and is not necessary at this time. |
286 | //CFK: m_log.Debug("METHOD BY UUID CALLED"); | 314 | //CFK: m_log.Debug("METHOD BY UUID CALLED"); |
@@ -288,7 +316,7 @@ namespace OpenSim.Grid.UserServer.Modules | |||
288 | { | 316 | { |
289 | try | 317 | try |
290 | { | 318 | { |
291 | UUID guess = new UUID((string) requestData["avatar_uuid"]); | 319 | UUID guess = new UUID((string)requestData["avatar_uuid"]); |
292 | 320 | ||
293 | userProfile = m_userDataBaseService.GetUserProfile(guess); | 321 | userProfile = m_userDataBaseService.GetUserProfile(guess); |
294 | } | 322 | } |
@@ -313,7 +341,7 @@ namespace OpenSim.Grid.UserServer.Modules | |||
313 | public XmlRpcResponse XmlRPCGetAgentMethodUUID(XmlRpcRequest request) | 341 | public XmlRpcResponse XmlRPCGetAgentMethodUUID(XmlRpcRequest request) |
314 | { | 342 | { |
315 | XmlRpcResponse response = new XmlRpcResponse(); | 343 | XmlRpcResponse response = new XmlRpcResponse(); |
316 | Hashtable requestData = (Hashtable) request.Params[0]; | 344 | Hashtable requestData = (Hashtable)request.Params[0]; |
317 | UserProfileData userProfile; | 345 | UserProfileData userProfile; |
318 | //CFK: this clogs the UserServer log and is not necessary at this time. | 346 | //CFK: this clogs the UserServer log and is not necessary at this time. |
319 | //CFK: m_log.Debug("METHOD BY UUID CALLED"); | 347 | //CFK: m_log.Debug("METHOD BY UUID CALLED"); |
@@ -321,7 +349,7 @@ namespace OpenSim.Grid.UserServer.Modules | |||
321 | { | 349 | { |
322 | UUID guess; | 350 | UUID guess; |
323 | 351 | ||
324 | UUID.TryParse((string) requestData["avatar_uuid"], out guess); | 352 | UUID.TryParse((string)requestData["avatar_uuid"], out guess); |
325 | 353 | ||
326 | if (guess == UUID.Zero) | 354 | if (guess == UUID.Zero) |
327 | { | 355 | { |
@@ -362,7 +390,7 @@ namespace OpenSim.Grid.UserServer.Modules | |||
362 | public XmlRpcResponse XmlRPCCheckAuthSession(XmlRpcRequest request) | 390 | public XmlRpcResponse XmlRPCCheckAuthSession(XmlRpcRequest request) |
363 | { | 391 | { |
364 | XmlRpcResponse response = new XmlRpcResponse(); | 392 | XmlRpcResponse response = new XmlRpcResponse(); |
365 | Hashtable requestData = (Hashtable) request.Params[0]; | 393 | Hashtable requestData = (Hashtable)request.Params[0]; |
366 | UserProfileData userProfile; | 394 | UserProfileData userProfile; |
367 | 395 | ||
368 | string authed = "FALSE"; | 396 | string authed = "FALSE"; |
@@ -371,12 +399,12 @@ namespace OpenSim.Grid.UserServer.Modules | |||
371 | UUID guess_aid; | 399 | UUID guess_aid; |
372 | UUID guess_sid; | 400 | UUID guess_sid; |
373 | 401 | ||
374 | UUID.TryParse((string) requestData["avatar_uuid"], out guess_aid); | 402 | UUID.TryParse((string)requestData["avatar_uuid"], out guess_aid); |
375 | if (guess_aid == UUID.Zero) | 403 | if (guess_aid == UUID.Zero) |
376 | { | 404 | { |
377 | return CreateUnknownUserErrorResponse(); | 405 | return CreateUnknownUserErrorResponse(); |
378 | } | 406 | } |
379 | UUID.TryParse((string) requestData["session_id"], out guess_sid); | 407 | UUID.TryParse((string)requestData["session_id"], out guess_sid); |
380 | if (guess_sid == UUID.Zero) | 408 | if (guess_sid == UUID.Zero) |
381 | { | 409 | { |
382 | return CreateUnknownUserErrorResponse(); | 410 | return CreateUnknownUserErrorResponse(); |
@@ -404,7 +432,7 @@ namespace OpenSim.Grid.UserServer.Modules | |||
404 | { | 432 | { |
405 | m_log.Debug("[UserManager]: Got request to update user profile"); | 433 | m_log.Debug("[UserManager]: Got request to update user profile"); |
406 | XmlRpcResponse response = new XmlRpcResponse(); | 434 | XmlRpcResponse response = new XmlRpcResponse(); |
407 | Hashtable requestData = (Hashtable) request.Params[0]; | 435 | Hashtable requestData = (Hashtable)request.Params[0]; |
408 | Hashtable responseData = new Hashtable(); | 436 | Hashtable responseData = new Hashtable(); |
409 | 437 | ||
410 | if (!requestData.Contains("avatar_uuid")) | 438 | if (!requestData.Contains("avatar_uuid")) |
@@ -412,7 +440,7 @@ namespace OpenSim.Grid.UserServer.Modules | |||
412 | return CreateUnknownUserErrorResponse(); | 440 | return CreateUnknownUserErrorResponse(); |
413 | } | 441 | } |
414 | 442 | ||
415 | UUID UserUUID = new UUID((string) requestData["avatar_uuid"]); | 443 | UUID UserUUID = new UUID((string)requestData["avatar_uuid"]); |
416 | UserProfileData userProfile = m_userDataBaseService.GetUserProfile(UserUUID); | 444 | UserProfileData userProfile = m_userDataBaseService.GetUserProfile(UserUUID); |
417 | if (null == userProfile) | 445 | if (null == userProfile) |
418 | { | 446 | { |
@@ -424,11 +452,11 @@ namespace OpenSim.Grid.UserServer.Modules | |||
424 | } | 452 | } |
425 | if (requestData.Contains("FLImageID")) | 453 | if (requestData.Contains("FLImageID")) |
426 | { | 454 | { |
427 | userProfile.FirstLifeImage = new UUID((string) requestData["FLImageID"]); | 455 | userProfile.FirstLifeImage = new UUID((string)requestData["FLImageID"]); |
428 | } | 456 | } |
429 | if (requestData.Contains("ImageID")) | 457 | if (requestData.Contains("ImageID")) |
430 | { | 458 | { |
431 | userProfile.Image = new UUID((string) requestData["ImageID"]); | 459 | userProfile.Image = new UUID((string)requestData["ImageID"]); |
432 | } | 460 | } |
433 | // dont' know how yet | 461 | // dont' know how yet |
434 | if (requestData.Contains("MaturePublish")) | 462 | if (requestData.Contains("MaturePublish")) |
@@ -436,11 +464,11 @@ namespace OpenSim.Grid.UserServer.Modules | |||
436 | } | 464 | } |
437 | if (requestData.Contains("AboutText")) | 465 | if (requestData.Contains("AboutText")) |
438 | { | 466 | { |
439 | userProfile.AboutText = (string) requestData["AboutText"]; | 467 | userProfile.AboutText = (string)requestData["AboutText"]; |
440 | } | 468 | } |
441 | if (requestData.Contains("FLAboutText")) | 469 | if (requestData.Contains("FLAboutText")) |
442 | { | 470 | { |
443 | userProfile.FirstLifeAboutText = (string) requestData["FLAboutText"]; | 471 | userProfile.FirstLifeAboutText = (string)requestData["FLAboutText"]; |
444 | } | 472 | } |
445 | // not in DB yet. | 473 | // not in DB yet. |
446 | if (requestData.Contains("ProfileURL")) | 474 | if (requestData.Contains("ProfileURL")) |
@@ -450,7 +478,7 @@ namespace OpenSim.Grid.UserServer.Modules | |||
450 | { | 478 | { |
451 | try | 479 | try |
452 | { | 480 | { |
453 | userProfile.HomeRegion = Convert.ToUInt64((string) requestData["home_region"]); | 481 | userProfile.HomeRegion = Convert.ToUInt64((string)requestData["home_region"]); |
454 | } | 482 | } |
455 | catch (ArgumentException) | 483 | catch (ArgumentException) |
456 | { | 484 | { |
@@ -468,14 +496,14 @@ namespace OpenSim.Grid.UserServer.Modules | |||
468 | if (requestData.Contains("home_region_id")) | 496 | if (requestData.Contains("home_region_id")) |
469 | { | 497 | { |
470 | UUID regionID; | 498 | UUID regionID; |
471 | UUID.TryParse((string) requestData["home_region_id"], out regionID); | 499 | UUID.TryParse((string)requestData["home_region_id"], out regionID); |
472 | userProfile.HomeRegionID = regionID; | 500 | userProfile.HomeRegionID = regionID; |
473 | } | 501 | } |
474 | if (requestData.Contains("home_pos_x")) | 502 | if (requestData.Contains("home_pos_x")) |
475 | { | 503 | { |
476 | try | 504 | try |
477 | { | 505 | { |
478 | userProfile.HomeLocationX = (float) Convert.ToDecimal((string) requestData["home_pos_x"]); | 506 | userProfile.HomeLocationX = (float)Convert.ToDecimal((string)requestData["home_pos_x"]); |
479 | } | 507 | } |
480 | catch (InvalidCastException) | 508 | catch (InvalidCastException) |
481 | { | 509 | { |
@@ -486,7 +514,7 @@ namespace OpenSim.Grid.UserServer.Modules | |||
486 | { | 514 | { |
487 | try | 515 | try |
488 | { | 516 | { |
489 | userProfile.HomeLocationY = (float) Convert.ToDecimal((string) requestData["home_pos_y"]); | 517 | userProfile.HomeLocationY = (float)Convert.ToDecimal((string)requestData["home_pos_y"]); |
490 | } | 518 | } |
491 | catch (InvalidCastException) | 519 | catch (InvalidCastException) |
492 | { | 520 | { |
@@ -497,7 +525,7 @@ namespace OpenSim.Grid.UserServer.Modules | |||
497 | { | 525 | { |
498 | try | 526 | try |
499 | { | 527 | { |
500 | userProfile.HomeLocationZ = (float) Convert.ToDecimal((string) requestData["home_pos_z"]); | 528 | userProfile.HomeLocationZ = (float)Convert.ToDecimal((string)requestData["home_pos_z"]); |
501 | } | 529 | } |
502 | catch (InvalidCastException) | 530 | catch (InvalidCastException) |
503 | { | 531 | { |
@@ -508,7 +536,7 @@ namespace OpenSim.Grid.UserServer.Modules | |||
508 | { | 536 | { |
509 | try | 537 | try |
510 | { | 538 | { |
511 | userProfile.HomeLookAtX = (float) Convert.ToDecimal((string) requestData["home_look_x"]); | 539 | userProfile.HomeLookAtX = (float)Convert.ToDecimal((string)requestData["home_look_x"]); |
512 | } | 540 | } |
513 | catch (InvalidCastException) | 541 | catch (InvalidCastException) |
514 | { | 542 | { |
@@ -519,7 +547,7 @@ namespace OpenSim.Grid.UserServer.Modules | |||
519 | { | 547 | { |
520 | try | 548 | try |
521 | { | 549 | { |
522 | userProfile.HomeLookAtY = (float) Convert.ToDecimal((string) requestData["home_look_y"]); | 550 | userProfile.HomeLookAtY = (float)Convert.ToDecimal((string)requestData["home_look_y"]); |
523 | } | 551 | } |
524 | catch (InvalidCastException) | 552 | catch (InvalidCastException) |
525 | { | 553 | { |
@@ -530,7 +558,7 @@ namespace OpenSim.Grid.UserServer.Modules | |||
530 | { | 558 | { |
531 | try | 559 | try |
532 | { | 560 | { |
533 | userProfile.HomeLookAtZ = (float) Convert.ToDecimal((string) requestData["home_look_z"]); | 561 | userProfile.HomeLookAtZ = (float)Convert.ToDecimal((string)requestData["home_look_z"]); |
534 | } | 562 | } |
535 | catch (InvalidCastException) | 563 | catch (InvalidCastException) |
536 | { | 564 | { |
@@ -541,7 +569,7 @@ namespace OpenSim.Grid.UserServer.Modules | |||
541 | { | 569 | { |
542 | try | 570 | try |
543 | { | 571 | { |
544 | userProfile.UserFlags = Convert.ToInt32((string) requestData["user_flags"]); | 572 | userProfile.UserFlags = Convert.ToInt32((string)requestData["user_flags"]); |
545 | } | 573 | } |
546 | catch (InvalidCastException) | 574 | catch (InvalidCastException) |
547 | { | 575 | { |
@@ -552,7 +580,7 @@ namespace OpenSim.Grid.UserServer.Modules | |||
552 | { | 580 | { |
553 | try | 581 | try |
554 | { | 582 | { |
555 | userProfile.GodLevel = Convert.ToInt32((string) requestData["god_level"]); | 583 | userProfile.GodLevel = Convert.ToInt32((string)requestData["god_level"]); |
556 | } | 584 | } |
557 | catch (InvalidCastException) | 585 | catch (InvalidCastException) |
558 | { | 586 | { |
@@ -563,7 +591,7 @@ namespace OpenSim.Grid.UserServer.Modules | |||
563 | { | 591 | { |
564 | try | 592 | try |
565 | { | 593 | { |
566 | userProfile.CustomType = (string) requestData["custom_type"]; | 594 | userProfile.CustomType = (string)requestData["custom_type"]; |
567 | } | 595 | } |
568 | catch (InvalidCastException) | 596 | catch (InvalidCastException) |
569 | { | 597 | { |
@@ -574,7 +602,7 @@ namespace OpenSim.Grid.UserServer.Modules | |||
574 | { | 602 | { |
575 | try | 603 | try |
576 | { | 604 | { |
577 | userProfile.Partner = new UUID((string) requestData["partner"]); | 605 | userProfile.Partner = new UUID((string)requestData["partner"]); |
578 | } | 606 | } |
579 | catch (InvalidCastException) | 607 | catch (InvalidCastException) |
580 | { | 608 | { |
@@ -596,7 +624,7 @@ namespace OpenSim.Grid.UserServer.Modules | |||
596 | public XmlRpcResponse XmlRPCLogOffUserMethodUUID(XmlRpcRequest request) | 624 | public XmlRpcResponse XmlRPCLogOffUserMethodUUID(XmlRpcRequest request) |
597 | { | 625 | { |
598 | XmlRpcResponse response = new XmlRpcResponse(); | 626 | XmlRpcResponse response = new XmlRpcResponse(); |
599 | Hashtable requestData = (Hashtable) request.Params[0]; | 627 | Hashtable requestData = (Hashtable)request.Params[0]; |
600 | 628 | ||
601 | if (requestData.Contains("avatar_uuid")) | 629 | if (requestData.Contains("avatar_uuid")) |
602 | { | 630 | { |
@@ -685,6 +713,6 @@ namespace OpenSim.Grid.UserServer.Modules | |||
685 | public void HandleRegionShutdown(UUID regionID) | 713 | public void HandleRegionShutdown(UUID regionID) |
686 | { | 714 | { |
687 | m_userDataBaseService.LogoutUsers(regionID); | 715 | m_userDataBaseService.LogoutUsers(regionID); |
688 | } | 716 | } |
689 | } | 717 | } |
690 | } | 718 | } |