changes to pass nini config object to the modules that get
loaded so that they may read out any bits they are interested inafrisby
parent
aaaa3c6835
commit
139994757c
|
@ -1,132 +1,133 @@
|
||||||
/*
|
/*
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/* Original code: Tedd Hansen */
|
/* Original code: Tedd Hansen */
|
||||||
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;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using OpenSim.Region.Environment.Scenes.Scripting;
|
using OpenSim.Region.Environment.Scenes.Scripting;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
using Nini.Config;
|
||||||
namespace OpenSim.Grid.ScriptEngine.DotNetEngine
|
|
||||||
{
|
namespace OpenSim.Grid.ScriptEngine.DotNetEngine
|
||||||
/// <summary>
|
{
|
||||||
/// This is the root object for ScriptEngine
|
/// <summary>
|
||||||
/// </summary>
|
/// This is the root object for ScriptEngine
|
||||||
[Serializable]
|
/// </summary>
|
||||||
public class ScriptEngine :IRegionModule
|
[Serializable]
|
||||||
{
|
public class ScriptEngine :IRegionModule
|
||||||
|
{
|
||||||
internal OpenSim.Region.Environment.Scenes.Scene World;
|
|
||||||
internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim
|
internal OpenSim.Region.Environment.Scenes.Scene World;
|
||||||
internal EventQueueManager m_EventQueueManager; // Executes events
|
internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim
|
||||||
internal ScriptManager m_ScriptManager; // Load, unload and execute scripts
|
internal EventQueueManager m_EventQueueManager; // Executes events
|
||||||
internal AppDomainManager m_AppDomainManager;
|
internal ScriptManager m_ScriptManager; // Load, unload and execute scripts
|
||||||
internal LSLLongCmdHandler m_LSLLongCmdHandler;
|
internal AppDomainManager m_AppDomainManager;
|
||||||
|
internal LSLLongCmdHandler m_LSLLongCmdHandler;
|
||||||
private OpenSim.Framework.Console.LogBase m_log;
|
|
||||||
|
private OpenSim.Framework.Console.LogBase m_log;
|
||||||
public ScriptEngine()
|
|
||||||
{
|
public ScriptEngine()
|
||||||
//Common.SendToDebug("ScriptEngine Object Initialized");
|
{
|
||||||
Common.mySE = this;
|
//Common.SendToDebug("ScriptEngine Object Initialized");
|
||||||
}
|
Common.mySE = this;
|
||||||
|
}
|
||||||
public LogBase Log
|
|
||||||
{
|
public LogBase Log
|
||||||
get { return m_log; }
|
{
|
||||||
}
|
get { return m_log; }
|
||||||
|
}
|
||||||
public void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger)
|
|
||||||
{
|
public void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger)
|
||||||
|
{
|
||||||
World = Sceneworld;
|
|
||||||
m_log = logger;
|
World = Sceneworld;
|
||||||
|
m_log = logger;
|
||||||
Log.Verbose("ScriptEngine", "DotNet & LSL ScriptEngine initializing");
|
|
||||||
|
Log.Verbose("ScriptEngine", "DotNet & LSL ScriptEngine initializing");
|
||||||
//m_logger.Status("ScriptEngine", "InitializeEngine");
|
|
||||||
|
//m_logger.Status("ScriptEngine", "InitializeEngine");
|
||||||
// Create all objects we'll be using
|
|
||||||
m_EventQueueManager = new EventQueueManager(this);
|
// Create all objects we'll be using
|
||||||
m_EventManager = new EventManager(this);
|
m_EventQueueManager = new EventQueueManager(this);
|
||||||
m_ScriptManager = new ScriptManager(this);
|
m_EventManager = new EventManager(this);
|
||||||
m_AppDomainManager = new AppDomainManager();
|
m_ScriptManager = new ScriptManager(this);
|
||||||
m_LSLLongCmdHandler = new LSLLongCmdHandler(this);
|
m_AppDomainManager = new AppDomainManager();
|
||||||
|
m_LSLLongCmdHandler = new LSLLongCmdHandler(this);
|
||||||
// Should we iterate the region for scripts that needs starting?
|
|
||||||
// Or can we assume we are loaded before anything else so we can use proper events?
|
// Should we iterate the region for scripts that needs starting?
|
||||||
|
// Or can we assume we are loaded before anything else so we can use proper events?
|
||||||
|
|
||||||
}
|
|
||||||
|
}
|
||||||
public void Shutdown()
|
|
||||||
{
|
public void Shutdown()
|
||||||
// We are shutting down
|
{
|
||||||
}
|
// We are shutting down
|
||||||
|
}
|
||||||
//// !!!FOR DEBUGGING ONLY!!! (for executing script directly from test app)
|
|
||||||
//[Obsolete("!!!FOR DEBUGGING ONLY!!!")]
|
//// !!!FOR DEBUGGING ONLY!!! (for executing script directly from test app)
|
||||||
//public void StartScript(string ScriptID, IScriptHost ObjectID)
|
//[Obsolete("!!!FOR DEBUGGING ONLY!!!")]
|
||||||
//{
|
//public void StartScript(string ScriptID, IScriptHost ObjectID)
|
||||||
// this.myEventManager.TEMP_OBJECT_ID = ObjectID;
|
//{
|
||||||
// Log.Status("ScriptEngine", "DEBUG FUNCTION: StartScript: " + ScriptID);
|
// this.myEventManager.TEMP_OBJECT_ID = ObjectID;
|
||||||
// myScriptManager.StartScript(ScriptID, ObjectID);
|
// Log.Status("ScriptEngine", "DEBUG FUNCTION: StartScript: " + ScriptID);
|
||||||
//}
|
// myScriptManager.StartScript(ScriptID, ObjectID);
|
||||||
|
//}
|
||||||
#region IRegionModule
|
|
||||||
|
#region IRegionModule
|
||||||
public void Initialise(Scene scene)
|
|
||||||
{
|
public void Initialise(Scene scene, IConfigSource config)
|
||||||
this.InitializeEngine(scene, MainLog.Instance);
|
{
|
||||||
}
|
this.InitializeEngine(scene, MainLog.Instance);
|
||||||
|
}
|
||||||
public void PostInitialise()
|
|
||||||
{
|
public void PostInitialise()
|
||||||
|
{
|
||||||
}
|
|
||||||
|
}
|
||||||
public void Close()
|
|
||||||
{
|
public void Close()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
public string Name
|
|
||||||
{
|
public string Name
|
||||||
get { return "LSLScriptingModule"; }
|
{
|
||||||
}
|
get { return "LSLScriptingModule"; }
|
||||||
|
}
|
||||||
public bool IsSharedModule
|
|
||||||
{
|
public bool IsSharedModule
|
||||||
get { return false; }
|
{
|
||||||
}
|
get { return false; }
|
||||||
|
}
|
||||||
#endregion
|
|
||||||
}
|
#endregion
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -63,6 +63,7 @@ namespace OpenSim
|
||||||
|
|
||||||
protected ModuleLoader m_moduleLoader;
|
protected ModuleLoader m_moduleLoader;
|
||||||
protected LocalLoginService m_loginService;
|
protected LocalLoginService m_loginService;
|
||||||
|
private IConfigSource m_config;
|
||||||
|
|
||||||
protected string m_storageDLL = "OpenSim.DataStore.NullStorage.dll";
|
protected string m_storageDLL = "OpenSim.DataStore.NullStorage.dll";
|
||||||
|
|
||||||
|
@ -89,9 +90,8 @@ namespace OpenSim
|
||||||
public OpenSimMain(IConfigSource configSource)
|
public OpenSimMain(IConfigSource configSource)
|
||||||
: base()
|
: base()
|
||||||
{
|
{
|
||||||
IConfigSource startupSource = configSource;
|
string iniFile = configSource.Configs["Startup"].GetString("inifile", "OpenSim.ini");
|
||||||
string iniFile = startupSource.Configs["Startup"].GetString("inifile", "OpenSim.ini");
|
string useExecutePathString = configSource.Configs["Startup"].GetString("useexecutepath", "false").ToLower();
|
||||||
string useExecutePathString = startupSource.Configs["Startup"].GetString("useexecutepath", "false").ToLower();
|
|
||||||
bool useExecutePath = false;
|
bool useExecutePath = false;
|
||||||
if (useExecutePathString == "true" || useExecutePathString == "" || useExecutePathString == "1" || useExecutePathString == "yes")
|
if (useExecutePathString == "true" || useExecutePathString == "" || useExecutePathString == "1" || useExecutePathString == "yes")
|
||||||
{
|
{
|
||||||
|
@ -104,46 +104,46 @@ namespace OpenSim
|
||||||
string iniFilePath = Path.Combine(Util.configDir(), iniFile);
|
string iniFilePath = Path.Combine(Util.configDir(), iniFile);
|
||||||
if (File.Exists(iniFilePath))
|
if (File.Exists(iniFilePath))
|
||||||
{
|
{
|
||||||
startupSource = new IniConfigSource(iniFilePath);
|
m_config = new IniConfigSource(iniFilePath);
|
||||||
|
|
||||||
//enable following line, if we want the original config source(normally commandline args) merged with ini file settings.
|
//enable following line, if we want the original config source(normally commandline args) merged with ini file settings.
|
||||||
//in this case we have it so that if both sources have the same named setting, the command line value will overwrite the ini file value.
|
//in this case we have it so that if both sources have the same named setting, the command line value will overwrite the ini file value.
|
||||||
//(as if someone has bothered to enter a command line arg, we should take notice of it)
|
//(as if someone has bothered to enter a command line arg, we should take notice of it)
|
||||||
startupSource.Merge(configSource);
|
m_config.Merge(configSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReadConfigSettings(startupSource);
|
ReadConfigSettings();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void ReadConfigSettings(IConfigSource configSource)
|
protected void ReadConfigSettings()
|
||||||
{
|
{
|
||||||
m_networkServersInfo = new NetworkServersInfo();
|
m_networkServersInfo = new NetworkServersInfo();
|
||||||
m_sandbox = !configSource.Configs["Startup"].GetBoolean("gridmode", false);
|
m_sandbox = !m_config.Configs["Startup"].GetBoolean("gridmode", false);
|
||||||
m_physicsEngine = configSource.Configs["Startup"].GetString("physics", "basicphysics");
|
m_physicsEngine = m_config.Configs["Startup"].GetString("physics", "basicphysics");
|
||||||
m_silent = configSource.Configs["Startup"].GetBoolean("noverbose", false);
|
m_silent = m_config.Configs["Startup"].GetBoolean("noverbose", false);
|
||||||
m_permissions = configSource.Configs["Startup"].GetBoolean("serverside_object_permissions", false);
|
m_permissions = m_config.Configs["Startup"].GetBoolean("serverside_object_permissions", false);
|
||||||
|
|
||||||
m_storageDLL = configSource.Configs["Startup"].GetString("storage_plugin", "OpenSim.DataStore.NullStorage.dll");
|
m_storageDLL = m_config.Configs["Startup"].GetString("storage_plugin", "OpenSim.DataStore.NullStorage.dll");
|
||||||
|
|
||||||
m_startupCommandsFile = configSource.Configs["Startup"].GetString("startup_console_commands_file", "");
|
m_startupCommandsFile = m_config.Configs["Startup"].GetString("startup_console_commands_file", "");
|
||||||
m_shutdownCommandsFile = configSource.Configs["Startup"].GetString("shutdown_console_commands_file", "");
|
m_shutdownCommandsFile = m_config.Configs["Startup"].GetString("shutdown_console_commands_file", "");
|
||||||
|
|
||||||
m_scriptEngine = configSource.Configs["Startup"].GetString("script_engine", "DotNetEngine");
|
m_scriptEngine = m_config.Configs["Startup"].GetString("script_engine", "DotNetEngine");
|
||||||
|
|
||||||
m_assetStorage = configSource.Configs["Startup"].GetString("asset_database", "db4o");
|
m_assetStorage = m_config.Configs["Startup"].GetString("asset_database", "db4o");
|
||||||
|
|
||||||
configSource.Configs["Startup"].GetBoolean("default_modules", true);
|
m_config.Configs["Startup"].GetBoolean("default_modules", true);
|
||||||
configSource.Configs["Startup"].GetBoolean("default_shared_modules", true);
|
m_config.Configs["Startup"].GetBoolean("default_shared_modules", true);
|
||||||
configSource.Configs["Startup"].GetString("except_modules", "");
|
m_config.Configs["Startup"].GetString("except_modules", "");
|
||||||
configSource.Configs["Startup"].GetString("except_shared_modules", "");
|
m_config.Configs["Startup"].GetString("except_shared_modules", "");
|
||||||
|
|
||||||
standaloneAuthenticate = configSource.Configs["StandAlone"].GetBoolean("accounts_authenticate", false);
|
standaloneAuthenticate = m_config.Configs["StandAlone"].GetBoolean("accounts_authenticate", false);
|
||||||
standaloneWelcomeMessage = configSource.Configs["StandAlone"].GetString("welcome_message", "Welcome to OpenSim");
|
standaloneWelcomeMessage = m_config.Configs["StandAlone"].GetString("welcome_message", "Welcome to OpenSim");
|
||||||
standaloneInventoryPlugin = configSource.Configs["StandAlone"].GetString("inventory_plugin", "OpenSim.Framework.Data.SQLite.dll");
|
standaloneInventoryPlugin = m_config.Configs["StandAlone"].GetString("inventory_plugin", "OpenSim.Framework.Data.SQLite.dll");
|
||||||
standaloneUserPlugin = configSource.Configs["StandAlone"].GetString("userDatabase_plugin", "OpenSim.Framework.Data.DB4o.dll");
|
standaloneUserPlugin = m_config.Configs["StandAlone"].GetString("userDatabase_plugin", "OpenSim.Framework.Data.DB4o.dll");
|
||||||
standaloneAssetPlugin = configSource.Configs["StandAlone"].GetString("asset_plugin", "OpenSim.Framework.Data.SQLite.dll");
|
standaloneAssetPlugin = m_config.Configs["StandAlone"].GetString("asset_plugin", "OpenSim.Framework.Data.SQLite.dll");
|
||||||
m_networkServersInfo.loadFromConfiguration(configSource);
|
m_networkServersInfo.loadFromConfiguration(m_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ namespace OpenSim
|
||||||
configFiles = Directory.GetFiles(regionConfigPath, "*.xml");
|
configFiles = Directory.GetFiles(regionConfigPath, "*.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_moduleLoader = new ModuleLoader( m_log );
|
m_moduleLoader = new ModuleLoader( m_log, m_config );
|
||||||
MainLog.Instance.Verbose("Loading Shared Modules");
|
MainLog.Instance.Verbose("Loading Shared Modules");
|
||||||
m_moduleLoader.LoadDefaultSharedModules();
|
m_moduleLoader.LoadDefaultSharedModules();
|
||||||
|
|
||||||
|
|
|
@ -27,12 +27,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
|
using Nini.Config;
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Interfaces
|
namespace OpenSim.Region.Environment.Interfaces
|
||||||
{
|
{
|
||||||
public interface IRegionModule
|
public interface IRegionModule
|
||||||
{
|
{
|
||||||
void Initialise(Scene scene);
|
void Initialise(Scene scene, IConfigSource source);
|
||||||
void PostInitialise();
|
void PostInitialise();
|
||||||
void Close();
|
void Close();
|
||||||
string Name { get; }
|
string Name { get; }
|
||||||
|
|
|
@ -1,202 +1,205 @@
|
||||||
/*
|
/*
|
||||||
* 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;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
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;
|
||||||
|
using Nini.Config;
|
||||||
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 Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>();
|
public List<IRegionModule> LoadedModules = new List<IRegionModule>();
|
||||||
private readonly LogBase m_log;
|
public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>();
|
||||||
|
private readonly LogBase m_log;
|
||||||
public ModuleLoader(LogBase log)
|
private IConfigSource m_config;
|
||||||
{
|
|
||||||
m_log = log;
|
public ModuleLoader(LogBase log, IConfigSource config)
|
||||||
}
|
{
|
||||||
|
m_log = log;
|
||||||
public void PickupModules(Scene scene, string moduleDir)
|
m_config = config;
|
||||||
{
|
}
|
||||||
DirectoryInfo dir = new DirectoryInfo(moduleDir);
|
|
||||||
|
public void PickupModules(Scene scene, string moduleDir)
|
||||||
foreach (FileInfo fileInfo in dir.GetFiles("*.dll"))
|
{
|
||||||
{
|
DirectoryInfo dir = new DirectoryInfo(moduleDir);
|
||||||
LoadRegionModules(fileInfo.FullName, scene);
|
|
||||||
}
|
foreach (FileInfo fileInfo in dir.GetFiles("*.dll"))
|
||||||
}
|
{
|
||||||
|
LoadRegionModules(fileInfo.FullName, scene);
|
||||||
public void LoadDefaultSharedModules()
|
}
|
||||||
{
|
}
|
||||||
DynamicTextureModule dynamicModule = new DynamicTextureModule();
|
|
||||||
LoadedSharedModules.Add(dynamicModule.Name, dynamicModule);
|
public void LoadDefaultSharedModules()
|
||||||
}
|
{
|
||||||
|
DynamicTextureModule dynamicModule = new DynamicTextureModule();
|
||||||
public void InitialiseSharedModules(Scene scene)
|
LoadedSharedModules.Add(dynamicModule.Name, dynamicModule);
|
||||||
{
|
}
|
||||||
foreach (IRegionModule module in LoadedSharedModules.Values)
|
|
||||||
{
|
public void InitialiseSharedModules(Scene scene)
|
||||||
module.Initialise(scene);
|
{
|
||||||
scene.AddModule(module.Name, module); //should be doing this?
|
foreach (IRegionModule module in LoadedSharedModules.Values)
|
||||||
}
|
{
|
||||||
}
|
module.Initialise(scene, m_config);
|
||||||
|
scene.AddModule(module.Name, module); //should be doing this?
|
||||||
public void InitializeModule(IRegionModule module, Scene scene)
|
}
|
||||||
{
|
}
|
||||||
module.Initialise(scene);
|
|
||||||
scene.AddModule(module.Name, module);
|
public void InitializeModule(IRegionModule module, Scene scene)
|
||||||
LoadedModules.Add(module);
|
{
|
||||||
}
|
module.Initialise(scene, m_config);
|
||||||
|
scene.AddModule(module.Name, module);
|
||||||
/// <summary>
|
LoadedModules.Add(module);
|
||||||
/// Loads/initialises a Module instance that can be used by mutliple Regions
|
}
|
||||||
/// </summary>
|
|
||||||
/// <param name="dllName"></param>
|
/// <summary>
|
||||||
/// <param name="moduleName"></param>
|
/// Loads/initialises a Module instance that can be used by mutliple Regions
|
||||||
/// <param name="scene"></param>
|
/// </summary>
|
||||||
public void LoadSharedModule(string dllName, string moduleName)
|
/// <param name="dllName"></param>
|
||||||
{
|
/// <param name="moduleName"></param>
|
||||||
IRegionModule module = LoadModule(dllName, moduleName);
|
/// <param name="scene"></param>
|
||||||
if (module != null)
|
public void LoadSharedModule(string dllName, string moduleName)
|
||||||
{
|
{
|
||||||
LoadedSharedModules.Add(module.Name, module);
|
IRegionModule module = LoadModule(dllName, moduleName);
|
||||||
}
|
if (module != null)
|
||||||
}
|
{
|
||||||
|
LoadedSharedModules.Add(module.Name, module);
|
||||||
public void LoadRegionModules(string dllName, Scene scene)
|
}
|
||||||
{
|
}
|
||||||
IRegionModule[] modules = LoadModules(dllName);
|
|
||||||
|
public void LoadRegionModules(string dllName, Scene scene)
|
||||||
if (modules.Length > 0)
|
{
|
||||||
{
|
IRegionModule[] modules = LoadModules(dllName);
|
||||||
m_log.Verbose("MODULES", "Found Module Library [{0}]", dllName );
|
|
||||||
foreach (IRegionModule module in modules)
|
if (modules.Length > 0)
|
||||||
{
|
{
|
||||||
m_log.Verbose("MODULES", " [{0}]: Initializing.", module.Name);
|
m_log.Verbose("MODULES", "Found Module Library [{0}]", dllName );
|
||||||
InitializeModule(module, scene);
|
foreach (IRegionModule module in modules)
|
||||||
}
|
{
|
||||||
}
|
m_log.Verbose("MODULES", " [{0}]: Initializing.", module.Name);
|
||||||
}
|
InitializeModule(module, scene);
|
||||||
|
}
|
||||||
public void LoadRegionModule(string dllName, string moduleName, Scene scene)
|
}
|
||||||
{
|
}
|
||||||
IRegionModule module = LoadModule(dllName, moduleName);
|
|
||||||
if (module != null)
|
public void LoadRegionModule(string dllName, string moduleName, Scene scene)
|
||||||
{
|
{
|
||||||
InitializeModule(module, scene);
|
IRegionModule module = LoadModule(dllName, moduleName);
|
||||||
}
|
if (module != null)
|
||||||
}
|
{
|
||||||
|
InitializeModule(module, scene);
|
||||||
/// <summary>
|
}
|
||||||
/// Loads a external Module (if not already loaded) and creates a new instance of it.
|
}
|
||||||
/// </summary>
|
|
||||||
/// <param name="dllName"></param>
|
/// <summary>
|
||||||
/// <param name="moduleName"></param>
|
/// Loads a external Module (if not already loaded) and creates a new instance of it.
|
||||||
/// <param name="scene"></param>
|
/// </summary>
|
||||||
public IRegionModule LoadModule(string dllName, string moduleName)
|
/// <param name="dllName"></param>
|
||||||
{
|
/// <param name="moduleName"></param>
|
||||||
IRegionModule[] modules = LoadModules(dllName);
|
/// <param name="scene"></param>
|
||||||
|
public IRegionModule LoadModule(string dllName, string moduleName)
|
||||||
foreach (IRegionModule module in modules)
|
{
|
||||||
{
|
IRegionModule[] modules = LoadModules(dllName);
|
||||||
if ((module != null) && (module.Name == moduleName))
|
|
||||||
{
|
foreach (IRegionModule module in modules)
|
||||||
return module;
|
{
|
||||||
}
|
if ((module != null) && (module.Name == moduleName))
|
||||||
}
|
{
|
||||||
|
return module;
|
||||||
return null;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IRegionModule[] LoadModules(string dllName)
|
return null;
|
||||||
{
|
}
|
||||||
List<IRegionModule> modules = new List<IRegionModule>();
|
|
||||||
|
public IRegionModule[] LoadModules(string dllName)
|
||||||
Assembly pluginAssembly;
|
{
|
||||||
if (!LoadedAssemblys.TryGetValue(dllName, out pluginAssembly ))
|
List<IRegionModule> modules = new List<IRegionModule>();
|
||||||
{
|
|
||||||
try
|
Assembly pluginAssembly;
|
||||||
{
|
if (!LoadedAssemblys.TryGetValue(dllName, out pluginAssembly ))
|
||||||
pluginAssembly = Assembly.LoadFrom(dllName);
|
{
|
||||||
LoadedAssemblys.Add(dllName, pluginAssembly);
|
try
|
||||||
}
|
{
|
||||||
catch( BadImageFormatException e )
|
pluginAssembly = Assembly.LoadFrom(dllName);
|
||||||
{
|
LoadedAssemblys.Add(dllName, pluginAssembly);
|
||||||
m_log.Warn( "MODULES", "The file [{0}] is not a module assembly.", e.FileName );
|
}
|
||||||
}
|
catch( BadImageFormatException e )
|
||||||
}
|
{
|
||||||
|
m_log.Warn( "MODULES", "The file [{0}] is not a module assembly.", e.FileName );
|
||||||
|
}
|
||||||
if (pluginAssembly != null)
|
}
|
||||||
{
|
|
||||||
foreach (Type pluginType in pluginAssembly.GetTypes())
|
|
||||||
{
|
if (pluginAssembly != null)
|
||||||
if (pluginType.IsPublic)
|
{
|
||||||
{
|
foreach (Type pluginType in pluginAssembly.GetTypes())
|
||||||
if (!pluginType.IsAbstract)
|
{
|
||||||
{
|
if (pluginType.IsPublic)
|
||||||
if( pluginType.GetInterface("IRegionModule") != null )
|
{
|
||||||
{
|
if (!pluginType.IsAbstract)
|
||||||
modules.Add((IRegionModule) Activator.CreateInstance(pluginType));
|
{
|
||||||
}
|
if( pluginType.GetInterface("IRegionModule") != null )
|
||||||
}
|
{
|
||||||
}
|
modules.Add((IRegionModule) Activator.CreateInstance(pluginType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return modules.ToArray();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
return modules.ToArray();
|
||||||
{
|
}
|
||||||
foreach (IRegionModule module in LoadedSharedModules.Values)
|
|
||||||
{
|
public void PostInitialise()
|
||||||
module.PostInitialise();
|
{
|
||||||
}
|
foreach (IRegionModule module in LoadedSharedModules.Values)
|
||||||
|
{
|
||||||
foreach (IRegionModule module in LoadedModules)
|
module.PostInitialise();
|
||||||
{
|
}
|
||||||
module.PostInitialise();
|
|
||||||
}
|
foreach (IRegionModule module in LoadedModules)
|
||||||
}
|
{
|
||||||
|
module.PostInitialise();
|
||||||
public void ClearCache()
|
}
|
||||||
{
|
}
|
||||||
LoadedAssemblys.Clear();
|
|
||||||
}
|
public void ClearCache()
|
||||||
}
|
{
|
||||||
}
|
LoadedAssemblys.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -29,6 +29,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;
|
||||||
|
using Nini.Config;
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Modules
|
namespace OpenSim.Region.Environment.Modules
|
||||||
{
|
{
|
||||||
|
@ -40,7 +41,7 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialise(Scene scene)
|
public void Initialise(Scene scene, IConfigSource config)
|
||||||
{
|
{
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
m_scene.EventManager.OnNewClient += NewClient;
|
m_scene.EventManager.OnNewClient += NewClient;
|
||||||
|
|
|
@ -1,93 +1,94 @@
|
||||||
/*
|
/*
|
||||||
* 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 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;
|
||||||
|
using Nini.Config;
|
||||||
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, IConfigSource config)
|
||||||
m_scene = scene;
|
{
|
||||||
m_scene.EventManager.OnNewClient += NewClient;
|
m_scene = scene;
|
||||||
}
|
m_scene.EventManager.OnNewClient += NewClient;
|
||||||
|
}
|
||||||
public void PostInitialise()
|
|
||||||
{
|
public void PostInitialise()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
public void Close()
|
|
||||||
{
|
public void Close()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
public string Name
|
|
||||||
{
|
public string Name
|
||||||
get { return "AvatarProfilesModule"; }
|
{
|
||||||
}
|
get { return "AvatarProfilesModule"; }
|
||||||
|
}
|
||||||
public bool IsSharedModule
|
|
||||||
{
|
public bool IsSharedModule
|
||||||
get { return false; }
|
{
|
||||||
}
|
get { return false; }
|
||||||
|
}
|
||||||
public void NewClient(IClientAPI client)
|
|
||||||
{
|
public void NewClient(IClientAPI client)
|
||||||
client.OnRequestAvatarProperties += RequestAvatarProperty;
|
{
|
||||||
}
|
client.OnRequestAvatarProperties += RequestAvatarProperty;
|
||||||
|
}
|
||||||
public void RemoveClient(IClientAPI client)
|
|
||||||
{
|
public void RemoveClient(IClientAPI client)
|
||||||
client.OnRequestAvatarProperties -= RequestAvatarProperty;
|
{
|
||||||
}
|
client.OnRequestAvatarProperties -= RequestAvatarProperty;
|
||||||
|
}
|
||||||
/// <summary>
|
|
||||||
///
|
/// <summary>
|
||||||
/// </summary>
|
///
|
||||||
/// <param name="remoteClient"></param>
|
/// </summary>
|
||||||
/// <param name="avatarID"></param>
|
/// <param name="remoteClient"></param>
|
||||||
public void RequestAvatarProperty(IClientAPI remoteClient, LLUUID avatarID)
|
/// <param name="avatarID"></param>
|
||||||
{
|
public void RequestAvatarProperty(IClientAPI remoteClient, LLUUID avatarID)
|
||||||
string about = "OpenSim crash test dummy";
|
{
|
||||||
string bornOn = "Before now";
|
string about = "OpenSim crash test dummy";
|
||||||
string flAbout = "First life? What is one of those? OpenSim is my life!";
|
string bornOn = "Before now";
|
||||||
LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000");
|
string flAbout = "First life? What is one of those? OpenSim is my life!";
|
||||||
remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "",
|
LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000");
|
||||||
partner);
|
remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "",
|
||||||
}
|
partner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,242 +1,243 @@
|
||||||
/*
|
/*
|
||||||
* 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;
|
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;
|
||||||
|
using Nini.Config;
|
||||||
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 string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot";
|
// private int m_port = 6668;
|
||||||
private string m_nick = "OSimBot";
|
//private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot";
|
||||||
private string m_channel = "#opensim";
|
private string m_nick = "OSimBot";
|
||||||
|
private string m_channel = "#opensim";
|
||||||
// private NetworkStream m_stream;
|
|
||||||
private TcpClient m_irc;
|
// private NetworkStream m_stream;
|
||||||
private StreamWriter m_ircWriter;
|
private TcpClient m_irc;
|
||||||
private StreamReader m_ircReader;
|
private StreamWriter m_ircWriter;
|
||||||
|
private StreamReader m_ircReader;
|
||||||
// private Thread pingSender;
|
|
||||||
// private Thread listener;
|
// private Thread pingSender;
|
||||||
|
// private Thread listener;
|
||||||
private bool connected = false;
|
|
||||||
|
private bool connected = false;
|
||||||
public ChatModule()
|
|
||||||
{
|
public ChatModule()
|
||||||
m_nick = "OSimBot" + Util.RandomClass.Next(1, 99);
|
{
|
||||||
m_irc = null;
|
m_nick = "OSimBot" + Util.RandomClass.Next(1, 99);
|
||||||
m_ircWriter = null;
|
m_irc = null;
|
||||||
m_ircReader = null;
|
m_ircWriter = null;
|
||||||
}
|
m_ircReader = null;
|
||||||
|
}
|
||||||
public void Initialise(Scene scene)
|
|
||||||
{
|
public void Initialise(Scene scene, IConfigSource config)
|
||||||
m_scene = scene;
|
{
|
||||||
m_scene.EventManager.OnNewClient += NewClient;
|
m_scene = scene;
|
||||||
|
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_stream = m_irc.GetStream();
|
m_irc = new TcpClient(m_server, m_port);
|
||||||
m_ircReader = new StreamReader(m_stream);
|
m_stream = m_irc.GetStream();
|
||||||
m_ircWriter = new StreamWriter(m_stream);
|
m_ircReader = new StreamReader(m_stream);
|
||||||
|
m_ircWriter = new StreamWriter(m_stream);
|
||||||
pingSender = new Thread(new ThreadStart(this.PingRun));
|
|
||||||
pingSender.Start();
|
pingSender = new Thread(new ThreadStart(this.PingRun));
|
||||||
|
pingSender.Start();
|
||||||
listener = new Thread(new ThreadStart(this.ListenerRun));
|
|
||||||
listener.Start();
|
listener = new Thread(new ThreadStart(this.ListenerRun));
|
||||||
|
listener.Start();
|
||||||
m_ircWriter.WriteLine(m_user);
|
|
||||||
m_ircWriter.Flush();
|
m_ircWriter.WriteLine(m_user);
|
||||||
m_ircWriter.WriteLine("NICK " + m_nick);
|
m_ircWriter.Flush();
|
||||||
m_ircWriter.Flush();
|
m_ircWriter.WriteLine("NICK " + m_nick);
|
||||||
m_ircWriter.WriteLine("JOIN " + m_channel);
|
m_ircWriter.Flush();
|
||||||
m_ircWriter.Flush();
|
m_ircWriter.WriteLine("JOIN " + m_channel);
|
||||||
connected = true;
|
m_ircWriter.Flush();
|
||||||
}
|
connected = true;
|
||||||
catch (Exception e)
|
}
|
||||||
{
|
catch (Exception e)
|
||||||
Console.WriteLine(e.ToString());
|
{
|
||||||
}
|
Console.WriteLine(e.ToString());
|
||||||
*/
|
}
|
||||||
}
|
*/
|
||||||
|
}
|
||||||
public void Close()
|
|
||||||
{
|
public void Close()
|
||||||
m_ircWriter.Close();
|
{
|
||||||
m_ircReader.Close();
|
m_ircWriter.Close();
|
||||||
m_irc.Close();
|
m_ircReader.Close();
|
||||||
}
|
m_irc.Close();
|
||||||
|
}
|
||||||
public string Name
|
|
||||||
{
|
public string Name
|
||||||
get { return "ChatModule"; }
|
{
|
||||||
}
|
get { return "ChatModule"; }
|
||||||
|
}
|
||||||
public bool IsSharedModule
|
|
||||||
{
|
public bool IsSharedModule
|
||||||
get { return false; }
|
{
|
||||||
}
|
get { 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.Flush();
|
m_ircWriter.WriteLine("PING :" + m_server);
|
||||||
Thread.Sleep(15000);
|
m_ircWriter.Flush();
|
||||||
}
|
Thread.Sleep(15000);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public void ListenerRun()
|
|
||||||
{
|
public void ListenerRun()
|
||||||
string inputLine;
|
{
|
||||||
LLVector3 pos = new LLVector3(128, 128, 20);
|
string inputLine;
|
||||||
while (true)
|
LLVector3 pos = new LLVector3(128, 128, 20);
|
||||||
{
|
while (true)
|
||||||
while ((inputLine = m_ircReader.ReadLine()) != null)
|
{
|
||||||
{
|
while ((inputLine = m_ircReader.ReadLine()) != null)
|
||||||
Console.WriteLine(inputLine);
|
{
|
||||||
if (inputLine.Contains(m_channel))
|
Console.WriteLine(inputLine);
|
||||||
{
|
if (inputLine.Contains(m_channel))
|
||||||
string mess = inputLine.Substring(inputLine.IndexOf(m_channel));
|
{
|
||||||
m_scene.Broadcast(delegate(IClientAPI client)
|
string mess = inputLine.Substring(inputLine.IndexOf(m_channel));
|
||||||
{
|
m_scene.Broadcast(delegate(IClientAPI client)
|
||||||
client.SendChatMessage(
|
{
|
||||||
Helpers.StringToField(mess), 255, pos, "IRC:",
|
client.SendChatMessage(
|
||||||
LLUUID.Zero);
|
Helpers.StringToField(mess), 255, pos, "IRC:",
|
||||||
});
|
LLUUID.Zero);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName,
|
|
||||||
LLUUID fromAgentID)
|
public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName,
|
||||||
{
|
LLUUID fromAgentID)
|
||||||
ScenePresence avatar = null;
|
{
|
||||||
avatar = m_scene.GetScenePresence(fromAgentID);
|
ScenePresence avatar = null;
|
||||||
if (avatar != null)
|
avatar = m_scene.GetScenePresence(fromAgentID);
|
||||||
{
|
if (avatar != null)
|
||||||
fromPos = avatar.AbsolutePosition;
|
{
|
||||||
fromName = avatar.Firstname + " " + avatar.Lastname;
|
fromPos = avatar.AbsolutePosition;
|
||||||
avatar = null;
|
fromName = avatar.Firstname + " " + avatar.Lastname;
|
||||||
}
|
avatar = null;
|
||||||
|
}
|
||||||
if (connected)
|
|
||||||
{
|
if (connected)
|
||||||
m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + ">: " +
|
{
|
||||||
Util.FieldToString(message));
|
m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + ">: " +
|
||||||
m_ircWriter.Flush();
|
Util.FieldToString(message));
|
||||||
}
|
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
|
|
||||||
avatar = m_scene.GetScenePresence(presence.ControllingClient.AgentId);
|
//err ??? the following code seems to be request a scenePresence when it already has a ref to it
|
||||||
if (avatar != null)
|
avatar = m_scene.GetScenePresence(presence.ControllingClient.AgentId);
|
||||||
{
|
if (avatar != null)
|
||||||
dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos);
|
{
|
||||||
}
|
dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos);
|
||||||
|
}
|
||||||
switch (type)
|
|
||||||
{
|
switch (type)
|
||||||
case 0: // Whisper
|
{
|
||||||
if ((dis < 10) && (dis > -10))
|
case 0: // Whisper
|
||||||
{
|
if ((dis < 10) && (dis > -10))
|
||||||
//should change so the message is sent through the avatar rather than direct to the ClientView
|
{
|
||||||
presence.ControllingClient.SendChatMessage(message,
|
//should change so the message is sent through the avatar rather than direct to the ClientView
|
||||||
type,
|
presence.ControllingClient.SendChatMessage(message,
|
||||||
fromPos,
|
type,
|
||||||
fromName,
|
fromPos,
|
||||||
fromAgentID);
|
fromName,
|
||||||
}
|
fromAgentID);
|
||||||
break;
|
}
|
||||||
case 1: // Say
|
break;
|
||||||
if ((dis < 30) && (dis > -30))
|
case 1: // Say
|
||||||
{
|
if ((dis < 30) && (dis > -30))
|
||||||
//Console.WriteLine("sending chat");
|
{
|
||||||
presence.ControllingClient.SendChatMessage(message,
|
//Console.WriteLine("sending chat");
|
||||||
type,
|
presence.ControllingClient.SendChatMessage(message,
|
||||||
fromPos,
|
type,
|
||||||
fromName,
|
fromPos,
|
||||||
fromAgentID);
|
fromName,
|
||||||
}
|
fromAgentID);
|
||||||
break;
|
}
|
||||||
case 2: // Shout
|
break;
|
||||||
if ((dis < 100) && (dis > -100))
|
case 2: // Shout
|
||||||
{
|
if ((dis < 100) && (dis > -100))
|
||||||
presence.ControllingClient.SendChatMessage(message,
|
{
|
||||||
type,
|
presence.ControllingClient.SendChatMessage(message,
|
||||||
fromPos,
|
type,
|
||||||
fromName,
|
fromPos,
|
||||||
fromAgentID);
|
fromName,
|
||||||
}
|
fromAgentID);
|
||||||
break;
|
}
|
||||||
|
break;
|
||||||
case 0xff: // Broadcast
|
|
||||||
presence.ControllingClient.SendChatMessage(message, type,
|
case 0xff: // Broadcast
|
||||||
fromPos,
|
presence.ControllingClient.SendChatMessage(message, type,
|
||||||
fromName,
|
fromPos,
|
||||||
fromAgentID);
|
fromName,
|
||||||
break;
|
fromAgentID);
|
||||||
}
|
break;
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,190 +1,191 @@
|
||||||
/*
|
/*
|
||||||
* 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;
|
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;
|
||||||
|
using Nini.Config;
|
||||||
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 =
|
|
||||||
new Dictionary<string, IDynamicTextureRender>();
|
private Dictionary<string, IDynamicTextureRender> RenderPlugins =
|
||||||
|
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, IConfigSource config)
|
||||||
if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
|
{
|
||||||
{
|
if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
|
||||||
RegisteredScenes.Add(scene.RegionInfo.RegionID, scene);
|
{
|
||||||
scene.RegisterModuleInterface<IDynamicTextureManager>(this);
|
RegisteredScenes.Add(scene.RegionInfo.RegionID, scene);
|
||||||
}
|
scene.RegisterModuleInterface<IDynamicTextureManager>(this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public void PostInitialise()
|
|
||||||
{
|
public void PostInitialise()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
public void Close()
|
|
||||||
{
|
public void Close()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
public string Name
|
|
||||||
{
|
public string Name
|
||||||
get { return "DynamicTextureModule"; }
|
{
|
||||||
}
|
get { return "DynamicTextureModule"; }
|
||||||
|
}
|
||||||
public bool IsSharedModule
|
|
||||||
{
|
public bool IsSharedModule
|
||||||
get { return true; }
|
{
|
||||||
}
|
get { 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];
|
{
|
||||||
if (RegisteredScenes.ContainsKey(updater.SimUUID))
|
DynamicTextureUpdater updater = Updaters[id];
|
||||||
{
|
if (RegisteredScenes.ContainsKey(updater.SimUUID))
|
||||||
Scene scene = RegisteredScenes[updater.SimUUID];
|
{
|
||||||
updater.DataReceived(data, scene);
|
Scene scene = RegisteredScenes[updater.SimUUID];
|
||||||
}
|
updater.DataReceived(data, scene);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url,
|
|
||||||
string extraParams, int updateTimer)
|
public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url,
|
||||||
{
|
string extraParams, int updateTimer)
|
||||||
if (RenderPlugins.ContainsKey(contentType))
|
{
|
||||||
{
|
if (RenderPlugins.ContainsKey(contentType))
|
||||||
//Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType);
|
{
|
||||||
|
//Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType);
|
||||||
DynamicTextureUpdater updater = new DynamicTextureUpdater();
|
|
||||||
updater.SimUUID = simID;
|
DynamicTextureUpdater updater = new DynamicTextureUpdater();
|
||||||
updater.PrimID = primID;
|
updater.SimUUID = simID;
|
||||||
updater.ContentType = contentType;
|
updater.PrimID = primID;
|
||||||
updater.Url = url;
|
updater.ContentType = contentType;
|
||||||
updater.UpdateTimer = updateTimer;
|
updater.Url = url;
|
||||||
updater.UpdaterID = LLUUID.Random();
|
updater.UpdateTimer = updateTimer;
|
||||||
updater.Params = extraParams;
|
updater.UpdaterID = LLUUID.Random();
|
||||||
|
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);
|
|
||||||
return updater.UpdaterID;
|
RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams);
|
||||||
}
|
return updater.UpdaterID;
|
||||||
return LLUUID.Zero;
|
}
|
||||||
}
|
return LLUUID.Zero;
|
||||||
|
}
|
||||||
public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data,
|
|
||||||
string extraParams, int updateTimer)
|
public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data,
|
||||||
{
|
string extraParams, int updateTimer)
|
||||||
if (RenderPlugins.ContainsKey(contentType))
|
{
|
||||||
{
|
if (RenderPlugins.ContainsKey(contentType))
|
||||||
DynamicTextureUpdater updater = new DynamicTextureUpdater();
|
{
|
||||||
updater.SimUUID = simID;
|
DynamicTextureUpdater updater = new DynamicTextureUpdater();
|
||||||
updater.PrimID = primID;
|
updater.SimUUID = simID;
|
||||||
updater.ContentType = contentType;
|
updater.PrimID = primID;
|
||||||
updater.BodyData = data;
|
updater.ContentType = contentType;
|
||||||
updater.UpdateTimer = updateTimer;
|
updater.BodyData = data;
|
||||||
updater.UpdaterID = LLUUID.Random();
|
updater.UpdateTimer = updateTimer;
|
||||||
updater.Params = extraParams;
|
updater.UpdaterID = LLUUID.Random();
|
||||||
|
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);
|
|
||||||
return updater.UpdaterID;
|
RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams);
|
||||||
}
|
return updater.UpdaterID;
|
||||||
return LLUUID.Zero;
|
}
|
||||||
}
|
return LLUUID.Zero;
|
||||||
|
}
|
||||||
public class DynamicTextureUpdater
|
|
||||||
{
|
public class DynamicTextureUpdater
|
||||||
public LLUUID SimUUID;
|
{
|
||||||
public LLUUID UpdaterID;
|
public LLUUID SimUUID;
|
||||||
public string ContentType;
|
public LLUUID UpdaterID;
|
||||||
public string Url;
|
public string ContentType;
|
||||||
public string BodyData;
|
public string Url;
|
||||||
public LLUUID PrimID;
|
public string BodyData;
|
||||||
public int UpdateTimer;
|
public LLUUID PrimID;
|
||||||
public LLUUID LastAssetID;
|
public int UpdateTimer;
|
||||||
public string Params;
|
public LLUUID LastAssetID;
|
||||||
|
public string Params;
|
||||||
public DynamicTextureUpdater()
|
|
||||||
{
|
public DynamicTextureUpdater()
|
||||||
LastAssetID = LLUUID.Zero;
|
{
|
||||||
UpdateTimer = 0;
|
LastAssetID = LLUUID.Zero;
|
||||||
BodyData = null;
|
UpdateTimer = 0;
|
||||||
}
|
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
|
{
|
||||||
byte[] assetData = new byte[data.Length];
|
//TODO delete the last asset(data), if it was a dynamic texture
|
||||||
Array.Copy(data, assetData, data.Length);
|
byte[] assetData = new byte[data.Length];
|
||||||
AssetBase asset = new AssetBase();
|
Array.Copy(data, assetData, data.Length);
|
||||||
asset.FullID = LLUUID.Random();
|
AssetBase asset = new AssetBase();
|
||||||
asset.Data = assetData;
|
asset.FullID = LLUUID.Random();
|
||||||
asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000);
|
asset.Data = assetData;
|
||||||
asset.Type = 0;
|
asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000);
|
||||||
asset.Description = "dynamic image";
|
asset.Type = 0;
|
||||||
asset.Local = false;
|
asset.Description = "dynamic image";
|
||||||
asset.Temporary = false;
|
asset.Local = false;
|
||||||
scene.commsManager.AssetCache.AddAsset(asset);
|
asset.Temporary = false;
|
||||||
|
scene.commsManager.AssetCache.AddAsset(asset);
|
||||||
LastAssetID = asset.FullID;
|
|
||||||
|
LastAssetID = asset.FullID;
|
||||||
SceneObjectPart part = scene.GetSceneObjectPart(PrimID);
|
|
||||||
part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes();
|
SceneObjectPart part = scene.GetSceneObjectPart(PrimID);
|
||||||
part.ScheduleFullUpdate();
|
part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes();
|
||||||
}
|
part.ScheduleFullUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,61 +1,62 @@
|
||||||
/*
|
/*
|
||||||
* 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 OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
|
using Nini.Config;
|
||||||
namespace OpenSim.Region.Environment.Modules
|
|
||||||
{
|
namespace OpenSim.Region.Environment.Modules
|
||||||
public class FriendsModule : IRegionModule
|
{
|
||||||
{
|
public class FriendsModule : IRegionModule
|
||||||
private Scene m_scene;
|
{
|
||||||
|
private Scene m_scene;
|
||||||
public void Initialise(Scene scene)
|
|
||||||
{
|
public void Initialise(Scene scene, IConfigSource config)
|
||||||
m_scene = scene;
|
{
|
||||||
}
|
m_scene = scene;
|
||||||
|
}
|
||||||
public void PostInitialise()
|
|
||||||
{
|
public void PostInitialise()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
public void Close()
|
|
||||||
{
|
public void Close()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
public string Name
|
|
||||||
{
|
public string Name
|
||||||
get { return "FriendsModule"; }
|
{
|
||||||
}
|
get { return "FriendsModule"; }
|
||||||
|
}
|
||||||
public bool IsSharedModule
|
|
||||||
{
|
public bool IsSharedModule
|
||||||
get { return false; }
|
{
|
||||||
}
|
get { return false; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,61 +1,62 @@
|
||||||
/*
|
/*
|
||||||
* 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 OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
|
using Nini.Config;
|
||||||
namespace OpenSim.Region.Environment.Modules
|
|
||||||
{
|
namespace OpenSim.Region.Environment.Modules
|
||||||
public class GroupsModule : IRegionModule
|
{
|
||||||
{
|
public class GroupsModule : IRegionModule
|
||||||
private Scene m_scene;
|
{
|
||||||
|
private Scene m_scene;
|
||||||
public void Initialise(Scene scene)
|
|
||||||
{
|
public void Initialise(Scene scene, IConfigSource config)
|
||||||
m_scene = scene;
|
{
|
||||||
}
|
m_scene = scene;
|
||||||
|
}
|
||||||
public void PostInitialise()
|
|
||||||
{
|
public void PostInitialise()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
public void Close()
|
|
||||||
{
|
public void Close()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
public string Name
|
|
||||||
{
|
public string Name
|
||||||
get { return "GroupsModule"; }
|
{
|
||||||
}
|
get { return "GroupsModule"; }
|
||||||
|
}
|
||||||
public bool IsSharedModule
|
|
||||||
{
|
public bool IsSharedModule
|
||||||
get { return false; }
|
{
|
||||||
}
|
get { return false; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,100 +1,101 @@
|
||||||
/*
|
/*
|
||||||
* 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.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
|
using Nini.Config;
|
||||||
namespace OpenSim.Region.Environment.Modules
|
|
||||||
{
|
namespace OpenSim.Region.Environment.Modules
|
||||||
public class InstantMessageModule : IRegionModule
|
{
|
||||||
{
|
public class InstantMessageModule : IRegionModule
|
||||||
private List<Scene> m_scenes = new List<Scene>();
|
{
|
||||||
private LogBase m_log;
|
private List<Scene> m_scenes = new List<Scene>();
|
||||||
|
private LogBase m_log;
|
||||||
public void Initialise(Scene scene)
|
|
||||||
{
|
public void Initialise(Scene scene, IConfigSource config)
|
||||||
if (!m_scenes.Contains(scene))
|
{
|
||||||
{
|
if (!m_scenes.Contains(scene))
|
||||||
m_scenes.Add(scene);
|
{
|
||||||
|
m_scenes.Add(scene);
|
||||||
scene.EventManager.OnNewClient += OnNewClient;
|
|
||||||
m_log = OpenSim.Framework.Console.MainLog.Instance;
|
scene.EventManager.OnNewClient += OnNewClient;
|
||||||
}
|
m_log = OpenSim.Framework.Console.MainLog.Instance;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
void OnNewClient(OpenSim.Framework.Interfaces.IClientAPI client)
|
|
||||||
{
|
void OnNewClient(OpenSim.Framework.Interfaces.IClientAPI client)
|
||||||
client.OnInstantMessage += OnInstantMessage;
|
{
|
||||||
}
|
client.OnInstantMessage += OnInstantMessage;
|
||||||
|
}
|
||||||
void OnInstantMessage(libsecondlife.LLUUID fromAgentID,
|
|
||||||
libsecondlife.LLUUID fromAgentSession, libsecondlife.LLUUID toAgentID,
|
void OnInstantMessage(libsecondlife.LLUUID fromAgentID,
|
||||||
libsecondlife.LLUUID imSessionID, uint timestamp, string fromAgentName,
|
libsecondlife.LLUUID fromAgentSession, libsecondlife.LLUUID toAgentID,
|
||||||
string message, byte dialog)
|
libsecondlife.LLUUID imSessionID, uint timestamp, string fromAgentName,
|
||||||
{
|
string message, byte dialog)
|
||||||
// TODO: Remove after debugging. Privacy implications.
|
{
|
||||||
m_log.Verbose("IM",fromAgentName + ": " + message);
|
// TODO: Remove after debugging. Privacy implications.
|
||||||
|
m_log.Verbose("IM",fromAgentName + ": " + message);
|
||||||
foreach (Scene m_scene in m_scenes)
|
|
||||||
{
|
foreach (Scene m_scene in m_scenes)
|
||||||
if (m_scene.Entities.ContainsKey(toAgentID) && m_scene.Entities[toAgentID] is ScenePresence)
|
{
|
||||||
{
|
if (m_scene.Entities.ContainsKey(toAgentID) && m_scene.Entities[toAgentID] is ScenePresence)
|
||||||
// Local Message
|
{
|
||||||
ScenePresence user = (ScenePresence)m_scene.Entities[toAgentID];
|
// Local Message
|
||||||
user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message,
|
ScenePresence user = (ScenePresence)m_scene.Entities[toAgentID];
|
||||||
toAgentID, imSessionID, user.Firstname + " " + user.Lastname, dialog, timestamp);
|
user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message,
|
||||||
|
toAgentID, imSessionID, user.Firstname + " " + user.Lastname, dialog, timestamp);
|
||||||
// Message sent
|
|
||||||
return;
|
// Message sent
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Still here, try send via Grid
|
|
||||||
}
|
// Still here, try send via Grid
|
||||||
|
}
|
||||||
public void PostInitialise()
|
|
||||||
{
|
public void PostInitialise()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
public void Close()
|
|
||||||
{
|
public void Close()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
public string Name
|
|
||||||
{
|
public string Name
|
||||||
get { return "InstantMessageModule"; }
|
{
|
||||||
}
|
get { return "InstantMessageModule"; }
|
||||||
|
}
|
||||||
public bool IsSharedModule
|
|
||||||
{
|
public bool IsSharedModule
|
||||||
get { return true; }
|
{
|
||||||
}
|
get { return true; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,61 +1,62 @@
|
||||||
/*
|
/*
|
||||||
* 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 OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
|
using Nini.Config;
|
||||||
namespace OpenSim.Region.Environment.Modules
|
|
||||||
{
|
namespace OpenSim.Region.Environment.Modules
|
||||||
public class InventoryModule : IRegionModule
|
{
|
||||||
{
|
public class InventoryModule : IRegionModule
|
||||||
private Scene m_scene;
|
{
|
||||||
|
private Scene m_scene;
|
||||||
public void Initialise(Scene scene)
|
|
||||||
{
|
public void Initialise(Scene scene, IConfigSource config)
|
||||||
m_scene = scene;
|
{
|
||||||
}
|
m_scene = scene;
|
||||||
|
}
|
||||||
public void PostInitialise()
|
|
||||||
{
|
public void PostInitialise()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
public void Close()
|
|
||||||
{
|
public void Close()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
public string Name
|
|
||||||
{
|
public string Name
|
||||||
get { return "InventoryModule"; }
|
{
|
||||||
}
|
get { return "InventoryModule"; }
|
||||||
|
}
|
||||||
public bool IsSharedModule
|
|
||||||
{
|
public bool IsSharedModule
|
||||||
get { return false; }
|
{
|
||||||
}
|
get { return false; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,123 +1,124 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using OpenJPEGNet;
|
using OpenJPEGNet;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
|
using Nini.Config;
|
||||||
namespace OpenSim.Region.Environment.Modules
|
|
||||||
{
|
namespace OpenSim.Region.Environment.Modules
|
||||||
public class LoadImageURLModule : IRegionModule , IDynamicTextureRender
|
{
|
||||||
{
|
public class LoadImageURLModule : IRegionModule , IDynamicTextureRender
|
||||||
private string m_name = "LoadImageURL";
|
{
|
||||||
private IDynamicTextureManager m_textureManager;
|
private string m_name = "LoadImageURL";
|
||||||
private Scene m_scene;
|
private IDynamicTextureManager m_textureManager;
|
||||||
|
private Scene m_scene;
|
||||||
public void Initialise(Scene scene)
|
|
||||||
{
|
public void Initialise(Scene scene, IConfigSource config)
|
||||||
if (m_scene == null)
|
{
|
||||||
{
|
if (m_scene == null)
|
||||||
m_scene = scene;
|
{
|
||||||
}
|
m_scene = scene;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public void PostInitialise()
|
|
||||||
{
|
public void PostInitialise()
|
||||||
m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>();
|
{
|
||||||
m_textureManager.RegisterRender(GetContentType(), this);
|
m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>();
|
||||||
}
|
m_textureManager.RegisterRender(GetContentType(), this);
|
||||||
|
}
|
||||||
public void Close()
|
|
||||||
{
|
public void Close()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
public string Name
|
|
||||||
{
|
public string Name
|
||||||
get { return m_name; }
|
{
|
||||||
}
|
get { return m_name; }
|
||||||
|
}
|
||||||
public bool IsSharedModule
|
|
||||||
{
|
public bool IsSharedModule
|
||||||
get { return true; }
|
{
|
||||||
}
|
get { return true; }
|
||||||
|
}
|
||||||
public string GetName()
|
|
||||||
{
|
public string GetName()
|
||||||
return m_name;
|
{
|
||||||
}
|
return m_name;
|
||||||
|
}
|
||||||
public string GetContentType()
|
|
||||||
{
|
public string GetContentType()
|
||||||
return ("image");
|
{
|
||||||
}
|
return ("image");
|
||||||
|
}
|
||||||
public bool SupportsAsynchronous()
|
|
||||||
{
|
public bool SupportsAsynchronous()
|
||||||
return true;
|
{
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
public byte[] ConvertUrl(string url, string extraParams)
|
|
||||||
{
|
public byte[] ConvertUrl(string url, string extraParams)
|
||||||
return null;
|
{
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
public byte[] ConvertStream(Stream data, string extraParams)
|
|
||||||
{
|
public byte[] ConvertStream(Stream data, string extraParams)
|
||||||
return null;
|
{
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
public bool AsyncConvertUrl(LLUUID id, string url, string extraParams)
|
|
||||||
{
|
public bool AsyncConvertUrl(LLUUID id, string url, string extraParams)
|
||||||
MakeHttpRequest(url, id);
|
{
|
||||||
return true;
|
MakeHttpRequest(url, id);
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
public bool AsyncConvertData(LLUUID id, string bodyData, string extraParams)
|
|
||||||
{
|
public bool AsyncConvertData(LLUUID id, string bodyData, string extraParams)
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
private void MakeHttpRequest(string url, LLUUID requestID)
|
|
||||||
{
|
private void MakeHttpRequest(string url, LLUUID requestID)
|
||||||
WebRequest request = HttpWebRequest.Create(url);
|
{
|
||||||
RequestState state = new RequestState((HttpWebRequest)request, requestID);
|
WebRequest request = HttpWebRequest.Create(url);
|
||||||
IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state);
|
RequestState state = new RequestState((HttpWebRequest)request, requestID);
|
||||||
|
IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state);
|
||||||
TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1));
|
|
||||||
state.TimeOfRequest = (int)t.TotalSeconds;
|
TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1));
|
||||||
}
|
state.TimeOfRequest = (int)t.TotalSeconds;
|
||||||
|
}
|
||||||
private void HttpRequestReturn(IAsyncResult result)
|
|
||||||
{
|
private void HttpRequestReturn(IAsyncResult result)
|
||||||
RequestState state = (RequestState)result.AsyncState;
|
{
|
||||||
WebRequest request = (WebRequest)state.Request;
|
RequestState state = (RequestState)result.AsyncState;
|
||||||
HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result);
|
WebRequest request = (WebRequest)state.Request;
|
||||||
if (response.StatusCode == HttpStatusCode.OK)
|
HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result);
|
||||||
{
|
if (response.StatusCode == HttpStatusCode.OK)
|
||||||
Bitmap image = new Bitmap(response.GetResponseStream());
|
{
|
||||||
Bitmap resize = new Bitmap(image, new Size(512, 512));
|
Bitmap image = new Bitmap(response.GetResponseStream());
|
||||||
byte[] imageJ2000 = OpenJPEG.EncodeFromImage(resize, true);
|
Bitmap resize = new Bitmap(image, new Size(512, 512));
|
||||||
|
byte[] imageJ2000 = OpenJPEG.EncodeFromImage(resize, true);
|
||||||
m_textureManager.ReturnData(state.RequestID, imageJ2000);
|
|
||||||
}
|
m_textureManager.ReturnData(state.RequestID, imageJ2000);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public class RequestState
|
|
||||||
{
|
public class RequestState
|
||||||
public HttpWebRequest Request = null;
|
{
|
||||||
public LLUUID RequestID = LLUUID.Zero;
|
public HttpWebRequest Request = null;
|
||||||
public int TimeOfRequest = 0;
|
public LLUUID RequestID = LLUUID.Zero;
|
||||||
|
public int TimeOfRequest = 0;
|
||||||
public RequestState(HttpWebRequest request, LLUUID requestID)
|
|
||||||
{
|
public RequestState(HttpWebRequest request, LLUUID requestID)
|
||||||
Request = request;
|
{
|
||||||
RequestID = requestID;
|
Request = request;
|
||||||
}
|
RequestID = requestID;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,76 +1,77 @@
|
||||||
/*
|
/*
|
||||||
* 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 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;
|
||||||
|
using Nini.Config;
|
||||||
namespace OpenSim.Region.Environment.Modules
|
|
||||||
{
|
namespace OpenSim.Region.Environment.Modules
|
||||||
public class TextureDownloadModule : IRegionModule
|
{
|
||||||
{
|
public class TextureDownloadModule : IRegionModule
|
||||||
private Scene m_scene;
|
{
|
||||||
|
private Scene m_scene;
|
||||||
public TextureDownloadModule()
|
|
||||||
{
|
public TextureDownloadModule()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
public void Initialise(Scene scene)
|
|
||||||
{
|
public void Initialise(Scene scene, IConfigSource config)
|
||||||
m_scene = scene;
|
{
|
||||||
m_scene.EventManager.OnNewClient += NewClient;
|
m_scene = scene;
|
||||||
}
|
m_scene.EventManager.OnNewClient += NewClient;
|
||||||
|
}
|
||||||
public void PostInitialise()
|
|
||||||
{
|
public void PostInitialise()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
public void Close()
|
|
||||||
{
|
public void Close()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
public string Name
|
|
||||||
{
|
public string Name
|
||||||
get { return "TextureDownloadModule"; }
|
{
|
||||||
}
|
get { return "TextureDownloadModule"; }
|
||||||
|
}
|
||||||
public bool IsSharedModule
|
|
||||||
{
|
public bool IsSharedModule
|
||||||
get { return false; }
|
{
|
||||||
}
|
get { return false; }
|
||||||
|
}
|
||||||
public void NewClient(IClientAPI client)
|
|
||||||
{
|
public void NewClient(IClientAPI client)
|
||||||
}
|
{
|
||||||
|
}
|
||||||
public void TextureAssetCallback(LLUUID texture, byte[] data)
|
|
||||||
{
|
public void TextureAssetCallback(LLUUID texture, byte[] data)
|
||||||
}
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ using OpenSim.Framework.Servers;
|
||||||
using Nwc.XmlRpc;
|
using Nwc.XmlRpc;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Nini.Config;
|
||||||
|
|
||||||
/*****************************************************
|
/*****************************************************
|
||||||
*
|
*
|
||||||
|
@ -84,7 +85,7 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialise(Scene scene)
|
public void Initialise(Scene scene, IConfigSource config)
|
||||||
{
|
{
|
||||||
|
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
|
|
|
@ -39,6 +39,7 @@ using OpenSim.Framework.Servers;
|
||||||
using Nwc.XmlRpc;
|
using Nwc.XmlRpc;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Nini.Config;
|
||||||
|
|
||||||
/*****************************************************
|
/*****************************************************
|
||||||
*
|
*
|
||||||
|
@ -93,7 +94,7 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialise(Scene scene)
|
public void Initialise(Scene scene, IConfigSource config)
|
||||||
{
|
{
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
|
|
||||||
|
|
|
@ -1,201 +1,202 @@
|
||||||
/*
|
/*
|
||||||
* 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;
|
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;
|
||||||
|
using Nini.Config;
|
||||||
namespace OpenSim.Region.Environment.Modules
|
|
||||||
{
|
namespace OpenSim.Region.Environment.Modules
|
||||||
public class XferModule : IRegionModule, IXfer
|
{
|
||||||
{
|
public class XferModule : IRegionModule, IXfer
|
||||||
public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>();
|
{
|
||||||
public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>();
|
public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>();
|
||||||
|
public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>();
|
||||||
private Scene m_scene;
|
|
||||||
|
private Scene m_scene;
|
||||||
public XferModule()
|
|
||||||
{
|
public XferModule()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
public void Initialise(Scene scene)
|
|
||||||
{
|
public void Initialise(Scene scene, IConfigSource config)
|
||||||
m_scene = scene;
|
{
|
||||||
m_scene.EventManager.OnNewClient += NewClient;
|
m_scene = scene;
|
||||||
|
m_scene.EventManager.OnNewClient += NewClient;
|
||||||
m_scene.RegisterModuleInterface<IXfer>(this);
|
|
||||||
}
|
m_scene.RegisterModuleInterface<IXfer>(this);
|
||||||
|
}
|
||||||
public void PostInitialise()
|
|
||||||
{
|
public void PostInitialise()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
public void Close()
|
|
||||||
{
|
public void Close()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
public string Name
|
|
||||||
{
|
public string Name
|
||||||
get { return "XferModule"; }
|
{
|
||||||
}
|
get { return "XferModule"; }
|
||||||
|
}
|
||||||
public bool IsSharedModule
|
|
||||||
{
|
public bool IsSharedModule
|
||||||
get { return false; }
|
{
|
||||||
}
|
get { return false; }
|
||||||
|
}
|
||||||
public void NewClient(IClientAPI client)
|
|
||||||
{
|
public void NewClient(IClientAPI client)
|
||||||
client.OnRequestXfer += RequestXfer;
|
{
|
||||||
client.OnConfirmXfer += AckPacket;
|
client.OnRequestXfer += RequestXfer;
|
||||||
}
|
client.OnConfirmXfer += AckPacket;
|
||||||
|
}
|
||||||
/// <summary>
|
|
||||||
///
|
/// <summary>
|
||||||
/// </summary>
|
///
|
||||||
/// <param name="remoteClient"></param>
|
/// </summary>
|
||||||
/// <param name="xferID"></param>
|
/// <param name="remoteClient"></param>
|
||||||
/// <param name="fileName"></param>
|
/// <param name="xferID"></param>
|
||||||
public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName)
|
/// <param name="fileName"></param>
|
||||||
{
|
public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName)
|
||||||
lock (NewFiles)
|
{
|
||||||
{
|
lock (NewFiles)
|
||||||
if (NewFiles.ContainsKey(fileName))
|
{
|
||||||
{
|
if (NewFiles.ContainsKey(fileName))
|
||||||
if (!Transfers.ContainsKey(xferID))
|
{
|
||||||
{
|
if (!Transfers.ContainsKey(xferID))
|
||||||
byte[] fileData = NewFiles[fileName];
|
{
|
||||||
XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient);
|
byte[] fileData = NewFiles[fileName];
|
||||||
Transfers.Add(xferID, transaction);
|
XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient);
|
||||||
NewFiles.Remove(fileName);
|
Transfers.Add(xferID, transaction);
|
||||||
transaction.StartSend();
|
NewFiles.Remove(fileName);
|
||||||
}
|
transaction.StartSend();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public void AckPacket(IClientAPI remoteClient, ulong xferID, uint packet)
|
|
||||||
{
|
public void AckPacket(IClientAPI remoteClient, ulong xferID, uint packet)
|
||||||
if (Transfers.ContainsKey(xferID))
|
{
|
||||||
{
|
if (Transfers.ContainsKey(xferID))
|
||||||
Transfers[xferID].AckPacket(packet);
|
{
|
||||||
}
|
Transfers[xferID].AckPacket(packet);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public bool AddNewFile(string fileName, byte[] data)
|
|
||||||
{
|
public bool AddNewFile(string fileName, byte[] data)
|
||||||
lock (NewFiles)
|
{
|
||||||
{
|
lock (NewFiles)
|
||||||
if (NewFiles.ContainsKey(fileName))
|
{
|
||||||
{
|
if (NewFiles.ContainsKey(fileName))
|
||||||
NewFiles[fileName] = data;
|
{
|
||||||
}
|
NewFiles[fileName] = data;
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
NewFiles.Add(fileName, data);
|
{
|
||||||
}
|
NewFiles.Add(fileName, data);
|
||||||
}
|
}
|
||||||
return true;
|
}
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public class XferDownLoad
|
|
||||||
{
|
public class XferDownLoad
|
||||||
public byte[] Data = new byte[0];
|
{
|
||||||
public string FileName = "";
|
public byte[] Data = new byte[0];
|
||||||
public ulong XferID = 0;
|
public string FileName = "";
|
||||||
public int DataPointer = 0;
|
public ulong XferID = 0;
|
||||||
public uint Packet = 0;
|
public int DataPointer = 0;
|
||||||
public IClientAPI Client;
|
public uint Packet = 0;
|
||||||
public uint Serial = 1;
|
public IClientAPI Client;
|
||||||
private bool complete = false;
|
public uint Serial = 1;
|
||||||
|
private bool complete = false;
|
||||||
public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client)
|
|
||||||
{
|
public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client)
|
||||||
FileName = fileName;
|
{
|
||||||
Data = data;
|
FileName = fileName;
|
||||||
XferID = xferID;
|
Data = data;
|
||||||
Client = client;
|
XferID = xferID;
|
||||||
}
|
Client = client;
|
||||||
|
}
|
||||||
public XferDownLoad()
|
|
||||||
{
|
public XferDownLoad()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
public void StartSend()
|
|
||||||
{
|
public void StartSend()
|
||||||
if (Data.Length < 1000)
|
{
|
||||||
{
|
if (Data.Length < 1000)
|
||||||
// for now (testing ) we only support files under 1000 bytes
|
{
|
||||||
byte[] transferData = new byte[Data.Length + 4];
|
// for now (testing ) we only support files under 1000 bytes
|
||||||
Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4);
|
byte[] transferData = new byte[Data.Length + 4];
|
||||||
Array.Copy(Data, 0, transferData, 4, Data.Length);
|
Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4);
|
||||||
Client.SendXferPacket(XferID, 0 + 0x80000000, transferData);
|
Array.Copy(Data, 0, transferData, 4, Data.Length);
|
||||||
complete = true;
|
Client.SendXferPacket(XferID, 0 + 0x80000000, transferData);
|
||||||
}
|
complete = true;
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
byte[] transferData = new byte[1000 + 4];
|
{
|
||||||
Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4);
|
byte[] transferData = new byte[1000 + 4];
|
||||||
Array.Copy(Data, 0, transferData, 4, 1000);
|
Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4);
|
||||||
Client.SendXferPacket(XferID, 0, transferData);
|
Array.Copy(Data, 0, transferData, 4, 1000);
|
||||||
Packet++;
|
Client.SendXferPacket(XferID, 0, transferData);
|
||||||
DataPointer = 1000;
|
Packet++;
|
||||||
}
|
DataPointer = 1000;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public void AckPacket(uint packet)
|
|
||||||
{
|
public void AckPacket(uint packet)
|
||||||
if (!complete)
|
{
|
||||||
{
|
if (!complete)
|
||||||
if ((Data.Length - DataPointer) > 1000)
|
{
|
||||||
{
|
if ((Data.Length - DataPointer) > 1000)
|
||||||
byte[] transferData = new byte[1000];
|
{
|
||||||
Array.Copy(Data, DataPointer, transferData, 0, 1000);
|
byte[] transferData = new byte[1000];
|
||||||
Client.SendXferPacket(XferID, Packet, transferData);
|
Array.Copy(Data, DataPointer, transferData, 0, 1000);
|
||||||
Packet++;
|
Client.SendXferPacket(XferID, Packet, transferData);
|
||||||
DataPointer += 1000;
|
Packet++;
|
||||||
}
|
DataPointer += 1000;
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
byte[] transferData = new byte[Data.Length - DataPointer];
|
{
|
||||||
Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer);
|
byte[] transferData = new byte[Data.Length - DataPointer];
|
||||||
uint endPacket = Packet |= (uint) 0x80000000;
|
Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer);
|
||||||
Client.SendXferPacket(XferID, endPacket, transferData);
|
uint endPacket = Packet |= (uint) 0x80000000;
|
||||||
Packet++;
|
Client.SendXferPacket(XferID, endPacket, transferData);
|
||||||
DataPointer += (Data.Length - DataPointer);
|
Packet++;
|
||||||
complete = true;
|
DataPointer += (Data.Length - DataPointer);
|
||||||
}
|
complete = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -39,12 +39,15 @@ using OpenSim.Region.Communications.Local;
|
||||||
using OpenSim.Region.Environment;
|
using OpenSim.Region.Environment;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
|
using Nini.Config;
|
||||||
|
|
||||||
namespace SimpleApp
|
namespace SimpleApp
|
||||||
{
|
{
|
||||||
class Program : RegionApplicationBase, conscmd_callback
|
class Program : RegionApplicationBase, conscmd_callback
|
||||||
{
|
{
|
||||||
private ModuleLoader m_moduleLoader;
|
private ModuleLoader m_moduleLoader;
|
||||||
|
private IConfigSource m_config;
|
||||||
|
|
||||||
protected override LogBase CreateLog()
|
protected override LogBase CreateLog()
|
||||||
{
|
{
|
||||||
return new LogBase(null, "SimpleApp", this, false);
|
return new LogBase(null, "SimpleApp", this, false);
|
||||||
|
@ -86,7 +89,7 @@ namespace SimpleApp
|
||||||
|
|
||||||
UDPServer udpServer;
|
UDPServer udpServer;
|
||||||
|
|
||||||
m_moduleLoader = new ModuleLoader( m_log );
|
m_moduleLoader = new ModuleLoader( m_log, m_config );
|
||||||
m_moduleLoader.LoadDefaultSharedModules();
|
m_moduleLoader.LoadDefaultSharedModules();
|
||||||
|
|
||||||
Scene scene = SetupScene(regionInfo, out udpServer);
|
Scene scene = SetupScene(regionInfo, out udpServer);
|
||||||
|
@ -155,7 +158,7 @@ namespace SimpleApp
|
||||||
|
|
||||||
protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, AgentCircuitManager circuitManager)
|
protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, AgentCircuitManager circuitManager)
|
||||||
{
|
{
|
||||||
return new MyWorld(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer, new ModuleLoader( m_log ));
|
return new MyWorld(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer, new ModuleLoader( m_log, m_config ));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override StorageManager CreateStorageManager(RegionInfo regionInfo)
|
protected override StorageManager CreateStorageManager(RegionInfo regionInfo)
|
||||||
|
|
|
@ -1,148 +1,149 @@
|
||||||
/*
|
/*
|
||||||
* 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;
|
||||||
|
using Nini.Config;
|
||||||
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>();
|
{
|
||||||
Scene m_scene;
|
readonly List<IScript> scripts = new List<IScript>();
|
||||||
readonly Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>();
|
Scene m_scene;
|
||||||
|
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.
|
{
|
||||||
MainLog.Instance.Verbose("Loading " + script.Key);
|
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.Value.Initialise(scriptInfo);
|
MainLog.Instance.Verbose("Loading " + script.Key);
|
||||||
scripts.Add(script.Value);
|
script.Value.Initialise(scriptInfo);
|
||||||
}
|
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
|
{
|
||||||
CSharpScriptEngine csharpCompiler = new CSharpScriptEngine();
|
// Default Engines
|
||||||
compilers.Add(csharpCompiler.FileExt(), csharpCompiler);
|
CSharpScriptEngine csharpCompiler = new CSharpScriptEngine();
|
||||||
|
compilers.Add(csharpCompiler.FileExt(), csharpCompiler);
|
||||||
JScriptEngine jscriptCompiler = new JScriptEngine();
|
|
||||||
compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler);
|
JScriptEngine jscriptCompiler = new JScriptEngine();
|
||||||
|
compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler);
|
||||||
JavaEngine javaCompiler = new JavaEngine();
|
|
||||||
compilers.Add(javaCompiler.FileExt(), javaCompiler);
|
JavaEngine javaCompiler = new JavaEngine();
|
||||||
}
|
compilers.Add(javaCompiler.FileExt(), javaCompiler);
|
||||||
|
}
|
||||||
public void Initialise(Scene scene)
|
|
||||||
{
|
public void Initialise(Scene scene, IConfigSource config)
|
||||||
System.Console.WriteLine("Initialising Extensions Scripting Module");
|
{
|
||||||
m_scene = scene;
|
System.Console.WriteLine("Initialising Extensions Scripting Module");
|
||||||
|
m_scene = scene;
|
||||||
m_scene.RegisterModuleInterface<IExtensionScriptModule>(this);
|
|
||||||
}
|
m_scene.RegisterModuleInterface<IExtensionScriptModule>(this);
|
||||||
|
}
|
||||||
public void PostInitialise()
|
|
||||||
{
|
public void PostInitialise()
|
||||||
|
{
|
||||||
}
|
|
||||||
|
}
|
||||||
public void Close()
|
|
||||||
{
|
public void Close()
|
||||||
|
{
|
||||||
}
|
|
||||||
|
}
|
||||||
public string Name
|
|
||||||
{
|
public string Name
|
||||||
get { return "ExtensionsScriptingModule"; }
|
{
|
||||||
}
|
get { return "ExtensionsScriptingModule"; }
|
||||||
|
}
|
||||||
public bool IsSharedModule
|
|
||||||
{
|
public bool IsSharedModule
|
||||||
get { return false; }
|
{
|
||||||
}
|
get { 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));
|
{
|
||||||
break;
|
LoadFromCompiler(compiler.Value.compile(filename));
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
public void RunScriptCmd(string[] args)
|
|
||||||
{
|
public void RunScriptCmd(string[] args)
|
||||||
switch (args[0])
|
{
|
||||||
{
|
switch (args[0])
|
||||||
case "load":
|
{
|
||||||
Compile(args[1]);
|
case "load":
|
||||||
break;
|
Compile(args[1]);
|
||||||
|
break;
|
||||||
default:
|
|
||||||
MainLog.Instance.Error("Unknown script command");
|
default:
|
||||||
break;
|
MainLog.Instance.Error("Unknown script command");
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public bool AddPreCompiledScript(IScript script)
|
|
||||||
{
|
public bool AddPreCompiledScript(IScript script)
|
||||||
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.
|
MainLog.Instance.Verbose("Loading script " + script.Name);
|
||||||
script.Initialise(scriptInfo);
|
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.
|
||||||
scripts.Add(script);
|
script.Initialise(scriptInfo);
|
||||||
|
scripts.Add(script);
|
||||||
return true;
|
|
||||||
}
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public interface IExtensionScriptModule
|
|
||||||
{
|
public interface IExtensionScriptModule
|
||||||
bool Compile(string filename);
|
{
|
||||||
bool AddPreCompiledScript(IScript script);
|
bool Compile(string filename);
|
||||||
}
|
bool AddPreCompiledScript(IScript script);
|
||||||
|
}
|
||||||
interface IScriptCompiler
|
|
||||||
{
|
interface IScriptCompiler
|
||||||
Dictionary<string, IScript> compile(string filename);
|
{
|
||||||
string FileExt();
|
Dictionary<string, IScript> compile(string filename);
|
||||||
}
|
string FileExt();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,132 +1,133 @@
|
||||||
/*
|
/*
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/* Original code: Tedd Hansen */
|
/* Original code: Tedd Hansen */
|
||||||
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;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using OpenSim.Region.Environment.Scenes.Scripting;
|
using OpenSim.Region.Environment.Scenes.Scripting;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
using Nini.Config;
|
||||||
namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|
||||||
{
|
namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||||
/// <summary>
|
{
|
||||||
/// This is the root object for ScriptEngine
|
/// <summary>
|
||||||
/// </summary>
|
/// This is the root object for ScriptEngine
|
||||||
[Serializable]
|
/// </summary>
|
||||||
public class ScriptEngine :IRegionModule
|
[Serializable]
|
||||||
{
|
public class ScriptEngine :IRegionModule
|
||||||
|
{
|
||||||
internal OpenSim.Region.Environment.Scenes.Scene World;
|
|
||||||
internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim
|
internal OpenSim.Region.Environment.Scenes.Scene World;
|
||||||
internal EventQueueManager m_EventQueueManager; // Executes events
|
internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim
|
||||||
internal ScriptManager m_ScriptManager; // Load, unload and execute scripts
|
internal EventQueueManager m_EventQueueManager; // Executes events
|
||||||
internal AppDomainManager m_AppDomainManager;
|
internal ScriptManager m_ScriptManager; // Load, unload and execute scripts
|
||||||
internal LSLLongCmdHandler m_LSLLongCmdHandler;
|
internal AppDomainManager m_AppDomainManager;
|
||||||
|
internal LSLLongCmdHandler m_LSLLongCmdHandler;
|
||||||
private OpenSim.Framework.Console.LogBase m_log;
|
|
||||||
|
private OpenSim.Framework.Console.LogBase m_log;
|
||||||
public ScriptEngine()
|
|
||||||
{
|
public ScriptEngine()
|
||||||
//Common.SendToDebug("ScriptEngine Object Initialized");
|
{
|
||||||
Common.mySE = this;
|
//Common.SendToDebug("ScriptEngine Object Initialized");
|
||||||
}
|
Common.mySE = this;
|
||||||
|
}
|
||||||
public LogBase Log
|
|
||||||
{
|
public LogBase Log
|
||||||
get { return m_log; }
|
{
|
||||||
}
|
get { return m_log; }
|
||||||
|
}
|
||||||
public void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger)
|
|
||||||
{
|
public void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger)
|
||||||
|
{
|
||||||
World = Sceneworld;
|
|
||||||
m_log = logger;
|
World = Sceneworld;
|
||||||
|
m_log = logger;
|
||||||
Log.Verbose("ScriptEngine", "DotNet & LSL ScriptEngine initializing");
|
|
||||||
|
Log.Verbose("ScriptEngine", "DotNet & LSL ScriptEngine initializing");
|
||||||
//m_logger.Status("ScriptEngine", "InitializeEngine");
|
|
||||||
|
//m_logger.Status("ScriptEngine", "InitializeEngine");
|
||||||
// Create all objects we'll be using
|
|
||||||
m_EventQueueManager = new EventQueueManager(this);
|
// Create all objects we'll be using
|
||||||
m_EventManager = new EventManager(this);
|
m_EventQueueManager = new EventQueueManager(this);
|
||||||
m_ScriptManager = new ScriptManager(this);
|
m_EventManager = new EventManager(this);
|
||||||
m_AppDomainManager = new AppDomainManager();
|
m_ScriptManager = new ScriptManager(this);
|
||||||
m_LSLLongCmdHandler = new LSLLongCmdHandler(this);
|
m_AppDomainManager = new AppDomainManager();
|
||||||
|
m_LSLLongCmdHandler = new LSLLongCmdHandler(this);
|
||||||
// Should we iterate the region for scripts that needs starting?
|
|
||||||
// Or can we assume we are loaded before anything else so we can use proper events?
|
// Should we iterate the region for scripts that needs starting?
|
||||||
|
// Or can we assume we are loaded before anything else so we can use proper events?
|
||||||
|
|
||||||
}
|
|
||||||
|
}
|
||||||
public void Shutdown()
|
|
||||||
{
|
public void Shutdown()
|
||||||
// We are shutting down
|
{
|
||||||
}
|
// We are shutting down
|
||||||
|
}
|
||||||
//// !!!FOR DEBUGGING ONLY!!! (for executing script directly from test app)
|
|
||||||
//[Obsolete("!!!FOR DEBUGGING ONLY!!!")]
|
//// !!!FOR DEBUGGING ONLY!!! (for executing script directly from test app)
|
||||||
//public void StartScript(string ScriptID, IScriptHost ObjectID)
|
//[Obsolete("!!!FOR DEBUGGING ONLY!!!")]
|
||||||
//{
|
//public void StartScript(string ScriptID, IScriptHost ObjectID)
|
||||||
// this.myEventManager.TEMP_OBJECT_ID = ObjectID;
|
//{
|
||||||
// Log.Status("ScriptEngine", "DEBUG FUNCTION: StartScript: " + ScriptID);
|
// this.myEventManager.TEMP_OBJECT_ID = ObjectID;
|
||||||
// myScriptManager.StartScript(ScriptID, ObjectID);
|
// Log.Status("ScriptEngine", "DEBUG FUNCTION: StartScript: " + ScriptID);
|
||||||
//}
|
// myScriptManager.StartScript(ScriptID, ObjectID);
|
||||||
|
//}
|
||||||
#region IRegionModule
|
|
||||||
|
#region IRegionModule
|
||||||
public void Initialise(Scene scene)
|
|
||||||
{
|
public void Initialise(Scene scene, IConfigSource config)
|
||||||
this.InitializeEngine(scene, MainLog.Instance);
|
{
|
||||||
}
|
this.InitializeEngine(scene, MainLog.Instance);
|
||||||
|
}
|
||||||
public void PostInitialise()
|
|
||||||
{
|
public void PostInitialise()
|
||||||
|
{
|
||||||
}
|
|
||||||
|
}
|
||||||
public void Close()
|
|
||||||
{
|
public void Close()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
public string Name
|
|
||||||
{
|
public string Name
|
||||||
get { return "LSLScriptingModule"; }
|
{
|
||||||
}
|
get { return "LSLScriptingModule"; }
|
||||||
|
}
|
||||||
public bool IsSharedModule
|
|
||||||
{
|
public bool IsSharedModule
|
||||||
get { return false; }
|
{
|
||||||
}
|
get { return false; }
|
||||||
|
}
|
||||||
#endregion
|
|
||||||
}
|
#endregion
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
10
prebuild.xml
10
prebuild.xml
|
@ -475,11 +475,12 @@
|
||||||
<Reference name="OpenSim.Framework.Console"/>
|
<Reference name="OpenSim.Framework.Console"/>
|
||||||
<Reference name="OpenSim.Region.Physics.Manager"/>
|
<Reference name="OpenSim.Region.Physics.Manager"/>
|
||||||
<Reference name="OpenSim.Framework.Servers"/>
|
<Reference name="OpenSim.Framework.Servers"/>
|
||||||
|
<Reference name="OpenSim.Region.ScriptEngine.DotNetEngine"/>
|
||||||
<!-- For scripting in funny languages by default -->
|
<!-- For scripting in funny languages by default -->
|
||||||
<Reference name="Microsoft.JScript"/>
|
<Reference name="Microsoft.JScript"/>
|
||||||
<Reference name="XMLRPC.dll"/>
|
<Reference name="XMLRPC.dll"/>
|
||||||
<Reference name="OpenSim.Framework.Communications"/>
|
<Reference name="OpenSim.Framework.Communications"/>
|
||||||
|
<Reference name="Nini.dll" />
|
||||||
<Files>
|
<Files>
|
||||||
<Match pattern="*.cs" recurse="true"/>
|
<Match pattern="*.cs" recurse="true"/>
|
||||||
</Files>
|
</Files>
|
||||||
|
@ -592,7 +593,7 @@
|
||||||
<Reference name="OpenSim.Region.Environment"/>
|
<Reference name="OpenSim.Region.Environment"/>
|
||||||
<Reference name="OpenSim.Framework.Console"/>
|
<Reference name="OpenSim.Framework.Console"/>
|
||||||
<Reference name="Axiom.MathLib.dll"/>
|
<Reference name="Axiom.MathLib.dll"/>
|
||||||
|
<Reference name="Nini.dll"/>
|
||||||
<Files>
|
<Files>
|
||||||
<Match pattern="*.cs" recurse="true"/>
|
<Match pattern="*.cs" recurse="true"/>
|
||||||
</Files>
|
</Files>
|
||||||
|
@ -670,7 +671,7 @@
|
||||||
<Reference name="OpenSim.Region.ClientStack"/>
|
<Reference name="OpenSim.Region.ClientStack"/>
|
||||||
<Reference name="OpenSim.Region.Environment"/>
|
<Reference name="OpenSim.Region.Environment"/>
|
||||||
<Reference name="OpenSim.Region.Terrain.BasicTerrain"/>
|
<Reference name="OpenSim.Region.Terrain.BasicTerrain"/>
|
||||||
|
<Reference name="Nini.dll" />
|
||||||
|
|
||||||
<Files>
|
<Files>
|
||||||
<Match pattern="*.cs" recurse="true"/>
|
<Match pattern="*.cs" recurse="true"/>
|
||||||
|
@ -895,6 +896,7 @@
|
||||||
<Reference name="OpenSim.Framework.Console"/>
|
<Reference name="OpenSim.Framework.Console"/>
|
||||||
<Reference name="OpenSim.Region.ScriptEngine.Common"/>
|
<Reference name="OpenSim.Region.ScriptEngine.Common"/>
|
||||||
<Reference name="Axiom.MathLib.dll" localCopy="false"/>
|
<Reference name="Axiom.MathLib.dll" localCopy="false"/>
|
||||||
|
<Reference name="Nini.dll" />
|
||||||
<Files>
|
<Files>
|
||||||
<Match pattern="*.cs" recurse="true"/>
|
<Match pattern="*.cs" recurse="true"/>
|
||||||
</Files>
|
</Files>
|
||||||
|
@ -983,6 +985,8 @@
|
||||||
<Reference name="OpenSim.Framework.Console"/>
|
<Reference name="OpenSim.Framework.Console"/>
|
||||||
<Reference name="OpenSim.Region.ScriptEngine.Common"/>
|
<Reference name="OpenSim.Region.ScriptEngine.Common"/>
|
||||||
<Reference name="Axiom.MathLib.dll" localCopy="false"/>
|
<Reference name="Axiom.MathLib.dll" localCopy="false"/>
|
||||||
|
<Reference name="Nini.dll" />
|
||||||
|
|
||||||
<Files>
|
<Files>
|
||||||
<Match pattern="*.cs" recurse="true"/>
|
<Match pattern="*.cs" recurse="true"/>
|
||||||
</Files>
|
</Files>
|
||||||
|
|
Loading…
Reference in New Issue