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()
{
int tries = 3;
int wait = 2000;
if (m_configSource == null)
{
m_log.Error("[WEBLOADER]: Unable to load configuration source!");
@ -64,35 +67,47 @@ namespace OpenSim.Framework.RegionLoader.Web
}
else
{
HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url);
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)
while (tries > 0)
{
xmlSource = xmlSource + tempStr;
tempStr = reader.ReadLine();
}
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++)
HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url);
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)
{
m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml);
regionInfos[i] =
new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource);
xmlSource = xmlSource + tempStr;
tempStr = reader.ReadLine();
}
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;
}

View File

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

View File

@ -935,6 +935,9 @@ namespace OpenSim.Region.Framework.Scenes
}
if (part != null && group != null)
{
if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId))
return;
TaskInventoryItem item = group.GetInventoryItem(localID, itemID);
if (item == null)
return;
@ -1074,9 +1077,21 @@ namespace OpenSim.Region.Framework.Scenes
return;
}
// Only owner can copy
if (remoteClient.AgentId != taskItem.OwnerID)
return;
TaskInventoryItem item = part.Inventory.GetInventoryItem(itemId);
if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
{
// 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);
}
@ -1359,16 +1374,45 @@ namespace OpenSim.Region.Framework.Scenes
{
agentTransactions.HandleTaskItemUpdateFromTransaction(
remoteClient, part, transactionID, currentItem);
}
if (part.Inventory.UpdateInventoryItem(itemInfo))
{
if ((InventoryType)itemInfo.InvType == InventoryType.Notecard)
remoteClient.SendAgentAlertMessage("Notecard saved", false);
else if ((InventoryType)itemInfo.InvType == InventoryType.LSL)
remoteClient.SendAgentAlertMessage("Script saved", false);
else
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);
}
}

View File

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

View File

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

View File

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

View File

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