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.0.6.0-stable
parent
cffb975dd9
commit
fe9aea258f
|
@ -798,6 +798,11 @@ namespace OpenSim.Data.MSSQL
|
||||||
m_log.Error("[INVENTORY DB] Error deleting folder :" + e.Message);
|
m_log.Error("[INVENTORY DB] Error deleting folder :" + e.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<InventoryItemBase> fetchActiveGestures (UUID avatarID)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -795,5 +795,41 @@ namespace OpenSim.Data.MySQL
|
||||||
deleteOneFolder(folderID);
|
deleteOneFolder(folderID);
|
||||||
deleteItemsInFolder(folderID);
|
deleteItemsInFolder(folderID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<InventoryItemBase> fetchActiveGestures(UUID avatarID)
|
||||||
|
{
|
||||||
|
MySqlDataReader result = null;
|
||||||
|
MySqlCommand sqlCmd = null;
|
||||||
|
lock (database)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
database.CheckConnection();
|
||||||
|
sqlCmd = new MySqlCommand(
|
||||||
|
"SELECT * FROM inventoryitems WHERE avatarId = ?uuid AND assetType = ?type and flags = 1",
|
||||||
|
database.Connection);
|
||||||
|
sqlCmd.Parameters.AddWithValue("?uuid", avatarID.ToString());
|
||||||
|
sqlCmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture);
|
||||||
|
result = sqlCmd.ExecuteReader();
|
||||||
|
|
||||||
|
List<InventoryItemBase> list = new List<InventoryItemBase>();
|
||||||
|
while (result.Read())
|
||||||
|
list.Add(readInventoryItem(result));
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
database.Reconnect();
|
||||||
|
m_log.Error(e.ToString());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if(result != null) result.Close();
|
||||||
|
if(sqlCmd != null) sqlCmd.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -389,5 +389,10 @@ namespace OpenSim.Data.NHibernate
|
||||||
|
|
||||||
return folders;
|
return folders;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<InventoryItemBase> fetchActiveGestures (UUID avatarID)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -847,5 +847,24 @@ namespace OpenSim.Data.SQLite
|
||||||
row["UUID"] = Util.ToRawUuidString(folder.ID);
|
row["UUID"] = Util.ToRawUuidString(folder.ID);
|
||||||
row["parentID"] = Util.ToRawUuidString(folder.ParentID);
|
row["parentID"] = Util.ToRawUuidString(folder.ParentID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<InventoryItemBase> fetchActiveGestures (UUID avatarID)
|
||||||
|
{
|
||||||
|
lock (ds)
|
||||||
|
{
|
||||||
|
List<InventoryItemBase> items = new List<InventoryItemBase>();
|
||||||
|
|
||||||
|
DataTable inventoryItemTable = ds.Tables["inventoryitems"];
|
||||||
|
string selectExp = "avatarID = '" + Util.ToRawUuidString(avatarID) + "' AND assetType = " +
|
||||||
|
(int)AssetType.Gesture + " AND flags = 1";
|
||||||
|
m_log.DebugFormat("[SQL]: sql = " + selectExp);
|
||||||
|
DataRow[] rows = inventoryItemTable.Select(selectExp);
|
||||||
|
foreach (DataRow row in rows)
|
||||||
|
{
|
||||||
|
items.Add(buildItem(row));
|
||||||
|
}
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,5 +49,16 @@ namespace OpenSim.Framework.Communications
|
||||||
/// <returns>A flat list of the user's inventory folder tree,
|
/// <returns>A flat list of the user's inventory folder tree,
|
||||||
/// null if there is no inventory for this user</returns>
|
/// null if there is no inventory for this user</returns>
|
||||||
List<InventoryFolderBase> GetInventorySkeleton(UUID userId);
|
List<InventoryFolderBase> GetInventorySkeleton(UUID userId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a list of all the active gestures in a user's inventory.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId">
|
||||||
|
/// The <see cref="UUID"/> of the user
|
||||||
|
/// </param>
|
||||||
|
/// <returns>
|
||||||
|
/// A flat list of the gesture items.
|
||||||
|
/// </returns>
|
||||||
|
List<InventoryItemBase> GetActiveGestures(UUID userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,6 +148,15 @@ namespace OpenSim.Framework.Communications
|
||||||
// See IInventoryServices
|
// See IInventoryServices
|
||||||
public abstract void RequestInventoryForUser(UUID userID, InventoryReceiptCallback callback);
|
public abstract void RequestInventoryForUser(UUID userID, InventoryReceiptCallback callback);
|
||||||
|
|
||||||
|
public List<InventoryItemBase> GetActiveGestures(UUID userId)
|
||||||
|
{
|
||||||
|
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||||
|
{
|
||||||
|
return plugin.fetchActiveGestures(userId);
|
||||||
|
}
|
||||||
|
return new List<InventoryItemBase>();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Methods used by GridInventoryService
|
#region Methods used by GridInventoryService
|
||||||
|
|
|
@ -60,6 +60,7 @@ namespace OpenSim.Framework.Communications
|
||||||
private ArrayList inventoryLibraryOwner;
|
private ArrayList inventoryLibraryOwner;
|
||||||
private ArrayList inventoryLibRoot;
|
private ArrayList inventoryLibRoot;
|
||||||
private ArrayList inventoryLibrary;
|
private ArrayList inventoryLibrary;
|
||||||
|
private ArrayList activeGestures;
|
||||||
|
|
||||||
private UserInfo userProfile;
|
private UserInfo userProfile;
|
||||||
|
|
||||||
|
@ -124,6 +125,7 @@ namespace OpenSim.Framework.Communications
|
||||||
agentInventory = new ArrayList();
|
agentInventory = new ArrayList();
|
||||||
inventoryLibrary = new ArrayList();
|
inventoryLibrary = new ArrayList();
|
||||||
inventoryLibraryOwner = new ArrayList();
|
inventoryLibraryOwner = new ArrayList();
|
||||||
|
activeGestures = new ArrayList();
|
||||||
|
|
||||||
xmlRpcResponse = new XmlRpcResponse();
|
xmlRpcResponse = new XmlRpcResponse();
|
||||||
// defaultXmlRpcResponse = new XmlRpcResponse();
|
// defaultXmlRpcResponse = new XmlRpcResponse();
|
||||||
|
@ -355,7 +357,7 @@ namespace OpenSim.Framework.Communications
|
||||||
responseData["inventory-skel-lib"] = inventoryLibrary;
|
responseData["inventory-skel-lib"] = inventoryLibrary;
|
||||||
responseData["inventory-root"] = inventoryRoot;
|
responseData["inventory-root"] = inventoryRoot;
|
||||||
responseData["inventory-lib-root"] = inventoryLibRoot;
|
responseData["inventory-lib-root"] = inventoryLibRoot;
|
||||||
responseData["gestures"] = new ArrayList(); // todo
|
responseData["gestures"] = activeGestures;
|
||||||
responseData["inventory-lib-owner"] = inventoryLibraryOwner;
|
responseData["inventory-lib-owner"] = inventoryLibraryOwner;
|
||||||
responseData["initial-outfit"] = initialOutfit;
|
responseData["initial-outfit"] = initialOutfit;
|
||||||
responseData["start_location"] = startLocation;
|
responseData["start_location"] = startLocation;
|
||||||
|
@ -452,7 +454,7 @@ namespace OpenSim.Framework.Communications
|
||||||
|
|
||||||
#endregion Inventory
|
#endregion Inventory
|
||||||
|
|
||||||
map["gestures"] = new LLSDArray(); // todo
|
map["gestures"] = ArrayListToLLSDArray(activeGestures);
|
||||||
|
|
||||||
map["initial-outfit"] = ArrayListToLLSDArray(initialOutfit);
|
map["initial-outfit"] = ArrayListToLLSDArray(initialOutfit);
|
||||||
map["start_location"] = LLSD.FromString(startLocation);
|
map["start_location"] = LLSD.FromString(startLocation);
|
||||||
|
@ -699,6 +701,12 @@ namespace OpenSim.Framework.Communications
|
||||||
set { inventoryLibRoot = value; }
|
set { inventoryLibRoot = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArrayList ActiveGestures
|
||||||
|
{
|
||||||
|
get { return activeGestures; }
|
||||||
|
set { activeGestures = value; }
|
||||||
|
}
|
||||||
|
|
||||||
public string Home
|
public string Home
|
||||||
{
|
{
|
||||||
get { return home; }
|
get { return home; }
|
||||||
|
|
|
@ -131,6 +131,17 @@ namespace OpenSim.Framework
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="folder">The id of the folder</param>
|
/// <param name="folder">The id of the folder</param>
|
||||||
void deleteInventoryFolder(UUID folder);
|
void deleteInventoryFolder(UUID folder);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns all activated gesture-items in the inventory of the specified avatar.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="avatarID">
|
||||||
|
/// The <see cref="UUID"/> of the avatar
|
||||||
|
/// </param>
|
||||||
|
/// <returns>
|
||||||
|
/// The list of gestures (<see cref="InventoryItemBase"/>s)
|
||||||
|
/// </returns>
|
||||||
|
List<InventoryItemBase> fetchActiveGestures(UUID avatarID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class InventoryDataInitialiser : PluginInitialiserBase
|
public class InventoryDataInitialiser : PluginInitialiserBase
|
||||||
|
|
|
@ -67,5 +67,21 @@ namespace OpenSim.Grid.Communications.OGS1
|
||||||
return SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
|
return SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
|
||||||
"POST", m_inventoryServerUrl + "RootFolders/", userId.Guid);
|
"POST", m_inventoryServerUrl + "RootFolders/", userId.Guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a list of all the active gestures in a user's inventory.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId">
|
||||||
|
/// The <see cref="UUID"/> of the user
|
||||||
|
/// </param>
|
||||||
|
/// <returns>
|
||||||
|
/// A flat list of the gesture items.
|
||||||
|
/// </returns>
|
||||||
|
public List<InventoryItemBase> GetActiveGestures(UUID userId)
|
||||||
|
{
|
||||||
|
return SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryItemBase>>(
|
||||||
|
"POST", m_inventoryServerUrl + "ActiveGestures/", userId.Guid);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -233,5 +233,14 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
|
|
||||||
return CreateNewUserInventory(userID);
|
return CreateNewUserInventory(userID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<InventoryItemBase> GetActiveGestures(Guid rawUserID)
|
||||||
|
{
|
||||||
|
UUID userID = new UUID(rawUserID);
|
||||||
|
|
||||||
|
m_log.InfoFormat("[GRID AGENT INVENTORY]: fetching active gestures for user {0}", userID);
|
||||||
|
|
||||||
|
return GetActiveGestures(userID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,6 +123,11 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
m_httpServer.AddStreamHandler(
|
m_httpServer.AddStreamHandler(
|
||||||
new RestDeserialiseTrustedHandler<Guid, List<InventoryFolderBase>>
|
new RestDeserialiseTrustedHandler<Guid, List<InventoryFolderBase>>
|
||||||
("POST", "/RootFolders/", m_inventoryService.GetInventorySkeleton, m_inventoryService.CheckTrustSource));
|
("POST", "/RootFolders/", m_inventoryService.GetInventorySkeleton, m_inventoryService.CheckTrustSource));
|
||||||
|
|
||||||
|
// for persistent active gestures
|
||||||
|
m_httpServer.AddStreamHandler(
|
||||||
|
new RestDeserialiseTrustedHandler<Guid, List<InventoryItemBase>>
|
||||||
|
("POST", "/ActiveGestures/", m_inventoryService.GetActiveGestures, m_inventoryService.CheckTrustSource));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Work()
|
private void Work()
|
||||||
|
|
|
@ -131,6 +131,9 @@ namespace OpenSim.Grid.UserServer
|
||||||
/// <param name="startLocationRequest">The requested start location</param>
|
/// <param name="startLocationRequest">The requested start location</param>
|
||||||
public override bool CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest)
|
public override bool CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest)
|
||||||
{
|
{
|
||||||
|
// add active gestures to login-response
|
||||||
|
AddActiveGestures(response, theUser);
|
||||||
|
|
||||||
// HomeLocation
|
// HomeLocation
|
||||||
RegionProfileData homeInfo = null;
|
RegionProfileData homeInfo = null;
|
||||||
// use the homeRegionID if it is stored already. If not, use the regionHandle as before
|
// use the homeRegionID if it is stored already. If not, use the regionHandle as before
|
||||||
|
@ -247,6 +250,33 @@ namespace OpenSim.Grid.UserServer
|
||||||
return PrepareLoginToRegion(regionInfo, theUser, response);
|
return PrepareLoginToRegion(regionInfo, theUser, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add active gestures of the user to the login response.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="response">
|
||||||
|
/// A <see cref="LoginResponse"/>
|
||||||
|
/// </param>
|
||||||
|
/// <param name="theUser">
|
||||||
|
/// A <see cref="UserProfileData"/>
|
||||||
|
/// </param>
|
||||||
|
private void AddActiveGestures(LoginResponse response, UserProfileData theUser)
|
||||||
|
{
|
||||||
|
List<InventoryItemBase> 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;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Prepare a login to the given region. This involves both telling the region to expect a connection
|
/// 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.
|
/// and appropriately customising the response to the user.
|
||||||
|
|
|
@ -142,6 +142,9 @@ namespace OpenSim.Region.Communications.Local
|
||||||
/// <param name="startLocationRequest">The requested start location</param>
|
/// <param name="startLocationRequest">The requested start location</param>
|
||||||
public override bool CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest)
|
public override bool CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest)
|
||||||
{
|
{
|
||||||
|
// add active gestures to login-response
|
||||||
|
AddActiveGestures(response, theUser);
|
||||||
|
|
||||||
// HomeLocation
|
// HomeLocation
|
||||||
RegionInfo homeInfo = null;
|
RegionInfo homeInfo = null;
|
||||||
|
|
||||||
|
@ -254,6 +257,33 @@ namespace OpenSim.Region.Communications.Local
|
||||||
return PrepareLoginToRegion(regionInfo, theUser, response);
|
return PrepareLoginToRegion(regionInfo, theUser, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add active gestures of the user to the login response.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="response">
|
||||||
|
/// A <see cref="LoginResponse"/>
|
||||||
|
/// </param>
|
||||||
|
/// <param name="theUser">
|
||||||
|
/// A <see cref="UserProfileData"/>
|
||||||
|
/// </param>
|
||||||
|
private void AddActiveGestures(LoginResponse response, UserProfileData theUser)
|
||||||
|
{
|
||||||
|
List<InventoryItemBase> gestures = m_interServiceInventoryService.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;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Prepare a login to the given region. This involves both telling the region to expect a connection
|
/// 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.
|
/// and appropriately customising the response to the user.
|
||||||
|
|
Loading…
Reference in New Issue