getting all our line endings consistant again

afrisby
Sean Dague 2007-10-05 15:45:45 +00:00
parent d4a4aafaf1
commit c3d8f1f425
40 changed files with 2836 additions and 2836 deletions

View File

@ -8,7 +8,7 @@ using Nwc.XmlRpc;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Inventory; using OpenSim.Framework.Inventory;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Framework.Configuration; using OpenSim.Framework.Configuration;

View File

@ -1,26 +1,26 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
public class Culture public class Culture
{ {
private static readonly CultureInfo m_cultureInfo = new System.Globalization.CultureInfo("en-US", true); private static readonly CultureInfo m_cultureInfo = new System.Globalization.CultureInfo("en-US", true);
public static NumberFormatInfo NumberFormatInfo public static NumberFormatInfo NumberFormatInfo
{ {
get get
{ {
return m_cultureInfo.NumberFormat; return m_cultureInfo.NumberFormat;
} }
} }
public static void SetCurrentCulture() public static void SetCurrentCulture()
{ {
Thread.CurrentThread.CurrentCulture = m_cultureInfo; Thread.CurrentThread.CurrentCulture = m_cultureInfo;
} }
} }
} }

View File

@ -24,35 +24,35 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace OpenSim.Grid.ScriptServer namespace OpenSim.Grid.ScriptServer
{ {
class OpenScript_Main class OpenScript_Main
{ {
public static ScriptServerMain SE; public static ScriptServerMain SE;
static void Main(string[] args) static void Main(string[] args)
{ {
// Application is starting // Application is starting
SE = new ScriptServerMain(); SE = new ScriptServerMain();
System.AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); System.AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
} }
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{ {
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine("APPLICATION EXCEPTION DETECTED"); Console.WriteLine("APPLICATION EXCEPTION DETECTED");
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine("Application is terminating: " + e.IsTerminating.ToString()); Console.WriteLine("Application is terminating: " + e.IsTerminating.ToString());
Console.WriteLine("Exception:"); Console.WriteLine("Exception:");
Console.WriteLine(e.ExceptionObject.ToString()); Console.WriteLine(e.ExceptionObject.ToString());
} }
} }
} }

View File

@ -1,33 +1,33 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("OpenSim.Grid.ScriptServer")] [assembly: AssemblyTitle("OpenSim.Grid.ScriptServer")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OpenSim.Grid.ScriptServer")] [assembly: AssemblyProduct("OpenSim.Grid.ScriptServer")]
[assembly: AssemblyCopyright("Copyright © 2007")] [assembly: AssemblyCopyright("Copyright © 2007")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("b6861b87-5203-4040-b756-fd4774932f82")] [assembly: Guid("b6861b87-5203-4040-b756-fd4774932f82")]
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
// Minor Version // Minor Version
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,16 +1,16 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace OpenSim.Grid.ScriptServer namespace OpenSim.Grid.ScriptServer
{ {
// Maintains connection and communication to a region // Maintains connection and communication to a region
internal class RegionConnectionManager internal class RegionConnectionManager
{ {
public RegionConnectionManager() public RegionConnectionManager()
{ {
} }
} }
} }

View File

@ -24,76 +24,76 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
namespace OpenSim.Grid.ScriptServer namespace OpenSim.Grid.ScriptServer
{ {
// Waiting for incoming script requests from region // Waiting for incoming script requests from region
internal class RegionCommManager internal class RegionCommManager
{ {
private Thread listenThread; private Thread listenThread;
private List<RegionConnectionManager> Regions = new List<RegionConnectionManager>(); private List<RegionConnectionManager> Regions = new List<RegionConnectionManager>();
private LogBase m_log; private LogBase m_log;
private ScriptServerMain m_ScriptServerMain; private ScriptServerMain m_ScriptServerMain;
public RegionCommManager(ScriptServerMain scm, LogBase logger) public RegionCommManager(ScriptServerMain scm, LogBase logger)
{ {
m_ScriptServerMain = scm; m_ScriptServerMain = scm;
m_log = logger; m_log = logger;
} }
~RegionCommManager() ~RegionCommManager()
{ {
Stop(); Stop();
} }
/// <summary> /// <summary>
/// Starts listening for region requests /// Starts listening for region requests
/// </summary> /// </summary>
public void Start() public void Start()
{ {
// Start listener // Start listener
Stop(); Stop();
listenThread = new Thread(ListenThreadLoop); listenThread = new Thread(ListenThreadLoop);
listenThread.Name = "listenThread"; listenThread.Name = "listenThread";
listenThread.IsBackground = true; listenThread.IsBackground = true;
listenThread.Start(); listenThread.Start();
} }
/// <summary> /// <summary>
/// Stops listening for region requests /// Stops listening for region requests
/// </summary> /// </summary>
public void Stop() public void Stop()
{ {
// Stop listener, clean up // Stop listener, clean up
if (listenThread != null) if (listenThread != null)
{ {
try try
{ {
if (listenThread.IsAlive) if (listenThread.IsAlive)
listenThread.Abort(); listenThread.Abort();
listenThread.Join(1000); // Wait 1 second for thread to shut down listenThread.Join(1000); // Wait 1 second for thread to shut down
} }
catch { } catch { }
listenThread = null; listenThread = null;
} }
} }
private void ListenThreadLoop() private void ListenThreadLoop()
{ {
// * Listen for requests from regions // * Listen for requests from regions
// * When a request is received: // * When a request is received:
// - Authenticate region // - Authenticate region
// - Authenticate user // - Authenticate user
// - Have correct scriptengine load script // - Have correct scriptengine load script
// ~ ask scriptengines if they will accept script? // ~ ask scriptengines if they will accept script?
// - Add script to shared communication channel towards that region // - Add script to shared communication channel towards that region
} }
} }
} }

View File

@ -28,8 +28,8 @@
using System; using System;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
namespace OpenSim.Grid.ScriptServer namespace OpenSim.Grid.ScriptServer
{ {
internal class ScriptEngineLoader internal class ScriptEngineLoader
@ -39,7 +39,7 @@ namespace OpenSim.Grid.ScriptServer
public ScriptEngineLoader(LogBase logger) public ScriptEngineLoader(LogBase logger)
{ {
m_log = logger; m_log = logger;
} }
public ScriptEngineInterface LoadScriptEngine(string EngineName) public ScriptEngineInterface LoadScriptEngine(string EngineName)
@ -121,5 +121,5 @@ namespace OpenSim.Grid.ScriptServer
return ret; return ret;
} }
} }
} }

View File

@ -1,41 +1,41 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
namespace OpenSim.Grid.ScriptServer namespace OpenSim.Grid.ScriptServer
{ {
internal class ScriptEngineManager internal class ScriptEngineManager
{ {
private LogBase m_log; private LogBase m_log;
private ScriptEngineLoader ScriptEngineLoader; private ScriptEngineLoader ScriptEngineLoader;
private List<ScriptEngineInterface> scriptEngines = new List<ScriptEngineInterface>(); private List<ScriptEngineInterface> scriptEngines = new List<ScriptEngineInterface>();
private ScriptServerMain m_ScriptServerMain; private ScriptServerMain m_ScriptServerMain;
// Initialize // Initialize
public ScriptEngineManager(ScriptServerMain scm, LogBase logger) public ScriptEngineManager(ScriptServerMain scm, LogBase logger)
{ {
m_ScriptServerMain = scm; m_ScriptServerMain = scm;
m_log = logger; m_log = logger;
ScriptEngineLoader = new ScriptEngineLoader(m_log); ScriptEngineLoader = new ScriptEngineLoader(m_log);
// Temp - we should not load during initialize... Loading should be done later. // Temp - we should not load during initialize... Loading should be done later.
LoadEngine("DotNetScriptEngine"); LoadEngine("DotNetScriptEngine");
} }
~ScriptEngineManager() ~ScriptEngineManager()
{ {
} }
public void LoadEngine(string engineName) public void LoadEngine(string engineName)
{ {
// Load and add to list of ScriptEngines // Load and add to list of ScriptEngines
ScriptEngineInterface sei = ScriptEngineLoader.LoadScriptEngine(engineName); ScriptEngineInterface sei = ScriptEngineLoader.LoadScriptEngine(engineName);
if (sei != null) if (sei != null)
{ {
scriptEngines.Add(sei); scriptEngines.Add(sei);
} }
} }
} }
} }

View File

@ -1,48 +1,48 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.IO; using System.IO;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
namespace OpenSim.Grid.ScriptServer namespace OpenSim.Grid.ScriptServer
{ {
public class ScriptServerMain : conscmd_callback public class ScriptServerMain : conscmd_callback
{ {
private readonly string m_logFilename = ("region-console.log"); private readonly string m_logFilename = ("region-console.log");
internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region
internal ScriptEngineManager ScriptEngines; // Loads scriptengines internal ScriptEngineManager ScriptEngines; // Loads scriptengines
private LogBase m_log; private LogBase m_log;
public ScriptServerMain() public ScriptServerMain()
{ {
m_log = CreateLog(); m_log = CreateLog();
RegionScriptDaemon = new RegionCommManager(this, m_log); RegionScriptDaemon = new RegionCommManager(this, m_log);
ScriptEngines = new ScriptEngineManager(this, m_log); ScriptEngines = new ScriptEngineManager(this, m_log);
} }
~ScriptServerMain() ~ScriptServerMain()
{ {
} }
protected LogBase CreateLog() protected LogBase CreateLog()
{ {
if (!Directory.Exists(Util.logDir())) if (!Directory.Exists(Util.logDir()))
{ {
Directory.CreateDirectory(Util.logDir()); Directory.CreateDirectory(Util.logDir());
} }
return new LogBase((Path.Combine(Util.logDir(), m_logFilename)), "Region", this, false); return new LogBase((Path.Combine(Util.logDir(), m_logFilename)), "Region", this, false);
} }
public void RunCmd(string command, string[] cmdparams) public void RunCmd(string command, string[] cmdparams)
{ {
} }
public void Show(string ShowWhat) public void Show(string ShowWhat)
{ {
} }
} }
} }

View File

@ -1,96 +1,96 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Net; using System.Net;
using Nwc.XmlRpc; using Nwc.XmlRpc;
using OpenSim.Framework.Data; using OpenSim.Framework.Data;
using OpenSim.Framework.UserManagement; using OpenSim.Framework.UserManagement;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Framework.Configuration; using OpenSim.Framework.Configuration;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
namespace OpenSim.Grid.UserServer namespace OpenSim.Grid.UserServer
{ {
public class UserLoginService : LoginService public class UserLoginService : LoginService
{ {
public UserConfig m_config; public UserConfig m_config;
public UserLoginService(UserManagerBase userManager, UserConfig config, string welcomeMess) public UserLoginService(UserManagerBase userManager, UserConfig config, string welcomeMess)
: base(userManager, welcomeMess) : base(userManager, welcomeMess)
{ {
m_config = config; m_config = config;
} }
/// <summary> /// <summary>
/// Customises the login response and fills in missing values. /// Customises the login response and fills in missing values.
/// </summary> /// </summary>
/// <param name="response">The existing response</param> /// <param name="response">The existing response</param>
/// <param name="theUser">The user profile</param> /// <param name="theUser">The user profile</param>
public override void CustomiseResponse(LoginResponse response, UserProfileData theUser) public override void CustomiseResponse(LoginResponse response, UserProfileData theUser)
{ {
// Load information from the gridserver // Load information from the gridserver
SimProfileData SimInfo = new SimProfileData(); SimProfileData SimInfo = new SimProfileData();
SimInfo = SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); SimInfo = SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey);
// Customise the response // Customise the response
// Home Location // Home Location
response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + (SimInfo.regionLocY * 256).ToString() + "], " + response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + (SimInfo.regionLocY * 256).ToString() + "], " +
"'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
"'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
// Destination // Destination
Console.WriteLine("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY); Console.WriteLine("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY);
response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString(); response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString();
response.SimPort = (Int32)SimInfo.serverPort; response.SimPort = (Int32)SimInfo.serverPort;
response.RegionX = SimInfo.regionLocX; response.RegionX = SimInfo.regionLocX;
response.RegionY = SimInfo.regionLocY; response.RegionY = SimInfo.regionLocY;
//Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI
string capsPath = Util.GetRandomCapsPath(); string capsPath = Util.GetRandomCapsPath();
response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/"; response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/";
// Notify the target of an incoming user // Notify the target of an incoming user
Console.WriteLine("Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI + ")"); Console.WriteLine("Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI + ")");
// Prepare notification // Prepare notification
Hashtable SimParams = new Hashtable(); Hashtable SimParams = new Hashtable();
SimParams["session_id"] = theUser.currentAgent.sessionID.ToString(); SimParams["session_id"] = theUser.currentAgent.sessionID.ToString();
SimParams["secure_session_id"] = theUser.currentAgent.secureSessionID.ToString(); SimParams["secure_session_id"] = theUser.currentAgent.secureSessionID.ToString();
SimParams["firstname"] = theUser.username; SimParams["firstname"] = theUser.username;
SimParams["lastname"] = theUser.surname; SimParams["lastname"] = theUser.surname;
SimParams["agent_id"] = theUser.UUID.ToString(); SimParams["agent_id"] = theUser.UUID.ToString();
SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode); SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode);
SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString(); SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString();
SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString(); SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString();
SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString(); SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString();
SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString(); SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString();
SimParams["caps_path"] = capsPath; SimParams["caps_path"] = capsPath;
ArrayList SendParams = new ArrayList(); ArrayList SendParams = new ArrayList();
SendParams.Add(SimParams); SendParams.Add(SimParams);
// Update agent with target sim // Update agent with target sim
theUser.currentAgent.currentRegion = SimInfo.UUID; theUser.currentAgent.currentRegion = SimInfo.UUID;
theUser.currentAgent.currentHandle = SimInfo.regionHandle; theUser.currentAgent.currentHandle = SimInfo.regionHandle;
System.Console.WriteLine("Informing region --> " + SimInfo.httpServerURI); System.Console.WriteLine("Informing region --> " + SimInfo.httpServerURI);
// Send // Send
try try
{ {
XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
} }
catch( WebException e ) catch( WebException e )
{ {
switch( e.Status ) switch( e.Status )
{ {
case WebExceptionStatus.Timeout: case WebExceptionStatus.Timeout:
//TODO: Send him to nearby or default region instead //TODO: Send him to nearby or default region instead
break; break;
default: default:
throw; throw;
} }
} }
} }
} }
} }

View File

@ -1,67 +1,67 @@
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using InventoryFolder=OpenSim.Framework.Communications.Caches.InventoryFolder; using InventoryFolder=OpenSim.Framework.Communications.Caches.InventoryFolder;
namespace OpenSim.Region.Communications.Local namespace OpenSim.Region.Communications.Local
{ {
public class LocalInventoryService : InventoryServiceBase public class LocalInventoryService : InventoryServiceBase
{ {
public LocalInventoryService() public LocalInventoryService()
{ {
} }
public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack) public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack)
{ {
List<InventoryFolderBase> folders = this.RequestFirstLevelFolders(userID); List<InventoryFolderBase> folders = this.RequestFirstLevelFolders(userID);
InventoryFolder rootFolder = null; InventoryFolder rootFolder = null;
//need to make sure we send root folder first //need to make sure we send root folder first
foreach (InventoryFolderBase folder in folders) foreach (InventoryFolderBase folder in folders)
{ {
if (folder.parentID == libsecondlife.LLUUID.Zero) if (folder.parentID == libsecondlife.LLUUID.Zero)
{ {
InventoryFolder newfolder = new InventoryFolder(folder); InventoryFolder newfolder = new InventoryFolder(folder);
rootFolder = newfolder; rootFolder = newfolder;
folderCallBack(userID, newfolder); folderCallBack(userID, newfolder);
} }
} }
if (rootFolder != null) if (rootFolder != null)
{ {
foreach (InventoryFolderBase folder in folders) foreach (InventoryFolderBase folder in folders)
{ {
if (folder.folderID != rootFolder.folderID) if (folder.folderID != rootFolder.folderID)
{ {
InventoryFolder newfolder = new InventoryFolder(folder); InventoryFolder newfolder = new InventoryFolder(folder);
folderCallBack(userID, newfolder); folderCallBack(userID, newfolder);
List<InventoryItemBase> items = this.RequestFolderItems(newfolder.folderID); List<InventoryItemBase> items = this.RequestFolderItems(newfolder.folderID);
foreach (InventoryItemBase item in items) foreach (InventoryItemBase item in items)
{ {
itemCallBack(userID, item); itemCallBack(userID, item);
} }
} }
} }
} }
} }
public override void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder) public override void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder)
{ {
this.AddFolder(folder); this.AddFolder(folder);
} }
public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
{ {
this.AddItem(item); this.AddItem(item);
} }
public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
{ {
this.deleteItem(item); this.deleteItem(item);
} }
} }
} }

View File

@ -1,173 +1,173 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using OpenSim.Framework.UserManagement; using OpenSim.Framework.UserManagement;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Framework.Inventory; using OpenSim.Framework.Inventory;
namespace OpenSim.Region.Communications.Local namespace OpenSim.Region.Communications.Local
{ {
public delegate void LoginToRegionEvent(ulong regionHandle, Login login); public delegate void LoginToRegionEvent(ulong regionHandle, Login login);
public class LocalLoginService : LoginService public class LocalLoginService : LoginService
{ {
private CommunicationsLocal m_Parent; private CommunicationsLocal m_Parent;
private NetworkServersInfo serversInfo; private NetworkServersInfo serversInfo;
private uint defaultHomeX; private uint defaultHomeX;
private uint defaultHomeY; private uint defaultHomeY;
private bool authUsers = false; private bool authUsers = false;
public event LoginToRegionEvent OnLoginToRegion; public event LoginToRegionEvent OnLoginToRegion;
public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent, NetworkServersInfo serversInfo, bool authenticate) public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent, NetworkServersInfo serversInfo, bool authenticate)
: base(userManager, welcomeMess) : base(userManager, welcomeMess)
{ {
m_Parent = parent; m_Parent = parent;
this.serversInfo = serversInfo; this.serversInfo = serversInfo;
defaultHomeX = this.serversInfo.DefaultHomeLocX; defaultHomeX = this.serversInfo.DefaultHomeLocX;
defaultHomeY = this.serversInfo.DefaultHomeLocY; defaultHomeY = this.serversInfo.DefaultHomeLocY;
this.authUsers = authenticate; this.authUsers = authenticate;
} }
public override UserProfileData GetTheUser(string firstname, string lastname) public override UserProfileData GetTheUser(string firstname, string lastname)
{ {
UserProfileData profile = this.m_userManager.GetUserProfile(firstname, lastname); UserProfileData profile = this.m_userManager.GetUserProfile(firstname, lastname);
if (profile != null) if (profile != null)
{ {
return profile; return profile;
} }
if (!authUsers) if (!authUsers)
{ {
//no current user account so make one //no current user account so make one
Console.WriteLine("No User account found so creating a new one "); Console.WriteLine("No User account found so creating a new one ");
this.m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY); this.m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY);
profile = this.m_userManager.GetUserProfile(firstname, lastname); profile = this.m_userManager.GetUserProfile(firstname, lastname);
if (profile != null) if (profile != null)
{ {
m_Parent.InventoryService.CreateNewUserInventory(profile.UUID); m_Parent.InventoryService.CreateNewUserInventory(profile.UUID);
} }
return profile; return profile;
} }
return null; return null;
} }
public override bool AuthenticateUser(UserProfileData profile, string password) public override bool AuthenticateUser(UserProfileData profile, string password)
{ {
if (!authUsers) if (!authUsers)
{ {
//for now we will accept any password in sandbox mode //for now we will accept any password in sandbox mode
Console.WriteLine("authorising user"); Console.WriteLine("authorising user");
return true; return true;
} }
else else
{ {
Console.WriteLine("Authenticating " + profile.username + " " + profile.surname); Console.WriteLine("Authenticating " + profile.username + " " + profile.surname);
password = password.Remove(0, 3); //remove $1$ password = password.Remove(0, 3); //remove $1$
string s = Util.Md5Hash(password + ":" + profile.passwordSalt); string s = Util.Md5Hash(password + ":" + profile.passwordSalt);
return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase); return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase);
} }
} }
public override void CustomiseResponse(LoginResponse response, UserProfileData theUser) public override void CustomiseResponse(LoginResponse response, UserProfileData theUser)
{ {
ulong currentRegion = theUser.currentAgent.currentHandle; ulong currentRegion = theUser.currentAgent.currentHandle;
RegionInfo reg = m_Parent.GridService.RequestNeighbourInfo(currentRegion); RegionInfo reg = m_Parent.GridService.RequestNeighbourInfo(currentRegion);
if (reg != null) if (reg != null)
{ {
response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " + response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " +
"'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
"'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
string capsPath = Util.GetRandomCapsPath(); string capsPath = Util.GetRandomCapsPath();
response.SimAddress = reg.ExternalEndPoint.Address.ToString(); response.SimAddress = reg.ExternalEndPoint.Address.ToString();
response.SimPort = (Int32)reg.ExternalEndPoint.Port; response.SimPort = (Int32)reg.ExternalEndPoint.Port;
response.RegionX = reg.RegionLocX; response.RegionX = reg.RegionLocX;
response.RegionY = reg.RegionLocY; response.RegionY = reg.RegionLocY;
response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/"; response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/";
// response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CapsSeed/" + capsPath + "0000/"; // response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CapsSeed/" + capsPath + "0000/";
theUser.currentAgent.currentRegion = reg.SimUUID; theUser.currentAgent.currentRegion = reg.SimUUID;
theUser.currentAgent.currentHandle = reg.RegionHandle; theUser.currentAgent.currentHandle = reg.RegionHandle;
Login _login = new Login(); Login _login = new Login();
//copy data to login object //copy data to login object
_login.First = response.Firstname; _login.First = response.Firstname;
_login.Last = response.Lastname; _login.Last = response.Lastname;
_login.Agent = response.AgentID; _login.Agent = response.AgentID;
_login.Session = response.SessionID; _login.Session = response.SessionID;
_login.SecureSession = response.SecureSessionID; _login.SecureSession = response.SecureSessionID;
_login.CircuitCode = (uint)response.CircuitCode; _login.CircuitCode = (uint)response.CircuitCode;
_login.CapsPath = capsPath; _login.CapsPath = capsPath;
if( OnLoginToRegion != null ) if( OnLoginToRegion != null )
{ {
OnLoginToRegion(currentRegion, _login); OnLoginToRegion(currentRegion, _login);
} }
} }
else else
{ {
Console.WriteLine("not found region " + currentRegion); Console.WriteLine("not found region " + currentRegion);
} }
} }
protected override InventoryData CreateInventoryData(LLUUID userID) protected override InventoryData CreateInventoryData(LLUUID userID)
{ {
List<InventoryFolderBase> folders = m_Parent.InventoryService.RequestFirstLevelFolders(userID); List<InventoryFolderBase> folders = m_Parent.InventoryService.RequestFirstLevelFolders(userID);
if (folders.Count > 0) if (folders.Count > 0)
{ {
LLUUID rootID = LLUUID.Zero; LLUUID rootID = LLUUID.Zero;
ArrayList AgentInventoryArray = new ArrayList(); ArrayList AgentInventoryArray = new ArrayList();
Hashtable TempHash; Hashtable TempHash;
foreach (InventoryFolderBase InvFolder in folders) foreach (InventoryFolderBase InvFolder in folders)
{ {
if (InvFolder.parentID == LLUUID.Zero) if (InvFolder.parentID == LLUUID.Zero)
{ {
rootID = InvFolder.folderID; rootID = InvFolder.folderID;
} }
TempHash = new Hashtable(); TempHash = new Hashtable();
TempHash["name"] = InvFolder.name; TempHash["name"] = InvFolder.name;
TempHash["parent_id"] = InvFolder.parentID.ToStringHyphenated(); TempHash["parent_id"] = InvFolder.parentID.ToStringHyphenated();
TempHash["version"] = (Int32)InvFolder.version; TempHash["version"] = (Int32)InvFolder.version;
TempHash["type_default"] = (Int32)InvFolder.type; TempHash["type_default"] = (Int32)InvFolder.type;
TempHash["folder_id"] = InvFolder.folderID.ToStringHyphenated(); TempHash["folder_id"] = InvFolder.folderID.ToStringHyphenated();
AgentInventoryArray.Add(TempHash); AgentInventoryArray.Add(TempHash);
} }
return new InventoryData(AgentInventoryArray, rootID); return new InventoryData(AgentInventoryArray, rootID);
} }
else else
{ {
AgentInventory userInventory = new AgentInventory(); AgentInventory userInventory = new AgentInventory();
userInventory.CreateRootFolder(userID, false); userInventory.CreateRootFolder(userID, false);
ArrayList AgentInventoryArray = new ArrayList(); ArrayList AgentInventoryArray = new ArrayList();
Hashtable TempHash; Hashtable TempHash;
foreach (OpenSim.Framework.Inventory.InventoryFolder InvFolder in userInventory.InventoryFolders.Values) foreach (OpenSim.Framework.Inventory.InventoryFolder InvFolder in userInventory.InventoryFolders.Values)
{ {
TempHash = new Hashtable(); TempHash = new Hashtable();
TempHash["name"] = InvFolder.FolderName; TempHash["name"] = InvFolder.FolderName;
TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
TempHash["version"] = (Int32)InvFolder.Version; TempHash["version"] = (Int32)InvFolder.Version;
TempHash["type_default"] = (Int32)InvFolder.DefaultType; TempHash["type_default"] = (Int32)InvFolder.DefaultType;
TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
AgentInventoryArray.Add(TempHash); AgentInventoryArray.Add(TempHash);
} }
return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID); return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID);
} }
} }
} }
} }

View File

@ -1,52 +1,52 @@
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder; using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder;
namespace OpenSim.Region.Communications.OGS1 namespace OpenSim.Region.Communications.OGS1
{ {
public class OGS1InventoryService : IInventoryServices public class OGS1InventoryService : IInventoryServices
{ {
public OGS1InventoryService() public OGS1InventoryService()
{ {
} }
#region IInventoryServices Members #region IInventoryServices Members
public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack) public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack)
{ {
} }
public void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder) public void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder)
{ {
} }
public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
{ {
} }
public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
{ {
} }
public void CreateNewUserInventory(LLUUID user) public void CreateNewUserInventory(LLUUID user)
{ {
} }
public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID) public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID)
{ {
return new List<InventoryFolderBase>(); return new List<InventoryFolderBase>();
} }
#endregion #endregion
} }
} }

View File

@ -1,17 +1,17 @@
using System.IO; using System.IO;
using libsecondlife; using libsecondlife;
namespace OpenSim.Region.Environment.Interfaces namespace OpenSim.Region.Environment.Interfaces
{ {
public interface IDynamicTextureManager public interface IDynamicTextureManager
{ {
void RegisterRender(string handleType, IDynamicTextureRender render); void RegisterRender(string handleType, IDynamicTextureRender render);
void ReturnData(LLUUID id, byte[] data); void ReturnData(LLUUID id, byte[] data);
LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams, LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams,
int updateTimer); int updateTimer);
LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, string extraParams, LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, string extraParams,
int updateTimer); int updateTimer);
} }

View File

@ -1,5 +1,5 @@
using libsecondlife; using libsecondlife;
namespace OpenSim.Region.Environment.Interfaces namespace OpenSim.Region.Environment.Interfaces
{ {
public interface IHttpRequests public interface IHttpRequests

View File

@ -1,5 +1,5 @@
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Interfaces namespace OpenSim.Region.Environment.Interfaces
{ {
public interface IRegionModule public interface IRegionModule

View File

@ -1,5 +1,5 @@
using libsecondlife; using libsecondlife;
namespace OpenSim.Region.Environment.Interfaces namespace OpenSim.Region.Environment.Interfaces
{ {
public interface ISimChat public interface ISimChat

View File

@ -1,16 +1,16 @@
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
namespace OpenSim.Region.Environment.Interfaces namespace OpenSim.Region.Environment.Interfaces
{ {
public interface ITerrain public interface ITerrain
{ {
bool Tainted(); bool Tainted();
bool Tainted(int x, int y); bool Tainted(int x, int y);
void ResetTaint(); void ResetTaint();
void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west,
IClientAPI remoteUser); IClientAPI remoteUser);
void CheckHeightValues(); void CheckHeightValues();
float[] GetHeights1D(); float[] GetHeights1D();
float[,] GetHeights2D(); float[,] GetHeights2D();

View File

@ -1,156 +1,156 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Modules; using OpenSim.Region.Environment.Modules;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment namespace OpenSim.Region.Environment
{ {
public class ModuleLoader public class ModuleLoader
{ {
public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>(); public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>();
public List<IRegionModule> LoadedModules = new List<IRegionModule>(); public List<IRegionModule> LoadedModules = new List<IRegionModule>();
public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>(); public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>();
public ModuleLoader() public ModuleLoader()
{ {
} }
/// <summary> /// <summary>
/// Should have a module factory? /// Should have a module factory?
/// </summary> /// </summary>
/// <param name="scene"></param> /// <param name="scene"></param>
public void CreateDefaultModules(Scene scene, string exceptModules) public void CreateDefaultModules(Scene scene, string exceptModules)
{ {
IRegionModule module = new XferModule(); IRegionModule module = new XferModule();
InitialiseModule(module, scene); InitialiseModule(module, scene);
module = new ChatModule(); module = new ChatModule();
InitialiseModule(module, scene); InitialiseModule(module, scene);
module = new AvatarProfilesModule(); module = new AvatarProfilesModule();
InitialiseModule(module, scene); InitialiseModule(module, scene);
LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene); LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene);
string lslPath = Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.DotNetEngine.dll"); string lslPath = Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.DotNetEngine.dll");
LoadRegionModule(lslPath, "LSLScriptingModule", scene); LoadRegionModule(lslPath, "LSLScriptingModule", scene);
} }
public void LoadDefaultSharedModules(string exceptModules) public void LoadDefaultSharedModules(string exceptModules)
{ {
DynamicTextureModule dynamicModule = new DynamicTextureModule(); DynamicTextureModule dynamicModule = new DynamicTextureModule();
LoadedSharedModules.Add(dynamicModule.GetName(), dynamicModule); LoadedSharedModules.Add(dynamicModule.GetName(), dynamicModule);
} }
public void InitialiseSharedModules(Scene scene) public void InitialiseSharedModules(Scene scene)
{ {
foreach (IRegionModule module in LoadedSharedModules.Values) foreach (IRegionModule module in LoadedSharedModules.Values)
{ {
module.Initialise(scene); module.Initialise(scene);
scene.AddModule(module.GetName(), module); //should be doing this? scene.AddModule(module.GetName(), module); //should be doing this?
} }
} }
private void InitialiseModule(IRegionModule module, Scene scene) private void InitialiseModule(IRegionModule module, Scene scene)
{ {
module.Initialise(scene); module.Initialise(scene);
scene.AddModule(module.GetName(), module); scene.AddModule(module.GetName(), module);
LoadedModules.Add(module); LoadedModules.Add(module);
} }
/// <summary> /// <summary>
/// Loads/initialises a Module instance that can be used by mutliple Regions /// Loads/initialises a Module instance that can be used by mutliple Regions
/// </summary> /// </summary>
/// <param name="dllName"></param> /// <param name="dllName"></param>
/// <param name="moduleName"></param> /// <param name="moduleName"></param>
/// <param name="scene"></param> /// <param name="scene"></param>
public void LoadSharedModule(string dllName, string moduleName) public void LoadSharedModule(string dllName, string moduleName)
{ {
IRegionModule module = LoadModule(dllName, moduleName); IRegionModule module = LoadModule(dllName, moduleName);
if (module != null) if (module != null)
{ {
LoadedSharedModules.Add(module.GetName(), module); LoadedSharedModules.Add(module.GetName(), module);
} }
} }
public void LoadRegionModule(string dllName, string moduleName, Scene scene) public void LoadRegionModule(string dllName, string moduleName, Scene scene)
{ {
IRegionModule module = LoadModule(dllName, moduleName); IRegionModule module = LoadModule(dllName, moduleName);
if (module != null) if (module != null)
{ {
InitialiseModule(module, scene); InitialiseModule(module, scene);
} }
} }
/// <summary> /// <summary>
/// Loads a external Module (if not already loaded) and creates a new instance of it. /// Loads a external Module (if not already loaded) and creates a new instance of it.
/// </summary> /// </summary>
/// <param name="dllName"></param> /// <param name="dllName"></param>
/// <param name="moduleName"></param> /// <param name="moduleName"></param>
/// <param name="scene"></param> /// <param name="scene"></param>
public IRegionModule LoadModule(string dllName, string moduleName) public IRegionModule LoadModule(string dllName, string moduleName)
{ {
Assembly pluginAssembly = null; Assembly pluginAssembly = null;
if (LoadedAssemblys.ContainsKey(dllName)) if (LoadedAssemblys.ContainsKey(dllName))
{ {
pluginAssembly = LoadedAssemblys[dllName]; pluginAssembly = LoadedAssemblys[dllName];
} }
else else
{ {
pluginAssembly = Assembly.LoadFrom(dllName); pluginAssembly = Assembly.LoadFrom(dllName);
LoadedAssemblys.Add(dllName, pluginAssembly); LoadedAssemblys.Add(dllName, pluginAssembly);
} }
IRegionModule module = null; IRegionModule module = null;
foreach (Type pluginType in pluginAssembly.GetTypes()) foreach (Type pluginType in pluginAssembly.GetTypes())
{ {
if (pluginType.IsPublic) if (pluginType.IsPublic)
{ {
if (!pluginType.IsAbstract) if (!pluginType.IsAbstract)
{ {
Type typeInterface = pluginType.GetInterface("IRegionModule", true); Type typeInterface = pluginType.GetInterface("IRegionModule", true);
if (typeInterface != null) if (typeInterface != null)
{ {
module = module =
(IRegionModule) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); (IRegionModule) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
break; break;
} }
typeInterface = null; typeInterface = null;
} }
} }
} }
pluginAssembly = null; pluginAssembly = null;
if ((module != null) || (module.GetName() == moduleName)) if ((module != null) || (module.GetName() == moduleName))
{ {
return module; return module;
} }
return null; return null;
} }
public void PostInitialise() public void PostInitialise()
{ {
foreach (IRegionModule module in LoadedSharedModules.Values) foreach (IRegionModule module in LoadedSharedModules.Values)
{ {
module.PostInitialise(); module.PostInitialise();
} }
foreach (IRegionModule module in LoadedModules) foreach (IRegionModule module in LoadedModules)
{ {
module.PostInitialise(); module.PostInitialise();
} }
} }
public void ClearCache() public void ClearCache()
{ {
LoadedAssemblys.Clear(); LoadedAssemblys.Clear();
} }
} }
} }

View File

@ -1,7 +1,7 @@
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
public class AssetDownloadModule : IRegionModule public class AssetDownloadModule : IRegionModule
@ -9,7 +9,7 @@ namespace OpenSim.Region.Environment.Modules
private Scene m_scene; private Scene m_scene;
public AssetDownloadModule() public AssetDownloadModule()
{ {
} }
public void Initialise(Scene scene) public void Initialise(Scene scene)
@ -19,7 +19,7 @@ namespace OpenSim.Region.Environment.Modules
} }
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()

View File

@ -1,16 +1,16 @@
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
public class AvatarProfilesModule : IRegionModule public class AvatarProfilesModule : IRegionModule
{ {
private Scene m_scene; private Scene m_scene;
public AvatarProfilesModule() public AvatarProfilesModule()
{ {
} }
public void Initialise(Scene scene) public void Initialise(Scene scene)
@ -20,11 +20,11 @@ namespace OpenSim.Region.Environment.Modules
} }
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()
{ {
} }
public string GetName() public string GetName()
@ -58,7 +58,7 @@ namespace OpenSim.Region.Environment.Modules
string bornOn = "Before now"; string bornOn = "Before now";
string flAbout = "First life? What is one of those? OpenSim is my life!"; string flAbout = "First life? What is one of those? OpenSim is my life!";
LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000"); LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000");
remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "", remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "",
partner); partner);
} }
} }

View File

@ -1,214 +1,214 @@
using System; using System;
using System.IO; using System.IO;
using System.Net.Sockets; using System.Net.Sockets;
using System.Threading; using System.Threading;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
public class ChatModule : IRegionModule, ISimChat public class ChatModule : IRegionModule, ISimChat
{ {
private Scene m_scene; private Scene m_scene;
private string m_server = "irc2.choopa.net"; private string m_server = "irc2.choopa.net";
// private int m_port = 6668; // private int m_port = 6668;
//private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot"; //private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot";
private string m_nick = "OSimBot"; private string m_nick = "OSimBot";
private string m_channel = "#opensim"; private string m_channel = "#opensim";
// private NetworkStream m_stream; // private NetworkStream m_stream;
private TcpClient m_irc; private TcpClient m_irc;
private StreamWriter m_ircWriter; private StreamWriter m_ircWriter;
private StreamReader m_ircReader; private StreamReader m_ircReader;
// private Thread pingSender; // private Thread pingSender;
// private Thread listener; // private Thread listener;
private bool connected = false; private bool connected = false;
public ChatModule() public ChatModule()
{ {
m_nick = "OSimBot" + Util.RandomClass.Next(1, 99); m_nick = "OSimBot" + Util.RandomClass.Next(1, 99);
m_irc = null; m_irc = null;
m_ircWriter = null; m_ircWriter = null;
m_ircReader = null; m_ircReader = null;
} }
public void Initialise(Scene scene) public void Initialise(Scene scene)
{ {
m_scene = scene; m_scene = scene;
m_scene.EventManager.OnNewClient += NewClient; m_scene.EventManager.OnNewClient += NewClient;
m_scene.RegisterModuleInterface<ISimChat>(this); m_scene.RegisterModuleInterface<ISimChat>(this);
} }
public void PostInitialise() public void PostInitialise()
{ {
/* /*
try try
{ {
m_irc = new TcpClient(m_server, m_port); m_irc = new TcpClient(m_server, m_port);
m_stream = m_irc.GetStream(); m_stream = m_irc.GetStream();
m_ircReader = new StreamReader(m_stream); m_ircReader = new StreamReader(m_stream);
m_ircWriter = new StreamWriter(m_stream); m_ircWriter = new StreamWriter(m_stream);
pingSender = new Thread(new ThreadStart(this.PingRun)); pingSender = new Thread(new ThreadStart(this.PingRun));
pingSender.Start(); pingSender.Start();
listener = new Thread(new ThreadStart(this.ListenerRun)); listener = new Thread(new ThreadStart(this.ListenerRun));
listener.Start(); listener.Start();
m_ircWriter.WriteLine(m_user); m_ircWriter.WriteLine(m_user);
m_ircWriter.Flush(); m_ircWriter.Flush();
m_ircWriter.WriteLine("NICK " + m_nick); m_ircWriter.WriteLine("NICK " + m_nick);
m_ircWriter.Flush(); m_ircWriter.Flush();
m_ircWriter.WriteLine("JOIN " + m_channel); m_ircWriter.WriteLine("JOIN " + m_channel);
m_ircWriter.Flush(); m_ircWriter.Flush();
connected = true; connected = true;
} }
catch (Exception e) catch (Exception e)
{ {
Console.WriteLine(e.ToString()); Console.WriteLine(e.ToString());
} }
*/ */
} }
public void CloseDown() public void CloseDown()
{ {
m_ircWriter.Close(); m_ircWriter.Close();
m_ircReader.Close(); m_ircReader.Close();
m_irc.Close(); m_irc.Close();
} }
public string GetName() public string GetName()
{ {
return "ChatModule"; return "ChatModule";
} }
public bool IsSharedModule() public bool IsSharedModule()
{ {
return false; return false;
} }
public void NewClient(IClientAPI client) public void NewClient(IClientAPI client)
{ {
client.OnChatFromViewer += SimChat; client.OnChatFromViewer += SimChat;
} }
public void PingRun() public void PingRun()
{ {
while (true) while (true)
{ {
m_ircWriter.WriteLine("PING :" + m_server); m_ircWriter.WriteLine("PING :" + m_server);
m_ircWriter.Flush(); m_ircWriter.Flush();
Thread.Sleep(15000); Thread.Sleep(15000);
} }
} }
public void ListenerRun() public void ListenerRun()
{ {
string inputLine; string inputLine;
LLVector3 pos = new LLVector3(128, 128, 20); LLVector3 pos = new LLVector3(128, 128, 20);
while (true) while (true)
{ {
while ((inputLine = m_ircReader.ReadLine()) != null) while ((inputLine = m_ircReader.ReadLine()) != null)
{ {
Console.WriteLine(inputLine); Console.WriteLine(inputLine);
if (inputLine.Contains(m_channel)) if (inputLine.Contains(m_channel))
{ {
string mess = inputLine.Substring(inputLine.IndexOf(m_channel)); string mess = inputLine.Substring(inputLine.IndexOf(m_channel));
m_scene.Broadcast(delegate(IClientAPI client) m_scene.Broadcast(delegate(IClientAPI client)
{ {
client.SendChatMessage( client.SendChatMessage(
Helpers.StringToField(mess), 255, pos, "IRC:", Helpers.StringToField(mess), 255, pos, "IRC:",
LLUUID.Zero); LLUUID.Zero);
}); });
} }
} }
} }
} }
public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName,
LLUUID fromAgentID) LLUUID fromAgentID)
{ {
ScenePresence avatar = null; ScenePresence avatar = null;
avatar = m_scene.GetScenePresence(fromAgentID); avatar = m_scene.GetScenePresence(fromAgentID);
if (avatar != null) if (avatar != null)
{ {
fromPos = avatar.AbsolutePosition; fromPos = avatar.AbsolutePosition;
fromName = avatar.Firstname + " " + avatar.Lastname; fromName = avatar.Firstname + " " + avatar.Lastname;
avatar = null; avatar = null;
} }
if (connected) if (connected)
{ {
m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + ">: " + m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + ">: " +
Util.FieldToString(message)); Util.FieldToString(message));
m_ircWriter.Flush(); m_ircWriter.Flush();
} }
if (channel == 0) if (channel == 0)
{ {
m_scene.ForEachScenePresence(delegate(ScenePresence presence) m_scene.ForEachScenePresence(delegate(ScenePresence presence)
{ {
int dis = -1000; int dis = -1000;
//err ??? the following code seems to be request a scenePresence when it already has a ref to it //err ??? the following code seems to be request a scenePresence when it already has a ref to it
avatar = m_scene.GetScenePresence(presence.ControllingClient.AgentId); avatar = m_scene.GetScenePresence(presence.ControllingClient.AgentId);
if (avatar != null) if (avatar != null)
{ {
dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos); dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos);
} }
switch (type) switch (type)
{ {
case 0: // Whisper case 0: // Whisper
if ((dis < 10) && (dis > -10)) if ((dis < 10) && (dis > -10))
{ {
//should change so the message is sent through the avatar rather than direct to the ClientView //should change so the message is sent through the avatar rather than direct to the ClientView
presence.ControllingClient.SendChatMessage(message, presence.ControllingClient.SendChatMessage(message,
type, type,
fromPos, fromPos,
fromName, fromName,
fromAgentID); fromAgentID);
} }
break; break;
case 1: // Say case 1: // Say
if ((dis < 30) && (dis > -30)) if ((dis < 30) && (dis > -30))
{ {
//Console.WriteLine("sending chat"); //Console.WriteLine("sending chat");
presence.ControllingClient.SendChatMessage(message, presence.ControllingClient.SendChatMessage(message,
type, type,
fromPos, fromPos,
fromName, fromName,
fromAgentID); fromAgentID);
} }
break; break;
case 2: // Shout case 2: // Shout
if ((dis < 100) && (dis > -100)) if ((dis < 100) && (dis > -100))
{ {
presence.ControllingClient.SendChatMessage(message, presence.ControllingClient.SendChatMessage(message,
type, type,
fromPos, fromPos,
fromName, fromName,
fromAgentID); fromAgentID);
} }
break; break;
case 0xff: // Broadcast case 0xff: // Broadcast
presence.ControllingClient.SendChatMessage(message, type, presence.ControllingClient.SendChatMessage(message, type,
fromPos, fromPos,
fromName, fromName,
fromAgentID); fromAgentID);
break; break;
} }
}); });
} }
} }
} }
} }

View File

@ -1,157 +1,157 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
public class DynamicTextureModule : IRegionModule, IDynamicTextureManager public class DynamicTextureModule : IRegionModule, IDynamicTextureManager
{ {
private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>(); private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
private Dictionary<string, IDynamicTextureRender> RenderPlugins = private Dictionary<string, IDynamicTextureRender> RenderPlugins =
new Dictionary<string, IDynamicTextureRender>(); new Dictionary<string, IDynamicTextureRender>();
private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>(); private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>();
public void Initialise(Scene scene) public void Initialise(Scene scene)
{ {
if (!RegisteredScenes.ContainsKey(scene.RegionInfo.SimUUID)) if (!RegisteredScenes.ContainsKey(scene.RegionInfo.SimUUID))
{ {
RegisteredScenes.Add(scene.RegionInfo.SimUUID, scene); RegisteredScenes.Add(scene.RegionInfo.SimUUID, scene);
scene.RegisterModuleInterface<IDynamicTextureManager>(this); scene.RegisterModuleInterface<IDynamicTextureManager>(this);
} }
} }
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()
{ {
} }
public string GetName() public string GetName()
{ {
return "DynamicTextureModule"; return "DynamicTextureModule";
} }
public bool IsSharedModule() public bool IsSharedModule()
{ {
return true; return true;
} }
public void RegisterRender(string handleType, IDynamicTextureRender render) public void RegisterRender(string handleType, IDynamicTextureRender render)
{ {
if (!RenderPlugins.ContainsKey(handleType)) if (!RenderPlugins.ContainsKey(handleType))
{ {
RenderPlugins.Add(handleType, render); RenderPlugins.Add(handleType, render);
} }
} }
public void ReturnData(LLUUID id, byte[] data) public void ReturnData(LLUUID id, byte[] data)
{ {
if (Updaters.ContainsKey(id)) if (Updaters.ContainsKey(id))
{ {
DynamicTextureUpdater updater = Updaters[id]; DynamicTextureUpdater updater = Updaters[id];
if (RegisteredScenes.ContainsKey(updater.SimUUID)) if (RegisteredScenes.ContainsKey(updater.SimUUID))
{ {
Scene scene = RegisteredScenes[updater.SimUUID]; Scene scene = RegisteredScenes[updater.SimUUID];
updater.DataReceived(data, scene); updater.DataReceived(data, scene);
} }
} }
} }
public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url,
string extraParams, int updateTimer) string extraParams, int updateTimer)
{ {
Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType); Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType);
if (RenderPlugins.ContainsKey(contentType)) if (RenderPlugins.ContainsKey(contentType))
{ {
DynamicTextureUpdater updater = new DynamicTextureUpdater(); DynamicTextureUpdater updater = new DynamicTextureUpdater();
updater.SimUUID = simID; updater.SimUUID = simID;
updater.PrimID = primID; updater.PrimID = primID;
updater.ContentType = contentType; updater.ContentType = contentType;
updater.Url = url; updater.Url = url;
updater.UpdateTimer = updateTimer; updater.UpdateTimer = updateTimer;
updater.UpdaterID = LLUUID.Random(); updater.UpdaterID = LLUUID.Random();
updater.Params = extraParams; updater.Params = extraParams;
if (!Updaters.ContainsKey(updater.UpdaterID)) if (!Updaters.ContainsKey(updater.UpdaterID))
{ {
Updaters.Add(updater.UpdaterID, updater); Updaters.Add(updater.UpdaterID, updater);
} }
RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams); RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams);
return updater.UpdaterID; return updater.UpdaterID;
} }
return LLUUID.Zero; return LLUUID.Zero;
} }
public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data,
string extraParams, int updateTimer) string extraParams, int updateTimer)
{ {
if (RenderPlugins.ContainsKey(contentType)) if (RenderPlugins.ContainsKey(contentType))
{ {
DynamicTextureUpdater updater = new DynamicTextureUpdater(); DynamicTextureUpdater updater = new DynamicTextureUpdater();
updater.SimUUID = simID; updater.SimUUID = simID;
updater.PrimID = primID; updater.PrimID = primID;
updater.ContentType = contentType; updater.ContentType = contentType;
updater.BodyData = data; updater.BodyData = data;
updater.UpdateTimer = updateTimer; updater.UpdateTimer = updateTimer;
updater.UpdaterID = LLUUID.Random(); updater.UpdaterID = LLUUID.Random();
updater.Params = extraParams; updater.Params = extraParams;
if (!Updaters.ContainsKey(updater.UpdaterID)) if (!Updaters.ContainsKey(updater.UpdaterID))
{ {
Updaters.Add(updater.UpdaterID, updater); Updaters.Add(updater.UpdaterID, updater);
} }
RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams); RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams);
return updater.UpdaterID; return updater.UpdaterID;
} }
return LLUUID.Zero; return LLUUID.Zero;
} }
public class DynamicTextureUpdater public class DynamicTextureUpdater
{ {
public LLUUID SimUUID; public LLUUID SimUUID;
public LLUUID UpdaterID; public LLUUID UpdaterID;
public string ContentType; public string ContentType;
public string Url; public string Url;
public string BodyData; public string BodyData;
public LLUUID PrimID; public LLUUID PrimID;
public int UpdateTimer; public int UpdateTimer;
public LLUUID LastAssetID; public LLUUID LastAssetID;
public string Params; public string Params;
public DynamicTextureUpdater() public DynamicTextureUpdater()
{ {
LastAssetID = LLUUID.Zero; LastAssetID = LLUUID.Zero;
UpdateTimer = 0; UpdateTimer = 0;
BodyData = null; BodyData = null;
} }
public void DataReceived(byte[] data, Scene scene) public void DataReceived(byte[] data, Scene scene)
{ {
//TODO delete the last asset(data), if it was a dynamic texture //TODO delete the last asset(data), if it was a dynamic texture
AssetBase asset = new AssetBase(); AssetBase asset = new AssetBase();
asset.FullID = LLUUID.Random(); asset.FullID = LLUUID.Random();
asset.Data = data; asset.Data = data;
asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000);
asset.Type = 0; asset.Type = 0;
scene.commsManager.AssetCache.AddAsset(asset); scene.commsManager.AssetCache.AddAsset(asset);
LastAssetID = asset.FullID; LastAssetID = asset.FullID;
SceneObjectPart part = scene.GetSceneObjectPart(PrimID); SceneObjectPart part = scene.GetSceneObjectPart(PrimID);
part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes(); part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes();
part.ScheduleFullUpdate(); part.ScheduleFullUpdate();
} }
} }
} }
} }

View File

@ -1,6 +1,6 @@
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
public class FriendsModule : IRegionModule public class FriendsModule : IRegionModule
@ -13,7 +13,7 @@ namespace OpenSim.Region.Environment.Modules
} }
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()

View File

@ -1,6 +1,6 @@
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
public class GroupsModule : IRegionModule public class GroupsModule : IRegionModule
@ -13,7 +13,7 @@ namespace OpenSim.Region.Environment.Modules
} }
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()

View File

@ -1,6 +1,6 @@
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
public class InstantMessageModule : IRegionModule public class InstantMessageModule : IRegionModule
@ -13,7 +13,7 @@ namespace OpenSim.Region.Environment.Modules
} }
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()

View File

@ -1,6 +1,6 @@
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
public class InventoryModule : IRegionModule public class InventoryModule : IRegionModule
@ -13,7 +13,7 @@ namespace OpenSim.Region.Environment.Modules
} }
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()

View File

@ -1,8 +1,8 @@
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
public class TextureDownloadModule : IRegionModule public class TextureDownloadModule : IRegionModule
@ -10,7 +10,7 @@ namespace OpenSim.Region.Environment.Modules
private Scene m_scene; private Scene m_scene;
public TextureDownloadModule() public TextureDownloadModule()
{ {
} }
public void Initialise(Scene scene) public void Initialise(Scene scene)
@ -20,7 +20,7 @@ namespace OpenSim.Region.Environment.Modules
} }
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()
@ -42,7 +42,7 @@ namespace OpenSim.Region.Environment.Modules
} }
public void TextureAssetCallback(LLUUID texture, byte[] data) public void TextureAssetCallback(LLUUID texture, byte[] data)
{ {
} }
} }
} }

View File

@ -1,10 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
public class XferModule : IRegionModule, IXfer public class XferModule : IRegionModule, IXfer
@ -15,7 +15,7 @@ namespace OpenSim.Region.Environment.Modules
private Scene m_scene; private Scene m_scene;
public XferModule() public XferModule()
{ {
} }
public void Initialise(Scene scene) public void Initialise(Scene scene)
@ -27,11 +27,11 @@ namespace OpenSim.Region.Environment.Modules
} }
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()
{ {
} }
public string GetName() public string GetName()
@ -119,7 +119,7 @@ namespace OpenSim.Region.Environment.Modules
} }
public XferDownLoad() public XferDownLoad()
{ {
} }
public void StartSend() public void StartSend()

View File

@ -1,7 +1,7 @@
using libsecondlife; using libsecondlife;
using OpenSim.Region.Environment.LandManagement; using OpenSim.Region.Environment.LandManagement;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment namespace OpenSim.Region.Environment
{ {
public class PermissionManager public class PermissionManager
@ -12,8 +12,8 @@ namespace OpenSim.Region.Environment
// disable in any production environment // disable in any production environment
// TODO: Change this to false when permissions are a desired default // TODO: Change this to false when permissions are a desired default
// TODO: Move to configuration option. // TODO: Move to configuration option.
private bool m_bypassPermissions = true; private bool m_bypassPermissions = true;
public bool BypassPermissions public bool BypassPermissions
{ {
get { return m_bypassPermissions; } get { return m_bypassPermissions; }
@ -117,7 +117,7 @@ namespace OpenSim.Region.Environment
permission = true; permission = true;
// Users should be able to edit what is over their land. // Users should be able to edit what is over their land.
if (m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y).landData.ownerID == if (m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y).landData.ownerID ==
user) user)
permission = true; permission = true;
@ -294,6 +294,6 @@ namespace OpenSim.Region.Environment
return GenericParcelPermission(user, parcel); return GenericParcelPermission(user, parcel);
} }
#endregion #endregion
} }
} }

View File

@ -1,445 +1,445 @@
using Axiom.Math; using Axiom.Math;
using libsecondlife; using libsecondlife;
using libsecondlife.Packets; using libsecondlife.Packets;
using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Communications.Caches; using OpenSim.Framework.Communications.Caches;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Region.Physics.Manager; using OpenSim.Region.Physics.Manager;
namespace OpenSim.Region.Environment.Scenes namespace OpenSim.Region.Environment.Scenes
{ {
public partial class Scene public partial class Scene
{ {
//split these method into this partial as a lot of these (hopefully) are only temporary and won't be needed once Caps is more complete //split these method into this partial as a lot of these (hopefully) are only temporary and won't be needed once Caps is more complete
// or at least some of they can be moved somewhere else // or at least some of they can be moved somewhere else
public void AddInventoryItem(LLUUID avatarId, InventoryItemBase item) public void AddInventoryItem(LLUUID avatarId, InventoryItemBase item)
{ {
ScenePresence avatar; ScenePresence avatar;
if ( TryGetAvatar( avatarId, out avatar )) if ( TryGetAvatar( avatarId, out avatar ))
{ {
AddInventoryItem(avatar.ControllingClient, item); AddInventoryItem(avatar.ControllingClient, item);
} }
} }
public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
{ {
CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
if (userInfo != null) if (userInfo != null)
{ {
userInfo.AddItem(remoteClient.AgentId, item); userInfo.AddItem(remoteClient.AgentId, item);
remoteClient.SendInventoryItemUpdate(item); remoteClient.SendInventoryItemUpdate(item);
} }
} }
public LLUUID CapsUpdateInventoryItemAsset(LLUUID avatarId, LLUUID itemID, byte[] data) public LLUUID CapsUpdateInventoryItemAsset(LLUUID avatarId, LLUUID itemID, byte[] data)
{ {
ScenePresence avatar; ScenePresence avatar;
if (TryGetAvatar(avatarId, out avatar)) if (TryGetAvatar(avatarId, out avatar))
{ {
return CapsUpdateInventoryItemAsset(avatar.ControllingClient, itemID, data); return CapsUpdateInventoryItemAsset(avatar.ControllingClient, itemID, data);
} }
return LLUUID.Zero; return LLUUID.Zero;
} }
public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data) public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data)
{ {
CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
if (userInfo != null) if (userInfo != null)
{ {
if (userInfo.RootFolder != null) if (userInfo.RootFolder != null)
{ {
InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
if (item != null) if (item != null)
{ {
AssetBase asset; AssetBase asset;
asset = new AssetBase(); asset = new AssetBase();
asset.FullID = LLUUID.Random(); asset.FullID = LLUUID.Random();
asset.Type = (sbyte) item.assetType; asset.Type = (sbyte) item.assetType;
asset.InvType = (sbyte) item.invType; asset.InvType = (sbyte) item.invType;
asset.Name = item.inventoryName; asset.Name = item.inventoryName;
asset.Data = data; asset.Data = data;
commsManager.AssetCache.AddAsset(asset); commsManager.AssetCache.AddAsset(asset);
item.assetID = asset.FullID; item.assetID = asset.FullID;
userInfo.UpdateItem(remoteClient.AgentId, item); userInfo.UpdateItem(remoteClient.AgentId, item);
// remoteClient.SendInventoryItemUpdate(item); // remoteClient.SendInventoryItemUpdate(item);
if (item.invType == 7) if (item.invType == 7)
{ {
//do we want to know about updated note cards? //do we want to know about updated note cards?
} }
else if (item.invType == 10) else if (item.invType == 10)
{ {
// do we want to know about updated scripts // do we want to know about updated scripts
} }
return (asset.FullID); return (asset.FullID);
} }
} }
} }
return LLUUID.Zero; return LLUUID.Zero;
} }
public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID,
LLUUID itemID) LLUUID itemID)
{ {
CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
if (userInfo != null) if (userInfo != null)
{ {
if (userInfo.RootFolder != null) if (userInfo.RootFolder != null)
{ {
InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
if (item != null) if (item != null)
{ {
AgentAssetTransactions transactions = AgentAssetTransactions transactions =
commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId); commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId);
if (transactions != null) if (transactions != null)
{ {
AssetBase asset = null; AssetBase asset = null;
bool addToCache = false; bool addToCache = false;
asset = commsManager.AssetCache.GetAsset(assetID); asset = commsManager.AssetCache.GetAsset(assetID);
if (asset == null) if (asset == null)
{ {
asset = transactions.GetTransactionAsset(transactionID); asset = transactions.GetTransactionAsset(transactionID);
addToCache = true; addToCache = true;
} }
if (asset != null) if (asset != null)
{ {
if (asset.FullID == assetID) if (asset.FullID == assetID)
{ {
asset.Name = item.inventoryName; asset.Name = item.inventoryName;
asset.Description = item.inventoryDescription; asset.Description = item.inventoryDescription;
asset.InvType = (sbyte) item.invType; asset.InvType = (sbyte) item.invType;
asset.Type = (sbyte) item.assetType; asset.Type = (sbyte) item.assetType;
item.assetID = asset.FullID; item.assetID = asset.FullID;
if (addToCache) if (addToCache)
{ {
commsManager.AssetCache.AddAsset(asset); commsManager.AssetCache.AddAsset(asset);
} }
userInfo.UpdateItem(remoteClient.AgentId, item); userInfo.UpdateItem(remoteClient.AgentId, item);
} }
} }
} }
} }
} }
} }
} }
/// <summary> /// <summary>
/// temporary method to test out creating new inventory items /// temporary method to test out creating new inventory items
/// </summary> /// </summary>
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
/// <param name="transActionID"></param> /// <param name="transActionID"></param>
/// <param name="folderID"></param> /// <param name="folderID"></param>
/// <param name="callbackID"></param> /// <param name="callbackID"></param>
/// <param name="description"></param> /// <param name="description"></param>
/// <param name="name"></param> /// <param name="name"></param>
/// <param name="invType"></param> /// <param name="invType"></param>
/// <param name="type"></param> /// <param name="type"></param>
/// <param name="wearableType"></param> /// <param name="wearableType"></param>
/// <param name="nextOwnerMask"></param> /// <param name="nextOwnerMask"></param>
public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID,
uint callbackID, string description, string name, sbyte invType, sbyte type, uint callbackID, string description, string name, sbyte invType, sbyte type,
byte wearableType, uint nextOwnerMask) byte wearableType, uint nextOwnerMask)
{ {
if (transActionID == LLUUID.Zero) if (transActionID == LLUUID.Zero)
{ {
CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
if (userInfo != null) if (userInfo != null)
{ {
AssetBase asset = new AssetBase(); AssetBase asset = new AssetBase();
asset.Name = name; asset.Name = name;
asset.Description = description; asset.Description = description;
asset.InvType = invType; asset.InvType = invType;
asset.Type = type; asset.Type = type;
asset.FullID = LLUUID.Random(); asset.FullID = LLUUID.Random();
asset.Data = new byte[1]; asset.Data = new byte[1];
commsManager.AssetCache.AddAsset(asset); commsManager.AssetCache.AddAsset(asset);
InventoryItemBase item = new InventoryItemBase(); InventoryItemBase item = new InventoryItemBase();
item.avatarID = remoteClient.AgentId; item.avatarID = remoteClient.AgentId;
item.creatorsID = remoteClient.AgentId; item.creatorsID = remoteClient.AgentId;
item.inventoryID = LLUUID.Random(); item.inventoryID = LLUUID.Random();
item.assetID = asset.FullID; item.assetID = asset.FullID;
item.inventoryDescription = description; item.inventoryDescription = description;
item.inventoryName = name; item.inventoryName = name;
item.assetType = invType; item.assetType = invType;
item.invType = invType; item.invType = invType;
item.parentFolderID = folderID; item.parentFolderID = folderID;
item.inventoryCurrentPermissions = 2147483647; item.inventoryCurrentPermissions = 2147483647;
item.inventoryNextPermissions = nextOwnerMask; item.inventoryNextPermissions = nextOwnerMask;
userInfo.AddItem(remoteClient.AgentId, item); userInfo.AddItem(remoteClient.AgentId, item);
remoteClient.SendInventoryItemUpdate(item); remoteClient.SendInventoryItemUpdate(item);
} }
} }
else else
{ {
commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID, commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID,
callbackID, description, name, invType, callbackID, description, name, invType,
type, wearableType, nextOwnerMask); type, wearableType, nextOwnerMask);
//System.Console.WriteLine("request to create inventory item from transaction " + transActionID); //System.Console.WriteLine("request to create inventory item from transaction " + transActionID);
} }
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
/// <param name="primLocalID"></param> /// <param name="primLocalID"></param>
public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID)
{ {
bool hasPrim = false; bool hasPrim = false;
foreach (EntityBase ent in Entities.Values) foreach (EntityBase ent in Entities.Values)
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID); hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
if (hasPrim != false) if (hasPrim != false)
{ {
bool fileChange = ((SceneObjectGroup) ent).GetPartInventoryFileName(remoteClient, primLocalID); bool fileChange = ((SceneObjectGroup) ent).GetPartInventoryFileName(remoteClient, primLocalID);
if (fileChange) if (fileChange)
{ {
if (XferManager != null) if (XferManager != null)
{ {
((SceneObjectGroup) ent).RequestInventoryFile(primLocalID, XferManager); ((SceneObjectGroup) ent).RequestInventoryFile(primLocalID, XferManager);
} }
} }
break; break;
} }
} }
} }
} }
public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID) public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID)
{ {
bool hasPrim = false; bool hasPrim = false;
foreach (EntityBase ent in Entities.Values) foreach (EntityBase ent in Entities.Values)
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID); hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false) if (hasPrim != false)
{ {
int type = ((SceneObjectGroup) ent).RemoveInventoryItem(remoteClient, localID, itemID); int type = ((SceneObjectGroup) ent).RemoveInventoryItem(remoteClient, localID, itemID);
((SceneObjectGroup) ent).GetProperites(remoteClient); ((SceneObjectGroup) ent).GetProperites(remoteClient);
if (type == 10) if (type == 10)
{ {
EventManager.TriggerRemoveScript(localID, itemID); EventManager.TriggerRemoveScript(localID, itemID);
} }
} }
} }
} }
} }
public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID) public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID)
{ {
CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
LLUUID copyID = LLUUID.Random(); LLUUID copyID = LLUUID.Random();
if (userInfo != null) if (userInfo != null)
{ {
if (userInfo.RootFolder != null) if (userInfo.RootFolder != null)
{ {
InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
if (item != null) if (item != null)
{ {
bool isTexture = false; bool isTexture = false;
bool rezzed = false; bool rezzed = false;
if (item.invType == 0) if (item.invType == 0)
{ {
isTexture = true; isTexture = true;
} }
AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture); AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture);
if (rezAsset != null) if (rezAsset != null)
{ {
string script = Util.FieldToString(rezAsset.Data); string script = Util.FieldToString(rezAsset.Data);
//Console.WriteLine("rez script "+script); //Console.WriteLine("rez script "+script);
EventManager.TriggerRezScript(localID, copyID, script); EventManager.TriggerRezScript(localID, copyID, script);
rezzed = true; rezzed = true;
} }
else else
{ {
//lets try once more incase the asset cache is being slow getting the asset from server //lets try once more incase the asset cache is being slow getting the asset from server
rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture); rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture);
if (rezAsset != null) if (rezAsset != null)
{ {
string script = Util.FieldToString(rezAsset.Data); string script = Util.FieldToString(rezAsset.Data);
// Console.WriteLine("rez script " + script); // Console.WriteLine("rez script " + script);
EventManager.TriggerRezScript(localID, copyID, script); EventManager.TriggerRezScript(localID, copyID, script);
rezzed = true; rezzed = true;
} }
} }
if (rezzed) if (rezzed)
{ {
bool hasPrim = false; bool hasPrim = false;
foreach (EntityBase ent in Entities.Values) foreach (EntityBase ent in Entities.Values)
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID); hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false) if (hasPrim != false)
{ {
bool added = bool added =
((SceneObjectGroup) ent).AddInventoryItem(remoteClient, localID, item, ((SceneObjectGroup) ent).AddInventoryItem(remoteClient, localID, item,
copyID); copyID);
((SceneObjectGroup) ent).GetProperites(remoteClient); ((SceneObjectGroup) ent).GetProperites(remoteClient);
} }
} }
} }
} }
} }
} }
} }
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="packet"></param> /// <param name="packet"></param>
/// <param name="simClient"></param> /// <param name="simClient"></param>
public void DeRezObject(Packet packet, IClientAPI remoteClient) public void DeRezObject(Packet packet, IClientAPI remoteClient)
{ {
DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet; DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet;
if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero)
{ {
//currently following code not used (or don't know of any case of destination being zero //currently following code not used (or don't know of any case of destination being zero
} }
else else
{ {
foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData)
{ {
EntityBase selectedEnt = null; EntityBase selectedEnt = null;
//OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString());
foreach (EntityBase ent in Entities.Values) foreach (EntityBase ent in Entities.Values)
{ {
if (ent.LocalId == Data.ObjectLocalID) if (ent.LocalId == Data.ObjectLocalID)
{ {
selectedEnt = ent; selectedEnt = ent;
break; break;
} }
} }
if (selectedEnt != null) if (selectedEnt != null)
{ {
if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID)) if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID))
{ {
string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString(); string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString();
CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
if (userInfo != null) if (userInfo != null)
{ {
AssetBase asset = new AssetBase(); AssetBase asset = new AssetBase();
asset.Name = ((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId); asset.Name = ((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId);
asset.Description = asset.Description =
((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId); ((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId);
asset.InvType = 6; asset.InvType = 6;
asset.Type = 6; asset.Type = 6;
asset.FullID = LLUUID.Random(); asset.FullID = LLUUID.Random();
asset.Data = Helpers.StringToField(sceneObjectXml); asset.Data = Helpers.StringToField(sceneObjectXml);
commsManager.AssetCache.AddAsset(asset); commsManager.AssetCache.AddAsset(asset);
InventoryItemBase item = new InventoryItemBase(); InventoryItemBase item = new InventoryItemBase();
item.avatarID = remoteClient.AgentId; item.avatarID = remoteClient.AgentId;
item.creatorsID = remoteClient.AgentId; item.creatorsID = remoteClient.AgentId;
item.inventoryID = LLUUID.Random(); item.inventoryID = LLUUID.Random();
item.assetID = asset.FullID; item.assetID = asset.FullID;
item.inventoryDescription = asset.Description; item.inventoryDescription = asset.Description;
item.inventoryName = asset.Name; item.inventoryName = asset.Name;
item.assetType = asset.Type; item.assetType = asset.Type;
item.invType = asset.InvType; item.invType = asset.InvType;
item.parentFolderID = DeRezPacket.AgentBlock.DestinationID; item.parentFolderID = DeRezPacket.AgentBlock.DestinationID;
item.inventoryCurrentPermissions = 2147483647; item.inventoryCurrentPermissions = 2147483647;
item.inventoryNextPermissions = 2147483647; item.inventoryNextPermissions = 2147483647;
userInfo.AddItem(remoteClient.AgentId, item); userInfo.AddItem(remoteClient.AgentId, item);
remoteClient.SendInventoryItemUpdate(item); remoteClient.SendInventoryItemUpdate(item);
} }
SceneObjectPart rootPart = SceneObjectPart rootPart =
((SceneObjectGroup) selectedEnt).GetChildPart(((SceneObjectGroup) selectedEnt).UUID); ((SceneObjectGroup) selectedEnt).GetChildPart(((SceneObjectGroup) selectedEnt).UUID);
if (rootPart.PhysActor != null) if (rootPart.PhysActor != null)
{ {
phyScene.RemovePrim(rootPart.PhysActor); phyScene.RemovePrim(rootPart.PhysActor);
rootPart.PhysActor = null; rootPart.PhysActor = null;
} }
storageManager.DataStore.RemoveObject(((SceneObjectGroup) selectedEnt).UUID, storageManager.DataStore.RemoveObject(((SceneObjectGroup) selectedEnt).UUID,
m_regInfo.SimUUID); m_regInfo.SimUUID);
((SceneObjectGroup) selectedEnt).DeleteGroup(); ((SceneObjectGroup) selectedEnt).DeleteGroup();
lock (Entities) lock (Entities)
{ {
Entities.Remove(((SceneObjectGroup) selectedEnt).UUID); Entities.Remove(((SceneObjectGroup) selectedEnt).UUID);
} }
((SceneObjectGroup) selectedEnt).DeleteParts(); ((SceneObjectGroup) selectedEnt).DeleteParts();
} }
} }
} }
} }
} }
public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos) public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos)
{ {
CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
if (userInfo != null) if (userInfo != null)
{ {
if (userInfo.RootFolder != null) if (userInfo.RootFolder != null)
{ {
InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
if (item != null) if (item != null)
{ {
AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false);
if (rezAsset != null) if (rezAsset != null)
{ {
AddRezObject(Util.FieldToString(rezAsset.Data), pos); AddRezObject(Util.FieldToString(rezAsset.Data), pos);
userInfo.DeleteItem(remoteClient.AgentId, item); userInfo.DeleteItem(remoteClient.AgentId, item);
remoteClient.SendRemoveInventoryItem(itemID); remoteClient.SendRemoveInventoryItem(itemID);
} }
else else
{ {
//lets try once more incase the asset cache is being slow getting the asset from server //lets try once more incase the asset cache is being slow getting the asset from server
rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false);
if (rezAsset != null) if (rezAsset != null)
{ {
AddRezObject(Util.FieldToString(rezAsset.Data), pos); AddRezObject(Util.FieldToString(rezAsset.Data), pos);
userInfo.DeleteItem(remoteClient.AgentId, item); userInfo.DeleteItem(remoteClient.AgentId, item);
remoteClient.SendRemoveInventoryItem(itemID); remoteClient.SendRemoveInventoryItem(itemID);
} }
} }
} }
} }
} }
} }
private void AddRezObject(string xmlData, LLVector3 pos) private void AddRezObject(string xmlData, LLVector3 pos)
{ {
SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData);
AddEntity(group); AddEntity(group);
group.AbsolutePosition = pos; group.AbsolutePosition = pos;
SceneObjectPart rootPart = group.GetChildPart(group.UUID); SceneObjectPart rootPart = group.GetChildPart(group.UUID);
if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
{ {
PrimitiveBaseShape pbs = rootPart.Shape; PrimitiveBaseShape pbs = rootPart.Shape;
rootPart.PhysActor = phyScene.AddPrimShape( rootPart.PhysActor = phyScene.AddPrimShape(
rootPart.Name, rootPart.Name,
pbs, pbs,
new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,
rootPart.AbsolutePosition.Z), rootPart.AbsolutePosition.Z),
new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
} }
} }
} }
} }

View File

@ -1,251 +1,251 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using libsecondlife; using libsecondlife;
namespace OpenSim.Region.Environment.Scenes namespace OpenSim.Region.Environment.Scenes
{ {
public class SceneManager public class SceneManager
{ {
private readonly List<Scene> m_localScenes; private readonly List<Scene> m_localScenes;
private Scene m_currentScene = null; private Scene m_currentScene = null;
public Scene CurrentScene public Scene CurrentScene
{ {
get { return m_currentScene; } get { return m_currentScene; }
} }
public Scene CurrentOrFirstScene public Scene CurrentOrFirstScene
{ {
get get
{ {
if (m_currentScene == null) if (m_currentScene == null)
{ {
return m_localScenes[0]; return m_localScenes[0];
} }
else else
{ {
return m_currentScene; return m_currentScene;
} }
} }
} }
public SceneManager() public SceneManager()
{ {
m_localScenes = new List<Scene>(); m_localScenes = new List<Scene>();
} }
public void Close() public void Close()
{ {
for (int i = 0; i < m_localScenes.Count; i++) for (int i = 0; i < m_localScenes.Count; i++)
{ {
m_localScenes[i].Close(); m_localScenes[i].Close();
} }
} }
public void Add(Scene scene) public void Add(Scene scene)
{ {
m_localScenes.Add(scene); m_localScenes.Add(scene);
} }
public void SaveCurrentSceneToXml(string filename) public void SaveCurrentSceneToXml(string filename)
{ {
CurrentOrFirstScene.SavePrimsToXml(filename); CurrentOrFirstScene.SavePrimsToXml(filename);
} }
public void LoadCurrentSceneFromXml(string filename) public void LoadCurrentSceneFromXml(string filename)
{ {
CurrentOrFirstScene.LoadPrimsFromXml(filename); CurrentOrFirstScene.LoadPrimsFromXml(filename);
} }
public bool RunTerrainCmdOnCurrentScene(string[] cmdparams, ref string result) public bool RunTerrainCmdOnCurrentScene(string[] cmdparams, ref string result)
{ {
if (m_currentScene == null) if (m_currentScene == null)
{ {
bool success = true; bool success = true;
foreach (Scene scene in m_localScenes) foreach (Scene scene in m_localScenes)
{ {
if (!scene.Terrain.RunTerrainCmd(cmdparams, ref result, scene.RegionInfo.RegionName)) if (!scene.Terrain.RunTerrainCmd(cmdparams, ref result, scene.RegionInfo.RegionName))
{ {
success = false; success = false;
} }
} }
return success; return success;
} }
else else
{ {
return m_currentScene.Terrain.RunTerrainCmd(cmdparams, ref result, m_currentScene.RegionInfo.RegionName); return m_currentScene.Terrain.RunTerrainCmd(cmdparams, ref result, m_currentScene.RegionInfo.RegionName);
} }
} }
public void SendCommandToCurrentSceneScripts(string[] cmdparams) public void SendCommandToCurrentSceneScripts(string[] cmdparams)
{ {
ForEachCurrentScene(delegate(Scene scene) { scene.SendCommandToPlugins(cmdparams); }); ForEachCurrentScene(delegate(Scene scene) { scene.SendCommandToPlugins(cmdparams); });
} }
public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions) public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions)
{ {
ForEachCurrentScene(delegate(Scene scene) { scene.PermissionsMngr.BypassPermissions = bypassPermissions; }); ForEachCurrentScene(delegate(Scene scene) { scene.PermissionsMngr.BypassPermissions = bypassPermissions; });
} }
private void ForEachCurrentScene(Action<Scene> func) private void ForEachCurrentScene(Action<Scene> func)
{ {
if (m_currentScene == null) if (m_currentScene == null)
{ {
m_localScenes.ForEach(func); m_localScenes.ForEach(func);
} }
else else
{ {
func(m_currentScene); func(m_currentScene);
} }
} }
public void BackupCurrentScene() public void BackupCurrentScene()
{ {
ForEachCurrentScene(delegate(Scene scene) { scene.Backup(); }); ForEachCurrentScene(delegate(Scene scene) { scene.Backup(); });
} }
public void HandleAlertCommandOnCurrentScene(string[] cmdparams) public void HandleAlertCommandOnCurrentScene(string[] cmdparams)
{ {
ForEachCurrentScene(delegate(Scene scene) { scene.HandleAlertCommand(cmdparams); }); ForEachCurrentScene(delegate(Scene scene) { scene.HandleAlertCommand(cmdparams); });
} }
public bool TrySetCurrentScene(string regionName) public bool TrySetCurrentScene(string regionName)
{ {
if ((String.Compare(regionName, "root") == 0) || (String.Compare(regionName, "..") == 0)) if ((String.Compare(regionName, "root") == 0) || (String.Compare(regionName, "..") == 0))
{ {
m_currentScene = null; m_currentScene = null;
return true; return true;
} }
else else
{ {
Console.WriteLine("Searching for Region: '" + regionName + "'"); Console.WriteLine("Searching for Region: '" + regionName + "'");
foreach (Scene scene in m_localScenes) foreach (Scene scene in m_localScenes)
{ {
if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0) if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0)
{ {
m_currentScene = scene; m_currentScene = scene;
return true; return true;
} }
} }
return false; return false;
} }
} }
public void SetDebugPacketOnCurrentScene(LogBase log, int newDebug) public void SetDebugPacketOnCurrentScene(LogBase log, int newDebug)
{ {
ForEachCurrentScene(delegate(Scene scene) ForEachCurrentScene(delegate(Scene scene)
{ {
foreach (EntityBase entity in scene.Entities.Values) foreach (EntityBase entity in scene.Entities.Values)
{ {
if (entity is ScenePresence) if (entity is ScenePresence)
{ {
ScenePresence scenePrescence = entity as ScenePresence; ScenePresence scenePrescence = entity as ScenePresence;
if (!scenePrescence.IsChildAgent) if (!scenePrescence.IsChildAgent)
{ {
log.Error(String.Format("Packet debug for {0} {1} set to {2}", log.Error(String.Format("Packet debug for {0} {1} set to {2}",
scenePrescence.Firstname, scenePrescence.Lastname, scenePrescence.Firstname, scenePrescence.Lastname,
newDebug)); newDebug));
scenePrescence.ControllingClient.SetDebug(newDebug); scenePrescence.ControllingClient.SetDebug(newDebug);
} }
} }
} }
}); });
} }
public List<ScenePresence> GetCurrentSceneAvatars() public List<ScenePresence> GetCurrentSceneAvatars()
{ {
List<ScenePresence> avatars = new List<ScenePresence>(); List<ScenePresence> avatars = new List<ScenePresence>();
ForEachCurrentScene(delegate(Scene scene) ForEachCurrentScene(delegate(Scene scene)
{ {
foreach (EntityBase entity in scene.Entities.Values) foreach (EntityBase entity in scene.Entities.Values)
{ {
if (entity is ScenePresence) if (entity is ScenePresence)
{ {
ScenePresence scenePrescence = entity as ScenePresence; ScenePresence scenePrescence = entity as ScenePresence;
if (!scenePrescence.IsChildAgent) if (!scenePrescence.IsChildAgent)
{ {
avatars.Add(scenePrescence); avatars.Add(scenePrescence);
} }
} }
} }
}); });
return avatars; return avatars;
} }
public RegionInfo GetRegionInfo(ulong regionHandle) public RegionInfo GetRegionInfo(ulong regionHandle)
{ {
foreach (Scene scene in m_localScenes) foreach (Scene scene in m_localScenes)
{ {
if (scene.RegionInfo.RegionHandle == regionHandle) if (scene.RegionInfo.RegionHandle == regionHandle)
{ {
return scene.RegionInfo; return scene.RegionInfo;
} }
} }
return null; return null;
} }
public void SetCurrentSceneTimePhase(int timePhase) public void SetCurrentSceneTimePhase(int timePhase)
{ {
ForEachCurrentScene(delegate(Scene scene) ForEachCurrentScene(delegate(Scene scene)
{ {
scene.SetTimePhase( scene.SetTimePhase(
timePhase) timePhase)
; ;
}); });
} }
public void ForceCurrentSceneClientUpdate() public void ForceCurrentSceneClientUpdate()
{ {
ForEachCurrentScene(delegate(Scene scene) { scene.ForceClientUpdate(); }); ForEachCurrentScene(delegate(Scene scene) { scene.ForceClientUpdate(); });
} }
public void HandleEditCommandOnCurrentScene(string[] cmdparams) public void HandleEditCommandOnCurrentScene(string[] cmdparams)
{ {
ForEachCurrentScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); }); ForEachCurrentScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); });
} }
public bool TryGetAvatar( LLUUID avatarId, out ScenePresence avatar ) public bool TryGetAvatar( LLUUID avatarId, out ScenePresence avatar )
{ {
foreach (Scene scene in m_localScenes) foreach (Scene scene in m_localScenes)
{ {
if( scene.TryGetAvatar( avatarId, out avatar )) if( scene.TryGetAvatar( avatarId, out avatar ))
{ {
return true; return true;
} }
} }
avatar = null; avatar = null;
return false; return false;
} }
public void CloseScene(Scene scene) public void CloseScene(Scene scene)
{ {
m_localScenes.Remove(scene); m_localScenes.Remove(scene);
scene.Close(); scene.Close();
} }
public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar)
{ {
foreach (Scene scene in m_localScenes) foreach (Scene scene in m_localScenes)
{ {
if (scene.TryGetAvatarByName(avatarName, out avatar)) if (scene.TryGetAvatarByName(avatarName, out avatar))
{ {
return true; return true;
} }
} }
avatar = null; avatar = null;
return false; return false;
} }
} }
} }

View File

@ -1,6 +1,6 @@
using Axiom.Math; using Axiom.Math;
using libsecondlife; using libsecondlife;
namespace OpenSim.Region.Environment.Scenes.Scripting namespace OpenSim.Region.Environment.Scenes.Scripting
{ {
public interface IScriptHost public interface IScriptHost

View File

@ -1,13 +1,13 @@
using System; using System;
using Axiom.Math; using Axiom.Math;
using libsecondlife; using libsecondlife;
namespace OpenSim.Region.Environment.Scenes.Scripting namespace OpenSim.Region.Environment.Scenes.Scripting
{ {
public class NullScriptHost : IScriptHost public class NullScriptHost : IScriptHost
{ {
private LLVector3 m_pos = new LLVector3(128, 128, 30); private LLVector3 m_pos = new LLVector3(128, 128, 30);
public string Name public string Name
{ {
get { return "Object"; } get { return "Object"; }
@ -38,13 +38,13 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
} }
public LLUUID ObjectOwner public LLUUID ObjectOwner
{ {
get { return LLUUID.Zero; } get { return LLUUID.Zero; }
} }
public LLUUID ObjectCreator public LLUUID ObjectCreator
{ {
get { return LLUUID.Zero; } get { return LLUUID.Zero; }
} }
public LLVector3 AbsolutePosition public LLVector3 AbsolutePosition

View File

@ -1,6 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Types namespace OpenSim.Region.Environment.Types
{ {
public class BasicQuadTreeNode public class BasicQuadTreeNode
@ -64,16 +64,16 @@ namespace OpenSim.Region.Environment.Types
if (m_childNodes == null) if (m_childNodes == null)
{ {
m_childNodes = new BasicQuadTreeNode[4]; m_childNodes = new BasicQuadTreeNode[4];
m_childNodes[0] = m_childNodes[0] =
new BasicQuadTreeNode(this, m_leftX, m_leftY, (short) (m_width/2), (short) (m_height/2)); new BasicQuadTreeNode(this, m_leftX, m_leftY, (short) (m_width/2), (short) (m_height/2));
m_childNodes[1] = m_childNodes[1] =
new BasicQuadTreeNode(this, (short) (m_leftX + (m_width/2)), m_leftY, (short) (m_width/2), new BasicQuadTreeNode(this, (short) (m_leftX + (m_width/2)), m_leftY, (short) (m_width/2),
(short) (m_height/2)); (short) (m_height/2));
m_childNodes[2] = m_childNodes[2] =
new BasicQuadTreeNode(this, m_leftX, (short) (m_leftY + (m_height/2)), (short) (m_width/2), new BasicQuadTreeNode(this, m_leftX, (short) (m_leftY + (m_height/2)), (short) (m_width/2),
(short) (m_height/2)); (short) (m_height/2));
m_childNodes[3] = m_childNodes[3] =
new BasicQuadTreeNode(this, (short) (m_leftX + (m_width/2)), (short) (m_height + (m_height/2)), new BasicQuadTreeNode(this, (short) (m_leftX + (m_width/2)), (short) (m_height + (m_height/2)),
(short) (m_width/2), (short) (m_height/2)); (short) (m_width/2), (short) (m_height/2));
} }
else else
@ -132,7 +132,7 @@ namespace OpenSim.Region.Environment.Types
List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>(); List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>();
foreach (SceneObjectGroup group in m_objects) foreach (SceneObjectGroup group in m_objects)
{ {
if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) &&
((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height))))
{ {
//still in bounds //still in bounds
@ -157,7 +157,7 @@ namespace OpenSim.Region.Environment.Types
public void PassUp(SceneObjectGroup group) public void PassUp(SceneObjectGroup group)
{ {
if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) &&
((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height))))
{ {
AddObject(group); AddObject(group);

View File

@ -1,7 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife; using libsecondlife;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Types namespace OpenSim.Region.Environment.Types
{ {
public class UpdateQueue public class UpdateQueue
@ -46,6 +46,6 @@ namespace OpenSim.Region.Environment.Types
} }
return part; return part;
} }
} }
} }

View File

@ -1,148 +1,148 @@
/* /*
* 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.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System.Collections.Generic; using System.Collections.Generic;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.ExtensionsScriptModule.CSharp; using OpenSim.Region.ExtensionsScriptModule.CSharp;
using OpenSim.Region.ExtensionsScriptModule.JScript; using OpenSim.Region.ExtensionsScriptModule.JScript;
using OpenSim.Region.ExtensionsScriptModule.JVMEngine; using OpenSim.Region.ExtensionsScriptModule.JVMEngine;
namespace OpenSim.Region.ExtensionsScriptModule namespace OpenSim.Region.ExtensionsScriptModule
{ {
public class ScriptManager : IRegionModule, IExtensionScriptModule public class ScriptManager : IRegionModule, IExtensionScriptModule
{ {
readonly List<IScript> scripts = new List<IScript>(); readonly List<IScript> scripts = new List<IScript>();
Scene m_scene; Scene m_scene;
readonly Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>(); readonly Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>();
private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts) private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts)
{ {
foreach (KeyValuePair<string, IScript> script in compiledscripts) foreach (KeyValuePair<string, IScript> script in compiledscripts)
{ {
ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script.
MainLog.Instance.Verbose("Loading " + script.Key); MainLog.Instance.Verbose("Loading " + script.Key);
script.Value.Initialise(scriptInfo); script.Value.Initialise(scriptInfo);
scripts.Add(script.Value); scripts.Add(script.Value);
} }
MainLog.Instance.Verbose(string.Format("Finished loading {0} script(s)", compiledscripts.Count)); MainLog.Instance.Verbose(string.Format("Finished loading {0} script(s)", compiledscripts.Count));
} }
public ScriptManager() public ScriptManager()
{ {
// Default Engines // Default Engines
CSharpScriptEngine csharpCompiler = new CSharpScriptEngine(); CSharpScriptEngine csharpCompiler = new CSharpScriptEngine();
compilers.Add(csharpCompiler.FileExt(), csharpCompiler); compilers.Add(csharpCompiler.FileExt(), csharpCompiler);
JScriptEngine jscriptCompiler = new JScriptEngine(); JScriptEngine jscriptCompiler = new JScriptEngine();
compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler); compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler);
JavaEngine javaCompiler = new JavaEngine(); JavaEngine javaCompiler = new JavaEngine();
compilers.Add(javaCompiler.FileExt(), javaCompiler); compilers.Add(javaCompiler.FileExt(), javaCompiler);
} }
public void Initialise(Scene scene) public void Initialise(Scene scene)
{ {
System.Console.WriteLine("Initialising Extensions Scripting Module"); System.Console.WriteLine("Initialising Extensions Scripting Module");
m_scene = scene; m_scene = scene;
m_scene.RegisterModuleInterface<IExtensionScriptModule>(this); m_scene.RegisterModuleInterface<IExtensionScriptModule>(this);
} }
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()
{ {
} }
public string GetName() public string GetName()
{ {
return "ExtensionsScriptingModule"; return "ExtensionsScriptingModule";
} }
public bool IsSharedModule() public bool IsSharedModule()
{ {
return false; return false;
} }
public bool Compile(string filename) public bool Compile(string filename)
{ {
foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers) foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers)
{ {
if (filename.EndsWith(compiler.Key)) if (filename.EndsWith(compiler.Key))
{ {
LoadFromCompiler(compiler.Value.compile(filename)); LoadFromCompiler(compiler.Value.compile(filename));
break; break;
} }
} }
return true; return true;
} }
public void RunScriptCmd(string[] args) public void RunScriptCmd(string[] args)
{ {
switch (args[0]) switch (args[0])
{ {
case "load": case "load":
Compile(args[1]); Compile(args[1]);
break; break;
default: default:
MainLog.Instance.Error("Unknown script command"); MainLog.Instance.Error("Unknown script command");
break; break;
} }
} }
public bool AddPreCompiledScript(IScript script) public bool AddPreCompiledScript(IScript script)
{ {
MainLog.Instance.Verbose("Loading script " + script.Name); MainLog.Instance.Verbose("Loading script " + script.Name);
ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script.
script.Initialise(scriptInfo); script.Initialise(scriptInfo);
scripts.Add(script); scripts.Add(script);
return true; return true;
} }
} }
public interface IExtensionScriptModule public interface IExtensionScriptModule
{ {
bool Compile(string filename); bool Compile(string filename);
bool AddPreCompiledScript(IScript script); bool AddPreCompiledScript(IScript script);
} }
interface IScriptCompiler interface IScriptCompiler
{ {
Dictionary<string, IScript> compile(string filename); Dictionary<string, IScript> compile(string filename);
string FileExt(); string FileExt();
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -760,138 +760,138 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
} }
public double llGetRegionTimeDilation() { return 1.0f; } public double llGetRegionTimeDilation() { return 1.0f; }
public double llGetRegionFPS() { return 10.0f; } public double llGetRegionFPS() { return 10.0f; }
/* particle system rules should be coming into this routine as doubles, that is /* particle system rules should be coming into this routine as doubles, that is
rule[0] should be an integer from this list and rule[1] should be the arg rule[0] should be an integer from this list and rule[1] should be the arg
for the same integer. wiki.secondlife.com has most of this mapping, but some for the same integer. wiki.secondlife.com has most of this mapping, but some
came from http://www.caligari-designs.com/p4u2 came from http://www.caligari-designs.com/p4u2
We iterate through the list for 'Count' elements, incrementing by two for each We iterate through the list for 'Count' elements, incrementing by two for each
iteration and set the members of Primitive.ParticleSystem, one at a time. iteration and set the members of Primitive.ParticleSystem, one at a time.
*/ */
public enum PrimitiveRule : int public enum PrimitiveRule : int
{ {
PSYS_PART_FLAGS = 0, PSYS_PART_FLAGS = 0,
PSYS_PART_START_COLOR = 1, PSYS_PART_START_COLOR = 1,
PSYS_PART_START_ALPHA = 2, PSYS_PART_START_ALPHA = 2,
PSYS_PART_END_COLOR = 3, PSYS_PART_END_COLOR = 3,
PSYS_PART_END_ALPHA = 4, PSYS_PART_END_ALPHA = 4,
PSYS_PART_START_SCALE = 5, PSYS_PART_START_SCALE = 5,
PSYS_PART_END_SCALE = 6, PSYS_PART_END_SCALE = 6,
PSYS_PART_MAX_AGE = 7, PSYS_PART_MAX_AGE = 7,
PSYS_SRC_ACCEL = 8, PSYS_SRC_ACCEL = 8,
PSYS_SRC_PATTERN = 9, PSYS_SRC_PATTERN = 9,
PSYS_SRC_TEXTURE = 12, PSYS_SRC_TEXTURE = 12,
PSYS_SRC_BURST_RATE = 13, PSYS_SRC_BURST_RATE = 13,
PSYS_SRC_BURST_PART_COUNT = 15, PSYS_SRC_BURST_PART_COUNT = 15,
PSYS_SRC_BURST_RADIUS = 16, PSYS_SRC_BURST_RADIUS = 16,
PSYS_SRC_BURST_SPEED_MIN = 17, PSYS_SRC_BURST_SPEED_MIN = 17,
PSYS_SRC_BURST_SPEED_MAX = 18, PSYS_SRC_BURST_SPEED_MAX = 18,
PSYS_SRC_MAX_AGE = 19, PSYS_SRC_MAX_AGE = 19,
PSYS_SRC_TARGET_KEY = 20, PSYS_SRC_TARGET_KEY = 20,
PSYS_SRC_OMEGA = 21, PSYS_SRC_OMEGA = 21,
PSYS_SRC_ANGLE_BEGIN = 22, PSYS_SRC_ANGLE_BEGIN = 22,
PSYS_SRC_ANGLE_END = 23 PSYS_SRC_ANGLE_END = 23
} }
public void llParticleSystem(List<Object> rules) public void llParticleSystem(List<Object> rules)
{ {
Primitive.ParticleSystem prules = new Primitive.ParticleSystem(); Primitive.ParticleSystem prules = new Primitive.ParticleSystem();
for (int i = 0; i < rules.Count; i += 2) for (int i = 0; i < rules.Count; i += 2)
{ {
switch ((int)rules[i]) switch ((int)rules[i])
{ {
case (int)PrimitiveRule.PSYS_PART_FLAGS: case (int)PrimitiveRule.PSYS_PART_FLAGS:
prules.PartFlags = (uint)rules[i + 1]; prules.PartFlags = (uint)rules[i + 1];
break; break;
case (int)PrimitiveRule.PSYS_PART_START_COLOR: case (int)PrimitiveRule.PSYS_PART_START_COLOR:
prules.PartStartColor = (LLColor)rules[i + 1]; prules.PartStartColor = (LLColor)rules[i + 1];
break; break;
case (int)PrimitiveRule.PSYS_PART_START_ALPHA: case (int)PrimitiveRule.PSYS_PART_START_ALPHA:
//what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
break; break;
case (int)PrimitiveRule.PSYS_PART_END_COLOR: case (int)PrimitiveRule.PSYS_PART_END_COLOR:
prules.PartEndColor = (LLColor)rules[i + 1]; prules.PartEndColor = (LLColor)rules[i + 1];
break; break;
case (int)PrimitiveRule.PSYS_PART_END_ALPHA: case (int)PrimitiveRule.PSYS_PART_END_ALPHA:
//what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
break; break;
case (int)PrimitiveRule.PSYS_PART_START_SCALE: case (int)PrimitiveRule.PSYS_PART_START_SCALE:
//what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
break; break;
case (int)PrimitiveRule.PSYS_PART_END_SCALE: case (int)PrimitiveRule.PSYS_PART_END_SCALE:
//what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
break; break;
case (int)PrimitiveRule.PSYS_PART_MAX_AGE: case (int)PrimitiveRule.PSYS_PART_MAX_AGE:
prules.MaxAge = (float)rules[i + 1]; prules.MaxAge = (float)rules[i + 1];
break; break;
case (int)PrimitiveRule.PSYS_SRC_ACCEL: case (int)PrimitiveRule.PSYS_SRC_ACCEL:
//what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
break; break;
case (int)PrimitiveRule.PSYS_SRC_PATTERN: case (int)PrimitiveRule.PSYS_SRC_PATTERN:
//what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
break; break;
case (int)PrimitiveRule.PSYS_SRC_TEXTURE: case (int)PrimitiveRule.PSYS_SRC_TEXTURE:
prules.Texture = (LLUUID)rules[i + 1]; prules.Texture = (LLUUID)rules[i + 1];
break; break;
case (int)PrimitiveRule.PSYS_SRC_BURST_RATE: case (int)PrimitiveRule.PSYS_SRC_BURST_RATE:
prules.BurstRate = (float)rules[i + 1]; prules.BurstRate = (float)rules[i + 1];
break; break;
case (int)PrimitiveRule.PSYS_SRC_BURST_PART_COUNT: case (int)PrimitiveRule.PSYS_SRC_BURST_PART_COUNT:
prules.BurstPartCount = (byte)rules[i + 1]; prules.BurstPartCount = (byte)rules[i + 1];
break; break;
case (int)PrimitiveRule.PSYS_SRC_BURST_RADIUS: case (int)PrimitiveRule.PSYS_SRC_BURST_RADIUS:
prules.BurstRadius = (float)rules[i + 1]; prules.BurstRadius = (float)rules[i + 1];
break; break;
case (int)PrimitiveRule.PSYS_SRC_BURST_SPEED_MIN: case (int)PrimitiveRule.PSYS_SRC_BURST_SPEED_MIN:
prules.BurstSpeedMin = (float)rules[i + 1]; prules.BurstSpeedMin = (float)rules[i + 1];
break; break;
case (int)PrimitiveRule.PSYS_SRC_BURST_SPEED_MAX: case (int)PrimitiveRule.PSYS_SRC_BURST_SPEED_MAX:
prules.BurstSpeedMax = (float)rules[i + 1]; prules.BurstSpeedMax = (float)rules[i + 1];
break; break;
case (int)PrimitiveRule.PSYS_SRC_MAX_AGE: case (int)PrimitiveRule.PSYS_SRC_MAX_AGE:
prules.MaxAge = (float)rules[i + 1]; prules.MaxAge = (float)rules[i + 1];
break; break;
case (int)PrimitiveRule.PSYS_SRC_TARGET_KEY: case (int)PrimitiveRule.PSYS_SRC_TARGET_KEY:
prules.Target = (LLUUID)rules[i + 1]; prules.Target = (LLUUID)rules[i + 1];
break; break;
case (int)PrimitiveRule.PSYS_SRC_OMEGA: case (int)PrimitiveRule.PSYS_SRC_OMEGA:
//cast?? prules.MaxAge = (float)rules[i + 1]; //cast?? prules.MaxAge = (float)rules[i + 1];
break; break;
case (int)PrimitiveRule.PSYS_SRC_ANGLE_BEGIN: case (int)PrimitiveRule.PSYS_SRC_ANGLE_BEGIN:
prules.InnerAngle = (float)rules[i + 1]; prules.InnerAngle = (float)rules[i + 1];
break; break;
case (int)PrimitiveRule.PSYS_SRC_ANGLE_END: case (int)PrimitiveRule.PSYS_SRC_ANGLE_END:
prules.OuterAngle = (float)rules[i + 1]; prules.OuterAngle = (float)rules[i + 1];
break; break;
} }
} }
m_host.AddNewParticleSystem(prules); m_host.AddNewParticleSystem(prules);
} }
public void llGroundRepel(double height, int water, double tau) { NotImplemented("llGroundRepel"); } public void llGroundRepel(double height, int water, double tau) { NotImplemented("llGroundRepel"); }
public void llGiveInventoryList() { NotImplemented("llGiveInventoryList"); } public void llGiveInventoryList() { NotImplemented("llGiveInventoryList"); }
public void llSetVehicleType(int type) { NotImplemented("llSetVehicleType"); } public void llSetVehicleType(int type) { NotImplemented("llSetVehicleType"); }

View File

@ -285,7 +285,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
before = GC.GetTotalMemory(true); before = GC.GetTotalMemory(true);
#endif #endif
LSL_BaseClass CompiledScript; LSL_BaseClass CompiledScript;
CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource); CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource);
#if DEBUG #if DEBUG