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

avinationmerge
Kitto Flora 2010-09-06 21:45:17 +00:00
commit cfaefad754
65 changed files with 1009 additions and 680 deletions

View File

@ -588,6 +588,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
/// <item><term>estate_name</term> /// <item><term>estate_name</term>
/// <description>the name of the estate to join (or to create if it doesn't /// <description>the name of the estate to join (or to create if it doesn't
/// already exist)</description></item> /// already exist)</description></item>
/// <item><term>region_file</term>
/// <description>The name of the file to persist the region specifications to.
/// If omitted, the region_file_template setting from OpenSim.ini will be used. (optional)</description></item>
/// </list> /// </list>
/// ///
/// XmlRpcCreateRegionMethod returns /// XmlRpcCreateRegionMethod returns
@ -701,7 +704,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
bool persist = Convert.ToBoolean((string) requestData["persist"]); bool persist = Convert.ToBoolean((string) requestData["persist"]);
if (persist) if (persist)
{ {
// default place for region XML files is in the // default place for region configuration files is in the
// Regions directory of the config dir (aka /bin) // Regions directory of the config dir (aka /bin)
string regionConfigPath = Path.Combine(Util.configDir(), "Regions"); string regionConfigPath = Path.Combine(Util.configDir(), "Regions");
try try
@ -714,19 +717,36 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{ {
// No INI setting recorded. // No INI setting recorded.
} }
string regionXmlPath = Path.Combine(regionConfigPath,
string regionIniPath;
if (requestData.Contains("region_file"))
{
// Make sure that the file to be created is in a subdirectory of the region storage directory.
string requestedFilePath = Path.Combine(regionConfigPath, (string) requestData["region_file"]);
string requestedDirectory = Path.GetDirectoryName(Path.GetFullPath(requestedFilePath));
if (requestedDirectory.StartsWith(Path.GetFullPath(regionConfigPath)))
regionIniPath = requestedFilePath;
else
throw new Exception("Invalid location for region file.");
}
else
{
regionIniPath = Path.Combine(regionConfigPath,
String.Format( String.Format(
m_config.GetString("region_file_template", m_config.GetString("region_file_template",
"{0}x{1}-{2}.xml"), "{0}x{1}-{2}.ini"),
region.RegionLocX.ToString(), region.RegionLocX.ToString(),
region.RegionLocY.ToString(), region.RegionLocY.ToString(),
regionID.ToString(), regionID.ToString(),
region.InternalEndPoint.Port.ToString(), region.InternalEndPoint.Port.ToString(),
region.RegionName.Replace(" ", "_").Replace(":", "_"). region.RegionName.Replace(" ", "_").Replace(":", "_").
Replace("/", "_"))); Replace("/", "_")));
}
m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}", m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}",
region.RegionID, regionXmlPath); region.RegionID, regionIniPath);
region.SaveRegionToFile("dynamic region", regionXmlPath); region.SaveRegionToFile("dynamic region", regionIniPath);
} }
else else
{ {
@ -1700,8 +1720,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
destinationItem.CreationDate = item.CreationDate; destinationItem.CreationDate = item.CreationDate;
destinationItem.Folder = destinationFolder.ID; destinationItem.Folder = destinationFolder.ID;
inventoryService.AddItem(destinationItem); m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem);
m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID);
// Wear item // Wear item
AvatarWearable newWearable = new AvatarWearable(); AvatarWearable newWearable = new AvatarWearable();
@ -1711,7 +1731,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
} }
else else
{ {
m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", wearable.ItemID, destinationFolder.ID); m_log.WarnFormat("[RADMIN]: Error transferring {0} to folder {1}", wearable.ItemID, destinationFolder.ID);
} }
} }
} }
@ -1753,16 +1773,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController
destinationItem.CreationDate = item.CreationDate; destinationItem.CreationDate = item.CreationDate;
destinationItem.Folder = destinationFolder.ID; destinationItem.Folder = destinationFolder.ID;
inventoryService.AddItem(destinationItem); m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem);
m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID);
// Attach item // Attach item
avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID); avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID);
m_log.DebugFormat("[RADMIN] Attached {0}", destinationItem.ID); m_log.DebugFormat("[RADMIN]: Attached {0}", destinationItem.ID);
} }
else else
{ {
m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", itemID, destinationFolder.ID); m_log.WarnFormat("[RADMIN]: Error transferring {0} to folder {1}", itemID, destinationFolder.ID);
} }
} }
} }
@ -1860,16 +1880,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController
destinationItem.CreationDate = item.CreationDate; destinationItem.CreationDate = item.CreationDate;
destinationItem.Folder = extraFolder.ID; destinationItem.Folder = extraFolder.ID;
inventoryService.AddItem(destinationItem); m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem);
inventoryMap.Add(item.ID, destinationItem.ID); inventoryMap.Add(item.ID, destinationItem.ID);
m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, extraFolder.ID); m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, extraFolder.ID);
// Attach item, if original is attached // Attach item, if original is attached
int attachpoint = avatarAppearance.GetAttachpoint(item.ID); int attachpoint = avatarAppearance.GetAttachpoint(item.ID);
if (attachpoint != 0) if (attachpoint != 0)
{ {
avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID); avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID);
m_log.DebugFormat("[RADMIN] Attached {0}", destinationItem.ID); m_log.DebugFormat("[RADMIN]: Attached {0}", destinationItem.ID);
} }
} }
} }
@ -1888,7 +1908,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
private bool CreateDefaultAvatars() private bool CreateDefaultAvatars()
{ {
// Only load once // Only load once
if (m_defaultAvatarsLoaded) if (m_defaultAvatarsLoaded)
{ {
return false; return false;
@ -2146,7 +2165,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
inventoryItem.CreationDate = GetIntegerAttribute(item,"creationdate",Util.UnixTimeSinceEpoch()); inventoryItem.CreationDate = GetIntegerAttribute(item,"creationdate",Util.UnixTimeSinceEpoch());
inventoryItem.Folder = extraFolder.ID; // Parent folder inventoryItem.Folder = extraFolder.ID; // Parent folder
inventoryService.AddItem(inventoryItem); m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(inventoryItem);
m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", inventoryItem.ID, extraFolder.ID); m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", inventoryItem.ID, extraFolder.ID);
} }

View File

@ -305,94 +305,94 @@ namespace OpenSim.Client.MXP.ClientStack
#region MXP Outgoing Message Processing #region MXP Outgoing Message Processing
private void MXPSendPrimitive(uint localID, UUID ownerID, Vector3 acc, Vector3 rvel, PrimitiveBaseShape primShape, Vector3 pos, UUID objectID, Vector3 vel, Quaternion rotation, uint flags, string text, byte[] textColor, uint parentID, byte[] particleSystem, byte clickAction, byte material, byte[] textureanim) // private void MXPSendPrimitive(uint localID, UUID ownerID, Vector3 acc, Vector3 rvel, PrimitiveBaseShape primShape, Vector3 pos, UUID objectID, Vector3 vel, Quaternion rotation, uint flags, string text, byte[] textColor, uint parentID, byte[] particleSystem, byte clickAction, byte material, byte[] textureanim)
{ // {
String typeName = ToOmType(primShape.PCode); // String typeName = ToOmType(primShape.PCode);
m_log.Info("[MXP ClientStack] Transmitting Primitive" + typeName); // m_log.Info("[MXP ClientStack] Transmitting Primitive" + typeName);
//
PerceptionEventMessage pe = new PerceptionEventMessage(); // PerceptionEventMessage pe = new PerceptionEventMessage();
pe.ObjectFragment.ObjectId = objectID.Guid; // pe.ObjectFragment.ObjectId = objectID.Guid;
//
pe.ObjectFragment.ParentObjectId = Guid.Empty; // pe.ObjectFragment.ParentObjectId = Guid.Empty;
//
// Resolving parent UUID. // // Resolving parent UUID.
OpenSim.Region.Framework.Scenes.Scene scene = (OpenSim.Region.Framework.Scenes.Scene)Scene; // OpenSim.Region.Framework.Scenes.Scene scene = (OpenSim.Region.Framework.Scenes.Scene)Scene;
if (scene.Entities.ContainsKey(parentID)) // if (scene.Entities.ContainsKey(parentID))
{ // {
pe.ObjectFragment.ParentObjectId = scene.Entities[parentID].UUID.Guid; // pe.ObjectFragment.ParentObjectId = scene.Entities[parentID].UUID.Guid;
} // }
//
pe.ObjectFragment.ObjectIndex = localID; // pe.ObjectFragment.ObjectIndex = localID;
pe.ObjectFragment.ObjectName = typeName + " Object"; // pe.ObjectFragment.ObjectName = typeName + " Object";
pe.ObjectFragment.OwnerId = ownerID.Guid; // pe.ObjectFragment.OwnerId = ownerID.Guid;
pe.ObjectFragment.TypeId = Guid.Empty; // pe.ObjectFragment.TypeId = Guid.Empty;
pe.ObjectFragment.TypeName = typeName; // pe.ObjectFragment.TypeName = typeName;
pe.ObjectFragment.Acceleration = ToOmVector(acc); // pe.ObjectFragment.Acceleration = ToOmVector(acc);
pe.ObjectFragment.AngularAcceleration=new MsdQuaternion4f(); // pe.ObjectFragment.AngularAcceleration=new MsdQuaternion4f();
pe.ObjectFragment.AngularVelocity = ToOmQuaternion(rvel); // pe.ObjectFragment.AngularVelocity = ToOmQuaternion(rvel);
pe.ObjectFragment.BoundingSphereRadius = primShape.Scale.Length(); // pe.ObjectFragment.BoundingSphereRadius = primShape.Scale.Length();
//
pe.ObjectFragment.Location = ToOmVector(pos); // pe.ObjectFragment.Location = ToOmVector(pos);
//
pe.ObjectFragment.Mass = 1.0f; // pe.ObjectFragment.Mass = 1.0f;
pe.ObjectFragment.Orientation = ToOmQuaternion(rotation); // pe.ObjectFragment.Orientation = ToOmQuaternion(rotation);
pe.ObjectFragment.Velocity =ToOmVector(vel); // pe.ObjectFragment.Velocity =ToOmVector(vel);
//
OmSlPrimitiveExt ext = new OmSlPrimitiveExt(); // OmSlPrimitiveExt ext = new OmSlPrimitiveExt();
//
if (!((primShape.PCode == (byte)PCode.NewTree) || (primShape.PCode == (byte)PCode.Tree) || (primShape.PCode == (byte)PCode.Grass))) // if (!((primShape.PCode == (byte)PCode.NewTree) || (primShape.PCode == (byte)PCode.Tree) || (primShape.PCode == (byte)PCode.Grass)))
{ // {
//
ext.PathBegin = primShape.PathBegin; // ext.PathBegin = primShape.PathBegin;
ext.PathEnd = primShape.PathEnd; // ext.PathEnd = primShape.PathEnd;
ext.PathScaleX = primShape.PathScaleX; // ext.PathScaleX = primShape.PathScaleX;
ext.PathScaleY = primShape.PathScaleY; // ext.PathScaleY = primShape.PathScaleY;
ext.PathShearX = primShape.PathShearX; // ext.PathShearX = primShape.PathShearX;
ext.PathShearY = primShape.PathShearY; // ext.PathShearY = primShape.PathShearY;
ext.PathSkew = primShape.PathSkew; // ext.PathSkew = primShape.PathSkew;
ext.ProfileBegin = primShape.ProfileBegin; // ext.ProfileBegin = primShape.ProfileBegin;
ext.ProfileEnd = primShape.ProfileEnd; // ext.ProfileEnd = primShape.ProfileEnd;
ext.PathCurve = primShape.PathCurve; // ext.PathCurve = primShape.PathCurve;
ext.ProfileCurve = primShape.ProfileCurve; // ext.ProfileCurve = primShape.ProfileCurve;
ext.ProfileHollow = primShape.ProfileHollow; // ext.ProfileHollow = primShape.ProfileHollow;
ext.PathRadiusOffset = primShape.PathRadiusOffset; // ext.PathRadiusOffset = primShape.PathRadiusOffset;
ext.PathRevolutions = primShape.PathRevolutions; // ext.PathRevolutions = primShape.PathRevolutions;
ext.PathTaperX = primShape.PathTaperX; // ext.PathTaperX = primShape.PathTaperX;
ext.PathTaperY = primShape.PathTaperY; // ext.PathTaperY = primShape.PathTaperY;
ext.PathTwist = primShape.PathTwist; // ext.PathTwist = primShape.PathTwist;
ext.PathTwistBegin = primShape.PathTwistBegin; // ext.PathTwistBegin = primShape.PathTwistBegin;
//
//
} // }
//
ext.UpdateFlags = flags; // ext.UpdateFlags = flags;
ext.ExtraParams = primShape.ExtraParams; // ext.ExtraParams = primShape.ExtraParams;
ext.State = primShape.State; // ext.State = primShape.State;
ext.TextureEntry = primShape.TextureEntry; // ext.TextureEntry = primShape.TextureEntry;
ext.TextureAnim = textureanim; // ext.TextureAnim = textureanim;
ext.Scale = ToOmVector(primShape.Scale); // ext.Scale = ToOmVector(primShape.Scale);
ext.Text = text; // ext.Text = text;
ext.TextColor = ToOmColor(textColor); // ext.TextColor = ToOmColor(textColor);
ext.PSBlock = particleSystem; // ext.PSBlock = particleSystem;
ext.ClickAction = clickAction; // ext.ClickAction = clickAction;
ext.Material = material; // ext.Material = material;
//
pe.SetExtension<OmSlPrimitiveExt>(ext); // pe.SetExtension<OmSlPrimitiveExt>(ext);
//
Session.Send(pe); // Session.Send(pe);
//
if (m_objectsSynchronized != -1) // if (m_objectsSynchronized != -1)
{ // {
m_objectsSynchronized++; // m_objectsSynchronized++;
//
if (m_objectsToSynchronize >= m_objectsSynchronized) // if (m_objectsToSynchronize >= m_objectsSynchronized)
{ // {
SynchronizationEndEventMessage synchronizationEndEventMessage = new SynchronizationEndEventMessage(); // SynchronizationEndEventMessage synchronizationEndEventMessage = new SynchronizationEndEventMessage();
Session.Send(synchronizationEndEventMessage); // Session.Send(synchronizationEndEventMessage);
m_objectsSynchronized = -1; // m_objectsSynchronized = -1;
} // }
} // }
} // }
public void MXPSendAvatarData(string participantName, UUID ownerID, UUID parentId, UUID avatarID, uint avatarLocalID, Vector3 position, Quaternion rotation) public void MXPSendAvatarData(string participantName, UUID ownerID, UUID parentId, UUID avatarID, uint avatarLocalID, Vector3 position, Quaternion rotation)
{ {

View File

@ -63,7 +63,7 @@ namespace OpenSim.Client.MXP.PacketHandler
private readonly IList<MXPClientView> m_sessionsToRemove = new List<MXPClientView>(); private readonly IList<MXPClientView> m_sessionsToRemove = new List<MXPClientView>();
private readonly int m_port; private readonly int m_port;
private readonly bool m_accountsAuthenticate; // private readonly bool m_accountsAuthenticate;
private readonly String m_programName; private readonly String m_programName;
private readonly byte m_programMajorVersion; private readonly byte m_programMajorVersion;
@ -76,7 +76,7 @@ namespace OpenSim.Client.MXP.PacketHandler
public MXPPacketServer(int port, Dictionary<UUID, Scene> scenes, bool accountsAuthenticate) public MXPPacketServer(int port, Dictionary<UUID, Scene> scenes, bool accountsAuthenticate)
{ {
m_port = port; m_port = port;
m_accountsAuthenticate = accountsAuthenticate; // m_accountsAuthenticate = accountsAuthenticate;
m_scenes = scenes; m_scenes = scenes;
@ -491,7 +491,6 @@ namespace OpenSim.Client.MXP.PacketHandler
public bool AuthoriseUser(string participantName, string password, UUID sceneId, out UserAccount account) public bool AuthoriseUser(string participantName, string password, UUID sceneId, out UserAccount account)
{ {
UUID userId = UUID.Zero;
string firstName = ""; string firstName = "";
string lastName = ""; string lastName = "";
account = null; account = null;

View File

@ -638,9 +638,9 @@ ELSE
//Insert new values //Insert new values
string sql = @"INSERT INTO [land] string sql = @"INSERT INTO [land]
([UUID],[RegionUUID],[LocalLandID],[Bitmap],[Name],[Description],[OwnerUUID],[IsGroupOwned],[Area],[AuctionID],[Category],[ClaimDate],[ClaimPrice],[GroupUUID],[SalePrice],[LandStatus],[LandFlags],[LandingType],[MediaAutoScale],[MediaTextureUUID],[MediaURL],[MusicURL],[PassHours],[PassPrice],[SnapshotUUID],[UserLocationX],[UserLocationY],[UserLocationZ],[UserLookAtX],[UserLookAtY],[UserLookAtZ],[AuthbuyerID],[OtherCleanTime],[Dwell]) ([UUID],[RegionUUID],[LocalLandID],[Bitmap],[Name],[Description],[OwnerUUID],[IsGroupOwned],[Area],[AuctionID],[Category],[ClaimDate],[ClaimPrice],[GroupUUID],[SalePrice],[LandStatus],[LandFlags],[LandingType],[MediaAutoScale],[MediaTextureUUID],[MediaURL],[MusicURL],[PassHours],[PassPrice],[SnapshotUUID],[UserLocationX],[UserLocationY],[UserLocationZ],[UserLookAtX],[UserLookAtY],[UserLookAtZ],[AuthbuyerID],[OtherCleanTime])
VALUES VALUES
(@UUID,@RegionUUID,@LocalLandID,@Bitmap,@Name,@Description,@OwnerUUID,@IsGroupOwned,@Area,@AuctionID,@Category,@ClaimDate,@ClaimPrice,@GroupUUID,@SalePrice,@LandStatus,@LandFlags,@LandingType,@MediaAutoScale,@MediaTextureUUID,@MediaURL,@MusicURL,@PassHours,@PassPrice,@SnapshotUUID,@UserLocationX,@UserLocationY,@UserLocationZ,@UserLookAtX,@UserLookAtY,@UserLookAtZ,@AuthbuyerID,@OtherCleanTime,@Dwell)"; (@UUID,@RegionUUID,@LocalLandID,@Bitmap,@Name,@Description,@OwnerUUID,@IsGroupOwned,@Area,@AuctionID,@Category,@ClaimDate,@ClaimPrice,@GroupUUID,@SalePrice,@LandStatus,@LandFlags,@LandingType,@MediaAutoScale,@MediaTextureUUID,@MediaURL,@MusicURL,@PassHours,@PassPrice,@SnapshotUUID,@UserLocationX,@UserLocationY,@UserLocationZ,@UserLookAtX,@UserLookAtY,@UserLookAtZ,@AuthbuyerID,@OtherCleanTime)";
using (SqlConnection conn = new SqlConnection(m_connectionString)) using (SqlConnection conn = new SqlConnection(m_connectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn)) using (SqlCommand cmd = new SqlCommand(sql, conn))
@ -954,7 +954,6 @@ VALUES
newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]); newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]);
newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
newData.Dwell = Convert.ToInt32(row["Dwell"]);
try try
{ {
@ -1357,7 +1356,6 @@ VALUES
parameters.Add(_Database.CreateParameter("UserLookAtZ", land.UserLookAt.Z)); parameters.Add(_Database.CreateParameter("UserLookAtZ", land.UserLookAt.Z));
parameters.Add(_Database.CreateParameter("AuthBuyerID", land.AuthBuyerID)); parameters.Add(_Database.CreateParameter("AuthBuyerID", land.AuthBuyerID));
parameters.Add(_Database.CreateParameter("OtherCleanTime", land.OtherCleanTime)); parameters.Add(_Database.CreateParameter("OtherCleanTime", land.OtherCleanTime));
parameters.Add(_Database.CreateParameter("Dwell", land.Dwell));
return parameters.ToArray(); return parameters.ToArray();
} }

View File

@ -677,7 +677,7 @@ namespace OpenSim.Data.MySQL
"MusicURL, PassHours, PassPrice, SnapshotUUID, " + "MusicURL, PassHours, PassPrice, SnapshotUUID, " +
"UserLocationX, UserLocationY, UserLocationZ, " + "UserLocationX, UserLocationY, UserLocationZ, " +
"UserLookAtX, UserLookAtY, UserLookAtZ, " + "UserLookAtX, UserLookAtY, UserLookAtZ, " +
"AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " + "AuthbuyerID, OtherCleanTime, MediaType, MediaDescription, " +
"MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" + "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" +
"?UUID, ?RegionUUID, " + "?UUID, ?RegionUUID, " +
"?LocalLandID, ?Bitmap, ?Name, ?Description, " + "?LocalLandID, ?Bitmap, ?Name, ?Description, " +
@ -688,7 +688,7 @@ namespace OpenSim.Data.MySQL
"?MusicURL, ?PassHours, ?PassPrice, ?SnapshotUUID, " + "?MusicURL, ?PassHours, ?PassPrice, ?SnapshotUUID, " +
"?UserLocationX, ?UserLocationY, ?UserLocationZ, " + "?UserLocationX, ?UserLocationY, ?UserLocationZ, " +
"?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " +
"?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+ "?AuthbuyerID, ?OtherCleanTime, ?MediaType, ?MediaDescription, "+
"CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)"; "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)";
FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID);
@ -1329,7 +1329,6 @@ namespace OpenSim.Data.MySQL
UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer); UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer);
UUID.TryParse((string)row["SnapshotUUID"], out snapshotID); UUID.TryParse((string)row["SnapshotUUID"], out snapshotID);
newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
newData.Dwell = Convert.ToInt32(row["Dwell"]);
newData.AuthBuyerID = authedbuyer; newData.AuthBuyerID = authedbuyer;
newData.SnapshotID = snapshotID; newData.SnapshotID = snapshotID;
@ -1660,7 +1659,6 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("UserLookAtZ", land.UserLookAt.Z); cmd.Parameters.AddWithValue("UserLookAtZ", land.UserLookAt.Z);
cmd.Parameters.AddWithValue("AuthBuyerID", land.AuthBuyerID); cmd.Parameters.AddWithValue("AuthBuyerID", land.AuthBuyerID);
cmd.Parameters.AddWithValue("OtherCleanTime", land.OtherCleanTime); cmd.Parameters.AddWithValue("OtherCleanTime", land.OtherCleanTime);
cmd.Parameters.AddWithValue("Dwell", land.Dwell);
cmd.Parameters.AddWithValue("MediaDescription", land.MediaDescription); cmd.Parameters.AddWithValue("MediaDescription", land.MediaDescription);
cmd.Parameters.AddWithValue("MediaType", land.MediaType); cmd.Parameters.AddWithValue("MediaType", land.MediaType);
cmd.Parameters.AddWithValue("MediaWidth", land.MediaWidth); cmd.Parameters.AddWithValue("MediaWidth", land.MediaWidth);

View File

@ -1,5 +0,0 @@
BEGIN;
ALTER TABLE regionsettings ADD COLUMN map_tile_ID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000';
COMMIT;

View File

@ -1,6 +0,0 @@
BEGIN;
ALTER TABLE prims ADD COLUMN MediaURL varchar(255);
ALTER TABLE primshapes ADD COLUMN Media TEXT;
COMMIT;

View File

@ -449,6 +449,17 @@ COMMIT;
:VERSION 19 :VERSION 19
BEGIN; BEGIN;
ALTER TABLE regionsettings ADD COLUMN map_tile_ID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000';
COMMIT;
:VERSION 20
BEGIN;
ALTER TABLE prims ADD COLUMN MediaURL varchar(255);
ALTER TABLE primshapes ADD COLUMN Media TEXT;
COMMIT;
:VERSION 21
BEGIN;
ALTER TABLE `land` ADD COLUMN `MediaType` VARCHAR(32) NOT NULL DEFAULT 'none/none'; ALTER TABLE `land` ADD COLUMN `MediaType` VARCHAR(32) NOT NULL DEFAULT 'none/none';
ALTER TABLE `land` ADD COLUMN `MediaDescription` VARCHAR(255) NOT NULL DEFAULT ''; ALTER TABLE `land` ADD COLUMN `MediaDescription` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `land` ADD COLUMN `MediaSize` VARCHAR(16) NOT NULL DEFAULT '0,0'; ALTER TABLE `land` ADD COLUMN `MediaSize` VARCHAR(16) NOT NULL DEFAULT '0,0';

View File

@ -1111,7 +1111,6 @@ namespace OpenSim.Data.SQLite
createCol(land, "UserLookAtZ", typeof (Double)); createCol(land, "UserLookAtZ", typeof (Double));
createCol(land, "AuthbuyerID", typeof(String)); createCol(land, "AuthbuyerID", typeof(String));
createCol(land, "OtherCleanTime", typeof(Int32)); createCol(land, "OtherCleanTime", typeof(Int32));
createCol(land, "Dwell", typeof(Int32));
land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]}; land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]};
@ -1449,7 +1448,6 @@ namespace OpenSim.Data.SQLite
UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID); UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID);
newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
newData.Dwell = Convert.ToInt32(row["Dwell"]);
return newData; return newData;
} }
@ -1761,7 +1759,6 @@ namespace OpenSim.Data.SQLite
row["UserLookAtZ"] = land.UserLookAt.Z; row["UserLookAtZ"] = land.UserLookAt.Z;
row["AuthbuyerID"] = land.AuthBuyerID.ToString(); row["AuthbuyerID"] = land.AuthBuyerID.ToString();
row["OtherCleanTime"] = land.OtherCleanTime; row["OtherCleanTime"] = land.OtherCleanTime;
row["Dwell"] = land.Dwell;
row["MediaType"] = land.MediaType; row["MediaType"] = land.MediaType;
row["MediaDescription"] = land.MediaDescription; row["MediaDescription"] = land.MediaDescription;
row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString(); row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString();

View File

@ -1069,7 +1069,6 @@ namespace OpenSim.Data.SQLiteLegacy
createCol(land, "UserLookAtZ", typeof (Double)); createCol(land, "UserLookAtZ", typeof (Double));
createCol(land, "AuthbuyerID", typeof(String)); createCol(land, "AuthbuyerID", typeof(String));
createCol(land, "OtherCleanTime", typeof(Int32)); createCol(land, "OtherCleanTime", typeof(Int32));
createCol(land, "Dwell", typeof(Int32));
land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]}; land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]};
@ -1400,7 +1399,6 @@ namespace OpenSim.Data.SQLiteLegacy
UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID); UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID);
newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
newData.Dwell = Convert.ToInt32(row["Dwell"]);
return newData; return newData;
} }
@ -1711,7 +1709,6 @@ namespace OpenSim.Data.SQLiteLegacy
row["UserLookAtZ"] = land.UserLookAt.Z; row["UserLookAtZ"] = land.UserLookAt.Z;
row["AuthbuyerID"] = land.AuthBuyerID.ToString(); row["AuthbuyerID"] = land.AuthBuyerID.ToString();
row["OtherCleanTime"] = land.OtherCleanTime; row["OtherCleanTime"] = land.OtherCleanTime;
row["Dwell"] = land.Dwell;
} }
/// <summary> /// <summary>

View File

@ -88,7 +88,6 @@ namespace OpenSim.Framework
private UUID _snapshotID = UUID.Zero; private UUID _snapshotID = UUID.Zero;
private Vector3 _userLocation = new Vector3(); private Vector3 _userLocation = new Vector3();
private Vector3 _userLookAt = new Vector3(); private Vector3 _userLookAt = new Vector3();
private int _dwell = 0;
private int _otherCleanTime = 0; private int _otherCleanTime = 0;
private string _mediaType = "none/none"; private string _mediaType = "none/none";
private string _mediaDescription = ""; private string _mediaDescription = "";
@ -619,18 +618,6 @@ namespace OpenSim.Framework
} }
} }
/// <summary>
/// Deprecated idea. Number of visitors ~= free money
/// </summary>
public int Dwell {
get {
return _dwell;
}
set {
_dwell = value;
}
}
/// <summary> /// <summary>
/// Number of minutes to return SceneObjectGroup that are owned by someone who doesn't own /// Number of minutes to return SceneObjectGroup that are owned by someone who doesn't own
/// the parcel and isn't set to the same 'group' as the parcel. /// the parcel and isn't set to the same 'group' as the parcel.
@ -703,7 +690,6 @@ namespace OpenSim.Framework
landData._userLocation = _userLocation; landData._userLocation = _userLocation;
landData._userLookAt = _userLookAt; landData._userLookAt = _userLookAt;
landData._otherCleanTime = _otherCleanTime; landData._otherCleanTime = _otherCleanTime;
landData._dwell = _dwell;
landData._mediaType = _mediaType; landData._mediaType = _mediaType;
landData._mediaDescription = _mediaDescription; landData._mediaDescription = _mediaDescription;
landData._mediaWidth = _mediaWidth; landData._mediaWidth = _mediaWidth;

View File

@ -806,7 +806,7 @@ namespace OpenSim.Framework
IConfig config = source.Configs[RegionName]; IConfig config = source.Configs[RegionName];
if (config != null) if (config != null)
source.Configs.Remove(RegionName); source.Configs.Remove(config);
config = source.AddConfig(RegionName); config = source.AddConfig(RegionName);
@ -865,11 +865,16 @@ namespace OpenSim.Framework
return; return;
} }
else if (filename.ToLower().EndsWith(".xml"))
{
configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe, configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe,
ignoreIncomingConfiguration, false); ignoreIncomingConfiguration, false);
configMember.performConfigurationRetrieve(); configMember.performConfigurationRetrieve();
RegionFile = filename; RegionFile = filename;
} }
else
throw new Exception("Invalid file type for region persistence.");
}
public void loadConfigurationOptionsFromMe() public void loadConfigurationOptionsFromMe()
{ {

View File

@ -118,7 +118,8 @@ namespace OpenSim.Framework.Serialization.External
landData.SnapshotID = UUID.Parse( xtr.ReadElementString("SnapshotID")); landData.SnapshotID = UUID.Parse( xtr.ReadElementString("SnapshotID"));
landData.UserLocation = Vector3.Parse( xtr.ReadElementString("UserLocation")); landData.UserLocation = Vector3.Parse( xtr.ReadElementString("UserLocation"));
landData.UserLookAt = Vector3.Parse( xtr.ReadElementString("UserLookAt")); landData.UserLookAt = Vector3.Parse( xtr.ReadElementString("UserLookAt"));
landData.Dwell = Convert.ToInt32( xtr.ReadElementString("Dwell")); // No longer used here
xtr.ReadElementString("Dwell");
landData.OtherCleanTime = Convert.ToInt32( xtr.ReadElementString("OtherCleanTime")); landData.OtherCleanTime = Convert.ToInt32( xtr.ReadElementString("OtherCleanTime"));
xtr.ReadEndElement(); xtr.ReadEndElement();
@ -177,7 +178,7 @@ namespace OpenSim.Framework.Serialization.External
xtw.WriteElementString("SnapshotID", landData.SnapshotID.ToString()); xtw.WriteElementString("SnapshotID", landData.SnapshotID.ToString());
xtw.WriteElementString("UserLocation", landData.UserLocation.ToString()); xtw.WriteElementString("UserLocation", landData.UserLocation.ToString());
xtw.WriteElementString("UserLookAt", landData.UserLookAt.ToString()); xtw.WriteElementString("UserLookAt", landData.UserLookAt.ToString());
xtw.WriteElementString("Dwell", Convert.ToString(landData.Dwell)); xtw.WriteElementString("Dwell", "0");
xtw.WriteElementString("OtherCleanTime", Convert.ToString(landData.OtherCleanTime)); xtw.WriteElementString("OtherCleanTime", Convert.ToString(landData.OtherCleanTime));
xtw.WriteEndElement(); xtw.WriteEndElement();

View File

@ -28,6 +28,7 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
@ -338,19 +339,25 @@ namespace OpenSim.Framework.Servers.HttpServer
// HandleRequest(request,resp); // HandleRequest(request,resp);
// } // }
/// <summary>
/// This methods is the start of incoming HTTP request handling.
/// </summary>
/// <param name="request"></param>
/// <param name="response"></param>
public virtual void HandleRequest(OSHttpRequest request, OSHttpResponse response) public virtual void HandleRequest(OSHttpRequest request, OSHttpResponse response)
{ {
try try
{ {
// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl);
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
// This is the REST agent interface. We require an agent to properly identify // This is the REST agent interface. We require an agent to properly identify
// itself. If the REST handler recognizes the prefix it will attempt to // itself. If the REST handler recognizes the prefix it will attempt to
// satisfy the request. If it is not recognizable, and no damage has occurred // satisfy the request. If it is not recognizable, and no damage has occurred
// the request can be passed through to the other handlers. This is a low // the request can be passed through to the other handlers. This is a low
// probability event; if a request is matched it is normally expected to be // probability event; if a request is matched it is normally expected to be
// handled // handled
// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl);
IHttpAgentHandler agentHandler; IHttpAgentHandler agentHandler;
if (TryGetAgentHandler(request, response, out agentHandler)) if (TryGetAgentHandler(request, response, out agentHandler))
@ -731,6 +738,7 @@ namespace OpenSim.Framework.Servers.HttpServer
if (methodWasFound) if (methodWasFound)
{ {
xmlRprcRequest.Params.Add(request.Url); // Param[2] xmlRprcRequest.Params.Add(request.Url); // Param[2]
xmlRprcRequest.Params.Add(request.Headers.Get("X-Forwarded-For")); // Param[3]
try try
{ {

View File

@ -57,12 +57,14 @@ namespace OpenSim.Framework.Servers.HttpServer
{ {
WebRequest request = WebRequest.Create(requestUrl); WebRequest request = WebRequest.Create(requestUrl);
request.Method = verb; request.Method = verb;
string respstring = String.Empty;
using (MemoryStream buffer = new MemoryStream())
{
if ((verb == "POST") || (verb == "PUT")) if ((verb == "POST") || (verb == "PUT"))
{ {
request.ContentType = "text/www-form-urlencoded"; request.ContentType = "text/www-form-urlencoded";
MemoryStream buffer = new MemoryStream();
int length = 0; int length = 0;
using (StreamWriter writer = new StreamWriter(buffer)) using (StreamWriter writer = new StreamWriter(buffer))
{ {
@ -85,21 +87,11 @@ namespace OpenSim.Framework.Servers.HttpServer
} }
finally finally
{ {
// If this is closed, it will be disposed internally, if (requestStream != null)
// but the above write is asynchronous and may hit after requestStream.Close();
// we're through here. So the thread handling that will
// throw and put us back into the catch above. Isn't
// .NET great?
//if (requestStream != null)
// requestStream.Close();
// Let's not close this
//buffer.Close();
} }
} }
string respstring = String.Empty;
try try
{ {
using (WebResponse resp = request.GetResponse()) using (WebResponse resp = request.GetResponse())
@ -132,6 +124,7 @@ namespace OpenSim.Framework.Servers.HttpServer
// This is what happens when there is invalid XML // This is what happens when there is invalid XML
m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request"); m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request");
} }
}
return respstring; return respstring;
} }
} }

View File

@ -1495,5 +1495,49 @@ namespace OpenSim.Framework
} }
} }
/// <summary>
/// Gets the client IP address
/// </summary>
/// <param name="xff"></param>
/// <returns></returns>
public static IPEndPoint GetClientIPFromXFF(string xff)
{
if (xff == string.Empty)
return null;
string[] parts = xff.Split(new char[] { ',' });
if (parts.Length > 0)
{
try
{
return new IPEndPoint(IPAddress.Parse(parts[0]), 0);
}
catch (Exception e)
{
m_log.WarnFormat("[UTIL]: Exception parsing XFF header {0}: {1}", xff, e.Message);
}
}
return null;
}
public static string GetCallerIP(Hashtable req)
{
if (req.ContainsKey("headers"))
{
try
{
Hashtable headers = (Hashtable)req["headers"];
if (headers.ContainsKey("remote_addr") && headers["remote_addr"] != null)
return headers["remote_addr"].ToString();
}
catch (Exception e)
{
m_log.WarnFormat("[UTIL]: exception in GetCallerIP: {0}", e.Message);
}
}
return string.Empty;
}
} }
} }

View File

@ -218,7 +218,13 @@ namespace OpenSim
m_console.Commands.AddCommand("region", false, "debug packet", m_console.Commands.AddCommand("region", false, "debug packet",
"debug packet <level>", "debug packet <level>",
"Turn on packet debugging", Debug); "Turn on packet debugging",
"If level > 255 then all incoming and outgoing packets are logged.\n"
+ "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n"
+ "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n"
+ "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n"
+ "If level <= 0 then no packets are logged.",
Debug);
m_console.Commands.AddCommand("region", false, "debug scene", m_console.Commands.AddCommand("region", false, "debug scene",
"debug scene <cripting> <collisions> <physics>", "debug scene <cripting> <collisions> <physics>",

View File

@ -36,7 +36,6 @@ using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
@ -403,7 +402,9 @@ namespace OpenSim
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("[STARTUP]: Registration of region with grid failed, aborting startup - {0}", e.StackTrace); m_log.ErrorFormat(
"[STARTUP]: Registration of region with grid failed, aborting startup due to {0} {1}",
e.Message, e.StackTrace);
if (scene.SnmpService != null) if (scene.SnmpService != null)
{ {

View File

@ -60,7 +60,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector
{ {
/// <value> /// <value>
/// Debug packet level. At the moment, only 255 does anything (prints out all in and out packets). /// Debug packet level. See OpenSim.RegisterConsoleCommands() for more details.
/// </value> /// </value>
protected int m_debugPacketLevel = 0; protected int m_debugPacketLevel = 0;
@ -2687,6 +2687,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void SendParcelInfo(RegionInfo info, LandData land, UUID parcelID, uint x, uint y) public void SendParcelInfo(RegionInfo info, LandData land, UUID parcelID, uint x, uint y)
{ {
float dwell = 0.0f;
IDwellModule dwellModule = m_scene.RequestModuleInterface<IDwellModule>();
if (dwellModule != null)
dwell = dwellModule.GetDwell(land.GlobalID);
ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply); ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply);
reply.AgentData.AgentID = m_agentId; reply.AgentData.AgentID = m_agentId;
reply.Data.ParcelID = parcelID; reply.Data.ParcelID = parcelID;
@ -2711,7 +2715,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
reply.Data.GlobalZ = pos.Z; reply.Data.GlobalZ = pos.Z;
reply.Data.SimName = Utils.StringToBytes(info.RegionName); reply.Data.SimName = Utils.StringToBytes(info.RegionName);
reply.Data.SnapshotID = land.SnapshotID; reply.Data.SnapshotID = land.SnapshotID;
reply.Data.Dwell = land.Dwell; reply.Data.Dwell = dwell;
reply.Data.SalePrice = land.SalePrice; reply.Data.SalePrice = land.SalePrice;
reply.Data.AuctionID = (int)land.AuctionID; reply.Data.AuctionID = (int)land.AuctionID;
@ -11229,8 +11233,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// handles splitting manually</param> /// handles splitting manually</param>
protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting) protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting)
{ {
if (m_debugPacketLevel >= 255) if (m_debugPacketLevel > 0)
{
bool outputPacket = true;
if (m_debugPacketLevel <= 255
&& (packet.Type == PacketType.SimStats || packet.Type == PacketType.SimulatorViewerTimeMessage))
outputPacket = false;
if (m_debugPacketLevel <= 200
&&
(packet.Type == PacketType.ImagePacket
|| packet.Type == PacketType.ImageData
|| packet.Type == PacketType.LayerData
|| packet.Type == PacketType.CoarseLocationUpdate))
outputPacket = false;
if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.AvatarAnimation || packet.Type == PacketType.ViewerEffect))
outputPacket = false;
if (outputPacket)
m_log.DebugFormat("[CLIENT]: Packet OUT {0}", packet.Type); m_log.DebugFormat("[CLIENT]: Packet OUT {0}", packet.Type);
}
m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting); m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting);
} }
@ -11316,26 +11340,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// Entryway from the client to the simulator. All UDP packets from the client will end up here /// Entryway from the client to the simulator. All UDP packets from the client will end up here
/// </summary> /// </summary>
/// <param name="Pack">OpenMetaverse.packet</param> /// <param name="Pack">OpenMetaverse.packet</param>
public void ProcessInPacket(Packet Pack) public void ProcessInPacket(Packet packet)
{ {
if (!m_IsPresenceReady) if (m_debugPacketLevel > 0)
{ {
if (m_pendingPackets == null) bool outputPacket = true;
{
m_pendingPackets = new List<Packet>();
}
m_pendingPackets.Add(Pack);
}
else
{
if (m_debugPacketLevel >= 255)
m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type);
if (!ProcessPacketMethod(Pack)) if (m_debugPacketLevel <= 255 && packet.Type == PacketType.AgentUpdate)
m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type); outputPacket = false;
PacketPool.Instance.ReturnPacket(Pack); if (m_debugPacketLevel <= 200 && packet.Type == PacketType.RequestImage)
outputPacket = false;
if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.ViewerEffect || packet.Type == PacketType.AgentAnimation))
outputPacket = false;
if (outputPacket)
m_log.DebugFormat("[CLIENT]: Packet IN {0}", packet.Type);
} }
if (!ProcessPacketMethod(packet))
m_log.Warn("[CLIENT]: unhandled packet " + packet.Type);
PacketPool.Instance.ReturnPacket(packet);
} }
private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket) private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket)

View File

@ -214,8 +214,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
{ {
m_userTransactions.Manager.MyScene.AssetService.Store(m_asset); m_userTransactions.Manager.MyScene.AssetService.Store(m_asset);
IInventoryService invService = m_userTransactions.Manager.MyScene.InventoryService;
InventoryItemBase item = new InventoryItemBase(); InventoryItemBase item = new InventoryItemBase();
item.Owner = ourClient.AgentId; item.Owner = ourClient.AgentId;
item.CreatorId = ourClient.AgentId.ToString(); item.CreatorId = ourClient.AgentId.ToString();
@ -234,7 +232,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
item.Flags = (uint) wearableType; item.Flags = (uint) wearableType;
item.CreationDate = Util.UnixTimeSinceEpoch(); item.CreationDate = Util.UnixTimeSinceEpoch();
if (invService.AddItem(item)) if (m_userTransactions.Manager.MyScene.AddInventoryItem(item))
ourClient.SendInventoryItemCreateUpdate(item, callbackID); ourClient.SendInventoryItemCreateUpdate(item, callbackID);
else else
ourClient.SendAlertMessage("Unable to create inventory item"); ourClient.SendAlertMessage("Unable to create inventory item");

View File

@ -174,17 +174,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
UUID itemID = UUID.Zero; UUID itemID = UUID.Zero;
if (sp != null) if (sp != null)
{ {
foreach(SceneObjectGroup grp in sp.Attachments) foreach(SceneObjectGroup grp in sp.GetAttachments(AttachmentPt))
{
if (grp.GetAttachmentPoint() == (byte)AttachmentPt)
{ {
itemID = grp.GetFromItemID(); itemID = grp.GetFromItemID();
break;
}
}
if (itemID != UUID.Zero) if (itemID != UUID.Zero)
DetachSingleAttachmentToInv(itemID, remoteClient); DetachSingleAttachmentToInv(itemID, remoteClient);
} }
}
if (group.GetFromItemID() == UUID.Zero) if (group.GetFromItemID() == UUID.Zero)
{ {
@ -197,12 +193,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemID, group); SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemID, group);
group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); AttachToAgent(sp, group, AttachmentPt, attachPos, silent);
// In case it is later dropped again, don't let
// it get cleaned up
group.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
group.HasGroupChanged = false;
} }
else else
{ {
@ -280,8 +271,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint())
tainted = true; tainted = true;
// This will throw if the attachment fails
try
{
AttachObject(remoteClient, objatt, AttachmentPt, false); AttachObject(remoteClient, objatt, AttachmentPt, false);
//objatt.ScheduleGroupForFullUpdate(); }
catch
{
// Make sure the object doesn't stick around and bail
m_scene.DeleteSceneObject(objatt, false);
return null;
}
if (tainted) if (tainted)
objatt.HasGroupChanged = true; objatt.HasGroupChanged = true;
@ -552,5 +552,77 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
} }
} }
} }
/// <summary>
/// Attach this scene object to the given avatar.
/// </summary>
///
/// This isn't publicly available since attachments should always perform the corresponding inventory
/// operation (to show the attach in user inventory and update the asset with positional information).
///
/// <param name="sp"></param>
/// <param name="so"></param>
/// <param name="attachmentpoint"></param>
/// <param name="AttachOffset"></param>
/// <param name="silent"></param>
protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 AttachOffset, bool silent)
{
// don't attach attachments to child agents
if (avatar.IsChildAgent) return;
// m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1}", Name, avatar.Name);
so.DetachFromBackup();
// Remove from database and parcel prim count
m_scene.DeleteFromStorage(so.UUID);
m_scene.EventManager.TriggerParcelPrimCountTainted();
so.RootPart.AttachedAvatar = avatar.UUID;
//Anakin Lohner bug #3839
lock (so.Children)
{
foreach (SceneObjectPart p in so.Children.Values)
{
p.AttachedAvatar = avatar.UUID;
}
}
if (so.RootPart.PhysActor != null)
{
m_scene.PhysicsScene.RemovePrim(so.RootPart.PhysActor);
so.RootPart.PhysActor = null;
}
so.AbsolutePosition = AttachOffset;
so.RootPart.AttachedPos = AttachOffset;
so.RootPart.IsAttachment = true;
so.RootPart.SetParentLocalId(avatar.LocalId);
so.SetAttachmentPoint(Convert.ToByte(attachmentpoint));
avatar.AddAttachment(so);
if (!silent)
{
// Killing it here will cause the client to deselect it
// It then reappears on the avatar, deselected
// through the full update below
//
if (so.IsSelected)
{
m_scene.SendKillObject(so.RootPart.LocalId);
}
so.IsSelected = false; // fudge....
so.ScheduleGroupForFullUpdate();
}
// In case it is later dropped again, don't let
// it get cleaned up
so.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
so.HasGroupChanged = false;
}
} }
} }

View File

@ -406,8 +406,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
// Reset folder ID to the one in which we want to load it // Reset folder ID to the one in which we want to load it
item.Folder = loadFolder.ID; item.Folder = loadFolder.ID;
//m_userInfo.AddItem(item); m_scene.AddInventoryItem(item);
m_scene.InventoryService.AddItem(item);
return item; return item;
} }

View File

@ -41,7 +41,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// </summary> /// </summary>
public static class InventoryArchiveUtils public static class InventoryArchiveUtils
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// Character used for escaping the path delimter ("\/") and itself ("\\") in human escaped strings // Character used for escaping the path delimter ("\/") and itself ("\\") in human escaped strings
public static readonly char ESCAPE_CHARACTER = '\\'; public static readonly char ESCAPE_CHARACTER = '\\';

View File

@ -163,7 +163,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
InventoryFolderBase objsFolder InventoryFolderBase objsFolder
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0]; = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
item1.Folder = objsFolder.ID; item1.Folder = objsFolder.ID;
scene.AddInventoryItem(userId, item1); scene.AddInventoryItem(item1);
MemoryStream archiveWriteStream = new MemoryStream(); MemoryStream archiveWriteStream = new MemoryStream();
archiverModule.OnInventoryArchiveSaved += SaveCompleted; archiverModule.OnInventoryArchiveSaved += SaveCompleted;
@ -282,7 +282,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
InventoryFolderBase objsFolder InventoryFolderBase objsFolder
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0]; = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
item1.Folder = objsFolder.ID; item1.Folder = objsFolder.ID;
scene.AddInventoryItem(userId, item1); scene.AddInventoryItem(item1);
MemoryStream archiveWriteStream = new MemoryStream(); MemoryStream archiveWriteStream = new MemoryStream();
archiverModule.OnInventoryArchiveSaved += SaveCompleted; archiverModule.OnInventoryArchiveSaved += SaveCompleted;
@ -485,7 +485,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
InventoryFolderBase objsFolder InventoryFolderBase objsFolder
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0]; = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
item1.Folder = objsFolder.ID; item1.Folder = objsFolder.ID;
scene.AddInventoryItem(userId, item1); scene.AddInventoryItem(item1);
MemoryStream archiveWriteStream = new MemoryStream(); MemoryStream archiveWriteStream = new MemoryStream();
archiverModule.OnInventoryArchiveSaved += SaveCompleted; archiverModule.OnInventoryArchiveSaved += SaveCompleted;

View File

@ -54,12 +54,12 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
}; };
} }
private static byte[] uintToByteArray(uint uIntValue) // private static byte[] uintToByteArray(uint uIntValue)
{ // {
byte[] result = new byte[4]; // byte[] result = new byte[4];
Utils.UIntToBytesBig(uIntValue, result, 0); // Utils.UIntToBytesBig(uIntValue, result, 0);
return result; // return result;
} // }
public static OSD buildEvent(string eventName, OSD eventBody) public static OSD buildEvent(string eventName, OSD eventBody)
{ {

View File

@ -132,7 +132,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
} }
// DO NOT OVERRIDE THE BASE METHOD // DO NOT OVERRIDE THE BASE METHOD
public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, public new virtual UUID DeleteToInventory(DeRezAction action, UUID folderID,
SceneObjectGroup objectGroup, IClientAPI remoteClient) SceneObjectGroup objectGroup, IClientAPI remoteClient)
{ {
UUID assetID = base.DeleteToInventory(action, folderID, new List<SceneObjectGroup>() {objectGroup}, remoteClient); UUID assetID = base.DeleteToInventory(action, folderID, new List<SceneObjectGroup>() {objectGroup}, remoteClient);

View File

@ -430,7 +430,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
item.Name = asset.Name; item.Name = asset.Name;
item.AssetType = asset.Type; item.AssetType = asset.Type;
m_Scene.InventoryService.AddItem(item); m_Scene.AddInventoryItem(item);
if (remoteClient != null && item.Owner == remoteClient.AgentId) if (remoteClient != null && item.Owner == remoteClient.AgentId)
{ {

View File

@ -1,4 +1,4 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *

View File

@ -222,34 +222,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
// "[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}", // "[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}",
// item.Name, item.Owner, item.Folder); // item.Name, item.Owner, item.Folder);
if (UUID.Zero == item.Folder)
{
InventoryFolderBase f = m_InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType);
if (f != null)
{
// m_log.DebugFormat(
// "[LOCAL INVENTORY SERVICES CONNECTOR]: Found folder {0} type {1} for item {2}",
// f.Name, (AssetType)f.Type, item.Name);
item.Folder = f.ID;
}
else
{
f = m_InventoryService.GetRootFolder(item.Owner);
if (f != null)
{
item.Folder = f.ID;
}
else
{
// m_log.WarnFormat(
// "[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified",
// item.Owner, item.Name);
return false;
}
}
}
return m_InventoryService.AddItem(item); return m_InventoryService.AddItem(item);
} }

View File

@ -229,30 +229,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
if (item == null) if (item == null)
return false; return false;
if (UUID.Zero == item.Folder)
{
InventoryFolderBase f = m_RemoteConnector.GetFolderForType(item.Owner, (AssetType)item.AssetType);
if (f != null)
{
item.Folder = f.ID;
}
else
{
f = m_RemoteConnector.GetRootFolder(item.Owner);
if (f != null)
{
item.Folder = f.ID;
}
else
{
m_log.WarnFormat(
"[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified",
item.Owner, item.Name);
return false;
}
}
}
return m_RemoteConnector.AddItem(item); return m_RemoteConnector.AddItem(item);
} }

View File

@ -171,7 +171,6 @@ namespace OpenSim.Region.CoreModules.World.Land
client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner; client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner;
client.OnParcelReclaim += ClientOnParcelReclaim; client.OnParcelReclaim += ClientOnParcelReclaim;
client.OnParcelInfoRequest += ClientOnParcelInfoRequest; client.OnParcelInfoRequest += ClientOnParcelInfoRequest;
// client.OnParcelDwellRequest += ClientOnParcelDwellRequest;
client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup;
client.OnPreAgentUpdate += ClientOnPreAgentUpdate; client.OnPreAgentUpdate += ClientOnPreAgentUpdate;
@ -1116,7 +1115,11 @@ namespace OpenSim.Region.CoreModules.World.Land
m_landList.TryGetValue(localID, out land); m_landList.TryGetValue(localID, out land);
} }
if (land != null) land.UpdateLandProperties(args, remote_client); if (land != null)
{
land.UpdateLandProperties(args, remote_client);
m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(args, localID, remote_client);
}
} }
public void ClientOnParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client) public void ClientOnParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client)
@ -1434,9 +1437,13 @@ namespace OpenSim.Region.CoreModules.World.Land
m_landList.TryGetValue(parcelID, out land); m_landList.TryGetValue(parcelID, out land);
} }
if (land != null) { if (land != null)
{
land.UpdateLandProperties(land_update, client); land.UpdateLandProperties(land_update, client);
} else { m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(land_update, parcelID, client);
}
else
{
m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID); m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID);
} }
return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
@ -1512,18 +1519,6 @@ namespace OpenSim.Region.CoreModules.World.Land
#endregion #endregion
private void ClientOnParcelDwellRequest(int localID, IClientAPI remoteClient)
{
ILandObject selectedParcel = null;
lock (m_landList)
{
if (!m_landList.TryGetValue(localID, out selectedParcel))
return;
}
remoteClient.SendParcelDwellReply(localID, selectedParcel.LandData.GlobalID, selectedParcel.LandData.Dwell);
}
private void ClientOnParcelInfoRequest(IClientAPI remoteClient, UUID parcelID) private void ClientOnParcelInfoRequest(IClientAPI remoteClient, UUID parcelID)
{ {
if (parcelID == UUID.Zero) if (parcelID == UUID.Zero)

View File

@ -219,7 +219,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
item.CurrentPermissions |= 16; // Slam! item.CurrentPermissions |= 16; // Slam!
item.CreationDate = Util.UnixTimeSinceEpoch(); item.CreationDate = Util.UnixTimeSinceEpoch();
if (m_scene.InventoryService.AddItem(item)) if (m_scene.AddInventoryItem(item))
{ {
remoteClient.SendInventoryItemCreateUpdate(item, 0); remoteClient.SendInventoryItemCreateUpdate(item, 0);
} }

View File

@ -123,6 +123,8 @@ namespace OpenSim.Region.DataSnapshot.Providers
ILandChannel landChannel = m_scene.LandChannel; ILandChannel landChannel = m_scene.LandChannel;
List<ILandObject> parcels = landChannel.AllParcels(); List<ILandObject> parcels = landChannel.AllParcels();
IDwellModule dwellModule = m_scene.RequestModuleInterface<IDwellModule>();
XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "parceldata", ""); XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "parceldata", "");
if (parcels != null) if (parcels != null)
{ {
@ -208,7 +210,10 @@ namespace OpenSim.Region.DataSnapshot.Providers
xmlparcel.AppendChild(infouuid); xmlparcel.AppendChild(infouuid);
XmlNode dwell = nodeFactory.CreateNode(XmlNodeType.Element, "dwell", ""); XmlNode dwell = nodeFactory.CreateNode(XmlNodeType.Element, "dwell", "");
dwell.InnerText = parcel.Dwell.ToString(); if (dwellModule != null)
dwell.InnerText = dwellModule.GetDwell(parcel.GlobalID).ToString();
else
dwell.InnerText = "0";
xmlparcel.AppendChild(dwell); xmlparcel.AppendChild(dwell);
//TODO: figure how to figure out teleport system landData.landingType //TODO: figure how to figure out teleport system landData.landingType

View File

@ -113,6 +113,8 @@ namespace OpenSim.Region.Framework.Scenes
public event OnSetRootAgentSceneDelegate OnSetRootAgentScene; public event OnSetRootAgentSceneDelegate OnSetRootAgentScene;
public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
/// <summary> /// <summary>
/// Fired when an object is touched/grabbed. /// Fired when an object is touched/grabbed.
/// </summary> /// </summary>
@ -2128,5 +2130,27 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
} }
public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args,
int local_id, IClientAPI remote_client)
{
ParcelPropertiesUpdateRequest handler = OnParcelPropertiesUpdateRequest;
if (handler != null)
{
foreach (ParcelPropertiesUpdateRequest d in handler.GetInvocationList())
{
try
{
d(args, local_id, remote_client);
}
catch (Exception e)
{
m_log.ErrorFormat(
"[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPartCopy failed - continuing. {0} {1}",
e.Message, e.StackTrace);
}
}
}
}
} }
} }

View File

@ -76,12 +76,12 @@ namespace OpenSim.Region.Framework.Scenes
money.ApplyUploadCharge(agentID, money.UploadCharge, "Asset upload"); money.ApplyUploadCharge(agentID, money.UploadCharge, "Asset upload");
} }
AddInventoryItem(agentID, item); AddInventoryItem(item);
} }
public bool AddInventoryItemReturned(UUID AgentId, InventoryItemBase item) public bool AddInventoryItemReturned(UUID AgentId, InventoryItemBase item)
{ {
if (InventoryService.AddItem(item)) if (AddInventoryItem(item))
return true; return true;
else else
{ {
@ -92,19 +92,23 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
public void AddInventoryItem(UUID AgentID, InventoryItemBase item) /// <summary>
/// Add the given inventory item to a user's inventory.
/// </summary>
/// <param name="item"></param>
public bool AddInventoryItem(InventoryItemBase item)
{ {
InventoryFolderBase folder; InventoryFolderBase folder;
if (item.Folder == UUID.Zero) if (item.Folder == UUID.Zero)
{ {
folder = InventoryService.GetFolderForType(AgentID, (AssetType)item.AssetType); folder = InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType);
if (folder == null) if (folder == null)
{ {
folder = InventoryService.GetRootFolder(AgentID); folder = InventoryService.GetRootFolder(item.Owner);
if (folder == null) if (folder == null)
return; return false;
} }
item.Folder = folder.ID; item.Folder = folder.ID;
@ -113,22 +117,39 @@ namespace OpenSim.Region.Framework.Scenes
if (InventoryService.AddItem(item)) if (InventoryService.AddItem(item))
{ {
int userlevel = 0; int userlevel = 0;
if (Permissions.IsGod(AgentID)) if (Permissions.IsGod(item.Owner))
{ {
userlevel = 1; userlevel = 1;
} }
EventManager.TriggerOnNewInventoryItemUploadComplete(AgentID, item.AssetID, item.Name, userlevel); EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, item.AssetID, item.Name, userlevel);
return true;
} }
else else
{ {
m_log.WarnFormat( m_log.WarnFormat(
"[AGENT INVENTORY]: Agent {0} could not add item {1} {2}", "[AGENT INVENTORY]: Agent {0} could not add item {1} {2}",
AgentID, item.Name, item.ID); item.Owner, item.Name, item.ID);
return; return false;
} }
} }
/// <summary>
/// Add the given inventory item to a user's inventory.
/// </summary>
/// <param name="AgentID">
/// A <see cref="UUID"/>
/// </param>
/// <param name="item">
/// A <see cref="InventoryItemBase"/>
/// </param>
[Obsolete("Use AddInventoryItem(InventoryItemBase item) instead. This was deprecated in OpenSim 0.7.1")]
public void AddInventoryItem(UUID AgentID, InventoryItemBase item)
{
AddInventoryItem(item);
}
/// <summary> /// <summary>
/// Add an inventory item to an avatar's inventory. /// Add an inventory item to an avatar's inventory.
/// </summary> /// </summary>
@ -137,7 +158,7 @@ namespace OpenSim.Region.Framework.Scenes
/// in which the item is to be placed.</param> /// in which the item is to be placed.</param>
public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
{ {
AddInventoryItem(remoteClient.AgentId, item); AddInventoryItem(item);
remoteClient.SendInventoryItemCreateUpdate(item, 0); remoteClient.SendInventoryItemCreateUpdate(item, 0);
} }
@ -529,7 +550,7 @@ namespace OpenSim.Region.Framework.Scenes
itemCopy.SalePrice = item.SalePrice; itemCopy.SalePrice = item.SalePrice;
itemCopy.SaleType = item.SaleType; itemCopy.SaleType = item.SaleType;
if (InventoryService.AddItem(itemCopy)) if (AddInventoryItem(itemCopy))
{ {
IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>();
if (invAccess != null) if (invAccess != null)
@ -775,8 +796,10 @@ namespace OpenSim.Region.Framework.Scenes
item.BasePermissions = baseMask; item.BasePermissions = baseMask;
item.CreationDate = creationDate; item.CreationDate = creationDate;
if (InventoryService.AddItem(item)) if (AddInventoryItem(item))
{
remoteClient.SendInventoryItemCreateUpdate(item, callbackID); remoteClient.SendInventoryItemCreateUpdate(item, callbackID);
}
else else
{ {
m_dialogModule.SendAlertToUser(remoteClient, "Failed to create item"); m_dialogModule.SendAlertToUser(remoteClient, "Failed to create item");
@ -1142,7 +1165,7 @@ namespace OpenSim.Region.Framework.Scenes
agentItem.Folder = folderId; agentItem.Folder = folderId;
AddInventoryItem(avatarId, agentItem); AddInventoryItem(agentItem);
return agentItem; return agentItem;
} }
@ -1266,7 +1289,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
agentItem.Folder = newFolderID; agentItem.Folder = newFolderID;
AddInventoryItem(destID, agentItem); AddInventoryItem(agentItem);
} }
} }
@ -1908,7 +1931,7 @@ namespace OpenSim.Region.Framework.Scenes
// sets itemID so client can show item as 'attached' in inventory // sets itemID so client can show item as 'attached' in inventory
grp.SetFromItemID(item.ID); grp.SetFromItemID(item.ID);
if (InventoryService.AddItem(item)) if (AddInventoryItem(item))
remoteClient.SendInventoryItemCreateUpdate(item, 0); remoteClient.SendInventoryItemCreateUpdate(item, 0);
else else
m_dialogModule.SendAlertToUser(remoteClient, "Operation failed"); m_dialogModule.SendAlertToUser(remoteClient, "Operation failed");

View File

@ -2729,6 +2729,8 @@ namespace OpenSim.Region.Framework.Scenes
try try
{ {
ScenePresence sp = GetScenePresence(agentID); ScenePresence sp = GetScenePresence(agentID);
PresenceService.LogoutAgent(sp.ControllingClient.SessionId);
if (sp != null) if (sp != null)
sp.ControllingClient.Close(); sp.ControllingClient.Close();

View File

@ -1619,11 +1619,6 @@ namespace OpenSim.Region.Framework.Scenes
if (child != null) if (child != null)
{ {
// Make sure no child prim is set for sale
// So that, on delink, no prims are unwittingly
// left for sale and sold off
child.RootPart.ObjectSaleType = 0;
child.RootPart.SalePrice = 10;
childGroups.Add(child); childGroups.Add(child);
} }
} }
@ -1907,9 +1902,6 @@ namespace OpenSim.Region.Framework.Scenes
child.ApplyNextOwnerPermissions(); child.ApplyNextOwnerPermissions();
} }
} }
copy.RootPart.ObjectSaleType = 0;
copy.RootPart.SalePrice = 10;
} }
Entities.Add(copy); Entities.Add(copy);

View File

@ -278,7 +278,7 @@ namespace OpenSim.Region.Framework.Scenes
if (!m_part.ParentGroup.Scene.RegionInfo.RegionSettings.DisableScripts) if (!m_part.ParentGroup.Scene.RegionInfo.RegionSettings.DisableScripts)
{ {
if (stateSource == 1 && // Prim crossing if (stateSource == 2 && // Prim crossing
m_part.ParentGroup.Scene.m_trustBinaries) m_part.ParentGroup.Scene.m_trustBinaries)
{ {
m_items.LockItemsForWrite(true); m_items.LockItemsForWrite(true);

View File

@ -3914,6 +3914,27 @@ if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for ju
} }
} }
/// <summary>
/// Get the scene object attached to the given point.
/// </summary>
/// <param name="attachmentPoint"></param>
/// <returns>Returns an empty list if there were no attachments at the point.</returns>
public List<SceneObjectGroup> GetAttachments(uint attachmentPoint)
{
List<SceneObjectGroup> attachments = new List<SceneObjectGroup>();
lock (m_attachments)
{
foreach (SceneObjectGroup so in m_attachments)
{
if (attachmentPoint == so.RootPart.AttachmentPoint)
attachments.Add(so);
}
}
return attachments;
}
public bool HasAttachments() public bool HasAttachments()
{ {
return m_attachments.Count > 0; return m_attachments.Count > 0;

View File

@ -134,5 +134,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
#endregion #endregion
[Test]
// llRot2Euler test.
public void TestllRot2Euler()
{
// 180, 90 and zero degree rotations.
CheckllRot2Euler(new LSL_Types.Quaternion(1.0f, 0.0f, 0.0f, 0.0f), new LSL_Types.Vector3(Math.PI, 0.0f, 0.0f));
CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 1.0f, 0.0f, 0.0f), new LSL_Types.Vector3(Math.PI, 0.0f, Math.PI));
CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 1.0f, 0.0f), new LSL_Types.Vector3(0.0f, 0.0f, Math.PI));
CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 0.0f, 1.0f), new LSL_Types.Vector3(0.0f, 0.0f, 0.0f));
CheckllRot2Euler(new LSL_Types.Quaternion(-0.5f, -0.5f, 0.5f, 0.5f), new LSL_Types.Vector3(0, -Math.PI / 2.0f, Math.PI / 2.0f));
CheckllRot2Euler(new LSL_Types.Quaternion(-0.707107f, 0.0f, 0.0f, -0.707107f), new LSL_Types.Vector3(Math.PI / 2.0f, 0.0f, 0.0f));
// A couple of messy rotations.
CheckllRot2Euler(new LSL_Types.Quaternion(1.0f, 5.651f, -3.1f, 67.023f), new LSL_Types.Vector3(0.037818f, 0.166447f, -0.095595f));
CheckllRot2Euler(new LSL_Types.Quaternion(0.719188f, -0.408934f, -0.363998f, -0.427841f), new LSL_Types.Vector3(-1.954769f, -0.174533f, 1.151917f));
}
private void CheckllRot2Euler(LSL_Types.Quaternion rot, LSL_Types.Vector3 eulerCheck)
{
// Call LSL function to convert quaternion rotaion to euler radians.
LSL_Types.Vector3 eulerCalc = m_lslApi.llRot2Euler(rot);
// Check upper and lower bounds of x, y and z.
// This type of check is performed as opposed to comparing for equal numbers, in order to allow slight
// differences in accuracy.
Assert.Greater(eulerCalc.x, eulerCheck.x - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler X lower bounds check fail");
Assert.Less(eulerCalc.x, eulerCheck.x + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler X upper bounds check fail");
Assert.Greater(eulerCalc.y, eulerCheck.y - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Y lower bounds check fail");
Assert.Less(eulerCalc.y, eulerCheck.y + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Y upper bounds check fail");
Assert.Greater(eulerCalc.z, eulerCheck.z - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z lower bounds check fail");
Assert.Less(eulerCalc.z, eulerCheck.z + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z upper bounds check fail");
}
} }
} }

View File

@ -54,9 +54,12 @@ namespace OpenSim.Server.Handlers.Hypergrid
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IUserAgentService m_UserAgentService; private IUserAgentService m_UserAgentService;
public HomeAgentHandler(IUserAgentService userAgentService) private string m_LoginServerIP;
public HomeAgentHandler(IUserAgentService userAgentService, string loginServerIP)
{ {
m_UserAgentService = userAgentService; m_UserAgentService = userAgentService;
m_LoginServerIP = loginServerIP;
} }
public Hashtable Handler(Hashtable request) public Hashtable Handler(Hashtable request)
@ -120,6 +123,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
string regionname = string.Empty; string regionname = string.Empty;
string gatekeeper_host = string.Empty; string gatekeeper_host = string.Empty;
int gatekeeper_port = 0; int gatekeeper_port = 0;
IPEndPoint client_ipaddress = null;
if (args.ContainsKey("gatekeeper_host") && args["gatekeeper_host"] != null) if (args.ContainsKey("gatekeeper_host") && args["gatekeeper_host"] != null)
gatekeeper_host = args["gatekeeper_host"].AsString(); gatekeeper_host = args["gatekeeper_host"].AsString();
@ -144,6 +148,24 @@ namespace OpenSim.Server.Handlers.Hypergrid
if (args.ContainsKey("destination_name") && args["destination_name"] != null) if (args.ContainsKey("destination_name") && args["destination_name"] != null)
regionname = args["destination_name"].ToString(); regionname = args["destination_name"].ToString();
if (args.ContainsKey("client_ip") && args["client_ip"] != null)
{
string ip_str = args["client_ip"].ToString();
try
{
string callerIP = Util.GetCallerIP(request);
// Verify if this caller has authority to send the client IP
if (callerIP == m_LoginServerIP)
client_ipaddress = new IPEndPoint(IPAddress.Parse(ip_str), 0);
else
m_log.WarnFormat("[HOME AGENT HANDLER]: Unauthorized machine {0} tried to set client ip to {1}", callerIP, ip_str);
}
catch
{
m_log.DebugFormat("[HOME AGENT HANDLER]: Exception parsing client ip address from {0}", ip_str);
}
}
GridRegion destination = new GridRegion(); GridRegion destination = new GridRegion();
destination.RegionID = uuid; destination.RegionID = uuid;
destination.RegionLocX = x; destination.RegionLocX = x;
@ -166,7 +188,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
OSDMap resp = new OSDMap(2); OSDMap resp = new OSDMap(2);
string reason = String.Empty; string reason = String.Empty;
bool result = m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, out reason); bool result = m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, client_ipaddress, out reason);
resp["reason"] = OSD.FromString(reason); resp["reason"] = OSD.FromString(reason);
resp["success"] = OSD.FromBoolean(result); resp["success"] = OSD.FromBoolean(result);

View File

@ -66,13 +66,15 @@ namespace OpenSim.Server.Handlers.Hypergrid
if (m_HomeUsersService == null) if (m_HomeUsersService == null)
throw new Exception("UserAgent server connector cannot proceed because of missing service"); throw new Exception("UserAgent server connector cannot proceed because of missing service");
string loginServerIP = gridConfig.GetString("LoginServerIP", "127.0.0.1");
server.AddXmlRPCHandler("agent_is_coming_home", AgentIsComingHome, false); server.AddXmlRPCHandler("agent_is_coming_home", AgentIsComingHome, false);
server.AddXmlRPCHandler("get_home_region", GetHomeRegion, false); server.AddXmlRPCHandler("get_home_region", GetHomeRegion, false);
server.AddXmlRPCHandler("verify_agent", VerifyAgent, false); server.AddXmlRPCHandler("verify_agent", VerifyAgent, false);
server.AddXmlRPCHandler("verify_client", VerifyClient, false); server.AddXmlRPCHandler("verify_client", VerifyClient, false);
server.AddXmlRPCHandler("logout_agent", LogoutAgent, false); server.AddXmlRPCHandler("logout_agent", LogoutAgent, false);
server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService).Handler); server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService, loginServerIP).Handler);
} }
public XmlRpcResponse GetHomeRegion(XmlRpcRequest request, IPEndPoint remoteClient) public XmlRpcResponse GetHomeRegion(XmlRpcRequest request, IPEndPoint remoteClient)

View File

@ -52,15 +52,24 @@ namespace OpenSim.Server.Handlers.Login
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private ILoginService m_LocalService; private ILoginService m_LocalService;
private bool m_Proxy;
public LLLoginHandlers(ILoginService service) public LLLoginHandlers(ILoginService service, bool hasProxy)
{ {
m_LocalService = service; m_LocalService = service;
m_Proxy = hasProxy;
} }
public XmlRpcResponse HandleXMLRPCLogin(XmlRpcRequest request, IPEndPoint remoteClient) public XmlRpcResponse HandleXMLRPCLogin(XmlRpcRequest request, IPEndPoint remoteClient)
{ {
Hashtable requestData = (Hashtable)request.Params[0]; Hashtable requestData = (Hashtable)request.Params[0];
if (m_Proxy && request.Params[3] != null)
{
IPEndPoint ep = Util.GetClientIPFromXFF((string)request.Params[3]);
if (ep != null)
// Bang!
remoteClient = ep;
}
if (requestData != null) if (requestData != null)
{ {
@ -189,6 +198,7 @@ namespace OpenSim.Server.Handlers.Login
return map; return map;
} }
} }
} }

View File

@ -43,6 +43,7 @@ namespace OpenSim.Server.Handlers.Login
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private ILoginService m_LoginService; private ILoginService m_LoginService;
private bool m_Proxy;
public LLLoginServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) : public LLLoginServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) :
base(config, server, String.Empty) base(config, server, String.Empty)
@ -81,12 +82,14 @@ namespace OpenSim.Server.Handlers.Login
if (loginService == string.Empty) if (loginService == string.Empty)
throw new Exception(String.Format("No LocalServiceModule for LoginService in config file")); throw new Exception(String.Format("No LocalServiceModule for LoginService in config file"));
m_Proxy = serverConfig.GetBoolean("HasProxy", false);
return loginService; return loginService;
} }
private void InitializeHandlers(IHttpServer server) private void InitializeHandlers(IHttpServer server)
{ {
LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService); LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService, m_Proxy);
server.AddXmlRPCHandler("login_to_simulator", loginHandlers.HandleXMLRPCLogin, false); server.AddXmlRPCHandler("login_to_simulator", loginHandlers.HandleXMLRPCLogin, false);
server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false); server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false);
server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin); server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin);

View File

@ -184,7 +184,7 @@ namespace OpenSim.Server.Handlers.Simulation
resp["reason"] = OSD.FromString(reason); resp["reason"] = OSD.FromString(reason);
resp["success"] = OSD.FromBoolean(result); resp["success"] = OSD.FromBoolean(result);
// Let's also send out the IP address of the caller back to the caller (HG 1.5) // Let's also send out the IP address of the caller back to the caller (HG 1.5)
resp["your_ip"] = OSD.FromString(GetCallerIP(request)); resp["your_ip"] = OSD.FromString(Util.GetCallerIP(request));
// TODO: add reason if not String.Empty? // TODO: add reason if not String.Empty?
responsedata["int_response_code"] = HttpStatusCode.OK; responsedata["int_response_code"] = HttpStatusCode.OK;
@ -378,23 +378,6 @@ namespace OpenSim.Server.Handlers.Simulation
m_SimulationService.ReleaseAgent(regionID, id, ""); m_SimulationService.ReleaseAgent(regionID, id, "");
} }
private string GetCallerIP(Hashtable req)
{
if (req.ContainsKey("headers"))
{
try
{
Hashtable headers = (Hashtable)req["headers"];
if (headers.ContainsKey("remote_addr") && headers["remote_addr"] != null)
return headers["remote_addr"].ToString();
}
catch (Exception e)
{
m_log.WarnFormat("[AGENT HANDLER]: exception in GetCallerIP: {0}", e.Message);
}
}
return string.Empty;
}
} }
} }

View File

@ -86,13 +86,8 @@ namespace OpenSim.Services.Connectors.Hypergrid
paramList.Add(hash); paramList.Add(hash);
XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); XmlRpcRequest request = new XmlRpcRequest("link_region", paramList);
IPEndPoint ext = info.ExternalEndPoint; string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/" );
string uri = ""; m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri);
if (ext != null)
{
uri = "http://" + ext.Address + ":" + info.HttpPort + "/";
}
//m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri);
XmlRpcResponse response = null; XmlRpcResponse response = null;
try try
{ {
@ -193,12 +188,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
paramList.Add(hash); paramList.Add(hash);
XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); XmlRpcRequest request = new XmlRpcRequest("get_region", paramList);
IPEndPoint ext = gatekeeper.ExternalEndPoint; string uri = "http://" + ((gatekeeper.ServerURI != null && gatekeeper.ServerURI != string.Empty && !gatekeeper.ServerURI.StartsWith("http:")) ? gatekeeper.ServerURI : gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/");
string uri = "";
if (ext != null)
{
uri = "http://" + ext.Address + ":" + gatekeeper.HttpPort + "/";
}
m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + uri); m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + uri);
XmlRpcResponse response = null; XmlRpcResponse response = null;
try try

View File

@ -51,34 +51,49 @@ namespace OpenSim.Services.Connectors.Hypergrid
MethodBase.GetCurrentMethod().DeclaringType); MethodBase.GetCurrentMethod().DeclaringType);
string m_ServerURL; string m_ServerURL;
Uri m_Uri;
public UserAgentServiceConnector(string url) public UserAgentServiceConnector(string url)
{ {
m_ServerURL = url; m_ServerURL = url;
// Doing this here, because XML-RPC or mono have some strong ideas about
// caching DNS translations.
try try
{ {
m_Uri = new Uri(m_ServerURL); Uri m_Uri = new Uri(m_ServerURL);
IPAddress ip = Util.GetHostFromDNS(m_Uri.Host); IPAddress ip = Util.GetHostFromDNS(m_Uri.Host);
m_ServerURL = "http://" + ip.ToString() + ":" + m_Uri.Port; m_ServerURL = m_ServerURL.Replace(m_Uri.Host, ip.ToString()); ;
} }
catch (Exception e) catch (Exception e)
{ {
m_log.DebugFormat("[USER AGENT CONNECTOR]: Malformed Uri {0}: {1}", m_ServerURL, e.Message); m_log.DebugFormat("[USER AGENT CONNECTOR]: Malformed Uri {0}: {1}", m_ServerURL, e.Message);
} }
m_log.DebugFormat("[USER AGENT CONNECTOR]: new connector to {0} ({1})", url, m_ServerURL);
} }
public UserAgentServiceConnector(IConfigSource config) public UserAgentServiceConnector(IConfigSource config)
{ {
} IConfig serviceConfig = config.Configs["UserAgentService"];
if (serviceConfig == null)
public bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint ipaddress, out string reason)
{ {
// not available over remote calls m_log.Error("[USER AGENT CONNECTOR]: UserAgentService missing from ini");
reason = "Method not available over remote calls"; throw new Exception("UserAgent connector init error");
return false;
} }
public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason) string serviceURI = serviceConfig.GetString("UserAgentServerURI",
String.Empty);
if (serviceURI == String.Empty)
{
m_log.Error("[USER AGENT CONNECTOR]: No Server URI named in section UserAgentService");
throw new Exception("UserAgent connector init error");
}
m_ServerURL = serviceURI;
m_log.DebugFormat("[USER AGENT CONNECTOR]: UserAgentServiceConnector started for {0}", m_ServerURL);
}
// The Login service calls this interface with a non-null [client] ipaddress
public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, IPEndPoint ipaddress, out string reason)
{ {
reason = String.Empty; reason = String.Empty;
@ -101,7 +116,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
//AgentCreateRequest.Headers.Add("Authorization", authKey); //AgentCreateRequest.Headers.Add("Authorization", authKey);
// Fill it in // Fill it in
OSDMap args = PackCreateAgentArguments(aCircuit, gatekeeper, destination); OSDMap args = PackCreateAgentArguments(aCircuit, gatekeeper, destination, ipaddress);
string strBuffer = ""; string strBuffer = "";
byte[] buffer = new byte[1]; byte[] buffer = new byte[1];
@ -198,7 +213,14 @@ namespace OpenSim.Services.Connectors.Hypergrid
} }
protected OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination)
// The simulators call this interface
public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason)
{
return LoginAgentToGrid(aCircuit, gatekeeper, destination, null, out reason);
}
protected OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, IPEndPoint ipaddress)
{ {
OSDMap args = null; OSDMap args = null;
try try
@ -216,6 +238,8 @@ namespace OpenSim.Services.Connectors.Hypergrid
args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
args["destination_name"] = OSD.FromString(destination.RegionName); args["destination_name"] = OSD.FromString(destination.RegionName);
args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
if (ipaddress != null)
args["client_ip"] = OSD.FromString(ipaddress.Address.ToString());
return args; return args;
} }

View File

@ -55,6 +55,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
private string m_serverUrl = String.Empty; private string m_serverUrl = String.Empty;
private IImprovedAssetCache m_cache; private IImprovedAssetCache m_cache;
private bool m_Enabled = false;
#region ISharedRegionModule #region ISharedRegionModule
@ -73,8 +74,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
public SimianAssetServiceConnector() { } public SimianAssetServiceConnector() { }
public string Name { get { return "SimianAssetServiceConnector"; } } public string Name { get { return "SimianAssetServiceConnector"; } }
public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface<IAssetService>(this); } } public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface<IAssetService>(this); } }
public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface<IAssetService>(this); } } public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface<IAssetService>(this); } }
#endregion ISharedRegionModule #endregion ISharedRegionModule
@ -85,29 +86,32 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
if (Simian.IsSimianEnabled(source, "AssetServices", this.Name)) IConfig moduleConfig = source.Configs["Modules"];
if (moduleConfig != null)
{
string name = moduleConfig.GetString("AssetServices", "");
if (name == Name)
{ {
IConfig gridConfig = source.Configs["AssetService"]; IConfig gridConfig = source.Configs["AssetService"];
if (gridConfig == null) if (gridConfig != null)
{ {
m_log.Error("[SIMIAN ASSET CONNECTOR]: AssetService missing from OpenSim.ini");
throw new Exception("Asset connector init error");
}
string serviceUrl = gridConfig.GetString("AssetServerURI"); string serviceUrl = gridConfig.GetString("AssetServerURI");
if (String.IsNullOrEmpty(serviceUrl)) if (!String.IsNullOrEmpty(serviceUrl))
{ {
m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI in section AssetService");
throw new Exception("Asset connector init error");
}
if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
serviceUrl = serviceUrl + '/'; serviceUrl = serviceUrl + '/';
m_serverUrl = serviceUrl; m_serverUrl = serviceUrl;
} }
} }
if (String.IsNullOrEmpty(m_serverUrl))
m_log.Info("[SIMIAN ASSET CONNECTOR]: No AssetServerURI specified, disabling connector");
else
m_Enabled = true;
}
}
}
#region IAssetService #region IAssetService
public AssetBase Get(string id) public AssetBase Get(string id)

View File

@ -1,4 +1,4 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
@ -51,6 +51,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
MethodBase.GetCurrentMethod().DeclaringType); MethodBase.GetCurrentMethod().DeclaringType);
private string m_serverUrl = String.Empty; private string m_serverUrl = String.Empty;
private bool m_Enabled = false;
#region ISharedRegionModule #region ISharedRegionModule
@ -61,8 +62,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
public SimianAuthenticationServiceConnector() { } public SimianAuthenticationServiceConnector() { }
public string Name { get { return "SimianAuthenticationServiceConnector"; } } public string Name { get { return "SimianAuthenticationServiceConnector"; } }
public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface<IAuthenticationService>(this); } } public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface<IAuthenticationService>(this); } }
public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface<IAuthenticationService>(this); } } public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface<IAuthenticationService>(this); } }
#endregion ISharedRegionModule #endregion ISharedRegionModule
@ -73,23 +74,28 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
if (Simian.IsSimianEnabled(source, "AuthenticationServices", this.Name)) IConfig moduleConfig = source.Configs["Modules"];
if (moduleConfig != null)
{ {
IConfig assetConfig = source.Configs["AuthenticationService"]; string name = moduleConfig.GetString("AuthenticationServices", "");
if (assetConfig == null) if (name == Name)
{ {
m_log.Error("[SIMIAN AUTH CONNECTOR]: AuthenticationService missing from OpenSim.ini"); IConfig gridConfig = source.Configs["AuthenticationService"];
throw new Exception("Authentication connector init error"); if (gridConfig != null)
{
string serviceUrl = gridConfig.GetString("AuthenticationServerURI");
if (!String.IsNullOrEmpty(serviceUrl))
{
if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
serviceUrl = serviceUrl + '/';
m_serverUrl = serviceUrl;
m_Enabled = true;
}
} }
string serviceURI = assetConfig.GetString("AuthenticationServerURI"); if (String.IsNullOrEmpty(m_serverUrl))
if (String.IsNullOrEmpty(serviceURI)) m_log.Info("[SIMIAN AUTH CONNECTOR]: No AuthenticationServerURI specified, disabling connector");
{
m_log.Error("[SIMIAN AUTH CONNECTOR]: No Server URI named in section AuthenticationService");
throw new Exception("Authentication connector init error");
} }
m_serverUrl = serviceURI;
} }
} }
@ -253,7 +259,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
if (password == simianGridCredential || if (password == simianGridCredential ||
"$1$" + password == simianGridCredential || "$1$" + password == simianGridCredential ||
"$1$" + Utils.MD5String(password) == simianGridCredential || "$1$" + Utils.MD5String(password) == simianGridCredential ||
Utils.MD5String(password) == simianGridCredential) Utils.MD5String(password) == simianGridCredential ||
"$1$" + Utils.MD5String(password + ":") == simianGridCredential)
{ {
authorizeResult = Authorize(userID); authorizeResult = Authorize(userID);
return true; return true;

View File

@ -56,6 +56,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
// private static string ZeroID = UUID.Zero.ToString(); // private static string ZeroID = UUID.Zero.ToString();
private string m_serverUrl = String.Empty; private string m_serverUrl = String.Empty;
private bool m_Enabled = false;
#region ISharedRegionModule #region ISharedRegionModule
@ -66,8 +67,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
public SimianAvatarServiceConnector() { } public SimianAvatarServiceConnector() { }
public string Name { get { return "SimianAvatarServiceConnector"; } } public string Name { get { return "SimianAvatarServiceConnector"; } }
public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface<IAvatarService>(this); } } public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface<IAvatarService>(this); } }
public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface<IAvatarService>(this); } } public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface<IAvatarService>(this); } }
#endregion ISharedRegionModule #endregion ISharedRegionModule
@ -78,26 +79,28 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
if (Simian.IsSimianEnabled(source, "AvatarServices", this.Name)) IConfig moduleConfig = source.Configs["Modules"];
if (moduleConfig != null)
{
string name = moduleConfig.GetString("AvatarServices", "");
if (name == Name)
{ {
IConfig gridConfig = source.Configs["AvatarService"]; IConfig gridConfig = source.Configs["AvatarService"];
if (gridConfig == null) if (gridConfig != null)
{ {
m_log.Error("[SIMIAN AVATAR CONNECTOR]: AvatarService missing from OpenSim.ini");
throw new Exception("Avatar connector init error");
}
string serviceUrl = gridConfig.GetString("AvatarServerURI"); string serviceUrl = gridConfig.GetString("AvatarServerURI");
if (String.IsNullOrEmpty(serviceUrl)) if (!String.IsNullOrEmpty(serviceUrl))
{ {
m_log.Error("[SIMIAN AVATAR CONNECTOR]: No AvatarServerURI in section AvatarService"); if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
throw new Exception("Avatar connector init error"); serviceUrl = serviceUrl + '/';
m_serverUrl = serviceUrl;
m_Enabled = true;
}
} }
if (!serviceUrl.EndsWith("/")) if (String.IsNullOrEmpty(m_serverUrl))
serviceUrl = serviceUrl + '/'; m_log.Info("[SIMIAN AVATAR CONNECTOR]: No AvatarServerURI specified, disabling connector");
}
m_serverUrl = serviceUrl;
} }
} }

View File

@ -46,8 +46,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// <summary> /// <summary>
/// Stores and retrieves friend lists from the SimianGrid backend /// Stores and retrieves friend lists from the SimianGrid backend
/// </summary> /// </summary>
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] public class SimianFriendsServiceConnector : IFriendsService
public class SimianFriendsServiceConnector : IFriendsService, ISharedRegionModule
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger( LogManager.GetLogger(
@ -55,20 +54,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
private string m_serverUrl = String.Empty; private string m_serverUrl = String.Empty;
#region ISharedRegionModule
public Type ReplaceableInterface { get { return null; } }
public void RegionLoaded(Scene scene) { }
public void PostInitialise() { }
public void Close() { }
public SimianFriendsServiceConnector() { }
public string Name { get { return "SimianFriendsServiceConnector"; } }
public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface<IFriendsService>(this); } }
public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface<IFriendsService>(this); } }
#endregion ISharedRegionModule
public SimianFriendsServiceConnector(IConfigSource source) public SimianFriendsServiceConnector(IConfigSource source)
{ {
Initialise(source); Initialise(source);
@ -76,38 +61,29 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
bool isSimianEnabled = false; IConfig gridConfig = source.Configs["FriendsService"];
if (gridConfig != null)
if (source.Configs["Friends"] != null)
{ {
string module = source.Configs["Friends"].GetString("Connector"); string serviceUrl = gridConfig.GetString("FriendsServerURI");
isSimianEnabled = !String.IsNullOrEmpty(module) && module.EndsWith(this.Name); if (!String.IsNullOrEmpty(serviceUrl))
{
if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
serviceUrl = serviceUrl + '/';
m_serverUrl = serviceUrl;
}
} }
if (isSimianEnabled) if (String.IsNullOrEmpty(m_serverUrl))
{ m_log.Info("[SIMIAN FRIENDS CONNECTOR]: No FriendsServerURI specified, disabling connector");
IConfig assetConfig = source.Configs["FriendsService"];
if (assetConfig == null)
{
m_log.Error("[SIMIAN FRIENDS CONNECTOR]: FriendsService missing from OpenSim.ini");
throw new Exception("Friends connector init error");
}
string serviceURI = assetConfig.GetString("FriendsServerURI");
if (String.IsNullOrEmpty(serviceURI))
{
m_log.Error("[SIMIAN FRIENDS CONNECTOR]: No Server URI named in section FriendsService");
throw new Exception("Friends connector init error");
}
m_serverUrl = serviceURI;
}
} }
#region IFriendsService #region IFriendsService
public FriendInfo[] GetFriends(UUID principalID) public FriendInfo[] GetFriends(UUID principalID)
{ {
if (String.IsNullOrEmpty(m_serverUrl))
return new FriendInfo[0];
Dictionary<UUID, FriendInfo> friends = new Dictionary<UUID, FriendInfo>(); Dictionary<UUID, FriendInfo> friends = new Dictionary<UUID, FriendInfo>();
OSDArray friendsArray = GetFriended(principalID); OSDArray friendsArray = GetFriended(principalID);
@ -156,6 +132,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
public bool StoreFriend(UUID principalID, string friend, int flags) public bool StoreFriend(UUID principalID, string friend, int flags)
{ {
if (String.IsNullOrEmpty(m_serverUrl))
return true;
NameValueCollection requestArgs = new NameValueCollection NameValueCollection requestArgs = new NameValueCollection
{ {
{ "RequestMethod", "AddGeneric" }, { "RequestMethod", "AddGeneric" },
@ -176,6 +155,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
public bool Delete(UUID principalID, string friend) public bool Delete(UUID principalID, string friend)
{ {
if (String.IsNullOrEmpty(m_serverUrl))
return true;
NameValueCollection requestArgs = new NameValueCollection NameValueCollection requestArgs = new NameValueCollection
{ {
{ "RequestMethod", "RemoveGeneric" }, { "RequestMethod", "RemoveGeneric" },

View File

@ -31,17 +31,3 @@ using Nini.Config;
[assembly: Addin("SimianGrid", "1.0")] [assembly: Addin("SimianGrid", "1.0")]
[assembly: AddinDependency("OpenSim", "0.5")] [assembly: AddinDependency("OpenSim", "0.5")]
public static class Simian
{
public static bool IsSimianEnabled(IConfigSource config, string moduleName, string connectorName)
{
if (config.Configs["Modules"] != null)
{
string module = config.Configs["Modules"].GetString(moduleName);
return !String.IsNullOrEmpty(module) && module.EndsWith(connectorName);
}
return false;
}
}

View File

@ -60,6 +60,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
private string m_serverUrl = String.Empty; private string m_serverUrl = String.Empty;
private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
private bool m_Enabled = false;
#region ISharedRegionModule #region ISharedRegionModule
@ -72,20 +73,24 @@ namespace OpenSim.Services.Connectors.SimianGrid
public string Name { get { return "SimianGridServiceConnector"; } } public string Name { get { return "SimianGridServiceConnector"; } }
public void AddRegion(Scene scene) public void AddRegion(Scene scene)
{ {
if (!m_Enabled)
return;
// Every shared region module has to maintain an indepedent list of // Every shared region module has to maintain an indepedent list of
// currently running regions // currently running regions
lock (m_scenes) lock (m_scenes)
m_scenes[scene.RegionInfo.RegionID] = scene; m_scenes[scene.RegionInfo.RegionID] = scene;
if (!String.IsNullOrEmpty(m_serverUrl))
scene.RegisterModuleInterface<IGridService>(this); scene.RegisterModuleInterface<IGridService>(this);
} }
public void RemoveRegion(Scene scene) public void RemoveRegion(Scene scene)
{ {
if (!m_Enabled)
return;
lock (m_scenes) lock (m_scenes)
m_scenes.Remove(scene.RegionInfo.RegionID); m_scenes.Remove(scene.RegionInfo.RegionID);
if (!String.IsNullOrEmpty(m_serverUrl))
scene.UnregisterModuleInterface<IGridService>(this); scene.UnregisterModuleInterface<IGridService>(this);
} }
@ -98,23 +103,28 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
if (Simian.IsSimianEnabled(source, "GridServices", this.Name)) IConfig moduleConfig = source.Configs["Modules"];
if (moduleConfig != null)
{
string name = moduleConfig.GetString("GridServices", "");
if (name == Name)
{ {
IConfig gridConfig = source.Configs["GridService"]; IConfig gridConfig = source.Configs["GridService"];
if (gridConfig == null) if (gridConfig != null)
{ {
m_log.Error("[SIMIAN GRID CONNECTOR]: GridService missing from OpenSim.ini");
throw new Exception("Grid connector init error");
}
string serviceUrl = gridConfig.GetString("GridServerURI"); string serviceUrl = gridConfig.GetString("GridServerURI");
if (String.IsNullOrEmpty(serviceUrl)) if (!String.IsNullOrEmpty(serviceUrl))
{ {
m_log.Error("[SIMIAN GRID CONNECTOR]: No Server URI named in section GridService"); if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
throw new Exception("Grid connector init error"); serviceUrl = serviceUrl + '/';
m_serverUrl = serviceUrl;
m_Enabled = true;
}
} }
m_serverUrl = serviceUrl; if (String.IsNullOrEmpty(m_serverUrl))
m_log.Info("[SIMIAN GRID CONNECTOR]: No GridServerURI specified, disabling connector");
}
} }
} }

View File

@ -70,6 +70,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
private string m_serverUrl = String.Empty; private string m_serverUrl = String.Empty;
private string m_userServerUrl = String.Empty; private string m_userServerUrl = String.Empty;
// private object m_gestureSyncRoot = new object(); // private object m_gestureSyncRoot = new object();
private bool m_Enabled = false;
#region ISharedRegionModule #region ISharedRegionModule
@ -80,8 +81,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
public SimianInventoryServiceConnector() { } public SimianInventoryServiceConnector() { }
public string Name { get { return "SimianInventoryServiceConnector"; } } public string Name { get { return "SimianInventoryServiceConnector"; } }
public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface<IInventoryService>(this); } } public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface<IInventoryService>(this); } }
public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface<IInventoryService>(this); } } public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface<IInventoryService>(this); } }
#endregion ISharedRegionModule #endregion ISharedRegionModule
@ -92,22 +93,20 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
if (Simian.IsSimianEnabled(source, "InventoryServices", this.Name)) IConfig moduleConfig = source.Configs["Modules"];
if (moduleConfig != null)
{
string name = moduleConfig.GetString("InventoryServices", "");
if (name == Name)
{ {
IConfig gridConfig = source.Configs["InventoryService"]; IConfig gridConfig = source.Configs["InventoryService"];
if (gridConfig == null) if (gridConfig != null)
{ {
m_log.Error("[SIMIAN INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini");
throw new Exception("Inventory connector init error");
}
string serviceUrl = gridConfig.GetString("InventoryServerURI"); string serviceUrl = gridConfig.GetString("InventoryServerURI");
if (String.IsNullOrEmpty(serviceUrl)) if (!String.IsNullOrEmpty(serviceUrl))
{ {
m_log.Error("[SIMIAN INVENTORY CONNECTOR]: No Server URI named in section InventoryService"); if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
throw new Exception("Inventory connector init error"); serviceUrl = serviceUrl + '/';
}
m_serverUrl = serviceUrl; m_serverUrl = serviceUrl;
gridConfig = source.Configs["UserAccountService"]; gridConfig = source.Configs["UserAccountService"];
@ -115,13 +114,18 @@ namespace OpenSim.Services.Connectors.SimianGrid
{ {
serviceUrl = gridConfig.GetString("UserAccountServerURI"); serviceUrl = gridConfig.GetString("UserAccountServerURI");
if (!String.IsNullOrEmpty(serviceUrl)) if (!String.IsNullOrEmpty(serviceUrl))
m_userServerUrl = serviceUrl;
else
m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No Server URI named in section UserAccountService");
}
else
{ {
m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: UserAccountService missing from OpenSim.ini"); m_userServerUrl = serviceUrl;
m_Enabled = true;
}
}
}
}
if (String.IsNullOrEmpty(m_serverUrl))
m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No InventoryServerURI specified, disabling connector");
else if (String.IsNullOrEmpty(m_userServerUrl))
m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No UserAccountServerURI specified, disabling connector");
} }
} }
} }

View File

@ -59,6 +59,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
private string m_serverUrl = String.Empty; private string m_serverUrl = String.Empty;
private SimianActivityDetector m_activityDetector; private SimianActivityDetector m_activityDetector;
private bool m_Enabled = false;
#region ISharedRegionModule #region ISharedRegionModule
@ -71,7 +72,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
public string Name { get { return "SimianPresenceServiceConnector"; } } public string Name { get { return "SimianPresenceServiceConnector"; } }
public void AddRegion(Scene scene) public void AddRegion(Scene scene)
{ {
if (!String.IsNullOrEmpty(m_serverUrl)) if (m_Enabled)
{ {
scene.RegisterModuleInterface<IPresenceService>(this); scene.RegisterModuleInterface<IPresenceService>(this);
scene.RegisterModuleInterface<IGridUserService>(this); scene.RegisterModuleInterface<IGridUserService>(this);
@ -83,7 +84,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
} }
public void RemoveRegion(Scene scene) public void RemoveRegion(Scene scene)
{ {
if (!String.IsNullOrEmpty(m_serverUrl)) if (m_Enabled)
{ {
scene.UnregisterModuleInterface<IPresenceService>(this); scene.UnregisterModuleInterface<IPresenceService>(this);
scene.UnregisterModuleInterface<IGridUserService>(this); scene.UnregisterModuleInterface<IGridUserService>(this);
@ -103,23 +104,28 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
if (Simian.IsSimianEnabled(source, "PresenceServices", this.Name)) IConfig moduleConfig = source.Configs["Modules"];
if (moduleConfig != null)
{
string name = moduleConfig.GetString("PresenceServices", "");
if (name == Name)
{ {
IConfig gridConfig = source.Configs["PresenceService"]; IConfig gridConfig = source.Configs["PresenceService"];
if (gridConfig == null) if (gridConfig != null)
{ {
m_log.Error("[SIMIAN PRESENCE CONNECTOR]: PresenceService missing from OpenSim.ini");
throw new Exception("Presence connector init error");
}
string serviceUrl = gridConfig.GetString("PresenceServerURI"); string serviceUrl = gridConfig.GetString("PresenceServerURI");
if (String.IsNullOrEmpty(serviceUrl)) if (!String.IsNullOrEmpty(serviceUrl))
{ {
m_log.Error("[SIMIAN PRESENCE CONNECTOR]: No PresenceServerURI in section PresenceService"); if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
throw new Exception("Presence connector init error"); serviceUrl = serviceUrl + '/';
m_serverUrl = serviceUrl;
m_Enabled = true;
}
} }
m_serverUrl = serviceUrl; if (String.IsNullOrEmpty(m_serverUrl))
m_log.Info("[SIMIAN PRESENCE CONNECTOR]: No PresenceServerURI specified, disabling connector");
}
} }
} }

View File

@ -67,6 +67,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
MethodBase.GetCurrentMethod().DeclaringType); MethodBase.GetCurrentMethod().DeclaringType);
private string m_serverUrl = String.Empty; private string m_serverUrl = String.Empty;
private bool m_Enabled = false;
#region INonSharedRegionModule #region INonSharedRegionModule
@ -76,8 +77,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
public SimianProfiles() { } public SimianProfiles() { }
public string Name { get { return "SimianProfiles"; } } public string Name { get { return "SimianProfiles"; } }
public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { CheckEstateManager(scene); scene.EventManager.OnClientConnect += ClientConnectHandler; } } public void AddRegion(Scene scene) { if (m_Enabled) { CheckEstateManager(scene); scene.EventManager.OnClientConnect += ClientConnectHandler; } }
public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.EventManager.OnClientConnect -= ClientConnectHandler; } } public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.EventManager.OnClientConnect -= ClientConnectHandler; } }
#endregion INonSharedRegionModule #endregion INonSharedRegionModule
@ -88,44 +89,27 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
if (Simian.IsSimianEnabled(source, "UserAccountServices", "SimianUserAccountServiceConnector")) IConfig profileConfig = source.Configs["Profile"];
{ if (profileConfig == null)
return;
if (profileConfig.GetString("Module", String.Empty) != Name)
return;
IConfig gridConfig = source.Configs["UserAccountService"]; IConfig gridConfig = source.Configs["UserAccountService"];
if (gridConfig == null) if (gridConfig != null)
{ {
m_log.Error("[SIMIAN PROFILES]: UserAccountService missing from OpenSim.ini");
throw new Exception("Profiles init error");
}
string serviceUrl = gridConfig.GetString("UserAccountServerURI"); string serviceUrl = gridConfig.GetString("UserAccountServerURI");
if (String.IsNullOrEmpty(serviceUrl)) if (!String.IsNullOrEmpty(serviceUrl))
{ {
m_log.Error("[SIMIAN PROFILES]: No UserAccountServerURI in section UserAccountService"); if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
throw new Exception("Profiles init error");
}
if (!serviceUrl.EndsWith("/"))
serviceUrl = serviceUrl + '/'; serviceUrl = serviceUrl + '/';
m_serverUrl = serviceUrl; m_serverUrl = serviceUrl;
IConfig profilesConfig = source.Configs["Profiles"];
if (profilesConfig == null)
{
// Do not run this module by default.
return;
} }
else }
{
// if profiles aren't enabled, we're not needed.
// if we're not specified as the connector to use, then we're not wanted
if (profilesConfig.GetString("Module", String.Empty) != Name)
{
return; if (String.IsNullOrEmpty(m_serverUrl))
} m_log.Info("[SIMIAN PROFILES]: No UserAccountServerURI specified, disabling connector");
m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Initializing {0}", this.Name);
}
}
} }
private void ClientConnectHandler(IClientCore clientCore) private void ClientConnectHandler(IClientCore clientCore)

View File

@ -55,6 +55,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
private string m_serverUrl = String.Empty; private string m_serverUrl = String.Empty;
private ExpiringCache<UUID, UserAccount> m_accountCache; private ExpiringCache<UUID, UserAccount> m_accountCache;
private bool m_Enabled = false;
#region ISharedRegionModule #region ISharedRegionModule
@ -65,8 +66,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
public SimianUserAccountServiceConnector() { } public SimianUserAccountServiceConnector() { }
public string Name { get { return "SimianUserAccountServiceConnector"; } } public string Name { get { return "SimianUserAccountServiceConnector"; } }
public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface<IUserAccountService>(this); } } public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface<IUserAccountService>(this); } }
public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface<IUserAccountService>(this); } } public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface<IUserAccountService>(this); } }
#endregion ISharedRegionModule #endregion ISharedRegionModule
@ -77,24 +78,28 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
if (Simian.IsSimianEnabled(source, "UserAccountServices", this.Name)) IConfig moduleConfig = source.Configs["Modules"];
if (moduleConfig != null)
{ {
IConfig assetConfig = source.Configs["UserAccountService"]; string name = moduleConfig.GetString("UserAccountServices", "");
if (assetConfig == null) if (name == Name)
{ {
m_log.Error("[SIMIAN ACCOUNT CONNECTOR]: UserAccountService missing from OpenSim.ini"); IConfig gridConfig = source.Configs["UserAccountService"];
throw new Exception("User account connector init error"); if (gridConfig != null)
{
string serviceUrl = gridConfig.GetString("UserAccountServerURI");
if (!String.IsNullOrEmpty(serviceUrl))
{
if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
serviceUrl = serviceUrl + '/';
m_serverUrl = serviceUrl;
m_Enabled = true;
}
} }
string serviceURI = assetConfig.GetString("UserAccountServerURI"); if (String.IsNullOrEmpty(m_serverUrl))
if (String.IsNullOrEmpty(serviceURI)) m_log.Info("[SIMIAN ACCOUNT CONNECTOR]: No UserAccountServerURI specified, disabling connector");
{
m_log.Error("[SIMIAN ACCOUNT CONNECTOR]: No UserAccountServerURI in section UserAccountService, skipping SimianUserAccountServiceConnector");
throw new Exception("User account connector init error");
} }
m_accountCache = new ExpiringCache<UUID, UserAccount>();
m_serverUrl = serviceURI;
} }
} }

View File

@ -104,8 +104,13 @@ namespace OpenSim.Services.Connectors.Simulation
return false; return false;
} }
// Eventually, we want to use a caps url instead of the agentID
string uri = string.Empty; string uri = string.Empty;
// HACK -- Simian grid make it work!!!
if (destination.ServerURI != null && destination.ServerURI != string.Empty && !destination.ServerURI.StartsWith("http:"))
uri = "http://" + destination.ServerURI + AgentPath() + aCircuit.AgentID + "/";
else
{
try try
{ {
uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + aCircuit.AgentID + "/"; uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + aCircuit.AgentID + "/";
@ -116,6 +121,7 @@ namespace OpenSim.Services.Connectors.Simulation
reason = e.Message; reason = e.Message;
return false; return false;
} }
}
//Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri); //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri);

View File

@ -158,7 +158,7 @@ namespace OpenSim.Services.GridService
string host = "127.0.0.1"; string host = "127.0.0.1";
string portstr; string portstr;
string regionName = ""; string regionName = "";
uint port = 9000; uint port = 0;
string[] parts = mapName.Split(new char[] { ':' }); string[] parts = mapName.Split(new char[] { ':' });
if (parts.Length >= 1) if (parts.Length >= 1)
{ {
@ -177,18 +177,16 @@ namespace OpenSim.Services.GridService
regionName = parts[2]; regionName = parts[2];
} }
// Sanity check. //// Sanity check.
//IPAddress ipaddr = null; //try
try //{
{ // Util.GetHostFromDNS(host);
//ipaddr = Util.GetHostFromDNS(host); //}
Util.GetHostFromDNS(host); //catch
} //{
catch // reason = "Malformed hostname";
{ // return null;
reason = "Malformed hostname"; //}
return null;
}
GridRegion regInfo; GridRegion regInfo;
bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, out regInfo, out reason); bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, out regInfo, out reason);
@ -217,6 +215,11 @@ namespace OpenSim.Services.GridService
regInfo.RegionLocY = yloc; regInfo.RegionLocY = yloc;
regInfo.ScopeID = scopeID; regInfo.ScopeID = scopeID;
// Big HACK for Simian Grid !!!
// We need to clean up all URLs used in OpenSim !!!
if (externalHostName.Contains("/"))
regInfo.ServerURI = externalHostName;
try try
{ {
regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0); regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0);

View File

@ -44,7 +44,7 @@ namespace OpenSim.Services.InventoryService
LogManager.GetLogger( LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType); MethodBase.GetCurrentMethod().DeclaringType);
protected IXInventoryData m_Database; protected new IXInventoryData m_Database;
public HGInventoryService(IConfigSource config) public HGInventoryService(IConfigSource config)
: base(config) : base(config)

View File

@ -293,13 +293,35 @@ namespace OpenSim.Services.InventoryService
public virtual bool AddFolder(InventoryFolderBase folder) public virtual bool AddFolder(InventoryFolderBase folder)
{ {
InventoryFolderBase check = GetFolder(folder);
if (check != null)
return false;
XInventoryFolder xFolder = ConvertFromOpenSim(folder); XInventoryFolder xFolder = ConvertFromOpenSim(folder);
return m_Database.StoreFolder(xFolder); return m_Database.StoreFolder(xFolder);
} }
public virtual bool UpdateFolder(InventoryFolderBase folder) public virtual bool UpdateFolder(InventoryFolderBase folder)
{ {
XInventoryFolder xFolder = ConvertFromOpenSim(folder);
InventoryFolderBase check = GetFolder(folder);
if (check == null)
return AddFolder(folder); return AddFolder(folder);
if (check.Type != -1 || xFolder.type != -1)
{
if (xFolder.version > check.Version)
return false;
check.Version = (ushort)xFolder.version;
xFolder = ConvertFromOpenSim(check);
return m_Database.StoreFolder(xFolder);
}
if (xFolder.version < check.Version)
xFolder.version = check.Version;
xFolder.folderID = check.ID;
return m_Database.StoreFolder(xFolder);
} }
public virtual bool MoveFolder(InventoryFolderBase folder) public virtual bool MoveFolder(InventoryFolderBase folder)

View File

@ -646,7 +646,7 @@
; {2} - region UUID ; {2} - region UUID
; {3} - region port ; {3} - region port
; {4} - region name with " ", ":", "/" mapped to "_" ; {4} - region name with " ", ":", "/" mapped to "_"
region_file_template = "{0}x{1}-{2}.xml" region_file_template = "{0}x{1}-{2}.ini"
; we can limit the number of regions that XmlRpcCreateRegion will ; we can limit the number of regions that XmlRpcCreateRegion will
; allow by setting this to a positive, non-0 number: as long as the ; allow by setting this to a positive, non-0 number: as long as the
@ -1330,6 +1330,7 @@ Message = "The MOTD module is working!"
;Include-Grid = "config-include/Grid.ini" ;Include-Grid = "config-include/Grid.ini"
;Include-HGGrid = "config-include/GridHypergrid.ini" ;Include-HGGrid = "config-include/GridHypergrid.ini"
;Include-SimianGrid = "config-include/SimianGrid.ini" ;Include-SimianGrid = "config-include/SimianGrid.ini"
;Include-HyperSimianGrid = "config-include/HyperSimianGrid.ini"
; Then choose ; Then choose
; config-include/StandaloneCommon.ini.example (if you're in standlone) OR ; config-include/StandaloneCommon.ini.example (if you're in standlone) OR

View File

@ -147,6 +147,9 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
WelcomeMessage = "Welcome, Avatar!" WelcomeMessage = "Welcome, Avatar!"
AllowRemoteSetLoginLevel = "false" AllowRemoteSetLoginLevel = "false"
; If you run this login server behind a proxy, set this to true
; HasProxy = true
; Defaults for the users, if none is specified in the useraccounts table entry (ServiceURLs) ; Defaults for the users, if none is specified in the useraccounts table entry (ServiceURLs)
; CHANGE THIS ; CHANGE THIS
HomeURI = "http://127.0.0.1:8002" HomeURI = "http://127.0.0.1:8002"
@ -217,6 +220,10 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
GridService = "OpenSim.Services.GridService.dll:GridService" GridService = "OpenSim.Services.GridService.dll:GridService"
GatekeeperService = "OpenSim.Services.HypergridService.dll:GatekeeperService" GatekeeperService = "OpenSim.Services.HypergridService.dll:GatekeeperService"
;; If you separate the UserAgentService from the LoginService, set this to
;; the IP address of the machine where your LoginService is
;LoginServerIP = "127.0.0.1"
; * The interface that local users get when they are in other grids. ; * The interface that local users get when they are in other grids.
; * This restricts the inventory operations while in other grids. ; * This restricts the inventory operations while in other grids.
; * Still not completely safe, especially if users perform inventory operations ; * Still not completely safe, especially if users perform inventory operations

View File

@ -0,0 +1,77 @@
;;
;; Please don't change this file.
;; All optional settings are in GridCommon.ini.example,
;; which you can copy and change.
;;
;;
;; In GridCommon.ini, these are the URLs you would use if SimianGrid is
;; installed at http://www.mygrid.com/Grid/
;;
; AssetServerURI = "http://www.mygrid.com/Grid/?id="
; InventoryServerURI = "http://www.mygrid.com/Grid/"
; AvatarServerURI = "http://www.mygrid.com/Grid/"
; PresenceServerURI = "http://www.mygrid.com/Grid/"
; UserAccountServerURI = "http://www.mygrid.com/Grid/"
; AuthenticationServerURI = "http://www.mygrid.com/Grid/"
; FriendsServerURI = "http://www.mygrid.com/Grid/"
; GroupsServerURI = "http://www.mygrid.com/Grid/"
[Includes]
Include-Common = "config-include/GridCommon.ini"
[Modules]
GridServices = "OpenSim.Services.Connectors.dll:SimianGridServiceConnector"
PresenceServices = "OpenSim.Services.Connectors.dll:SimianPresenceServiceConnector"
UserAccountServices = "OpenSim.Services.Connectors.dll:SimianUserAccountServiceConnector"
AuthenticationServices = "OpenSim.Services.Connectors.dll:SimianAuthenticationServiceConnector"
AssetServices = "HGAssetBroker"
InventoryServices = "HGInventoryBroker"
AvatarServices = "OpenSim.Services.Connectors.dll:SimianAvatarServiceConnector"
NeighbourServices = "RemoteNeighbourServicesConnector"
SimulationServices = "RemoteSimulationConnectorModule"
EntityTransferModule = "HGEntityTransferModule"
InventoryAccessModule = "HGInventoryAccessModule"
LandServiceInConnector = true
NeighbourServiceInConnector = true
SimulationServiceInConnector = true
LibraryModule = false
AssetCaching = "FlotsamAssetCache"
[Friends]
Connector = "OpenSim.Services.Connectors.dll:SimianFriendsServiceConnector"
[GridService]
LocalServiceModule = "OpenSim.Services.GridService.dll:GridService"
StorageProvider = "OpenSim.Data.Null.dll:NullRegionData"
AllowHypergridMapSearch = true
[LibraryService]
LocalServiceModule = "OpenSim.Services.InventoryService.dll:LibraryService"
LibraryName = "OpenSim Library"
DefaultLibrary = "./inventory/Libraries.xml"
[AssetService]
DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll"
LocalGridAssetService = "OpenSim.Services.Connectors.dll:SimianAssetServiceConnector"
HypergridAssetService = "OpenSim.Services.Connectors.dll:HGAssetServiceConnector"
AssetLoaderArgs = "assets/AssetSets.xml"
[InventoryService]
LocalGridInventoryService = "OpenSim.Services.Connectors.dll:SimianInventoryServiceConnector"
[Groups]
Enabled = true
Module = GroupsModule
DebugEnabled = false
NoticesEnabled = true
MessagingModule = GroupsMessagingModule
MessagingEnabled = true
ServicesConnectorModule = SimianGroupsServicesConnector
[Profiles]
Module = SimianProfiles