aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/ApplicationPlugins')
-rw-r--r--OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs219
-rw-r--r--OpenSim/ApplicationPlugins/CreateCommsManager/Resources/CreateCommsManagerPlugin.addin.xml11
-rw-r--r--OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs4
-rw-r--r--OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs28
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs496
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs26
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs18
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs373
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs398
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs8
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Regions/RegionDetails.cs9
11 files changed, 680 insertions, 910 deletions
diff --git a/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs b/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs
deleted file mode 100644
index 0f827b0..0000000
--- a/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs
+++ /dev/null
@@ -1,219 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using log4net;
32using OpenSim.Data;
33using OpenSim.Framework;
34using OpenSim.Framework.Communications;
35using OpenSim.Framework.Communications.Services;
36using OpenSim.Framework.Communications.Cache;
37using OpenSim.Framework.Communications.Osp;
38using OpenSim.Framework.Servers;
39using OpenSim.Framework.Servers.HttpServer;
40using OpenSim.Region.Communications.Hypergrid;
41using OpenSim.Region.Communications.Local;
42using OpenSim.Region.Communications.OGS1;
43
44namespace OpenSim.ApplicationPlugins.CreateCommsManager
45{
46 public class CreateCommsManagerPlugin : IApplicationPlugin
47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49
50 #region IApplicationPlugin Members
51
52 // TODO: required by IPlugin, but likely not at all right
53 private string m_name = "CreateCommsManagerPlugin";
54 private string m_version = "0.0";
55
56 public string Version
57 {
58 get { return m_version; }
59 }
60
61 public string Name
62 {
63 get { return m_name; }
64 }
65
66 protected OpenSimBase m_openSim;
67
68 protected BaseHttpServer m_httpServer;
69
70 protected CommunicationsManager m_commsManager;
71 protected GridInfoService m_gridInfoService;
72
73 protected IRegionCreator m_regionCreator;
74
75 public void Initialise()
76 {
77 m_log.Info("[LOADREGIONS]: " + Name + " cannot be default-initialized!");
78 throw new PluginNotInitialisedException(Name);
79 }
80
81 public void Initialise(OpenSimBase openSim)
82 {
83 m_openSim = openSim;
84 m_httpServer = openSim.HttpServer;
85 MainServer.Instance = m_httpServer;
86
87 InitialiseCommsManager(openSim);
88 if (m_commsManager != null)
89 {
90 m_openSim.ApplicationRegistry.RegisterInterface<IUserService>(m_commsManager.UserService);
91 }
92 }
93
94 public void PostInitialise()
95 {
96 if (m_openSim.ApplicationRegistry.TryGet<IRegionCreator>(out m_regionCreator))
97 {
98 m_regionCreator.OnNewRegionCreated += RegionCreated;
99 }
100 }
101
102 public void Dispose()
103 {
104 }
105
106 #endregion
107
108 private void RegionCreated(IScene scene)
109 {
110 if (m_commsManager != null)
111 {
112 scene.RegisterModuleInterface<IUserService>(m_commsManager.UserService);
113 }
114 }
115
116 protected void InitialiseCommsManager(OpenSimBase openSim)
117 {
118 LibraryRootFolder libraryRootFolder = new LibraryRootFolder(m_openSim.ConfigurationSettings.LibrariesXMLFile);
119
120 bool hgrid = m_openSim.ConfigSource.Source.Configs["Startup"].GetBoolean("hypergrid", false);
121
122 if (hgrid)
123 {
124 InitialiseHGServices(openSim, libraryRootFolder);
125 }
126 else
127 {
128 InitialiseStandardServices(libraryRootFolder);
129 }
130
131 openSim.CommunicationsManager = m_commsManager;
132 }
133
134 protected void InitialiseHGServices(OpenSimBase openSim, LibraryRootFolder libraryRootFolder)
135 {
136 // Standalone mode is determined by !startupConfig.GetBoolean("gridmode", false)
137 if (m_openSim.ConfigurationSettings.Standalone)
138 {
139 InitialiseHGStandaloneServices(libraryRootFolder);
140 }
141 else
142 {
143 // We are in grid mode
144 InitialiseHGGridServices(libraryRootFolder);
145 }
146 }
147
148 protected void InitialiseStandardServices(LibraryRootFolder libraryRootFolder)
149 {
150 // Standalone mode is determined by !startupConfig.GetBoolean("gridmode", false)
151 if (m_openSim.ConfigurationSettings.Standalone)
152 {
153 InitialiseStandaloneServices(libraryRootFolder);
154 }
155 else
156 {
157 // We are in grid mode
158 InitialiseGridServices(libraryRootFolder);
159 }
160 }
161
162 /// <summary>
163 /// Initialises the backend services for standalone mode, and registers some http handlers
164 /// </summary>
165 /// <param name="libraryRootFolder"></param>
166 protected virtual void InitialiseStandaloneServices(LibraryRootFolder libraryRootFolder)
167 {
168 m_commsManager
169 = new CommunicationsLocal(
170 m_openSim.ConfigurationSettings, m_openSim.NetServersInfo,
171 libraryRootFolder);
172
173 CreateGridInfoService();
174 }
175
176 protected virtual void InitialiseGridServices(LibraryRootFolder libraryRootFolder)
177 {
178 m_commsManager
179 = new CommunicationsOGS1(m_openSim.NetServersInfo, libraryRootFolder);
180
181 m_httpServer.AddStreamHandler(new OpenSim.SimStatusHandler());
182 m_httpServer.AddStreamHandler(new OpenSim.XSimStatusHandler(m_openSim));
183 if (m_openSim.userStatsURI != String.Empty)
184 m_httpServer.AddStreamHandler(new OpenSim.UXSimStatusHandler(m_openSim));
185 }
186
187 protected virtual void InitialiseHGStandaloneServices(LibraryRootFolder libraryRootFolder)
188 {
189 m_commsManager
190 = new HGCommunicationsStandalone(
191 m_openSim.ConfigurationSettings, m_openSim.NetServersInfo, m_httpServer,
192 libraryRootFolder, false);
193
194 CreateGridInfoService();
195 }
196
197 protected virtual void InitialiseHGGridServices(LibraryRootFolder libraryRootFolder)
198 {
199 m_commsManager
200 = new HGCommunicationsGridMode(
201 m_openSim.NetServersInfo,
202 m_openSim.SceneManager, libraryRootFolder);
203
204 m_httpServer.AddStreamHandler(new OpenSim.SimStatusHandler());
205 m_httpServer.AddStreamHandler(new OpenSim.XSimStatusHandler(m_openSim));
206 if (m_openSim.userStatsURI != String.Empty)
207 m_httpServer.AddStreamHandler(new OpenSim.UXSimStatusHandler(m_openSim));
208 }
209
210 private void CreateGridInfoService()
211 {
212 // provide grid info
213 m_gridInfoService = new GridInfoService(m_openSim.ConfigSource.Source);
214 m_httpServer.AddXmlRPCHandler("get_grid_info", m_gridInfoService.XmlRpcGridInfoMethod);
215 m_httpServer.AddStreamHandler(
216 new RestStreamHandler("GET", "/get_grid_info", m_gridInfoService.RestGetGridInfoMethod));
217 }
218 }
219}
diff --git a/OpenSim/ApplicationPlugins/CreateCommsManager/Resources/CreateCommsManagerPlugin.addin.xml b/OpenSim/ApplicationPlugins/CreateCommsManager/Resources/CreateCommsManagerPlugin.addin.xml
deleted file mode 100644
index ec042f3..0000000
--- a/OpenSim/ApplicationPlugins/CreateCommsManager/Resources/CreateCommsManagerPlugin.addin.xml
+++ /dev/null
@@ -1,11 +0,0 @@
1<Addin id="OpenSim.ApplicationPlugins.CreateCommsManager" version="0.1">
2 <Runtime>
3 <Import assembly="OpenSim.ApplicationPlugins.CreateCommsManager.dll"/>
4 </Runtime>
5 <Dependencies>
6 <Addin id="OpenSim" version="0.5" />
7 </Dependencies>
8 <Extension path = "/OpenSim/Startup">
9 <Plugin id="CreateCommsManager" type="OpenSim.ApplicationPlugins.CreateCommsManager.CreateCommsManagerPlugin" />
10 </Extension>
11</Addin>
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
index 6fd3d30..1e85a22 100644
--- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
+++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
@@ -102,8 +102,6 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
102 m_log.Info("[LOADREGIONSPLUGIN]: Loading specific shared modules..."); 102 m_log.Info("[LOADREGIONSPLUGIN]: Loading specific shared modules...");
103 m_log.Info("[LOADREGIONSPLUGIN]: DynamicTextureModule..."); 103 m_log.Info("[LOADREGIONSPLUGIN]: DynamicTextureModule...");
104 m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule()); 104 m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule());
105 m_log.Info("[LOADREGIONSPLUGIN]: InstantMessageModule...");
106 m_openSim.ModuleLoader.LoadDefaultSharedModule(new InstantMessageModule());
107 m_log.Info("[LOADREGIONSPLUGIN]: LoadImageURLModule..."); 105 m_log.Info("[LOADREGIONSPLUGIN]: LoadImageURLModule...");
108 m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule()); 106 m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule());
109 m_log.Info("[LOADREGIONSPLUGIN]: XMLRPCModule..."); 107 m_log.Info("[LOADREGIONSPLUGIN]: XMLRPCModule...");
@@ -217,4 +215,4 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
217 } 215 }
218 } 216 }
219 } 217 }
220} \ No newline at end of file 218}
diff --git a/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs b/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs
index 6c0c74d..9d79b3a 100644
--- a/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs
@@ -65,9 +65,9 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
65 65
66 public void Initialise (OpenSimBase openSim) 66 public void Initialise (OpenSimBase openSim)
67 { 67 {
68 m_log.DebugFormat("[REGIONMODULES]: Initializing...");
69 m_openSim = openSim; 68 m_openSim = openSim;
70 openSim.ApplicationRegistry.RegisterInterface<IRegionModulesController>(this); 69 m_openSim.ApplicationRegistry.RegisterInterface<IRegionModulesController>(this);
70 m_log.DebugFormat("[REGIONMODULES]: Initializing...");
71 71
72 // Who we are 72 // Who we are
73 string id = AddinManager.CurrentAddin.Id; 73 string id = AddinManager.CurrentAddin.Id;
@@ -81,9 +81,9 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
81 81
82 // The [Modules] section in the ini file 82 // The [Modules] section in the ini file
83 IConfig modulesConfig = 83 IConfig modulesConfig =
84 openSim.ConfigSource.Source.Configs["Modules"]; 84 m_openSim.ConfigSource.Source.Configs["Modules"];
85 if (modulesConfig == null) 85 if (modulesConfig == null)
86 modulesConfig = openSim.ConfigSource.Source.AddConfig("Modules"); 86 modulesConfig = m_openSim.ConfigSource.Source.AddConfig("Modules");
87 87
88 // Scan modules and load all that aren't disabled 88 // Scan modules and load all that aren't disabled
89 foreach (TypeExtensionNode node in 89 foreach (TypeExtensionNode node in
@@ -104,7 +104,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
104 continue; 104 continue;
105 105
106 // Split off port, if present 106 // Split off port, if present
107 string[] moduleParts = moduleString.Split(new char[] {'/'}, 2); 107 string[] moduleParts = moduleString.Split(new char[] { '/' }, 2);
108 // Format is [port/][class] 108 // Format is [port/][class]
109 string className = moduleParts[0]; 109 string className = moduleParts[0];
110 if (moduleParts.Length > 1) 110 if (moduleParts.Length > 1)
@@ -134,7 +134,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
134 continue; 134 continue;
135 135
136 // Split off port, if present 136 // Split off port, if present
137 string[] moduleParts = moduleString.Split(new char[] {'/'}, 2); 137 string[] moduleParts = moduleString.Split(new char[] { '/' }, 2);
138 // Format is [port/][class] 138 // Format is [port/][class]
139 string className = moduleParts[0]; 139 string className = moduleParts[0];
140 if (moduleParts.Length > 1) 140 if (moduleParts.Length > 1)
@@ -162,7 +162,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
162 // 162 //
163 foreach (TypeExtensionNode node in m_sharedModules) 163 foreach (TypeExtensionNode node in m_sharedModules)
164 { 164 {
165 Object[] ctorArgs = new Object[] {(uint)0}; 165 Object[] ctorArgs = new Object[] { (uint)0 };
166 166
167 // Read the config again 167 // Read the config again
168 string moduleString = 168 string moduleString =
@@ -172,7 +172,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
172 if (moduleString != String.Empty) 172 if (moduleString != String.Empty)
173 { 173 {
174 // Get the port number from the string 174 // Get the port number from the string
175 string[] moduleParts = moduleString.Split(new char[] {'/'}, 175 string[] moduleParts = moduleString.Split(new char[] { '/' },
176 2); 176 2);
177 if (moduleParts.Length > 1) 177 if (moduleParts.Length > 1)
178 ctorArgs[0] = Convert.ToUInt32(moduleParts[0]); 178 ctorArgs[0] = Convert.ToUInt32(moduleParts[0]);
@@ -195,18 +195,22 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
195 195
196 // OK, we're up and running 196 // OK, we're up and running
197 m_sharedInstances.Add(module); 197 m_sharedInstances.Add(module);
198 module.Initialise(openSim.ConfigSource.Source); 198 module.Initialise(m_openSim.ConfigSource.Source);
199 } 199 }
200 200
201
202 }
203
204 public void PostInitialise ()
205 {
206 m_log.DebugFormat("[REGIONMODULES]: PostInitializing...");
207
201 // Immediately run PostInitialise on shared modules 208 // Immediately run PostInitialise on shared modules
202 foreach (ISharedRegionModule module in m_sharedInstances) 209 foreach (ISharedRegionModule module in m_sharedInstances)
203 { 210 {
204 module.PostInitialise(); 211 module.PostInitialise();
205 } 212 }
206 }
207 213
208 public void PostInitialise ()
209 {
210 } 214 }
211 215
212#endregion 216#endregion
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 9400788..457177d 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -41,7 +41,7 @@ using OpenMetaverse;
41using OpenSim; 41using OpenSim;
42using OpenSim.Framework; 42using OpenSim.Framework;
43using OpenSim.Framework.Communications; 43using OpenSim.Framework.Communications;
44using OpenSim.Framework.Communications.Cache; 44
45using OpenSim.Framework.Console; 45using OpenSim.Framework.Console;
46using OpenSim.Framework.Servers; 46using OpenSim.Framework.Servers;
47using OpenSim.Framework.Servers.HttpServer; 47using OpenSim.Framework.Servers.HttpServer;
@@ -49,6 +49,8 @@ using OpenSim.Region.CoreModules.World.Terrain;
49using OpenSim.Region.Framework.Interfaces; 49using OpenSim.Region.Framework.Interfaces;
50using OpenSim.Region.Framework.Scenes; 50using OpenSim.Region.Framework.Scenes;
51using OpenSim.Services.Interfaces; 51using OpenSim.Services.Interfaces;
52using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
53using GridRegion = OpenSim.Services.Interfaces.GridRegion;
52 54
53namespace OpenSim.ApplicationPlugins.RemoteController 55namespace OpenSim.ApplicationPlugins.RemoteController
54{ 56{
@@ -582,39 +584,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
582 { 584 {
583 // ok, client wants us to use an explicit UUID 585 // ok, client wants us to use an explicit UUID
584 // regardless of what the avatar name provided 586 // regardless of what the avatar name provided
585 userID = new UUID((string) requestData["region_master_uuid"]); 587 userID = new UUID((string) requestData["estate_owner_uuid"]);
586 } 588 }
587 else
588 {
589 if (masterFirst != String.Empty && masterLast != String.Empty) // User requests a master avatar
590 {
591 // no client supplied UUID: look it up...
592 CachedUserInfo userInfo
593 = m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(
594 masterFirst, masterLast);
595
596 if (null == userInfo)
597 {
598 m_log.InfoFormat("master avatar does not exist, creating it");
599 // ...or create new user
600 userID = m_app.CommunicationsManager.UserAdminService.AddUser(
601 masterFirst, masterLast, masterPassword, "", region.RegionLocX, region.RegionLocY);
602
603 if (userID == UUID.Zero)
604 throw new Exception(String.Format("failed to create new user {0} {1}",
605 masterFirst, masterLast));
606 }
607 else
608 {
609 userID = userInfo.UserProfile.ID;
610 }
611 }
612 }
613
614 region.MasterAvatarFirstName = masterFirst;
615 region.MasterAvatarLastName = masterLast;
616 region.MasterAvatarSandboxPassword = masterPassword;
617 region.MasterAvatarAssignedUUID = userID;
618 589
619 bool persist = Convert.ToBoolean((string) requestData["persist"]); 590 bool persist = Convert.ToBoolean((string) requestData["persist"]);
620 if (persist) 591 if (persist)
@@ -659,6 +630,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
659 // If an access specification was provided, use it. 630 // If an access specification was provided, use it.
660 // Otherwise accept the default. 631 // Otherwise accept the default.
661 newscene.RegionInfo.EstateSettings.PublicAccess = getBoolean(requestData, "public", m_publicAccess); 632 newscene.RegionInfo.EstateSettings.PublicAccess = getBoolean(requestData, "public", m_publicAccess);
633 newscene.RegionInfo.EstateSettings.EstateOwner = userID;
662 if (persist) 634 if (persist)
663 newscene.RegionInfo.EstateSettings.Save(); 635 newscene.RegionInfo.EstateSettings.Save();
664 636
@@ -1032,30 +1004,37 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1032 if (requestData.Contains("user_email")) 1004 if (requestData.Contains("user_email"))
1033 email = (string)requestData["user_email"]; 1005 email = (string)requestData["user_email"];
1034 1006
1035 CachedUserInfo userInfo = 1007 UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
1036 m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(firstname, lastname);
1037 1008
1038 if (null != userInfo) 1009 UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, firstname, lastname);
1039 throw new Exception(String.Format("Avatar {0} {1} already exists", firstname, lastname));
1040 1010
1041 UUID userID = 1011 if (null != account)
1042 m_app.CommunicationsManager.UserAdminService.AddUser(firstname, lastname, 1012 throw new Exception(String.Format("Account {0} {1} already exists", firstname, lastname));
1043 passwd, email, regX, regY);
1044 1013
1045 if (userID == UUID.Zero) 1014 account = new UserAccount(scopeID, firstname, lastname, email);
1015 // REFACTORING PROBLEM: no method to set the password!
1016
1017 bool success = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.StoreUserAccount(account);
1018
1019 if (!success)
1046 throw new Exception(String.Format("failed to create new user {0} {1}", 1020 throw new Exception(String.Format("failed to create new user {0} {1}",
1047 firstname, lastname)); 1021 firstname, lastname));
1048 1022
1023 GridRegion home = m_app.SceneManager.CurrentOrFirstScene.GridService.GetRegionByPosition(scopeID,
1024 (int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize));
1025 if (home == null)
1026 m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", firstname, lastname);
1027
1049 // Establish the avatar's initial appearance 1028 // Establish the avatar's initial appearance
1050 1029
1051 updateUserAppearance(responseData, requestData, userID); 1030 updateUserAppearance(responseData, requestData, account.PrincipalID);
1052 1031
1053 responseData["success"] = true; 1032 responseData["success"] = true;
1054 responseData["avatar_uuid"] = userID.ToString(); 1033 responseData["avatar_uuid"] = account.PrincipalID.ToString();
1055 1034
1056 response.Value = responseData; 1035 response.Value = responseData;
1057 1036
1058 m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstname, lastname, userID); 1037 m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstname, lastname, account.PrincipalID);
1059 } 1038 }
1060 catch (Exception e) 1039 catch (Exception e)
1061 { 1040 {
@@ -1124,21 +1103,27 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1124 string firstname = (string) requestData["user_firstname"]; 1103 string firstname = (string) requestData["user_firstname"];
1125 string lastname = (string) requestData["user_lastname"]; 1104 string lastname = (string) requestData["user_lastname"];
1126 1105
1127 CachedUserInfo userInfo
1128 = m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(firstname, lastname);
1129
1130 responseData["user_firstname"] = firstname; 1106 responseData["user_firstname"] = firstname;
1131 responseData["user_lastname"] = lastname; 1107 responseData["user_lastname"] = lastname;
1132 1108
1133 if (null == userInfo) 1109 UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
1110
1111 UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, firstname, lastname);
1112
1113 if (null == account)
1134 { 1114 {
1135 responseData["success"] = false; 1115 responseData["success"] = false;
1136 responseData["lastlogin"] = 0; 1116 responseData["lastlogin"] = 0;
1137 } 1117 }
1138 else 1118 else
1139 { 1119 {
1120 PresenceInfo[] pinfos = m_app.SceneManager.CurrentOrFirstScene.PresenceService.GetAgents(new string[] { account.PrincipalID.ToString() });
1121 if (pinfos != null && pinfos.Length >= 1)
1122 responseData["lastlogin"] = pinfos[0].Login;
1123 else
1124 responseData["lastlogin"] = 0;
1125
1140 responseData["success"] = true; 1126 responseData["success"] = true;
1141 responseData["lastlogin"] = userInfo.UserProfile.LastLogin;
1142 } 1127 }
1143 1128
1144 response.Value = responseData; 1129 response.Value = responseData;
@@ -1200,117 +1185,118 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1200 public XmlRpcResponse XmlRpcUpdateUserAccountMethod(XmlRpcRequest request, IPEndPoint remoteClient) 1185 public XmlRpcResponse XmlRpcUpdateUserAccountMethod(XmlRpcRequest request, IPEndPoint remoteClient)
1201 { 1186 {
1202 m_log.Info("[RADMIN]: UpdateUserAccount: new request"); 1187 m_log.Info("[RADMIN]: UpdateUserAccount: new request");
1188 m_log.Warn("[RADMIN]: This method needs update for 0.7");
1203 XmlRpcResponse response = new XmlRpcResponse(); 1189 XmlRpcResponse response = new XmlRpcResponse();
1204 Hashtable responseData = new Hashtable(); 1190 Hashtable responseData = new Hashtable();
1205 1191
1206 lock (rslock) 1192 //lock (rslock)
1207 { 1193 //{
1208 try 1194 // try
1209 { 1195 // {
1210 Hashtable requestData = (Hashtable) request.Params[0]; 1196 // Hashtable requestData = (Hashtable) request.Params[0];
1211 1197
1212 // check completeness 1198 // // check completeness
1213 checkStringParameters(request, new string[] { 1199 // checkStringParameters(request, new string[] {
1214 "password", "user_firstname", 1200 // "password", "user_firstname",
1215 "user_lastname"}); 1201 // "user_lastname"});
1216 1202
1217 // check password 1203 // // check password
1218 if (!String.IsNullOrEmpty(m_requiredPassword) && 1204 // if (!String.IsNullOrEmpty(m_requiredPassword) &&
1219 (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); 1205 // (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password");
1220 1206
1221 // do the job 1207 // // do the job
1222 string firstname = (string) requestData["user_firstname"]; 1208 // string firstname = (string) requestData["user_firstname"];
1223 string lastname = (string) requestData["user_lastname"]; 1209 // string lastname = (string) requestData["user_lastname"];
1224 1210
1225 string passwd = String.Empty; 1211 // string passwd = String.Empty;
1226 uint? regX = null; 1212 // uint? regX = null;
1227 uint? regY = null; 1213 // uint? regY = null;
1228 uint? ulaX = null; 1214 // uint? ulaX = null;
1229 uint? ulaY = null; 1215 // uint? ulaY = null;
1230 uint? ulaZ = null; 1216 // uint? ulaZ = null;
1231 uint? usaX = null; 1217 // uint? usaX = null;
1232 uint? usaY = null; 1218 // uint? usaY = null;
1233 uint? usaZ = null; 1219 // uint? usaZ = null;
1234 string aboutFirstLive = String.Empty; 1220 // string aboutFirstLive = String.Empty;
1235 string aboutAvatar = String.Empty; 1221 // string aboutAvatar = String.Empty;
1236 1222
1237 if (requestData.ContainsKey("user_password")) passwd = (string) requestData["user_password"]; 1223 // if (requestData.ContainsKey("user_password")) passwd = (string) requestData["user_password"];
1238 if (requestData.ContainsKey("start_region_x")) 1224 // if (requestData.ContainsKey("start_region_x"))
1239 regX = Convert.ToUInt32((Int32) requestData["start_region_x"]); 1225 // regX = Convert.ToUInt32((Int32) requestData["start_region_x"]);
1240 if (requestData.ContainsKey("start_region_y")) 1226 // if (requestData.ContainsKey("start_region_y"))
1241 regY = Convert.ToUInt32((Int32) requestData["start_region_y"]); 1227 // regY = Convert.ToUInt32((Int32) requestData["start_region_y"]);
1242 1228
1243 if (requestData.ContainsKey("start_lookat_x")) 1229 // if (requestData.ContainsKey("start_lookat_x"))
1244 ulaX = Convert.ToUInt32((Int32) requestData["start_lookat_x"]); 1230 // ulaX = Convert.ToUInt32((Int32) requestData["start_lookat_x"]);
1245 if (requestData.ContainsKey("start_lookat_y")) 1231 // if (requestData.ContainsKey("start_lookat_y"))
1246 ulaY = Convert.ToUInt32((Int32) requestData["start_lookat_y"]); 1232 // ulaY = Convert.ToUInt32((Int32) requestData["start_lookat_y"]);
1247 if (requestData.ContainsKey("start_lookat_z")) 1233 // if (requestData.ContainsKey("start_lookat_z"))
1248 ulaZ = Convert.ToUInt32((Int32) requestData["start_lookat_z"]); 1234 // ulaZ = Convert.ToUInt32((Int32) requestData["start_lookat_z"]);
1249 1235
1250 if (requestData.ContainsKey("start_standat_x")) 1236 // if (requestData.ContainsKey("start_standat_x"))
1251 usaX = Convert.ToUInt32((Int32) requestData["start_standat_x"]); 1237 // usaX = Convert.ToUInt32((Int32) requestData["start_standat_x"]);
1252 if (requestData.ContainsKey("start_standat_y")) 1238 // if (requestData.ContainsKey("start_standat_y"))
1253 usaY = Convert.ToUInt32((Int32) requestData["start_standat_y"]); 1239 // usaY = Convert.ToUInt32((Int32) requestData["start_standat_y"]);
1254 if (requestData.ContainsKey("start_standat_z")) 1240 // if (requestData.ContainsKey("start_standat_z"))
1255 usaZ = Convert.ToUInt32((Int32) requestData["start_standat_z"]); 1241 // usaZ = Convert.ToUInt32((Int32) requestData["start_standat_z"]);
1256 if (requestData.ContainsKey("about_real_world")) 1242 // if (requestData.ContainsKey("about_real_world"))
1257 aboutFirstLive = (string)requestData["about_real_world"]; 1243 // aboutFirstLive = (string)requestData["about_real_world"];
1258 if (requestData.ContainsKey("about_virtual_world")) 1244 // if (requestData.ContainsKey("about_virtual_world"))
1259 aboutAvatar = (string)requestData["about_virtual_world"]; 1245 // aboutAvatar = (string)requestData["about_virtual_world"];
1260 1246
1261 UserProfileData userProfile 1247 // UserProfileData userProfile
1262 = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname); 1248 // = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname);
1263 1249
1264 if (null == userProfile) 1250 // if (null == userProfile)
1265 throw new Exception(String.Format("avatar {0} {1} does not exist", firstname, lastname)); 1251 // throw new Exception(String.Format("avatar {0} {1} does not exist", firstname, lastname));
1266 1252
1267 if (!String.IsNullOrEmpty(passwd)) 1253 // if (!String.IsNullOrEmpty(passwd))
1268 { 1254 // {
1269 m_log.DebugFormat("[RADMIN]: UpdateUserAccount: updating password for avatar {0} {1}", firstname, lastname); 1255 // m_log.DebugFormat("[RADMIN]: UpdateUserAccount: updating password for avatar {0} {1}", firstname, lastname);
1270 string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(passwd) + ":" + String.Empty); 1256 // string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(passwd) + ":" + String.Empty);
1271 userProfile.PasswordHash = md5PasswdHash; 1257 // userProfile.PasswordHash = md5PasswdHash;
1272 } 1258 // }
1273 1259
1274 if (null != regX) userProfile.HomeRegionX = (uint) regX; 1260 // if (null != regX) userProfile.HomeRegionX = (uint) regX;
1275 if (null != regY) userProfile.HomeRegionY = (uint) regY; 1261 // if (null != regY) userProfile.HomeRegionY = (uint) regY;
1276 1262
1277 if (null != usaX) userProfile.HomeLocationX = (uint) usaX; 1263 // if (null != usaX) userProfile.HomeLocationX = (uint) usaX;
1278 if (null != usaY) userProfile.HomeLocationY = (uint) usaY; 1264 // if (null != usaY) userProfile.HomeLocationY = (uint) usaY;
1279 if (null != usaZ) userProfile.HomeLocationZ = (uint) usaZ; 1265 // if (null != usaZ) userProfile.HomeLocationZ = (uint) usaZ;
1280 1266
1281 if (null != ulaX) userProfile.HomeLookAtX = (uint) ulaX; 1267 // if (null != ulaX) userProfile.HomeLookAtX = (uint) ulaX;
1282 if (null != ulaY) userProfile.HomeLookAtY = (uint) ulaY; 1268 // if (null != ulaY) userProfile.HomeLookAtY = (uint) ulaY;
1283 if (null != ulaZ) userProfile.HomeLookAtZ = (uint) ulaZ; 1269 // if (null != ulaZ) userProfile.HomeLookAtZ = (uint) ulaZ;
1284 1270
1285 if (String.Empty != aboutFirstLive) userProfile.FirstLifeAboutText = aboutFirstLive; 1271 // if (String.Empty != aboutFirstLive) userProfile.FirstLifeAboutText = aboutFirstLive;
1286 if (String.Empty != aboutAvatar) userProfile.AboutText = aboutAvatar; 1272 // if (String.Empty != aboutAvatar) userProfile.AboutText = aboutAvatar;
1287 1273
1288 // User has been created. Now establish gender and appearance. 1274 // // User has been created. Now establish gender and appearance.
1289 1275
1290 updateUserAppearance(responseData, requestData, userProfile.ID); 1276 // updateUserAppearance(responseData, requestData, userProfile.ID);
1291 1277
1292 if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile)) 1278 // if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile))
1293 throw new Exception("did not manage to update user profile"); 1279 // throw new Exception("did not manage to update user profile");
1294 1280
1295 responseData["success"] = true; 1281 // responseData["success"] = true;
1296 1282
1297 response.Value = responseData; 1283 // response.Value = responseData;
1298 1284
1299 m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}", 1285 // m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}",
1300 firstname, lastname, 1286 // firstname, lastname,
1301 userProfile.ID); 1287 // userProfile.ID);
1302 } 1288 // }
1303 catch (Exception e) 1289 // catch (Exception e)
1304 { 1290 // {
1305 m_log.ErrorFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.Message); 1291 // m_log.ErrorFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.Message);
1306 m_log.DebugFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.ToString()); 1292 // m_log.DebugFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.ToString());
1307 1293
1308 responseData["success"] = false; 1294 // responseData["success"] = false;
1309 responseData["error"] = e.Message; 1295 // responseData["error"] = e.Message;
1310 1296
1311 response.Value = responseData; 1297 // response.Value = responseData;
1312 } 1298 // }
1313 } 1299 //}
1314 1300
1315 m_log.Info("[RADMIN]: UpdateUserAccount: request complete"); 1301 m_log.Info("[RADMIN]: UpdateUserAccount: request complete");
1316 return response; 1302 return response;
@@ -1327,72 +1313,73 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1327 private void updateUserAppearance(Hashtable responseData, Hashtable requestData, UUID userid) 1313 private void updateUserAppearance(Hashtable responseData, Hashtable requestData, UUID userid)
1328 { 1314 {
1329 m_log.DebugFormat("[RADMIN] updateUserAppearance"); 1315 m_log.DebugFormat("[RADMIN] updateUserAppearance");
1316 m_log.Warn("[RADMIN]: This method needs update for 0.7");
1330 1317
1331 string dmale = m_config.GetString("default_male", "Default Male"); 1318 //string dmale = m_config.GetString("default_male", "Default Male");
1332 string dfemale = m_config.GetString("default_female", "Default Female"); 1319 //string dfemale = m_config.GetString("default_female", "Default Female");
1333 string dneut = m_config.GetString("default_female", "Default Default"); 1320 //string dneut = m_config.GetString("default_female", "Default Default");
1334 string model = String.Empty; 1321 string model = String.Empty;
1335 1322
1336 // Has a gender preference been supplied? 1323 //// Has a gender preference been supplied?
1337 1324
1338 if (requestData.Contains("gender")) 1325 //if (requestData.Contains("gender"))
1339 { 1326 //{
1340 switch ((string)requestData["gender"]) 1327 // switch ((string)requestData["gender"])
1341 { 1328 // {
1342 case "m" : 1329 // case "m" :
1343 model = dmale; 1330 // model = dmale;
1344 break; 1331 // break;
1345 case "f" : 1332 // case "f" :
1346 model = dfemale; 1333 // model = dfemale;
1347 break; 1334 // break;
1348 case "n" : 1335 // case "n" :
1349 default : 1336 // default :
1350 model = dneut; 1337 // model = dneut;
1351 break; 1338 // break;
1352 } 1339 // }
1353 } 1340 //}
1354 1341
1355 // Has an explicit model been specified? 1342 //// Has an explicit model been specified?
1356 1343
1357 if (requestData.Contains("model")) 1344 //if (requestData.Contains("model"))
1358 { 1345 //{
1359 model = (string)requestData["model"]; 1346 // model = (string)requestData["model"];
1360 } 1347 //}
1361 1348
1362 // No appearance attributes were set 1349 //// No appearance attributes were set
1363 1350
1364 if (model == String.Empty) 1351 //if (model == String.Empty)
1365 { 1352 //{
1366 m_log.DebugFormat("[RADMIN] Appearance update not requested"); 1353 // m_log.DebugFormat("[RADMIN] Appearance update not requested");
1367 return; 1354 // return;
1368 } 1355 //}
1369 1356
1370 m_log.DebugFormat("[RADMIN] Setting appearance for avatar {0}, using model {1}", userid, model); 1357 //m_log.DebugFormat("[RADMIN] Setting appearance for avatar {0}, using model {1}", userid, model);
1371 1358
1372 string[] nomens = model.Split(); 1359 //string[] nomens = model.Split();
1373 if (nomens.Length != 2) 1360 //if (nomens.Length != 2)
1374 { 1361 //{
1375 m_log.WarnFormat("[RADMIN] User appearance not set for {0}. Invalid model name : <{1}>", userid, model); 1362 // m_log.WarnFormat("[RADMIN] User appearance not set for {0}. Invalid model name : <{1}>", userid, model);
1376 // nomens = dmodel.Split(); 1363 // // nomens = dmodel.Split();
1377 return; 1364 // return;
1378 } 1365 //}
1379 1366
1380 UserProfileData mprof = m_app.CommunicationsManager.UserService.GetUserProfile(nomens[0], nomens[1]); 1367 //UserProfileData mprof = m_app.CommunicationsManager.UserService.GetUserProfile(nomens[0], nomens[1]);
1381 1368
1382 // Is this the first time one of the default models has been used? Create it if that is the case 1369 //// Is this the first time one of the default models has been used? Create it if that is the case
1383 // otherwise default to male. 1370 //// otherwise default to male.
1384 1371
1385 if (mprof == null) 1372 //if (mprof == null)
1386 { 1373 //{
1387 m_log.WarnFormat("[RADMIN] Requested model ({0}) not found. Appearance unchanged", model); 1374 // m_log.WarnFormat("[RADMIN] Requested model ({0}) not found. Appearance unchanged", model);
1388 return; 1375 // return;
1389 } 1376 //}
1390 1377
1391 // Set current user's appearance. This bit is easy. The appearance structure is populated with 1378 //// Set current user's appearance. This bit is easy. The appearance structure is populated with
1392 // actual asset ids, however to complete the magic we need to populate the inventory with the 1379 //// actual asset ids, however to complete the magic we need to populate the inventory with the
1393 // assets in question. 1380 //// assets in question.
1394 1381
1395 establishAppearance(userid, mprof.ID); 1382 //establishAppearance(userid, mprof.ID);
1396 1383
1397 m_log.DebugFormat("[RADMIN] Finished setting appearance for avatar {0}, using model {1}", 1384 m_log.DebugFormat("[RADMIN] Finished setting appearance for avatar {0}, using model {1}",
1398 userid, model); 1385 userid, model);
@@ -1407,8 +1394,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1407 private void establishAppearance(UUID dest, UUID srca) 1394 private void establishAppearance(UUID dest, UUID srca)
1408 { 1395 {
1409 m_log.DebugFormat("[RADMIN] Initializing inventory for {0} from {1}", dest, srca); 1396 m_log.DebugFormat("[RADMIN] Initializing inventory for {0} from {1}", dest, srca);
1410 1397 AvatarAppearance ava = null;
1411 AvatarAppearance ava = m_app.CommunicationsManager.AvatarService.GetUserAppearance(srca); 1398 AvatarData avatar = m_app.SceneManager.CurrentOrFirstScene.AvatarService.GetAvatar(srca);
1399 if (avatar != null)
1400 ava = avatar.ToAvatarAppearance(srca);
1412 1401
1413 // If the model has no associated appearance we're done. 1402 // If the model has no associated appearance we're done.
1414 1403
@@ -1501,7 +1490,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1501 throw new Exception("Unable to load both inventories"); 1490 throw new Exception("Unable to load both inventories");
1502 } 1491 }
1503 1492
1504 m_app.CommunicationsManager.AvatarService.UpdateUserAppearance(dest, ava); 1493 AvatarData adata = new AvatarData(ava);
1494 m_app.SceneManager.CurrentOrFirstScene.AvatarService.SetAvatar(dest, adata);
1505 } 1495 }
1506 catch (Exception e) 1496 catch (Exception e)
1507 { 1497 {
@@ -1556,7 +1546,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1556 uint regX = 1000; 1546 uint regX = 1000;
1557 uint regY = 1000; 1547 uint regY = 1000;
1558 string passwd = UUID.Random().ToString(); // No requirement to sign-in. 1548 string passwd = UUID.Random().ToString(); // No requirement to sign-in.
1559 CachedUserInfo UI;
1560 UUID ID = UUID.Zero; 1549 UUID ID = UUID.Zero;
1561 AvatarAppearance mava; 1550 AvatarAppearance mava;
1562 XmlNodeList avatars; 1551 XmlNodeList avatars;
@@ -1604,20 +1593,27 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1604 passwd = GetStringAttribute(avatar,"password",passwd); 1593 passwd = GetStringAttribute(avatar,"password",passwd);
1605 1594
1606 string[] nomens = name.Split(); 1595 string[] nomens = name.Split();
1607 UI = m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(nomens[0], nomens[1]); 1596 UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
1608 if (null == UI) 1597 UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, nomens[0], nomens[1]);
1598 if (null == account)
1609 { 1599 {
1610 ID = m_app.CommunicationsManager.UserAdminService.AddUser(nomens[0], nomens[1], 1600 account = new UserAccount(scopeID, nomens[0], nomens[1], email);
1611 passwd, email, regX, regY); 1601 bool success = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.StoreUserAccount(account);
1612 if (ID == UUID.Zero) 1602 if (!success)
1613 { 1603 {
1614 m_log.ErrorFormat("[RADMIN] Avatar {0} {1} was not created", nomens[0], nomens[1]); 1604 m_log.ErrorFormat("[RADMIN] Avatar {0} {1} was not created", nomens[0], nomens[1]);
1615 return false; 1605 return false;
1616 } 1606 }
1607 // !!! REFACTORING PROBLEM: need to set the password
1608
1609 GridRegion home = m_app.SceneManager.CurrentOrFirstScene.GridService.GetRegionByPosition(scopeID,
1610 (int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize));
1611 if (home != null)
1612 m_app.SceneManager.CurrentOrFirstScene.PresenceService.SetHomeLocation(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
1617 } 1613 }
1618 else 1614 else
1619 { 1615 {
1620 ID = UI.UserProfile.ID; 1616 ID = account.PrincipalID;
1621 } 1617 }
1622 1618
1623 m_log.DebugFormat("[RADMIN] User {0}[{1}] created or retrieved", name, ID); 1619 m_log.DebugFormat("[RADMIN] User {0}[{1}] created or retrieved", name, ID);
@@ -1641,10 +1637,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1641 iserv.GetUserInventory(ID, uic.callback); 1637 iserv.GetUserInventory(ID, uic.callback);
1642 1638
1643 // While the inventory is being fetched, setup for appearance processing 1639 // While the inventory is being fetched, setup for appearance processing
1644 if ((mava = m_app.CommunicationsManager.AvatarService.GetUserAppearance(ID)) == null) 1640 AvatarData adata = m_app.SceneManager.CurrentOrFirstScene.AvatarService.GetAvatar(ID);
1645 { 1641 if (adata != null)
1642 mava = adata.ToAvatarAppearance(ID);
1643 else
1646 mava = new AvatarAppearance(); 1644 mava = new AvatarAppearance();
1647 }
1648 1645
1649 { 1646 {
1650 AvatarWearable[] wearables = mava.Wearables; 1647 AvatarWearable[] wearables = mava.Wearables;
@@ -1779,7 +1776,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1779 m_log.DebugFormat("[RADMIN] Outfit {0} load completed", oname); 1776 m_log.DebugFormat("[RADMIN] Outfit {0} load completed", oname);
1780 } // foreach outfit 1777 } // foreach outfit
1781 m_log.DebugFormat("[RADMIN] Inventory update complete for {0}", name); 1778 m_log.DebugFormat("[RADMIN] Inventory update complete for {0}", name);
1782 m_app.CommunicationsManager.AvatarService.UpdateUserAppearance(ID, mava); 1779 AvatarData adata2 = new AvatarData(mava);
1780 m_app.SceneManager.CurrentOrFirstScene.AvatarService.SetAvatar(ID, adata2);
1783 } 1781 }
1784 catch (Exception e) 1782 catch (Exception e)
1785 { 1783 {
@@ -2391,17 +2389,18 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2391 2389
2392 if (requestData.Contains("users")) 2390 if (requestData.Contains("users"))
2393 { 2391 {
2394 UserProfileCacheService ups = m_app.CommunicationsManager.UserProfileCacheService; 2392 UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
2393 IUserAccountService userService = m_app.SceneManager.CurrentOrFirstScene.UserAccountService;
2395 Scene s = m_app.SceneManager.CurrentScene; 2394 Scene s = m_app.SceneManager.CurrentScene;
2396 Hashtable users = (Hashtable) requestData["users"]; 2395 Hashtable users = (Hashtable) requestData["users"];
2397 List<UUID> uuids = new List<UUID>(); 2396 List<UUID> uuids = new List<UUID>();
2398 foreach (string name in users.Values) 2397 foreach (string name in users.Values)
2399 { 2398 {
2400 string[] parts = name.Split(); 2399 string[] parts = name.Split();
2401 CachedUserInfo udata = ups.GetUserDetails(parts[0],parts[1]); 2400 UserAccount account = userService.GetUserAccount(scopeID, parts[0], parts[1]);
2402 if (udata != null) 2401 if (account != null)
2403 { 2402 {
2404 uuids.Add(udata.UserProfile.ID); 2403 uuids.Add(account.PrincipalID);
2405 m_log.DebugFormat("[RADMIN] adding \"{0}\" to ACL for \"{1}\"", name, s.RegionInfo.RegionName); 2404 m_log.DebugFormat("[RADMIN] adding \"{0}\" to ACL for \"{1}\"", name, s.RegionInfo.RegionName);
2406 } 2405 }
2407 } 2406 }
@@ -2477,21 +2476,23 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2477 2476
2478 if (requestData.Contains("users")) 2477 if (requestData.Contains("users"))
2479 { 2478 {
2480 UserProfileCacheService ups = m_app.CommunicationsManager.UserProfileCacheService; 2479 UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
2480 IUserAccountService userService = m_app.SceneManager.CurrentOrFirstScene.UserAccountService;
2481 //UserProfileCacheService ups = m_app.CommunicationsManager.UserProfileCacheService;
2481 Scene s = m_app.SceneManager.CurrentScene; 2482 Scene s = m_app.SceneManager.CurrentScene;
2482 Hashtable users = (Hashtable) requestData["users"]; 2483 Hashtable users = (Hashtable) requestData["users"];
2483 List<UUID> uuids = new List<UUID>(); 2484 List<UUID> uuids = new List<UUID>();
2484 foreach (string name in users.Values) 2485 foreach (string name in users.Values)
2485 { 2486 {
2486 string[] parts = name.Split(); 2487 string[] parts = name.Split();
2487 CachedUserInfo udata = ups.GetUserDetails(parts[0],parts[1]); 2488 UserAccount account = userService.GetUserAccount(scopeID, parts[0], parts[1]);
2488 if (udata != null) 2489 if (account != null)
2489 { 2490 {
2490 uuids.Add(udata.UserProfile.ID); 2491 uuids.Add(account.PrincipalID);
2491 } 2492 }
2492 } 2493 }
2493 List<UUID> acl = new List<UUID>(s.RegionInfo.EstateSettings.EstateAccess); 2494 List<UUID> acl = new List<UUID>(s.RegionInfo.EstateSettings.EstateAccess);
2494 foreach (UUID uuid in uuids) 2495 foreach (UUID uuid in uuids)
2495 { 2496 {
2496 if (acl.Contains(uuid)) 2497 if (acl.Contains(uuid))
2497 { 2498 {
@@ -2564,10 +2565,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2564 2565
2565 foreach (UUID user in acl) 2566 foreach (UUID user in acl)
2566 { 2567 {
2567 CachedUserInfo udata = m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(user); 2568 UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
2568 if (udata != null) 2569 UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, user);
2570 if (account != null)
2569 { 2571 {
2570 users[user.ToString()] = udata.UserProfile.Name; 2572 users[user.ToString()] = account.FirstName + " " + account.LastName;
2571 } 2573 }
2572 } 2574 }
2573 2575
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs
index d3a7e64..10f1a6e 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs
@@ -35,6 +35,9 @@ using System.Xml;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Servers; 36using OpenSim.Framework.Servers;
37using OpenSim.Framework.Servers.HttpServer; 37using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Services.Interfaces;
39
40using OpenMetaverse;
38 41
39namespace OpenSim.ApplicationPlugins.Rest.Inventory 42namespace OpenSim.ApplicationPlugins.Rest.Inventory
40{ 43{
@@ -658,7 +661,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
658 { 661 {
659 662
660 int x; 663 int x;
661 string HA1;
662 string first; 664 string first;
663 string last; 665 string last;
664 666
@@ -675,17 +677,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
675 last = String.Empty; 677 last = String.Empty;
676 } 678 }
677 679
678 UserProfileData udata = Rest.UserServices.GetUserProfile(first, last); 680 UserAccount account = Rest.UserServices.GetUserAccount(UUID.Zero, first, last);
679 681
680 // If we don't recognize the user id, perhaps it is god? 682 // If we don't recognize the user id, perhaps it is god?
681 683 if (account == null)
682 if (udata == null)
683 return pass == Rest.GodKey; 684 return pass == Rest.GodKey;
684 685
685 HA1 = HashToString(pass); 686 return (Rest.AuthServices.Authenticate(account.PrincipalID, pass, 1) != string.Empty);
686 HA1 = HashToString(String.Format("{0}:{1}",HA1,udata.PasswordSalt));
687
688 return (0 == sc.Compare(HA1, udata.PasswordHash));
689 687
690 } 688 }
691 689
@@ -897,11 +895,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
897 last = String.Empty; 895 last = String.Empty;
898 } 896 }
899 897
900 UserProfileData udata = Rest.UserServices.GetUserProfile(first, last); 898 UserAccount account = Rest.UserServices.GetUserAccount(UUID.Zero, first, last);
901
902 // If we don;t recognize the user id, perhaps it is god? 899 // If we don;t recognize the user id, perhaps it is god?
903 900
904 if (udata == null) 901 if (account == null)
905 { 902 {
906 Rest.Log.DebugFormat("{0} Administrator", MsgId); 903 Rest.Log.DebugFormat("{0} Administrator", MsgId);
907 return Rest.GodKey; 904 return Rest.GodKey;
@@ -909,7 +906,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
909 else 906 else
910 { 907 {
911 Rest.Log.DebugFormat("{0} Normal User {1}", MsgId, user); 908 Rest.Log.DebugFormat("{0} Normal User {1}", MsgId, user);
912 return udata.PasswordHash; 909
910 // !!! REFACTORING PROBLEM
911 // This is what it was. It doesn't work in 0.7
912 // Nothing retrieves the password from the authentication service, there's only authentication.
913 //return udata.PasswordHash;
914 return string.Empty;
913 } 915 }
914 916
915 } 917 }
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs
index 7db705e..9755e73 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs
@@ -35,7 +35,7 @@ using Nini.Config;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Communications; 36using OpenSim.Framework.Communications;
37using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
38using IUserService = OpenSim.Framework.Communications.IUserService; 38using IAvatarService = OpenSim.Services.Interfaces.IAvatarService;
39 39
40namespace OpenSim.ApplicationPlugins.Rest.Inventory 40namespace OpenSim.ApplicationPlugins.Rest.Inventory
41{ 41{
@@ -92,24 +92,24 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
92 /// initializes. 92 /// initializes.
93 /// </summary> 93 /// </summary>
94 94
95 internal static CommunicationsManager Comms 95 internal static IInventoryService InventoryServices
96 { 96 {
97 get { return main.CommunicationsManager; } 97 get { return main.SceneManager.CurrentOrFirstScene.InventoryService; }
98 } 98 }
99 99
100 internal static IInventoryService InventoryServices 100 internal static IUserAccountService UserServices
101 { 101 {
102 get { return main.SceneManager.CurrentOrFirstScene.InventoryService; } 102 get { return main.SceneManager.CurrentOrFirstScene.UserAccountService; }
103 } 103 }
104 104
105 internal static IUserService UserServices 105 internal static IAuthenticationService AuthServices
106 { 106 {
107 get { return Comms.UserService; } 107 get { return main.SceneManager.CurrentOrFirstScene.AuthenticationService; }
108 } 108 }
109 109
110 internal static IAvatarService AvatarServices 110 internal static IAvatarService AvatarServices
111 { 111 {
112 get { return Comms.AvatarService; } 112 get { return main.SceneManager.CurrentOrFirstScene.AvatarService; }
113 } 113 }
114 114
115 internal static IAssetService AssetServices 115 internal static IAssetService AssetServices
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs
index b2b4aa7..b70a511 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs
@@ -32,6 +32,7 @@ using OpenMetaverse;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Framework.Servers; 33using OpenSim.Framework.Servers;
34using OpenSim.Framework.Servers.HttpServer; 34using OpenSim.Framework.Servers.HttpServer;
35using OpenSim.Services.Interfaces;
35 36
36namespace OpenSim.ApplicationPlugins.Rest.Inventory 37namespace OpenSim.ApplicationPlugins.Rest.Inventory
37{ 38{
@@ -135,152 +136,153 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
135 136
136 private void DoAppearance(RequestData hdata) 137 private void DoAppearance(RequestData hdata)
137 { 138 {
138 139 // !!! REFACTORIMG PROBLEM. This needs rewriting for 0.7
139 AppearanceRequestData rdata = (AppearanceRequestData) hdata; 140
140 141 //AppearanceRequestData rdata = (AppearanceRequestData) hdata;
141 Rest.Log.DebugFormat("{0} DoAppearance ENTRY", MsgId); 142
142 143 //Rest.Log.DebugFormat("{0} DoAppearance ENTRY", MsgId);
143 // If we're disabled, do nothing. 144
144 145 //// If we're disabled, do nothing.
145 if (!enabled) 146
146 { 147 //if (!enabled)
147 return; 148 //{
148 } 149 // return;
149 150 //}
150 // Now that we know this is a serious attempt to 151
151 // access inventory data, we should find out who 152 //// Now that we know this is a serious attempt to
152 // is asking, and make sure they are authorized 153 //// access inventory data, we should find out who
153 // to do so. We need to validate the caller's 154 //// is asking, and make sure they are authorized
154 // identity before revealing anything about the 155 //// to do so. We need to validate the caller's
155 // status quo. Authenticate throws an exception 156 //// identity before revealing anything about the
156 // via Fail if no identity information is present. 157 //// status quo. Authenticate throws an exception
157 // 158 //// via Fail if no identity information is present.
158 // With the present HTTP server we can't use the 159 ////
159 // builtin authentication mechanisms because they 160 //// With the present HTTP server we can't use the
160 // would be enforced for all in-bound requests. 161 //// builtin authentication mechanisms because they
161 // Instead we look at the headers ourselves and 162 //// would be enforced for all in-bound requests.
162 // handle authentication directly. 163 //// Instead we look at the headers ourselves and
163 164 //// handle authentication directly.
164 try 165
165 { 166 //try
166 if (!rdata.IsAuthenticated) 167 //{
167 { 168 // if (!rdata.IsAuthenticated)
168 rdata.Fail(Rest.HttpStatusCodeNotAuthorized,String.Format("user \"{0}\" could not be authenticated", rdata.userName)); 169 // {
169 } 170 // rdata.Fail(Rest.HttpStatusCodeNotAuthorized,String.Format("user \"{0}\" could not be authenticated", rdata.userName));
170 } 171 // }
171 catch (RestException e) 172 //}
172 { 173 //catch (RestException e)
173 if (e.statusCode == Rest.HttpStatusCodeNotAuthorized) 174 //{
174 { 175 // if (e.statusCode == Rest.HttpStatusCodeNotAuthorized)
175 Rest.Log.WarnFormat("{0} User not authenticated", MsgId); 176 // {
176 Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization")); 177 // Rest.Log.WarnFormat("{0} User not authenticated", MsgId);
177 } 178 // Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization"));
178 else 179 // }
179 { 180 // else
180 Rest.Log.ErrorFormat("{0} User authentication failed", MsgId); 181 // {
181 Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization")); 182 // Rest.Log.ErrorFormat("{0} User authentication failed", MsgId);
182 } 183 // Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization"));
183 throw (e); 184 // }
184 } 185 // throw (e);
185 186 //}
186 Rest.Log.DebugFormat("{0} Authenticated {1}", MsgId, rdata.userName); 187
187 188 //Rest.Log.DebugFormat("{0} Authenticated {1}", MsgId, rdata.userName);
188 // We can only get here if we are authorized 189
189 // 190 //// We can only get here if we are authorized
190 // The requestor may have specified an UUID or 191 ////
191 // a conjoined FirstName LastName string. We'll 192 //// The requestor may have specified an UUID or
192 // try both. If we fail with the first, UUID, 193 //// a conjoined FirstName LastName string. We'll
193 // attempt, we try the other. As an example, the 194 //// try both. If we fail with the first, UUID,
194 // URI for a valid inventory request might be: 195 //// attempt, we try the other. As an example, the
195 // 196 //// URI for a valid inventory request might be:
196 // http://<host>:<port>/admin/inventory/Arthur Dent 197 ////
197 // 198 //// http://<host>:<port>/admin/inventory/Arthur Dent
198 // Indicating that this is an inventory request for 199 ////
199 // an avatar named Arthur Dent. This is ALL that is 200 //// Indicating that this is an inventory request for
200 // required to designate a GET for an entire 201 //// an avatar named Arthur Dent. This is ALL that is
201 // inventory. 202 //// required to designate a GET for an entire
202 // 203 //// inventory.
203 204 ////
204 // Do we have at least a user agent name? 205
205 206 //// Do we have at least a user agent name?
206 if (rdata.Parameters.Length < 1) 207
207 { 208 //if (rdata.Parameters.Length < 1)
208 Rest.Log.WarnFormat("{0} Appearance: No user agent identifier specified", MsgId); 209 //{
209 rdata.Fail(Rest.HttpStatusCodeBadRequest, "no user identity specified"); 210 // Rest.Log.WarnFormat("{0} Appearance: No user agent identifier specified", MsgId);
210 } 211 // rdata.Fail(Rest.HttpStatusCodeBadRequest, "no user identity specified");
211 212 //}
212 // The first parameter MUST be the agent identification, either an UUID 213
213 // or a space-separated First-name Last-Name specification. We check for 214 //// The first parameter MUST be the agent identification, either an UUID
214 // an UUID first, if anyone names their character using a valid UUID 215 //// or a space-separated First-name Last-Name specification. We check for
215 // that identifies another existing avatar will cause this a problem... 216 //// an UUID first, if anyone names their character using a valid UUID
216 217 //// that identifies another existing avatar will cause this a problem...
217 try 218
218 { 219 //try
219 rdata.uuid = new UUID(rdata.Parameters[PARM_USERID]); 220 //{
220 Rest.Log.DebugFormat("{0} UUID supplied", MsgId); 221 // rdata.uuid = new UUID(rdata.Parameters[PARM_USERID]);
221 rdata.userProfile = Rest.UserServices.GetUserProfile(rdata.uuid); 222 // Rest.Log.DebugFormat("{0} UUID supplied", MsgId);
222 } 223 // rdata.userProfile = Rest.UserServices.GetUserProfile(rdata.uuid);
223 catch 224 //}
224 { 225 //catch
225 string[] names = rdata.Parameters[PARM_USERID].Split(Rest.CA_SPACE); 226 //{
226 if (names.Length == 2) 227 // string[] names = rdata.Parameters[PARM_USERID].Split(Rest.CA_SPACE);
227 { 228 // if (names.Length == 2)
228 Rest.Log.DebugFormat("{0} Agent Name supplied [2]", MsgId); 229 // {
229 rdata.userProfile = Rest.UserServices.GetUserProfile(names[0],names[1]); 230 // Rest.Log.DebugFormat("{0} Agent Name supplied [2]", MsgId);
230 } 231 // rdata.userProfile = Rest.UserServices.GetUserProfile(names[0],names[1]);
231 else 232 // }
232 { 233 // else
233 Rest.Log.WarnFormat("{0} A Valid UUID or both first and last names must be specified", MsgId); 234 // {
234 rdata.Fail(Rest.HttpStatusCodeBadRequest, "invalid user identity"); 235 // Rest.Log.WarnFormat("{0} A Valid UUID or both first and last names must be specified", MsgId);
235 } 236 // rdata.Fail(Rest.HttpStatusCodeBadRequest, "invalid user identity");
236 } 237 // }
237 238 //}
238 // If the user profile is null then either the server is broken, or the 239
239 // user is not known. We always assume the latter case. 240 //// If the user profile is null then either the server is broken, or the
240 241 //// user is not known. We always assume the latter case.
241 if (rdata.userProfile != null) 242
242 { 243 //if (rdata.userProfile != null)
243 Rest.Log.DebugFormat("{0} User profile obtained for agent {1} {2}", 244 //{
244 MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName); 245 // Rest.Log.DebugFormat("{0} User profile obtained for agent {1} {2}",
245 } 246 // MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
246 else 247 //}
247 { 248 //else
248 Rest.Log.WarnFormat("{0} No user profile for {1}", MsgId, rdata.path); 249 //{
249 rdata.Fail(Rest.HttpStatusCodeNotFound, "unrecognized user identity"); 250 // Rest.Log.WarnFormat("{0} No user profile for {1}", MsgId, rdata.path);
250 } 251 // rdata.Fail(Rest.HttpStatusCodeNotFound, "unrecognized user identity");
251 252 //}
252 // If we get to here, then we have effectively validated the user's 253
253 254 //// If we get to here, then we have effectively validated the user's
254 switch (rdata.method) 255
255 { 256 //switch (rdata.method)
256 case Rest.HEAD : // Do the processing, set the status code, suppress entity 257 //{
257 DoGet(rdata); 258 // case Rest.HEAD : // Do the processing, set the status code, suppress entity
258 rdata.buffer = null; 259 // DoGet(rdata);
259 break; 260 // rdata.buffer = null;
260 261 // break;
261 case Rest.GET : // Do the processing, set the status code, return entity 262
262 DoGet(rdata); 263 // case Rest.GET : // Do the processing, set the status code, return entity
263 break; 264 // DoGet(rdata);
264 265 // break;
265 case Rest.PUT : // Update named element 266
266 DoUpdate(rdata); 267 // case Rest.PUT : // Update named element
267 break; 268 // DoUpdate(rdata);
268 269 // break;
269 case Rest.POST : // Add new information to identified context. 270
270 DoExtend(rdata); 271 // case Rest.POST : // Add new information to identified context.
271 break; 272 // DoExtend(rdata);
272 273 // break;
273 case Rest.DELETE : // Delete information 274
274 DoDelete(rdata); 275 // case Rest.DELETE : // Delete information
275 break; 276 // DoDelete(rdata);
276 277 // break;
277 default : 278
278 Rest.Log.WarnFormat("{0} Method {1} not supported for {2}", 279 // default :
279 MsgId, rdata.method, rdata.path); 280 // Rest.Log.WarnFormat("{0} Method {1} not supported for {2}",
280 rdata.Fail(Rest.HttpStatusCodeMethodNotAllowed, 281 // MsgId, rdata.method, rdata.path);
281 String.Format("{0} not supported", rdata.method)); 282 // rdata.Fail(Rest.HttpStatusCodeMethodNotAllowed,
282 break; 283 // String.Format("{0} not supported", rdata.method));
283 } 284 // break;
285 //}
284 } 286 }
285 287
286 #endregion Interface 288 #endregion Interface
@@ -294,15 +296,15 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
294 296
295 private void DoGet(AppearanceRequestData rdata) 297 private void DoGet(AppearanceRequestData rdata)
296 { 298 {
299 AvatarData adata = Rest.AvatarServices.GetAvatar(rdata.userProfile.ID);
297 300
298 rdata.userAppearance = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID); 301 if (adata == null)
299
300 if (rdata.userAppearance == null)
301 { 302 {
302 rdata.Fail(Rest.HttpStatusCodeNoContent, 303 rdata.Fail(Rest.HttpStatusCodeNoContent,
303 String.Format("appearance data not found for user {0} {1}", 304 String.Format("appearance data not found for user {0} {1}",
304 rdata.userProfile.FirstName, rdata.userProfile.SurName)); 305 rdata.userProfile.FirstName, rdata.userProfile.SurName));
305 } 306 }
307 rdata.userAppearance = adata.ToAvatarAppearance(rdata.userProfile.ID);
306 308
307 rdata.initXmlWriter(); 309 rdata.initXmlWriter();
308 310
@@ -341,18 +343,20 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
341 // increasingly doubtful that it is appropriate for REST. If I attempt to 343 // increasingly doubtful that it is appropriate for REST. If I attempt to
342 // add a new record, and it already exists, then it seems to me that the 344 // add a new record, and it already exists, then it seems to me that the
343 // attempt should fail, rather than update the existing record. 345 // attempt should fail, rather than update the existing record.
344 346 AvatarData adata = null;
345 if (GetUserAppearance(rdata)) 347 if (GetUserAppearance(rdata))
346 { 348 {
347 modified = rdata.userAppearance != null; 349 modified = rdata.userAppearance != null;
348 created = !modified; 350 created = !modified;
349 Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance); 351 adata = new AvatarData(rdata.userAppearance);
352 Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
350 // Rest.UserServices.UpdateUserProfile(rdata.userProfile); 353 // Rest.UserServices.UpdateUserProfile(rdata.userProfile);
351 } 354 }
352 else 355 else
353 { 356 {
354 created = true; 357 created = true;
355 Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance); 358 adata = new AvatarData(rdata.userAppearance);
359 Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
356 // Rest.UserServices.UpdateUserProfile(rdata.userProfile); 360 // Rest.UserServices.UpdateUserProfile(rdata.userProfile);
357 } 361 }
358 362
@@ -391,37 +395,39 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
391 private void DoUpdate(AppearanceRequestData rdata) 395 private void DoUpdate(AppearanceRequestData rdata)
392 { 396 {
393 397
394 bool created = false; 398 // REFACTORING PROBLEM This was commented out. It doesn't work for 0.7
395 bool modified = false;
396 399
400 //bool created = false;
401 //bool modified = false;
397 402
398 rdata.userAppearance = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
399 403
400 // If the user exists then this is considered a modification regardless 404 //rdata.userAppearance = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
401 // of what may, or may not be, specified in the payload.
402 405
403 if (rdata.userAppearance != null) 406 //// If the user exists then this is considered a modification regardless
404 { 407 //// of what may, or may not be, specified in the payload.
405 modified = true;
406 Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
407 Rest.UserServices.UpdateUserProfile(rdata.userProfile);
408 }
409 408
410 if (created) 409 //if (rdata.userAppearance != null)
411 { 410 //{
412 rdata.Complete(Rest.HttpStatusCodeCreated); 411 // modified = true;
413 } 412 // Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
414 else 413 // Rest.UserServices.UpdateUserProfile(rdata.userProfile);
415 { 414 //}
416 if (modified) 415
417 { 416 //if (created)
418 rdata.Complete(Rest.HttpStatusCodeOK); 417 //{
419 } 418 // rdata.Complete(Rest.HttpStatusCodeCreated);
420 else 419 //}
421 { 420 //else
422 rdata.Complete(Rest.HttpStatusCodeNoContent); 421 //{
423 } 422 // if (modified)
424 } 423 // {
424 // rdata.Complete(Rest.HttpStatusCodeOK);
425 // }
426 // else
427 // {
428 // rdata.Complete(Rest.HttpStatusCodeNoContent);
429 // }
430 //}
425 431
426 rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method)); 432 rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
427 433
@@ -436,21 +442,22 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
436 442
437 private void DoDelete(AppearanceRequestData rdata) 443 private void DoDelete(AppearanceRequestData rdata)
438 { 444 {
445 AvatarData adata = Rest.AvatarServices.GetAvatar(rdata.userProfile.ID);
439 446
440 AvatarAppearance old = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID); 447 if (adata != null)
441
442 if (old != null)
443 { 448 {
449 AvatarAppearance old = adata.ToAvatarAppearance(rdata.userProfile.ID);
444 rdata.userAppearance = new AvatarAppearance(); 450 rdata.userAppearance = new AvatarAppearance();
445
446 rdata.userAppearance.Owner = old.Owner; 451 rdata.userAppearance.Owner = old.Owner;
452 adata = new AvatarData(rdata.userAppearance);
447 453
448 Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance); 454 Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
449 455
450 rdata.Complete(); 456 rdata.Complete();
451 } 457 }
452 else 458 else
453 { 459 {
460
454 rdata.Complete(Rest.HttpStatusCodeNoContent); 461 rdata.Complete(Rest.HttpStatusCodeNoContent);
455 } 462 }
456 463
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
index 01bfe00..fb1d739 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
@@ -36,7 +36,7 @@ using System.Xml;
36using OpenMetaverse; 36using OpenMetaverse;
37using OpenMetaverse.Imaging; 37using OpenMetaverse.Imaging;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Framework.Communications.Cache; 39
40using OpenSim.Framework.Servers; 40using OpenSim.Framework.Servers;
41using OpenSim.Framework.Servers.HttpServer; 41using OpenSim.Framework.Servers.HttpServer;
42using Timer=System.Timers.Timer; 42using Timer=System.Timers.Timer;
@@ -143,203 +143,205 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
143 143
144 Rest.Log.DebugFormat("{0} DoInventory ENTRY", MsgId); 144 Rest.Log.DebugFormat("{0} DoInventory ENTRY", MsgId);
145 145
146 // If we're disabled, do nothing. 146 // !!! REFACTORING PROBLEM
147 147
148 if (!enabled) 148 //// If we're disabled, do nothing.
149 { 149
150 return; 150 //if (!enabled)
151 } 151 //{
152 152 // return;
153 // Now that we know this is a serious attempt to 153 //}
154 // access inventory data, we should find out who 154
155 // is asking, and make sure they are authorized 155 //// Now that we know this is a serious attempt to
156 // to do so. We need to validate the caller's 156 //// access inventory data, we should find out who
157 // identity before revealing anything about the 157 //// is asking, and make sure they are authorized
158 // status quo. Authenticate throws an exception 158 //// to do so. We need to validate the caller's
159 // via Fail if no identity information is present. 159 //// identity before revealing anything about the
160 // 160 //// status quo. Authenticate throws an exception
161 // With the present HTTP server we can't use the 161 //// via Fail if no identity information is present.
162 // builtin authentication mechanisms because they 162 ////
163 // would be enforced for all in-bound requests. 163 //// With the present HTTP server we can't use the
164 // Instead we look at the headers ourselves and 164 //// builtin authentication mechanisms because they
165 // handle authentication directly. 165 //// would be enforced for all in-bound requests.
166 166 //// Instead we look at the headers ourselves and
167 try 167 //// handle authentication directly.
168 { 168
169 if (!rdata.IsAuthenticated) 169 //try
170 { 170 //{
171 rdata.Fail(Rest.HttpStatusCodeNotAuthorized,String.Format("user \"{0}\" could not be authenticated", rdata.userName)); 171 // if (!rdata.IsAuthenticated)
172 } 172 // {
173 } 173 // rdata.Fail(Rest.HttpStatusCodeNotAuthorized,String.Format("user \"{0}\" could not be authenticated", rdata.userName));
174 catch (RestException e) 174 // }
175 { 175 //}
176 if (e.statusCode == Rest.HttpStatusCodeNotAuthorized) 176 //catch (RestException e)
177 { 177 //{
178 Rest.Log.WarnFormat("{0} User not authenticated", MsgId); 178 // if (e.statusCode == Rest.HttpStatusCodeNotAuthorized)
179 Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization")); 179 // {
180 } 180 // Rest.Log.WarnFormat("{0} User not authenticated", MsgId);
181 else 181 // Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization"));
182 { 182 // }
183 Rest.Log.ErrorFormat("{0} User authentication failed", MsgId); 183 // else
184 Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization")); 184 // {
185 } 185 // Rest.Log.ErrorFormat("{0} User authentication failed", MsgId);
186 throw (e); 186 // Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization"));
187 } 187 // }
188 188 // throw (e);
189 Rest.Log.DebugFormat("{0} Authenticated {1}", MsgId, rdata.userName); 189 //}
190 190
191 // We can only get here if we are authorized 191 //Rest.Log.DebugFormat("{0} Authenticated {1}", MsgId, rdata.userName);
192 // 192
193 // The requestor may have specified an UUID or 193 //// We can only get here if we are authorized
194 // a conjoined FirstName LastName string. We'll 194 ////
195 // try both. If we fail with the first, UUID, 195 //// The requestor may have specified an UUID or
196 // attempt, we try the other. As an example, the 196 //// a conjoined FirstName LastName string. We'll
197 // URI for a valid inventory request might be: 197 //// try both. If we fail with the first, UUID,
198 // 198 //// attempt, we try the other. As an example, the
199 // http://<host>:<port>/admin/inventory/Arthur Dent 199 //// URI for a valid inventory request might be:
200 // 200 ////
201 // Indicating that this is an inventory request for 201 //// http://<host>:<port>/admin/inventory/Arthur Dent
202 // an avatar named Arthur Dent. This is ALL that is 202 ////
203 // required to designate a GET for an entire 203 //// Indicating that this is an inventory request for
204 // inventory. 204 //// an avatar named Arthur Dent. This is ALL that is
205 // 205 //// required to designate a GET for an entire
206 206 //// inventory.
207 207 ////
208 // Do we have at least a user agent name? 208
209 209
210 if (rdata.Parameters.Length < 1) 210 //// Do we have at least a user agent name?
211 { 211
212 Rest.Log.WarnFormat("{0} Inventory: No user agent identifier specified", MsgId); 212 //if (rdata.Parameters.Length < 1)
213 rdata.Fail(Rest.HttpStatusCodeBadRequest, "no user identity specified"); 213 //{
214 } 214 // Rest.Log.WarnFormat("{0} Inventory: No user agent identifier specified", MsgId);
215 215 // rdata.Fail(Rest.HttpStatusCodeBadRequest, "no user identity specified");
216 // The first parameter MUST be the agent identification, either an UUID 216 //}
217 // or a space-separated First-name Last-Name specification. We check for 217
218 // an UUID first, if anyone names their character using a valid UUID 218 //// The first parameter MUST be the agent identification, either an UUID
219 // that identifies another existing avatar will cause this a problem... 219 //// or a space-separated First-name Last-Name specification. We check for
220 220 //// an UUID first, if anyone names their character using a valid UUID
221 try 221 //// that identifies another existing avatar will cause this a problem...
222 { 222
223 rdata.uuid = new UUID(rdata.Parameters[PARM_USERID]); 223 //try
224 Rest.Log.DebugFormat("{0} UUID supplied", MsgId); 224 //{
225 rdata.userProfile = Rest.UserServices.GetUserProfile(rdata.uuid); 225 // rdata.uuid = new UUID(rdata.Parameters[PARM_USERID]);
226 } 226 // Rest.Log.DebugFormat("{0} UUID supplied", MsgId);
227 catch 227 // rdata.userProfile = Rest.UserServices.GetUserProfile(rdata.uuid);
228 { 228 //}
229 string[] names = rdata.Parameters[PARM_USERID].Split(Rest.CA_SPACE); 229 //catch
230 if (names.Length == 2) 230 //{
231 { 231 // string[] names = rdata.Parameters[PARM_USERID].Split(Rest.CA_SPACE);
232 Rest.Log.DebugFormat("{0} Agent Name supplied [2]", MsgId); 232 // if (names.Length == 2)
233 rdata.userProfile = Rest.UserServices.GetUserProfile(names[0],names[1]); 233 // {
234 } 234 // Rest.Log.DebugFormat("{0} Agent Name supplied [2]", MsgId);
235 else 235 // rdata.userProfile = Rest.UserServices.GetUserProfile(names[0],names[1]);
236 { 236 // }
237 Rest.Log.WarnFormat("{0} A Valid UUID or both first and last names must be specified", MsgId); 237 // else
238 rdata.Fail(Rest.HttpStatusCodeBadRequest, "invalid user identity"); 238 // {
239 } 239 // Rest.Log.WarnFormat("{0} A Valid UUID or both first and last names must be specified", MsgId);
240 } 240 // rdata.Fail(Rest.HttpStatusCodeBadRequest, "invalid user identity");
241 241 // }
242 // If the user profile is null then either the server is broken, or the 242 //}
243 // user is not known. We always assume the latter case. 243
244 244 //// If the user profile is null then either the server is broken, or the
245 if (rdata.userProfile != null) 245 //// user is not known. We always assume the latter case.
246 { 246
247 Rest.Log.DebugFormat("{0} Profile obtained for agent {1} {2}", 247 //if (rdata.userProfile != null)
248 MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName); 248 //{
249 } 249 // Rest.Log.DebugFormat("{0} Profile obtained for agent {1} {2}",
250 else 250 // MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
251 { 251 //}
252 Rest.Log.WarnFormat("{0} No profile for {1}", MsgId, rdata.path); 252 //else
253 rdata.Fail(Rest.HttpStatusCodeNotFound, "unrecognized user identity"); 253 //{
254 } 254 // Rest.Log.WarnFormat("{0} No profile for {1}", MsgId, rdata.path);
255 255 // rdata.Fail(Rest.HttpStatusCodeNotFound, "unrecognized user identity");
256 // If we get to here, then we have effectively validated the user's 256 //}
257 // identity. Now we need to get the inventory. If the server does not 257
258 // have the inventory, we reject the request with an appropriate explanation. 258 //// If we get to here, then we have effectively validated the user's
259 // 259 //// identity. Now we need to get the inventory. If the server does not
260 // Note that inventory retrieval is an asynchronous event, we use the rdata 260 //// have the inventory, we reject the request with an appropriate explanation.
261 // class instance as the basis for our synchronization. 261 ////
262 // 262 //// Note that inventory retrieval is an asynchronous event, we use the rdata
263 263 //// class instance as the basis for our synchronization.
264 rdata.uuid = rdata.userProfile.ID; 264 ////
265 265
266 if (Rest.InventoryServices.HasInventoryForUser(rdata.uuid)) 266 //rdata.uuid = rdata.userProfile.ID;
267 { 267
268 rdata.root = Rest.InventoryServices.GetRootFolder(rdata.uuid); 268 //if (Rest.InventoryServices.HasInventoryForUser(rdata.uuid))
269 269 //{
270 Rest.Log.DebugFormat("{0} Inventory Root retrieved for {1} {2}", 270 // rdata.root = Rest.InventoryServices.GetRootFolder(rdata.uuid);
271 MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName); 271
272 272 // Rest.Log.DebugFormat("{0} Inventory Root retrieved for {1} {2}",
273 Rest.InventoryServices.GetUserInventory(rdata.uuid, rdata.GetUserInventory); 273 // MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
274 274
275 Rest.Log.DebugFormat("{0} Inventory catalog requested for {1} {2}", 275 // Rest.InventoryServices.GetUserInventory(rdata.uuid, rdata.GetUserInventory);
276 MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName); 276
277 277 // Rest.Log.DebugFormat("{0} Inventory catalog requested for {1} {2}",
278 lock (rdata) 278 // MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
279 { 279
280 if (!rdata.HaveInventory) 280 // lock (rdata)
281 { 281 // {
282 rdata.startWD(1000); 282 // if (!rdata.HaveInventory)
283 rdata.timeout = false; 283 // {
284 Monitor.Wait(rdata); 284 // rdata.startWD(1000);
285 } 285 // rdata.timeout = false;
286 } 286 // Monitor.Wait(rdata);
287 287 // }
288 if (rdata.timeout) 288 // }
289 { 289
290 Rest.Log.WarnFormat("{0} Inventory not available for {1} {2}. No response from service.", 290 // if (rdata.timeout)
291 MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName); 291 // {
292 rdata.Fail(Rest.HttpStatusCodeServerError, "inventory server not responding"); 292 // Rest.Log.WarnFormat("{0} Inventory not available for {1} {2}. No response from service.",
293 } 293 // MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
294 294 // rdata.Fail(Rest.HttpStatusCodeServerError, "inventory server not responding");
295 if (rdata.root == null) 295 // }
296 { 296
297 Rest.Log.WarnFormat("{0} Inventory is not available [1] for agent {1} {2}", 297 // if (rdata.root == null)
298 MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName); 298 // {
299 rdata.Fail(Rest.HttpStatusCodeServerError, "inventory retrieval failed"); 299 // Rest.Log.WarnFormat("{0} Inventory is not available [1] for agent {1} {2}",
300 } 300 // MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
301 301 // rdata.Fail(Rest.HttpStatusCodeServerError, "inventory retrieval failed");
302 } 302 // }
303 else 303
304 { 304 //}
305 Rest.Log.WarnFormat("{0} Inventory is not locally available for agent {1} {2}", 305 //else
306 MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName); 306 //{
307 rdata.Fail(Rest.HttpStatusCodeNotFound, "no local inventory for user"); 307 // Rest.Log.WarnFormat("{0} Inventory is not locally available for agent {1} {2}",
308 } 308 // MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
309 309 // rdata.Fail(Rest.HttpStatusCodeNotFound, "no local inventory for user");
310 // If we get here, then we have successfully retrieved the user's information 310 //}
311 // and inventory information is now available locally. 311
312 312 //// If we get here, then we have successfully retrieved the user's information
313 switch (rdata.method) 313 //// and inventory information is now available locally.
314 { 314
315 case Rest.HEAD : // Do the processing, set the status code, suppress entity 315 //switch (rdata.method)
316 DoGet(rdata); 316 //{
317 rdata.buffer = null; 317 // case Rest.HEAD : // Do the processing, set the status code, suppress entity
318 break; 318 // DoGet(rdata);
319 319 // rdata.buffer = null;
320 case Rest.GET : // Do the processing, set the status code, return entity 320 // break;
321 DoGet(rdata); 321
322 break; 322 // case Rest.GET : // Do the processing, set the status code, return entity
323 323 // DoGet(rdata);
324 case Rest.PUT : // Update named element 324 // break;
325 DoUpdate(rdata); 325
326 break; 326 // case Rest.PUT : // Update named element
327 327 // DoUpdate(rdata);
328 case Rest.POST : // Add new information to identified context. 328 // break;
329 DoExtend(rdata); 329
330 break; 330 // case Rest.POST : // Add new information to identified context.
331 331 // DoExtend(rdata);
332 case Rest.DELETE : // Delete information 332 // break;
333 DoDelete(rdata); 333
334 break; 334 // case Rest.DELETE : // Delete information
335 335 // DoDelete(rdata);
336 default : 336 // break;
337 Rest.Log.WarnFormat("{0} Method {1} not supported for {2}", 337
338 MsgId, rdata.method, rdata.path); 338 // default :
339 rdata.Fail(Rest.HttpStatusCodeMethodNotAllowed, 339 // Rest.Log.WarnFormat("{0} Method {1} not supported for {2}",
340 String.Format("{0} not supported", rdata.method)); 340 // MsgId, rdata.method, rdata.path);
341 break; 341 // rdata.Fail(Rest.HttpStatusCodeMethodNotAllowed,
342 } 342 // String.Format("{0} not supported", rdata.method));
343 // break;
344 //}
343 } 345 }
344 346
345 #endregion Interface 347 #endregion Interface
diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs
index 5798286..734b668 100644
--- a/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs
@@ -113,14 +113,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
113 rxw.WriteString(s.RegionInfo.ExternalHostName); 113 rxw.WriteString(s.RegionInfo.ExternalHostName);
114 rxw.WriteEndAttribute(); 114 rxw.WriteEndAttribute();
115 115
116 rxw.WriteStartAttribute(String.Empty, "master_name", String.Empty);
117 rxw.WriteString(String.Format("{0} {1}", s.RegionInfo.MasterAvatarFirstName, s.RegionInfo.MasterAvatarLastName));
118 rxw.WriteEndAttribute();
119
120 rxw.WriteStartAttribute(String.Empty, "master_uuid", String.Empty);
121 rxw.WriteString(s.RegionInfo.MasterAvatarAssignedUUID.ToString());
122 rxw.WriteEndAttribute();
123
124 rxw.WriteStartAttribute(String.Empty, "ip", String.Empty); 116 rxw.WriteStartAttribute(String.Empty, "ip", String.Empty);
125 rxw.WriteString(s.RegionInfo.InternalEndPoint.ToString()); 117 rxw.WriteString(s.RegionInfo.InternalEndPoint.ToString());
126 rxw.WriteEndAttribute(); 118 rxw.WriteEndAttribute();
diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/RegionDetails.cs b/OpenSim/ApplicationPlugins/Rest/Regions/RegionDetails.cs
index 746d08d..5e76009 100644
--- a/OpenSim/ApplicationPlugins/Rest/Regions/RegionDetails.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Regions/RegionDetails.cs
@@ -56,20 +56,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
56 region_id = regInfo.RegionID.ToString(); 56 region_id = regInfo.RegionID.ToString();
57 region_x = regInfo.RegionLocX; 57 region_x = regInfo.RegionLocX;
58 region_y = regInfo.RegionLocY; 58 region_y = regInfo.RegionLocY;
59 if (regInfo.EstateSettings.EstateOwner != UUID.Zero) 59 region_owner_id = regInfo.EstateSettings.EstateOwner.ToString();
60 region_owner_id = regInfo.EstateSettings.EstateOwner.ToString();
61 else
62 region_owner_id = regInfo.MasterAvatarAssignedUUID.ToString();
63 region_http_port = regInfo.HttpPort; 60 region_http_port = regInfo.HttpPort;
64 region_server_uri = regInfo.ServerURI; 61 region_server_uri = regInfo.ServerURI;
65 region_external_hostname = regInfo.ExternalHostName; 62 region_external_hostname = regInfo.ExternalHostName;
66 63
67 Uri uri = new Uri(region_server_uri); 64 Uri uri = new Uri(region_server_uri);
68 region_port = (uint)uri.Port; 65 region_port = (uint)uri.Port;
69
70 if (!String.IsNullOrEmpty(regInfo.MasterAvatarFirstName))
71 region_owner = String.Format("{0} {1}", regInfo.MasterAvatarFirstName,
72 regInfo.MasterAvatarLastName);
73 } 66 }
74 67
75 public string this[string idx] 68 public string this[string idx]