diff options
author | Diva Canto | 2010-01-09 09:09:32 -0800 |
---|---|---|
committer | Diva Canto | 2010-01-09 09:09:32 -0800 |
commit | 25fdbd6cbcfc857c444042745d7d4fa8e495a982 (patch) | |
tree | d3b1479ca58d2348ba83b422dcfb5abb0bb58766 /OpenSim | |
parent | A few more inches... Old friends things removed. Less references to UserProfi... (diff) | |
download | opensim-SC_OLD-25fdbd6cbcfc857c444042745d7d4fa8e495a982.zip opensim-SC_OLD-25fdbd6cbcfc857c444042745d7d4fa8e495a982.tar.gz opensim-SC_OLD-25fdbd6cbcfc857c444042745d7d4fa8e495a982.tar.bz2 opensim-SC_OLD-25fdbd6cbcfc857c444042745d7d4fa8e495a982.tar.xz |
Less refs to UserProfileCacheService. Compiles but likely doesn't run.
Diffstat (limited to '')
10 files changed, 163 insertions, 113 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 @@ | |||
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using OpenSim.Data; | 29 | using OpenSim.Data; |
30 | using OpenMetaverse; | 30 | using OpenMetaverse; |
31 | using OpenSim.Services.Interfaces; | ||
31 | 32 | ||
32 | namespace OpenSim.Framework.Communications.Osp | 33 | namespace 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; | |||
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Framework.Communications.Cache; | 33 | using OpenSim.Framework.Communications.Cache; |
34 | using OpenSim.Services.Interfaces; | ||
34 | 35 | ||
35 | namespace OpenSim.Framework.Communications.Osp | 36 | namespace 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 | /* |
diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs index 61b6d65..db94d2a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs | |||
@@ -130,7 +130,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule | |||
130 | } | 130 | } |
131 | else | 131 | else |
132 | { | 132 | { |
133 | string killer = DeadAvatar.Scene.CommsManager.UUIDNameRequestString(part.OwnerID); | 133 | string killer = DeadAvatar.Scene.GetUserName(part.OwnerID); |
134 | DeadAvatar.ControllingClient.SendAgentAlertMessage("You impaled yourself on " + part.Name + " owned by " + killer +"!", true); | 134 | DeadAvatar.ControllingClient.SendAgentAlertMessage("You impaled yourself on " + part.Name + " owned by " + killer +"!", true); |
135 | } | 135 | } |
136 | //DeadAvatar.Scene. part.ObjectOwner | 136 | //DeadAvatar.Scene. part.ObjectOwner |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 160a9bd..3417c87 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -357,7 +357,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
357 | // Don't use the item ID that's in the file | 357 | // Don't use the item ID that's in the file |
358 | item.ID = UUID.Random(); | 358 | item.ID = UUID.Random(); |
359 | 359 | ||
360 | UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.CommsManager); | 360 | UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.UserAccountService); |
361 | if (UUID.Zero != ospResolvedId) | 361 | if (UUID.Zero != ospResolvedId) |
362 | { | 362 | { |
363 | item.CreatorIdAsUuid = ospResolvedId; | 363 | item.CreatorIdAsUuid = ospResolvedId; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index 98b686e..8f75983 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -148,7 +148,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
148 | m_userUuids[inventoryItem.CreatorIdAsUuid] = 1; | 148 | m_userUuids[inventoryItem.CreatorIdAsUuid] = 1; |
149 | 149 | ||
150 | InventoryItemBase saveItem = (InventoryItemBase)inventoryItem.Clone(); | 150 | InventoryItemBase saveItem = (InventoryItemBase)inventoryItem.Clone(); |
151 | saveItem.CreatorId = OspResolver.MakeOspa(saveItem.CreatorIdAsUuid, m_scene.CommsManager); | 151 | saveItem.CreatorId = OspResolver.MakeOspa(saveItem.CreatorIdAsUuid, m_scene.UserAccountService); |
152 | 152 | ||
153 | string serialization = UserInventoryItemSerializer.Serialize(saveItem); | 153 | string serialization = UserInventoryItemSerializer.Serialize(saveItem); |
154 | m_archiveWriter.WriteFile(filename, serialization); | 154 | m_archiveWriter.WriteFile(filename, serialization); |
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index b1dcb14..5b82d4c 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -649,16 +649,9 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
649 | lsri.TaskID = sog.UUID; | 649 | lsri.TaskID = sog.UUID; |
650 | lsri.TaskLocalID = sog.LocalId; | 650 | lsri.TaskLocalID = sog.LocalId; |
651 | lsri.TaskName = sog.GetPartName(obj); | 651 | lsri.TaskName = sog.GetPartName(obj); |
652 | if (m_scene.CommsManager.UUIDNameCachedTest(sog.OwnerID)) | 652 | lsri.OwnerName = "waiting"; |
653 | { | 653 | lock (uuidNameLookupList) |
654 | lsri.OwnerName = m_scene.CommsManager.UUIDNameRequestString(sog.OwnerID); | 654 | uuidNameLookupList.Add(sog.OwnerID); |
655 | } | ||
656 | else | ||
657 | { | ||
658 | lsri.OwnerName = "waiting"; | ||
659 | lock (uuidNameLookupList) | ||
660 | uuidNameLookupList.Add(sog.OwnerID); | ||
661 | } | ||
662 | 655 | ||
663 | if (filter.Length != 0) | 656 | if (filter.Length != 0) |
664 | { | 657 | { |
@@ -709,7 +702,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
709 | for (int i = 0; i < uuidarr.Length; i++) | 702 | for (int i = 0; i < uuidarr.Length; i++) |
710 | { | 703 | { |
711 | // string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]); | 704 | // string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]); |
712 | m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]); | 705 | m_scene.GetUserName(uuidarr[i]); |
713 | // we drop it. It gets cached though... so we're ready for the next request. | 706 | // we drop it. It gets cached though... so we're ready for the next request. |
714 | } | 707 | } |
715 | } | 708 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 022d79d..139e0ca 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -33,6 +33,7 @@ using OpenMetaverse.Packets; | |||
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications; | 34 | using OpenSim.Framework.Communications; |
35 | using OpenSim.Framework.Communications.Cache; | 35 | using OpenSim.Framework.Communications.Cache; |
36 | using OpenSim.Services.Interfaces; | ||
36 | 37 | ||
37 | namespace OpenSim.Region.Framework.Scenes | 38 | namespace OpenSim.Region.Framework.Scenes |
38 | { | 39 | { |
@@ -415,7 +416,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
415 | } | 416 | } |
416 | ); | 417 | ); |
417 | } | 418 | } |
418 | 419 | ||
420 | public void HandleUUIDNameRequest(UUID uuid, IClientAPI remote_client) | ||
421 | { | ||
422 | if (uuid == CommsManager.UserProfileCacheService.LibraryRoot.Owner) | ||
423 | { | ||
424 | remote_client.SendNameReply(uuid, "Mr", "OpenSim"); | ||
425 | } | ||
426 | else | ||
427 | { | ||
428 | string[] names = GetUserNames(uuid); | ||
429 | if (names.Length == 2) | ||
430 | { | ||
431 | remote_client.SendNameReply(uuid, names[0], names[1]); | ||
432 | } | ||
433 | |||
434 | } | ||
435 | } | ||
436 | |||
419 | /// <summary> | 437 | /// <summary> |
420 | /// Handle a fetch inventory request from the client | 438 | /// Handle a fetch inventory request from the client |
421 | /// </summary> | 439 | /// </summary> |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index ef62b79..90d476e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -841,6 +841,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
841 | return m_simulatorVersion; | 841 | return m_simulatorVersion; |
842 | } | 842 | } |
843 | 843 | ||
844 | public string[] GetUserNames(UUID uuid) | ||
845 | { | ||
846 | string[] returnstring = new string[0]; | ||
847 | |||
848 | UserAccount account = UserAccountService.GetUserAccount(RegionInfo.ScopeID, uuid); | ||
849 | |||
850 | if (account != null) | ||
851 | { | ||
852 | returnstring = new string[2]; | ||
853 | returnstring[0] = account.FirstName; | ||
854 | returnstring[1] = account.LastName; | ||
855 | } | ||
856 | |||
857 | return returnstring; | ||
858 | } | ||
859 | |||
860 | public string GetUserName(UUID uuid) | ||
861 | { | ||
862 | string[] names = GetUserNames(uuid); | ||
863 | if (names.Length == 2) | ||
864 | { | ||
865 | string firstname = names[0]; | ||
866 | string lastname = names[1]; | ||
867 | |||
868 | return firstname + " " + lastname; | ||
869 | |||
870 | } | ||
871 | return "(hippos)"; | ||
872 | } | ||
873 | |||
844 | /// <summary> | 874 | /// <summary> |
845 | /// Another region is up. | 875 | /// Another region is up. |
846 | /// | 876 | /// |
@@ -2804,7 +2834,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2804 | 2834 | ||
2805 | public virtual void SubscribeToClientGridEvents(IClientAPI client) | 2835 | public virtual void SubscribeToClientGridEvents(IClientAPI client) |
2806 | { | 2836 | { |
2807 | client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest; | 2837 | client.OnNameFromUUIDRequest += HandleUUIDNameRequest; |
2808 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; | 2838 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; |
2809 | client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; | 2839 | client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; |
2810 | client.OnSetStartLocationRequest += SetHomeRezPoint; | 2840 | client.OnSetStartLocationRequest += SetHomeRezPoint; |
@@ -2959,7 +2989,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2959 | 2989 | ||
2960 | public virtual void UnSubscribeToClientGridEvents(IClientAPI client) | 2990 | public virtual void UnSubscribeToClientGridEvents(IClientAPI client) |
2961 | { | 2991 | { |
2962 | client.OnNameFromUUIDRequest -= CommsManager.HandleUUIDNameRequest; | 2992 | client.OnNameFromUUIDRequest -= HandleUUIDNameRequest; |
2963 | client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest; | 2993 | client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest; |
2964 | client.OnAvatarPickerRequest -= ProcessAvatarPickerRequest; | 2994 | client.OnAvatarPickerRequest -= ProcessAvatarPickerRequest; |
2965 | client.OnSetStartLocationRequest -= SetHomeRezPoint; | 2995 | client.OnSetStartLocationRequest -= SetHomeRezPoint; |
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index c14651d..dacfa51 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using Nini.Config; | 30 | using Nini.Config; |
31 | using OpenSim.Data; | 31 | using OpenSim.Data; |
32 | using OpenSim.Framework.Console; | ||
32 | using OpenSim.Services.Interfaces; | 33 | using OpenSim.Services.Interfaces; |
33 | using System.Collections.Generic; | 34 | using System.Collections.Generic; |
34 | using OpenMetaverse; | 35 | using OpenMetaverse; |
@@ -37,10 +38,17 @@ namespace OpenSim.Services.UserAccountService | |||
37 | { | 38 | { |
38 | public class UserAccountService : UserAccountServiceBase, IUserAccountService | 39 | public class UserAccountService : UserAccountServiceBase, IUserAccountService |
39 | { | 40 | { |
40 | public UserAccountService(IConfigSource config) : base(config) | 41 | public UserAccountService(IConfigSource config) |
42 | : base(config) | ||
41 | { | 43 | { |
44 | MainConsole.Instance.Commands.AddCommand("UserService", false, | ||
45 | "create user", | ||
46 | "create user [<first> [<last> [<pass> [<x> <y> [<email>]]]]]", | ||
47 | "Create a new user", HandleCreateUser); | ||
42 | } | 48 | } |
43 | 49 | ||
50 | #region IUserAccountService | ||
51 | |||
44 | public UserAccount GetUserAccount(UUID scopeID, string firstName, | 52 | public UserAccount GetUserAccount(UUID scopeID, string firstName, |
45 | string lastName) | 53 | string lastName) |
46 | { | 54 | { |
@@ -49,14 +57,14 @@ namespace OpenSim.Services.UserAccountService | |||
49 | if (scopeID != UUID.Zero) | 57 | if (scopeID != UUID.Zero) |
50 | { | 58 | { |
51 | d = m_Database.Get( | 59 | d = m_Database.Get( |
52 | new string[] {"ScopeID", "FirstName", "LastName"}, | 60 | new string[] { "ScopeID", "FirstName", "LastName" }, |
53 | new string[] {scopeID.ToString(), firstName, lastName}); | 61 | new string[] { scopeID.ToString(), firstName, lastName }); |
54 | } | 62 | } |
55 | else | 63 | else |
56 | { | 64 | { |
57 | d = m_Database.Get( | 65 | d = m_Database.Get( |
58 | new string[] {"FirstName", "LastName"}, | 66 | new string[] { "FirstName", "LastName" }, |
59 | new string[] {firstName, lastName}); | 67 | new string[] { firstName, lastName }); |
60 | } | 68 | } |
61 | 69 | ||
62 | if (d.Length < 1) | 70 | if (d.Length < 1) |
@@ -75,12 +83,12 @@ namespace OpenSim.Services.UserAccountService | |||
75 | u.Email = d.Data["Email"].ToString(); | 83 | u.Email = d.Data["Email"].ToString(); |
76 | u.Created = Convert.ToInt32(d.Data["Created"].ToString()); | 84 | u.Created = Convert.ToInt32(d.Data["Created"].ToString()); |
77 | 85 | ||
78 | string[] URLs = d.Data["ServiceURLs"].ToString().Split(new char[] {' '}); | 86 | string[] URLs = d.Data["ServiceURLs"].ToString().Split(new char[] { ' ' }); |
79 | u.ServiceURLs = new Dictionary<string, object>(); | 87 | u.ServiceURLs = new Dictionary<string, object>(); |
80 | 88 | ||
81 | foreach(string url in URLs) | 89 | foreach (string url in URLs) |
82 | { | 90 | { |
83 | string[] parts = url.Split(new char[] {'='}); | 91 | string[] parts = url.Split(new char[] { '=' }); |
84 | 92 | ||
85 | if (parts.Length != 2) | 93 | if (parts.Length != 2) |
86 | continue; | 94 | continue; |
@@ -101,14 +109,14 @@ namespace OpenSim.Services.UserAccountService | |||
101 | if (scopeID != UUID.Zero) | 109 | if (scopeID != UUID.Zero) |
102 | { | 110 | { |
103 | d = m_Database.Get( | 111 | d = m_Database.Get( |
104 | new string[] {"ScopeID", "Email"}, | 112 | new string[] { "ScopeID", "Email" }, |
105 | new string[] {scopeID.ToString(), email}); | 113 | new string[] { scopeID.ToString(), email }); |
106 | } | 114 | } |
107 | else | 115 | else |
108 | { | 116 | { |
109 | d = m_Database.Get( | 117 | d = m_Database.Get( |
110 | new string[] {"Email"}, | 118 | new string[] { "Email" }, |
111 | new string[] {email}); | 119 | new string[] { email }); |
112 | } | 120 | } |
113 | 121 | ||
114 | if (d.Length < 1) | 122 | if (d.Length < 1) |
@@ -116,7 +124,7 @@ namespace OpenSim.Services.UserAccountService | |||
116 | 124 | ||
117 | return MakeUserAccount(d[0]); | 125 | return MakeUserAccount(d[0]); |
118 | } | 126 | } |
119 | 127 | ||
120 | public UserAccount GetUserAccount(UUID scopeID, UUID principalID) | 128 | public UserAccount GetUserAccount(UUID scopeID, UUID principalID) |
121 | { | 129 | { |
122 | UserAccountData[] d; | 130 | UserAccountData[] d; |
@@ -124,14 +132,14 @@ namespace OpenSim.Services.UserAccountService | |||
124 | if (scopeID != UUID.Zero) | 132 | if (scopeID != UUID.Zero) |
125 | { | 133 | { |
126 | d = m_Database.Get( | 134 | d = m_Database.Get( |
127 | new string[] {"ScopeID", "PrincipalID"}, | 135 | new string[] { "ScopeID", "PrincipalID" }, |
128 | new string[] {scopeID.ToString(), principalID.ToString()}); | 136 | new string[] { scopeID.ToString(), principalID.ToString() }); |
129 | } | 137 | } |
130 | else | 138 | else |
131 | { | 139 | { |
132 | d = m_Database.Get( | 140 | d = m_Database.Get( |
133 | new string[] {"PrincipalID"}, | 141 | new string[] { "PrincipalID" }, |
134 | new string[] {principalID.ToString()}); | 142 | new string[] { principalID.ToString() }); |
135 | } | 143 | } |
136 | 144 | ||
137 | if (d.Length < 1) | 145 | if (d.Length < 1) |
@@ -148,13 +156,13 @@ namespace OpenSim.Services.UserAccountService | |||
148 | d.LastName = data.LastName; | 156 | d.LastName = data.LastName; |
149 | d.PrincipalID = data.PrincipalID; | 157 | d.PrincipalID = data.PrincipalID; |
150 | d.ScopeID = data.ScopeID; | 158 | d.ScopeID = data.ScopeID; |
151 | d.Data = new Dictionary<string,string>(); | 159 | d.Data = new Dictionary<string, string>(); |
152 | d.Data["Email"] = data.Email; | 160 | d.Data["Email"] = data.Email; |
153 | d.Data["Created"] = data.Created.ToString(); | 161 | d.Data["Created"] = data.Created.ToString(); |
154 | 162 | ||
155 | List<string> parts = new List<string>(); | 163 | List<string> parts = new List<string>(); |
156 | 164 | ||
157 | foreach (KeyValuePair<string,object> kvp in data.ServiceURLs) | 165 | foreach (KeyValuePair<string, object> kvp in data.ServiceURLs) |
158 | { | 166 | { |
159 | string key = System.Web.HttpUtility.UrlEncode(kvp.Key); | 167 | string key = System.Web.HttpUtility.UrlEncode(kvp.Key); |
160 | string val = System.Web.HttpUtility.UrlEncode(kvp.Value.ToString()); | 168 | string val = System.Web.HttpUtility.UrlEncode(kvp.Value.ToString()); |
@@ -180,5 +188,66 @@ namespace OpenSim.Services.UserAccountService | |||
180 | 188 | ||
181 | return ret; | 189 | return ret; |
182 | } | 190 | } |
191 | |||
192 | #endregion | ||
193 | |||
194 | #region Console commands | ||
195 | /// <summary> | ||
196 | /// Create a new user | ||
197 | /// </summary> | ||
198 | /// <param name="cmdparams">string array with parameters: firstname, lastname, password, locationX, locationY, email</param> | ||
199 | protected void HandleCreateUser(string module, string[] cmdparams) | ||
200 | { | ||
201 | string firstName; | ||
202 | string lastName; | ||
203 | string password; | ||
204 | string email; | ||
205 | uint regX = 1000; | ||
206 | uint regY = 1000; | ||
207 | |||
208 | // IConfig standalone; | ||
209 | // if ((standalone = m_config.Source.Configs["StandAlone"]) != null) | ||
210 | // { | ||
211 | // regX = (uint)standalone.GetInt("default_location_x", (int)regX); | ||
212 | // regY = (uint)standalone.GetInt("default_location_y", (int)regY); | ||
213 | // } | ||
214 | |||
215 | |||
216 | // if (cmdparams.Length < 3) | ||
217 | // firstName = MainConsole.Instance.CmdPrompt("First name", "Default"); | ||
218 | // else firstName = cmdparams[2]; | ||
219 | |||
220 | // if (cmdparams.Length < 4) | ||
221 | // lastName = MainConsole.Instance.CmdPrompt("Last name", "User"); | ||
222 | // else lastName = cmdparams[3]; | ||
223 | |||
224 | // if (cmdparams.Length < 5) | ||
225 | // password = MainConsole.Instance.PasswdPrompt("Password"); | ||
226 | // else password = cmdparams[4]; | ||
227 | |||
228 | // if (cmdparams.Length < 6) | ||
229 | // regX = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region X", regX.ToString())); | ||
230 | // else regX = Convert.ToUInt32(cmdparams[5]); | ||
231 | |||
232 | // if (cmdparams.Length < 7) | ||
233 | // regY = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region Y", regY.ToString())); | ||
234 | // else regY = Convert.ToUInt32(cmdparams[6]); | ||
235 | |||
236 | // if (cmdparams.Length < 8) | ||
237 | // email = MainConsole.Instance.CmdPrompt("Email", ""); | ||
238 | // else email = cmdparams[7]; | ||
239 | |||
240 | // if (null == m_commsManager.UserProfileCacheService.GetUserDetails(firstName, lastName)) | ||
241 | // { | ||
242 | // m_commsManager.UserAdminService.AddUser(firstName, lastName, password, email, regX, regY); | ||
243 | // } | ||
244 | // else | ||
245 | // { | ||
246 | // m_log.ErrorFormat("[CONSOLE]: A user with the name {0} {1} already exists!", firstName, lastName); | ||
247 | // } | ||
248 | //} | ||
249 | |||
250 | } | ||
251 | #endregion | ||
183 | } | 252 | } |
184 | } | 253 | } |