aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs54
-rw-r--r--OpenSim/Region/Environment/Interfaces/IRegionModule.cs3
-rw-r--r--OpenSim/Region/Environment/ModuleLoader.cs407
-rw-r--r--OpenSim/Region/Environment/Modules/AssetDownloadModule.cs3
-rw-r--r--OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs187
-rw-r--r--OpenSim/Region/Environment/Modules/ChatModule.cs485
-rw-r--r--OpenSim/Region/Environment/Modules/DynamicTextureModule.cs381
-rw-r--r--OpenSim/Region/Environment/Modules/FriendsModule.cs123
-rw-r--r--OpenSim/Region/Environment/Modules/GroupsModule.cs123
-rw-r--r--OpenSim/Region/Environment/Modules/InstantMessageModule.cs201
-rw-r--r--OpenSim/Region/Environment/Modules/InventoryModule.cs123
-rw-r--r--OpenSim/Region/Environment/Modules/LoadImageURLModule.cs247
-rw-r--r--OpenSim/Region/Environment/Modules/TextureDownloadModule.cs153
-rw-r--r--OpenSim/Region/Environment/Modules/WorldCommModule.cs3
-rw-r--r--OpenSim/Region/Environment/Modules/XMLRPCModule.cs3
-rw-r--r--OpenSim/Region/Environment/Modules/XferModule.cs403
-rw-r--r--OpenSim/Region/Examples/SimpleApp/Program.cs7
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs297
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs265
19 files changed, 1745 insertions, 1723 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index 5fb514f..c367537 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -63,6 +63,7 @@ namespace OpenSim
63 63
64 protected ModuleLoader m_moduleLoader; 64 protected ModuleLoader m_moduleLoader;
65 protected LocalLoginService m_loginService; 65 protected LocalLoginService m_loginService;
66 private IConfigSource m_config;
66 67
67 protected string m_storageDLL = "OpenSim.DataStore.NullStorage.dll"; 68 protected string m_storageDLL = "OpenSim.DataStore.NullStorage.dll";
68 69
@@ -89,9 +90,8 @@ namespace OpenSim
89 public OpenSimMain(IConfigSource configSource) 90 public OpenSimMain(IConfigSource configSource)
90 : base() 91 : base()
91 { 92 {
92 IConfigSource startupSource = configSource; 93 string iniFile = configSource.Configs["Startup"].GetString("inifile", "OpenSim.ini");
93 string iniFile = startupSource.Configs["Startup"].GetString("inifile", "OpenSim.ini"); 94 string useExecutePathString = configSource.Configs["Startup"].GetString("useexecutepath", "false").ToLower();
94 string useExecutePathString = startupSource.Configs["Startup"].GetString("useexecutepath", "false").ToLower();
95 bool useExecutePath = false; 95 bool useExecutePath = false;
96 if (useExecutePathString == "true" || useExecutePathString == "" || useExecutePathString == "1" || useExecutePathString == "yes") 96 if (useExecutePathString == "true" || useExecutePathString == "" || useExecutePathString == "1" || useExecutePathString == "yes")
97 { 97 {
@@ -104,46 +104,46 @@ namespace OpenSim
104 string iniFilePath = Path.Combine(Util.configDir(), iniFile); 104 string iniFilePath = Path.Combine(Util.configDir(), iniFile);
105 if (File.Exists(iniFilePath)) 105 if (File.Exists(iniFilePath))
106 { 106 {
107 startupSource = new IniConfigSource(iniFilePath); 107 m_config = new IniConfigSource(iniFilePath);
108 108
109 //enable following line, if we want the original config source(normally commandline args) merged with ini file settings. 109 //enable following line, if we want the original config source(normally commandline args) merged with ini file settings.
110 //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. 110 //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.
111 //(as if someone has bothered to enter a command line arg, we should take notice of it) 111 //(as if someone has bothered to enter a command line arg, we should take notice of it)
112 startupSource.Merge(configSource); 112 m_config.Merge(configSource);
113 } 113 }
114 114
115 ReadConfigSettings(startupSource); 115 ReadConfigSettings();
116 116
117 } 117 }
118 118
119 protected void ReadConfigSettings(IConfigSource configSource) 119 protected void ReadConfigSettings()
120 { 120 {
121 m_networkServersInfo = new NetworkServersInfo(); 121 m_networkServersInfo = new NetworkServersInfo();
122 m_sandbox = !configSource.Configs["Startup"].GetBoolean("gridmode", false); 122 m_sandbox = !m_config.Configs["Startup"].GetBoolean("gridmode", false);
123 m_physicsEngine = configSource.Configs["Startup"].GetString("physics", "basicphysics"); 123 m_physicsEngine = m_config.Configs["Startup"].GetString("physics", "basicphysics");
124 m_silent = configSource.Configs["Startup"].GetBoolean("noverbose", false); 124 m_silent = m_config.Configs["Startup"].GetBoolean("noverbose", false);
125 m_permissions = configSource.Configs["Startup"].GetBoolean("serverside_object_permissions", false); 125 m_permissions = m_config.Configs["Startup"].GetBoolean("serverside_object_permissions", false);
126 126
127 m_storageDLL = configSource.Configs["Startup"].GetString("storage_plugin", "OpenSim.DataStore.NullStorage.dll"); 127 m_storageDLL = m_config.Configs["Startup"].GetString("storage_plugin", "OpenSim.DataStore.NullStorage.dll");
128 128
129 m_startupCommandsFile = configSource.Configs["Startup"].GetString("startup_console_commands_file", ""); 129 m_startupCommandsFile = m_config.Configs["Startup"].GetString("startup_console_commands_file", "");
130 m_shutdownCommandsFile = configSource.Configs["Startup"].GetString("shutdown_console_commands_file", ""); 130 m_shutdownCommandsFile = m_config.Configs["Startup"].GetString("shutdown_console_commands_file", "");
131 131
132 m_scriptEngine = configSource.Configs["Startup"].GetString("script_engine", "DotNetEngine"); 132 m_scriptEngine = m_config.Configs["Startup"].GetString("script_engine", "DotNetEngine");
133 133
134 m_assetStorage = configSource.Configs["Startup"].GetString("asset_database", "db4o"); 134 m_assetStorage = m_config.Configs["Startup"].GetString("asset_database", "db4o");
135 135
136 configSource.Configs["Startup"].GetBoolean("default_modules", true); 136 m_config.Configs["Startup"].GetBoolean("default_modules", true);
137 configSource.Configs["Startup"].GetBoolean("default_shared_modules", true); 137 m_config.Configs["Startup"].GetBoolean("default_shared_modules", true);
138 configSource.Configs["Startup"].GetString("except_modules", ""); 138 m_config.Configs["Startup"].GetString("except_modules", "");
139 configSource.Configs["Startup"].GetString("except_shared_modules", ""); 139 m_config.Configs["Startup"].GetString("except_shared_modules", "");
140 140
141 standaloneAuthenticate = configSource.Configs["StandAlone"].GetBoolean("accounts_authenticate", false); 141 standaloneAuthenticate = m_config.Configs["StandAlone"].GetBoolean("accounts_authenticate", false);
142 standaloneWelcomeMessage = configSource.Configs["StandAlone"].GetString("welcome_message", "Welcome to OpenSim"); 142 standaloneWelcomeMessage = m_config.Configs["StandAlone"].GetString("welcome_message", "Welcome to OpenSim");
143 standaloneInventoryPlugin = configSource.Configs["StandAlone"].GetString("inventory_plugin", "OpenSim.Framework.Data.SQLite.dll"); 143 standaloneInventoryPlugin = m_config.Configs["StandAlone"].GetString("inventory_plugin", "OpenSim.Framework.Data.SQLite.dll");
144 standaloneUserPlugin = configSource.Configs["StandAlone"].GetString("userDatabase_plugin", "OpenSim.Framework.Data.DB4o.dll"); 144 standaloneUserPlugin = m_config.Configs["StandAlone"].GetString("userDatabase_plugin", "OpenSim.Framework.Data.DB4o.dll");
145 standaloneAssetPlugin = configSource.Configs["StandAlone"].GetString("asset_plugin", "OpenSim.Framework.Data.SQLite.dll"); 145 standaloneAssetPlugin = m_config.Configs["StandAlone"].GetString("asset_plugin", "OpenSim.Framework.Data.SQLite.dll");
146 m_networkServersInfo.loadFromConfiguration(configSource); 146 m_networkServersInfo.loadFromConfiguration(m_config);
147 } 147 }
148 148
149 149
@@ -207,7 +207,7 @@ namespace OpenSim
207 configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); 207 configFiles = Directory.GetFiles(regionConfigPath, "*.xml");
208 } 208 }
209 209
210 m_moduleLoader = new ModuleLoader( m_log ); 210 m_moduleLoader = new ModuleLoader( m_log, m_config );
211 MainLog.Instance.Verbose("Loading Shared Modules"); 211 MainLog.Instance.Verbose("Loading Shared Modules");
212 m_moduleLoader.LoadDefaultSharedModules(); 212 m_moduleLoader.LoadDefaultSharedModules();
213 213
diff --git a/OpenSim/Region/Environment/Interfaces/IRegionModule.cs b/OpenSim/Region/Environment/Interfaces/IRegionModule.cs
index e60c42b..808b94a 100644
--- a/OpenSim/Region/Environment/Interfaces/IRegionModule.cs
+++ b/OpenSim/Region/Environment/Interfaces/IRegionModule.cs
@@ -27,12 +27,13 @@
27*/ 27*/
28 28
29using OpenSim.Region.Environment.Scenes; 29using OpenSim.Region.Environment.Scenes;
30using Nini.Config;
30 31
31namespace OpenSim.Region.Environment.Interfaces 32namespace OpenSim.Region.Environment.Interfaces
32{ 33{
33 public interface IRegionModule 34 public interface IRegionModule
34 { 35 {
35 void Initialise(Scene scene); 36 void Initialise(Scene scene, IConfigSource source);
36 void PostInitialise(); 37 void PostInitialise();
37 void Close(); 38 void Close();
38 string Name { get; } 39 string Name { get; }
diff --git a/OpenSim/Region/Environment/ModuleLoader.cs b/OpenSim/Region/Environment/ModuleLoader.cs
index 69cc379..f88f9ac 100644
--- a/OpenSim/Region/Environment/ModuleLoader.cs
+++ b/OpenSim/Region/Environment/ModuleLoader.cs
@@ -1,202 +1,205 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.IO; 31using System.IO;
32using System.Reflection; 32using System.Reflection;
33using OpenSim.Framework.Console; 33using OpenSim.Framework.Console;
34using OpenSim.Region.Environment.Interfaces; 34using OpenSim.Region.Environment.Interfaces;
35using OpenSim.Region.Environment.Modules; 35using OpenSim.Region.Environment.Modules;
36using OpenSim.Region.Environment.Scenes; 36using OpenSim.Region.Environment.Scenes;
37 37using Nini.Config;
38namespace OpenSim.Region.Environment 38
39{ 39namespace OpenSim.Region.Environment
40 public class ModuleLoader 40{
41 { 41 public class ModuleLoader
42 public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>(); 42 {
43 43 public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>();
44 public List<IRegionModule> LoadedModules = new List<IRegionModule>(); 44
45 public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>(); 45 public List<IRegionModule> LoadedModules = new List<IRegionModule>();
46 private readonly LogBase m_log; 46 public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>();
47 47 private readonly LogBase m_log;
48 public ModuleLoader(LogBase log) 48 private IConfigSource m_config;
49 { 49
50 m_log = log; 50 public ModuleLoader(LogBase log, IConfigSource config)
51 } 51 {
52 52 m_log = log;
53 public void PickupModules(Scene scene, string moduleDir) 53 m_config = config;
54 { 54 }
55 DirectoryInfo dir = new DirectoryInfo(moduleDir); 55
56 56 public void PickupModules(Scene scene, string moduleDir)
57 foreach (FileInfo fileInfo in dir.GetFiles("*.dll")) 57 {
58 { 58 DirectoryInfo dir = new DirectoryInfo(moduleDir);
59 LoadRegionModules(fileInfo.FullName, scene); 59
60 } 60 foreach (FileInfo fileInfo in dir.GetFiles("*.dll"))
61 } 61 {
62 62 LoadRegionModules(fileInfo.FullName, scene);
63 public void LoadDefaultSharedModules() 63 }
64 { 64 }
65 DynamicTextureModule dynamicModule = new DynamicTextureModule(); 65
66 LoadedSharedModules.Add(dynamicModule.Name, dynamicModule); 66 public void LoadDefaultSharedModules()
67 } 67 {
68 68 DynamicTextureModule dynamicModule = new DynamicTextureModule();
69 public void InitialiseSharedModules(Scene scene) 69 LoadedSharedModules.Add(dynamicModule.Name, dynamicModule);
70 { 70 }
71 foreach (IRegionModule module in LoadedSharedModules.Values) 71
72 { 72 public void InitialiseSharedModules(Scene scene)
73 module.Initialise(scene); 73 {
74 scene.AddModule(module.Name, module); //should be doing this? 74 foreach (IRegionModule module in LoadedSharedModules.Values)
75 } 75 {
76 } 76 module.Initialise(scene, m_config);
77 77 scene.AddModule(module.Name, module); //should be doing this?
78 public void InitializeModule(IRegionModule module, Scene scene) 78 }
79 { 79 }
80 module.Initialise(scene); 80
81 scene.AddModule(module.Name, module); 81 public void InitializeModule(IRegionModule module, Scene scene)
82 LoadedModules.Add(module); 82 {
83 } 83 module.Initialise(scene, m_config);
84 84 scene.AddModule(module.Name, module);
85 /// <summary> 85 LoadedModules.Add(module);
86 /// Loads/initialises a Module instance that can be used by mutliple Regions 86 }
87 /// </summary> 87
88 /// <param name="dllName"></param> 88 /// <summary>
89 /// <param name="moduleName"></param> 89 /// Loads/initialises a Module instance that can be used by mutliple Regions
90 /// <param name="scene"></param> 90 /// </summary>
91 public void LoadSharedModule(string dllName, string moduleName) 91 /// <param name="dllName"></param>
92 { 92 /// <param name="moduleName"></param>
93 IRegionModule module = LoadModule(dllName, moduleName); 93 /// <param name="scene"></param>
94 if (module != null) 94 public void LoadSharedModule(string dllName, string moduleName)
95 { 95 {
96 LoadedSharedModules.Add(module.Name, module); 96 IRegionModule module = LoadModule(dllName, moduleName);
97 } 97 if (module != null)
98 } 98 {
99 99 LoadedSharedModules.Add(module.Name, module);
100 public void LoadRegionModules(string dllName, Scene scene) 100 }
101 { 101 }
102 IRegionModule[] modules = LoadModules(dllName); 102
103 103 public void LoadRegionModules(string dllName, Scene scene)
104 if (modules.Length > 0) 104 {
105 { 105 IRegionModule[] modules = LoadModules(dllName);
106 m_log.Verbose("MODULES", "Found Module Library [{0}]", dllName ); 106
107 foreach (IRegionModule module in modules) 107 if (modules.Length > 0)
108 { 108 {
109 m_log.Verbose("MODULES", " [{0}]: Initializing.", module.Name); 109 m_log.Verbose("MODULES", "Found Module Library [{0}]", dllName );
110 InitializeModule(module, scene); 110 foreach (IRegionModule module in modules)
111 } 111 {
112 } 112 m_log.Verbose("MODULES", " [{0}]: Initializing.", module.Name);
113 } 113 InitializeModule(module, scene);
114 114 }
115 public void LoadRegionModule(string dllName, string moduleName, Scene scene) 115 }
116 { 116 }
117 IRegionModule module = LoadModule(dllName, moduleName); 117
118 if (module != null) 118 public void LoadRegionModule(string dllName, string moduleName, Scene scene)
119 { 119 {
120 InitializeModule(module, scene); 120 IRegionModule module = LoadModule(dllName, moduleName);
121 } 121 if (module != null)
122 } 122 {
123 123 InitializeModule(module, scene);
124 /// <summary> 124 }
125 /// Loads a external Module (if not already loaded) and creates a new instance of it. 125 }
126 /// </summary> 126
127 /// <param name="dllName"></param> 127 /// <summary>
128 /// <param name="moduleName"></param> 128 /// Loads a external Module (if not already loaded) and creates a new instance of it.
129 /// <param name="scene"></param> 129 /// </summary>
130 public IRegionModule LoadModule(string dllName, string moduleName) 130 /// <param name="dllName"></param>
131 { 131 /// <param name="moduleName"></param>
132 IRegionModule[] modules = LoadModules(dllName); 132 /// <param name="scene"></param>
133 133 public IRegionModule LoadModule(string dllName, string moduleName)
134 foreach (IRegionModule module in modules) 134 {
135 { 135 IRegionModule[] modules = LoadModules(dllName);
136 if ((module != null) && (module.Name == moduleName)) 136
137 { 137 foreach (IRegionModule module in modules)
138 return module; 138 {
139 } 139 if ((module != null) && (module.Name == moduleName))
140 } 140 {
141 141 return module;
142 return null; 142 }
143 } 143 }
144 144
145 public IRegionModule[] LoadModules(string dllName) 145 return null;
146 { 146 }
147 List<IRegionModule> modules = new List<IRegionModule>(); 147
148 148 public IRegionModule[] LoadModules(string dllName)
149 Assembly pluginAssembly; 149 {
150 if (!LoadedAssemblys.TryGetValue(dllName, out pluginAssembly )) 150 List<IRegionModule> modules = new List<IRegionModule>();
151 { 151
152 try 152 Assembly pluginAssembly;
153 { 153 if (!LoadedAssemblys.TryGetValue(dllName, out pluginAssembly ))
154 pluginAssembly = Assembly.LoadFrom(dllName); 154 {
155 LoadedAssemblys.Add(dllName, pluginAssembly); 155 try
156 } 156 {
157 catch( BadImageFormatException e ) 157 pluginAssembly = Assembly.LoadFrom(dllName);
158 { 158 LoadedAssemblys.Add(dllName, pluginAssembly);
159 m_log.Warn( "MODULES", "The file [{0}] is not a module assembly.", e.FileName ); 159 }
160 } 160 catch( BadImageFormatException e )
161 } 161 {
162 162 m_log.Warn( "MODULES", "The file [{0}] is not a module assembly.", e.FileName );
163 163 }
164 if (pluginAssembly != null) 164 }
165 { 165
166 foreach (Type pluginType in pluginAssembly.GetTypes()) 166
167 { 167 if (pluginAssembly != null)
168 if (pluginType.IsPublic) 168 {
169 { 169 foreach (Type pluginType in pluginAssembly.GetTypes())
170 if (!pluginType.IsAbstract) 170 {
171 { 171 if (pluginType.IsPublic)
172 if( pluginType.GetInterface("IRegionModule") != null ) 172 {
173 { 173 if (!pluginType.IsAbstract)
174 modules.Add((IRegionModule) Activator.CreateInstance(pluginType)); 174 {
175 } 175 if( pluginType.GetInterface("IRegionModule") != null )
176 } 176 {
177 } 177 modules.Add((IRegionModule) Activator.CreateInstance(pluginType));
178 } 178 }
179 } 179 }
180 180 }
181 return modules.ToArray(); 181 }
182 } 182 }
183 183
184 public void PostInitialise() 184 return modules.ToArray();
185 { 185 }
186 foreach (IRegionModule module in LoadedSharedModules.Values) 186
187 { 187 public void PostInitialise()
188 module.PostInitialise(); 188 {
189 } 189 foreach (IRegionModule module in LoadedSharedModules.Values)
190 190 {
191 foreach (IRegionModule module in LoadedModules) 191 module.PostInitialise();
192 { 192 }
193 module.PostInitialise(); 193
194 } 194 foreach (IRegionModule module in LoadedModules)
195 } 195 {
196 196 module.PostInitialise();
197 public void ClearCache() 197 }
198 { 198 }
199 LoadedAssemblys.Clear(); 199
200 } 200 public void ClearCache()
201 } 201 {
202} 202 LoadedAssemblys.Clear();
203 }
204 }
205}
diff --git a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
index 417e3bc..b53c05e 100644
--- a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
+++ b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
@@ -29,6 +29,7 @@
29using OpenSim.Framework.Interfaces; 29using OpenSim.Framework.Interfaces;
30using OpenSim.Region.Environment.Interfaces; 30using OpenSim.Region.Environment.Interfaces;
31using OpenSim.Region.Environment.Scenes; 31using OpenSim.Region.Environment.Scenes;
32using Nini.Config;
32 33
33namespace OpenSim.Region.Environment.Modules 34namespace OpenSim.Region.Environment.Modules
34{ 35{
@@ -40,7 +41,7 @@ namespace OpenSim.Region.Environment.Modules
40 { 41 {
41 } 42 }
42 43
43 public void Initialise(Scene scene) 44 public void Initialise(Scene scene, IConfigSource config)
44 { 45 {
45 m_scene = scene; 46 m_scene = scene;
46 m_scene.EventManager.OnNewClient += NewClient; 47 m_scene.EventManager.OnNewClient += NewClient;
diff --git a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs
index 9c627df..4bdb61b 100644
--- a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs
+++ b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs
@@ -1,93 +1,94 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using libsecondlife; 29using libsecondlife;
30using OpenSim.Framework.Interfaces; 30using OpenSim.Framework.Interfaces;
31using OpenSim.Region.Environment.Interfaces; 31using OpenSim.Region.Environment.Interfaces;
32using OpenSim.Region.Environment.Scenes; 32using OpenSim.Region.Environment.Scenes;
33 33using Nini.Config;
34namespace OpenSim.Region.Environment.Modules 34
35{ 35namespace OpenSim.Region.Environment.Modules
36 public class AvatarProfilesModule : IRegionModule 36{
37 { 37 public class AvatarProfilesModule : IRegionModule
38 private Scene m_scene; 38 {
39 39 private Scene m_scene;
40 public AvatarProfilesModule() 40
41 { 41 public AvatarProfilesModule()
42 } 42 {
43 43 }
44 public void Initialise(Scene scene) 44
45 { 45 public void Initialise(Scene scene, IConfigSource config)
46 m_scene = scene; 46 {
47 m_scene.EventManager.OnNewClient += NewClient; 47 m_scene = scene;
48 } 48 m_scene.EventManager.OnNewClient += NewClient;
49 49 }
50 public void PostInitialise() 50
51 { 51 public void PostInitialise()
52 } 52 {
53 53 }
54 public void Close() 54
55 { 55 public void Close()
56 } 56 {
57 57 }
58 public string Name 58
59 { 59 public string Name
60 get { return "AvatarProfilesModule"; } 60 {
61 } 61 get { return "AvatarProfilesModule"; }
62 62 }
63 public bool IsSharedModule 63
64 { 64 public bool IsSharedModule
65 get { return false; } 65 {
66 } 66 get { return false; }
67 67 }
68 public void NewClient(IClientAPI client) 68
69 { 69 public void NewClient(IClientAPI client)
70 client.OnRequestAvatarProperties += RequestAvatarProperty; 70 {
71 } 71 client.OnRequestAvatarProperties += RequestAvatarProperty;
72 72 }
73 public void RemoveClient(IClientAPI client) 73
74 { 74 public void RemoveClient(IClientAPI client)
75 client.OnRequestAvatarProperties -= RequestAvatarProperty; 75 {
76 } 76 client.OnRequestAvatarProperties -= RequestAvatarProperty;
77 77 }
78 /// <summary> 78
79 /// 79 /// <summary>
80 /// </summary> 80 ///
81 /// <param name="remoteClient"></param> 81 /// </summary>
82 /// <param name="avatarID"></param> 82 /// <param name="remoteClient"></param>
83 public void RequestAvatarProperty(IClientAPI remoteClient, LLUUID avatarID) 83 /// <param name="avatarID"></param>
84 { 84 public void RequestAvatarProperty(IClientAPI remoteClient, LLUUID avatarID)
85 string about = "OpenSim crash test dummy"; 85 {
86 string bornOn = "Before now"; 86 string about = "OpenSim crash test dummy";
87 string flAbout = "First life? What is one of those? OpenSim is my life!"; 87 string bornOn = "Before now";
88 LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000"); 88 string flAbout = "First life? What is one of those? OpenSim is my life!";
89 remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "", 89 LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000");
90 partner); 90 remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "",
91 } 91 partner);
92 } 92 }
93} 93 }
94}
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs
index 6b8050e..a85a12c 100644
--- a/OpenSim/Region/Environment/Modules/ChatModule.cs
+++ b/OpenSim/Region/Environment/Modules/ChatModule.cs
@@ -1,242 +1,243 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
30using System.IO; 30using System.IO;
31using System.Net.Sockets; 31using System.Net.Sockets;
32using System.Threading; 32using System.Threading;
33using libsecondlife; 33using libsecondlife;
34using OpenSim.Framework.Interfaces; 34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Utilities; 35using OpenSim.Framework.Utilities;
36using OpenSim.Region.Environment.Interfaces; 36using OpenSim.Region.Environment.Interfaces;
37using OpenSim.Region.Environment.Scenes; 37using OpenSim.Region.Environment.Scenes;
38 38using Nini.Config;
39namespace OpenSim.Region.Environment.Modules 39
40{ 40namespace OpenSim.Region.Environment.Modules
41 public class ChatModule : IRegionModule, ISimChat 41{
42 { 42 public class ChatModule : IRegionModule, ISimChat
43 private Scene m_scene; 43 {
44 44 private Scene m_scene;
45 private string m_server = "irc2.choopa.net"; 45
46 46 private string m_server = "irc2.choopa.net";
47 // private int m_port = 6668; 47
48 //private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot"; 48 // private int m_port = 6668;
49 private string m_nick = "OSimBot"; 49 //private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot";
50 private string m_channel = "#opensim"; 50 private string m_nick = "OSimBot";
51 51 private string m_channel = "#opensim";
52 // private NetworkStream m_stream; 52
53 private TcpClient m_irc; 53 // private NetworkStream m_stream;
54 private StreamWriter m_ircWriter; 54 private TcpClient m_irc;
55 private StreamReader m_ircReader; 55 private StreamWriter m_ircWriter;
56 56 private StreamReader m_ircReader;
57 // private Thread pingSender; 57
58 // private Thread listener; 58 // private Thread pingSender;
59 59 // private Thread listener;
60 private bool connected = false; 60
61 61 private bool connected = false;
62 public ChatModule() 62
63 { 63 public ChatModule()
64 m_nick = "OSimBot" + Util.RandomClass.Next(1, 99); 64 {
65 m_irc = null; 65 m_nick = "OSimBot" + Util.RandomClass.Next(1, 99);
66 m_ircWriter = null; 66 m_irc = null;
67 m_ircReader = null; 67 m_ircWriter = null;
68 } 68 m_ircReader = null;
69 69 }
70 public void Initialise(Scene scene) 70
71 { 71 public void Initialise(Scene scene, IConfigSource config)
72 m_scene = scene; 72 {
73 m_scene.EventManager.OnNewClient += NewClient; 73 m_scene = scene;
74 74 m_scene.EventManager.OnNewClient += NewClient;
75 m_scene.RegisterModuleInterface<ISimChat>(this); 75
76 } 76 m_scene.RegisterModuleInterface<ISimChat>(this);
77 77 }
78 public void PostInitialise() 78
79 { 79 public void PostInitialise()
80 /* 80 {
81 try 81 /*
82 { 82 try
83 m_irc = new TcpClient(m_server, m_port); 83 {
84 m_stream = m_irc.GetStream(); 84 m_irc = new TcpClient(m_server, m_port);
85 m_ircReader = new StreamReader(m_stream); 85 m_stream = m_irc.GetStream();
86 m_ircWriter = new StreamWriter(m_stream); 86 m_ircReader = new StreamReader(m_stream);
87 87 m_ircWriter = new StreamWriter(m_stream);
88 pingSender = new Thread(new ThreadStart(this.PingRun)); 88
89 pingSender.Start(); 89 pingSender = new Thread(new ThreadStart(this.PingRun));
90 90 pingSender.Start();
91 listener = new Thread(new ThreadStart(this.ListenerRun)); 91
92 listener.Start(); 92 listener = new Thread(new ThreadStart(this.ListenerRun));
93 93 listener.Start();
94 m_ircWriter.WriteLine(m_user); 94
95 m_ircWriter.Flush(); 95 m_ircWriter.WriteLine(m_user);
96 m_ircWriter.WriteLine("NICK " + m_nick); 96 m_ircWriter.Flush();
97 m_ircWriter.Flush(); 97 m_ircWriter.WriteLine("NICK " + m_nick);
98 m_ircWriter.WriteLine("JOIN " + m_channel); 98 m_ircWriter.Flush();
99 m_ircWriter.Flush(); 99 m_ircWriter.WriteLine("JOIN " + m_channel);
100 connected = true; 100 m_ircWriter.Flush();
101 } 101 connected = true;
102 catch (Exception e) 102 }
103 { 103 catch (Exception e)
104 Console.WriteLine(e.ToString()); 104 {
105 } 105 Console.WriteLine(e.ToString());
106 */ 106 }
107 } 107 */
108 108 }
109 public void Close() 109
110 { 110 public void Close()
111 m_ircWriter.Close(); 111 {
112 m_ircReader.Close(); 112 m_ircWriter.Close();
113 m_irc.Close(); 113 m_ircReader.Close();
114 } 114 m_irc.Close();
115 115 }
116 public string Name 116
117 { 117 public string Name
118 get { return "ChatModule"; } 118 {
119 } 119 get { return "ChatModule"; }
120 120 }
121 public bool IsSharedModule 121
122 { 122 public bool IsSharedModule
123 get { return false; } 123 {
124 } 124 get { return false; }
125 125 }
126 public void NewClient(IClientAPI client) 126
127 { 127 public void NewClient(IClientAPI client)
128 client.OnChatFromViewer += SimChat; 128 {
129 } 129 client.OnChatFromViewer += SimChat;
130 130 }
131 public void PingRun() 131
132 { 132 public void PingRun()
133 while (true) 133 {
134 { 134 while (true)
135 m_ircWriter.WriteLine("PING :" + m_server); 135 {
136 m_ircWriter.Flush(); 136 m_ircWriter.WriteLine("PING :" + m_server);
137 Thread.Sleep(15000); 137 m_ircWriter.Flush();
138 } 138 Thread.Sleep(15000);
139 } 139 }
140 140 }
141 public void ListenerRun() 141
142 { 142 public void ListenerRun()
143 string inputLine; 143 {
144 LLVector3 pos = new LLVector3(128, 128, 20); 144 string inputLine;
145 while (true) 145 LLVector3 pos = new LLVector3(128, 128, 20);
146 { 146 while (true)
147 while ((inputLine = m_ircReader.ReadLine()) != null) 147 {
148 { 148 while ((inputLine = m_ircReader.ReadLine()) != null)
149 Console.WriteLine(inputLine); 149 {
150 if (inputLine.Contains(m_channel)) 150 Console.WriteLine(inputLine);
151 { 151 if (inputLine.Contains(m_channel))
152 string mess = inputLine.Substring(inputLine.IndexOf(m_channel)); 152 {
153 m_scene.Broadcast(delegate(IClientAPI client) 153 string mess = inputLine.Substring(inputLine.IndexOf(m_channel));
154 { 154 m_scene.Broadcast(delegate(IClientAPI client)
155 client.SendChatMessage( 155 {
156 Helpers.StringToField(mess), 255, pos, "IRC:", 156 client.SendChatMessage(
157 LLUUID.Zero); 157 Helpers.StringToField(mess), 255, pos, "IRC:",
158 }); 158 LLUUID.Zero);
159 } 159 });
160 } 160 }
161 } 161 }
162 } 162 }
163 163 }
164 public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, 164
165 LLUUID fromAgentID) 165 public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName,
166 { 166 LLUUID fromAgentID)
167 ScenePresence avatar = null; 167 {
168 avatar = m_scene.GetScenePresence(fromAgentID); 168 ScenePresence avatar = null;
169 if (avatar != null) 169 avatar = m_scene.GetScenePresence(fromAgentID);
170 { 170 if (avatar != null)
171 fromPos = avatar.AbsolutePosition; 171 {
172 fromName = avatar.Firstname + " " + avatar.Lastname; 172 fromPos = avatar.AbsolutePosition;
173 avatar = null; 173 fromName = avatar.Firstname + " " + avatar.Lastname;
174 } 174 avatar = null;
175 175 }
176 if (connected) 176
177 { 177 if (connected)
178 m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + ">: " + 178 {
179 Util.FieldToString(message)); 179 m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + ">: " +
180 m_ircWriter.Flush(); 180 Util.FieldToString(message));
181 } 181 m_ircWriter.Flush();
182 182 }
183 if (channel == 0) 183
184 { 184 if (channel == 0)
185 m_scene.ForEachScenePresence(delegate(ScenePresence presence) 185 {
186 { 186 m_scene.ForEachScenePresence(delegate(ScenePresence presence)
187 int dis = -1000; 187 {
188 188 int dis = -1000;
189 //err ??? the following code seems to be request a scenePresence when it already has a ref to it 189
190 avatar = m_scene.GetScenePresence(presence.ControllingClient.AgentId); 190 //err ??? the following code seems to be request a scenePresence when it already has a ref to it
191 if (avatar != null) 191 avatar = m_scene.GetScenePresence(presence.ControllingClient.AgentId);
192 { 192 if (avatar != null)
193 dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos); 193 {
194 } 194 dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos);
195 195 }
196 switch (type) 196
197 { 197 switch (type)
198 case 0: // Whisper 198 {
199 if ((dis < 10) && (dis > -10)) 199 case 0: // Whisper
200 { 200 if ((dis < 10) && (dis > -10))
201 //should change so the message is sent through the avatar rather than direct to the ClientView 201 {
202 presence.ControllingClient.SendChatMessage(message, 202 //should change so the message is sent through the avatar rather than direct to the ClientView
203 type, 203 presence.ControllingClient.SendChatMessage(message,
204 fromPos, 204 type,
205 fromName, 205 fromPos,
206 fromAgentID); 206 fromName,
207 } 207 fromAgentID);
208 break; 208 }
209 case 1: // Say 209 break;
210 if ((dis < 30) && (dis > -30)) 210 case 1: // Say
211 { 211 if ((dis < 30) && (dis > -30))
212 //Console.WriteLine("sending chat"); 212 {
213 presence.ControllingClient.SendChatMessage(message, 213 //Console.WriteLine("sending chat");
214 type, 214 presence.ControllingClient.SendChatMessage(message,
215 fromPos, 215 type,
216 fromName, 216 fromPos,
217 fromAgentID); 217 fromName,
218 } 218 fromAgentID);
219 break; 219 }
220 case 2: // Shout 220 break;
221 if ((dis < 100) && (dis > -100)) 221 case 2: // Shout
222 { 222 if ((dis < 100) && (dis > -100))
223 presence.ControllingClient.SendChatMessage(message, 223 {
224 type, 224 presence.ControllingClient.SendChatMessage(message,
225 fromPos, 225 type,
226 fromName, 226 fromPos,
227 fromAgentID); 227 fromName,
228 } 228 fromAgentID);
229 break; 229 }
230 230 break;
231 case 0xff: // Broadcast 231
232 presence.ControllingClient.SendChatMessage(message, type, 232 case 0xff: // Broadcast
233 fromPos, 233 presence.ControllingClient.SendChatMessage(message, type,
234 fromName, 234 fromPos,
235 fromAgentID); 235 fromName,
236 break; 236 fromAgentID);
237 } 237 break;
238 }); 238 }
239 } 239 });
240 } 240 }
241 } 241 }
242} 242 }
243}
diff --git a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs
index e776717..4e29977 100644
--- a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs
+++ b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs
@@ -1,190 +1,191 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using libsecondlife; 31using libsecondlife;
32using OpenSim.Framework.Types; 32using OpenSim.Framework.Types;
33using OpenSim.Framework.Utilities; 33using OpenSim.Framework.Utilities;
34using OpenSim.Region.Environment.Interfaces; 34using OpenSim.Region.Environment.Interfaces;
35using OpenSim.Region.Environment.Scenes; 35using OpenSim.Region.Environment.Scenes;
36 36using Nini.Config;
37namespace OpenSim.Region.Environment.Modules 37
38{ 38namespace OpenSim.Region.Environment.Modules
39 public class DynamicTextureModule : IRegionModule, IDynamicTextureManager 39{
40 { 40 public class DynamicTextureModule : IRegionModule, IDynamicTextureManager
41 private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>(); 41 {
42 42 private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
43 private Dictionary<string, IDynamicTextureRender> RenderPlugins = 43
44 new Dictionary<string, IDynamicTextureRender>(); 44 private Dictionary<string, IDynamicTextureRender> RenderPlugins =
45 45 new Dictionary<string, IDynamicTextureRender>();
46 private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>(); 46
47 47 private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>();
48 public void Initialise(Scene scene) 48
49 { 49 public void Initialise(Scene scene, IConfigSource config)
50 if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID)) 50 {
51 { 51 if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
52 RegisteredScenes.Add(scene.RegionInfo.RegionID, scene); 52 {
53 scene.RegisterModuleInterface<IDynamicTextureManager>(this); 53 RegisteredScenes.Add(scene.RegionInfo.RegionID, scene);
54 } 54 scene.RegisterModuleInterface<IDynamicTextureManager>(this);
55 } 55 }
56 56 }
57 public void PostInitialise() 57
58 { 58 public void PostInitialise()
59 } 59 {
60 60 }
61 public void Close() 61
62 { 62 public void Close()
63 } 63 {
64 64 }
65 public string Name 65
66 { 66 public string Name
67 get { return "DynamicTextureModule"; } 67 {
68 } 68 get { return "DynamicTextureModule"; }
69 69 }
70 public bool IsSharedModule 70
71 { 71 public bool IsSharedModule
72 get { return true; } 72 {
73 } 73 get { return true; }
74 74 }
75 public void RegisterRender(string handleType, IDynamicTextureRender render) 75
76 { 76 public void RegisterRender(string handleType, IDynamicTextureRender render)
77 if (!RenderPlugins.ContainsKey(handleType)) 77 {
78 { 78 if (!RenderPlugins.ContainsKey(handleType))
79 RenderPlugins.Add(handleType, render); 79 {
80 } 80 RenderPlugins.Add(handleType, render);
81 } 81 }
82 82 }
83 public void ReturnData(LLUUID id, byte[] data) 83
84 { 84 public void ReturnData(LLUUID id, byte[] data)
85 if (Updaters.ContainsKey(id)) 85 {
86 { 86 if (Updaters.ContainsKey(id))
87 DynamicTextureUpdater updater = Updaters[id]; 87 {
88 if (RegisteredScenes.ContainsKey(updater.SimUUID)) 88 DynamicTextureUpdater updater = Updaters[id];
89 { 89 if (RegisteredScenes.ContainsKey(updater.SimUUID))
90 Scene scene = RegisteredScenes[updater.SimUUID]; 90 {
91 updater.DataReceived(data, scene); 91 Scene scene = RegisteredScenes[updater.SimUUID];
92 } 92 updater.DataReceived(data, scene);
93 } 93 }
94 } 94 }
95 95 }
96 public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, 96
97 string extraParams, int updateTimer) 97 public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url,
98 { 98 string extraParams, int updateTimer)
99 if (RenderPlugins.ContainsKey(contentType)) 99 {
100 { 100 if (RenderPlugins.ContainsKey(contentType))
101 //Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType); 101 {
102 102 //Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType);
103 DynamicTextureUpdater updater = new DynamicTextureUpdater(); 103
104 updater.SimUUID = simID; 104 DynamicTextureUpdater updater = new DynamicTextureUpdater();
105 updater.PrimID = primID; 105 updater.SimUUID = simID;
106 updater.ContentType = contentType; 106 updater.PrimID = primID;
107 updater.Url = url; 107 updater.ContentType = contentType;
108 updater.UpdateTimer = updateTimer; 108 updater.Url = url;
109 updater.UpdaterID = LLUUID.Random(); 109 updater.UpdateTimer = updateTimer;
110 updater.Params = extraParams; 110 updater.UpdaterID = LLUUID.Random();
111 111 updater.Params = extraParams;
112 if (!Updaters.ContainsKey(updater.UpdaterID)) 112
113 { 113 if (!Updaters.ContainsKey(updater.UpdaterID))
114 Updaters.Add(updater.UpdaterID, updater); 114 {
115 } 115 Updaters.Add(updater.UpdaterID, updater);
116 116 }
117 RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams); 117
118 return updater.UpdaterID; 118 RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams);
119 } 119 return updater.UpdaterID;
120 return LLUUID.Zero; 120 }
121 } 121 return LLUUID.Zero;
122 122 }
123 public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, 123
124 string extraParams, int updateTimer) 124 public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data,
125 { 125 string extraParams, int updateTimer)
126 if (RenderPlugins.ContainsKey(contentType)) 126 {
127 { 127 if (RenderPlugins.ContainsKey(contentType))
128 DynamicTextureUpdater updater = new DynamicTextureUpdater(); 128 {
129 updater.SimUUID = simID; 129 DynamicTextureUpdater updater = new DynamicTextureUpdater();
130 updater.PrimID = primID; 130 updater.SimUUID = simID;
131 updater.ContentType = contentType; 131 updater.PrimID = primID;
132 updater.BodyData = data; 132 updater.ContentType = contentType;
133 updater.UpdateTimer = updateTimer; 133 updater.BodyData = data;
134 updater.UpdaterID = LLUUID.Random(); 134 updater.UpdateTimer = updateTimer;
135 updater.Params = extraParams; 135 updater.UpdaterID = LLUUID.Random();
136 136 updater.Params = extraParams;
137 if (!Updaters.ContainsKey(updater.UpdaterID)) 137
138 { 138 if (!Updaters.ContainsKey(updater.UpdaterID))
139 Updaters.Add(updater.UpdaterID, updater); 139 {
140 } 140 Updaters.Add(updater.UpdaterID, updater);
141 141 }
142 RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams); 142
143 return updater.UpdaterID; 143 RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams);
144 } 144 return updater.UpdaterID;
145 return LLUUID.Zero; 145 }
146 } 146 return LLUUID.Zero;
147 147 }
148 public class DynamicTextureUpdater 148
149 { 149 public class DynamicTextureUpdater
150 public LLUUID SimUUID; 150 {
151 public LLUUID UpdaterID; 151 public LLUUID SimUUID;
152 public string ContentType; 152 public LLUUID UpdaterID;
153 public string Url; 153 public string ContentType;
154 public string BodyData; 154 public string Url;
155 public LLUUID PrimID; 155 public string BodyData;
156 public int UpdateTimer; 156 public LLUUID PrimID;
157 public LLUUID LastAssetID; 157 public int UpdateTimer;
158 public string Params; 158 public LLUUID LastAssetID;
159 159 public string Params;
160 public DynamicTextureUpdater() 160
161 { 161 public DynamicTextureUpdater()
162 LastAssetID = LLUUID.Zero; 162 {
163 UpdateTimer = 0; 163 LastAssetID = LLUUID.Zero;
164 BodyData = null; 164 UpdateTimer = 0;
165 } 165 BodyData = null;
166 166 }
167 public void DataReceived(byte[] data, Scene scene) 167
168 { 168 public void DataReceived(byte[] data, Scene scene)
169 //TODO delete the last asset(data), if it was a dynamic texture 169 {
170 byte[] assetData = new byte[data.Length]; 170 //TODO delete the last asset(data), if it was a dynamic texture
171 Array.Copy(data, assetData, data.Length); 171 byte[] assetData = new byte[data.Length];
172 AssetBase asset = new AssetBase(); 172 Array.Copy(data, assetData, data.Length);
173 asset.FullID = LLUUID.Random(); 173 AssetBase asset = new AssetBase();
174 asset.Data = assetData; 174 asset.FullID = LLUUID.Random();
175 asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); 175 asset.Data = assetData;
176 asset.Type = 0; 176 asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000);
177 asset.Description = "dynamic image"; 177 asset.Type = 0;
178 asset.Local = false; 178 asset.Description = "dynamic image";
179 asset.Temporary = false; 179 asset.Local = false;
180 scene.commsManager.AssetCache.AddAsset(asset); 180 asset.Temporary = false;
181 181 scene.commsManager.AssetCache.AddAsset(asset);
182 LastAssetID = asset.FullID; 182
183 183 LastAssetID = asset.FullID;
184 SceneObjectPart part = scene.GetSceneObjectPart(PrimID); 184
185 part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes(); 185 SceneObjectPart part = scene.GetSceneObjectPart(PrimID);
186 part.ScheduleFullUpdate(); 186 part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes();
187 } 187 part.ScheduleFullUpdate();
188 } 188 }
189 } 189 }
190} 190 }
191}
diff --git a/OpenSim/Region/Environment/Modules/FriendsModule.cs b/OpenSim/Region/Environment/Modules/FriendsModule.cs
index 1b51d9e..9144bee 100644
--- a/OpenSim/Region/Environment/Modules/FriendsModule.cs
+++ b/OpenSim/Region/Environment/Modules/FriendsModule.cs
@@ -1,61 +1,62 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using OpenSim.Region.Environment.Interfaces; 29using OpenSim.Region.Environment.Interfaces;
30using OpenSim.Region.Environment.Scenes; 30using OpenSim.Region.Environment.Scenes;
31 31using Nini.Config;
32namespace OpenSim.Region.Environment.Modules 32
33{ 33namespace OpenSim.Region.Environment.Modules
34 public class FriendsModule : IRegionModule 34{
35 { 35 public class FriendsModule : IRegionModule
36 private Scene m_scene; 36 {
37 37 private Scene m_scene;
38 public void Initialise(Scene scene) 38
39 { 39 public void Initialise(Scene scene, IConfigSource config)
40 m_scene = scene; 40 {
41 } 41 m_scene = scene;
42 42 }
43 public void PostInitialise() 43
44 { 44 public void PostInitialise()
45 } 45 {
46 46 }
47 public void Close() 47
48 { 48 public void Close()
49 } 49 {
50 50 }
51 public string Name 51
52 { 52 public string Name
53 get { return "FriendsModule"; } 53 {
54 } 54 get { return "FriendsModule"; }
55 55 }
56 public bool IsSharedModule 56
57 { 57 public bool IsSharedModule
58 get { return false; } 58 {
59 } 59 get { return false; }
60 } 60 }
61} 61 }
62}
diff --git a/OpenSim/Region/Environment/Modules/GroupsModule.cs b/OpenSim/Region/Environment/Modules/GroupsModule.cs
index a024ccd..150f294 100644
--- a/OpenSim/Region/Environment/Modules/GroupsModule.cs
+++ b/OpenSim/Region/Environment/Modules/GroupsModule.cs
@@ -1,61 +1,62 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using OpenSim.Region.Environment.Interfaces; 29using OpenSim.Region.Environment.Interfaces;
30using OpenSim.Region.Environment.Scenes; 30using OpenSim.Region.Environment.Scenes;
31 31using Nini.Config;
32namespace OpenSim.Region.Environment.Modules 32
33{ 33namespace OpenSim.Region.Environment.Modules
34 public class GroupsModule : IRegionModule 34{
35 { 35 public class GroupsModule : IRegionModule
36 private Scene m_scene; 36 {
37 37 private Scene m_scene;
38 public void Initialise(Scene scene) 38
39 { 39 public void Initialise(Scene scene, IConfigSource config)
40 m_scene = scene; 40 {
41 } 41 m_scene = scene;
42 42 }
43 public void PostInitialise() 43
44 { 44 public void PostInitialise()
45 } 45 {
46 46 }
47 public void Close() 47
48 { 48 public void Close()
49 } 49 {
50 50 }
51 public string Name 51
52 { 52 public string Name
53 get { return "GroupsModule"; } 53 {
54 } 54 get { return "GroupsModule"; }
55 55 }
56 public bool IsSharedModule 56
57 { 57 public bool IsSharedModule
58 get { return false; } 58 {
59 } 59 get { return false; }
60 } 60 }
61} 61 }
62}
diff --git a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
index dbd2434..7c4e2c8 100644
--- a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
+++ b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
@@ -1,100 +1,101 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenSim.Region.Environment.Interfaces; 30using OpenSim.Region.Environment.Interfaces;
31using OpenSim.Region.Environment.Scenes; 31using OpenSim.Region.Environment.Scenes;
32using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
33 33using Nini.Config;
34namespace OpenSim.Region.Environment.Modules 34
35{ 35namespace OpenSim.Region.Environment.Modules
36 public class InstantMessageModule : IRegionModule 36{
37 { 37 public class InstantMessageModule : IRegionModule
38 private List<Scene> m_scenes = new List<Scene>(); 38 {
39 private LogBase m_log; 39 private List<Scene> m_scenes = new List<Scene>();
40 40 private LogBase m_log;
41 public void Initialise(Scene scene) 41
42 { 42 public void Initialise(Scene scene, IConfigSource config)
43 if (!m_scenes.Contains(scene)) 43 {
44 { 44 if (!m_scenes.Contains(scene))
45 m_scenes.Add(scene); 45 {
46 46 m_scenes.Add(scene);
47 scene.EventManager.OnNewClient += OnNewClient; 47
48 m_log = OpenSim.Framework.Console.MainLog.Instance; 48 scene.EventManager.OnNewClient += OnNewClient;
49 } 49 m_log = OpenSim.Framework.Console.MainLog.Instance;
50 } 50 }
51 51 }
52 void OnNewClient(OpenSim.Framework.Interfaces.IClientAPI client) 52
53 { 53 void OnNewClient(OpenSim.Framework.Interfaces.IClientAPI client)
54 client.OnInstantMessage += OnInstantMessage; 54 {
55 } 55 client.OnInstantMessage += OnInstantMessage;
56 56 }
57 void OnInstantMessage(libsecondlife.LLUUID fromAgentID, 57
58 libsecondlife.LLUUID fromAgentSession, libsecondlife.LLUUID toAgentID, 58 void OnInstantMessage(libsecondlife.LLUUID fromAgentID,
59 libsecondlife.LLUUID imSessionID, uint timestamp, string fromAgentName, 59 libsecondlife.LLUUID fromAgentSession, libsecondlife.LLUUID toAgentID,
60 string message, byte dialog) 60 libsecondlife.LLUUID imSessionID, uint timestamp, string fromAgentName,
61 { 61 string message, byte dialog)
62 // TODO: Remove after debugging. Privacy implications. 62 {
63 m_log.Verbose("IM",fromAgentName + ": " + message); 63 // TODO: Remove after debugging. Privacy implications.
64 64 m_log.Verbose("IM",fromAgentName + ": " + message);
65 foreach (Scene m_scene in m_scenes) 65
66 { 66 foreach (Scene m_scene in m_scenes)
67 if (m_scene.Entities.ContainsKey(toAgentID) && m_scene.Entities[toAgentID] is ScenePresence) 67 {
68 { 68 if (m_scene.Entities.ContainsKey(toAgentID) && m_scene.Entities[toAgentID] is ScenePresence)
69 // Local Message 69 {
70 ScenePresence user = (ScenePresence)m_scene.Entities[toAgentID]; 70 // Local Message
71 user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, 71 ScenePresence user = (ScenePresence)m_scene.Entities[toAgentID];
72 toAgentID, imSessionID, user.Firstname + " " + user.Lastname, dialog, timestamp); 72 user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message,
73 73 toAgentID, imSessionID, user.Firstname + " " + user.Lastname, dialog, timestamp);
74 // Message sent 74
75 return; 75 // Message sent
76 } 76 return;
77 } 77 }
78 78 }
79 // Still here, try send via Grid 79
80 } 80 // Still here, try send via Grid
81 81 }
82 public void PostInitialise() 82
83 { 83 public void PostInitialise()
84 } 84 {
85 85 }
86 public void Close() 86
87 { 87 public void Close()
88 } 88 {
89 89 }
90 public string Name 90
91 { 91 public string Name
92 get { return "InstantMessageModule"; } 92 {
93 } 93 get { return "InstantMessageModule"; }
94 94 }
95 public bool IsSharedModule 95
96 { 96 public bool IsSharedModule
97 get { return true; } 97 {
98 } 98 get { return true; }
99 } 99 }
100} 100 }
101}
diff --git a/OpenSim/Region/Environment/Modules/InventoryModule.cs b/OpenSim/Region/Environment/Modules/InventoryModule.cs
index d3b90c2..3f8cd6e 100644
--- a/OpenSim/Region/Environment/Modules/InventoryModule.cs
+++ b/OpenSim/Region/Environment/Modules/InventoryModule.cs
@@ -1,61 +1,62 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using OpenSim.Region.Environment.Interfaces; 29using OpenSim.Region.Environment.Interfaces;
30using OpenSim.Region.Environment.Scenes; 30using OpenSim.Region.Environment.Scenes;
31 31using Nini.Config;
32namespace OpenSim.Region.Environment.Modules 32
33{ 33namespace OpenSim.Region.Environment.Modules
34 public class InventoryModule : IRegionModule 34{
35 { 35 public class InventoryModule : IRegionModule
36 private Scene m_scene; 36 {
37 37 private Scene m_scene;
38 public void Initialise(Scene scene) 38
39 { 39 public void Initialise(Scene scene, IConfigSource config)
40 m_scene = scene; 40 {
41 } 41 m_scene = scene;
42 42 }
43 public void PostInitialise() 43
44 { 44 public void PostInitialise()
45 } 45 {
46 46 }
47 public void Close() 47
48 { 48 public void Close()
49 } 49 {
50 50 }
51 public string Name 51
52 { 52 public string Name
53 get { return "InventoryModule"; } 53 {
54 } 54 get { return "InventoryModule"; }
55 55 }
56 public bool IsSharedModule 56
57 { 57 public bool IsSharedModule
58 get { return false; } 58 {
59 } 59 get { return false; }
60 } 60 }
61} 61 }
62}
diff --git a/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs b/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs
index f1f479d..8b8b386 100644
--- a/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs
+++ b/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs
@@ -1,123 +1,124 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using System.Net; 4using System.Net;
5using System.IO; 5using System.IO;
6using System.Drawing; 6using System.Drawing;
7using libsecondlife; 7using libsecondlife;
8using OpenJPEGNet; 8using OpenJPEGNet;
9using OpenSim.Region.Environment.Scenes; 9using OpenSim.Region.Environment.Scenes;
10using OpenSim.Region.Environment.Interfaces; 10using OpenSim.Region.Environment.Interfaces;
11 11using Nini.Config;
12namespace OpenSim.Region.Environment.Modules 12
13{ 13namespace OpenSim.Region.Environment.Modules
14 public class LoadImageURLModule : IRegionModule , IDynamicTextureRender 14{
15 { 15 public class LoadImageURLModule : IRegionModule , IDynamicTextureRender
16 private string m_name = "LoadImageURL"; 16 {
17 private IDynamicTextureManager m_textureManager; 17 private string m_name = "LoadImageURL";
18 private Scene m_scene; 18 private IDynamicTextureManager m_textureManager;
19 19 private Scene m_scene;
20 public void Initialise(Scene scene) 20
21 { 21 public void Initialise(Scene scene, IConfigSource config)
22 if (m_scene == null) 22 {
23 { 23 if (m_scene == null)
24 m_scene = scene; 24 {
25 } 25 m_scene = scene;
26 } 26 }
27 27 }
28 public void PostInitialise() 28
29 { 29 public void PostInitialise()
30 m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); 30 {
31 m_textureManager.RegisterRender(GetContentType(), this); 31 m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>();
32 } 32 m_textureManager.RegisterRender(GetContentType(), this);
33 33 }
34 public void Close() 34
35 { 35 public void Close()
36 } 36 {
37 37 }
38 public string Name 38
39 { 39 public string Name
40 get { return m_name; } 40 {
41 } 41 get { return m_name; }
42 42 }
43 public bool IsSharedModule 43
44 { 44 public bool IsSharedModule
45 get { return true; } 45 {
46 } 46 get { return true; }
47 47 }
48 public string GetName() 48
49 { 49 public string GetName()
50 return m_name; 50 {
51 } 51 return m_name;
52 52 }
53 public string GetContentType() 53
54 { 54 public string GetContentType()
55 return ("image"); 55 {
56 } 56 return ("image");
57 57 }
58 public bool SupportsAsynchronous() 58
59 { 59 public bool SupportsAsynchronous()
60 return true; 60 {
61 } 61 return true;
62 62 }
63 public byte[] ConvertUrl(string url, string extraParams) 63
64 { 64 public byte[] ConvertUrl(string url, string extraParams)
65 return null; 65 {
66 } 66 return null;
67 67 }
68 public byte[] ConvertStream(Stream data, string extraParams) 68
69 { 69 public byte[] ConvertStream(Stream data, string extraParams)
70 return null; 70 {
71 } 71 return null;
72 72 }
73 public bool AsyncConvertUrl(LLUUID id, string url, string extraParams) 73
74 { 74 public bool AsyncConvertUrl(LLUUID id, string url, string extraParams)
75 MakeHttpRequest(url, id); 75 {
76 return true; 76 MakeHttpRequest(url, id);
77 } 77 return true;
78 78 }
79 public bool AsyncConvertData(LLUUID id, string bodyData, string extraParams) 79
80 { 80 public bool AsyncConvertData(LLUUID id, string bodyData, string extraParams)
81 return false; 81 {
82 } 82 return false;
83 83 }
84 private void MakeHttpRequest(string url, LLUUID requestID) 84
85 { 85 private void MakeHttpRequest(string url, LLUUID requestID)
86 WebRequest request = HttpWebRequest.Create(url); 86 {
87 RequestState state = new RequestState((HttpWebRequest)request, requestID); 87 WebRequest request = HttpWebRequest.Create(url);
88 IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state); 88 RequestState state = new RequestState((HttpWebRequest)request, requestID);
89 89 IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state);
90 TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1)); 90
91 state.TimeOfRequest = (int)t.TotalSeconds; 91 TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1));
92 } 92 state.TimeOfRequest = (int)t.TotalSeconds;
93 93 }
94 private void HttpRequestReturn(IAsyncResult result) 94
95 { 95 private void HttpRequestReturn(IAsyncResult result)
96 RequestState state = (RequestState)result.AsyncState; 96 {
97 WebRequest request = (WebRequest)state.Request; 97 RequestState state = (RequestState)result.AsyncState;
98 HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result); 98 WebRequest request = (WebRequest)state.Request;
99 if (response.StatusCode == HttpStatusCode.OK) 99 HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result);
100 { 100 if (response.StatusCode == HttpStatusCode.OK)
101 Bitmap image = new Bitmap(response.GetResponseStream()); 101 {
102 Bitmap resize = new Bitmap(image, new Size(512, 512)); 102 Bitmap image = new Bitmap(response.GetResponseStream());
103 byte[] imageJ2000 = OpenJPEG.EncodeFromImage(resize, true); 103 Bitmap resize = new Bitmap(image, new Size(512, 512));
104 104 byte[] imageJ2000 = OpenJPEG.EncodeFromImage(resize, true);
105 m_textureManager.ReturnData(state.RequestID, imageJ2000); 105
106 } 106 m_textureManager.ReturnData(state.RequestID, imageJ2000);
107 } 107 }
108 108 }
109 public class RequestState 109
110 { 110 public class RequestState
111 public HttpWebRequest Request = null; 111 {
112 public LLUUID RequestID = LLUUID.Zero; 112 public HttpWebRequest Request = null;
113 public int TimeOfRequest = 0; 113 public LLUUID RequestID = LLUUID.Zero;
114 114 public int TimeOfRequest = 0;
115 public RequestState(HttpWebRequest request, LLUUID requestID) 115
116 { 116 public RequestState(HttpWebRequest request, LLUUID requestID)
117 Request = request; 117 {
118 RequestID = requestID; 118 Request = request;
119 } 119 RequestID = requestID;
120 } 120 }
121 121 }
122 } 122
123} 123 }
124}
diff --git a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
index 2531265..d3297c8 100644
--- a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
+++ b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
@@ -1,76 +1,77 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using libsecondlife; 29using libsecondlife;
30using OpenSim.Framework.Interfaces; 30using OpenSim.Framework.Interfaces;
31using OpenSim.Region.Environment.Interfaces; 31using OpenSim.Region.Environment.Interfaces;
32using OpenSim.Region.Environment.Scenes; 32using OpenSim.Region.Environment.Scenes;
33 33using Nini.Config;
34namespace OpenSim.Region.Environment.Modules 34
35{ 35namespace OpenSim.Region.Environment.Modules
36 public class TextureDownloadModule : IRegionModule 36{
37 { 37 public class TextureDownloadModule : IRegionModule
38 private Scene m_scene; 38 {
39 39 private Scene m_scene;
40 public TextureDownloadModule() 40
41 { 41 public TextureDownloadModule()
42 } 42 {
43 43 }
44 public void Initialise(Scene scene) 44
45 { 45 public void Initialise(Scene scene, IConfigSource config)
46 m_scene = scene; 46 {
47 m_scene.EventManager.OnNewClient += NewClient; 47 m_scene = scene;
48 } 48 m_scene.EventManager.OnNewClient += NewClient;
49 49 }
50 public void PostInitialise() 50
51 { 51 public void PostInitialise()
52 } 52 {
53 53 }
54 public void Close() 54
55 { 55 public void Close()
56 } 56 {
57 57 }
58 public string Name 58
59 { 59 public string Name
60 get { return "TextureDownloadModule"; } 60 {
61 } 61 get { return "TextureDownloadModule"; }
62 62 }
63 public bool IsSharedModule 63
64 { 64 public bool IsSharedModule
65 get { return false; } 65 {
66 } 66 get { return false; }
67 67 }
68 public void NewClient(IClientAPI client) 68
69 { 69 public void NewClient(IClientAPI client)
70 } 70 {
71 71 }
72 public void TextureAssetCallback(LLUUID texture, byte[] data) 72
73 { 73 public void TextureAssetCallback(LLUUID texture, byte[] data)
74 } 74 {
75 } 75 }
76} 76 }
77}
diff --git a/OpenSim/Region/Environment/Modules/WorldCommModule.cs b/OpenSim/Region/Environment/Modules/WorldCommModule.cs
index 994d07e..765f1b4 100644
--- a/OpenSim/Region/Environment/Modules/WorldCommModule.cs
+++ b/OpenSim/Region/Environment/Modules/WorldCommModule.cs
@@ -40,6 +40,7 @@ using OpenSim.Framework.Servers;
40using Nwc.XmlRpc; 40using Nwc.XmlRpc;
41using System.Collections; 41using System.Collections;
42using System.Collections.Generic; 42using System.Collections.Generic;
43using Nini.Config;
43 44
44/***************************************************** 45/*****************************************************
45 * 46 *
@@ -84,7 +85,7 @@ namespace OpenSim.Region.Environment.Modules
84 { 85 {
85 } 86 }
86 87
87 public void Initialise(Scene scene) 88 public void Initialise(Scene scene, IConfigSource config)
88 { 89 {
89 90
90 m_scene = scene; 91 m_scene = scene;
diff --git a/OpenSim/Region/Environment/Modules/XMLRPCModule.cs b/OpenSim/Region/Environment/Modules/XMLRPCModule.cs
index 941d3c1..3a5b3c6 100644
--- a/OpenSim/Region/Environment/Modules/XMLRPCModule.cs
+++ b/OpenSim/Region/Environment/Modules/XMLRPCModule.cs
@@ -39,6 +39,7 @@ using OpenSim.Framework.Servers;
39using Nwc.XmlRpc; 39using Nwc.XmlRpc;
40using System.Collections; 40using System.Collections;
41using System.Collections.Generic; 41using System.Collections.Generic;
42using Nini.Config;
42 43
43/***************************************************** 44/*****************************************************
44 * 45 *
@@ -93,7 +94,7 @@ namespace OpenSim.Region.Environment.Modules
93 { 94 {
94 } 95 }
95 96
96 public void Initialise(Scene scene) 97 public void Initialise(Scene scene, IConfigSource config)
97 { 98 {
98 m_scene = scene; 99 m_scene = scene;
99 100
diff --git a/OpenSim/Region/Environment/Modules/XferModule.cs b/OpenSim/Region/Environment/Modules/XferModule.cs
index 7bc831f..2adb1c9 100644
--- a/OpenSim/Region/Environment/Modules/XferModule.cs
+++ b/OpenSim/Region/Environment/Modules/XferModule.cs
@@ -1,201 +1,202 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using libsecondlife; 31using libsecondlife;
32using OpenSim.Framework.Interfaces; 32using OpenSim.Framework.Interfaces;
33using OpenSim.Region.Environment.Interfaces; 33using OpenSim.Region.Environment.Interfaces;
34using OpenSim.Region.Environment.Scenes; 34using OpenSim.Region.Environment.Scenes;
35 35using Nini.Config;
36namespace OpenSim.Region.Environment.Modules 36
37{ 37namespace OpenSim.Region.Environment.Modules
38 public class XferModule : IRegionModule, IXfer 38{
39 { 39 public class XferModule : IRegionModule, IXfer
40 public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>(); 40 {
41 public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>(); 41 public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>();
42 42 public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>();
43 private Scene m_scene; 43
44 44 private Scene m_scene;
45 public XferModule() 45
46 { 46 public XferModule()
47 } 47 {
48 48 }
49 public void Initialise(Scene scene) 49
50 { 50 public void Initialise(Scene scene, IConfigSource config)
51 m_scene = scene; 51 {
52 m_scene.EventManager.OnNewClient += NewClient; 52 m_scene = scene;
53 53 m_scene.EventManager.OnNewClient += NewClient;
54 m_scene.RegisterModuleInterface<IXfer>(this); 54
55 } 55 m_scene.RegisterModuleInterface<IXfer>(this);
56 56 }
57 public void PostInitialise() 57
58 { 58 public void PostInitialise()
59 } 59 {
60 60 }
61 public void Close() 61
62 { 62 public void Close()
63 } 63 {
64 64 }
65 public string Name 65
66 { 66 public string Name
67 get { return "XferModule"; } 67 {
68 } 68 get { return "XferModule"; }
69 69 }
70 public bool IsSharedModule 70
71 { 71 public bool IsSharedModule
72 get { return false; } 72 {
73 } 73 get { return false; }
74 74 }
75 public void NewClient(IClientAPI client) 75
76 { 76 public void NewClient(IClientAPI client)
77 client.OnRequestXfer += RequestXfer; 77 {
78 client.OnConfirmXfer += AckPacket; 78 client.OnRequestXfer += RequestXfer;
79 } 79 client.OnConfirmXfer += AckPacket;
80 80 }
81 /// <summary> 81
82 /// 82 /// <summary>
83 /// </summary> 83 ///
84 /// <param name="remoteClient"></param> 84 /// </summary>
85 /// <param name="xferID"></param> 85 /// <param name="remoteClient"></param>
86 /// <param name="fileName"></param> 86 /// <param name="xferID"></param>
87 public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName) 87 /// <param name="fileName"></param>
88 { 88 public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName)
89 lock (NewFiles) 89 {
90 { 90 lock (NewFiles)
91 if (NewFiles.ContainsKey(fileName)) 91 {
92 { 92 if (NewFiles.ContainsKey(fileName))
93 if (!Transfers.ContainsKey(xferID)) 93 {
94 { 94 if (!Transfers.ContainsKey(xferID))
95 byte[] fileData = NewFiles[fileName]; 95 {
96 XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient); 96 byte[] fileData = NewFiles[fileName];
97 Transfers.Add(xferID, transaction); 97 XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient);
98 NewFiles.Remove(fileName); 98 Transfers.Add(xferID, transaction);
99 transaction.StartSend(); 99 NewFiles.Remove(fileName);
100 } 100 transaction.StartSend();
101 } 101 }
102 } 102 }
103 } 103 }
104 104 }
105 public void AckPacket(IClientAPI remoteClient, ulong xferID, uint packet) 105
106 { 106 public void AckPacket(IClientAPI remoteClient, ulong xferID, uint packet)
107 if (Transfers.ContainsKey(xferID)) 107 {
108 { 108 if (Transfers.ContainsKey(xferID))
109 Transfers[xferID].AckPacket(packet); 109 {
110 } 110 Transfers[xferID].AckPacket(packet);
111 } 111 }
112 112 }
113 public bool AddNewFile(string fileName, byte[] data) 113
114 { 114 public bool AddNewFile(string fileName, byte[] data)
115 lock (NewFiles) 115 {
116 { 116 lock (NewFiles)
117 if (NewFiles.ContainsKey(fileName)) 117 {
118 { 118 if (NewFiles.ContainsKey(fileName))
119 NewFiles[fileName] = data; 119 {
120 } 120 NewFiles[fileName] = data;
121 else 121 }
122 { 122 else
123 NewFiles.Add(fileName, data); 123 {
124 } 124 NewFiles.Add(fileName, data);
125 } 125 }
126 return true; 126 }
127 } 127 return true;
128 128 }
129 129
130 public class XferDownLoad 130
131 { 131 public class XferDownLoad
132 public byte[] Data = new byte[0]; 132 {
133 public string FileName = ""; 133 public byte[] Data = new byte[0];
134 public ulong XferID = 0; 134 public string FileName = "";
135 public int DataPointer = 0; 135 public ulong XferID = 0;
136 public uint Packet = 0; 136 public int DataPointer = 0;
137 public IClientAPI Client; 137 public uint Packet = 0;
138 public uint Serial = 1; 138 public IClientAPI Client;
139 private bool complete = false; 139 public uint Serial = 1;
140 140 private bool complete = false;
141 public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client) 141
142 { 142 public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client)
143 FileName = fileName; 143 {
144 Data = data; 144 FileName = fileName;
145 XferID = xferID; 145 Data = data;
146 Client = client; 146 XferID = xferID;
147 } 147 Client = client;
148 148 }
149 public XferDownLoad() 149
150 { 150 public XferDownLoad()
151 } 151 {
152 152 }
153 public void StartSend() 153
154 { 154 public void StartSend()
155 if (Data.Length < 1000) 155 {
156 { 156 if (Data.Length < 1000)
157 // for now (testing ) we only support files under 1000 bytes 157 {
158 byte[] transferData = new byte[Data.Length + 4]; 158 // for now (testing ) we only support files under 1000 bytes
159 Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4); 159 byte[] transferData = new byte[Data.Length + 4];
160 Array.Copy(Data, 0, transferData, 4, Data.Length); 160 Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4);
161 Client.SendXferPacket(XferID, 0 + 0x80000000, transferData); 161 Array.Copy(Data, 0, transferData, 4, Data.Length);
162 complete = true; 162 Client.SendXferPacket(XferID, 0 + 0x80000000, transferData);
163 } 163 complete = true;
164 else 164 }
165 { 165 else
166 byte[] transferData = new byte[1000 + 4]; 166 {
167 Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4); 167 byte[] transferData = new byte[1000 + 4];
168 Array.Copy(Data, 0, transferData, 4, 1000); 168 Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4);
169 Client.SendXferPacket(XferID, 0, transferData); 169 Array.Copy(Data, 0, transferData, 4, 1000);
170 Packet++; 170 Client.SendXferPacket(XferID, 0, transferData);
171 DataPointer = 1000; 171 Packet++;
172 } 172 DataPointer = 1000;
173 } 173 }
174 174 }
175 public void AckPacket(uint packet) 175
176 { 176 public void AckPacket(uint packet)
177 if (!complete) 177 {
178 { 178 if (!complete)
179 if ((Data.Length - DataPointer) > 1000) 179 {
180 { 180 if ((Data.Length - DataPointer) > 1000)
181 byte[] transferData = new byte[1000]; 181 {
182 Array.Copy(Data, DataPointer, transferData, 0, 1000); 182 byte[] transferData = new byte[1000];
183 Client.SendXferPacket(XferID, Packet, transferData); 183 Array.Copy(Data, DataPointer, transferData, 0, 1000);
184 Packet++; 184 Client.SendXferPacket(XferID, Packet, transferData);
185 DataPointer += 1000; 185 Packet++;
186 } 186 DataPointer += 1000;
187 else 187 }
188 { 188 else
189 byte[] transferData = new byte[Data.Length - DataPointer]; 189 {
190 Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer); 190 byte[] transferData = new byte[Data.Length - DataPointer];
191 uint endPacket = Packet |= (uint) 0x80000000; 191 Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer);
192 Client.SendXferPacket(XferID, endPacket, transferData); 192 uint endPacket = Packet |= (uint) 0x80000000;
193 Packet++; 193 Client.SendXferPacket(XferID, endPacket, transferData);
194 DataPointer += (Data.Length - DataPointer); 194 Packet++;
195 complete = true; 195 DataPointer += (Data.Length - DataPointer);
196 } 196 complete = true;
197 } 197 }
198 } 198 }
199 } 199 }
200 } 200 }
201} 201 }
202}
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs
index 7967867..35f2051 100644
--- a/OpenSim/Region/Examples/SimpleApp/Program.cs
+++ b/OpenSim/Region/Examples/SimpleApp/Program.cs
@@ -39,12 +39,15 @@ using OpenSim.Region.Communications.Local;
39using OpenSim.Region.Environment; 39using OpenSim.Region.Environment;
40using OpenSim.Region.Environment.Scenes; 40using OpenSim.Region.Environment.Scenes;
41using OpenSim.Region.Physics.Manager; 41using OpenSim.Region.Physics.Manager;
42using Nini.Config;
42 43
43namespace SimpleApp 44namespace SimpleApp
44{ 45{
45 class Program : RegionApplicationBase, conscmd_callback 46 class Program : RegionApplicationBase, conscmd_callback
46 { 47 {
47 private ModuleLoader m_moduleLoader; 48 private ModuleLoader m_moduleLoader;
49 private IConfigSource m_config;
50
48 protected override LogBase CreateLog() 51 protected override LogBase CreateLog()
49 { 52 {
50 return new LogBase(null, "SimpleApp", this, false); 53 return new LogBase(null, "SimpleApp", this, false);
@@ -86,7 +89,7 @@ namespace SimpleApp
86 89
87 UDPServer udpServer; 90 UDPServer udpServer;
88 91
89 m_moduleLoader = new ModuleLoader( m_log ); 92 m_moduleLoader = new ModuleLoader( m_log, m_config );
90 m_moduleLoader.LoadDefaultSharedModules(); 93 m_moduleLoader.LoadDefaultSharedModules();
91 94
92 Scene scene = SetupScene(regionInfo, out udpServer); 95 Scene scene = SetupScene(regionInfo, out udpServer);
@@ -155,7 +158,7 @@ namespace SimpleApp
155 158
156 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, AgentCircuitManager circuitManager) 159 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, AgentCircuitManager circuitManager)
157 { 160 {
158 return new MyWorld(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer, new ModuleLoader( m_log )); 161 return new MyWorld(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer, new ModuleLoader( m_log, m_config ));
159 } 162 }
160 163
161 protected override StorageManager CreateStorageManager(RegionInfo regionInfo) 164 protected override StorageManager CreateStorageManager(RegionInfo regionInfo)
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs
index a818155..be27a0b 100644
--- a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs
@@ -1,148 +1,149 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Collections.Generic; 28using System.Collections.Generic;
29using OpenSim.Framework.Console; 29using OpenSim.Framework.Console;
30using OpenSim.Region.Environment.Interfaces; 30using OpenSim.Region.Environment.Interfaces;
31using OpenSim.Region.Environment.Scenes; 31using OpenSim.Region.Environment.Scenes;
32using OpenSim.Region.ExtensionsScriptModule.CSharp; 32using OpenSim.Region.ExtensionsScriptModule.CSharp;
33using OpenSim.Region.ExtensionsScriptModule.JScript; 33using OpenSim.Region.ExtensionsScriptModule.JScript;
34using OpenSim.Region.ExtensionsScriptModule.JVMEngine; 34using OpenSim.Region.ExtensionsScriptModule.JVMEngine;
35 35using Nini.Config;
36namespace OpenSim.Region.ExtensionsScriptModule 36
37{ 37namespace OpenSim.Region.ExtensionsScriptModule
38 public class ScriptManager : IRegionModule, IExtensionScriptModule 38{
39 { 39 public class ScriptManager : IRegionModule, IExtensionScriptModule
40 readonly List<IScript> scripts = new List<IScript>(); 40 {
41 Scene m_scene; 41 readonly List<IScript> scripts = new List<IScript>();
42 readonly Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>(); 42 Scene m_scene;
43 43 readonly Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>();
44 private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts) 44
45 { 45 private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts)
46 foreach (KeyValuePair<string, IScript> script in compiledscripts) 46 {
47 { 47 foreach (KeyValuePair<string, IScript> script in compiledscripts)
48 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. 48 {
49 MainLog.Instance.Verbose("Loading " + script.Key); 49 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.
50 script.Value.Initialise(scriptInfo); 50 MainLog.Instance.Verbose("Loading " + script.Key);
51 scripts.Add(script.Value); 51 script.Value.Initialise(scriptInfo);
52 } 52 scripts.Add(script.Value);
53 53 }
54 MainLog.Instance.Verbose(string.Format("Finished loading {0} script(s)", compiledscripts.Count)); 54
55 } 55 MainLog.Instance.Verbose(string.Format("Finished loading {0} script(s)", compiledscripts.Count));
56 56 }
57 public ScriptManager() 57
58 { 58 public ScriptManager()
59 // Default Engines 59 {
60 CSharpScriptEngine csharpCompiler = new CSharpScriptEngine(); 60 // Default Engines
61 compilers.Add(csharpCompiler.FileExt(), csharpCompiler); 61 CSharpScriptEngine csharpCompiler = new CSharpScriptEngine();
62 62 compilers.Add(csharpCompiler.FileExt(), csharpCompiler);
63 JScriptEngine jscriptCompiler = new JScriptEngine(); 63
64 compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler); 64 JScriptEngine jscriptCompiler = new JScriptEngine();
65 65 compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler);
66 JavaEngine javaCompiler = new JavaEngine(); 66
67 compilers.Add(javaCompiler.FileExt(), javaCompiler); 67 JavaEngine javaCompiler = new JavaEngine();
68 } 68 compilers.Add(javaCompiler.FileExt(), javaCompiler);
69 69 }
70 public void Initialise(Scene scene) 70
71 { 71 public void Initialise(Scene scene, IConfigSource config)
72 System.Console.WriteLine("Initialising Extensions Scripting Module"); 72 {
73 m_scene = scene; 73 System.Console.WriteLine("Initialising Extensions Scripting Module");
74 74 m_scene = scene;
75 m_scene.RegisterModuleInterface<IExtensionScriptModule>(this); 75
76 } 76 m_scene.RegisterModuleInterface<IExtensionScriptModule>(this);
77 77 }
78 public void PostInitialise() 78
79 { 79 public void PostInitialise()
80 80 {
81 } 81
82 82 }
83 public void Close() 83
84 { 84 public void Close()
85 85 {
86 } 86
87 87 }
88 public string Name 88
89 { 89 public string Name
90 get { return "ExtensionsScriptingModule"; } 90 {
91 } 91 get { return "ExtensionsScriptingModule"; }
92 92 }
93 public bool IsSharedModule 93
94{ 94 public bool IsSharedModule
95 get { return false; } 95{
96 } 96 get { return false; }
97 97 }
98 public bool Compile(string filename) 98
99 { 99 public bool Compile(string filename)
100 foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers) 100 {
101 { 101 foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers)
102 if (filename.EndsWith(compiler.Key)) 102 {
103 { 103 if (filename.EndsWith(compiler.Key))
104 LoadFromCompiler(compiler.Value.compile(filename)); 104 {
105 break; 105 LoadFromCompiler(compiler.Value.compile(filename));
106 } 106 break;
107 } 107 }
108 108 }
109 return true; 109
110 } 110 return true;
111 111 }
112 public void RunScriptCmd(string[] args) 112
113 { 113 public void RunScriptCmd(string[] args)
114 switch (args[0]) 114 {
115 { 115 switch (args[0])
116 case "load": 116 {
117 Compile(args[1]); 117 case "load":
118 break; 118 Compile(args[1]);
119 119 break;
120 default: 120
121 MainLog.Instance.Error("Unknown script command"); 121 default:
122 break; 122 MainLog.Instance.Error("Unknown script command");
123 } 123 break;
124 } 124 }
125 125 }
126 public bool AddPreCompiledScript(IScript script) 126
127 { 127 public bool AddPreCompiledScript(IScript script)
128 MainLog.Instance.Verbose("Loading script " + script.Name); 128 {
129 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. 129 MainLog.Instance.Verbose("Loading script " + script.Name);
130 script.Initialise(scriptInfo); 130 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.
131 scripts.Add(script); 131 script.Initialise(scriptInfo);
132 132 scripts.Add(script);
133 return true; 133
134 } 134 return true;
135 } 135 }
136 136 }
137 public interface IExtensionScriptModule 137
138 { 138 public interface IExtensionScriptModule
139 bool Compile(string filename); 139 {
140 bool AddPreCompiledScript(IScript script); 140 bool Compile(string filename);
141 } 141 bool AddPreCompiledScript(IScript script);
142 142 }
143 interface IScriptCompiler 143
144 { 144 interface IScriptCompiler
145 Dictionary<string, IScript> compile(string filename); 145 {
146 string FileExt(); 146 Dictionary<string, IScript> compile(string filename);
147 } 147 string FileExt();
148} 148 }
149}
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
index d89a8ad..38bf746 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
@@ -1,132 +1,133 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text; 31using System.Text;
32using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
33using OpenSim.Region.Environment.Scenes; 33using OpenSim.Region.Environment.Scenes;
34using OpenSim.Region.Environment.Scenes.Scripting; 34using OpenSim.Region.Environment.Scenes.Scripting;
35using OpenSim.Region.Environment.Interfaces; 35using OpenSim.Region.Environment.Interfaces;
36using libsecondlife; 36using libsecondlife;
37 37using Nini.Config;
38namespace OpenSim.Region.ScriptEngine.DotNetEngine 38
39{ 39namespace OpenSim.Region.ScriptEngine.DotNetEngine
40 /// <summary> 40{
41 /// This is the root object for ScriptEngine 41 /// <summary>
42 /// </summary> 42 /// This is the root object for ScriptEngine
43 [Serializable] 43 /// </summary>
44 public class ScriptEngine :IRegionModule 44 [Serializable]
45 { 45 public class ScriptEngine :IRegionModule
46 46 {
47 internal OpenSim.Region.Environment.Scenes.Scene World; 47
48 internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim 48 internal OpenSim.Region.Environment.Scenes.Scene World;
49 internal EventQueueManager m_EventQueueManager; // Executes events 49 internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim
50 internal ScriptManager m_ScriptManager; // Load, unload and execute scripts 50 internal EventQueueManager m_EventQueueManager; // Executes events
51 internal AppDomainManager m_AppDomainManager; 51 internal ScriptManager m_ScriptManager; // Load, unload and execute scripts
52 internal LSLLongCmdHandler m_LSLLongCmdHandler; 52 internal AppDomainManager m_AppDomainManager;
53 53 internal LSLLongCmdHandler m_LSLLongCmdHandler;
54 private OpenSim.Framework.Console.LogBase m_log; 54
55 55 private OpenSim.Framework.Console.LogBase m_log;
56 public ScriptEngine() 56
57 { 57 public ScriptEngine()
58 //Common.SendToDebug("ScriptEngine Object Initialized"); 58 {
59 Common.mySE = this; 59 //Common.SendToDebug("ScriptEngine Object Initialized");
60 } 60 Common.mySE = this;
61 61 }
62 public LogBase Log 62
63 { 63 public LogBase Log
64 get { return m_log; } 64 {
65 } 65 get { return m_log; }
66 66 }
67 public void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger) 67
68 { 68 public void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger)
69 69 {
70 World = Sceneworld; 70
71 m_log = logger; 71 World = Sceneworld;
72 72 m_log = logger;
73 Log.Verbose("ScriptEngine", "DotNet & LSL ScriptEngine initializing"); 73
74 74 Log.Verbose("ScriptEngine", "DotNet & LSL ScriptEngine initializing");
75 //m_logger.Status("ScriptEngine", "InitializeEngine"); 75
76 76 //m_logger.Status("ScriptEngine", "InitializeEngine");
77 // Create all objects we'll be using 77
78 m_EventQueueManager = new EventQueueManager(this); 78 // Create all objects we'll be using
79 m_EventManager = new EventManager(this); 79 m_EventQueueManager = new EventQueueManager(this);
80 m_ScriptManager = new ScriptManager(this); 80 m_EventManager = new EventManager(this);
81 m_AppDomainManager = new AppDomainManager(); 81 m_ScriptManager = new ScriptManager(this);
82 m_LSLLongCmdHandler = new LSLLongCmdHandler(this); 82 m_AppDomainManager = new AppDomainManager();
83 83 m_LSLLongCmdHandler = new LSLLongCmdHandler(this);
84 // Should we iterate the region for scripts that needs starting? 84
85 // Or can we assume we are loaded before anything else so we can use proper events? 85 // Should we iterate the region for scripts that needs starting?
86 86 // Or can we assume we are loaded before anything else so we can use proper events?
87 87
88 } 88
89 89 }
90 public void Shutdown() 90
91 { 91 public void Shutdown()
92 // We are shutting down 92 {
93 } 93 // We are shutting down
94 94 }
95 //// !!!FOR DEBUGGING ONLY!!! (for executing script directly from test app) 95
96 //[Obsolete("!!!FOR DEBUGGING ONLY!!!")] 96 //// !!!FOR DEBUGGING ONLY!!! (for executing script directly from test app)
97 //public void StartScript(string ScriptID, IScriptHost ObjectID) 97 //[Obsolete("!!!FOR DEBUGGING ONLY!!!")]
98 //{ 98 //public void StartScript(string ScriptID, IScriptHost ObjectID)
99 // this.myEventManager.TEMP_OBJECT_ID = ObjectID; 99 //{
100 // Log.Status("ScriptEngine", "DEBUG FUNCTION: StartScript: " + ScriptID); 100 // this.myEventManager.TEMP_OBJECT_ID = ObjectID;
101 // myScriptManager.StartScript(ScriptID, ObjectID); 101 // Log.Status("ScriptEngine", "DEBUG FUNCTION: StartScript: " + ScriptID);
102 //} 102 // myScriptManager.StartScript(ScriptID, ObjectID);
103 103 //}
104 #region IRegionModule 104
105 105 #region IRegionModule
106 public void Initialise(Scene scene) 106
107 { 107 public void Initialise(Scene scene, IConfigSource config)
108 this.InitializeEngine(scene, MainLog.Instance); 108 {
109 } 109 this.InitializeEngine(scene, MainLog.Instance);
110 110 }
111 public void PostInitialise() 111
112 { 112 public void PostInitialise()
113 113 {
114 } 114
115 115 }
116 public void Close() 116
117 { 117 public void Close()
118 } 118 {
119 119 }
120 public string Name 120
121 { 121 public string Name
122 get { return "LSLScriptingModule"; } 122 {
123 } 123 get { return "LSLScriptingModule"; }
124 124 }
125 public bool IsSharedModule 125
126 { 126 public bool IsSharedModule
127 get { return false; } 127 {
128 } 128 get { return false; }
129 129 }
130 #endregion 130
131 } 131 #endregion
132} 132 }
133}