From fe9aea258ff4142e718b4916ccefeeedef229768 Mon Sep 17 00:00:00 2001 From: Homer Horwitz Date: Wed, 24 Sep 2008 21:12:21 +0000 Subject: Add persistence of active gestures. This needs an UGAIM update to work. Active gestures are sent as part of the login-response. Added fetchActiveGestures to SQLite and MySQL; added an empty one for MSSQL and NHibernate. Using the empty ones won't cause errors, but doesn't provide persistence either, of course. --- .../OGS1/OGS1InterServiceInventoryService.cs | 16 ++++++++++ .../Grid/InventoryServer/GridInventoryService.cs | 9 ++++++ OpenSim/Grid/InventoryServer/Main.cs | 5 ++++ OpenSim/Grid/UserServer/UserLoginService.cs | 34 ++++++++++++++++++++-- 4 files changed, 62 insertions(+), 2 deletions(-) (limited to 'OpenSim/Grid') diff --git a/OpenSim/Grid/Communications/OGS1/OGS1InterServiceInventoryService.cs b/OpenSim/Grid/Communications/OGS1/OGS1InterServiceInventoryService.cs index 5de5bb3..ee76d74 100644 --- a/OpenSim/Grid/Communications/OGS1/OGS1InterServiceInventoryService.cs +++ b/OpenSim/Grid/Communications/OGS1/OGS1InterServiceInventoryService.cs @@ -67,5 +67,21 @@ namespace OpenSim.Grid.Communications.OGS1 return SynchronousRestObjectPoster.BeginPostObject>( "POST", m_inventoryServerUrl + "RootFolders/", userId.Guid); } + + /// + /// Returns a list of all the active gestures in a user's inventory. + /// + /// + /// The of the user + /// + /// + /// A flat list of the gesture items. + /// + public List GetActiveGestures(UUID userId) + { + return SynchronousRestObjectPoster.BeginPostObject>( + "POST", m_inventoryServerUrl + "ActiveGestures/", userId.Guid); + } + } } diff --git a/OpenSim/Grid/InventoryServer/GridInventoryService.cs b/OpenSim/Grid/InventoryServer/GridInventoryService.cs index 4d58775..6f7672e 100644 --- a/OpenSim/Grid/InventoryServer/GridInventoryService.cs +++ b/OpenSim/Grid/InventoryServer/GridInventoryService.cs @@ -233,5 +233,14 @@ namespace OpenSim.Grid.InventoryServer return CreateNewUserInventory(userID); } + + public List GetActiveGestures(Guid rawUserID) + { + UUID userID = new UUID(rawUserID); + + m_log.InfoFormat("[GRID AGENT INVENTORY]: fetching active gestures for user {0}", userID); + + return GetActiveGestures(userID); + } } } diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs index 9f40d16..3b990e7 100644 --- a/OpenSim/Grid/InventoryServer/Main.cs +++ b/OpenSim/Grid/InventoryServer/Main.cs @@ -123,6 +123,11 @@ namespace OpenSim.Grid.InventoryServer m_httpServer.AddStreamHandler( new RestDeserialiseTrustedHandler> ("POST", "/RootFolders/", m_inventoryService.GetInventorySkeleton, m_inventoryService.CheckTrustSource)); + + // for persistent active gestures + m_httpServer.AddStreamHandler( + new RestDeserialiseTrustedHandler> + ("POST", "/ActiveGestures/", m_inventoryService.GetActiveGestures, m_inventoryService.CheckTrustSource)); } private void Work() diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs index 8ab9af1..573e546 100644 --- a/OpenSim/Grid/UserServer/UserLoginService.cs +++ b/OpenSim/Grid/UserServer/UserLoginService.cs @@ -131,6 +131,9 @@ namespace OpenSim.Grid.UserServer /// The requested start location public override bool CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest) { + // add active gestures to login-response + AddActiveGestures(response, theUser); + // HomeLocation RegionProfileData homeInfo = null; // use the homeRegionID if it is stored already. If not, use the regionHandle as before @@ -243,10 +246,37 @@ namespace OpenSim.Grid.UserServer // theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z); theUser.CurrentAgent.Position = new Vector3(128,128,0); response.StartLocation = "safe"; - + return PrepareLoginToRegion(regionInfo, theUser, response); } - + + /// + /// Add active gestures of the user to the login response. + /// + /// + /// A + /// + /// + /// A + /// + private void AddActiveGestures(LoginResponse response, UserProfileData theUser) + { + List gestures = m_inventoryService.GetActiveGestures(theUser.ID); + m_log.DebugFormat("[LOGIN]: AddActiveGestures, found {0}", gestures == null ? 0 : gestures.Count); + ArrayList list = new ArrayList(); + if (gestures != null) + { + foreach (InventoryItemBase gesture in gestures) + { + Hashtable item = new Hashtable(); + item["item_id"] = gesture.ID.ToString(); + item["asset_id"] = gesture.AssetID.ToString(); + list.Add(item); + } + } + response.ActiveGestures = list; + } + /// /// Prepare a login to the given region. This involves both telling the region to expect a connection /// and appropriately customising the response to the user. -- cgit v1.1