aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorHomer Horwitz2008-09-24 21:12:21 +0000
committerHomer Horwitz2008-09-24 21:12:21 +0000
commitfe9aea258ff4142e718b4916ccefeeedef229768 (patch)
treef60c40697833392b35788fbc5cd97a5014bb29b7 /OpenSim
parentlight the mysql region tests (diff)
downloadopensim-SC_OLD-fe9aea258ff4142e718b4916ccefeeedef229768.zip
opensim-SC_OLD-fe9aea258ff4142e718b4916ccefeeedef229768.tar.gz
opensim-SC_OLD-fe9aea258ff4142e718b4916ccefeeedef229768.tar.bz2
opensim-SC_OLD-fe9aea258ff4142e718b4916ccefeeedef229768.tar.xz
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.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLInventoryData.cs5
-rw-r--r--OpenSim/Data/MySQL/MySQLInventoryData.cs36
-rw-r--r--OpenSim/Data/NHibernate/NHibernateInventoryData.cs5
-rw-r--r--OpenSim/Data/SQLite/SQLiteInventoryStore.cs19
-rw-r--r--OpenSim/Framework/Communications/IInterServiceInventoryServices.cs11
-rw-r--r--OpenSim/Framework/Communications/InventoryServiceBase.cs9
-rw-r--r--OpenSim/Framework/Communications/LoginResponse.cs12
-rw-r--r--OpenSim/Framework/IInventoryData.cs11
-rw-r--r--OpenSim/Grid/Communications/OGS1/OGS1InterServiceInventoryService.cs16
-rw-r--r--OpenSim/Grid/InventoryServer/GridInventoryService.cs9
-rw-r--r--OpenSim/Grid/InventoryServer/Main.cs5
-rw-r--r--OpenSim/Grid/UserServer/UserLoginService.cs34
-rw-r--r--OpenSim/Region/Communications/Local/LocalLoginService.cs30
13 files changed, 198 insertions, 4 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
index 03600e2..2b9913c 100644
--- a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
@@ -798,6 +798,11 @@ namespace OpenSim.Data.MSSQL
798 m_log.Error("[INVENTORY DB] Error deleting folder :" + e.Message); 798 m_log.Error("[INVENTORY DB] Error deleting folder :" + e.Message);
799 } 799 }
800 } 800 }
801
802 public List<InventoryItemBase> fetchActiveGestures (UUID avatarID)
803 {
804 return null;
805 }
801 #endregion 806 #endregion
802 } 807 }
803} 808}
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs
index 50d3cc7..68885e1 100644
--- a/OpenSim/Data/MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs
@@ -795,5 +795,41 @@ namespace OpenSim.Data.MySQL
795 deleteOneFolder(folderID); 795 deleteOneFolder(folderID);
796 deleteItemsInFolder(folderID); 796 deleteItemsInFolder(folderID);
797 } 797 }
798
799 public List<InventoryItemBase> fetchActiveGestures(UUID avatarID)
800 {
801 MySqlDataReader result = null;
802 MySqlCommand sqlCmd = null;
803 lock (database)
804 {
805 try
806 {
807 database.CheckConnection();
808 sqlCmd = new MySqlCommand(
809 "SELECT * FROM inventoryitems WHERE avatarId = ?uuid AND assetType = ?type and flags = 1",
810 database.Connection);
811 sqlCmd.Parameters.AddWithValue("?uuid", avatarID.ToString());
812 sqlCmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture);
813 result = sqlCmd.ExecuteReader();
814
815 List<InventoryItemBase> list = new List<InventoryItemBase>();
816 while (result.Read())
817 list.Add(readInventoryItem(result));
818
819 return list;
820 }
821 catch (Exception e)
822 {
823 database.Reconnect();
824 m_log.Error(e.ToString());
825 return null;
826 }
827 finally
828 {
829 if(result != null) result.Close();
830 if(sqlCmd != null) sqlCmd.Dispose();
831 }
832 }
833 }
798 } 834 }
799} 835}
diff --git a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
index 20dad1a..bceb5d5 100644
--- a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
@@ -389,5 +389,10 @@ namespace OpenSim.Data.NHibernate
389 389
390 return folders; 390 return folders;
391 } 391 }
392
393 public List<InventoryItemBase> fetchActiveGestures (UUID avatarID)
394 {
395 return null;
396 }
392 } 397 }
393} 398}
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
index 40b61ee..b9fda04 100644
--- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
@@ -847,5 +847,24 @@ namespace OpenSim.Data.SQLite
847 row["UUID"] = Util.ToRawUuidString(folder.ID); 847 row["UUID"] = Util.ToRawUuidString(folder.ID);
848 row["parentID"] = Util.ToRawUuidString(folder.ParentID); 848 row["parentID"] = Util.ToRawUuidString(folder.ParentID);
849 } 849 }
850
851 public List<InventoryItemBase> fetchActiveGestures (UUID avatarID)
852 {
853 lock (ds)
854 {
855 List<InventoryItemBase> items = new List<InventoryItemBase>();
856
857 DataTable inventoryItemTable = ds.Tables["inventoryitems"];
858 string selectExp = "avatarID = '" + Util.ToRawUuidString(avatarID) + "' AND assetType = " +
859 (int)AssetType.Gesture + " AND flags = 1";
860 m_log.DebugFormat("[SQL]: sql = " + selectExp);
861 DataRow[] rows = inventoryItemTable.Select(selectExp);
862 foreach (DataRow row in rows)
863 {
864 items.Add(buildItem(row));
865 }
866 return items;
867 }
868 }
850 } 869 }
851} 870}
diff --git a/OpenSim/Framework/Communications/IInterServiceInventoryServices.cs b/OpenSim/Framework/Communications/IInterServiceInventoryServices.cs
index 5900f4e..661eb91 100644
--- a/OpenSim/Framework/Communications/IInterServiceInventoryServices.cs
+++ b/OpenSim/Framework/Communications/IInterServiceInventoryServices.cs
@@ -49,5 +49,16 @@ namespace OpenSim.Framework.Communications
49 /// <returns>A flat list of the user's inventory folder tree, 49 /// <returns>A flat list of the user's inventory folder tree,
50 /// null if there is no inventory for this user</returns> 50 /// null if there is no inventory for this user</returns>
51 List<InventoryFolderBase> GetInventorySkeleton(UUID userId); 51 List<InventoryFolderBase> GetInventorySkeleton(UUID userId);
52
53 /// <summary>
54 /// Returns a list of all the active gestures in a user's inventory.
55 /// </summary>
56 /// <param name="userId">
57 /// The <see cref="UUID"/> of the user
58 /// </param>
59 /// <returns>
60 /// A flat list of the gesture items.
61 /// </returns>
62 List<InventoryItemBase> GetActiveGestures(UUID userId);
52 } 63 }
53} 64}
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs
index e9dc3c4..d6392c4 100644
--- a/OpenSim/Framework/Communications/InventoryServiceBase.cs
+++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs
@@ -148,6 +148,15 @@ namespace OpenSim.Framework.Communications
148 // See IInventoryServices 148 // See IInventoryServices
149 public abstract void RequestInventoryForUser(UUID userID, InventoryReceiptCallback callback); 149 public abstract void RequestInventoryForUser(UUID userID, InventoryReceiptCallback callback);
150 150
151 public List<InventoryItemBase> GetActiveGestures(UUID userId)
152 {
153 foreach (IInventoryDataPlugin plugin in m_plugins)
154 {
155 return plugin.fetchActiveGestures(userId);
156 }
157 return new List<InventoryItemBase>();
158 }
159
151 #endregion 160 #endregion
152 161
153 #region Methods used by GridInventoryService 162 #region Methods used by GridInventoryService
diff --git a/OpenSim/Framework/Communications/LoginResponse.cs b/OpenSim/Framework/Communications/LoginResponse.cs
index 435852d4..db504f9 100644
--- a/OpenSim/Framework/Communications/LoginResponse.cs
+++ b/OpenSim/Framework/Communications/LoginResponse.cs
@@ -60,6 +60,7 @@ namespace OpenSim.Framework.Communications
60 private ArrayList inventoryLibraryOwner; 60 private ArrayList inventoryLibraryOwner;
61 private ArrayList inventoryLibRoot; 61 private ArrayList inventoryLibRoot;
62 private ArrayList inventoryLibrary; 62 private ArrayList inventoryLibrary;
63 private ArrayList activeGestures;
63 64
64 private UserInfo userProfile; 65 private UserInfo userProfile;
65 66
@@ -124,6 +125,7 @@ namespace OpenSim.Framework.Communications
124 agentInventory = new ArrayList(); 125 agentInventory = new ArrayList();
125 inventoryLibrary = new ArrayList(); 126 inventoryLibrary = new ArrayList();
126 inventoryLibraryOwner = new ArrayList(); 127 inventoryLibraryOwner = new ArrayList();
128 activeGestures = new ArrayList();
127 129
128 xmlRpcResponse = new XmlRpcResponse(); 130 xmlRpcResponse = new XmlRpcResponse();
129 // defaultXmlRpcResponse = new XmlRpcResponse(); 131 // defaultXmlRpcResponse = new XmlRpcResponse();
@@ -355,7 +357,7 @@ namespace OpenSim.Framework.Communications
355 responseData["inventory-skel-lib"] = inventoryLibrary; 357 responseData["inventory-skel-lib"] = inventoryLibrary;
356 responseData["inventory-root"] = inventoryRoot; 358 responseData["inventory-root"] = inventoryRoot;
357 responseData["inventory-lib-root"] = inventoryLibRoot; 359 responseData["inventory-lib-root"] = inventoryLibRoot;
358 responseData["gestures"] = new ArrayList(); // todo 360 responseData["gestures"] = activeGestures;
359 responseData["inventory-lib-owner"] = inventoryLibraryOwner; 361 responseData["inventory-lib-owner"] = inventoryLibraryOwner;
360 responseData["initial-outfit"] = initialOutfit; 362 responseData["initial-outfit"] = initialOutfit;
361 responseData["start_location"] = startLocation; 363 responseData["start_location"] = startLocation;
@@ -452,7 +454,7 @@ namespace OpenSim.Framework.Communications
452 454
453 #endregion Inventory 455 #endregion Inventory
454 456
455 map["gestures"] = new LLSDArray(); // todo 457 map["gestures"] = ArrayListToLLSDArray(activeGestures);
456 458
457 map["initial-outfit"] = ArrayListToLLSDArray(initialOutfit); 459 map["initial-outfit"] = ArrayListToLLSDArray(initialOutfit);
458 map["start_location"] = LLSD.FromString(startLocation); 460 map["start_location"] = LLSD.FromString(startLocation);
@@ -699,6 +701,12 @@ namespace OpenSim.Framework.Communications
699 set { inventoryLibRoot = value; } 701 set { inventoryLibRoot = value; }
700 } 702 }
701 703
704 public ArrayList ActiveGestures
705 {
706 get { return activeGestures; }
707 set { activeGestures = value; }
708 }
709
702 public string Home 710 public string Home
703 { 711 {
704 get { return home; } 712 get { return home; }
diff --git a/OpenSim/Framework/IInventoryData.cs b/OpenSim/Framework/IInventoryData.cs
index d5fa25d..e42e50d 100644
--- a/OpenSim/Framework/IInventoryData.cs
+++ b/OpenSim/Framework/IInventoryData.cs
@@ -131,6 +131,17 @@ namespace OpenSim.Framework
131 /// </summary> 131 /// </summary>
132 /// <param name="folder">The id of the folder</param> 132 /// <param name="folder">The id of the folder</param>
133 void deleteInventoryFolder(UUID folder); 133 void deleteInventoryFolder(UUID folder);
134
135 /// <summary>
136 /// Returns all activated gesture-items in the inventory of the specified avatar.
137 /// </summary>
138 /// <param name="avatarID">
139 /// The <see cref="UUID"/> of the avatar
140 /// </param>
141 /// <returns>
142 /// The list of gestures (<see cref="InventoryItemBase"/>s)
143 /// </returns>
144 List<InventoryItemBase> fetchActiveGestures(UUID avatarID);
134 } 145 }
135 146
136 public class InventoryDataInitialiser : PluginInitialiserBase 147 public class InventoryDataInitialiser : PluginInitialiserBase
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
67 return SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>( 67 return SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
68 "POST", m_inventoryServerUrl + "RootFolders/", userId.Guid); 68 "POST", m_inventoryServerUrl + "RootFolders/", userId.Guid);
69 } 69 }
70
71 /// <summary>
72 /// Returns a list of all the active gestures in a user's inventory.
73 /// </summary>
74 /// <param name="userId">
75 /// The <see cref="UUID"/> of the user
76 /// </param>
77 /// <returns>
78 /// A flat list of the gesture items.
79 /// </returns>
80 public List<InventoryItemBase> GetActiveGestures(UUID userId)
81 {
82 return SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryItemBase>>(
83 "POST", m_inventoryServerUrl + "ActiveGestures/", userId.Guid);
84 }
85
70 } 86 }
71} 87}
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
233 233
234 return CreateNewUserInventory(userID); 234 return CreateNewUserInventory(userID);
235 } 235 }
236
237 public List<InventoryItemBase> GetActiveGestures(Guid rawUserID)
238 {
239 UUID userID = new UUID(rawUserID);
240
241 m_log.InfoFormat("[GRID AGENT INVENTORY]: fetching active gestures for user {0}", userID);
242
243 return GetActiveGestures(userID);
244 }
236 } 245 }
237} 246}
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
123 m_httpServer.AddStreamHandler( 123 m_httpServer.AddStreamHandler(
124 new RestDeserialiseTrustedHandler<Guid, List<InventoryFolderBase>> 124 new RestDeserialiseTrustedHandler<Guid, List<InventoryFolderBase>>
125 ("POST", "/RootFolders/", m_inventoryService.GetInventorySkeleton, m_inventoryService.CheckTrustSource)); 125 ("POST", "/RootFolders/", m_inventoryService.GetInventorySkeleton, m_inventoryService.CheckTrustSource));
126
127 // for persistent active gestures
128 m_httpServer.AddStreamHandler(
129 new RestDeserialiseTrustedHandler<Guid, List<InventoryItemBase>>
130 ("POST", "/ActiveGestures/", m_inventoryService.GetActiveGestures, m_inventoryService.CheckTrustSource));
126 } 131 }
127 132
128 private void Work() 133 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
131 /// <param name="startLocationRequest">The requested start location</param> 131 /// <param name="startLocationRequest">The requested start location</param>
132 public override bool CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest) 132 public override bool CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest)
133 { 133 {
134 // add active gestures to login-response
135 AddActiveGestures(response, theUser);
136
134 // HomeLocation 137 // HomeLocation
135 RegionProfileData homeInfo = null; 138 RegionProfileData homeInfo = null;
136 // use the homeRegionID if it is stored already. If not, use the regionHandle as before 139 // use the homeRegionID if it is stored already. If not, use the regionHandle as before
@@ -243,10 +246,37 @@ namespace OpenSim.Grid.UserServer
243 // theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z); 246 // theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
244 theUser.CurrentAgent.Position = new Vector3(128,128,0); 247 theUser.CurrentAgent.Position = new Vector3(128,128,0);
245 response.StartLocation = "safe"; 248 response.StartLocation = "safe";
246 249
247 return PrepareLoginToRegion(regionInfo, theUser, response); 250 return PrepareLoginToRegion(regionInfo, theUser, response);
248 } 251 }
249 252
253 /// <summary>
254 /// Add active gestures of the user to the login response.
255 /// </summary>
256 /// <param name="response">
257 /// A <see cref="LoginResponse"/>
258 /// </param>
259 /// <param name="theUser">
260 /// A <see cref="UserProfileData"/>
261 /// </param>
262 private void AddActiveGestures(LoginResponse response, UserProfileData theUser)
263 {
264 List<InventoryItemBase> gestures = m_inventoryService.GetActiveGestures(theUser.ID);
265 m_log.DebugFormat("[LOGIN]: AddActiveGestures, found {0}", gestures == null ? 0 : gestures.Count);
266 ArrayList list = new ArrayList();
267 if (gestures != null)
268 {
269 foreach (InventoryItemBase gesture in gestures)
270 {
271 Hashtable item = new Hashtable();
272 item["item_id"] = gesture.ID.ToString();
273 item["asset_id"] = gesture.AssetID.ToString();
274 list.Add(item);
275 }
276 }
277 response.ActiveGestures = list;
278 }
279
250 /// <summary> 280 /// <summary>
251 /// Prepare a login to the given region. This involves both telling the region to expect a connection 281 /// Prepare a login to the given region. This involves both telling the region to expect a connection
252 /// and appropriately customising the response to the user. 282 /// and appropriately customising the response to the user.
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs
index ded2d56..3d09729 100644
--- a/OpenSim/Region/Communications/Local/LocalLoginService.cs
+++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs
@@ -142,6 +142,9 @@ namespace OpenSim.Region.Communications.Local
142 /// <param name="startLocationRequest">The requested start location</param> 142 /// <param name="startLocationRequest">The requested start location</param>
143 public override bool CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest) 143 public override bool CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest)
144 { 144 {
145 // add active gestures to login-response
146 AddActiveGestures(response, theUser);
147
145 // HomeLocation 148 // HomeLocation
146 RegionInfo homeInfo = null; 149 RegionInfo homeInfo = null;
147 150
@@ -255,6 +258,33 @@ namespace OpenSim.Region.Communications.Local
255 } 258 }
256 259
257 /// <summary> 260 /// <summary>
261 /// Add active gestures of the user to the login response.
262 /// </summary>
263 /// <param name="response">
264 /// A <see cref="LoginResponse"/>
265 /// </param>
266 /// <param name="theUser">
267 /// A <see cref="UserProfileData"/>
268 /// </param>
269 private void AddActiveGestures(LoginResponse response, UserProfileData theUser)
270 {
271 List<InventoryItemBase> gestures = m_interServiceInventoryService.GetActiveGestures(theUser.ID);
272 m_log.DebugFormat("[LOGIN]: AddActiveGestures, found {0}", gestures == null ? 0 : gestures.Count);
273 ArrayList list = new ArrayList();
274 if (gestures != null)
275 {
276 foreach (InventoryItemBase gesture in gestures)
277 {
278 Hashtable item = new Hashtable();
279 item["item_id"] = gesture.ID.ToString();
280 item["asset_id"] = gesture.AssetID.ToString();
281 list.Add(item);
282 }
283 }
284 response.ActiveGestures = list;
285 }
286
287 /// <summary>
258 /// Prepare a login to the given region. This involves both telling the region to expect a connection 288 /// Prepare a login to the given region. This involves both telling the region to expect a connection
259 /// and appropriately customising the response to the user. 289 /// and appropriately customising the response to the user.
260 /// </summary> 290 /// </summary>