diff --git a/.nant/local.include b/.nant/local.include
index 5ff96446c5..be79d1cfce 100644
--- a/.nant/local.include
+++ b/.nant/local.include
@@ -145,7 +145,12 @@
-
+
+
+
+
+
+
@@ -260,6 +265,11 @@
+
+
+
+
+
@@ -271,6 +281,7 @@
+
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index d540c07d76..30bf0140db 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -4,14 +4,10 @@ The following people have contributed to OpenSim (Thank you for your effort!)
These folks represent the current core team for OpenSim, and are the
people that make the day to day of OpenSim happen.
-* justincc (OSVW Consulting, justincc.org)
* Melanie Thielker
* Diva (Crista Lopes, University of California, Irvine)
-* BlueWall (James Hughes)
* Nebadon Izumi (Michael Cerquoni, OSgrid)
-* Snoopy Pfeffer
* Robert Adams (MisterBlue)
-* Oren Hurvitz (Kitely)
* Kevin Cozens
* Leal Duarte (Ubit Umarov)
@@ -20,11 +16,14 @@ Core developers who have temporarily (we hope) gone chasing the white rabbit.
They are in all similar to the active core developers, except that they haven't
been that active lately, so their voting rights are awaiting their come back.
-* Teravus (w3z)
* Arthur Rodrigo S Valadares (IBM)
+* BlueWall (James Hughes)
* Dan Lake
-* Marck
+ * Marck
* Mic Bowman
+* Oren Hurvitz (Kitely)
+* Snoopy Pfeffer
+* Teravus (w3z)
= Past Open Sim Developers =
These folks are alumns of the OpenSim core group, but are now
@@ -57,7 +56,7 @@ where we are today.
* John Hurliman
* chi11ken (Genkii)
* dahlia
-
+* justincc (OSVW Consulting, justincc.org)
= Additional OpenSim Contributors =
These folks have contributed code patches or content to OpenSimulator to help make it
@@ -149,6 +148,7 @@ what it is today.
* Micheil Merlin
* Mike Osias (IBM)
* Mike Pitman (IBM)
+* Mike Rieker (Dreamnation)
* mikemig
* mikkopa/_someone - RealXtend
* Misterblue
diff --git a/OpenSim/Addons/Groups/GroupsModule.cs b/OpenSim/Addons/Groups/GroupsModule.cs
index 0e3a1729b5..5b76e0a5b8 100644
--- a/OpenSim/Addons/Groups/GroupsModule.cs
+++ b/OpenSim/Addons/Groups/GroupsModule.cs
@@ -787,7 +787,7 @@ namespace OpenSim.Groups
remoteClient.SendCreateGroupReply(groupID, true, "Group created successfully");
// Update the founder with new group information.
- SendAgentGroupDataUpdate(remoteClient, false);
+ SendAgentGroupDataUpdate(remoteClient, true);
}
else
remoteClient.SendCreateGroupReply(groupID, false, reason);
diff --git a/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs b/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs
index af007709be..51f3ec15e0 100644
--- a/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs
+++ b/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs
@@ -115,9 +115,10 @@ namespace OpenSim.Groups
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
- StreamReader sr = new StreamReader(requestData);
- string body = sr.ReadToEnd();
- sr.Close();
+ string body;
+ using(StreamReader sr = new StreamReader(requestData))
+ body = sr.ReadToEnd();
+
body = body.Trim();
//m_log.DebugFormat("[XXX]: query String: {0}", body);
diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs
index 598e7a5a9d..8502bb5bda 100644
--- a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs
+++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs
@@ -91,9 +91,10 @@ namespace OpenSim.Groups
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
- StreamReader sr = new StreamReader(requestData);
- string body = sr.ReadToEnd();
- sr.Close();
+ string body;
+ using(StreamReader sr = new StreamReader(requestData))
+ body = sr.ReadToEnd();
+
body = body.Trim();
//m_log.DebugFormat("[XXX]: query String: {0}", body);
diff --git a/OpenSim/Addons/Groups/Service/GroupsService.cs b/OpenSim/Addons/Groups/Service/GroupsService.cs
index ea0fedd9de..bed91d9666 100644
--- a/OpenSim/Addons/Groups/Service/GroupsService.cs
+++ b/OpenSim/Addons/Groups/Service/GroupsService.cs
@@ -43,60 +43,62 @@ namespace OpenSim.Groups
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
- public const GroupPowers DefaultEveryonePowers = GroupPowers.AllowSetHome |
- GroupPowers.Accountable |
- GroupPowers.JoinChat |
- GroupPowers.AllowVoiceChat |
- GroupPowers.ReceiveNotices |
- GroupPowers.StartProposal |
- GroupPowers.VoteOnProposal;
+ public const GroupPowers DefaultEveryonePowers =
+ GroupPowers.AllowSetHome |
+ GroupPowers.Accountable |
+ GroupPowers.JoinChat |
+ GroupPowers.AllowVoiceChat |
+ GroupPowers.ReceiveNotices |
+ GroupPowers.StartProposal |
+ GroupPowers.VoteOnProposal;
- public const GroupPowers OwnerPowers = GroupPowers.Accountable |
- GroupPowers.AllowEditLand |
- GroupPowers.AllowFly |
- GroupPowers.AllowLandmark |
- GroupPowers.AllowRez |
- GroupPowers.AllowSetHome |
- GroupPowers.AllowVoiceChat |
- GroupPowers.AssignMember |
- GroupPowers.AssignMemberLimited |
- GroupPowers.ChangeActions |
- GroupPowers.ChangeIdentity |
- GroupPowers.ChangeMedia |
- GroupPowers.ChangeOptions |
- GroupPowers.CreateRole |
- GroupPowers.DeedObject |
- GroupPowers.DeleteRole |
- GroupPowers.Eject |
- GroupPowers.FindPlaces |
- GroupPowers.HostEvent |
- GroupPowers.Invite |
- GroupPowers.JoinChat |
- GroupPowers.LandChangeIdentity |
- GroupPowers.LandDeed |
- GroupPowers.LandDivideJoin |
- GroupPowers.LandEdit |
- GroupPowers.LandEjectAndFreeze |
- GroupPowers.LandGardening |
- GroupPowers.LandManageAllowed |
- GroupPowers.LandManageBanned |
- GroupPowers.LandManagePasses |
- GroupPowers.LandOptions |
- GroupPowers.LandRelease |
- GroupPowers.LandSetSale |
- GroupPowers.ModerateChat |
- GroupPowers.ObjectManipulate |
- GroupPowers.ObjectSetForSale |
- GroupPowers.ReceiveNotices |
- GroupPowers.RemoveMember |
- GroupPowers.ReturnGroupOwned |
- GroupPowers.ReturnGroupSet |
- GroupPowers.ReturnNonGroup |
- GroupPowers.RoleProperties |
- GroupPowers.SendNotices |
- GroupPowers.SetLandingPoint |
- GroupPowers.StartProposal |
- GroupPowers.VoteOnProposal;
+ public const GroupPowers OfficersPowers = DefaultEveryonePowers |
+ GroupPowers.AllowFly |
+ GroupPowers.AllowLandmark |
+ GroupPowers.AllowRez |
+ GroupPowers.AssignMemberLimited |
+ GroupPowers.ChangeIdentity |
+ GroupPowers.ChangeMedia |
+ GroupPowers.ChangeOptions |
+ GroupPowers.DeedObject |
+ GroupPowers.Eject |
+ GroupPowers.FindPlaces |
+ GroupPowers.Invite |
+ GroupPowers.LandChangeIdentity |
+ GroupPowers.LandDeed |
+ GroupPowers.LandDivideJoin |
+ GroupPowers.LandEdit |
+ GroupPowers.LandEjectAndFreeze |
+ GroupPowers.LandGardening |
+ GroupPowers.LandManageAllowed |
+ GroupPowers.LandManageBanned |
+ GroupPowers.LandManagePasses |
+ GroupPowers.LandOptions |
+ GroupPowers.LandRelease |
+ GroupPowers.LandSetSale |
+ GroupPowers.MemberVisible |
+ GroupPowers.ModerateChat |
+ GroupPowers.ObjectManipulate |
+ GroupPowers.ObjectSetForSale |
+ GroupPowers.ReturnGroupOwned |
+ GroupPowers.ReturnGroupSet |
+ GroupPowers.ReturnNonGroup |
+ GroupPowers.RoleProperties |
+ GroupPowers.SendNotices |
+ GroupPowers.SetLandingPoint;
+
+ public const GroupPowers OwnerPowers = OfficersPowers |
+ GroupPowers.Accountable |
+ GroupPowers.AllowEditLand |
+ GroupPowers.AssignMember |
+ GroupPowers.ChangeActions |
+ GroupPowers.CreateRole |
+ GroupPowers.DeleteRole |
+ GroupPowers.ExperienceAdmin |
+ GroupPowers.ExperienceCreator |
+ GroupPowers.GroupBanAccess |
+ GroupPowers.HostEvent |
+ GroupPowers.RemoveMember;
#region Daily Cleanup
@@ -151,20 +153,25 @@ namespace OpenSim.Groups
data.Data["ShowInList"] = showInList ? "1" : "0";
data.Data["AllowPublish"] = allowPublish ? "1" : "0";
data.Data["MaturePublish"] = maturePublish ? "1" : "0";
- UUID roleID = UUID.Random();
- data.Data["OwnerRoleID"] = roleID.ToString();
+ UUID ownerRoleID = UUID.Random();
+ data.Data["OwnerRoleID"] = ownerRoleID.ToString();
if (!m_Database.StoreGroup(data))
return UUID.Zero;
// Create Everyone role
- _AddOrUpdateGroupRole(RequestingAgentID, data.GroupID, UUID.Zero, "Everyone", "Everyone in the group", "Member of " + name, (ulong)DefaultEveryonePowers, true);
+ _AddOrUpdateGroupRole(RequestingAgentID, data.GroupID, UUID.Zero, "Everyone", "Everyone in the group is in the everyone role.", "Member of " + name, (ulong)DefaultEveryonePowers, true);
+
+ // Create Officers role
+ UUID officersRoleID = UUID.Random();
+ _AddOrUpdateGroupRole(RequestingAgentID, data.GroupID, officersRoleID, "Officers", "The officers of the group, with more powers than regular members.", "Officer of " + name, (ulong)OfficersPowers, true);
// Create Owner role
- _AddOrUpdateGroupRole(RequestingAgentID, data.GroupID, roleID, "Owners", "Owners of the group", "Owner of " + name, (ulong)OwnerPowers, true);
+ _AddOrUpdateGroupRole(RequestingAgentID, data.GroupID, ownerRoleID, "Owners", "Owners of the group", "Owner of " + name, (ulong)OwnerPowers, true);
// Add founder to group
- _AddAgentToGroup(RequestingAgentID, founderID.ToString(), data.GroupID, roleID);
+ _AddAgentToGroup(RequestingAgentID, founderID.ToString(), data.GroupID, ownerRoleID);
+ _AddAgentToGroup(RequestingAgentID, founderID.ToString(), data.GroupID, officersRoleID);
return data.GroupID;
}
@@ -843,7 +850,7 @@ namespace OpenSim.Groups
return false;
}
- if (!add && data == null) // it deosn't exist, can't update
+ if (!add && data == null) // it doesn't exist, can't update
{
m_log.DebugFormat("[Groups]: Group {0} doesn't exist. Can't update it", groupID);
return false;
diff --git a/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs b/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs
index 5340bcd094..d8164e718a 100644
--- a/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs
+++ b/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs
@@ -114,7 +114,6 @@ namespace OpenSim.OfflineIM
scene.ForEachClient(delegate(IClientAPI client)
{
client.OnRetrieveInstantMessages -= RetrieveInstantMessages;
- client.OnMuteListRequest -= OnMuteListRequest;
});
}
@@ -162,7 +161,6 @@ namespace OpenSim.OfflineIM
private void OnNewClient(IClientAPI client)
{
client.OnRetrieveInstantMessages += RetrieveInstantMessages;
- client.OnMuteListRequest += OnMuteListRequest;
}
private void RetrieveInstantMessages(IClientAPI client)
@@ -194,20 +192,6 @@ namespace OpenSim.OfflineIM
}
}
- // Apparently this is needed in order for the viewer to request the IMs.
- private void OnMuteListRequest(IClientAPI client, uint crc)
- {
- m_log.DebugFormat("[OfflineIM.V2] Got mute list request for crc {0}", crc);
- string filename = "mutes" + client.AgentId.ToString();
-
- IXfer xfer = client.Scene.RequestModuleInterface();
- if (xfer != null)
- {
- xfer.AddNewFile(filename, new Byte[0]);
- client.SendMuteListUpdate(filename);
- }
- }
-
private void UndeliveredMessage(GridInstantMessage im)
{
if (im.dialog != (byte)InstantMessageDialog.MessageFromObject &&
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 1ee24689dc..468e7be92e 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -1934,7 +1934,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
GetSceneFromRegionParams(requestData, responseData, out scene);
health = scene.GetHealth(out flags, out text);
}
- catch (Exception e)
+ catch
{
responseData["error"] = null;
}
@@ -3087,15 +3087,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController
///
private void ApplyNextOwnerPermissions(InventoryItemBase item)
{
- if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0)
+ if (item.InvType == (int)InventoryType.Object)
{
- if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
- item.CurrentPermissions &= ~(uint)PermissionMask.Copy;
- if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0)
- item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
- if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
- item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
+ uint perms = item.CurrentPermissions;
+ PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref perms);
+ item.CurrentPermissions = perms;
}
+
item.CurrentPermissions &= item.NextPermissions;
item.BasePermissions &= item.NextPermissions;
item.EveryOnePermissions &= item.NextPermissions;
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs
index 53ed1152fd..427a310233 100644
--- a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs
+++ b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs
@@ -30,6 +30,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
+using System.Text;
using log4net;
using Nini.Config;
using OpenMetaverse;
@@ -60,26 +61,10 @@ namespace OpenSim.Capabilities.Handlers
m_Scene = s;
}
-
public string FetchInventoryDescendentsRequest(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
//m_log.DebugFormat("[XXX]: FetchInventoryDescendentsRequest in {0}, {1}", (m_Scene == null) ? "none" : m_Scene.Name, request);
-
- // nasty temporary hack here, the linden client falsely
- // identifies the uuid 00000000-0000-0000-0000-000000000000
- // as a string which breaks us
- //
- // correctly mark it as a uuid
- //
- request = request.Replace("00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000000");
-
- // another hack 1 results in a
- // System.ArgumentException: Object type System.Int32 cannot
- // be converted to target type: System.Boolean
- //
- request = request.Replace("fetch_folders0", "fetch_folders0");
- request = request.Replace("fetch_folders1", "fetch_folders1");
-
+
Hashtable hash = new Hashtable();
try
{
@@ -92,10 +77,7 @@ namespace OpenSim.Capabilities.Handlers
}
ArrayList foldersrequested = (ArrayList)hash["folders"];
-
- string response = "";
- string bad_folders_response = "";
-
+
List folders = new List();
for (int i = 0; i < foldersrequested.Count; i++)
{
@@ -113,72 +95,56 @@ namespace OpenSim.Capabilities.Handlers
continue;
}
- // Filter duplicate folder ids that bad viewers may send
- if (folders.Find(f => f.folder_id == llsdRequest.folder_id) == null)
- folders.Add(llsdRequest);
-
+ folders.Add(llsdRequest);
}
- if (folders.Count > 0)
+ if(folders.Count == 0)
+ return "";
+
+ List bad_folders = new List();
+
+ List invcollSet = Fetch(folders, bad_folders);
+ //m_log.DebugFormat("[XXX]: Got {0} folders from a request of {1}", invcollSet.Count, folders.Count);
+
+ if (invcollSet == null)
{
- List bad_folders = new List();
- List invcollSet = Fetch(folders, bad_folders);
- //m_log.DebugFormat("[XXX]: Got {0} folders from a request of {1}", invcollSet.Count, folders.Count);
-
- if (invcollSet == null)
- {
- m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Multiple folder fetch failed. Trying old protocol.");
+ m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Multiple folder fetch failed. Trying old protocol.");
#pragma warning disable 0612
- return FetchInventoryDescendentsRequest(foldersrequested, httpRequest, httpResponse);
+ return FetchInventoryDescendentsRequest(foldersrequested, httpRequest, httpResponse);
#pragma warning restore 0612
- }
+ }
- string inventoryitemstr = string.Empty;
+ StringBuilder lastresponse = new StringBuilder(1024);
+ lastresponse.Append("");
+
+ if(invcollSet.Count > 0)
+ {
+ lastresponse.Append("");
}
else
+ lastresponse.Append("folders");
+
+ //m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Bad folders {0}", string.Join(", ", bad_folders));
+ if(bad_folders.Count > 0)
{
- if (bad_folders_response.Length != 0)
+ lastresponse.Append("bad_folders");
+ foreach (UUID bad in bad_folders)
{
- response = "folders" + response + "bad_folders" + bad_folders_response + "";
- }
- else
- {
- response = "folders" + response + "";
+ lastresponse.Append("folder_id");
+ lastresponse.Append(bad.ToString());
+ lastresponse.Append("errorUnknown");
}
+ lastresponse.Append("");
}
+ lastresponse.Append("");
- //m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Replying to CAPS fetch inventory request for {0} folders. Item count {1}", folders.Count, item_count);
- //m_log.Debug("[WEB FETCH INV DESC HANDLER] " + response);
-
- return response;
-
+ return lastresponse.ToString();;
}
///
@@ -240,24 +206,19 @@ namespace OpenSim.Capabilities.Handlers
return reply;
}
- private LLSDInventoryDescendents ToLLSD(InventoryCollection inv, int descendents)
+ private LLSDInventoryFolderContents contentsToLLSD(InventoryCollection inv, int descendents)
{
- LLSDInventoryDescendents reply = new LLSDInventoryDescendents();
LLSDInventoryFolderContents contents = new LLSDInventoryFolderContents();
contents.agent_id = inv.OwnerID;
contents.owner_id = inv.OwnerID;
contents.folder_id = inv.FolderID;
- reply.folders.Array.Add(contents);
-
if (inv.Folders != null)
{
foreach (InventoryFolderBase invFolder in inv.Folders)
{
contents.categories.Array.Add(ConvertInventoryFolder(invFolder));
}
-
- descendents += inv.Folders.Count;
}
if (inv.Items != null)
@@ -271,7 +232,7 @@ namespace OpenSim.Capabilities.Handlers
contents.descendents = descendents;
contents.version = inv.Version;
- return reply;
+ return contents;
}
///
/// Old style. Soon to be deprecated.
@@ -285,8 +246,8 @@ namespace OpenSim.Capabilities.Handlers
{
//m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Received request for {0} folders", foldersrequested.Count);
- string response = "";
- string bad_folders_response = "";
+ StringBuilder tmpresponse = new StringBuilder(1024);
+ StringBuilder tmpbadfolders = new StringBuilder(1024);
for (int i = 0; i < foldersrequested.Count; i++)
{
@@ -308,7 +269,9 @@ namespace OpenSim.Capabilities.Handlers
if (null == reply)
{
- bad_folders_response += "" + llsdRequest.folder_id.ToString() + "";
+ tmpbadfolders.Append("folder_id");
+ tmpbadfolders.Append(llsdRequest.folder_id.ToString());
+ tmpbadfolders.Append("errorUnknown");
}
else
{
@@ -317,39 +280,29 @@ namespace OpenSim.Capabilities.Handlers
inventoryitemstr = inventoryitemstr.Replace("", "");
}
- response += inventoryitemstr;
+ tmpresponse.Append(inventoryitemstr);
}
- if (response.Length == 0)
+ StringBuilder lastresponse = new StringBuilder(1024);
+ lastresponse.Append("");
+ if(tmpresponse.Length > 0)
{
- /* Viewers expect a bad_folders array when not available */
- if (bad_folders_response.Length != 0)
- {
- response = "bad_folders" + bad_folders_response + "";
- }
- else
- {
- response = "folders";
- }
+ lastresponse.Append("folders");
+ lastresponse.Append(tmpresponse.ToString());
+ lastresponse.Append("");
}
else
+ lastresponse.Append("folders");
+
+ if(tmpbadfolders.Length > 0)
{
- if (bad_folders_response.Length != 0)
- {
- response = "folders" + response + "bad_folders" + bad_folders_response + "";
- }
- else
- {
- response = "folders" + response + "";
- }
+ lastresponse.Append("bad_folders");
+ lastresponse.Append(tmpbadfolders.ToString());
+ lastresponse.Append("");
}
+ lastresponse.Append("");
- // m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Replying to CAPS fetch inventory request");
- //m_log.Debug("[WEB FETCH INV DESC HANDLER] "+response);
-
- return response;
-
- // }
+ return lastresponse.ToString();
}
///
@@ -436,108 +389,7 @@ namespace OpenSim.Capabilities.Handlers
itemsToReturn.Insert(0, linkedItem);
}
}
-
- // Now scan for folder links and insert the items they target and those links at the head of the return data
-
-/* dont send contents of LinkFolders.
-from docs seems this was never a spec
-
- foreach (InventoryItemBase item in originalItems)
- {
- if (item.AssetType == (int)AssetType.LinkFolder)
- {
- InventoryCollection linkedFolderContents = m_InventoryService.GetFolderContent(ownerID, item.AssetID);
- List links = linkedFolderContents.Items;
-
- itemsToReturn.InsertRange(0, links);
-
- foreach (InventoryItemBase link in linkedFolderContents.Items)
- {
- // Take care of genuinely broken links where the target doesn't exist
- // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
- // but no viewer has been observed to set these up and this is the lazy way of avoiding cycles
- // rather than having to keep track of every folder requested in the recursion.
- if (link != null)
- {
-// m_log.DebugFormat(
-// "[WEB FETCH INV DESC HANDLER]: Adding item {0} {1} from folder {2} linked from {3}",
-// link.Name, (AssetType)link.AssetType, item.AssetID, containingFolder.Name);
-
- InventoryItemBase linkedItem
- = m_InventoryService.GetItem(new InventoryItemBase(link.AssetID));
-
- if (linkedItem != null)
- itemsToReturn.Insert(0, linkedItem);
- }
- }
- }
- }
-*/
}
-
-// foreach (InventoryItemBase item in contents.Items)
-// {
-// m_log.DebugFormat(
-// "[WEB FETCH INV DESC HANDLER]: Returning item {0}, type {1}, parent {2} in {3} {4}",
-// item.Name, (AssetType)item.AssetType, item.Folder, containingFolder.Name, containingFolder.ID);
-// }
-
- // =====
-
-//
-// foreach (InventoryItemBase linkedItem in linkedItemsToAdd)
-// {
-// m_log.DebugFormat(
-// "[WEB FETCH INV DESC HANDLER]: Inserted linked item {0} for link in folder {1} for agent {2}",
-// linkedItem.Name, folderID, agentID);
-//
-// contents.Items.Add(linkedItem);
-// }
-//
-// // If the folder requested contains links, then we need to send those folders first, otherwise the links
-// // will be broken in the viewer.
-// HashSet linkedItemFolderIdsToSend = new HashSet();
-// foreach (InventoryItemBase item in contents.Items)
-// {
-// if (item.AssetType == (int)AssetType.Link)
-// {
-// InventoryItemBase linkedItem = m_InventoryService.GetItem(new InventoryItemBase(item.AssetID));
-//
-// // Take care of genuinely broken links where the target doesn't exist
-// // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
-// // but no viewer has been observed to set these up and this is the lazy way of avoiding cycles
-// // rather than having to keep track of every folder requested in the recursion.
-// if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link)
-// {
-// // We don't need to send the folder if source and destination of the link are in the same
-// // folder.
-// if (linkedItem.Folder != containingFolder.ID)
-// linkedItemFolderIdsToSend.Add(linkedItem.Folder);
-// }
-// }
-// }
-//
-// foreach (UUID linkedItemFolderId in linkedItemFolderIdsToSend)
-// {
-// m_log.DebugFormat(
-// "[WEB FETCH INV DESC HANDLER]: Recursively fetching folder {0} linked by item in folder {1} for agent {2}",
-// linkedItemFolderId, folderID, agentID);
-//
-// int dummyVersion;
-// InventoryCollection linkedCollection
-// = Fetch(
-// agentID, linkedItemFolderId, ownerID, fetchFolders, fetchItems, sortOrder, out dummyVersion);
-//
-// InventoryFolderBase linkedFolder = new InventoryFolderBase(linkedItemFolderId);
-// linkedFolder.Owner = agentID;
-// linkedFolder = m_InventoryService.GetFolder(linkedFolder);
-//
-//// contents.Folders.AddRange(linkedCollection.Folders);
-//
-// contents.Folders.Add(linkedFolder);
-// contents.Items.AddRange(linkedCollection.Items);
-// }
-// }
}
}
else
@@ -550,33 +402,26 @@ from docs seems this was never a spec
}
- private void AddLibraryFolders(List fetchFolders, List result)
+ private void AddLibraryFolders(List libFolders, List result)
{
InventoryFolderImpl fold;
- if (m_LibraryService != null && m_LibraryService.LibraryRootFolder != null)
+ foreach (LLSDFetchInventoryDescendents f in libFolders)
{
- List libfolders = fetchFolders.FindAll(f => f.owner_id == m_LibraryService.LibraryRootFolder.Owner);
- fetchFolders.RemoveAll(f => libfolders.Contains(f));
-
- //m_log.DebugFormat("[XXX]: Found {0} library folders in request", libfolders.Count);
-
- foreach (LLSDFetchInventoryDescendents f in libfolders)
+ if ((fold = m_LibraryService.LibraryRootFolder.FindFolder(f.folder_id)) != null)
{
- if ((fold = m_LibraryService.LibraryRootFolder.FindFolder(f.folder_id)) != null)
- {
- InventoryCollectionWithDescendents ret = new InventoryCollectionWithDescendents();
- ret.Collection = new InventoryCollection();
- ret.Collection.Folders = new List();
- ret.Collection.Items = fold.RequestListOfItems();
- ret.Collection.OwnerID = m_LibraryService.LibraryRootFolder.Owner;
- ret.Collection.FolderID = f.folder_id;
- ret.Collection.Version = fold.Version;
+ InventoryCollectionWithDescendents ret = new InventoryCollectionWithDescendents();
+ ret.Collection = new InventoryCollection();
+// ret.Collection.Folders = new List();
+ ret.Collection.Folders = fold.RequestListOfFolders();
+ ret.Collection.Items = fold.RequestListOfItems();
+ ret.Collection.OwnerID = m_LibraryService.LibraryRootFolder.Owner;
+ ret.Collection.FolderID = f.folder_id;
+ ret.Collection.Version = fold.Version;
- ret.Descendents = ret.Collection.Items.Count;
- result.Add(ret);
+ ret.Descendents = ret.Collection.Items.Count + ret.Collection.Folders.Count;
+ result.Add(ret);
- //m_log.DebugFormat("[XXX]: Added libfolder {0} ({1}) {2}", ret.Collection.FolderID, ret.Collection.OwnerID);
- }
+ //m_log.DebugFormat("[XXX]: Added libfolder {0} ({1}) {2}", ret.Collection.FolderID, ret.Collection.OwnerID);
}
}
}
@@ -589,117 +434,122 @@ from docs seems this was never a spec
// FIXME MAYBE: We're not handling sortOrder!
List result = new List();
+ List libFolders = new List();
+ List otherFolders = new List();
+ HashSet libIDs = new HashSet();
+ HashSet otherIDs = new HashSet();
- AddLibraryFolders(fetchFolders, result);
+ bool dolib = (m_LibraryService != null && m_LibraryService.LibraryRootFolder != null);
+ UUID libOwner = UUID.Zero;
+ if(dolib)
+ libOwner = m_LibraryService.LibraryRootFolder.Owner;
// Filter folder Zero right here. Some viewers (Firestorm) send request for folder Zero, which doesn't make sense
// and can kill the sim (all root folders have parent_id Zero)
- LLSDFetchInventoryDescendents zero = fetchFolders.Find(f => f.folder_id == UUID.Zero);
- if (zero != null)
+ // send something.
+ bool doneZeroID = false;
+ foreach(LLSDFetchInventoryDescendents f in fetchFolders)
{
- fetchFolders.Remove(zero);
- BadFolder(zero, null, bad_folders);
+ if (f.folder_id == UUID.Zero)
+ {
+ if(doneZeroID)
+ continue;
+ doneZeroID = true;
+ InventoryCollectionWithDescendents zeroColl = new InventoryCollectionWithDescendents();
+ zeroColl.Collection = new InventoryCollection();
+ zeroColl.Collection.OwnerID = f.owner_id;
+ zeroColl.Collection.Version = 0;
+ zeroColl.Collection.FolderID = f.folder_id;
+ zeroColl.Descendents = 0;
+ result.Add(zeroColl);
+ continue;
+ }
+ if(dolib && f.owner_id == libOwner)
+ {
+ if(libIDs.Contains(f.folder_id))
+ continue;
+ libIDs.Add(f.folder_id);
+ libFolders.Add(f);
+ continue;
+ }
+ if(otherIDs.Contains(f.folder_id))
+ continue;
+ otherIDs.Add(f.folder_id);
+ otherFolders.Add(f);
}
- if (fetchFolders.Count > 0)
- {
- UUID[] fids = new UUID[fetchFolders.Count];
+ if(otherFolders.Count > 0)
+ {
int i = 0;
- foreach (LLSDFetchInventoryDescendents f in fetchFolders)
- fids[i++] = f.folder_id;
//m_log.DebugFormat("[XXX]: {0}", string.Join(",", fids));
- InventoryCollection[] fetchedContents = m_InventoryService.GetMultipleFoldersContent(fetchFolders[0].owner_id, fids);
+ InventoryCollection[] fetchedContents = m_InventoryService.GetMultipleFoldersContent(otherFolders[0].owner_id, otherIDs.ToArray());
- if (fetchedContents == null || (fetchedContents != null && fetchedContents.Length == 0))
+ if (fetchedContents == null)
+ return null;
+
+ if (fetchedContents.Length == 0)
{
- m_log.WarnFormat("[WEB FETCH INV DESC HANDLER]: Could not get contents of multiple folders for user {0}", fetchFolders[0].owner_id);
- foreach (LLSDFetchInventoryDescendents freq in fetchFolders)
+ foreach (LLSDFetchInventoryDescendents freq in otherFolders)
BadFolder(freq, null, bad_folders);
- return null;
}
-
- i = 0;
- // Do some post-processing. May need to fetch more from inv server for links
- foreach (InventoryCollection contents in fetchedContents)
+ else
{
- // Find the original request
- LLSDFetchInventoryDescendents freq = fetchFolders[i++];
+ i = 0;
+ // Do some post-processing. May need to fetch more from inv server for links
+ foreach (InventoryCollection contents in fetchedContents)
+ {
+ // Find the original request
+ LLSDFetchInventoryDescendents freq = otherFolders[i++];
- InventoryCollectionWithDescendents coll = new InventoryCollectionWithDescendents();
- coll.Collection = contents;
+ InventoryCollectionWithDescendents coll = new InventoryCollectionWithDescendents();
+ coll.Collection = contents;
- if (BadFolder(freq, contents, bad_folders))
- continue;
+ if (BadFolder(freq, contents, bad_folders))
+ continue;
- // Next: link management
- ProcessLinks(freq, coll);
+ // Next: link management
+ ProcessLinks(freq, coll);
- result.Add(coll);
+ result.Add(coll);
+ }
}
}
+ if(dolib && libFolders.Count > 0)
+ {
+ AddLibraryFolders(libFolders, result);
+ }
+
return result;
}
private bool BadFolder(LLSDFetchInventoryDescendents freq, InventoryCollection contents, List bad_folders)
{
- bool bad = false;
if (contents == null)
{
bad_folders.Add(freq.folder_id);
- bad = true;
+ return true;
}
// The inventory server isn't sending FolderID in the collection...
// Must fetch it individually
- else if (contents.FolderID == UUID.Zero)
+ if (contents.FolderID == UUID.Zero)
{
InventoryFolderBase containingFolder = m_InventoryService.GetFolder(freq.owner_id, freq.folder_id);
-
- if (containingFolder != null)
+ if (containingFolder == null)
{
- contents.FolderID = containingFolder.ID;
- contents.OwnerID = containingFolder.Owner;
- contents.Version = containingFolder.Version;
- }
- else
- {
- // Was it really a request for folder Zero?
- // This is an overkill, but Firestorm really asks for folder Zero.
- // I'm leaving the code here for the time being, but commented.
- if (freq.folder_id == UUID.Zero)
- {
- //coll.Collection.OwnerID = freq.owner_id;
- //coll.Collection.FolderID = contents.FolderID;
- //containingFolder = m_InventoryService.GetRootFolder(freq.owner_id);
- //if (containingFolder != null)
- //{
- // m_log.WarnFormat("[WEB FETCH INV DESC HANDLER]: Request for parent of folder {0}", containingFolder.ID);
- // coll.Collection.Folders.Clear();
- // coll.Collection.Folders.Add(containingFolder);
- // if (m_LibraryService != null && m_LibraryService.LibraryRootFolder != null)
- // {
- // InventoryFolderBase lib = new InventoryFolderBase(m_LibraryService.LibraryRootFolder.ID, m_LibraryService.LibraryRootFolder.Owner);
- // lib.Name = m_LibraryService.LibraryRootFolder.Name;
- // lib.Type = m_LibraryService.LibraryRootFolder.Type;
- // lib.Version = m_LibraryService.LibraryRootFolder.Version;
- // coll.Collection.Folders.Add(lib);
- // }
- // coll.Collection.Items.Clear();
- //}
- }
- else
- {
- m_log.WarnFormat("[WEB FETCH INV DESC HANDLER]: Unable to fetch folder {0}", freq.folder_id);
- bad_folders.Add(freq.folder_id);
- }
- bad = true;
+ m_log.WarnFormat("[WEB FETCH INV DESC HANDLER]: Unable to fetch folder {0}", freq.folder_id);
+ bad_folders.Add(freq.folder_id);
+ return true;
}
+ contents.FolderID = containingFolder.ID;
+ contents.OwnerID = containingFolder.Owner;
+ contents.Version = containingFolder.Version;
}
- return bad;
+ return false;
}
private void ProcessLinks(LLSDFetchInventoryDescendents freq, InventoryCollectionWithDescendents coll)
@@ -708,42 +558,21 @@ from docs seems this was never a spec
if (freq.fetch_items && contents.Items != null)
{
- List itemsToReturn = contents.Items;
-
+ // viewers are lasy and want a copy of the linked item sent before the link to it
+
// descendents must only include the links, not the linked items we add
- coll.Descendents = itemsToReturn.Count;
+ coll.Descendents = contents.Items.Count + contents.Folders.Count;
- // Add target items for links in this folder before the links themselves.
+ // look for item links
List itemIDs = new List();
- List folderIDs = new List();
- foreach (InventoryItemBase item in itemsToReturn)
+ foreach (InventoryItemBase item in contents.Items)
{
//m_log.DebugFormat("[XXX]: {0} {1}", item.Name, item.AssetType);
if (item.AssetType == (int)AssetType.Link)
itemIDs.Add(item.AssetID);
-
-// else if (item.AssetType == (int)AssetType.LinkFolder)
-// folderIDs.Add(item.AssetID);
- }
-
- //m_log.DebugFormat("[XXX]: folder {0} has {1} links and {2} linkfolders", contents.FolderID, itemIDs.Count, folderIDs.Count);
-
- // Scan for folder links and insert the items they target and those links at the head of the return data
- if (folderIDs.Count > 0)
- {
- InventoryCollection[] linkedFolders = m_InventoryService.GetMultipleFoldersContent(coll.Collection.OwnerID, folderIDs.ToArray());
- foreach (InventoryCollection linkedFolderContents in linkedFolders)
- {
- if (linkedFolderContents == null)
- continue;
-
- List links = linkedFolderContents.Items;
-
- itemsToReturn.InsertRange(0, links);
-
- }
}
+ // get the linked if any
if (itemIDs.Count > 0)
{
InventoryItemBase[] linked = m_InventoryService.GetMultipleItems(freq.owner_id, itemIDs.ToArray());
@@ -758,13 +587,11 @@ from docs seems this was never a spec
linked[i++] = m_InventoryService.GetItem(freq.owner_id, id);
}
}
-
- //m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Processing folder {0}. Existing items:", freq.folder_id);
- //foreach (InventoryItemBase item in itemsToReturn)
- // m_log.DebugFormat("[XXX]: {0} {1} {2}", item.Name, item.AssetType, item.Folder);
-
+
if (linked != null)
{
+ List linkedItems = new List();
+ // check for broken
foreach (InventoryItemBase linkedItem in linked)
{
// Take care of genuinely broken links where the target doesn't exist
@@ -773,14 +600,16 @@ from docs seems this was never a spec
// rather than having to keep track of every folder requested in the recursion.
if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link)
{
- itemsToReturn.Insert(0, linkedItem);
+ linkedItems.Add(linkedItem);
//m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Added {0} {1} {2}", linkedItem.Name, linkedItem.AssetType, linkedItem.Folder);
}
}
+ // insert them
+ if(linkedItems.Count > 0)
+ contents.Items.InsertRange(0,linkedItems);
}
}
}
-
}
///
@@ -795,6 +624,7 @@ from docs seems this was never a spec
llsdFolder.parent_id = invFolder.ParentID;
llsdFolder.name = invFolder.Name;
llsdFolder.type = invFolder.Type;
+ llsdFolder.version = invFolder.Version;
llsdFolder.preferred_type = -1;
return llsdFolder;
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs
index e239a90dbf..bae4cf60c8 100644
--- a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs
+++ b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs
@@ -26,6 +26,7 @@
*/
using System.Reflection;
+using System.Text;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
@@ -59,9 +60,6 @@ namespace OpenSim.Capabilities.Handlers
OSDMap requestmap = (OSDMap)OSDParser.DeserializeLLSDXml(Utils.StringToBytes(request));
OSDArray itemsRequested = (OSDArray)requestmap["items"];
- string reply;
- LLSDFetchInventory llsdReply = new LLSDFetchInventory();
-
UUID[] itemIDs = new UUID[itemsRequested.Count];
int i = 0;
@@ -75,15 +73,6 @@ namespace OpenSim.Capabilities.Handlers
if (m_agentID != UUID.Zero)
{
items = m_inventoryService.GetMultipleItems(m_agentID, itemIDs);
-
- if (items == null)
- {
- // OMG!!! One by one!!! This is fallback code, in case the backend isn't updated
- m_log.WarnFormat("[FETCH INVENTORY HANDLER]: GetMultipleItems failed. Falling back to fetching inventory items one by one.");
- items = new InventoryItemBase[itemsRequested.Count];
- foreach (UUID id in itemIDs)
- items[i++] = m_inventoryService.GetItem(m_agentID, id);
- }
}
else
{
@@ -92,55 +81,31 @@ namespace OpenSim.Capabilities.Handlers
items[i++] = m_inventoryService.GetItem(UUID.Zero, id);
}
- foreach (InventoryItemBase item in items)
+ StringBuilder lsl = LLSDxmlEncode.Start(4096);
+ LLSDxmlEncode.AddMap(lsl);
+
+ if(m_agentID == UUID.Zero && items.Length > 0)
+ LLSDxmlEncode.AddElem("agent_id", items[0].Owner, lsl);
+ else
+ LLSDxmlEncode.AddElem("agent_id", m_agentID, lsl);
+
+ if(items == null || items.Length == 0)
{
- if (item != null)
- {
- // We don't know the agent that this request belongs to so we'll use the agent id of the item
- // which will be the same for all items.
- llsdReply.agent_id = item.Owner;
- llsdReply.items.Array.Add(ConvertInventoryItem(item));
- }
+ LLSDxmlEncode.AddEmptyArray("items", lsl);
}
+ else
+ {
+ LLSDxmlEncode.AddArray("items", lsl);
+ foreach (InventoryItemBase item in items)
+ {
+ if (item != null)
+ item.ToLLSDxml(lsl);
+ }
+ LLSDxmlEncode.AddEndArray(lsl);
+ }
- reply = LLSDHelpers.SerialiseLLSDReply(llsdReply);
-
- return reply;
- }
-
- ///
- /// Convert an internal inventory item object into an LLSD object.
- ///
- ///
- ///
- private LLSDInventoryItem ConvertInventoryItem(InventoryItemBase invItem)
- {
- LLSDInventoryItem llsdItem = new LLSDInventoryItem();
- llsdItem.asset_id = invItem.AssetID;
- llsdItem.created_at = invItem.CreationDate;
- llsdItem.desc = invItem.Description;
- llsdItem.flags = ((int)invItem.Flags) & 0xff;
- llsdItem.item_id = invItem.ID;
- llsdItem.name = invItem.Name;
- llsdItem.parent_id = invItem.Folder;
- llsdItem.type = invItem.AssetType;
- llsdItem.inv_type = invItem.InvType;
-
- llsdItem.permissions = new LLSDPermissions();
- llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid;
- llsdItem.permissions.base_mask = (int)invItem.CurrentPermissions;
- llsdItem.permissions.everyone_mask = (int)invItem.EveryOnePermissions;
- llsdItem.permissions.group_id = invItem.GroupID;
- llsdItem.permissions.group_mask = (int)invItem.GroupPermissions;
- llsdItem.permissions.is_owner_group = invItem.GroupOwned;
- llsdItem.permissions.next_owner_mask = (int)invItem.NextPermissions;
- llsdItem.permissions.owner_id = invItem.Owner;
- llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions;
- llsdItem.sale_info = new LLSDSaleInfo();
- llsdItem.sale_info.sale_price = invItem.SalePrice;
- llsdItem.sale_info.sale_type = invItem.SaleType;
-
- return llsdItem;
+ LLSDxmlEncode.AddEndMap(lsl);
+ return LLSDxmlEncode.End(lsl);;
}
}
}
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventoryDescendents2HandlerTests.cs b/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventoryDescendents2HandlerTests.cs
index 4143aa33af..1e9a993494 100644
--- a/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventoryDescendents2HandlerTests.cs
+++ b/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventoryDescendents2HandlerTests.cs
@@ -267,6 +267,7 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
[Test]
public void Test_005_FolderZero()
{
+
TestHelpers.InMethod();
Init();
@@ -283,11 +284,11 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
Assert.That(llsdresponse != null, Is.True, "Incorrect null response");
Assert.That(llsdresponse != string.Empty, Is.True, "Incorrect empty response");
- Assert.That(llsdresponse.Contains("bad_folders00000000-0000-0000-0000-000000000000"), Is.True, "Folder Zero should be a bad folder");
+ // we do return a answer now
+ //Assert.That(llsdresponse.Contains("bad_folders00000000-0000-0000-0000-000000000000"), Is.True, "Folder Zero should be a bad folder");
Console.WriteLine(llsdresponse);
}
-
}
}
\ No newline at end of file
diff --git a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs
index a9b81f3138..a0471bb0c4 100644
--- a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs
+++ b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs
@@ -64,10 +64,7 @@ namespace OpenSim.Capabilities.Handlers
Hashtable ret = new Hashtable();
ret["int_response_code"] = (int)System.Net.HttpStatusCode.NotFound;
ret["content_type"] = "text/plain";
- ret["keepalive"] = false;
- ret["reusecontext"] = false;
ret["int_bytes"] = 0;
- ret["int_lod"] = 0;
string MeshStr = (string)request["mesh_id"];
@@ -76,6 +73,8 @@ namespace OpenSim.Capabilities.Handlers
if (m_assetService == null)
{
m_log.Error("[GETMESH]: Cannot fetch mesh " + MeshStr + " without an asset service");
+ ret["keepalive"] = false;
+ return ret;
}
UUID meshID;
@@ -101,10 +100,7 @@ namespace OpenSim.Capabilities.Handlers
Hashtable responsedata = new Hashtable();
responsedata["int_response_code"] = 400; //501; //410; //404;
responsedata["content_type"] = "text/plain";
- responsedata["keepalive"] = false;
responsedata["str_response_string"] = "Request wasn't what was expected";
- responsedata["reusecontext"] = false;
- responsedata["int_lod"] = 0;
responsedata["int_bytes"] = 0;
string meshStr = string.Empty;
@@ -118,10 +114,8 @@ namespace OpenSim.Capabilities.Handlers
if (m_assetService == null)
{
responsedata["int_response_code"] = 404; //501; //410; //404;
- responsedata["content_type"] = "text/plain";
responsedata["keepalive"] = false;
responsedata["str_response_string"] = "The asset service is unavailable. So is your mesh.";
- responsedata["reusecontext"] = false;
return responsedata;
}
@@ -155,10 +149,7 @@ namespace OpenSim.Capabilities.Handlers
{
responsedata["int_response_code"] = 404; //501; //410; //404;
responsedata["content_type"] = "text/plain";
- responsedata["keepalive"] = false;
responsedata["str_response_string"] = "This range doesnt exist.";
- responsedata["reusecontext"] = false;
- responsedata["int_lod"] = 3;
return responsedata;
}
else
@@ -169,28 +160,11 @@ namespace OpenSim.Capabilities.Handlers
//m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
- if (start > 20000)
- {
- responsedata["int_lod"] = 3;
- }
- else if (start < 4097)
- {
- responsedata["int_lod"] = 1;
- }
- else
- {
- responsedata["int_lod"] = 2;
- }
-
-
if (start == 0 && len == mesh.Data.Length) // well redudante maybe
{
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.OK;
responsedata["bin_response_data"] = mesh.Data;
responsedata["int_bytes"] = mesh.Data.Length;
- responsedata["reusecontext"] = false;
- responsedata["int_lod"] = 3;
-
}
else
{
@@ -203,7 +177,6 @@ namespace OpenSim.Capabilities.Handlers
Array.Copy(mesh.Data, start, d, 0, len);
responsedata["bin_response_data"] = d;
responsedata["int_bytes"] = len;
- responsedata["reusecontext"] = false;
}
}
}
@@ -213,8 +186,6 @@ namespace OpenSim.Capabilities.Handlers
responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data);
responsedata["content_type"] = "application/vnd.ll.mesh";
responsedata["int_response_code"] = 200;
- responsedata["reusecontext"] = false;
- responsedata["int_lod"] = 3;
}
}
else
@@ -222,8 +193,6 @@ namespace OpenSim.Capabilities.Handlers
responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data);
responsedata["content_type"] = "application/vnd.ll.mesh";
responsedata["int_response_code"] = 200;
- responsedata["reusecontext"] = false;
- responsedata["int_lod"] = 3;
}
}
// Optionally add additional mesh types here
@@ -231,10 +200,7 @@ namespace OpenSim.Capabilities.Handlers
{
responsedata["int_response_code"] = 404; //501; //410; //404;
responsedata["content_type"] = "text/plain";
- responsedata["keepalive"] = false;
responsedata["str_response_string"] = "Unfortunately, this asset isn't a mesh.";
- responsedata["reusecontext"] = false;
- responsedata["int_lod"] = 1;
return responsedata;
}
}
@@ -242,10 +208,7 @@ namespace OpenSim.Capabilities.Handlers
{
responsedata["int_response_code"] = 404; //501; //410; //404;
responsedata["content_type"] = "text/plain";
- responsedata["keepalive"] = false;
responsedata["str_response_string"] = "Your Mesh wasn't found. Sorry!";
- responsedata["reusecontext"] = false;
- responsedata["int_lod"] = 0;
return responsedata;
}
}
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
index 062a842748..2499ce4023 100644
--- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
+++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
@@ -66,8 +66,6 @@ namespace OpenSim.Capabilities.Handlers
Hashtable ret = new Hashtable();
ret["int_response_code"] = (int)System.Net.HttpStatusCode.NotFound;
ret["content_type"] = "text/plain";
- ret["keepalive"] = false;
- ret["reusecontext"] = false;
ret["int_bytes"] = 0;
string textureStr = (string)request["texture_id"];
string format = (string)request["format"];
@@ -112,8 +110,6 @@ namespace OpenSim.Capabilities.Handlers
ret["error_status_text"] = "not found";
ret["str_response_string"] = "not found";
ret["content_type"] = "text/plain";
- ret["keepalive"] = false;
- ret["reusecontext"] = false;
ret["int_bytes"] = 0;
}
}
@@ -362,8 +358,6 @@ namespace OpenSim.Capabilities.Handlers
{
// Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data
- imgstream = new MemoryStream();
-
// Decode image to System.Drawing.Image
if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image) && image != null)
{
@@ -404,10 +398,7 @@ namespace OpenSim.Capabilities.Handlers
if(managedImage != null)
managedImage.Clear();
if (imgstream != null)
- {
- imgstream.Close();
imgstream.Dispose();
- }
}
return data;
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureRobustHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureRobustHandler.cs
index d5df7a29bd..a9b3d48694 100644
--- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureRobustHandler.cs
+++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureRobustHandler.cs
@@ -131,87 +131,46 @@ namespace OpenSim.Capabilities.Handlers
/// False for "caller try another codec"; true otherwise
private bool FetchTexture(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, UUID textureID, string format)
{
-// m_log.DebugFormat("[GETTEXTURE]: {0} with requested format {1}", textureID, format);
- AssetBase texture;
-
- string fullID = textureID.ToString();
- if (format != DefaultFormat)
- fullID = fullID + "-" + format;
-
- if (!String.IsNullOrEmpty(m_RedirectURL))
+ // m_log.DebugFormat("[GETTEXTURE]: {0} with requested format {1}", textureID, format);
+ if(!String.IsNullOrEmpty(m_RedirectURL))
{
- // Only try to fetch locally cached textures. Misses are redirected
- texture = m_assetService.GetCached(fullID);
+ string textureUrl = m_RedirectURL + "?texture_id=" + textureID.ToString();
+ m_log.Debug("[GETTEXTURE]: Redirecting texture request to " + textureUrl);
+ httpResponse.StatusCode = (int)OSHttpStatusCode.RedirectMovedPermanently;
+ httpResponse.RedirectLocation = textureUrl;
+ return true;
+ }
- if (texture != null)
+ // Fetch, Misses or invalid return a 404
+ AssetBase texture = m_assetService.Get(textureID.ToString());
+ if (texture != null)
+ {
+ if (texture.Type != (sbyte)AssetType.Texture)
+ {
+ httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
+ return true;
+ }
+ if (format == DefaultFormat)
{
- if (texture.Type != (sbyte)AssetType.Texture)
- {
- httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
- return true;
- }
WriteTextureData(httpRequest, httpResponse, texture, format);
return true;
}
- else
- {
- string textureUrl = m_RedirectURL + "?texture_id="+ textureID.ToString();
- m_log.Debug("[GETTEXTURE]: Redirecting texture request to " + textureUrl);
- httpResponse.StatusCode = (int)OSHttpStatusCode.RedirectMovedPermanently;
- httpResponse.RedirectLocation = textureUrl;
- return true;
- }
- }
- else // no redirect
- {
- // try the cache
- texture = m_assetService.GetCached(fullID);
- if (texture == null)
- {
-// m_log.DebugFormat("[GETTEXTURE]: texture was not in the cache");
+ // need to convert format
+ AssetBase newTexture = new AssetBase(texture.ID + "-" + format, texture.Name, (sbyte)AssetType.Texture, texture.Metadata.CreatorID);
+ newTexture.Data = ConvertTextureData(texture, format);
+ if (newTexture.Data.Length == 0)
+ return false; // !!! Caller try another codec, please!
- // Fetch locally or remotely. Misses return a 404
- texture = m_assetService.Get(textureID.ToString());
-
- if (texture != null)
- {
- if (texture.Type != (sbyte)AssetType.Texture)
- {
- httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
- return true;
- }
- if (format == DefaultFormat)
- {
- WriteTextureData(httpRequest, httpResponse, texture, format);
- return true;
- }
- else
- {
- AssetBase newTexture = new AssetBase(texture.ID + "-" + format, texture.Name, (sbyte)AssetType.Texture, texture.Metadata.CreatorID);
- newTexture.Data = ConvertTextureData(texture, format);
- if (newTexture.Data.Length == 0)
- return false; // !!! Caller try another codec, please!
-
- newTexture.Flags = AssetFlags.Collectable;
- newTexture.Temporary = true;
- newTexture.Local = true;
- m_assetService.Store(newTexture);
- WriteTextureData(httpRequest, httpResponse, newTexture, format);
- return true;
- }
- }
- }
- else // it was on the cache
- {
-// m_log.DebugFormat("[GETTEXTURE]: texture was in the cache");
- WriteTextureData(httpRequest, httpResponse, texture, format);
- return true;
- }
+ newTexture.Flags = AssetFlags.Collectable;
+ newTexture.Temporary = true;
+ newTexture.Local = true;
+ WriteTextureData(httpRequest, httpResponse, newTexture, format);
+ return true;
}
// not found
-// m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found");
+ // m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found");
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
return true;
}
@@ -368,9 +327,6 @@ namespace OpenSim.Capabilities.Handlers
try
{
// Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data
-
- imgstream = new MemoryStream();
-
// Decode image to System.Drawing.Image
if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image) && image != null)
{
@@ -412,10 +368,7 @@ namespace OpenSim.Capabilities.Handlers
managedImage.Clear();
if (imgstream != null)
- {
- imgstream.Close();
imgstream.Dispose();
- }
}
return data;
diff --git a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs
index 80b83069e2..48274c1ae5 100644
--- a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs
+++ b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs
@@ -26,24 +26,12 @@
*/
using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.Specialized;
-using System.Drawing;
-using System.Drawing.Imaging;
using System.Reflection;
-using System.IO;
-using System.Web;
using log4net;
-using Nini.Config;
using OpenMetaverse;
-using OpenMetaverse.StructuredData;
-using OpenMetaverse.Imaging;
using OpenSim.Framework;
using OpenSim.Framework.Capabilities;
-using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer;
-using OpenSim.Region.Framework.Interfaces;
using OpenSim.Services.Interfaces;
using Caps = OpenSim.Framework.Capabilities.Caps;
@@ -56,13 +44,11 @@ namespace OpenSim.Capabilities.Handlers
private Caps m_HostCapsObj;
private IAssetService m_assetService;
- private bool m_persistBakedTextures;
- public UploadBakedTextureHandler(Caps caps, IAssetService assetService, bool persistBakedTextures)
+ public UploadBakedTextureHandler(Caps caps, IAssetService assetService)
{
m_HostCapsObj = caps;
m_assetService = assetService;
- m_persistBakedTextures = persistBakedTextures;
}
///
@@ -125,9 +111,8 @@ namespace OpenSim.Capabilities.Handlers
asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_HostCapsObj.AgentID.ToString());
asset.Data = data;
asset.Temporary = true;
- asset.Local = !m_persistBakedTextures; // Local assets aren't persisted, non-local are
+ asset.Local = true;
m_assetService.Store(asset);
-
}
}
@@ -151,8 +136,6 @@ namespace OpenSim.Capabilities.Handlers
// m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID);
}
-
-
///
/// Handle raw uploaded baked texture data.
///
diff --git a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs
index 10ea8eefe6..fd484bad8e 100644
--- a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs
+++ b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs
@@ -67,7 +67,7 @@ namespace OpenSim.Capabilities.Handlers
server.AddStreamHandler(new RestStreamHandler(
"POST",
"/CAPS/UploadBakedTexture/",
- new UploadBakedTextureHandler(caps, m_AssetService, true).UploadBakedTexture,
+ new UploadBakedTextureHandler(caps, m_AssetService).UploadBakedTexture,
"UploadBakedTexture",
"Upload Baked Texture Capability"));
diff --git a/OpenSim/Capabilities/LLSD.cs b/OpenSim/Capabilities/LLSD.cs
index c59cede3f4..342164d9af 100644
--- a/OpenSim/Capabilities/LLSD.cs
+++ b/OpenSim/Capabilities/LLSD.cs
@@ -107,17 +107,17 @@ namespace OpenSim.Framework.Capabilities
///
public static byte[] LLSDSerialize(object obj)
{
- StringWriter sw = new StringWriter();
- XmlTextWriter writer = new XmlTextWriter(sw);
- writer.Formatting = Formatting.None;
+ using(StringWriter sw = new StringWriter())
+ using(XmlTextWriter writer = new XmlTextWriter(sw))
+ {
+ writer.Formatting = Formatting.None;
- writer.WriteStartElement(String.Empty, "llsd", String.Empty);
- LLSDWriteOne(writer, obj);
- writer.WriteEndElement();
-
- writer.Close();
-
- return Util.UTF8.GetBytes(sw.ToString());
+ writer.WriteStartElement(String.Empty, "llsd", String.Empty);
+ LLSDWriteOne(writer, obj);
+ writer.WriteEndElement();
+ writer.Flush();
+ return Util.UTF8.GetBytes(sw.ToString());
+ }
}
///
@@ -566,7 +566,7 @@ namespace OpenSim.Framework.Capabilities
endPos = FindEnd(llsd, 1);
if (Double.TryParse(llsd.Substring(1, endPos - 1), NumberStyles.Float,
- Utils.EnUsCulture.NumberFormat, out value))
+ Culture.NumberFormatInfo, out value))
return value;
else
throw new LLSDParseException("Failed to parse double value type");
diff --git a/OpenSim/Capabilities/LLSDHelpers.cs b/OpenSim/Capabilities/LLSDHelpers.cs
index 8f1a40e632..e54618d3b5 100644
--- a/OpenSim/Capabilities/LLSDHelpers.cs
+++ b/OpenSim/Capabilities/LLSDHelpers.cs
@@ -30,6 +30,7 @@ using System.Collections;
using System.IO;
using System.Reflection;
using System.Xml;
+using OpenMetaverse;
namespace OpenSim.Framework.Capabilities
{
@@ -40,17 +41,32 @@ namespace OpenSim.Framework.Capabilities
public static string SerialiseLLSDReply(object obj)
{
- StringWriter sw = new StringWriter();
- XmlTextWriter writer = new XmlTextWriter(sw);
- writer.Formatting = Formatting.None;
- writer.WriteStartElement(String.Empty, "llsd", String.Empty);
- SerializeOSDType(writer, obj);
- writer.WriteEndElement();
- writer.Close();
-
+ using(StringWriter sw = new StringWriter())
+ using(XmlTextWriter writer = new XmlTextWriter(sw))
+ {
+ writer.Formatting = Formatting.None;
+ writer.WriteStartElement(String.Empty, "llsd", String.Empty);
+ SerializeOSDType(writer, obj);
+ writer.WriteEndElement();
+ writer.Flush();
//m_log.DebugFormat("[LLSD Helpers]: Generated serialized LLSD reply {0}", sw.ToString());
- return sw.ToString();
+ return sw.ToString();
+ }
+ }
+
+ public static string SerialiseLLSDReplyNoHeader(object obj)
+ {
+ using(StringWriter sw = new StringWriter())
+ using(XmlTextWriter writer = new XmlTextWriter(sw))
+ {
+ writer.Formatting = Formatting.None;
+ SerializeOSDType(writer, obj);
+ writer.Flush();
+ //m_log.DebugFormat("[LLSD Helpers]: Generated serialized LLSD reply {0}", sw.ToString());
+
+ return sw.ToString();
+ }
}
private static void SerializeOSDType(XmlTextWriter writer, object obj)
@@ -157,6 +173,22 @@ namespace OpenSim.Framework.Capabilities
// the LLSD map/array types in the array need to be deserialised
// but first we need to know the right class to deserialise them into.
}
+ else if(enumerator.Value is Boolean && field.FieldType == typeof(int) )
+ {
+ int i = (bool)enumerator.Value ? 1 : 0;
+ field.SetValue(obj, i);
+ }
+ else if(field.FieldType == typeof(bool) && enumerator.Value is int)
+ {
+ bool b = (int)enumerator.Value != 0;
+ field.SetValue(obj, b);
+ }
+ else if(field.FieldType == typeof(UUID) && enumerator.Value is string)
+ {
+ UUID u;
+ UUID.TryParse((string)enumerator.Value, out u);
+ field.SetValue(obj, u);
+ }
else
{
field.SetValue(obj, enumerator.Value);
diff --git a/OpenSim/Capabilities/LLSDInventoryFolder.cs b/OpenSim/Capabilities/LLSDInventoryFolder.cs
index d085430e8a..76b3f4135d 100644
--- a/OpenSim/Capabilities/LLSDInventoryFolder.cs
+++ b/OpenSim/Capabilities/LLSDInventoryFolder.cs
@@ -37,5 +37,6 @@ namespace OpenSim.Framework.Capabilities
public string name;
public int type;
public int preferred_type;
+ public int version;
}
}
diff --git a/OpenSim/Framework/GcNotify.cs b/OpenSim/Data/IMuteListData.cs
similarity index 69%
rename from OpenSim/Framework/GcNotify.cs
rename to OpenSim/Data/IMuteListData.cs
index 14a22a6104..b0235b2fa8 100644
--- a/OpenSim/Framework/GcNotify.cs
+++ b/OpenSim/Data/IMuteListData.cs
@@ -26,37 +26,19 @@
*/
using System;
-using System.Reflection;
-using log4net;
+using System.Collections.Generic;
+using OpenMetaverse;
+using OpenSim.Framework;
-public class GcNotify
+namespace OpenSim.Data
{
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- public static bool Enabled
+ ///
+ /// An interface for connecting to the Mute List datastore
+ ///
+ public interface IMuteListData
{
- get { return s_initialized; }
- set
- {
- if (!s_initialized && value)
- new GcNotify();
-
- s_initialized = value;
- }
+ bool Store(MuteData data);
+ MuteData[] Get(UUID agentID);
+ bool Delete(UUID agentID, UUID muteID, string muteName);
}
-
- private static bool s_initialized = false;
-
- private GcNotify() {}
-
- ~GcNotify()
- {
- if (!Environment.HasShutdownStarted && !AppDomain.CurrentDomain.IsFinalizingForUnload())
- {
- m_log.DebugFormat("[GC NOTIFY]: Garbage collection triggered.");
-
- if (Enabled)
- new GcNotify();
- }
- }
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index f16cd913e7..8569c903a6 100644
--- a/OpenSim/Data/MySQL/MySQLAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLAssetData.cs
@@ -75,6 +75,7 @@ namespace OpenSim.Data.MySQL
dbcon.Open();
Migration m = new Migration(dbcon, Assembly, "AssetStore");
m.Update();
+ dbcon.Close();
}
}
@@ -144,6 +145,7 @@ namespace OpenSim.Data.MySQL
string.Format("[ASSETS DB]: MySql failure fetching asset {0}. Exception ", assetID), e);
}
}
+ dbcon.Close();
}
return asset;
@@ -156,28 +158,27 @@ namespace OpenSim.Data.MySQL
/// On failure : Throw an exception and attempt to reconnect to database
override public bool StoreAsset(AssetBase asset)
{
+ string assetName = asset.Name;
+ if (asset.Name.Length > AssetBase.MAX_ASSET_NAME)
+ {
+ assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME);
+ m_log.WarnFormat(
+ "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
+ asset.Name, asset.ID, asset.Name.Length, assetName.Length);
+ }
+
+ string assetDescription = asset.Description;
+ if (asset.Description.Length > AssetBase.MAX_ASSET_DESC)
+ {
+ assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC);
+ m_log.WarnFormat(
+ "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
+ asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
+ }
+
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
-
- string assetName = asset.Name;
- if (asset.Name.Length > AssetBase.MAX_ASSET_NAME)
- {
- assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME);
- m_log.WarnFormat(
- "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
- asset.Name, asset.ID, asset.Name.Length, assetName.Length);
- }
-
- string assetDescription = asset.Description;
- if (asset.Description.Length > AssetBase.MAX_ASSET_DESC)
- {
- assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC);
- m_log.WarnFormat(
- "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
- asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
- }
-
using (MySqlCommand cmd =
new MySqlCommand(
"replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, CreatorID, data)" +
@@ -200,15 +201,17 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
cmd.Parameters.AddWithValue("?data", asset.Data);
cmd.ExecuteNonQuery();
+ dbcon.Close();
return true;
}
catch (Exception e)
{
m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
asset.FullID, asset.Name, e.Message);
+ dbcon.Close();
return false;
}
- }
+ }
}
}
@@ -238,6 +241,7 @@ namespace OpenSim.Data.MySQL
e);
}
}
+ dbcon.Close();
}
}
@@ -270,6 +274,7 @@ namespace OpenSim.Data.MySQL
}
}
}
+ dbcon.Close();
}
bool[] results = new bool[uuids.Length];
@@ -334,6 +339,7 @@ namespace OpenSim.Data.MySQL
e);
}
}
+ dbcon.Close();
}
return retList;
@@ -350,6 +356,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?id", id);
cmd.ExecuteNonQuery();
}
+ dbcon.Close();
}
return true;
diff --git a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs
index af6be75bf7..fef582e809 100644
--- a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs
+++ b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs
@@ -59,6 +59,7 @@ namespace OpenSim.Data.MySQL
dbcon.Open();
Migration m = new Migration(dbcon, Assembly, "AuthStore");
m.Update();
+ dbcon.Close();
}
}
@@ -76,27 +77,30 @@ namespace OpenSim.Data.MySQL
{
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
- IDataReader result = cmd.ExecuteReader();
-
- if (result.Read())
+ using(IDataReader result = cmd.ExecuteReader())
{
- ret.PrincipalID = principalID;
-
- CheckColumnNames(result);
-
- foreach (string s in m_ColumnNames)
+ if(result.Read())
{
- if (s == "UUID")
- continue;
+ ret.PrincipalID = principalID;
- ret.Data[s] = result[s].ToString();
+ CheckColumnNames(result);
+
+ foreach(string s in m_ColumnNames)
+ {
+ if(s == "UUID")
+ continue;
+
+ ret.Data[s] = result[s].ToString();
+ }
+
+ dbcon.Close();
+ return ret;
+ }
+ else
+ {
+ dbcon.Close();
+ return null;
}
-
- return ret;
- }
- else
- {
- return null;
}
}
}
diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs
index a5c8d24de5..eeedf02b29 100644
--- a/OpenSim/Data/MySQL/MySQLEstateData.cs
+++ b/OpenSim/Data/MySQL/MySQLEstateData.cs
@@ -82,6 +82,7 @@ namespace OpenSim.Data.MySQL
Migration m = new Migration(dbcon, Assembly, "EstateStore");
m.Update();
+ dbcon.Close();
Type t = typeof(EstateSettings);
m_Fields = t.GetFields(BindingFlags.NonPublic |
@@ -143,7 +144,6 @@ namespace OpenSim.Data.MySQL
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
-
cmd.Connection = dbcon;
bool found = false;
@@ -171,6 +171,8 @@ namespace OpenSim.Data.MySQL
}
}
}
+ dbcon.Close();
+ cmd.Connection = null;
if (!found && create)
{
@@ -231,6 +233,7 @@ namespace OpenSim.Data.MySQL
es.Save();
}
+ dbcon.Close();
}
}
@@ -263,6 +266,7 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery();
}
+ dbcon.Close();
}
SaveBanList(es);
@@ -300,6 +304,7 @@ namespace OpenSim.Data.MySQL
}
}
}
+ dbcon.Close();
}
}
@@ -329,6 +334,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.Clear();
}
}
+ dbcon.Close();
}
}
@@ -358,6 +364,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.Clear();
}
}
+ dbcon.Close();
}
}
@@ -383,6 +390,7 @@ namespace OpenSim.Data.MySQL
}
}
}
+ dbcon.Close();
}
return uuids.ToArray();
@@ -437,7 +445,6 @@ namespace OpenSim.Data.MySQL
reader.Close();
}
}
-
dbcon.Close();
}
@@ -466,7 +473,6 @@ namespace OpenSim.Data.MySQL
reader.Close();
}
}
-
dbcon.Close();
}
diff --git a/OpenSim/Data/MySQL/MySQLFSAssetData.cs b/OpenSim/Data/MySQL/MySQLFSAssetData.cs
index 2837ce31be..6c486077d3 100644
--- a/OpenSim/Data/MySQL/MySQLFSAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLFSAssetData.cs
@@ -78,6 +78,7 @@ namespace OpenSim.Data.MySQL
conn.Open();
Migration m = new Migration(conn, Assembly, "FSAssetStore");
m.Update();
+ conn.Close();
}
}
catch (MySqlException e)
@@ -121,9 +122,13 @@ namespace OpenSim.Data.MySQL
}
catch (MySqlException e)
{
+ cmd.Connection = null;
+ conn.Close();
m_log.ErrorFormat("[FSASSETS]: Query {0} failed with {1}", cmd.CommandText, e.ToString());
return false;
}
+ conn.Close();
+ cmd.Connection = null;
}
return true;
@@ -175,7 +180,7 @@ namespace OpenSim.Data.MySQL
UpdateAccessTime(id, AccessTime);
}
}
-
+ conn.Close();
}
return meta;
@@ -206,6 +211,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?id", AssetID);
cmd.ExecuteNonQuery();
}
+ conn.Close();
}
}
@@ -299,6 +305,7 @@ namespace OpenSim.Data.MySQL
}
}
}
+ conn.Close();
}
for (int i = 0; i < uuids.Length; i++)
@@ -333,6 +340,7 @@ namespace OpenSim.Data.MySQL
count = Convert.ToInt32(reader["count"]);
}
}
+ conn.Close();
}
return count;
@@ -413,8 +421,8 @@ namespace OpenSim.Data.MySQL
imported++;
}
}
-
}
+ importConn.Close();
}
MainConsole.Instance.Output(String.Format("Import done, {0} assets imported", imported));
diff --git a/OpenSim/Data/MySQL/MySQLFramework.cs b/OpenSim/Data/MySQL/MySQLFramework.cs
index 93662db875..98106f0057 100644
--- a/OpenSim/Data/MySQL/MySQLFramework.cs
+++ b/OpenSim/Data/MySQL/MySQLFramework.cs
@@ -74,7 +74,9 @@ namespace OpenSim.Data.MySQL
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
- return ExecuteNonQueryWithConnection(cmd, dbcon);
+ int ret = ExecuteNonQueryWithConnection(cmd, dbcon);
+ dbcon.Close();
+ return ret;
}
}
else
@@ -97,12 +99,15 @@ namespace OpenSim.Data.MySQL
try
{
- return cmd.ExecuteNonQuery();
+ int ret = cmd.ExecuteNonQuery();
+ cmd.Connection = null;
+ return ret;
}
catch (Exception e)
{
m_log.Error(e.Message, e);
m_log.Error(Environment.StackTrace.ToString());
+ cmd.Connection = null;
return 0;
}
}
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
index bd8bbd5920..1564140785 100644
--- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
+++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
@@ -29,11 +29,9 @@ using System;
using System.Collections.Generic;
using System.Data;
using System.Reflection;
-using log4net;
+using System.Text;
using MySql.Data.MySqlClient;
using OpenMetaverse;
-using OpenSim.Framework;
-using OpenSim.Region.Framework.Interfaces;
namespace OpenSim.Data.MySQL
{
@@ -129,25 +127,27 @@ namespace OpenSim.Data.MySQL
public virtual T[] Get(string[] fields, string[] keys, string options)
{
- if (fields.Length != keys.Length)
+ int flen = fields.Length;
+ if (flen == 0 || flen != keys.Length)
return new T[0];
- List terms = new List();
+ int flast = flen - 1;
+ StringBuilder sb = new StringBuilder(1024);
+ sb.AppendFormat("select * from {0} where ", m_Realm);
using (MySqlCommand cmd = new MySqlCommand())
{
- for (int i = 0 ; i < fields.Length ; i++)
+ for (int i = 0 ; i < flen ; i++)
{
cmd.Parameters.AddWithValue(fields[i], keys[i]);
- terms.Add("`" + fields[i] + "` = ?" + fields[i]);
+ if(i< flast)
+ sb.AppendFormat("`{0}` = ?{0} and ", fields[i]);
+ else
+ sb.AppendFormat("`{0}` = ?{0} ", fields[i]);
}
- string where = String.Join(" and ", terms.ToArray());
-
- string query = String.Format("select * from {0} where {1} {2}",
- m_Realm, where, options);
-
- cmd.CommandText = query;
+ sb.Append(options);
+ cmd.CommandText = sb.ToString();
return DoQuery(cmd);
}
@@ -160,8 +160,9 @@ namespace OpenSim.Data.MySQL
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
-
- return DoQueryWithConnection(cmd, dbcon);
+ T[] ret = DoQueryWithConnection(cmd, dbcon);
+ dbcon.Close();
+ return ret;
}
}
else
@@ -203,7 +204,7 @@ namespace OpenSim.Data.MySQL
if (m_Fields[name].FieldType == typeof(bool))
{
int v = Convert.ToInt32(reader[name]);
- m_Fields[name].SetValue(row, v != 0 ? true : false);
+ m_Fields[name].SetValue(row, v != 0);
}
else if (m_Fields[name].FieldType == typeof(UUID))
{
@@ -243,7 +244,7 @@ namespace OpenSim.Data.MySQL
result.Add(row);
}
}
-
+ cmd.Connection = null;
return result.ToArray();
}
@@ -402,7 +403,10 @@ namespace OpenSim.Data.MySQL
dbcon.Open();
cmd.Connection = dbcon;
- return cmd.ExecuteScalar();
+ Object ret = cmd.ExecuteScalar();
+ cmd.Connection = null;
+ dbcon.Close();
+ return ret;
}
}
else
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs
index 382d4a5c33..cc787ccde8 100644
--- a/OpenSim/Data/MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs
@@ -78,6 +78,7 @@ namespace OpenSim.Data.MySQL
dbcon.Open();
Migration m = new Migration(dbcon, assem, "InventoryStore");
m.Update();
+ dbcon.Close();
}
}
@@ -130,6 +131,7 @@ namespace OpenSim.Data.MySQL
items.Add(item);
}
+ dbcon.Close();
return items;
}
}
@@ -170,6 +172,7 @@ namespace OpenSim.Data.MySQL
while (reader.Read())
items.Add(readInventoryFolder(reader));
+ dbcon.Close();
return items;
}
}
@@ -221,6 +224,7 @@ namespace OpenSim.Data.MySQL
if (items.Count > 0)
rootFolder = items[0];
+ dbcon.Close();
return rootFolder;
}
}
@@ -261,6 +265,7 @@ namespace OpenSim.Data.MySQL
while (reader.Read())
items.Add(readInventoryFolder(reader));
+ dbcon.Close();
return items;
}
}
@@ -352,6 +357,7 @@ namespace OpenSim.Data.MySQL
if (reader.Read())
item = readInventoryItem(reader);
+ dbcon.Close();
return item;
}
}
@@ -417,6 +423,7 @@ namespace OpenSim.Data.MySQL
if (reader.Read())
folder = readInventoryFolder(reader);
+ dbcon.Close();
return folder;
}
}
@@ -504,6 +511,7 @@ namespace OpenSim.Data.MySQL
lock (m_dbLock)
result.ExecuteNonQuery();
}
+ dbcon.Close();
}
}
catch (MySqlException e)
@@ -540,6 +548,7 @@ namespace OpenSim.Data.MySQL
lock (m_dbLock)
cmd.ExecuteNonQuery();
}
+ dbcon.Close();
}
}
catch (MySqlException e)
@@ -600,6 +609,7 @@ namespace OpenSim.Data.MySQL
m_log.Error(e.ToString());
}
}
+ dbcon.Close();
}
}
@@ -643,6 +653,7 @@ namespace OpenSim.Data.MySQL
m_log.Error(e.ToString());
}
}
+ dbcon.Close();
}
}
@@ -806,6 +817,7 @@ namespace OpenSim.Data.MySQL
lock (m_dbLock)
cmd.ExecuteNonQuery();
}
+ dbcon.Close();
}
}
catch (MySqlException e)
@@ -833,6 +845,7 @@ namespace OpenSim.Data.MySQL
lock (m_dbLock)
cmd.ExecuteNonQuery();
}
+ dbcon.Close();
}
}
catch (MySqlException e)
@@ -886,6 +899,7 @@ namespace OpenSim.Data.MySQL
if (item != null)
list.Add(item);
}
+ dbcon.Close();
return list;
}
}
diff --git a/OpenSim/Data/MySQL/MySQLMuteListData.cs b/OpenSim/Data/MySQL/MySQLMuteListData.cs
new file mode 100644
index 0000000000..a5935a32fa
--- /dev/null
+++ b/OpenSim/Data/MySQL/MySQLMuteListData.cs
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Data;
+using OpenMetaverse;
+using OpenSim.Framework;
+using MySql.Data.MySqlClient;
+
+namespace OpenSim.Data.MySQL
+{
+ public class MySqlMuteListData : MySQLGenericTableHandler, IMuteListData
+ {
+ public MySqlMuteListData(string connectionString)
+ : base(connectionString, "MuteList", "MuteListStore")
+ {
+ }
+
+ public MuteData[] Get(UUID agentID)
+ {
+ MuteData[] data = base.Get("AgentID", agentID.ToString());
+ return data;
+ }
+
+ public bool Delete(UUID agentID, UUID muteID, string muteName)
+ {
+ string cmnd ="delete from MuteList where AgentID = ?AgentID and MuteID = ?MuteID and MuteName = ?MuteName";
+
+ using (MySqlCommand cmd = new MySqlCommand(cmnd))
+ {
+ cmd.Parameters.AddWithValue("?AgentID", agentID.ToString());
+ cmd.Parameters.AddWithValue("?MuteID", muteID.ToString());
+ cmd.Parameters.AddWithValue("?MuteName", muteName);
+
+ if (ExecuteNonQuery(cmd) > 0)
+ return true;
+ return false;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index 0e55285451..46df421352 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -60,6 +60,7 @@ namespace OpenSim.Data.MySQL
dbcon.Open();
Migration m = new Migration(dbcon, Assembly, "GridStore");
m.Update();
+ dbcon.Close();
}
}
@@ -260,6 +261,8 @@ namespace OpenSim.Data.MySQL
retList.Add(ret);
}
}
+ cmd.Connection = null;
+ dbcon.Close();
}
return retList;
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index 8278c0ec20..e754522f44 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -88,6 +88,7 @@ namespace OpenSim.Data.MySQL
//
Migration m = new Migration(dbcon, Assembly, "RegionStore");
m.Update();
+ dbcon.Close();
}
}
@@ -187,7 +188,7 @@ namespace OpenSim.Data.MySQL
"LinkNumber, MediaURL, KeyframeMotion, AttachedPosX, " +
"AttachedPosY, AttachedPosZ, " +
"PhysicsShapeType, Density, GravityModifier, " +
- "Friction, Restitution, Vehicle, DynAttrs, " +
+ "Friction, Restitution, Vehicle, PhysInertia, DynAttrs, " +
"RotationAxisLocks" +
") values (" + "?UUID, " +
"?CreationDate, ?Name, ?Text, " +
@@ -224,7 +225,7 @@ namespace OpenSim.Data.MySQL
"?LinkNumber, ?MediaURL, ?KeyframeMotion, ?AttachedPosX, " +
"?AttachedPosY, ?AttachedPosZ, " +
"?PhysicsShapeType, ?Density, ?GravityModifier, " +
- "?Friction, ?Restitution, ?Vehicle, ?DynAttrs," +
+ "?Friction, ?Restitution, ?Vehicle, ?PhysInertia, ?DynAttrs," +
"?RotationAxisLocks)";
FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
@@ -261,6 +262,7 @@ namespace OpenSim.Data.MySQL
ExecuteNonQuery(cmd);
}
}
+ dbcon.Close();
}
}
}
@@ -300,6 +302,7 @@ namespace OpenSim.Data.MySQL
cmd.CommandText = "delete from prims where SceneGroupID= ?UUID";
ExecuteNonQuery(cmd);
}
+ dbcon.Close();
}
}
@@ -334,6 +337,7 @@ namespace OpenSim.Data.MySQL
ExecuteNonQuery(cmd);
}
+ dbcon.Close();
}
}
}
@@ -372,6 +376,7 @@ namespace OpenSim.Data.MySQL
ExecuteNonQuery(cmd);
}
+ dbcon.Close();
}
}
}
@@ -411,6 +416,7 @@ namespace OpenSim.Data.MySQL
ExecuteNonQuery(cmd);
}
+ dbcon.Close();
}
}
}
@@ -460,6 +466,7 @@ namespace OpenSim.Data.MySQL
}
}
}
+ dbcon.Close();
}
}
@@ -535,6 +542,7 @@ namespace OpenSim.Data.MySQL
}
}
}
+ dbcon.Close();
}
}
@@ -580,6 +588,7 @@ namespace OpenSim.Data.MySQL
}
}
}
+ dbcon.Close();
}
prim.Inventory.RestoreInventoryItems(inventory);
@@ -598,6 +607,10 @@ namespace OpenSim.Data.MySQL
{
m_log.Info("[REGION DB]: Storing terrain");
+ int terrainDBRevision;
+ Array terrainDBblob;
+ terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob);
+
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
@@ -617,10 +630,6 @@ namespace OpenSim.Data.MySQL
"Revision, Heightfield) values (?RegionUUID, " +
"?Revision, ?Heightfield)";
- int terrainDBRevision;
- Array terrainDBblob;
- terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob);
-
cmd2.Parameters.AddWithValue("RegionUUID", regionID.ToString());
cmd2.Parameters.AddWithValue("Revision", terrainDBRevision);
cmd2.Parameters.AddWithValue("Heightfield", terrainDBblob);
@@ -634,6 +643,7 @@ namespace OpenSim.Data.MySQL
}
}
}
+ dbcon.Close();
}
}
});
@@ -645,6 +655,10 @@ namespace OpenSim.Data.MySQL
{
m_log.Info("[REGION DB]: Storing Baked terrain");
+ int terrainDBRevision;
+ Array terrainDBblob;
+ terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob);
+
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
@@ -664,10 +678,6 @@ namespace OpenSim.Data.MySQL
"Revision, Heightfield) values (?RegionUUID, " +
"?Revision, ?Heightfield)";
- int terrainDBRevision;
- Array terrainDBblob;
- terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob);
-
cmd2.Parameters.AddWithValue("RegionUUID", regionID.ToString());
cmd2.Parameters.AddWithValue("Revision", terrainDBRevision);
cmd2.Parameters.AddWithValue("Heightfield", terrainDBblob);
@@ -681,6 +691,7 @@ namespace OpenSim.Data.MySQL
}
}
}
+ dbcon.Close();
}
}
});
@@ -700,9 +711,12 @@ namespace OpenSim.Data.MySQL
public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
{
TerrainData terrData = null;
+ byte[] blob = null;
+ int rev = 0;
lock (m_dbLock)
{
+
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
@@ -718,24 +732,29 @@ namespace OpenSim.Data.MySQL
{
while (reader.Read())
{
- int rev = Convert.ToInt32(reader["Revision"]);
+ rev = Convert.ToInt32(reader["Revision"]);
if ((reader["Heightfield"] != DBNull.Value))
{
- byte[] blob = (byte[])reader["Heightfield"];
- terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob);
+ blob = (byte[])reader["Heightfield"];
}
}
}
}
+ dbcon.Close();
}
}
+ if(blob != null)
+ terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob);
+
return terrData;
}
public TerrainData LoadBakedTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
{
TerrainData terrData = null;
+ byte[] blob = null;
+ int rev = 0;
lock (m_dbLock)
{
@@ -753,17 +772,19 @@ namespace OpenSim.Data.MySQL
{
while (reader.Read())
{
- int rev = Convert.ToInt32(reader["Revision"]);
+ rev = Convert.ToInt32(reader["Revision"]);
if ((reader["Heightfield"] != DBNull.Value))
{
- byte[] blob = (byte[])reader["Heightfield"];
- terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob);
+ blob = (byte[])reader["Heightfield"];
}
}
}
}
+ dbcon.Close();
}
}
+ if(blob != null)
+ terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob);
return terrData;
}
@@ -783,6 +804,7 @@ namespace OpenSim.Data.MySQL
ExecuteNonQuery(cmd);
}
+ dbcon.Close();
}
}
}
@@ -842,6 +864,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.Clear();
}
}
+ dbcon.Close();
}
}
}
@@ -863,82 +886,85 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString());
- IDataReader result = ExecuteReader(cmd);
- if (!result.Read())
+ using(IDataReader result = ExecuteReader(cmd))
{
- //No result, so store our default windlight profile and return it
- nWP.regionID = regionUUID;
-// StoreRegionWindlightSettings(nWP);
- return nWP;
- }
- else
- {
- nWP.regionID = DBGuid.FromDB(result["region_id"]);
- nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]);
- nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]);
- nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]);
- nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]);
- nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]);
- nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]);
- nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]);
- nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]);
- nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]);
- nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]);
- nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]);
- nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]);
- nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]);
- nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]);
- nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]);
- nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]);
- nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]);
- UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture);
- nWP.horizon.X = Convert.ToSingle(result["horizon_r"]);
- nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]);
- nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]);
- nWP.horizon.W = Convert.ToSingle(result["horizon_i"]);
- nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]);
- nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]);
- nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]);
- nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]);
- nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]);
- nWP.hazeDensity = Convert.ToSingle(result["haze_density"]);
- nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]);
- nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]);
- nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]);
- nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]);
- nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]);
- nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]);
- nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]);
- nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]);
- nWP.ambient.X = Convert.ToSingle(result["ambient_r"]);
- nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]);
- nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]);
- nWP.ambient.W = Convert.ToSingle(result["ambient_i"]);
- nWP.eastAngle = Convert.ToSingle(result["east_angle"]);
- nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]);
- nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]);
- nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]);
- nWP.starBrightness = Convert.ToSingle(result["star_brightness"]);
- nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]);
- nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]);
- nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]);
- nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]);
- nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]);
- nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]);
- nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]);
- nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]);
- nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]);
- nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]);
- nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]);
- nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]);
- nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]);
- nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]);
- nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]);
- nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]);
- nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]);
- nWP.valid = true;
+ if(!result.Read())
+ {
+ //No result, so store our default windlight profile and return it
+ nWP.regionID = regionUUID;
+ // StoreRegionWindlightSettings(nWP);
+ return nWP;
+ }
+ else
+ {
+ nWP.regionID = DBGuid.FromDB(result["region_id"]);
+ nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]);
+ nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]);
+ nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]);
+ nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]);
+ nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]);
+ nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]);
+ nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]);
+ nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]);
+ nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]);
+ nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]);
+ nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]);
+ nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]);
+ nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]);
+ nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]);
+ nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]);
+ nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]);
+ nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]);
+ UUID.TryParse(result["normal_map_texture"].ToString(),out nWP.normalMapTexture);
+ nWP.horizon.X = Convert.ToSingle(result["horizon_r"]);
+ nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]);
+ nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]);
+ nWP.horizon.W = Convert.ToSingle(result["horizon_i"]);
+ nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]);
+ nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]);
+ nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]);
+ nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]);
+ nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]);
+ nWP.hazeDensity = Convert.ToSingle(result["haze_density"]);
+ nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]);
+ nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]);
+ nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]);
+ nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]);
+ nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]);
+ nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]);
+ nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]);
+ nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]);
+ nWP.ambient.X = Convert.ToSingle(result["ambient_r"]);
+ nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]);
+ nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]);
+ nWP.ambient.W = Convert.ToSingle(result["ambient_i"]);
+ nWP.eastAngle = Convert.ToSingle(result["east_angle"]);
+ nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]);
+ nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]);
+ nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]);
+ nWP.starBrightness = Convert.ToSingle(result["star_brightness"]);
+ nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]);
+ nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]);
+ nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]);
+ nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]);
+ nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]);
+ nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]);
+ nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]);
+ nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]);
+ nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]);
+ nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]);
+ nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]);
+ nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]);
+ nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]);
+ nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]);
+ nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]);
+ nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]);
+ nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]);
+ nWP.valid = true;
+ }
}
}
+ dbcon.Close();
}
return nWP;
@@ -947,6 +973,7 @@ namespace OpenSim.Data.MySQL
public virtual RegionSettings LoadRegionSettings(UUID regionUUID)
{
RegionSettings rs = null;
+ bool needStore = false;
lock (m_dbLock)
{
@@ -972,13 +999,17 @@ namespace OpenSim.Data.MySQL
rs.RegionUUID = regionUUID;
rs.OnSave += StoreRegionSettings;
- StoreRegionSettings(rs);
+ needStore = true;
}
}
}
+ dbcon.Close();
}
}
+ if(needStore)
+ StoreRegionSettings(rs);
+
LoadSpawnPoints(rs);
return rs;
@@ -992,31 +1023,32 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = dbcon.CreateCommand())
{
- cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, ";
- cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, ";
- cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, ";
- cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, ";
- cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, ";
- cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, ";
- cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, ";
- cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, ";
- cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, ";
- cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, ";
- cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, ";
- cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, ";
- cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, ";
- cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, ";
- cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, ";
- cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, ";
- cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, ";
- cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, ";
- cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, ";
- cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, ";
- cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, ";
- cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, ";
- cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, ";
- cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, ";
- cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)";
+ cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, "
+ + "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, "
+ + "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, "
+ + "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, "
+ + "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, "
+ + "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, "
+ + "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, "
+ + "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, "
+ + "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, "
+ + "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, "
+ + "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, "
+ + "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, "
+ + "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, "
+ + "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, "
+ + "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, "
+ + "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, "
+ + "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, "
+ + "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, "
+ + "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, "
+ + "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, "
+ + "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, "
+ + "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, "
+ + "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, "
+ + "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, "
+ + "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)"
+ ;
cmd.Parameters.AddWithValue("region_id", wl.regionID);
cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X);
@@ -1084,6 +1116,7 @@ namespace OpenSim.Data.MySQL
ExecuteNonQuery(cmd);
}
+ dbcon.Close();
}
}
@@ -1099,6 +1132,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?regionID", regionID.ToString());
ExecuteNonQuery(cmd);
}
+ dbcon.Close();
}
}
@@ -1117,14 +1151,19 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
- IDataReader result = ExecuteReader(cmd);
- if (!result.Read())
+ using(IDataReader result = ExecuteReader(cmd))
{
- return String.Empty;
- }
- else
- {
- return Convert.ToString(result["llsd_settings"]);
+ if(!result.Read())
+ {
+ dbcon.Close();
+ return String.Empty;
+ }
+ else
+ {
+ string ret = Convert.ToString(result["llsd_settings"]);
+ dbcon.Close();
+ return ret;
+ }
}
}
}
@@ -1145,6 +1184,7 @@ namespace OpenSim.Data.MySQL
ExecuteNonQuery(cmd);
}
+ dbcon.Close();
}
}
@@ -1160,6 +1200,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
ExecuteNonQuery(cmd);
}
+ dbcon.Close();
}
}
#endregion
@@ -1212,7 +1253,7 @@ namespace OpenSim.Data.MySQL
FillRegionSettingsCommand(cmd, rs);
ExecuteNonQuery(cmd);
}
-
+ dbcon.Close();
SaveSpawnPoints(rs);
}
}
@@ -1259,6 +1300,7 @@ namespace OpenSim.Data.MySQL
}
}
}
+ dbcon.Close();
}
}
@@ -1452,6 +1494,11 @@ namespace OpenSim.Data.MySQL
prim.VehicleParams = vehicle;
}
+ PhysicsInertiaData pdata = null;
+ if (row["PhysInertia"].ToString() != String.Empty)
+ pdata = PhysicsInertiaData.FromXml2(row["PhysInertia"].ToString());
+ prim.PhysicsInertia = pdata;
+
return prim;
}
@@ -1810,6 +1857,11 @@ namespace OpenSim.Data.MySQL
else
cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]);
+ if (prim.PhysicsInertia != null)
+ cmd.Parameters.AddWithValue("PhysInertia", prim.PhysicsInertia.ToXml2());
+ else
+ cmd.Parameters.AddWithValue("PhysInertia", String.Empty);
+
if (prim.VehicleParams != null)
cmd.Parameters.AddWithValue("Vehicle", prim.VehicleParams.ToXml2());
else
@@ -2113,6 +2165,7 @@ namespace OpenSim.Data.MySQL
ExecuteNonQuery(cmd);
}
}
+ dbcon.Close();
}
}
}
@@ -2142,6 +2195,7 @@ namespace OpenSim.Data.MySQL
}
}
}
+ dbcon.Close();
}
}
@@ -2177,6 +2231,7 @@ namespace OpenSim.Data.MySQL
}
}
}
+ dbcon.Close();
}
}
}
@@ -2211,6 +2266,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.Clear();
}
}
+ dbcon.Close();
}
}
}
@@ -2230,6 +2286,7 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery();
}
+ dbcon.Close();
}
}
@@ -2247,6 +2304,7 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery();
}
+ dbcon.Close();
}
}
@@ -2270,6 +2328,7 @@ namespace OpenSim.Data.MySQL
}
}
}
+ dbcon.Close();
}
return ret;
diff --git a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
index 8af2a3ef29..2669aca4d2 100644
--- a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
@@ -69,6 +69,7 @@ namespace OpenSim.Data.MySQL
Migration m = new Migration(dbcon, Assembly, "UserProfiles");
m.Update();
+ dbcon.Close();
}
}
#endregion Member Functions
@@ -89,7 +90,7 @@ namespace OpenSim.Data.MySQL
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
{
- string query = "SELECT classifieduuid, name FROM classifieds WHERE creatoruuid = ?Id";
+ const string query = "SELECT classifieduuid, name FROM classifieds WHERE creatoruuid = ?Id";
dbcon.Open();
using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
{
@@ -111,8 +112,7 @@ namespace OpenSim.Data.MySQL
}
catch (Exception e)
{
- m_log.ErrorFormat("[PROFILES_DATA]" +
- ": UserAccount exception {0}", e.Message);
+ m_log.ErrorFormat("[PROFILES_DATA] GetClassifiedRecords exception {0}", e.Message);
}
n.Add("classifieduuid", OSD.FromUUID(Id));
n.Add("name", OSD.FromString(Name));
@@ -121,58 +121,58 @@ namespace OpenSim.Data.MySQL
}
}
}
+ dbcon.Close();
}
return data;
}
public bool UpdateClassifiedRecord(UserClassifiedAdd ad, ref string result)
{
- string query = string.Empty;
-
-
- query += "INSERT INTO classifieds (";
- query += "`classifieduuid`,";
- query += "`creatoruuid`,";
- query += "`creationdate`,";
- query += "`expirationdate`,";
- query += "`category`,";
- query += "`name`,";
- query += "`description`,";
- query += "`parceluuid`,";
- query += "`parentestate`,";
- query += "`snapshotuuid`,";
- query += "`simname`,";
- query += "`posglobal`,";
- query += "`parcelname`,";
- query += "`classifiedflags`,";
- query += "`priceforlisting`) ";
- query += "VALUES (";
- query += "?ClassifiedId,";
- query += "?CreatorId,";
- query += "?CreatedDate,";
- query += "?ExpirationDate,";
- query += "?Category,";
- query += "?Name,";
- query += "?Description,";
- query += "?ParcelId,";
- query += "?ParentEstate,";
- query += "?SnapshotId,";
- query += "?SimName,";
- query += "?GlobalPos,";
- query += "?ParcelName,";
- query += "?Flags,";
- query += "?ListingPrice ) ";
- query += "ON DUPLICATE KEY UPDATE ";
- query += "category=?Category, ";
- query += "expirationdate=?ExpirationDate, ";
- query += "name=?Name, ";
- query += "description=?Description, ";
- query += "parentestate=?ParentEstate, ";
- query += "posglobal=?GlobalPos, ";
- query += "parcelname=?ParcelName, ";
- query += "classifiedflags=?Flags, ";
- query += "priceforlisting=?ListingPrice, ";
- query += "snapshotuuid=?SnapshotId";
+ const string query =
+ "INSERT INTO classifieds ("
+ + "`classifieduuid`,"
+ + "`creatoruuid`,"
+ + "`creationdate`,"
+ + "`expirationdate`,"
+ + "`category`,"
+ + "`name`,"
+ + "`description`,"
+ + "`parceluuid`,"
+ + "`parentestate`,"
+ + "`snapshotuuid`,"
+ + "`simname`,"
+ + "`posglobal`,"
+ + "`parcelname`,"
+ + "`classifiedflags`,"
+ + "`priceforlisting`) "
+ + "VALUES ("
+ + "?ClassifiedId,"
+ + "?CreatorId,"
+ + "?CreatedDate,"
+ + "?ExpirationDate,"
+ + "?Category,"
+ + "?Name,"
+ + "?Description,"
+ + "?ParcelId,"
+ + "?ParentEstate,"
+ + "?SnapshotId,"
+ + "?SimName,"
+ + "?GlobalPos,"
+ + "?ParcelName,"
+ + "?Flags,"
+ + "?ListingPrice ) "
+ + "ON DUPLICATE KEY UPDATE "
+ + "category=?Category, "
+ + "expirationdate=?ExpirationDate, "
+ + "name=?Name, "
+ + "description=?Description, "
+ + "parentestate=?ParentEstate, "
+ + "posglobal=?GlobalPos, "
+ + "parcelname=?ParcelName, "
+ + "classifiedflags=?Flags, "
+ + "priceforlisting=?ListingPrice, "
+ + "snapshotuuid=?SnapshotId"
+ ;
if(string.IsNullOrEmpty(ad.ParcelName))
ad.ParcelName = "Unknown";
@@ -228,12 +228,12 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery();
}
+ dbcon.Close();
}
}
catch (Exception e)
{
- m_log.ErrorFormat("[PROFILES_DATA]" +
- ": ClassifiedesUpdate exception {0}", e.Message);
+ m_log.ErrorFormat("[PROFILES_DATA]: UpdateClassifiedRecord exception {0}", e.Message);
result = e.Message;
return false;
}
@@ -242,10 +242,7 @@ namespace OpenSim.Data.MySQL
public bool DeleteClassifiedRecord(UUID recordId)
{
- string query = string.Empty;
-
- query += "DELETE FROM classifieds WHERE ";
- query += "classifieduuid = ?recordId";
+ const string query = "DELETE FROM classifieds WHERE classifieduuid = ?recordId";
try
{
@@ -258,12 +255,12 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?recordId", recordId.ToString());
cmd.ExecuteNonQuery();
}
+ dbcon.Close();
}
}
catch (Exception e)
{
- m_log.ErrorFormat("[PROFILES_DATA]" +
- ": DeleteClassifiedRecord exception {0}", e.Message);
+ m_log.ErrorFormat("[PROFILES_DATA]: DeleteClassifiedRecord exception {0}", e.Message);
return false;
}
return true;
@@ -271,10 +268,8 @@ namespace OpenSim.Data.MySQL
public bool GetClassifiedInfo(ref UserClassifiedAdd ad, ref string result)
{
- string query = string.Empty;
- query += "SELECT * FROM classifieds WHERE ";
- query += "classifieduuid = ?AdId";
+ const string query = "SELECT * FROM classifieds WHERE classifieduuid = ?AdId";
try
{
@@ -312,8 +307,7 @@ namespace OpenSim.Data.MySQL
}
catch (Exception e)
{
- m_log.ErrorFormat("[PROFILES_DATA]" +
- ": GetPickInfo exception {0}", e.Message);
+ m_log.ErrorFormat("[PROFILES_DATA]: GetClassifiedInfo exception {0}", e.Message);
}
return true;
}
@@ -322,10 +316,8 @@ namespace OpenSim.Data.MySQL
#region Picks Queries
public OSDArray GetAvatarPicks(UUID avatarId)
{
- string query = string.Empty;
+ const string query = "SELECT `pickuuid`,`name` FROM userpicks WHERE creatoruuid = ?Id";
- query += "SELECT `pickuuid`,`name` FROM userpicks WHERE ";
- query += "creatoruuid = ?Id";
OSDArray data = new OSDArray();
try
@@ -352,24 +344,20 @@ namespace OpenSim.Data.MySQL
}
}
}
+ dbcon.Close();
}
}
catch (Exception e)
{
- m_log.ErrorFormat("[PROFILES_DATA]" +
- ": GetAvatarPicks exception {0}", e.Message);
+ m_log.ErrorFormat("[PROFILES_DATA]: GetAvatarPicks exception {0}", e.Message);
}
return data;
}
public UserProfilePick GetPickInfo(UUID avatarId, UUID pickId)
{
- string query = string.Empty;
UserProfilePick pick = new UserProfilePick();
-
- query += "SELECT * FROM userpicks WHERE ";
- query += "creatoruuid = ?CreatorId AND ";
- query += "pickuuid = ?PickId";
+ const string query = "SELECT * FROM userpicks WHERE creatoruuid = ?CreatorId AND pickuuid = ?PickId";
try
{
@@ -414,41 +402,40 @@ namespace OpenSim.Data.MySQL
}
catch (Exception e)
{
- m_log.ErrorFormat("[PROFILES_DATA]" +
- ": GetPickInfo exception {0}", e.Message);
+ m_log.ErrorFormat("[PROFILES_DATA]: GetPickInfo exception {0}", e.Message);
}
return pick;
}
public bool UpdatePicksRecord(UserProfilePick pick)
{
- string query = string.Empty;
-
- query += "INSERT INTO userpicks VALUES (";
- query += "?PickId,";
- query += "?CreatorId,";
- query += "?TopPick,";
- query += "?ParcelId,";
- query += "?Name,";
- query += "?Desc,";
- query += "?SnapshotId,";
- query += "?User,";
- query += "?Original,";
- query += "?SimName,";
- query += "?GlobalPos,";
- query += "?SortOrder,";
- query += "?Enabled,";
- query += "?Gatekeeper)";
- query += "ON DUPLICATE KEY UPDATE ";
- query += "parceluuid=?ParcelId,";
- query += "name=?Name,";
- query += "description=?Desc,";
- query += "user=?User,";
- query += "simname=?SimName,";
- query += "snapshotuuid=?SnapshotId,";
- query += "pickuuid=?PickId,";
- query += "posglobal=?GlobalPos,";
- query += "gatekeeper=?Gatekeeper";
+ const string query =
+ "INSERT INTO userpicks VALUES ("
+ + "?PickId,"
+ + "?CreatorId,"
+ + "?TopPick,"
+ + "?ParcelId,"
+ + "?Name,"
+ + "?Desc,"
+ + "?SnapshotId,"
+ + "?User,"
+ + "?Original,"
+ + "?SimName,"
+ + "?GlobalPos,"
+ + "?SortOrder,"
+ + "?Enabled,"
+ + "?Gatekeeper)"
+ + "ON DUPLICATE KEY UPDATE "
+ + "parceluuid=?ParcelId,"
+ + "name=?Name,"
+ + "description=?Desc,"
+ + "user=?User,"
+ + "simname=?SimName,"
+ + "snapshotuuid=?SnapshotId,"
+ + "pickuuid=?PickId,"
+ + "posglobal=?GlobalPos,"
+ + "gatekeeper=?Gatekeeper"
+ ;
try
{
@@ -474,12 +461,12 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery();
}
+ dbcon.Close();
}
}
catch (Exception e)
{
- m_log.ErrorFormat("[PROFILES_DATA]" +
- ": UpdateAvatarNotes exception {0}", e.Message);
+ m_log.ErrorFormat("[PROFILES_DATA]: UpdatePicksRecord exception {0}", e.Message);
return false;
}
return true;
@@ -487,10 +474,7 @@ namespace OpenSim.Data.MySQL
public bool DeletePicksRecord(UUID pickId)
{
- string query = string.Empty;
-
- query += "DELETE FROM userpicks WHERE ";
- query += "pickuuid = ?PickId";
+ string query = "DELETE FROM userpicks WHERE pickuuid = ?PickId";
try
{
@@ -504,12 +488,12 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery();
}
+ dbcon.Close();
}
}
catch (Exception e)
{
- m_log.ErrorFormat("[PROFILES_DATA]" +
- ": DeleteUserPickRecord exception {0}", e.Message);
+ m_log.ErrorFormat("[PROFILES_DATA]: DeletePicksRecord exception {0}", e.Message);
return false;
}
return true;
@@ -519,11 +503,7 @@ namespace OpenSim.Data.MySQL
#region Avatar Notes Queries
public bool GetAvatarNotes(ref UserProfileNotes notes)
{ // WIP
- string query = string.Empty;
-
- query += "SELECT `notes` FROM usernotes WHERE ";
- query += "useruuid = ?Id AND ";
- query += "targetuuid = ?TargetId";
+ const string query = "SELECT `notes` FROM usernotes WHERE useruuid = ?Id AND targetuuid = ?TargetId";
try
{
@@ -548,38 +528,37 @@ namespace OpenSim.Data.MySQL
}
}
}
+ dbcon.Close();
}
}
catch (Exception e)
{
- m_log.ErrorFormat("[PROFILES_DATA]" +
- ": GetAvatarNotes exception {0}", e.Message);
+ m_log.ErrorFormat("[PROFILES_DATA]: GetAvatarNotes exception {0}", e.Message);
}
return true;
}
public bool UpdateAvatarNotes(ref UserProfileNotes note, ref string result)
{
- string query = string.Empty;
+ string query;
bool remove;
if(string.IsNullOrEmpty(note.Notes))
{
remove = true;
- query += "DELETE FROM usernotes WHERE ";
- query += "useruuid=?UserId AND ";
- query += "targetuuid=?TargetId";
+ query = "DELETE FROM usernotes WHERE useruuid=?UserId AND targetuuid=?TargetId";
}
else
{
remove = false;
- query += "INSERT INTO usernotes VALUES ( ";
- query += "?UserId,";
- query += "?TargetId,";
- query += "?Notes )";
- query += "ON DUPLICATE KEY ";
- query += "UPDATE ";
- query += "notes=?Notes";
+ query = "INSERT INTO usernotes VALUES ("
+ + "?UserId,"
+ + "?TargetId,"
+ + "?Notes )"
+ + "ON DUPLICATE KEY "
+ + "UPDATE "
+ + "notes=?Notes"
+ ;
}
try
@@ -596,12 +575,12 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery();
}
+ dbcon.Close();
}
}
catch (Exception e)
{
- m_log.ErrorFormat("[PROFILES_DATA]" +
- ": UpdateAvatarNotes exception {0}", e.Message);
+ m_log.ErrorFormat("[PROFILES_DATA]: UpdateAvatarNotes exception {0}", e.Message);
return false;
}
return true;
@@ -612,10 +591,7 @@ namespace OpenSim.Data.MySQL
#region Avatar Properties
public bool GetAvatarProperties(ref UserProfileProperties props, ref string result)
{
- string query = string.Empty;
-
- query += "SELECT * FROM userprofile WHERE ";
- query += "useruuid = ?Id";
+ string query = "SELECT * FROM userprofile WHERE useruuid = ?Id";
try
{
@@ -664,35 +640,36 @@ namespace OpenSim.Data.MySQL
props.PublishProfile = false;
props.PublishMature = false;
- query = "INSERT INTO userprofile (";
- query += "useruuid, ";
- query += "profilePartner, ";
- query += "profileAllowPublish, ";
- query += "profileMaturePublish, ";
- query += "profileURL, ";
- query += "profileWantToMask, ";
- query += "profileWantToText, ";
- query += "profileSkillsMask, ";
- query += "profileSkillsText, ";
- query += "profileLanguages, ";
- query += "profileImage, ";
- query += "profileAboutText, ";
- query += "profileFirstImage, ";
- query += "profileFirstText) VALUES (";
- query += "?userId, ";
- query += "?profilePartner, ";
- query += "?profileAllowPublish, ";
- query += "?profileMaturePublish, ";
- query += "?profileURL, ";
- query += "?profileWantToMask, ";
- query += "?profileWantToText, ";
- query += "?profileSkillsMask, ";
- query += "?profileSkillsText, ";
- query += "?profileLanguages, ";
- query += "?profileImage, ";
- query += "?profileAboutText, ";
- query += "?profileFirstImage, ";
- query += "?profileFirstText)";
+ query = "INSERT INTO userprofile ("
+ + "useruuid, "
+ + "profilePartner, "
+ + "profileAllowPublish, "
+ + "profileMaturePublish, "
+ + "profileURL, "
+ + "profileWantToMask, "
+ + "profileWantToText, "
+ + "profileSkillsMask, "
+ + "profileSkillsText, "
+ + "profileLanguages, "
+ + "profileImage, "
+ + "profileAboutText, "
+ + "profileFirstImage, "
+ + "profileFirstText) VALUES ("
+ + "?userId, "
+ + "?profilePartner, "
+ + "?profileAllowPublish, "
+ + "?profileMaturePublish, "
+ + "?profileURL, "
+ + "?profileWantToMask, "
+ + "?profileWantToText, "
+ + "?profileSkillsMask, "
+ + "?profileSkillsText, "
+ + "?profileLanguages, "
+ + "?profileImage, "
+ + "?profileAboutText, "
+ + "?profileFirstImage, "
+ + "?profileFirstText)"
+ ;
dbcon.Close();
dbcon.Open();
@@ -719,12 +696,12 @@ namespace OpenSim.Data.MySQL
}
}
}
+ dbcon.Close();
}
}
catch (Exception e)
{
- m_log.ErrorFormat("[PROFILES_DATA]" +
- ": Requst properties exception {0}", e.Message);
+ m_log.ErrorFormat("[PROFILES_DATA]: GetAvatarProperties exception {0}", e.Message);
result = e.Message;
return false;
}
@@ -733,15 +710,10 @@ namespace OpenSim.Data.MySQL
public bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result)
{
- string query = string.Empty;
-
- query += "UPDATE userprofile SET ";
- query += "profileURL=?profileURL, ";
- query += "profileImage=?image, ";
- query += "profileAboutText=?abouttext,";
- query += "profileFirstImage=?firstlifeimage,";
- query += "profileFirstText=?firstlifetext ";
- query += "WHERE useruuid=?uuid";
+ const string query = "UPDATE userprofile SET profileURL=?profileURL,"
+ + "profileImage=?image, profileAboutText=?abouttext,"
+ + "profileFirstImage=?firstlifeimage, profileFirstText=?firstlifetext "
+ + "WHERE useruuid=?uuid";
try
{
@@ -759,12 +731,12 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery();
}
+ dbcon.Close();
}
}
catch (Exception e)
{
- m_log.ErrorFormat("[PROFILES_DATA]" +
- ": AgentPropertiesUpdate exception {0}", e.Message);
+ m_log.ErrorFormat("[PROFILES_DATA]: UpdateAvatarProperties exception {0}", e.Message);
return false;
}
@@ -775,15 +747,13 @@ namespace OpenSim.Data.MySQL
#region Avatar Interests
public bool UpdateAvatarInterests(UserProfileProperties up, ref string result)
{
- string query = string.Empty;
-
- query += "UPDATE userprofile SET ";
- query += "profileWantToMask=?WantMask, ";
- query += "profileWantToText=?WantText,";
- query += "profileSkillsMask=?SkillsMask,";
- query += "profileSkillsText=?SkillsText, ";
- query += "profileLanguages=?Languages ";
- query += "WHERE useruuid=?uuid";
+ const string query = "UPDATE userprofile SET "
+ + "profileWantToMask=?WantMask, "
+ + "profileWantToText=?WantText,"
+ + "profileSkillsMask=?SkillsMask,"
+ + "profileSkillsText=?SkillsText, "
+ + "profileLanguages=?Languages "
+ + "WHERE useruuid=?uuid";
try
{
@@ -805,8 +775,7 @@ namespace OpenSim.Data.MySQL
}
catch (Exception e)
{
- m_log.ErrorFormat("[PROFILES_DATA]" +
- ": AgentInterestsUpdate exception {0}", e.Message);
+ m_log.ErrorFormat("[PROFILES_DATA]: UpdateAvatarInterests exception {0}", e.Message);
result = e.Message;
return false;
}
@@ -817,18 +786,17 @@ namespace OpenSim.Data.MySQL
public OSDArray GetUserImageAssets(UUID avatarId)
{
OSDArray data = new OSDArray();
- string query = "SELECT `snapshotuuid` FROM {0} WHERE `creatoruuid` = ?Id";
+ const string queryA = "SELECT `snapshotuuid` FROM {0} WHERE `creatoruuid` = ?Id";
// Get classified image assets
-
try
{
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
{
dbcon.Open();
- using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`classifieds`"), dbcon))
+ using (MySqlCommand cmd = new MySqlCommand(string.Format (queryA,"`classifieds`"), dbcon))
{
cmd.Parameters.AddWithValue("?Id", avatarId.ToString());
@@ -847,7 +815,7 @@ namespace OpenSim.Data.MySQL
dbcon.Close();
dbcon.Open();
- using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`userpicks`"), dbcon))
+ using (MySqlCommand cmd = new MySqlCommand(string.Format (queryA,"`userpicks`"), dbcon))
{
cmd.Parameters.AddWithValue("?Id", avatarId.ToString());
@@ -866,9 +834,9 @@ namespace OpenSim.Data.MySQL
dbcon.Close();
dbcon.Open();
- query = "SELECT `profileImage`, `profileFirstImage` FROM `userprofile` WHERE `useruuid` = ?Id";
+ const string queryB = "SELECT `profileImage`, `profileFirstImage` FROM `userprofile` WHERE `useruuid` = ?Id";
- using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`userpicks`"), dbcon))
+ using (MySqlCommand cmd = new MySqlCommand(queryB, dbcon))
{
cmd.Parameters.AddWithValue("?Id", avatarId.ToString());
@@ -884,12 +852,12 @@ namespace OpenSim.Data.MySQL
}
}
}
+ dbcon.Close();
}
}
catch (Exception e)
{
- m_log.ErrorFormat("[PROFILES_DATA]" +
- ": GetAvatarNotes exception {0}", e.Message);
+ m_log.ErrorFormat("[PROFILES_DATA]: GetUserImageAssets exception {0}", e.Message);
}
return data;
}
@@ -897,11 +865,7 @@ namespace OpenSim.Data.MySQL
#region User Preferences
public bool GetUserPreferences(ref UserPreferences pref, ref string result)
{
- string query = string.Empty;
-
- query += "SELECT imviaemail,visible,email FROM ";
- query += "usersettings WHERE ";
- query += "useruuid = ?Id";
+ const string query = "SELECT imviaemail,visible,email FROM usersettings WHERE useruuid = ?Id";
try
{
@@ -925,10 +889,9 @@ namespace OpenSim.Data.MySQL
dbcon.Close();
dbcon.Open();
- query = "INSERT INTO usersettings VALUES ";
- query += "(?uuid,'false','false', ?Email)";
+ const string queryB = "INSERT INTO usersettings VALUES (?uuid,'false','false', ?Email)";
- using (MySqlCommand put = new MySqlCommand(query, dbcon))
+ using (MySqlCommand put = new MySqlCommand(queryB, dbcon))
{
put.Parameters.AddWithValue("?Email", pref.EMail);
@@ -939,12 +902,12 @@ namespace OpenSim.Data.MySQL
}
}
}
+ dbcon.Close();
}
}
catch (Exception e)
{
- m_log.ErrorFormat("[PROFILES_DATA]" +
- ": Get preferences exception {0}", e.Message);
+ m_log.ErrorFormat("[PROFILES_DATA]: GetUserPreferences exception {0}", e.Message);
result = e.Message;
return false;
}
@@ -953,13 +916,9 @@ namespace OpenSim.Data.MySQL
public bool UpdateUserPreferences(ref UserPreferences pref, ref string result)
{
- string query = string.Empty;
-
- query += "UPDATE usersettings SET ";
- query += "imviaemail=?ImViaEmail, ";
- query += "visible=?Visible, ";
- query += "email=?EMail ";
- query += "WHERE useruuid=?uuid";
+ const string query = "UPDATE usersettings SET imviaemail=?ImViaEmail,"
+ + "visible=?Visible, email=?EMail "
+ + "WHERE useruuid=?uuid";
try
{
@@ -975,12 +934,12 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery();
}
+ dbcon.Close();
}
}
catch (Exception e)
{
- m_log.ErrorFormat("[PROFILES_DATA]" +
- ": UserPreferencesUpdate exception {0} {1}", e.Message, e.InnerException);
+ m_log.ErrorFormat("[PROFILES_DATA]: UpdateUserPreferences exception {0} {1}", e.Message, e.InnerException);
result = e.Message;
return false;
}
@@ -991,11 +950,7 @@ namespace OpenSim.Data.MySQL
#region Integration
public bool GetUserAppData(ref UserAppData props, ref string result)
{
- string query = string.Empty;
-
- query += "SELECT * FROM `userdata` WHERE ";
- query += "UserId = ?Id AND ";
- query += "TagId = ?TagId";
+ const string query = "SELECT * FROM `userdata` WHERE UserId = ?Id AND TagId = ?TagId";
try
{
@@ -1017,13 +972,8 @@ namespace OpenSim.Data.MySQL
}
else
{
- query += "INSERT INTO userdata VALUES ( ";
- query += "?UserId,";
- query += "?TagId,";
- query += "?DataKey,";
- query += "?DataVal) ";
-
- using (MySqlCommand put = new MySqlCommand(query, dbcon))
+ const string queryB = "INSERT INTO userdata VALUES (?UserId, ?TagId, ?DataKey, ?DataVal)";
+ using (MySqlCommand put = new MySqlCommand(queryB, dbcon))
{
put.Parameters.AddWithValue("?UserId", props.UserId.ToString());
put.Parameters.AddWithValue("?TagId", props.TagId.ToString());
@@ -1035,12 +985,12 @@ namespace OpenSim.Data.MySQL
}
}
}
+ dbcon.Close();
}
}
catch (Exception e)
{
- m_log.ErrorFormat("[PROFILES_DATA]" +
- ": Requst application data exception {0}", e.Message);
+ m_log.ErrorFormat("[PROFILES_DATA]: GetUserAppData exception {0}", e.Message);
result = e.Message;
return false;
}
@@ -1049,14 +999,7 @@ namespace OpenSim.Data.MySQL
public bool SetUserAppData(UserAppData props, ref string result)
{
- string query = string.Empty;
-
- query += "UPDATE userdata SET ";
- query += "TagId = ?TagId, ";
- query += "DataKey = ?DataKey, ";
- query += "DataVal = ?DataVal WHERE ";
- query += "UserId = ?UserId AND ";
- query += "TagId = ?TagId";
+ const string query = "UPDATE userdata SET TagId = ?TagId, DataKey = ?DataKey, DataVal = ?DataVal WHERE UserId = ?UserId AND TagId = ?TagId";
try
{
@@ -1072,12 +1015,12 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery();
}
+ dbcon.Close();
}
}
catch (Exception e)
{
- m_log.ErrorFormat("[PROFILES_DATA]" +
- ": SetUserData exception {0}", e.Message);
+ m_log.ErrorFormat("[PROFILES_DATA]: SetUserAppData exception {0}", e.Message);
return false;
}
return true;
diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs
index 2c6acdef32..9f9c9cf4fa 100644
--- a/OpenSim/Data/MySQL/MySQLXAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs
@@ -97,6 +97,7 @@ namespace OpenSim.Data.MySQL
dbcon.Open();
Migration m = new Migration(dbcon, Assembly, "XAssetStore");
m.Update();
+ dbcon.Close();
}
}
@@ -130,6 +131,7 @@ namespace OpenSim.Data.MySQL
// m_log.DebugFormat("[MYSQL XASSET DATA]: Looking for asset {0}", assetID);
AssetBase asset = null;
+ int accessTime = 0;
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
@@ -140,7 +142,6 @@ namespace OpenSim.Data.MySQL
dbcon))
{
cmd.Parameters.AddWithValue("?ID", assetID.ToString());
-
try
{
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
@@ -159,23 +160,7 @@ namespace OpenSim.Data.MySQL
asset.Temporary = Convert.ToBoolean(dbReader["Temporary"]);
asset.Flags = (AssetFlags)Convert.ToInt32(dbReader["AssetFlags"]);
-
- if (m_enableCompression)
- {
- using (GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), CompressionMode.Decompress))
- {
- MemoryStream outputStream = new MemoryStream();
- WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue);
-// int compressedLength = asset.Data.Length;
- asset.Data = outputStream.ToArray();
-
-// m_log.DebugFormat(
-// "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}",
-// asset.ID, asset.Name, asset.Data.Length, compressedLength);
- }
- }
-
- UpdateAccessTime(asset.Metadata, (int)dbReader["AccessTime"]);
+ accessTime = (int)dbReader["AccessTime"];
}
}
}
@@ -184,9 +169,38 @@ namespace OpenSim.Data.MySQL
m_log.Error(string.Format("[MYSQL XASSET DATA]: Failure fetching asset {0}", assetID), e);
}
}
+ dbcon.Close();
}
- return asset;
+ if(asset == null)
+ return asset;
+
+ if(accessTime > 0)
+ {
+ try
+ {
+ UpdateAccessTime(asset.Metadata, accessTime);
+ }
+ catch { }
+ }
+
+ if (m_enableCompression && asset.Data != null)
+ {
+ using(MemoryStream ms = new MemoryStream(asset.Data))
+ using(GZipStream decompressionStream = new GZipStream(ms, CompressionMode.Decompress))
+ {
+ using(MemoryStream outputStream = new MemoryStream())
+ {
+ decompressionStream.CopyTo(outputStream, int.MaxValue);
+// int compressedLength = asset.Data.Length;
+ asset.Data = outputStream.ToArray();
+ }
+// m_log.DebugFormat(
+// "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}",
+// asset.ID, asset.Name, asset.Data.Length, compressedLength);
+ }
+ }
+ return asset;
}
///
@@ -303,6 +317,7 @@ namespace OpenSim.Data.MySQL
transaction.Commit();
}
+ dbcon.Close();
}
}
@@ -344,6 +359,7 @@ namespace OpenSim.Data.MySQL
"[XASSET MYSQL DB]: Failure updating access_time for asset {0} with name {1}",
assetMetadata.ID, assetMetadata.Name);
}
+ dbcon.Close();
}
}
@@ -474,6 +490,7 @@ namespace OpenSim.Data.MySQL
m_log.Error("[XASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString());
}
}
+ dbcon.Close();
}
return retList;
@@ -492,9 +509,9 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?ID", id);
cmd.ExecuteNonQuery();
}
-
// TODO: How do we deal with data from deleted assets? Probably not easily reapable unless we
// keep a reference count (?)
+ dbcon.Close();
}
return true;
diff --git a/OpenSim/Data/MySQL/MySQLXInventoryData.cs b/OpenSim/Data/MySQL/MySQLXInventoryData.cs
index 4e41fec9cd..501999425d 100644
--- a/OpenSim/Data/MySQL/MySQLXInventoryData.cs
+++ b/OpenSim/Data/MySQL/MySQLXInventoryData.cs
@@ -328,7 +328,6 @@ namespace OpenSim.Data.MySQL
{
return false;
}
- cmd.Dispose();
}
dbcon.Close();
diff --git a/OpenSim/Data/MySQL/Resources/MuteListStore.migrations b/OpenSim/Data/MySQL/Resources/MuteListStore.migrations
new file mode 100644
index 0000000000..5bde63edd8
--- /dev/null
+++ b/OpenSim/Data/MySQL/Resources/MuteListStore.migrations
@@ -0,0 +1,16 @@
+:VERSION 1
+
+BEGIN;
+
+CREATE TABLE `MuteList` (
+ `AgentID` char(36) NOT NULL,
+ `MuteID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
+ `MuteName` varchar(64) NOT NULL DEFAULT '',
+ `MuteType` int(11) NOT NULL DEFAULT '1',
+ `MuteFlags` int(11) NOT NULL DEFAULT '0',
+ `Stamp` int(11) NOT NULL,
+ UNIQUE KEY `AgentID_2` (`AgentID`,`MuteID`,`MuteName`),
+ KEY `AgentID` (`AgentID`)
+);
+
+COMMIT;
diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
index c63cc95d22..0577392184 100644
--- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations
+++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
@@ -461,3 +461,9 @@ BEGIN;
ALTER TABLE `prims` ADD COLUMN `RezzerID` char(36) DEFAULT NULL;
COMMIT;
+
+:VERSION 57 #----- Add physics inertia data
+
+BEGIN;
+ALTER TABLE `prims` ADD COLUMN `PhysInertia` TEXT default NULL;
+COMMIT;
diff --git a/OpenSim/Data/MySQL/Resources/os_groups_Store.migrations b/OpenSim/Data/MySQL/Resources/os_groups_Store.migrations
index 1a499000fb..6ec89144b5 100644
--- a/OpenSim/Data/MySQL/Resources/os_groups_Store.migrations
+++ b/OpenSim/Data/MySQL/Resources/os_groups_Store.migrations
@@ -18,7 +18,7 @@ CREATE TABLE `os_groups_groups` (
PRIMARY KEY (`GroupID`),
UNIQUE KEY `Name` (`Name`),
FULLTEXT KEY `Name_2` (`Name`)
-) ENGINE=InnoDB;
+) ENGINE=MyISAM;
CREATE TABLE `os_groups_membership` (
diff --git a/OpenSim/Data/PGSQL/PGSQLFSAssetData.cs b/OpenSim/Data/PGSQL/PGSQLFSAssetData.cs
new file mode 100644
index 0000000000..59b857c61f
--- /dev/null
+++ b/OpenSim/Data/PGSQL/PGSQLFSAssetData.cs
@@ -0,0 +1,316 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Reflection;
+using System.Collections.Generic;
+using System.Data;
+using OpenSim.Framework;
+using OpenSim.Framework.Console;
+using log4net;
+using OpenMetaverse;
+using Npgsql;
+using NpgsqlTypes;
+
+namespace OpenSim.Data.PGSQL
+{
+ public class PGSQLFSAssetData : IFSAssetDataPlugin
+ {
+ private const string _migrationStore = "FSAssetStore";
+ private static string m_Table = "fsassets";
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+ private long m_ticksToEpoch;
+
+ private PGSQLManager m_database;
+ private string m_connectionString;
+
+ public PGSQLFSAssetData()
+ {
+ }
+
+ public void Initialise(string connect, string realm, int UpdateAccessTime)
+ {
+ DaysBetweenAccessTimeUpdates = UpdateAccessTime;
+
+ m_ticksToEpoch = new System.DateTime(1970, 1, 1).Ticks;
+
+ m_connectionString = connect;
+ m_database = new PGSQLManager(m_connectionString);
+
+ //New migration to check for DB changes
+ m_database.CheckMigration(_migrationStore);
+ }
+
+ public void Initialise()
+ {
+ throw new NotImplementedException();
+ }
+
+ ///
+ /// Number of days that must pass before we update the access time on an asset when it has been fetched
+ /// Config option to change this is "DaysBetweenAccessTimeUpdates"
+ ///
+ private int DaysBetweenAccessTimeUpdates = 0;
+
+ protected virtual Assembly Assembly
+ {
+ get { return GetType().Assembly; }
+ }
+
+ #region IPlugin Members
+
+ public string Version { get { return "1.0.0.0"; } }
+
+ public void Dispose() { }
+
+ public string Name
+ {
+ get { return "PGSQL FSAsset storage engine"; }
+ }
+
+ #endregion
+
+ #region IFSAssetDataPlugin Members
+
+ public AssetMetadata Get(string id, out string hash)
+ {
+ hash = String.Empty;
+ AssetMetadata meta = null;
+ UUID uuid = new UUID(id);
+
+ string query = String.Format("select \"id\", \"type\", \"hash\", \"create_time\", \"access_time\", \"asset_flags\" from {0} where \"id\" = :id", m_Table);
+ using (NpgsqlConnection dbcon = new NpgsqlConnection(m_connectionString))
+ using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
+ {
+ dbcon.Open();
+ cmd.Parameters.Add(m_database.CreateParameter("id", uuid));
+ using (NpgsqlDataReader reader = cmd.ExecuteReader(CommandBehavior.Default))
+ {
+ if (reader.Read())
+ {
+ meta = new AssetMetadata();
+ hash = reader["hash"].ToString();
+ meta.ID = id;
+ meta.FullID = uuid;
+ meta.Name = String.Empty;
+ meta.Description = String.Empty;
+ meta.Type = (sbyte)Convert.ToInt32(reader["type"]);
+ meta.ContentType = SLUtil.SLAssetTypeToContentType(meta.Type);
+ meta.CreationDate = Util.ToDateTime(Convert.ToInt32(reader["create_time"]));
+ meta.Flags = (AssetFlags)Convert.ToInt32(reader["asset_flags"]);
+ int atime = Convert.ToInt32(reader["access_time"]);
+ UpdateAccessTime(atime, uuid);
+ }
+ }
+ }
+
+ return meta;
+ }
+
+ private void UpdateAccessTime(int AccessTime, UUID id)
+ {
+ // Reduce DB work by only updating access time if asset hasn't recently been accessed
+ // 0 By Default, Config option is "DaysBetweenAccessTimeUpdates"
+ if (DaysBetweenAccessTimeUpdates > 0 && (DateTime.UtcNow - Utils.UnixTimeToDateTime(AccessTime)).TotalDays < DaysBetweenAccessTimeUpdates)
+ return;
+
+ string query = String.Format("UPDATE {0} SET \"access_time\" = :access_time WHERE \"id\" = :id", m_Table);
+ using (NpgsqlConnection dbcon = new NpgsqlConnection(m_connectionString))
+ using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
+ {
+ dbcon.Open();
+ int now = (int)((System.DateTime.Now.Ticks - m_ticksToEpoch) / 10000000);
+ cmd.Parameters.Add(m_database.CreateParameter("id", id));
+ cmd.Parameters.Add(m_database.CreateParameter("access_time", now));
+ cmd.ExecuteNonQuery();
+ }
+ }
+
+ public bool Store(AssetMetadata meta, string hash)
+ {
+ try
+ {
+ bool found = false;
+ string oldhash;
+ AssetMetadata existingAsset = Get(meta.ID, out oldhash);
+
+ string query = String.Format("UPDATE {0} SET \"access_time\" = :access_time WHERE \"id\" = :id", m_Table);
+ if (existingAsset == null)
+ {
+ query = String.Format("insert into {0} (\"id\", \"type\", \"hash\", \"asset_flags\", \"create_time\", \"access_time\") values ( :id, :type, :hash, :asset_flags, :create_time, :access_time)", m_Table);
+ found = true;
+ }
+
+ using (NpgsqlConnection dbcon = new NpgsqlConnection(m_connectionString))
+ using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
+ {
+ dbcon.Open();
+ int now = (int)((System.DateTime.Now.Ticks - m_ticksToEpoch) / 10000000);
+ cmd.Parameters.Add(m_database.CreateParameter("id", meta.FullID));
+ cmd.Parameters.Add(m_database.CreateParameter("type", meta.Type));
+ cmd.Parameters.Add(m_database.CreateParameter("hash", hash));
+ cmd.Parameters.Add(m_database.CreateParameter("asset_flags", Convert.ToInt32(meta.Flags)));
+ cmd.Parameters.Add(m_database.CreateParameter("create_time", now));
+ cmd.Parameters.Add(m_database.CreateParameter("access_time", now));
+ cmd.ExecuteNonQuery();
+ }
+ return found;
+ }
+ catch(Exception e)
+ {
+ m_log.Error("[PGSQL FSASSETS] Failed to store asset with ID " + meta.ID);
+ m_log.Error(e.ToString());
+ return false;
+ }
+ }
+
+ ///
+ /// Check if the assets exist in the database.
+ ///
+ /// The asset UUID's
+ /// For each asset: true if it exists, false otherwise
+ public bool[] AssetsExist(UUID[] uuids)
+ {
+ if (uuids.Length == 0)
+ return new bool[0];
+
+ HashSet exists = new HashSet();
+
+ string ids = "'" + string.Join("','", uuids) + "'";
+ string query = string.Format("select \"id\" from {1} where id in ({0})", ids, m_Table);
+ using (NpgsqlConnection dbcon = new NpgsqlConnection(m_connectionString))
+ using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
+ {
+ dbcon.Open();
+ using (NpgsqlDataReader reader = cmd.ExecuteReader(CommandBehavior.Default))
+ {
+ while (reader.Read())
+ {
+ UUID id = DBGuid.FromDB(reader["id"]);;
+ exists.Add(id);
+ }
+ }
+ }
+
+ bool[] results = new bool[uuids.Length];
+ for (int i = 0; i < uuids.Length; i++)
+ results[i] = exists.Contains(uuids[i]);
+ return results;
+ }
+
+ public int Count()
+ {
+ int count = 0;
+ string query = String.Format("select count(*) as count from {0}", m_Table);
+ using (NpgsqlConnection dbcon = new NpgsqlConnection(m_connectionString))
+ using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
+ {
+ dbcon.Open();
+ IDataReader reader = cmd.ExecuteReader();
+ reader.Read();
+ count = Convert.ToInt32(reader["count"]);
+ reader.Close();
+ }
+
+ return count;
+ }
+
+ public bool Delete(string id)
+ {
+ string query = String.Format("delete from {0} where \"id\" = :id", m_Table);
+ using (NpgsqlConnection dbcon = new NpgsqlConnection(m_connectionString))
+ using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
+ {
+ dbcon.Open();
+ cmd.Parameters.Add(m_database.CreateParameter("id", new UUID(id)));
+ cmd.ExecuteNonQuery();
+ }
+
+ return true;
+ }
+
+ public void Import(string conn, string table, int start, int count, bool force, FSStoreDelegate store)
+ {
+ int imported = 0;
+ string limit = String.Empty;
+ if(count != -1)
+ {
+ limit = String.Format(" limit {0} offset {1}", start, count);
+ }
+ string query = String.Format("select * from {0}{1}", table, limit);
+ try
+ {
+ using (NpgsqlConnection remote = new NpgsqlConnection(conn))
+ using (NpgsqlCommand cmd = new NpgsqlCommand(query, remote))
+ {
+ remote.Open();
+ MainConsole.Instance.Output("Querying database");
+ MainConsole.Instance.Output("Reading data");
+ using (NpgsqlDataReader reader = cmd.ExecuteReader(CommandBehavior.Default))
+ {
+ while (reader.Read())
+ {
+ if ((imported % 100) == 0)
+ {
+ MainConsole.Instance.Output(String.Format("{0} assets imported so far", imported));
+ }
+
+ AssetBase asset = new AssetBase();
+ AssetMetadata meta = new AssetMetadata();
+
+ meta.ID = reader["id"].ToString();
+ meta.FullID = new UUID(meta.ID);
+
+ meta.Name = String.Empty;
+ meta.Description = String.Empty;
+ meta.Type = (sbyte)Convert.ToInt32(reader["assetType"]);
+ meta.ContentType = SLUtil.SLAssetTypeToContentType(meta.Type);
+ meta.CreationDate = Util.ToDateTime(Convert.ToInt32(reader["create_time"]));
+
+ asset.Metadata = meta;
+ asset.Data = (byte[])reader["data"];
+
+ store(asset, force);
+
+ imported++;
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ m_log.ErrorFormat("[PGSQL FSASSETS]: Error importing assets: {0}",
+ e.Message.ToString());
+ return;
+ }
+
+ MainConsole.Instance.Output(String.Format("Import done, {0} assets imported", imported));
+ }
+
+ #endregion
+ }
+}
diff --git a/OpenSim/Data/PGSQL/PGSQLGroupsData.cs b/OpenSim/Data/PGSQL/PGSQLGroupsData.cs
index 6ef576bccc..f398256863 100755
--- a/OpenSim/Data/PGSQL/PGSQLGroupsData.cs
+++ b/OpenSim/Data/PGSQL/PGSQLGroupsData.cs
@@ -435,7 +435,7 @@ namespace OpenSim.Data.PGSQL
using (NpgsqlCommand cmd = new NpgsqlCommand())
{
- cmd.CommandText = String.Format("delete from {0} where \"TMStamp\" < CURRENT_DATE - INTERVAL '2 week'", m_Realm);
+ cmd.CommandText = String.Format("delete from {0} where \"TMStamp\"::abstime::timestamp < now() - INTERVAL '2 week'", m_Realm);
ExecuteNonQuery(cmd);
}
@@ -461,7 +461,7 @@ namespace OpenSim.Data.PGSQL
using (NpgsqlCommand cmd = new NpgsqlCommand())
{
- cmd.CommandText = String.Format("delete from {0} where \"TMStamp\" < CURRENT_DATE - INTERVAL '2 week'", m_Realm);
+ cmd.CommandText = String.Format("delete from {0} where \"TMStamp\"::abstime::timestamp < now() - INTERVAL '2 week'", m_Realm);
ExecuteNonQuery(cmd);
}
diff --git a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs
index 33d12bd71e..f4af40ba88 100755
--- a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs
+++ b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs
@@ -350,10 +350,11 @@ namespace OpenSim.Data.PGSQL
""CameraEyeOffsetY"" = :CameraEyeOffsetY, ""CameraEyeOffsetZ"" = :CameraEyeOffsetZ, ""CameraAtOffsetX"" = :CameraAtOffsetX,
""CameraAtOffsetY"" = :CameraAtOffsetY, ""CameraAtOffsetZ"" = :CameraAtOffsetZ, ""ForceMouselook"" = :ForceMouselook,
""ScriptAccessPin"" = :ScriptAccessPin, ""AllowedDrop"" = :AllowedDrop, ""DieAtEdge"" = :DieAtEdge, ""SalePrice"" = :SalePrice,
- ""SaleType"" = :SaleType, ""ColorR"" = :ColorR, ""ColorG"" = :ColorG, ""ColorB"" = :ColorB, ""ColorA"" = :ColorA, ""ParticleSystem"" = :ParticleSystem,
+ ""PhysicsShapeType"" = :PhysicsShapeType, ""Density"" = :Density, ""GravityModifier"" = :GravityModifier, ""Friction"" = :Friction, ""Restitution"" = :Restitution,
+ ""PassCollisions"" = :PassCollisions, ""RotationAxisLocks"" = :RotationAxisLocks, ""RezzerID"" = :RezzerID,
""ClickAction"" = :ClickAction, ""Material"" = :Material, ""CollisionSound"" = :CollisionSound, ""CollisionSoundVolume"" = :CollisionSoundVolume, ""PassTouches"" = :PassTouches,
""LinkNumber"" = :LinkNumber, ""MediaURL"" = :MediaURL, ""DynAttrs"" = :DynAttrs,
- ""PhysicsShapeType"" = :PhysicsShapeType, ""Density"" = :Density, ""GravityModifier"" = :GravityModifier, ""Friction"" = :Friction, ""Restitution"" = :Restitution
+ ""PhysInertia"" = :PhysInertia
WHERE ""UUID"" = :UUID ;
INSERT INTO
@@ -367,7 +368,7 @@ namespace OpenSim.Data.PGSQL
""OmegaY"", ""OmegaZ"", ""CameraEyeOffsetX"", ""CameraEyeOffsetY"", ""CameraEyeOffsetZ"", ""CameraAtOffsetX"", ""CameraAtOffsetY"", ""CameraAtOffsetZ"",
""ForceMouselook"", ""ScriptAccessPin"", ""AllowedDrop"", ""DieAtEdge"", ""SalePrice"", ""SaleType"", ""ColorR"", ""ColorG"", ""ColorB"", ""ColorA"",
""ParticleSystem"", ""ClickAction"", ""Material"", ""CollisionSound"", ""CollisionSoundVolume"", ""PassTouches"", ""LinkNumber"", ""MediaURL"", ""DynAttrs"",
- ""PhysicsShapeType"", ""Density"", ""GravityModifier"", ""Friction"", ""Restitution""
+ ""PhysicsShapeType"", ""Density"", ""GravityModifier"", ""Friction"", ""Restitution"", ""PassCollisions"", ""RotationAxisLocks"", ""RezzerID"" , ""PhysInertia""
) Select
:UUID, :CreationDate, :Name, :Text, :Description, :SitName, :TouchName, :ObjectFlags, :OwnerMask, :NextOwnerMask, :GroupMask,
:EveryoneMask, :BaseMask, :PositionX, :PositionY, :PositionZ, :GroupPositionX, :GroupPositionY, :GroupPositionZ, :VelocityX,
@@ -378,7 +379,7 @@ namespace OpenSim.Data.PGSQL
:OmegaY, :OmegaZ, :CameraEyeOffsetX, :CameraEyeOffsetY, :CameraEyeOffsetZ, :CameraAtOffsetX, :CameraAtOffsetY, :CameraAtOffsetZ,
:ForceMouselook, :ScriptAccessPin, :AllowedDrop, :DieAtEdge, :SalePrice, :SaleType, :ColorR, :ColorG, :ColorB, :ColorA,
:ParticleSystem, :ClickAction, :Material, :CollisionSound, :CollisionSoundVolume, :PassTouches, :LinkNumber, :MediaURL, :DynAttrs,
- :PhysicsShapeType, :Density, :GravityModifier, :Friction, :Restitution
+ :PhysicsShapeType, :Density, :GravityModifier, :Friction, :Restitution, :PassCollisions, :RotationAxisLocks, :RezzerID, :PhysInertia
where not EXISTS (SELECT ""UUID"" FROM prims WHERE ""UUID"" = :UUID);
";
@@ -1678,6 +1679,12 @@ namespace OpenSim.Data.PGSQL
prim.OwnerID = new UUID((Guid)primRow["OwnerID"]);
prim.GroupID = new UUID((Guid)primRow["GroupID"]);
prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]);
+
+ if (primRow["RezzerID"] != DBNull.Value)
+ prim.RezzerID = new UUID((Guid)primRow["RezzerID"]);
+ else
+ prim.RezzerID = UUID.Zero;
+
prim.OwnerMask = Convert.ToUInt32(primRow["OwnerMask"]);
prim.NextOwnerMask = Convert.ToUInt32(primRow["NextOwnerMask"]);
prim.GroupMask = Convert.ToUInt32(primRow["GroupMask"]);
@@ -1782,6 +1789,7 @@ namespace OpenSim.Data.PGSQL
prim.CollisionSoundVolume = Convert.ToSingle(primRow["CollisionSoundVolume"]);
prim.PassTouches = (bool)primRow["PassTouches"];
+ prim.PassCollisions = (bool)primRow["PassCollisions"];
if (!(primRow["MediaURL"] is System.DBNull))
prim.MediaUrl = (string)primRow["MediaURL"];
@@ -1796,6 +1804,13 @@ namespace OpenSim.Data.PGSQL
prim.GravityModifier = Convert.ToSingle(primRow["GravityModifier"]);
prim.Friction = Convert.ToSingle(primRow["Friction"]);
prim.Restitution = Convert.ToSingle(primRow["Restitution"]);
+ prim.RotationAxisLocks = Convert.ToByte(primRow["RotationAxisLocks"]);
+
+
+ PhysicsInertiaData pdata = null;
+ if (!(primRow["PhysInertia"] is System.DBNull))
+ pdata = PhysicsInertiaData.FromXml2(primRow["PhysInertia"].ToString());
+ prim.PhysicsInertia = pdata;
return prim;
}
@@ -2097,6 +2112,7 @@ namespace OpenSim.Data.PGSQL
parameters.Add(_Database.CreateParameter("OwnerID", prim.OwnerID));
parameters.Add(_Database.CreateParameter("GroupID", prim.GroupID));
parameters.Add(_Database.CreateParameter("LastOwnerID", prim.LastOwnerID));
+ parameters.Add(_Database.CreateParameter("RezzerID", prim.RezzerID));
parameters.Add(_Database.CreateParameter("OwnerMask", prim.OwnerMask));
parameters.Add(_Database.CreateParameter("NextOwnerMask", prim.NextOwnerMask));
parameters.Add(_Database.CreateParameter("GroupMask", prim.GroupMask));
@@ -2196,10 +2212,28 @@ namespace OpenSim.Data.PGSQL
parameters.Add(_Database.CreateParameter("CollisionSound", prim.CollisionSound));
parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume));
- parameters.Add(_Database.CreateParameter("PassTouches", prim.PassTouches));
+ parameters.Add(_Database.CreateParameter("PassTouches", (bool)prim.PassTouches));
+ parameters.Add(_Database.CreateParameter("PassCollisions", (bool)prim.PassCollisions));
+
+
+ if (prim.PassTouches)
+ parameters.Add(_Database.CreateParameter("PassTouches", true));
+ else
+ parameters.Add(_Database.CreateParameter("PassTouches", false));
+
+ if (prim.PassCollisions)
+ parameters.Add(_Database.CreateParameter("PassCollisions", true));
+ else
+ parameters.Add(_Database.CreateParameter("PassCollisions", false));
parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum));
parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl));
+
+ if (prim.PhysicsInertia != null)
+ parameters.Add(_Database.CreateParameter("PhysInertia", prim.PhysicsInertia.ToXml2()));
+ else
+ parameters.Add(_Database.CreateParameter("PhysInertia", String.Empty));
+
if (prim.DynAttrs.CountNamespaces > 0)
parameters.Add(_Database.CreateParameter("DynAttrs", prim.DynAttrs.ToXml()));
@@ -2211,12 +2245,13 @@ namespace OpenSim.Data.PGSQL
parameters.Add(_Database.CreateParameter("GravityModifier", (double)prim.GravityModifier));
parameters.Add(_Database.CreateParameter("Friction", (double)prim.Friction));
parameters.Add(_Database.CreateParameter("Restitution", (double)prim.Restitution));
+ parameters.Add(_Database.CreateParameter("RotationAxisLocks", prim.RotationAxisLocks));
return parameters.ToArray();
}
///
- /// Creates the primshape parameters for stroing in DB.
+ /// Creates the primshape parameters for storing in DB.
///
/// Basic data of SceneObjectpart prim.
/// The scene group ID.
diff --git a/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs b/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs
index 75a51e2de1..5800de9e84 100644
--- a/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs
+++ b/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs
@@ -845,7 +845,7 @@ namespace OpenSim.Data.PGSQL
query = "SELECT \"profileImage\", \"profileFirstImage\" FROM \"userprofile\" WHERE \"useruuid\" = :Id";
- using (NpgsqlCommand cmd = new NpgsqlCommand(string.Format(query, "\"userpicks\""), dbcon))
+ using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
{
cmd.Parameters.Add(m_database.CreateParameter("Id", avatarId));
diff --git a/OpenSim/Data/PGSQL/PGSQLXAssetData.cs b/OpenSim/Data/PGSQL/PGSQLXAssetData.cs
index 6e884898f5..1798d20508 100644
--- a/OpenSim/Data/PGSQL/PGSQLXAssetData.cs
+++ b/OpenSim/Data/PGSQL/PGSQLXAssetData.cs
@@ -173,16 +173,18 @@ namespace OpenSim.Data.PGSQL
if (m_enableCompression)
{
- using (GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), CompressionMode.Decompress))
+ using(MemoryStream ms = new MemoryStream(asset.Data))
+ using(GZipStream decompressionStream = new GZipStream(ms, CompressionMode.Decompress))
{
- MemoryStream outputStream = new MemoryStream();
- WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue);
- // int compressedLength = asset.Data.Length;
- asset.Data = outputStream.ToArray();
-
- // m_log.DebugFormat(
- // "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}",
- // asset.ID, asset.Name, asset.Data.Length, compressedLength);
+ using(MemoryStream outputStream = new MemoryStream())
+ {
+ decompressionStream.CopyTo(outputStream,int.MaxValue);
+ // int compressedLength = asset.Data.Length;
+ asset.Data = outputStream.ToArray();
+ }
+ // m_log.DebugFormat(
+ // "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}",
+ // asset.ID, asset.Name, asset.Data.Length, compressedLength);
}
}
diff --git a/OpenSim/Data/PGSQL/PGSQLXInventoryData.cs b/OpenSim/Data/PGSQL/PGSQLXInventoryData.cs
index 55a1996f51..4c10ac99b7 100644
--- a/OpenSim/Data/PGSQL/PGSQLXInventoryData.cs
+++ b/OpenSim/Data/PGSQL/PGSQLXInventoryData.cs
@@ -206,7 +206,7 @@ namespace OpenSim.Data.PGSQL
cmd.CommandText = String.Format(@"select bit_or(""inventoryCurrentPermissions"") as ""inventoryCurrentPermissions""
from inventoryitems
where ""avatarID""::uuid = :PrincipalID
- and ""assetID"" = :AssetID
+ and ""assetID""::uuid = :AssetID
group by ""assetID"" ");
cmd.Parameters.Add(m_database.CreateParameter("PrincipalID", principalID));
diff --git a/OpenSim/Data/PGSQL/Resources/AgentPrefs.migrations b/OpenSim/Data/PGSQL/Resources/AgentPrefs.migrations
new file mode 100644
index 0000000000..ca3cca21f6
--- /dev/null
+++ b/OpenSim/Data/PGSQL/Resources/AgentPrefs.migrations
@@ -0,0 +1,19 @@
+:VERSION 1
+
+BEGIN TRANSACTION;
+
+CREATE TABLE IF NOT EXISTS "public"."agentprefs" (
+ "PrincipalID" uuid NOT NULL,
+ "AccessPrefs" char(2) NOT NULL DEFAULT 'M'::bpchar COLLATE "default",
+ "HoverHeight" float8 NOT NULL DEFAULT 0,
+ "Language" char(5) NOT NULL DEFAULT 'en-us'::bpchar COLLATE "default",
+ "LanguageIsPublic" bool NOT NULL DEFAULT true,
+ "PermEveryone" int4 NOT NULL DEFAULT 0,
+ "PermGroup" int4 NOT NULL DEFAULT 0,
+ "PermNextOwner" int4 NOT NULL DEFAULT 532480
+)
+WITH (OIDS=FALSE);
+
+ALTER TABLE "public"."agentprefs" ADD PRIMARY KEY ("PrincipalID") NOT DEFERRABLE INITIALLY IMMEDIATE;
+
+COMMIT;
diff --git a/OpenSim/Data/PGSQL/Resources/EstateStore.migrations b/OpenSim/Data/PGSQL/Resources/EstateStore.migrations
index 59270f8b01..5b450aa45f 100644
--- a/OpenSim/Data/PGSQL/Resources/EstateStore.migrations
+++ b/OpenSim/Data/PGSQL/Resources/EstateStore.migrations
@@ -1,307 +1,127 @@
-:VERSION 1
+:VERSION 12
BEGIN TRANSACTION;
-CREATE TABLE estate_managers(
- "EstateID" int NOT NULL Primary Key,
- uuid varchar(36) NOT NULL
- );
-
-CREATE TABLE estate_groups(
- "EstateID" int NOT NULL,
- uuid varchar(36) NOT NULL
- );
+-- ----------------------------
+-- Table structure for estate_groups
+-- ----------------------------
+CREATE TABLE IF NOT EXISTS "public"."estate_groups" (
+ "EstateID" int4 NOT NULL,
+ "uuid" uuid NOT NULL
+)
+WITH (OIDS=FALSE);
+-- Indexes structure for table estate_groups
+-- ----------------------------
+CREATE INDEX IF NOT EXISTS "ix_estate_groups" ON "public"."estate_groups" USING btree("EstateID" "pg_catalog"."int4_ops" ASC NULLS LAST);
-CREATE TABLE estate_users(
- "EstateID" int NOT NULL,
- uuid varchar(36) NOT NULL
- );
+-- ----------------------------
+-- Table structure for estate_managers
+-- ----------------------------
+CREATE TABLE IF NOT EXISTS "public"."estate_managers" (
+ "EstateID" int4 NOT NULL,
+ "uuid" uuid NOT NULL
+)
+WITH (OIDS=FALSE);
+-- Indexes structure for table estate_managers
+-- ----------------------------
+CREATE INDEX IF NOT EXISTS "ix_estate_managers" ON "public"."estate_managers" USING btree("EstateID" "pg_catalog"."int4_ops" ASC NULLS LAST);
-CREATE TABLE estateban(
- "EstateID" int NOT NULL,
- "bannedUUID" varchar(36) NOT NULL,
- "bannedIp" varchar(16) NOT NULL,
- "bannedIpHostMask" varchar(16) NOT NULL,
- "bannedNameMask" varchar(64) NULL DEFAULT NULL
- );
+-- ----------------------------
+-- Table structure for estate_map
+-- ----------------------------
+CREATE TABLE IF NOT EXISTS "public"."estate_map" (
+ "RegionID" uuid NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'::uuid,
+ "EstateID" int4 NOT NULL
+)
+WITH (OIDS=FALSE);
-Create Sequence estate_settings_id increment by 100 start with 100;
+-- Primary key structure for table estate_map
+-- ----------------------------
+ALTER TABLE "public"."estate_map" ADD PRIMARY KEY ("RegionID") NOT DEFERRABLE INITIALLY IMMEDIATE;
-CREATE TABLE estate_settings(
- "EstateID" integer DEFAULT nextval('estate_settings_id') NOT NULL,
- "EstateName" varchar(64) NULL DEFAULT (NULL),
- "AbuseEmailToEstateOwner" boolean NOT NULL,
- "DenyAnonymous" boolean NOT NULL,
- "ResetHomeOnTeleport" boolean NOT NULL,
- "FixedSun" boolean NOT NULL,
- "DenyTransacted" boolean NOT NULL,
- "BlockDwell" boolean NOT NULL,
- "DenyIdentified" boolean NOT NULL,
- "AllowVoice" boolean NOT NULL,
- "UseGlobalTime" boolean NOT NULL,
- "PricePerMeter" int NOT NULL,
- "TaxFree" boolean NOT NULL,
- "AllowDirectTeleport" boolean NOT NULL,
- "RedirectGridX" int NOT NULL,
- "RedirectGridY" int NOT NULL,
- "ParentEstateID" int NOT NULL,
- "SunPosition" double precision NOT NULL,
- "EstateSkipScripts" boolean NOT NULL,
- "BillableFactor" double precision NOT NULL,
- "PublicAccess" boolean NOT NULL,
- "AbuseEmail" varchar(255) NOT NULL,
- "EstateOwner" varchar(36) NOT NULL,
- "DenyMinors" boolean NOT NULL
- );
-
-
-CREATE TABLE estate_map(
- "RegionID" varchar(36) NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'),
- "EstateID" int NOT NULL
- );
-
-COMMIT;
-
-:VERSION 2
-
-BEGIN TRANSACTION;
-
-CREATE INDEX IX_estate_managers ON estate_managers
- (
- "EstateID"
- );
-
-
-CREATE INDEX IX_estate_groups ON estate_groups
- (
- "EstateID"
- );
-
-
-CREATE INDEX IX_estate_users ON estate_users
- (
- "EstateID"
- );
-
-COMMIT;
-
-:VERSION 3
-
-BEGIN TRANSACTION;
-
-CREATE TABLE Tmp_estateban
- (
- "EstateID" int NOT NULL,
- "bannedUUID" varchar(36) NOT NULL,
- "bannedIp" varchar(16) NULL,
- "bannedIpHostMask" varchar(16) NULL,
- "bannedNameMask" varchar(64) NULL
- );
-
- INSERT INTO Tmp_estateban ("EstateID", "bannedUUID", "bannedIp", "bannedIpHostMask", "bannedNameMask")
- SELECT "EstateID", "bannedUUID", "bannedIp", "bannedIpHostMask", "bannedNameMask" FROM estateban;
-
-DROP TABLE estateban;
-
-Alter table Tmp_estateban
- rename to estateban;
-
-CREATE INDEX IX_estateban ON estateban
- (
- "EstateID"
- );
-
-COMMIT;
-
-
-:VERSION 4
-
-BEGIN TRANSACTION;
-
-CREATE TABLE Tmp_estate_managers
- (
- "EstateID" int NOT NULL,
- uuid uuid NOT NULL
- );
-
-INSERT INTO Tmp_estate_managers ("EstateID", uuid)
- SELECT "EstateID", cast(uuid as uuid) FROM estate_managers;
-
-DROP TABLE estate_managers;
-
-Alter table Tmp_estate_managers
- rename to estate_managers;
-
-CREATE INDEX IX_estate_managers ON estate_managers
- (
- "EstateID"
- );
-
-COMMIT;
-
-
-:VERSION 5
-
-BEGIN TRANSACTION;
-
-CREATE TABLE Tmp_estate_groups
- (
- "EstateID" int NOT NULL,
- uuid uuid NOT NULL
- ) ;
-
- INSERT INTO Tmp_estate_groups ("EstateID", uuid)
- SELECT "EstateID", cast(uuid as uuid) FROM estate_groups;
-
-DROP TABLE estate_groups;
-
-Alter table Tmp_estate_groups
- rename to estate_groups;
-
-CREATE INDEX IX_estate_groups ON estate_groups
- (
- "EstateID"
- );
-
-COMMIT;
-
-
-:VERSION 6
-
-BEGIN TRANSACTION;
-
-CREATE TABLE Tmp_estate_users
- (
- "EstateID" int NOT NULL,
- uuid uuid NOT NULL
- );
-
-INSERT INTO Tmp_estate_users ("EstateID", uuid)
- SELECT "EstateID", cast(uuid as uuid) FROM estate_users ;
-
-DROP TABLE estate_users;
-
-Alter table Tmp_estate_users
- rename to estate_users;
-
-CREATE INDEX IX_estate_users ON estate_users
- (
- "EstateID"
- );
-
-COMMIT;
-
-
-:VERSION 7
-
-BEGIN TRANSACTION;
-
-CREATE TABLE Tmp_estateban
- (
- "EstateID" int NOT NULL,
- "bannedUUID" uuid NOT NULL,
- "bannedIp" varchar(16) NULL,
- "bannedIpHostMask" varchar(16) NULL,
- "bannedNameMask" varchar(64) NULL
- );
-
-INSERT INTO Tmp_estateban ("EstateID", "bannedUUID", "bannedIp", "bannedIpHostMask", "bannedNameMask")
- SELECT "EstateID", cast("bannedUUID" as uuid), "bannedIp", "bannedIpHostMask", "bannedNameMask" FROM estateban ;
-
-DROP TABLE estateban;
-
-Alter table Tmp_estateban
- rename to estateban;
-
-CREATE INDEX IX_estateban ON estateban
- (
- "EstateID"
- );
-
-COMMIT;
-
-
-:VERSION 8
-
-BEGIN TRANSACTION;
-
-CREATE TABLE Tmp_estate_settings
- (
- "EstateID" integer default nextval('estate_settings_id') NOT NULL,
- "EstateName" varchar(64) NULL DEFAULT (NULL),
- "AbuseEmailToEstateOwner" boolean NOT NULL,
- "DenyAnonymous" boolean NOT NULL,
- "ResetHomeOnTeleport" boolean NOT NULL,
- "FixedSun" boolean NOT NULL,
- "DenyTransacted" boolean NOT NULL,
- "BlockDwell" boolean NOT NULL,
- "DenyIdentified" boolean NOT NULL,
- "AllowVoice" boolean NOT NULL,
- "UseGlobalTime" boolean NOT NULL,
- "PricePerMeter" int NOT NULL,
- "TaxFree" boolean NOT NULL,
- "AllowDirectTeleport" boolean NOT NULL,
- "RedirectGridX" int NOT NULL,
- "RedirectGridY" int NOT NULL,
- "ParentEstateID" int NOT NULL,
- "SunPosition" double precision NOT NULL,
- "EstateSkipScripts" boolean NOT NULL,
- "BillableFactor" double precision NOT NULL,
- "PublicAccess" boolean NOT NULL,
- "AbuseEmail" varchar(255) NOT NULL,
+-- ----------------------------
+-- Table structure for estate_settings
+-- ----------------------------
+CREATE TABLE IF NOT EXISTS "public"."estate_settings" (
+ "EstateID" int4 NOT NULL DEFAULT nextval('estate_settings_id'::regclass),
+ "EstateName" varchar(64) DEFAULT NULL::character varying COLLATE "default",
+ "AbuseEmailToEstateOwner" bool NOT NULL,
+ "DenyAnonymous" bool NOT NULL,
+ "ResetHomeOnTeleport" bool NOT NULL,
+ "FixedSun" bool NOT NULL,
+ "DenyTransacted" bool NOT NULL,
+ "BlockDwell" bool NOT NULL,
+ "DenyIdentified" bool NOT NULL,
+ "AllowVoice" bool NOT NULL,
+ "UseGlobalTime" bool NOT NULL,
+ "PricePerMeter" int4 NOT NULL,
+ "TaxFree" bool NOT NULL,
+ "AllowDirectTeleport" bool NOT NULL,
+ "RedirectGridX" int4 NOT NULL,
+ "RedirectGridY" int4 NOT NULL,
+ "ParentEstateID" int4 NOT NULL,
+ "SunPosition" float8 NOT NULL,
+ "EstateSkipScripts" bool NOT NULL,
+ "BillableFactor" float8 NOT NULL,
+ "PublicAccess" bool NOT NULL,
+ "AbuseEmail" varchar(255) NOT NULL COLLATE "default",
"EstateOwner" uuid NOT NULL,
- "DenyMinors" boolean NOT NULL
- );
+ "DenyMinors" bool NOT NULL,
+ "AllowLandmark" bool NOT NULL DEFAULT true,
+ "AllowParcelChanges" bool NOT NULL DEFAULT true,
+ "AllowSetHome" bool NOT NULL DEFAULT true
+)
+WITH (OIDS=FALSE);
-INSERT INTO Tmp_estate_settings ("EstateID", "EstateName", "AbuseEmailToEstateOwner", "DenyAnonymous", "ResetHomeOnTeleport", "FixedSun", "DenyTransacted", "BlockDwell", "DenyIdentified", "AllowVoice", "UseGlobalTime", "PricePerMeter", "TaxFree", "AllowDirectTeleport", "RedirectGridX", "RedirectGridY", "ParentEstateID", "SunPosition", "EstateSkipScripts", "BillableFactor", "PublicAccess", "AbuseEmail", "EstateOwner", "DenyMinors")
- SELECT "EstateID", "EstateName", "AbuseEmailToEstateOwner", "DenyAnonymous", "ResetHomeOnTeleport", "FixedSun", "DenyTransacted", "BlockDwell", "DenyIdentified", "AllowVoice", "UseGlobalTime", "PricePerMeter", "TaxFree", "AllowDirectTeleport", "RedirectGridX", "RedirectGridY", "ParentEstateID", "SunPosition", "EstateSkipScripts", "BillableFactor", "PublicAccess", "AbuseEmail", cast("EstateOwner" as uuid), "DenyMinors" FROM estate_settings ;
+-- Primary key structure for table estate_settings
+-- ----------------------------
+ALTER TABLE "public"."estate_settings" ADD PRIMARY KEY ("EstateID") NOT DEFERRABLE INITIALLY IMMEDIATE;
-DROP TABLE estate_settings;
+-- ----------------------------
+-- Table structure for estate_users
+-- ----------------------------
+CREATE TABLE IF NOT EXISTS "public"."estate_users" (
+ "EstateID" int4 NOT NULL,
+ "uuid" uuid NOT NULL
+)
+WITH (OIDS=FALSE);
+-- Indexes structure for table estate_users
+-- ----------------------------
+CREATE INDEX IF NOT EXISTS "ix_estate_users" ON "public"."estate_users" USING btree("EstateID" "pg_catalog"."int4_ops" ASC NULLS LAST);
-Alter table Tmp_estate_settings
- rename to estate_settings;
+-- ----------------------------
+-- Table structure for estateban
+-- ----------------------------
+CREATE TABLE IF NOT EXISTS "public"."estateban" (
+ "EstateID" int4 NOT NULL,
+ "bannedUUID" uuid NOT NULL,
+ "bannedIp" varchar(16) COLLATE "default",
+ "bannedIpHostMask" varchar(16) COLLATE "default",
+ "bannedNameMask" varchar(64) COLLATE "default"
+)
+WITH (OIDS=FALSE);
-
-Create index on estate_settings (lower("EstateName"));
+-- Indexes structure for table estateban
+-- ----------------------------
+CREATE INDEX IF NOT EXISTS "ix_estateban" ON "public"."estateban" USING btree("EstateID" "pg_catalog"."int4_ops" ASC NULLS LAST);
COMMIT;
+:VERSION 13
-:VERSION 9
+ BEGIN TRASACTION;
-BEGIN TRANSACTION;
-
-CREATE TABLE Tmp_estate_map
- (
- "RegionID" uuid NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'),
- "EstateID" int NOT NULL
- );
-
-INSERT INTO Tmp_estate_map ("RegionID", "EstateID")
- SELECT cast("RegionID" as uuid), "EstateID" FROM estate_map ;
-
-DROP TABLE estate_map;
-
-Alter table Tmp_estate_map
- rename to estate_map;
+-- ----------------------------
+-- SEQUENCE estate_settings_id
+-- ----------------------------
+CREATE SEQUENCE IF NOT EXISTS "public"."estate_settings_id"
+ INCREMENT 100
+ MINVALUE 1
+ MAXVALUE 9223372036854775807
+ START 100
+ CACHE 1;
COMMIT;
-
-:VERSION 10
-
-BEGIN TRANSACTION;
-ALTER TABLE estate_settings ADD COLUMN "AllowLandmark" boolean NOT NULL default true;
-ALTER TABLE estate_settings ADD COLUMN "AllowParcelChanges" boolean NOT NULL default true;
-ALTER TABLE estate_settings ADD COLUMN "AllowSetHome" boolean NOT NULL default true;
-COMMIT;
-
-:VERSION 11
-
-Begin transaction;
-
-
-Commit;
-
diff --git a/OpenSim/Data/PGSQL/Resources/FSAssetStore.migrations b/OpenSim/Data/PGSQL/Resources/FSAssetStore.migrations
new file mode 100644
index 0000000000..3a072e566e
--- /dev/null
+++ b/OpenSim/Data/PGSQL/Resources/FSAssetStore.migrations
@@ -0,0 +1,14 @@
+:VERSION 1
+
+BEGIN TRANSACTION;
+
+CREATE TABLE fsassets (
+ "id" uuid NOT NULL PRIMARY KEY,
+ "type" integer NOT NULL,
+ "hash" char(64) NOT NULL,
+ "create_time" integer NOT NULL DEFAULT '0',
+ "access_time" integer NOT NULL DEFAULT '0',
+ "asset_flags" integer NOT NULL DEFAULT '0'
+);
+
+COMMIT;
diff --git a/OpenSim/Data/PGSQL/Resources/RegionStore.migrations b/OpenSim/Data/PGSQL/Resources/RegionStore.migrations
index c08593917d..fcefb6baa3 100644
--- a/OpenSim/Data/PGSQL/Resources/RegionStore.migrations
+++ b/OpenSim/Data/PGSQL/Resources/RegionStore.migrations
@@ -1195,3 +1195,33 @@ CREATE TABLE bakedterrain
);
COMMIT;
+
+:VERSION 45 #---- Add RezzerID filed in table prims
+
+BEGIN TRANSACTION;
+
+ALTER TABLE prims ADD "RezzerID" uuid NULL;
+
+COMMIT;
+
+:VERSION 46 #---- Add physics inertia data to table prims
+
+BEGIN TRANSACTION;
+
+ALTER TABLE prims ADD "PhysInertia" TEXT;
+
+COMMIT;
+
+
+:VERSION 47 #---- Convert field PassCollisions in table prims to BOOLEAN
+
+BEGIN TRANSACTION;
+
+ALTER TABLE "public"."prims" ALTER COLUMN "PassCollisions" DROP DEFAULT;
+ALTER TABLE "public"."prims"
+ ALTER COLUMN "PassCollisions" TYPE BOOLEAN
+ USING CASE WHEN "PassCollisions" = 0 THEN FALSE
+ WHEN "PassCollisions" = 1 THEN TRUE
+ ELSE NULL
+ END;
+COMMIT;
diff --git a/OpenSim/Data/SQLite/Resources/MuteListStore.migrations b/OpenSim/Data/SQLite/Resources/MuteListStore.migrations
new file mode 100644
index 0000000000..f981ded2af
--- /dev/null
+++ b/OpenSim/Data/SQLite/Resources/MuteListStore.migrations
@@ -0,0 +1,16 @@
+:VERSION 1
+
+BEGIN TRANSACTION;
+
+CREATE TABLE MuteList (
+ AgentID char(36) NOT NULL,
+ MuteID char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
+ MuteName varchar(64) NOT NULL DEFAULT '',
+ MuteType int(11) NOT NULL DEFAULT '1',
+ MuteFlags int(11) NOT NULL DEFAULT '0',
+ Stamp int(11) NOT NULL,
+ UNIQUE (AgentID, MuteID, MuteName),
+ PRIMARY KEY(AgentID)
+);
+
+COMMIT;
diff --git a/OpenSim/Data/SQLite/Resources/RegionStore.migrations b/OpenSim/Data/SQLite/Resources/RegionStore.migrations
index eef14d6a46..fb154cf84a 100644
--- a/OpenSim/Data/SQLite/Resources/RegionStore.migrations
+++ b/OpenSim/Data/SQLite/Resources/RegionStore.migrations
@@ -371,3 +371,9 @@ BEGIN;
ALTER TABLE `prims` ADD COLUMN `RezzerID` char(36) DEFAULT NULL;
COMMIT;
+
+:VERSION 36 #----- Add physics inertia data
+
+BEGIN;
+ALTER TABLE `prims` ADD COLUMN `PhysInertia` TEXT default NULL;
+COMMIT;
diff --git a/OpenSim/Data/SQLite/SQLiteMuteListData.cs b/OpenSim/Data/SQLite/SQLiteMuteListData.cs
new file mode 100644
index 0000000000..80fd0192ad
--- /dev/null
+++ b/OpenSim/Data/SQLite/SQLiteMuteListData.cs
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Data;
+using OpenMetaverse;
+using OpenSim.Framework;
+#if CSharpSqlite
+ using Community.CsharpSqlite.Sqlite;
+#else
+ using Mono.Data.Sqlite;
+#endif
+
+namespace OpenSim.Data.SQLite
+{
+ public class SQLiteMuteListData : SQLiteGenericTableHandler, IMuteListData
+ {
+ public SQLiteMuteListData(string connectionString)
+ : base(connectionString, "MuteList", "MuteListStore")
+ {
+ }
+
+ public MuteData[] Get(UUID agentID)
+ {
+ MuteData[] data = base.Get("AgentID", agentID.ToString());
+ return data;
+ }
+
+ public bool Delete(UUID agentID, UUID muteID, string muteName)
+ {
+ using (SqliteCommand cmd = new SqliteCommand())
+ {
+ cmd.CommandText = "delete from MuteList where `AgentID` = :AgentID and `MuteID` = :MuteID and `MuteName` = :MuteName";
+
+ cmd.Parameters.AddWithValue(":AgentID", agentID.ToString());
+ cmd.Parameters.AddWithValue(":MuteID", muteID.ToString());
+ cmd.Parameters.AddWithValue(":MuteName", muteName);
+
+ if (ExecuteNonQuery(cmd, m_Connection) > 0)
+ return true;
+ return false;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
index eec386fcb0..19880dec20 100644
--- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs
+++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
@@ -1843,6 +1843,12 @@ namespace OpenSim.Data.SQLite
if (vehicle != null)
prim.VehicleParams = vehicle;
}
+
+ PhysicsInertiaData pdata = null;
+ if (!(row["PhysInertia"] is DBNull) && row["PhysInertia"].ToString() != String.Empty)
+ pdata = PhysicsInertiaData.FromXml2(row["PhysInertia"].ToString());
+ prim.PhysicsInertia = pdata;
+
return prim;
}
@@ -2266,6 +2272,11 @@ namespace OpenSim.Data.SQLite
else
row["Vehicle"] = String.Empty;
+ if (prim.PhysicsInertia != null)
+ row["PhysInertia"] = prim.PhysicsInertia.ToXml2();
+ else
+ row["PhysInertia"] = String.Empty;
+
}
///
diff --git a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs
index 13aac79049..2f22d544f5 100644
--- a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs
+++ b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs
@@ -926,7 +926,7 @@ namespace OpenSim.Data.SQLite
{
using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
{
- cmd.CommandText = query;
+ cmd.CommandText = string.Format(query, "\"classifieds\"");
cmd.Parameters.AddWithValue(":Id", avatarId.ToString());
using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
@@ -940,7 +940,7 @@ namespace OpenSim.Data.SQLite
using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
{
- cmd.CommandText = query;
+ cmd.CommandText = string.Format(query, "\"userpicks\"");
cmd.Parameters.AddWithValue(":Id", avatarId.ToString());
using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
diff --git a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs
index 7f44a651e9..4ef1f30a8d 100644
--- a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs
+++ b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs
@@ -305,17 +305,11 @@ namespace OpenSim.Data.SQLite
using (SqliteCommand cmd = new SqliteCommand())
{
- cmd.CommandText = "update inventoryfolders set version=version+1 where folderID = ?folderID";
+ cmd.CommandText = "update inventoryfolders set version=version+1 where folderID = :folderID";
cmd.Parameters.Add(new SqliteParameter(":folderID", folderID));
- try
- {
- cmd.ExecuteNonQuery();
- }
- catch (Exception)
- {
+ if(ExecuteNonQuery(cmd, m_Connection) == 0)
return false;
- }
}
return true;
diff --git a/OpenSim/Framework/AgentUpdateArgs.cs b/OpenSim/Framework/AgentUpdateArgs.cs
index f04d692092..cd1c3a0745 100644
--- a/OpenSim/Framework/AgentUpdateArgs.cs
+++ b/OpenSim/Framework/AgentUpdateArgs.cs
@@ -83,6 +83,7 @@ namespace OpenSim.Framework
public bool UseClientAgentPosition;
public bool NeedsCameraCollision;
public uint lastpacketSequence;
+ public double lastUpdateTS;
public AgentUpdateArgs()
{
diff --git a/OpenSim/Framework/AnimationSet.cs b/OpenSim/Framework/AnimationSet.cs
index 87c4a78ea9..8753088cc7 100644
--- a/OpenSim/Framework/AnimationSet.cs
+++ b/OpenSim/Framework/AnimationSet.cs
@@ -31,7 +31,8 @@ using OpenMetaverse;
namespace OpenSim.Framework
{
- public delegate bool AnimationSetValidator(UUID animID);
+// public delegate bool AnimationSetValidator(UUID animID);
+ public delegate uint AnimationSetValidator(UUID animID);
public class AnimationSet
{
@@ -141,7 +142,7 @@ namespace OpenSim.Framework
assetData += String.Format("{0} {1} {2}\n", kvp.Key, kvp.Value.Value.ToString(), kvp.Value.Key);
return System.Text.Encoding.ASCII.GetBytes(assetData);
}
-
+/*
public bool Validate(AnimationSetValidator val)
{
if (m_parseError)
@@ -164,5 +165,22 @@ namespace OpenSim.Framework
return allOk;
}
+*/
+ public uint Validate(AnimationSetValidator val)
+ {
+ if (m_parseError)
+ return 0;
+
+ uint ret = 0x7fffffff;
+ uint t;
+ foreach (KeyValuePair> kvp in m_animations)
+ {
+ t = val(kvp.Value.Value);
+ if (t == 0)
+ return 0;
+ ret &= t;
+ }
+ return ret;
+ }
}
}
diff --git a/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs b/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs
index 097ad7d6a3..efccc35080 100644
--- a/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs
+++ b/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs
@@ -42,11 +42,13 @@ namespace OpenSim.Framework.AssetLoader.Filesystem
public class AssetLoaderFileSystem : IAssetLoader
{
private static readonly UUID LIBRARY_OWNER_ID = new UUID("11111111-1111-0000-0000-000100bba000");
+ private static readonly string LIBRARY_OWNER_IDstr = "11111111-1111-0000-0000-000100bba000";
+
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected static AssetBase CreateAsset(string assetIdStr, string name, string path, sbyte type)
{
- AssetBase asset = new AssetBase(new UUID(assetIdStr), name, type, LIBRARY_OWNER_ID.ToString());
+ AssetBase asset = new AssetBase(new UUID(assetIdStr), name, type, LIBRARY_OWNER_IDstr);
if (!String.IsNullOrEmpty(path))
{
diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs
index 0e8f9608f0..fddd0f06ea 100644
--- a/OpenSim/Framework/AvatarWearable.cs
+++ b/OpenSim/Framework/AvatarWearable.cs
@@ -91,11 +91,11 @@ namespace OpenSim.Framework
public static readonly UUID DEFAULT_PANTS_ITEM = new UUID("77c41e39-38f9-f75a-0000-5859892f1111");
public static readonly UUID DEFAULT_PANTS_ASSET = new UUID("00000000-38f9-1111-024e-222222111120");
-// public static readonly UUID DEFAULT_ALPHA_ITEM = new UUID("bfb9923c-4838-4d2d-bf07-608c5b1165c8");
-// public static readonly UUID DEFAULT_ALPHA_ASSET = new UUID("1578a2b1-5179-4b53-b618-fe00ca5a5594");
+ public static readonly UUID DEFAULT_ALPHA_ITEM = new UUID("bfb9923c-4838-4d2d-bf07-608c5b1165c8");
+ public static readonly UUID DEFAULT_ALPHA_ASSET = new UUID("1578a2b1-5179-4b53-b618-fe00ca5a5594");
-// public static readonly UUID DEFAULT_TATTOO_ITEM = new UUID("c47e22bd-3021-4ba4-82aa-2b5cb34d35e1");
-// public static readonly UUID DEFAULT_TATTOO_ASSET = new UUID("00000000-0000-2222-3333-100000001007");
+ public static readonly UUID DEFAULT_TATTOO_ITEM = new UUID("c47e22bd-3021-4ba4-82aa-2b5cb34d35e1");
+ public static readonly UUID DEFAULT_TATTOO_ASSET = new UUID("00000000-0000-2222-3333-100000001007");
protected Dictionary m_items = new Dictionary();
protected List m_ids = new List();
diff --git a/OpenSim/Framework/BlockingQueue.cs b/OpenSim/Framework/BlockingQueue.cs
deleted file mode 100644
index 2461049107..0000000000
--- a/OpenSim/Framework/BlockingQueue.cs
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System.Collections.Generic;
-using System.Threading;
-
-namespace OpenSim.Framework
-{
- public class BlockingQueue
- {
- private readonly Queue m_pqueue = new Queue();
- private readonly Queue m_queue = new Queue();
- private readonly object m_queueSync = new object();
-
- public void PriorityEnqueue(T value)
- {
- lock (m_queueSync)
- {
- m_pqueue.Enqueue(value);
- Monitor.Pulse(m_queueSync);
- }
- }
-
- public void Enqueue(T value)
- {
- lock (m_queueSync)
- {
- m_queue.Enqueue(value);
- Monitor.Pulse(m_queueSync);
- }
- }
-
- public T Dequeue()
- {
- lock (m_queueSync)
- {
- while (m_queue.Count < 1 && m_pqueue.Count < 1)
- {
- Monitor.Wait(m_queueSync);
- }
-
- if (m_pqueue.Count > 0)
- return m_pqueue.Dequeue();
-
- if (m_queue.Count > 0)
- return m_queue.Dequeue();
- return default(T);
- }
- }
-
- public T Dequeue(int msTimeout)
- {
- lock (m_queueSync)
- {
- if (m_queue.Count < 1 && m_pqueue.Count < 1)
- {
- if(!Monitor.Wait(m_queueSync, msTimeout))
- return default(T);
- }
-
- if (m_pqueue.Count > 0)
- return m_pqueue.Dequeue();
- if (m_queue.Count > 0)
- return m_queue.Dequeue();
- return default(T);
- }
- }
-
- ///
- /// Indicate whether this queue contains the given item.
- ///
- ///
- /// This method is not thread-safe. Do not rely on the result without consistent external locking.
- ///
- public bool Contains(T item)
- {
- lock (m_queueSync)
- {
- if (m_queue.Count < 1 && m_pqueue.Count < 1)
- return false;
-
- if (m_pqueue.Contains(item))
- return true;
- return m_queue.Contains(item);
- }
- }
-
- ///
- /// Return a count of the number of requests on this queue.
- ///
- public int Count()
- {
- lock (m_queueSync)
- return m_queue.Count + m_pqueue.Count;
- }
-
- ///
- /// Return the array of items on this queue.
- ///
- ///
- /// This method is not thread-safe. Do not rely on the result without consistent external locking.
- ///
- public T[] GetQueueArray()
- {
- lock (m_queueSync)
- {
- if (m_queue.Count < 1 && m_pqueue.Count < 1)
- return new T[0];
-
- return m_queue.ToArray();
- }
- }
-
- public void Clear()
- {
- lock (m_queueSync)
- {
- m_pqueue.Clear();
- m_queue.Clear();
- Monitor.Pulse(m_queueSync);
- }
- }
- }
-}
diff --git a/OpenSim/Framework/Cache.cs b/OpenSim/Framework/Cache.cs
index 7ccc320acd..3ca85d7d1a 100644
--- a/OpenSim/Framework/Cache.cs
+++ b/OpenSim/Framework/Cache.cs
@@ -390,17 +390,21 @@ namespace OpenSim.Framework
Object data = fetch(index);
- if (data == null && (m_Flags & CacheFlags.CacheMissing) == 0)
- return null;
-
- lock (m_Index)
+ if (data == null)
{
- CacheItemBase missing = new CacheItemBase(index);
- if (!m_Index.Contains(missing))
- {
- m_Index.Add(missing);
- m_Lookup[index] = missing;
- }
+ if((m_Flags & CacheFlags.CacheMissing) != 0)
+ {
+ lock (m_Index)
+ {
+ CacheItemBase missing = new CacheItemBase(index);
+ if (!m_Index.Contains(missing))
+ {
+ m_Index.Add(missing);
+ m_Lookup[index] = missing;
+ }
+ }
+ }
+ return null;
}
Store(index, data);
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index d6d8dde6fe..ee5007abf8 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -375,6 +375,7 @@ namespace OpenSim.Framework
public string ActiveGroupTitle = null;
public UUID agentCOF;
public byte CrossingFlags;
+ public byte CrossExtraFlags;
public Dictionary ChildrenCapSeeds = null;
public Animation[] Anims;
@@ -454,6 +455,8 @@ namespace OpenSim.Framework
args["agent_cof"] = OSD.FromUUID(agentCOF);
args["crossingflags"] = OSD.FromInteger(CrossingFlags);
+ if(CrossingFlags != 0)
+ args["crossExtraFlags"] = OSD.FromInteger(CrossExtraFlags);
args["active_group_id"] = OSD.FromUUID(ActiveGroupID);
args["active_group_name"] = OSD.FromString(ActiveGroupName);
@@ -646,6 +649,12 @@ namespace OpenSim.Framework
if (args.ContainsKey("crossingflags") && args["crossingflags"] != null)
CrossingFlags = (byte)args["crossingflags"].AsInteger();
+ if(CrossingFlags != 0)
+ {
+ if (args.ContainsKey("crossExtraFlags") && args["crossExtraFlags"] != null)
+ CrossExtraFlags = (byte)args["crossExtraFlags"].AsInteger();
+ }
+
if (args.ContainsKey("active_group_id") && args["active_group_id"] != null)
ActiveGroupID = args["active_group_id"].AsUUID();
diff --git a/OpenSim/Framework/Client/IClientIPEndpoint.cs b/OpenSim/Framework/Client/IClientIPEndpoint.cs
index 2b99bf0a99..2194616a02 100644
--- a/OpenSim/Framework/Client/IClientIPEndpoint.cs
+++ b/OpenSim/Framework/Client/IClientIPEndpoint.cs
@@ -34,6 +34,6 @@ namespace OpenSim.Framework.Client
{
public interface IClientIPEndpoint
{
- IPAddress EndPoint { get; }
+ IPEndPoint RemoteEndPoint { get; }
}
}
diff --git a/OpenSim/Framework/ClientInfo.cs b/OpenSim/Framework/ClientInfo.cs
index 98e4465cf8..a1ca9bc32b 100644
--- a/OpenSim/Framework/ClientInfo.cs
+++ b/OpenSim/Framework/ClientInfo.cs
@@ -36,14 +36,8 @@ namespace OpenSim.Framework
public readonly DateTime StartedTime = DateTime.Now;
public AgentCircuitData agentcircuit = null;
- public Dictionary needAck;
-
- public List out_packets = new List();
- public Dictionary pendingAcks = new Dictionary();
public EndPoint proxyEP;
- public uint sequence;
- public byte[] usecircuit;
public EndPoint userEP;
public int resendThrottle;
@@ -59,9 +53,5 @@ namespace OpenSim.Framework
public int targetThrottle;
public int maxThrottle;
-
- public Dictionary SyncRequests = new Dictionary();
- public Dictionary AsyncRequests = new Dictionary();
- public Dictionary GenericRequests = new Dictionary();
}
}
diff --git a/OpenSim/Framework/ClientManager.cs b/OpenSim/Framework/ClientManager.cs
index baff2f4354..45c54e4989 100644
--- a/OpenSim/Framework/ClientManager.cs
+++ b/OpenSim/Framework/ClientManager.cs
@@ -27,10 +27,8 @@
using System;
using System.Collections.Generic;
-using System.Reflection;
using System.Net;
using OpenMetaverse;
-using OpenMetaverse.Packets;
namespace OpenSim.Framework
{
@@ -76,20 +74,16 @@ namespace OpenSim.Framework
{
lock (m_syncRoot)
{
- if (m_dict1.ContainsKey(value.AgentId) || m_dict2.ContainsKey(value.RemoteEndPoint))
- return false;
+ // allow self healing
+// if (m_dict1.ContainsKey(value.AgentId) || m_dict2.ContainsKey(value.RemoteEndPoint))
+// return false;
m_dict1[value.AgentId] = value;
m_dict2[value.RemoteEndPoint] = value;
- IClientAPI[] oldArray = m_array;
- int oldLength = oldArray.Length;
-
- IClientAPI[] newArray = new IClientAPI[oldLength + 1];
- for (int i = 0; i < oldLength; i++)
- newArray[i] = oldArray[i];
- newArray[oldLength] = value;
-
+ // dict1 is the master
+ IClientAPI[] newArray = new IClientAPI[m_dict1.Count];
+ m_dict1.Values.CopyTo(newArray, 0);
m_array = newArray;
}
@@ -112,22 +106,12 @@ namespace OpenSim.Framework
m_dict1.Remove(key);
m_dict2.Remove(value.RemoteEndPoint);
- IClientAPI[] oldArray = m_array;
- int oldLength = oldArray.Length;
-
- IClientAPI[] newArray = new IClientAPI[oldLength - 1];
- int j = 0;
- for (int i = 0; i < oldLength; i++)
- {
- if (oldArray[i] != value)
- newArray[j++] = oldArray[i];
- }
-
+ IClientAPI[] newArray = new IClientAPI[m_dict1.Count];
+ m_dict1.Values.CopyTo(newArray, 0);
m_array = newArray;
return true;
}
}
-
return false;
}
@@ -196,26 +180,12 @@ namespace OpenSim.Framework
}
}
- ///
- /// Performs a given task in parallel for each of the elements in the
- /// collection
- ///
- /// Action to perform on each element
- public void ForEach(Action action)
- {
- IClientAPI[] localArray = m_array;
- Parallel.For(0, localArray.Length,
- delegate(int i)
- { action(localArray[i]); }
- );
- }
-
///
/// Performs a given task synchronously for each of the elements in
/// the collection
///
/// Action to perform on each element
- public void ForEachSync(Action action)
+ public void ForEach(Action action)
{
IClientAPI[] localArray = m_array;
for (int i = 0; i < localArray.Length; i++)
diff --git a/OpenSim/Framework/Console/LocalConsole.cs b/OpenSim/Framework/Console/LocalConsole.cs
index 73f0323874..ba32f5008e 100644
--- a/OpenSim/Framework/Console/LocalConsole.cs
+++ b/OpenSim/Framework/Console/LocalConsole.cs
@@ -46,6 +46,7 @@ namespace OpenSim.Framework.Console
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private string m_historyPath;
private bool m_historyEnable;
+ private bool m_historytimestamps;
// private readonly object m_syncRoot = new object();
private const string LOGLEVEL_NONE = "(none)";
@@ -98,15 +99,30 @@ namespace OpenSim.Framework.Console
string m_historyFile = startupConfig.GetString("ConsoleHistoryFile", "OpenSimConsoleHistory.txt");
int m_historySize = startupConfig.GetInt("ConsoleHistoryFileLines", 100);
m_historyPath = Path.GetFullPath(Path.Combine(Util.configDir(), m_historyFile));
- m_log.InfoFormat("[LOCAL CONSOLE]: Persistent command line history is Enabled, up to {0} lines from file {1}", m_historySize, m_historyPath);
+ m_historytimestamps = startupConfig.GetBoolean("ConsoleHistoryTimeStamp", false);
+ m_log.InfoFormat("[LOCAL CONSOLE]: Persistent command line history is Enabled, up to {0} lines from file {1} {2} timestamps",
+ m_historySize, m_historyPath, m_historytimestamps?"with":"without");
if (File.Exists(m_historyPath))
{
+ List originallines = new List();
using (StreamReader history_file = new StreamReader(m_historyPath))
{
string line;
while ((line = history_file.ReadLine()) != null)
{
+ originallines.Add(line);
+ if(line.StartsWith("["))
+ {
+ int indx = line.IndexOf("]:> ");
+ if(indx > 0)
+ {
+ if(indx + 4 >= line.Length)
+ line = String.Empty;
+ else
+ line = line.Substring(indx + 4);
+ }
+ }
m_history.Add(line);
}
}
@@ -114,11 +130,14 @@ namespace OpenSim.Framework.Console
if (m_history.Count > m_historySize)
{
while (m_history.Count > m_historySize)
+ {
m_history.RemoveAt(0);
+ originallines.RemoveAt(0);
+ }
using (StreamWriter history_file = new StreamWriter(m_historyPath))
{
- foreach (string line in m_history)
+ foreach (string line in originallines)
{
history_file.WriteLine(line);
}
@@ -141,6 +160,8 @@ namespace OpenSim.Framework.Console
m_history.Add(text);
if (m_historyEnable)
{
+ if (m_historytimestamps)
+ text = String.Format("[{0} {1}]:> {2}", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), text);
File.AppendAllText(m_historyPath, text + Environment.NewLine);
}
}
diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs
index f59c9024be..b90b75f2df 100644
--- a/OpenSim/Framework/Console/RemoteConsole.cs
+++ b/OpenSim/Framework/Console/RemoteConsole.cs
@@ -403,7 +403,7 @@ namespace OpenSim.Framework.Console
string uri = "/ReadResponses/" + sessionID.ToString() + "/";
m_Server.AddPollServiceHTTPHandler(
- uri, new PollServiceEventArgs(null, uri, HasEvents, GetEvents, NoEvents, sessionID,25000)); // 25 secs timeout
+ uri, new PollServiceEventArgs(null, uri, HasEvents, GetEvents, NoEvents, null, sessionID,25000)); // 25 secs timeout
// Our reply is an XML document.
// TODO: Change this to Linq.Xml
@@ -687,7 +687,6 @@ namespace OpenSim.Framework.Console
result["int_response_code"] = 200;
result["content_type"] = "application/xml";
result["keepalive"] = false;
- result["reusecontext"] = false;
result = CheckOrigin(result);
return result;
@@ -713,7 +712,6 @@ namespace OpenSim.Framework.Console
result["int_response_code"] = 200;
result["content_type"] = "text/xml";
result["keepalive"] = false;
- result["reusecontext"] = false;
result = CheckOrigin(result);
return result;
diff --git a/OpenSim/Framework/Crc32.cs b/OpenSim/Framework/Crc32.cs
new file mode 100644
index 0000000000..7ad156646f
--- /dev/null
+++ b/OpenSim/Framework/Crc32.cs
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Security.Cryptography;
+
+namespace OpenSim.Framework
+{
+ // this is more generic than openmetaverse CRC32
+
+ public class Crc32 : HashAlgorithm
+ {
+ public const UInt32 DefaultPolynomial = 0xedb88320;
+ public const UInt32 DefaultSeed = 0xffffffff;
+
+ private UInt32 hash;
+ private UInt32 seed;
+ private UInt32[] table;
+ private static UInt32[] defaultTable;
+
+ public Crc32()
+ {
+ table = InitializeTable(DefaultPolynomial);
+ seed = DefaultSeed;
+ Initialize();
+ }
+
+ public Crc32(UInt32 polynomial, UInt32 seed)
+ {
+ table = InitializeTable(polynomial);
+ this.seed = seed;
+ Initialize();
+ }
+
+ public override void Initialize()
+ {
+ hash = seed;
+ }
+
+ protected override void HashCore(byte[] buffer, int start, int length)
+ {
+ hash = CalculateHash(table, hash, buffer, start, length);
+ }
+
+ protected override byte[] HashFinal()
+ {
+ byte[] hashBuffer = UInt32ToBigEndianBytes(~hash);
+ this.HashValue = hashBuffer;
+ return hashBuffer;
+ }
+
+ public override int HashSize
+ {
+ get { return 32; }
+ }
+
+ public static UInt32 Compute(byte[] buffer)
+ {
+ return ~CalculateHash(InitializeTable(DefaultPolynomial), DefaultSeed, buffer, 0, buffer.Length);
+ }
+
+ public static UInt32 Compute(UInt32 seed, byte[] buffer)
+ {
+ return ~CalculateHash(InitializeTable(DefaultPolynomial), seed, buffer, 0, buffer.Length);
+ }
+
+ public static UInt32 Compute(UInt32 polynomial, UInt32 seed, byte[] buffer)
+ {
+ return ~CalculateHash(InitializeTable(polynomial), seed, buffer, 0, buffer.Length);
+ }
+
+ private static UInt32[] InitializeTable(UInt32 polynomial)
+ {
+ if (polynomial == DefaultPolynomial && defaultTable != null)
+ return defaultTable;
+
+ UInt32[] createTable = new UInt32[256];
+ for (int i = 0; i < 256; i++)
+ {
+ UInt32 entry = (UInt32)i;
+ for (int j = 0; j < 8; j++)
+ if ((entry & 1) == 1)
+ entry = (entry >> 1) ^ polynomial;
+ else
+ entry = entry >> 1;
+ createTable[i] = entry;
+ }
+
+ if (polynomial == DefaultPolynomial)
+ defaultTable = createTable;
+
+ return createTable;
+ }
+
+ private static UInt32 CalculateHash(UInt32[] table, UInt32 seed, byte[] buffer, int start, int size)
+ {
+ UInt32 crc = seed;
+ for (int i = start; i < size; i++)
+ unchecked
+ {
+ crc = (crc >> 8) ^ table[buffer[i] ^ crc & 0xff];
+ }
+ return crc;
+ }
+
+ private byte[] UInt32ToBigEndianBytes(UInt32 x)
+ {
+ return new byte[] {
+ (byte)((x >> 24) & 0xff),
+ (byte)((x >> 16) & 0xff),
+ (byte)((x >> 8) & 0xff),
+ (byte)(x & 0xff) };
+ }
+ }
+}
diff --git a/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs b/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs
index 55ec13e5d3..816523b770 100644
--- a/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs
+++ b/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs
@@ -74,21 +74,19 @@ namespace OpenSim.Framework
{
rwLock.EnterWriteLock();
gotLock = true;
+ if (Dictionary1.ContainsKey(key1))
+ {
+ if (!Dictionary2.ContainsKey(key2))
+ throw new ArgumentException("key1 exists in the dictionary but not key2");
+ }
+ else if (Dictionary2.ContainsKey(key2))
+ {
+ if (!Dictionary1.ContainsKey(key1))
+ throw new ArgumentException("key2 exists in the dictionary but not key1");
+ }
+ Dictionary1[key1] = value;
+ Dictionary2[key2] = value;
}
-
- if (Dictionary1.ContainsKey(key1))
- {
- if (!Dictionary2.ContainsKey(key2))
- throw new ArgumentException("key1 exists in the dictionary but not key2");
- }
- else if (Dictionary2.ContainsKey(key2))
- {
- if (!Dictionary1.ContainsKey(key1))
- throw new ArgumentException("key2 exists in the dictionary but not key1");
- }
-
- Dictionary1[key1] = value;
- Dictionary2[key2] = value;
}
finally
{
@@ -112,10 +110,9 @@ namespace OpenSim.Framework
{
rwLock.EnterWriteLock();
gotLock = true;
+ Dictionary1.Remove(key1);
+ success = Dictionary2.Remove(key2);
}
-
- Dictionary1.Remove(key1);
- success = Dictionary2.Remove(key2);
}
finally
{
@@ -151,8 +148,12 @@ namespace OpenSim.Framework
{
if (kvp.Value.Equals(value))
{
- Dictionary1.Remove(key1);
- Dictionary2.Remove(kvp.Key);
+ try { }
+ finally
+ {
+ Dictionary1.Remove(key1);
+ Dictionary2.Remove(kvp.Key);
+ }
found = true;
break;
}
@@ -193,8 +194,12 @@ namespace OpenSim.Framework
{
if (kvp.Value.Equals(value))
{
- Dictionary2.Remove(key2);
- Dictionary1.Remove(kvp.Key);
+ try { }
+ finally
+ {
+ Dictionary2.Remove(key2);
+ Dictionary1.Remove(kvp.Key);
+ }
found = true;
break;
}
@@ -224,10 +229,9 @@ namespace OpenSim.Framework
{
rwLock.EnterWriteLock();
gotLock = true;
+ Dictionary1.Clear();
+ Dictionary2.Clear();
}
-
- Dictionary1.Clear();
- Dictionary2.Clear();
}
finally
{
@@ -485,15 +489,15 @@ namespace OpenSim.Framework
try {}
finally
{
- rwLock.EnterUpgradeableReadLock();
+ rwLock.EnterWriteLock();
gotWriteLock = true;
+
+ for (int i = 0; i < list.Count; i++)
+ Dictionary1.Remove(list[i]);
+
+ for (int i = 0; i < list2.Count; i++)
+ Dictionary2.Remove(list2[i]);
}
-
- for (int i = 0; i < list.Count; i++)
- Dictionary1.Remove(list[i]);
-
- for (int i = 0; i < list2.Count; i++)
- Dictionary2.Remove(list2[i]);
}
finally
{
diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs
index 7134cbf825..1b5ebfaafb 100644
--- a/OpenSim/Framework/EstateSettings.cs
+++ b/OpenSim/Framework/EstateSettings.cs
@@ -44,7 +44,6 @@ namespace OpenSim.Framework
// Only the client uses these
//
private uint m_EstateID = 0;
-
public uint EstateID
{
get { return m_EstateID; }
@@ -52,7 +51,6 @@ namespace OpenSim.Framework
}
private string m_EstateName = "My Estate";
-
public string EstateName
{
get { return m_EstateName; }
@@ -60,7 +58,6 @@ namespace OpenSim.Framework
}
private bool m_AllowLandmark = true;
-
public bool AllowLandmark
{
get { return m_AllowLandmark; }
@@ -68,7 +65,6 @@ namespace OpenSim.Framework
}
private bool m_AllowParcelChanges = true;
-
public bool AllowParcelChanges
{
get { return m_AllowParcelChanges; }
@@ -76,7 +72,6 @@ namespace OpenSim.Framework
}
private bool m_AllowSetHome = true;
-
public bool AllowSetHome
{
get { return m_AllowSetHome; }
@@ -84,7 +79,6 @@ namespace OpenSim.Framework
}
private uint m_ParentEstateID = 1;
-
public uint ParentEstateID
{
get { return m_ParentEstateID; }
@@ -92,7 +86,6 @@ namespace OpenSim.Framework
}
private float m_BillableFactor = 0.0f;
-
public float BillableFactor
{
get { return m_BillableFactor; }
@@ -100,7 +93,6 @@ namespace OpenSim.Framework
}
private int m_PricePerMeter = 1;
-
public int PricePerMeter
{
get { return m_PricePerMeter; }
@@ -108,7 +100,6 @@ namespace OpenSim.Framework
}
private int m_RedirectGridX = 0;
-
public int RedirectGridX
{
get { return m_RedirectGridX; }
@@ -116,7 +107,6 @@ namespace OpenSim.Framework
}
private int m_RedirectGridY = 0;
-
public int RedirectGridY
{
get { return m_RedirectGridY; }
@@ -126,7 +116,6 @@ namespace OpenSim.Framework
// Used by the sim
//
private bool m_UseGlobalTime = true;
-
public bool UseGlobalTime
{
get { return m_UseGlobalTime; }
@@ -134,7 +123,6 @@ namespace OpenSim.Framework
}
private bool m_FixedSun = false;
-
public bool FixedSun
{
get { return m_FixedSun; }
@@ -142,7 +130,6 @@ namespace OpenSim.Framework
}
private double m_SunPosition = 0.0;
-
public double SunPosition
{
get { return m_SunPosition; }
@@ -150,7 +137,6 @@ namespace OpenSim.Framework
}
private bool m_AllowVoice = true;
-
public bool AllowVoice
{
get { return m_AllowVoice; }
@@ -158,7 +144,6 @@ namespace OpenSim.Framework
}
private bool m_AllowDirectTeleport = true;
-
public bool AllowDirectTeleport
{
get { return m_AllowDirectTeleport; }
@@ -166,23 +151,22 @@ namespace OpenSim.Framework
}
private bool m_DenyAnonymous = false;
-
public bool DenyAnonymous
{
get { return m_DenyAnonymous; }
set { m_DenyAnonymous = value; }
}
+ // no longer in used, may be reassigned
private bool m_DenyIdentified = false;
-
public bool DenyIdentified
{
get { return m_DenyIdentified; }
set { m_DenyIdentified = value; }
}
+ // no longer in used, may be reassigned
private bool m_DenyTransacted = false;
-
public bool DenyTransacted
{
get { return m_DenyTransacted; }
@@ -190,7 +174,6 @@ namespace OpenSim.Framework
}
private bool m_AbuseEmailToEstateOwner = false;
-
public bool AbuseEmailToEstateOwner
{
get { return m_AbuseEmailToEstateOwner; }
@@ -198,7 +181,6 @@ namespace OpenSim.Framework
}
private bool m_BlockDwell = false;
-
public bool BlockDwell
{
get { return m_BlockDwell; }
@@ -206,7 +188,6 @@ namespace OpenSim.Framework
}
private bool m_EstateSkipScripts = false;
-
public bool EstateSkipScripts
{
get { return m_EstateSkipScripts; }
@@ -214,7 +195,6 @@ namespace OpenSim.Framework
}
private bool m_ResetHomeOnTeleport = false;
-
public bool ResetHomeOnTeleport
{
get { return m_ResetHomeOnTeleport; }
@@ -222,15 +202,13 @@ namespace OpenSim.Framework
}
private bool m_TaxFree = false;
-
- public bool TaxFree
+ public bool TaxFree // this is now AllowAccessOverride, keeping same name to reuse DB entries
{
get { return m_TaxFree; }
set { m_TaxFree = value; }
}
private bool m_PublicAccess = true;
-
public bool PublicAccess
{
get { return m_PublicAccess; }
@@ -246,7 +224,6 @@ namespace OpenSim.Framework
}
private UUID m_EstateOwner = UUID.Zero;
-
public UUID EstateOwner
{
get { return m_EstateOwner; }
@@ -254,7 +231,6 @@ namespace OpenSim.Framework
}
private bool m_DenyMinors = false;
-
public bool DenyMinors
{
get { return m_DenyMinors; }
@@ -280,7 +256,6 @@ namespace OpenSim.Framework
}
private List l_EstateAccess = new List();
-
public UUID[] EstateAccess
{
get { return l_EstateAccess.ToArray(); }
@@ -288,13 +263,15 @@ namespace OpenSim.Framework
}
private List l_EstateGroups = new List();
-
public UUID[] EstateGroups
{
get { return l_EstateGroups.ToArray(); }
set { l_EstateGroups = new List(value); }
}
+ public bool DoDenyMinors = true;
+ public bool DoDenyAnonymous = true;
+
public EstateSettings()
{
}
@@ -402,14 +379,14 @@ namespace OpenSim.Framework
if (!HasAccess(avatarID))
{
- if (DenyMinors)
+ if (DoDenyMinors && DenyMinors)
{
if ((userFlags & 32) == 0)
{
return true;
}
}
- if (DenyAnonymous)
+ if (DoDenyAnonymous && DenyAnonymous)
{
if ((userFlags & 4) == 0)
{
@@ -572,14 +549,41 @@ namespace OpenSim.Framework
// EstateBans are special
if (map.ContainsKey("EstateBans"))
- {
- var banData = ((Dictionary)map["EstateBans"]).Values;
- EstateBan[] bans = new EstateBan[banData.Count];
- int b = 0;
- foreach (Dictionary ban in banData)
- bans[b++] = new EstateBan(ban);
- PropertyInfo bansProperty = this.GetType().GetProperty("EstateBans", BindingFlags.Public | BindingFlags.Instance);
- bansProperty.SetValue(this, bans, null);
+ {
+ if(map["EstateBans"] is string)
+ {
+ // JSON encoded bans map
+ Dictionary bdata = new Dictionary();
+ try
+ {
+ // bypass libovm, we dont need even more useless high level maps
+ // this should only be called once.. but no problem, i hope
+ // (other uses may need more..)
+ LitJson.JsonMapper.RegisterImporter((input) => new UUID(input));
+ bdata = LitJson.JsonMapper.ToObject>((string)map["EstateBans"]);
+ }
+ // catch(Exception e)
+ catch
+ {
+ return;
+ }
+ EstateBan[] jbans = new EstateBan[bdata.Count];
+ bdata.Values.CopyTo(jbans,0);
+
+ PropertyInfo jbansProperty = this.GetType().GetProperty("EstateBans", BindingFlags.Public | BindingFlags.Instance);
+ jbansProperty.SetValue(this, jbans, null);
+ }
+ else
+ {
+ var banData = ((Dictionary)map["EstateBans"]).Values;
+ EstateBan[] bans = new EstateBan[banData.Count];
+
+ int b = 0;
+ foreach (Dictionary ban in banData)
+ bans[b++] = new EstateBan(ban);
+ PropertyInfo bansProperty = this.GetType().GetProperty("EstateBans", BindingFlags.Public | BindingFlags.Instance);
+ bansProperty.SetValue(this, bans, null);
+ }
}
}
}
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index ab6d58fb05..f8bf583fad 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -443,7 +443,7 @@ namespace OpenSim.Framework
public delegate void DeclineCallingCard(IClientAPI remoteClient, UUID transactionID);
public delegate void SoundTrigger(
- UUID soundId, UUID ownerid, UUID objid, UUID parentid, double Gain, Vector3 Position, UInt64 Handle, float radius);
+ UUID soundId, UUID ownerid, UUID objid, UUID parentid, double Gain, Vector3 Position, UInt64 Handle);
public delegate void StartLure(byte lureType, string message, UUID targetID, IClientAPI client);
public delegate void TeleportLureRequest(UUID lureID, uint teleportFlags, IClientAPI client);
@@ -685,9 +685,10 @@ namespace OpenSim.Framework
ExtraData = 1 << 20,
Sound = 1 << 21,
Joint = 1 << 22,
- FullUpdate = 0x3fffffff,
- CancelKill = 0x7fffffff,
- Kill = 0x80000000
+ FullUpdate = 0x0fffffff,
+ SendInTransit = 0x20000000,
+ CancelKill = 0x4fffffff, // 1 << 30
+ Kill = 0x80000000 // 1 << 31
}
/* included in .net 4.0
@@ -1187,7 +1188,8 @@ namespace OpenSim.Framework
void SetAgentThrottleSilent(int throttle, int setting);
int GetAgentThrottleSilent(int throttle);
- void SendAvatarDataImmediate(ISceneEntity avatar);
+ void SendEntityFullUpdateImmediate(ISceneEntity entity);
+ void SendEntityTerseUpdateImmediate(ISceneEntity entity);
///
/// Send a positional, velocity, etc. update to the viewer for a given entity.
@@ -1483,7 +1485,7 @@ namespace OpenSim.Framework
void SendUserInfoReply(bool imViaEmail, bool visible, string email);
void SendUseCachedMuteList();
-
+ void SendEmpytMuteList();
void SendMuteListUpdate(string filename);
void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals);
diff --git a/OpenSim/Framework/ILandChannel.cs b/OpenSim/Framework/ILandChannel.cs
index 44a24b94a3..e5ea596327 100644
--- a/OpenSim/Framework/ILandChannel.cs
+++ b/OpenSim/Framework/ILandChannel.cs
@@ -33,6 +33,8 @@ namespace OpenSim.Region.Framework.Interfaces
{
public interface ILandChannel
{
+
+ float BanLineSafeHeight {get;}
///
/// Get all parcels
///
@@ -76,6 +78,8 @@ namespace OpenSim.Region.Framework.Interfaces
///
ILandObject GetLandObject(int localID);
+ ILandObject GetLandObject(UUID GlobalID);
+
///
/// Clear the land channel of all parcels.
///
@@ -86,6 +90,7 @@ namespace OpenSim.Region.Framework.Interfaces
bool IsForcefulBansAllowed();
void UpdateLandObject(int localID, LandData data);
+ void SendParcelsOverlay(IClientAPI client);
void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient);
void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel);
void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel);
@@ -94,6 +99,5 @@ namespace OpenSim.Region.Framework.Interfaces
void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id);
void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id);
void sendClientInitialLandInfo(IClientAPI remoteClient);
-
}
}
diff --git a/OpenSim/Framework/ILandObject.cs b/OpenSim/Framework/ILandObject.cs
index f3b850d528..a7832568a2 100644
--- a/OpenSim/Framework/ILandObject.cs
+++ b/OpenSim/Framework/ILandObject.cs
@@ -189,5 +189,7 @@ namespace OpenSim.Framework
///
/// The music url.
string GetMusicUrl();
+
+ void Clear();
}
}
diff --git a/OpenSim/Framework/IMoneyModule.cs b/OpenSim/Framework/IMoneyModule.cs
index be454385db..c72c742151 100644
--- a/OpenSim/Framework/IMoneyModule.cs
+++ b/OpenSim/Framework/IMoneyModule.cs
@@ -41,6 +41,7 @@ namespace OpenSim.Framework
void ApplyCharge(UUID agentID, int amount, MoneyTransactionType type, string extraData = "");
void ApplyUploadCharge(UUID agentID, int amount, string text);
void MoveMoney(UUID fromUser, UUID toUser, int amount, string text);
+ bool MoveMoney(UUID fromUser, UUID toUser, int amount, MoneyTransactionType type, string text);
int UploadCharge { get; }
int GroupCreationCharge { get; }
diff --git a/OpenSim/Framework/InventoryItemBase.cs b/OpenSim/Framework/InventoryItemBase.cs
index c359a0cca3..b7f27bdade 100644
--- a/OpenSim/Framework/InventoryItemBase.cs
+++ b/OpenSim/Framework/InventoryItemBase.cs
@@ -26,6 +26,7 @@
*/
using System;
+using System.Text;
using OpenMetaverse;
namespace OpenSim.Framework
@@ -415,5 +416,40 @@ namespace OpenSim.Framework
{
return MemberwiseClone();
}
+
+ public void ToLLSDxml(StringBuilder lsl)
+ {
+ LLSDxmlEncode.AddMap(lsl);
+ LLSDxmlEncode.AddElem("parent_id", Folder, lsl);
+ LLSDxmlEncode.AddElem("asset_id", AssetID, lsl);
+ LLSDxmlEncode.AddElem("item_id", ID, lsl);
+
+ LLSDxmlEncode.AddMap("permissions",lsl);
+ LLSDxmlEncode.AddElem("creator_id", CreatorIdAsUuid, lsl);
+ LLSDxmlEncode.AddElem("owner_id", Owner, lsl);
+ LLSDxmlEncode.AddElem("group_id", GroupID, lsl);
+ LLSDxmlEncode.AddElem("base_mask", (int)CurrentPermissions, lsl);
+ LLSDxmlEncode.AddElem("owner_mask", (int)CurrentPermissions, lsl);
+ LLSDxmlEncode.AddElem("group_mask", (int)GroupPermissions, lsl);
+ LLSDxmlEncode.AddElem("everyone_mask", (int)EveryOnePermissions, lsl);
+ LLSDxmlEncode.AddElem("next_owner_mask", (int)NextPermissions, lsl);
+ LLSDxmlEncode.AddElem("is_owner_group", GroupOwned, lsl);
+ LLSDxmlEncode.AddEndMap(lsl);
+
+ LLSDxmlEncode.AddElem("type", AssetType, lsl);
+ LLSDxmlEncode.AddElem("inv_type", InvType, lsl);
+ LLSDxmlEncode.AddElem("flags", ((int)Flags) & 0xff, lsl);
+
+ LLSDxmlEncode.AddMap("sale_info",lsl);
+ LLSDxmlEncode.AddElem("sale_price", SalePrice, lsl);
+ LLSDxmlEncode.AddElem("sale_type", SaleType, lsl);
+ LLSDxmlEncode.AddEndMap(lsl);
+
+ LLSDxmlEncode.AddElem("name", Name, lsl);
+ LLSDxmlEncode.AddElem("desc", Description, lsl);
+ LLSDxmlEncode.AddElem("created_at", CreationDate, lsl);
+
+ LLSDxmlEncode.AddEndMap(lsl);
+ }
}
}
diff --git a/OpenSim/Framework/LLSDxmlEncode.cs b/OpenSim/Framework/LLSDxmlEncode.cs
new file mode 100644
index 0000000000..ed5c4db284
--- /dev/null
+++ b/OpenSim/Framework/LLSDxmlEncode.cs
@@ -0,0 +1,725 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// a class for low level LLSD encoding into a provided StringBuilder
+// for cases where we already need to know the low level detail
+// and so using something like OSD or even protbuf is just a pure waste
+
+using System;
+using System.Globalization;
+using System.Text;
+using OpenMetaverse;
+
+namespace OpenSim.Framework
+{
+ public static class LLSDxmlEncode
+ {
+ static readonly DateTime depoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
+
+ public static void AddStart(StringBuilder sb, bool addxmlversion = false)
+ {
+ if(addxmlversion)
+ sb.Append(""); // legacy llsd xml name still valid
+ else
+ sb.Append("");
+ }
+
+ // got tired of creating a stringbuilder all the time;
+ public static StringBuilder Start(int size = 256, bool addxmlversion = false)
+ {
+ StringBuilder sb = new StringBuilder(size);
+ if(addxmlversion)
+ sb.Append(""); // legacy llsd xml name still valid
+ else
+ sb.Append("");
+ return sb;
+ }
+
+ public static void AddEnd(StringBuilder sb)
+ {
+ sb.Append("");
+ }
+
+ public static string End(StringBuilder sb)
+ {
+ sb.Append("");
+ return sb.ToString();
+ }
+
+ // map == a list of key value pairs
+ public static void AddMap(StringBuilder sb)
+ {
+ sb.Append("");
+ }
+
+ public static void AddEndMap(StringBuilder sb)
+ {
+ sb.Append("");
+ }
+
+ public static void AddEmptyMap(StringBuilder sb)
+ {
+ sb.Append("");
+ }
+
+ // array == a list values
+ public static void AddArray(StringBuilder sb)
+ {
+ sb.Append("");
+ }
+
+ public static void AddEndArray(StringBuilder sb)
+ {
+ sb.Append("");
+ }
+
+ public static void AddEmptyArray(StringBuilder sb)
+ {
+ sb.Append("");
+ }
+
+ // undefined or null
+ public static void AddUnknownElem(StringBuilder sb)
+ {
+ sb.Append("");
+ }
+
+ public static void AddElem(bool e, StringBuilder sb)
+ {
+ if(e)
+ sb.Append("1");
+ else
+ sb.Append("");
+ }
+
+ public static void AddElem(byte e, StringBuilder sb)
+ {
+ if(e == 0)
+ sb.Append("");
+ else
+ {
+ sb.Append("");
+ sb.Append(e.ToString());
+ sb.Append("");
+ }
+ }
+
+ public static void AddElem(byte[] e, StringBuilder sb)
+ {
+ if(e == null || e.Length == 0)
+ sb.Append("binary />");
+ else
+ {
+ sb.Append(""); // encode64 is default
+ sb.Append(Convert.ToBase64String(e,Base64FormattingOptions.None));
+ sb.Append("");
+ }
+ }
+
+ public static void AddElem(int e, StringBuilder sb)
+ {
+ if(e == 0)
+ sb.Append("");
+ else
+ {
+ sb.Append("");
+ sb.Append(e.ToString());
+ sb.Append("");
+ }
+ }
+
+ public static void AddElem(float e, StringBuilder sb)
+ {
+ if(e == 0)
+ sb.Append("");
+ else
+ {
+ sb.Append("");
+ sb.Append(e.ToString(CultureInfo.InvariantCulture));
+ sb.Append("");
+ }
+ }
+
+ public static void AddElem(Vector2 e, StringBuilder sb)
+ {
+ sb.Append("x");
+
+ if(e.X == 0)
+ sb.Append("y");
+ else
+ {
+ sb.Append("");
+ sb.Append(e.X.ToString(CultureInfo.InvariantCulture));
+ sb.Append("y");
+ }
+
+ if(e.Y == 0)
+ sb.Append("");
+ else
+ {
+ sb.Append("");
+ sb.Append(e.Y.ToString(CultureInfo.InvariantCulture));
+ sb.Append("");
+ }
+ }
+
+ public static void AddElem(Vector3 e, StringBuilder sb)
+ {
+ sb.Append("key>x");
+
+ if(e.X == 0)
+ sb.Append("y");
+ else
+ {
+ sb.Append("");
+ sb.Append(e.X.ToString(CultureInfo.InvariantCulture));
+ sb.Append("y");
+ }
+
+ if(e.Y == 0)
+ sb.Append("z");
+ else
+ {
+ sb.Append("");
+ sb.Append(e.Y.ToString(CultureInfo.InvariantCulture));
+ sb.Append("z");
+ }
+
+ if(e.Z == 0)
+ sb.Append("");
+ else
+ {
+ sb.Append("");
+ sb.Append(e.Z.ToString(CultureInfo.InvariantCulture));
+ sb.Append("");
+ }
+ }
+
+ public static void AddElem(Quaternion e, StringBuilder sb)
+ {
+ sb.Append("x");
+
+ if(e.X == 0)
+ sb.Append("y");
+ else
+ {
+ sb.Append("");
+ sb.Append(e.X.ToString(CultureInfo.InvariantCulture));
+ sb.Append("y");
+ }
+
+ if(e.Y == 0)
+ sb.Append("z");
+ else
+ {
+ sb.Append("");
+ sb.Append(e.Y.ToString(CultureInfo.InvariantCulture));
+ sb.Append("z");
+ }
+ if(e.Z == 0)
+ sb.Append("w");
+ else
+ {
+ sb.Append("");
+ sb.Append(e.Z.ToString(CultureInfo.InvariantCulture));
+ sb.Append("w");
+ }
+
+ if(e.W == 0)
+ sb.Append("");
+ else
+ {
+ sb.Append("");
+ sb.Append(e.W.ToString(CultureInfo.InvariantCulture));
+ sb.Append("");
+ }
+ }
+
+ public static void AddElem(double e, StringBuilder sb)
+ {
+ if(e == 0)
+ sb.Append("");
+ else
+ {
+ sb.Append("");
+ sb.Append(e.ToString(CultureInfo.InvariantCulture));
+ sb.Append("");
+ }
+ }
+
+ public static void AddElem(UUID e, StringBuilder sb)
+ {
+ if(e == UUID.Zero)
+ sb.Append("");
+ else
+ {
+ sb.Append("");
+ EscapeToXML(e.ToString(), sb);
+ sb.Append("");
+ }
+ }
+
+ public static void AddElem(string e, StringBuilder sb)
+ {
+ if(String.IsNullOrEmpty(e))
+ sb.Append("");
+ else
+ {
+ sb.Append("");
+ EscapeToXML(e.ToString(), sb);
+ sb.Append("");
+ }
+ }
+
+ public static void AddRawElem(string e, StringBuilder sb)
+ {
+ if(String.IsNullOrEmpty(e))
+ sb.Append("");
+ else
+ {
+ sb.Append("");
+ sb.Append(e);
+ sb.Append("");
+ }
+ }
+
+ public static void AddElem(Uri e, StringBuilder sb)
+ {
+ if(e == null)
+ {
+ sb.Append("");
+ return;
+ }
+
+ string s;
+ if (e.IsAbsoluteUri)
+ s = e.AbsoluteUri;
+ else
+ s = e.ToString();
+
+ if(String.IsNullOrEmpty(s))
+ sb.Append("");
+ else
+ {
+ sb.Append("");
+ sb.Append(s);
+ sb.Append("");
+ }
+ }
+
+ public static void AddElem(DateTime e, StringBuilder sb)
+ {
+ DateTime u = e.ToUniversalTime();
+ if(u == depoch)
+ {
+ sb.Append("");
+ return;
+ }
+ string format;
+ if(u.Hour == 0 && u.Minute == 0 && u.Second == 0)
+ format = "yyyy-MM-dd";
+ else if (u.Millisecond > 0)
+ format = "yyyy-MM-ddTHH:mm:ss.ffZ";
+ else
+ format = "yyyy-MM-ddTHH:mm:ssZ";
+ sb.Append("");
+ sb.Append(u.ToString(format,CultureInfo.InvariantCulture));
+ sb.Append("");
+ }
+
+//************ key value *******************
+// assumes name is a valid llsd key
+
+ public static void AddMap(string name, StringBuilder sb)
+ {
+ sb.Append("");
+ sb.Append(name);
+ sb.Append("");
+ }
+
+ public static void AddEmptyMap(string name, StringBuilder sb)
+ {
+ sb.Append("");
+ sb.Append(name);
+ sb.Append("");
+ }
+
+ // array == a list values
+ public static void AddArray(string name, StringBuilder sb)
+ {
+ sb.Append("");
+ sb.Append(name);
+ sb.Append("");
+ }
+
+ public static void AddEmptyArray(string name, StringBuilder sb)
+ {
+ sb.Append("");
+ sb.Append(name);
+ sb.Append("");
+ }
+
+ // undefined or null
+ public static void AddUnknownElem(string name, StringBuilder sb)
+ {
+ sb.Append("");
+ sb.Append(name);
+ sb.Append("");
+ }
+
+ public static void AddElem(string name, bool e, StringBuilder sb)
+ {
+ sb.Append("");
+ sb.Append(name);
+ sb.Append("");
+
+ if(e)
+ sb.Append("1");
+ else
+ sb.Append("");
+ }
+
+ public static void AddElem(string name, byte e, StringBuilder sb)
+ {
+ sb.Append("");
+ sb.Append(name);
+ sb.Append("");
+
+ if(e == 0)
+ sb.Append("");
+ else
+ {
+ sb.Append("");
+ sb.Append(e.ToString());
+ sb.Append("");
+ }
+ }
+
+ public static void AddElem(string name, byte[] e, StringBuilder sb)
+ {
+ sb.Append("");
+ sb.Append(name);
+ sb.Append("");
+
+ if(e == null || e.Length == 0)
+ sb.Append("binary />");
+ else
+ {
+ sb.Append(""); // encode64 is default
+ sb.Append(Convert.ToBase64String(e,Base64FormattingOptions.None));
+ sb.Append("");
+ }
+ }
+
+ public static void AddElem(string name, int e, StringBuilder sb)
+ {
+ sb.Append("");
+ sb.Append(name);
+ sb.Append("");
+
+ if(e == 0)
+ sb.Append("");
+ else
+ {
+ sb.Append("");
+ sb.Append(e.ToString());
+ sb.Append("");
+ }
+ }
+
+ public static void AddElem(string name, float e, StringBuilder sb)
+ {
+ sb.Append("");
+ sb.Append(name);
+ sb.Append("");
+
+ if(e == 0)
+ sb.Append("");
+ else
+ {
+ sb.Append("");
+ sb.Append(e.ToString(CultureInfo.InvariantCulture));
+ sb.Append("");
+ }
+ }
+
+ public static void AddElem(string name, Vector2 e, StringBuilder sb)
+ {
+ sb.Append("");
+ sb.Append(name);
+ sb.Append("x");
+
+ if(e.X == 0)
+ sb.Append("y");
+ else
+ {
+ sb.Append("");
+ sb.Append(e.X.ToString(CultureInfo.InvariantCulture));
+ sb.Append("y");
+ }
+
+ if(e.Y == 0)
+ sb.Append("");
+ else
+ {
+ sb.Append("");
+ sb.Append(e.Y.ToString(CultureInfo.InvariantCulture));
+ sb.Append("");
+ }
+ }
+
+ public static void AddElem(string name, Vector3 e, StringBuilder sb)
+ {
+ sb.Append("");
+ sb.Append(name);
+ sb.Append("key>x");
+
+ if(e.X == 0)
+ sb.Append("y");
+ else
+ {
+ sb.Append("");
+ sb.Append(e.X.ToString(CultureInfo.InvariantCulture));
+ sb.Append("y");
+ }
+
+ if(e.Y == 0)
+ sb.Append("z");
+ else
+ {
+ sb.Append("");
+ sb.Append(e.Y.ToString(CultureInfo.InvariantCulture));
+ sb.Append("z");
+ }
+
+ if(e.Z == 0)
+ sb.Append("");
+ else
+ {
+ sb.Append("");
+ sb.Append(e.Z.ToString(CultureInfo.InvariantCulture));
+ sb.Append("");
+ }
+ }
+
+ public static void AddElem(string name, Quaternion e, StringBuilder sb)
+ {
+ sb.Append("");
+ sb.Append(name);
+ sb.Append("x");
+
+ if(e.X == 0)
+ sb.Append("y");
+ else
+ {
+ sb.Append("");
+ sb.Append(e.X.ToString(CultureInfo.InvariantCulture));
+ sb.Append("y");
+ }
+
+ if(e.Y == 0)
+ sb.Append("z");
+ else
+ {
+ sb.Append("");
+ sb.Append(e.Y.ToString(CultureInfo.InvariantCulture));
+ sb.Append("z");
+ }
+ if(e.Z == 0)
+ sb.Append("w");
+ else
+ {
+ sb.Append("");
+ sb.Append(e.Z.ToString(CultureInfo.InvariantCulture));
+ sb.Append("w");
+ }
+
+ if(e.W == 0)
+ sb.Append("");
+ else
+ {
+ sb.Append("");
+ sb.Append(e.W.ToString(CultureInfo.InvariantCulture));
+ sb.Append("");
+ }
+ }
+
+ public static void AddElem(string name, double e, StringBuilder sb)
+ {
+ sb.Append("");
+ sb.Append(name);
+ sb.Append("");
+
+ if(e == 0)
+ sb.Append("");
+ else
+ {
+ sb.Append("");
+ sb.Append(e.ToString(CultureInfo.InvariantCulture));
+ sb.Append("");
+ }
+ }
+
+ public static void AddElem(string name, UUID e, StringBuilder sb)
+ {
+ sb.Append("");
+ sb.Append(name);
+ sb.Append("");
+
+ if(e == UUID.Zero)
+ sb.Append("");
+ else
+ {
+ sb.Append("");
+ EscapeToXML(e.ToString(), sb);
+ sb.Append("");
+ }
+ }
+
+ public static void AddElem(string name, string e, StringBuilder sb)
+ {
+ sb.Append("");
+ sb.Append(name);
+ sb.Append("");
+
+ if(String.IsNullOrEmpty(e))
+ sb.Append("");
+ else
+ {
+ sb.Append("");
+ EscapeToXML(e.ToString(), sb);
+ sb.Append("");
+ }
+ }
+
+ public static void AddRawElem(string name, string e, StringBuilder sb)
+ {
+ sb.Append("");
+ sb.Append(name);
+ sb.Append("");
+
+ if(String.IsNullOrEmpty(e))
+ sb.Append("");
+ else
+ {
+ sb.Append("");
+ sb.Append(e);
+ sb.Append("");
+ }
+ }
+
+ public static void AddElem(string name, Uri e, StringBuilder sb)
+ {
+ sb.Append("");
+ sb.Append(name);
+ sb.Append("");
+
+ if(e == null)
+ {
+ sb.Append("");
+ return;
+ }
+
+ string s;
+ if (e.IsAbsoluteUri)
+ s = e.AbsoluteUri;
+ else
+ s = e.ToString();
+
+ if(String.IsNullOrEmpty(s))
+ sb.Append("");
+ else
+ {
+ sb.Append("");
+ sb.Append(s);
+ sb.Append("");
+ }
+ }
+
+ public static void AddElem(string name, DateTime e, StringBuilder sb)
+ {
+ sb.Append("");
+ sb.Append(name);
+ sb.Append("");
+
+ DateTime u = e.ToUniversalTime();
+ if(u == depoch)
+ {
+ sb.Append("");
+ return;
+ }
+ string format;
+ if(u.Hour == 0 && u.Minute == 0 && u.Second == 0)
+ format = "yyyy-MM-dd";
+ else if (u.Millisecond > 0)
+ format = "yyyy-MM-ddTHH:mm:ss.ffZ";
+ else
+ format = "yyyy-MM-ddTHH:mm:ssZ";
+ sb.Append("");
+ sb.Append(u.ToString(format,CultureInfo.InvariantCulture));
+ sb.Append("");
+ }
+
+ public static void AddLLSD(string e, StringBuilder sb)
+ {
+ sb.Append(e);
+ }
+
+ public static void EscapeToXML(string s, StringBuilder sb)
+ {
+ int i;
+ char c;
+ int len = s.Length;
+
+ for (i = 0; i < len; i++)
+ {
+ c = s[i];
+ switch (c)
+ {
+ case '<':
+ sb.Append("<");
+ break;
+ case '>':
+ sb.Append(">");
+ break;
+ case '&':
+ sb.Append("&");
+ break;
+ case '"':
+ sb.Append(""");
+ break;
+ case '\\':
+ sb.Append("'");
+ break;
+ default:
+ sb.Append(c);
+ break;
+ }
+ }
+ }
+ }
+}
diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs
index 13d29776c5..13b58be3dd 100644
--- a/OpenSim/Framework/LandData.cs
+++ b/OpenSim/Framework/LandData.cs
@@ -97,7 +97,9 @@ namespace OpenSim.Framework
private bool _mediaLoop = false;
private bool _obscureMusic = false;
private bool _obscureMedia = false;
- private float _dwell = 0;
+
+ private float m_dwell = 0;
+ public double LastDwellTimeMS;
public bool SeeAVs { get; set; }
public bool AnyAVSounds { get; set; }
@@ -111,11 +113,12 @@ namespace OpenSim.Framework
{
get
{
- return _dwell;
+ return m_dwell;
}
set
{
- _dwell = value;
+ m_dwell = value;
+ LastDwellTimeMS = Util.GetTimeStampMS();
}
}
@@ -735,6 +738,7 @@ namespace OpenSim.Framework
SeeAVs = true;
AnyAVSounds = true;
GroupAVSounds = true;
+ LastDwellTimeMS = Util.GetTimeStampMS();
}
///
@@ -784,7 +788,7 @@ namespace OpenSim.Framework
landData._obscureMedia = _obscureMedia;
landData._simwideArea = _simwideArea;
landData._simwidePrims = _simwidePrims;
- landData._dwell = _dwell;
+ landData.m_dwell = m_dwell;
landData.SeeAVs = SeeAVs;
landData.AnyAVSounds = AnyAVSounds;
landData.GroupAVSounds = GroupAVSounds;
diff --git a/OpenSim/Framework/MinHeap.cs b/OpenSim/Framework/MinHeap.cs
index 99ac25d09d..68f66683e0 100644
--- a/OpenSim/Framework/MinHeap.cs
+++ b/OpenSim/Framework/MinHeap.cs
@@ -45,8 +45,8 @@ namespace OpenSim.Framework
internal void Clear()
{
- this.index = -1;
- this.heap = null;
+ index = -1;
+ heap = null;
}
}
@@ -55,23 +55,26 @@ namespace OpenSim.Framework
internal T value;
internal Handle handle;
- internal HeapItem(T value, Handle handle)
+ internal HeapItem(T _value, Handle _handle)
{
- this.value = value;
- this.handle = handle;
+ value = _value;
+ handle = _handle;
}
internal void Clear()
{
- if (this.handle != null)
- this.handle.Clear();
- ClearRef();
+ if (handle != null)
+ {
+ handle.Clear();
+ handle = null;
+ }
+ value = default(T);
}
internal void ClearRef()
{
- this.value = default(T);
- this.handle = null;
+ value = default(T);
+ handle = null;
}
}
@@ -81,6 +84,7 @@ namespace OpenSim.Framework
private int size;
private object sync_root;
private int version;
+ private int capacity;
private Comparison comparison;
@@ -90,14 +94,15 @@ namespace OpenSim.Framework
public MinHeap(int capacity, IComparer comparer) :
this(capacity, new Comparison(comparer.Compare)) { }
public MinHeap(Comparison comparison) : this(DEFAULT_CAPACITY, comparison) { }
- public MinHeap(int capacity, Comparison comparison)
+ public MinHeap(int _capacity, Comparison _comparison)
{
- this.items = new HeapItem[capacity];
- this.comparison = comparison;
- this.size = this.version = 0;
+ capacity = _capacity;
+ items = new HeapItem[capacity];
+ comparison = _comparison;
+ size = version = 0;
}
- public int Count { get { return this.size; } }
+ public int Count { get { return size; } }
public bool IsReadOnly { get { return false; } }
@@ -108,15 +113,16 @@ namespace OpenSim.Framework
get
{
Handle handle = ValidateThisHandle(key);
- return this.items[handle.index].value;
+ return items[handle.index].value;
}
set
{
Handle handle = ValidateThisHandle(key);
- this.items[handle.index].value = value;
- if (!BubbleUp(handle.index))
- BubbleDown(handle.index);
+ int indx = handle.index;
+ items[indx].value = value;
+ if (!BubbleUp(indx))
+ BubbleDown(indx);
}
}
@@ -124,9 +130,9 @@ namespace OpenSim.Framework
{
get
{
- if (this.sync_root == null)
- Interlocked.CompareExchange