Merge branch 'careminster-presence-refactor' of ssh://melanie@3dhosting.de/var/git/careminster into careminster-presence-refactor

avinationmerge
Melanie 2010-07-17 03:18:01 +01:00
commit 859e3252be
7 changed files with 107 additions and 38 deletions

View File

@ -48,6 +48,9 @@ namespace OpenSim.Framework.RegionLoader.Web
public RegionInfo[] LoadRegions() public RegionInfo[] LoadRegions()
{ {
int tries = 3;
int wait = 2000;
if (m_configSource == null) if (m_configSource == null)
{ {
m_log.Error("[WEBLOADER]: Unable to load configuration source!"); m_log.Error("[WEBLOADER]: Unable to load configuration source!");
@ -64,35 +67,47 @@ namespace OpenSim.Framework.RegionLoader.Web
} }
else else
{ {
HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url); while (tries > 0)
webRequest.Timeout = 30000; //30 Second Timeout
m_log.Debug("[WEBLOADER]: Sending Download Request...");
HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse();
m_log.Debug("[WEBLOADER]: Downloading Region Information From Remote Server...");
StreamReader reader = new StreamReader(webResponse.GetResponseStream());
string xmlSource = String.Empty;
string tempStr = reader.ReadLine();
while (tempStr != null)
{ {
xmlSource = xmlSource + tempStr; HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url);
tempStr = reader.ReadLine(); webRequest.Timeout = 30000; //30 Second Timeout
} m_log.Debug("[WEBLOADER]: Sending Download Request...");
m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " + HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse();
xmlSource.Length); m_log.Debug("[WEBLOADER]: Downloading Region Information From Remote Server...");
XmlDocument xmlDoc = new XmlDocument(); StreamReader reader = new StreamReader(webResponse.GetResponseStream());
xmlDoc.LoadXml(xmlSource); string xmlSource = String.Empty;
if (xmlDoc.FirstChild.Name == "Regions") string tempStr = reader.ReadLine();
{ while (tempStr != null)
RegionInfo[] regionInfos = new RegionInfo[xmlDoc.FirstChild.ChildNodes.Count];
int i;
for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++)
{ {
m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml); xmlSource = xmlSource + tempStr;
regionInfos[i] = tempStr = reader.ReadLine();
new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource); }
m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " +
xmlSource.Length);
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xmlSource);
if (xmlDoc.FirstChild.Name == "Regions")
{
RegionInfo[] regionInfos = new RegionInfo[xmlDoc.FirstChild.ChildNodes.Count];
int i;
for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++)
{
m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml);
regionInfos[i] =
new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource);
}
if (i > 0)
return regionInfos;
} }
return regionInfos; m_log.Debug("[WEBLOADER]: Request yielded no regions.");
tries--;
if (tries > 0)
{
m_log.Debug("[WEBLOADER]: Retrying");
System.Threading.Thread.Sleep(wait);
}
} }
return null; return null;
} }

View File

@ -529,7 +529,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
// find small items. // find small items.
// //
if (!attachment) if (!attachment)
{
group.RootPart.CreateSelected = true; group.RootPart.CreateSelected = true;
foreach (SceneObjectPart child in group.Children.Values)
child.CreateSelected = true;
}
if (!m_Scene.Permissions.CanRezObject( if (!m_Scene.Permissions.CanRezObject(
group.Children.Count, remoteClient.AgentId, pos) group.Children.Count, remoteClient.AgentId, pos)

View File

@ -935,6 +935,9 @@ namespace OpenSim.Region.Framework.Scenes
} }
if (part != null && group != null) if (part != null && group != null)
{ {
if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId))
return;
TaskInventoryItem item = group.GetInventoryItem(localID, itemID); TaskInventoryItem item = group.GetInventoryItem(localID, itemID);
if (item == null) if (item == null)
return; return;
@ -1074,9 +1077,21 @@ namespace OpenSim.Region.Framework.Scenes
return; return;
} }
// Only owner can copy TaskInventoryItem item = part.Inventory.GetInventoryItem(itemId);
if (remoteClient.AgentId != taskItem.OwnerID) if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
return; {
// If the item to be moved is no copy, we need to be able to
// edit the prim.
if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId))
return;
}
else
{
// If the item is copiable, then we just need to have perms
// on it. The delete check is a pure rights check
if (!Permissions.CanDeleteObject(part.UUID, remoteClient.AgentId))
return;
}
MoveTaskInventoryItem(remoteClient, folderId, part, itemId); MoveTaskInventoryItem(remoteClient, folderId, part, itemId);
} }
@ -1359,16 +1374,45 @@ namespace OpenSim.Region.Framework.Scenes
{ {
agentTransactions.HandleTaskItemUpdateFromTransaction( agentTransactions.HandleTaskItemUpdateFromTransaction(
remoteClient, part, transactionID, currentItem); remoteClient, part, transactionID, currentItem);
}
if (part.Inventory.UpdateInventoryItem(itemInfo))
{
if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) if ((InventoryType)itemInfo.InvType == InventoryType.Notecard)
remoteClient.SendAgentAlertMessage("Notecard saved", false); remoteClient.SendAgentAlertMessage("Notecard saved", false);
else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) else if ((InventoryType)itemInfo.InvType == InventoryType.LSL)
remoteClient.SendAgentAlertMessage("Script saved", false); remoteClient.SendAgentAlertMessage("Script saved", false);
else else
remoteClient.SendAgentAlertMessage("Item saved", false); remoteClient.SendAgentAlertMessage("Item saved", false);
}
// Check if we're allowed to mess with permissions
if (!Permissions.IsGod(remoteClient.AgentId)) // Not a god
{
if (remoteClient.AgentId != part.OwnerID) // Not owner
{
// Friends and group members can't change any perms
itemInfo.BasePermissions = currentItem.BasePermissions;
itemInfo.EveryonePermissions = currentItem.EveryonePermissions;
itemInfo.GroupPermissions = currentItem.GroupPermissions;
itemInfo.NextPermissions = currentItem.NextPermissions;
itemInfo.CurrentPermissions = currentItem.CurrentPermissions;
}
else
{
// Owner can't change base, and can change other
// only up to base
// Base ALWAYS has move
currentItem.BasePermissions |= (uint)PermissionMask.Move;
itemInfo.BasePermissions = currentItem.BasePermissions;
itemInfo.EveryonePermissions &= currentItem.BasePermissions;
itemInfo.GroupPermissions &= currentItem.BasePermissions;
itemInfo.CurrentPermissions &= currentItem.BasePermissions;
itemInfo.NextPermissions &= currentItem.BasePermissions;
// Next ALWAYS has move
itemInfo.NextPermissions |= (uint)PermissionMask.Move;
}
}
if (part.Inventory.UpdateInventoryItem(itemInfo))
{
part.GetProperties(remoteClient); part.GetProperties(remoteClient);
} }
} }

View File

@ -4156,6 +4156,9 @@ namespace OpenSim.Region.Framework.Scenes
// objects // objects
if ((_nextOwnerMask & (uint)PermissionMask.Copy) == 0) if ((_nextOwnerMask & (uint)PermissionMask.Copy) == 0)
_nextOwnerMask |= (uint)PermissionMask.Transfer; _nextOwnerMask |= (uint)PermissionMask.Transfer;
_nextOwnerMask |= (uint)PermissionMask.Move;
break; break;
} }
SendFullUpdateToAllClients(); SendFullUpdateToAllClients();

View File

@ -762,12 +762,6 @@ namespace OpenSim.Region.Framework.Scenes
else if ((InventoryType)item.Type == InventoryType.Notecard) else if ((InventoryType)item.Type == InventoryType.Notecard)
{ {
ScenePresence presence = m_part.ParentGroup.Scene.GetScenePresence(item.OwnerID); ScenePresence presence = m_part.ParentGroup.Scene.GetScenePresence(item.OwnerID);
if (presence != null)
{
presence.ControllingClient.SendAgentAlertMessage(
"Notecard saved", false);
}
} }
m_items[item.ItemID] = item; m_items[item.ItemID] = item;

View File

@ -1735,6 +1735,13 @@ namespace OpenSim.Region.Physics.OdePlugin
if (m_isphysical) if (m_isphysical)
{ {
disableBodySoft(); disableBodySoft();
if (Body != IntPtr.Zero)
{
d.BodySetLinearVel(Body, 0f, 0f, 0f);
d.BodySetForce(Body, 0, 0, 0);
enableBodySoft();
}
} }
} }
else else
@ -1756,6 +1763,7 @@ namespace OpenSim.Region.Physics.OdePlugin
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
} }
/* Uhhh - stop the motion if the object is _selected_!!
if (m_isphysical) if (m_isphysical)
{ {
if (Body != IntPtr.Zero) if (Body != IntPtr.Zero)
@ -1765,6 +1773,7 @@ namespace OpenSim.Region.Physics.OdePlugin
enableBodySoft(); enableBodySoft();
} }
} }
*/
} }
resetCollisionAccounting(); resetCollisionAccounting();

View File

@ -4177,7 +4177,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
byte[] bucket = new byte[17]; byte[] bucket = new byte[17];
bucket[0] = (byte)assetType; bucket[0] = (byte)assetType;
byte[] objBytes = objId.GetBytes(); byte[] objBytes = agentItem.ID.GetBytes();
Array.Copy(objBytes, 0, bucket, 1, 16); Array.Copy(objBytes, 0, bucket, 1, 16);
Console.WriteLine("Giving inventory"); Console.WriteLine("Giving inventory");