From b2b5675bd4b43861f95d3b576b427db519c17728 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Tue, 22 Jul 2008 17:43:09 +0000
Subject: * refactor: move new inventory service call by user server to OGS1
 with all the other service calls * will post to mailing list about moving
 this shortly

---
 OpenSim/Grid/UserServer/Main.cs                           | 15 ++++++++-------
 OpenSim/Grid/UserServer/UserManager.cs                    |  1 +
 .../Region/Communications/OGS1/OGS1InventoryService.cs    |  5 +++--
 prebuild.xml                                              |  1 +
 4 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index a04b5ef..c7011a9 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -34,10 +34,12 @@ using libsecondlife;
 using log4net;
 using log4net.Config;
 using OpenSim.Framework;
+using OpenSim.Framework.Communications;
 using OpenSim.Framework.Communications.Cache;
 using OpenSim.Framework.Console;
 using OpenSim.Framework.Servers;
 using OpenSim.Framework.Statistics;
+using OpenSim.Region.Communications.OGS1;
 
 namespace OpenSim.Grid.UserServer
 {
@@ -52,6 +54,7 @@ namespace OpenSim.Grid.UserServer
         public UserManager m_userManager;
         public UserLoginService m_loginService;
         public MessageServersConnector m_messagesService;
+        protected IInventoryServices m_inventoryService;
 
         private LLUUID m_lastCreatedUser = LLUUID.Random();
 
@@ -100,6 +103,8 @@ namespace OpenSim.Grid.UserServer
             m_loginService = new UserLoginService(
                  m_userManager, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg);
 
+            m_inventoryService = new OGS1InventoryService(m_userManager._config.InventoryUrl);
+            
             m_messagesService = new MessageServersConnector();
 
             m_loginService.OnUserLoggedInAtLocation += NotifyMessageServersUserLoggedInToLocation;
@@ -178,6 +183,7 @@ namespace OpenSim.Grid.UserServer
                     tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + String.Empty);
 
                     LLUUID userID = new LLUUID();
+                    
                     try
                     {
                         userID = m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
@@ -188,12 +194,8 @@ namespace OpenSim.Grid.UserServer
                     }
 
                     try
-                    {
-                        bool created
-                            = SynchronousRestObjectPoster.BeginPostObject<Guid, bool>(
-                                "POST", m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID);
-
-                        if (!created)
+                    {                        
+                        if (!m_inventoryService.CreateNewUserInventory(userID))
                         {
                             throw new Exception(
                                 String.Format(
@@ -201,7 +203,6 @@ namespace OpenSim.Grid.UserServer
                                         + "  Please contact your inventory service provider for more information.",
                                     userID));
                         }
-
                     }
                     catch (WebException)
                     {
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs
index b48f20e..ff62d78 100644
--- a/OpenSim/Grid/UserServer/UserManager.cs
+++ b/OpenSim/Grid/UserServer/UserManager.cs
@@ -407,6 +407,7 @@ namespace OpenSim.Grid.UserServer
 
             return ProfileToXmlRPCResponse(userProfile);
         }
+        
         public XmlRpcResponse XmlRPCGetAgentMethodUUID(XmlRpcRequest request)
         {
             XmlRpcResponse response = new XmlRpcResponse();
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
index 4e4bfe8..05ecfcc 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
@@ -306,9 +306,10 @@ namespace OpenSim.Region.Communications.OGS1
             return null;
         }
 
-        public bool CreateNewUserInventory(LLUUID user)
+        public bool CreateNewUserInventory(LLUUID userId)
         {
-            return false;
+            return SynchronousRestObjectPoster.BeginPostObject<Guid, bool>(
+                "POST", _inventoryServerUrl + "CreateInventory/", userId.UUID);
         }
 
         // See IInventoryServices
diff --git a/prebuild.xml b/prebuild.xml
index 513b419..40f4f5e 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -1739,6 +1739,7 @@
       <Reference name="OpenSim.Data"/>
       <Reference name="OpenSim.Framework.Servers"/>
       <Reference name="OpenSim.Framework.Statistics"/>
+      <Reference name="OpenSim.Region.Communications.OGS1"/>
       <Reference name="libsecondlife.dll"/>
       <Reference name="XMLRPC.dll"/>
       <Reference name="log4net.dll"/>
-- 
cgit v1.1