aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorTeravus Ovares (Dan Olivares)2009-08-26 11:48:05 -0400
committerTeravus Ovares (Dan Olivares)2009-08-26 11:48:05 -0400
commit54e05a083d2aeb7a892647f64edfd52db80ce5ed (patch)
tree1fca51f8dd19c0f4871d8e1b875511c6087b3675 /OpenSim
parent* It turns out that Physics heightmap values were being stored in managed mem... (diff)
parentAdd reference to OpenMetaverse.dll to UserServer.Modules to make MSVS happy (diff)
downloadopensim-SC-54e05a083d2aeb7a892647f64edfd52db80ce5ed.zip
opensim-SC-54e05a083d2aeb7a892647f64edfd52db80ce5ed.tar.gz
opensim-SC-54e05a083d2aeb7a892647f64edfd52db80ce5ed.tar.bz2
opensim-SC-54e05a083d2aeb7a892647f64edfd52db80ce5ed.tar.xz
Merge branch 'master' of ssh://MyConnection/var/git/opensim
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/ConsoleClient/ConsoleClient.cs4
-rw-r--r--OpenSim/ConsoleClient/Requester.cs2
-rw-r--r--OpenSim/Data/MySQL/MySQLAssetData.cs4
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs7
-rw-r--r--OpenSim/Framework/Communications/Tests/LoginServiceTests.cs5
-rw-r--r--OpenSim/Framework/Console/CommandConsole.cs4
-rw-r--r--OpenSim/Framework/Console/ConsoleBase.cs4
-rw-r--r--OpenSim/Framework/Console/RemoteConsole.cs8
-rw-r--r--OpenSim/Framework/GridConfig.cs4
-rw-r--r--OpenSim/Framework/IClientAPI.cs2
-rw-r--r--OpenSim/Framework/MessageServerConfig.cs4
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs43
-rw-r--r--OpenSim/Framework/Servers/HttpServer/RestSessionService.cs3
-rw-r--r--OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs2
-rw-r--r--OpenSim/Framework/UserConfig.cs4
-rw-r--r--OpenSim/Grid/GridServer/GridServerBase.cs3
-rw-r--r--OpenSim/Grid/GridServer/Program.cs2
-rw-r--r--OpenSim/Grid/InventoryServer/AuthedSessionCache.cs (renamed from OpenSim/Framework/Communications/Cache/AuthedSessionCache.cs)2
-rw-r--r--OpenSim/Grid/InventoryServer/InventoryServiceBase.cs (renamed from OpenSim/Framework/Communications/InventoryServiceBase.cs)4
-rw-r--r--OpenSim/Grid/MessagingServer/Main.cs5
-rw-r--r--OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs7
-rw-r--r--OpenSim/Grid/UserServer/Main.cs5
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs26
-rw-r--r--OpenSim/Region/CoreModules/Avatar/NPC/INPCModule.cs40
-rw-r--r--OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs125
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs5
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs17
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs5
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs13
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs138
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs1
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsVector.cs5
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs4
-rw-r--r--OpenSim/Region/Physics/POSPlugin/POSCharacter.cs6
-rw-r--r--OpenSim/Region/Physics/POSPlugin/POSScene.cs14
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs32
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs82
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs29
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs43
-rw-r--r--OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs16
-rw-r--r--OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs81
-rw-r--r--OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs13
-rw-r--r--OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs5
-rw-r--r--OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs49
-rw-r--r--OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs6
-rw-r--r--OpenSim/Services/Interfaces/IInventoryService.cs8
-rw-r--r--OpenSim/Services/InventoryService/InventoryService.cs20
-rw-r--r--OpenSim/Tests/Common/Mock/TestInventoryService.cs5
53 files changed, 807 insertions, 170 deletions
diff --git a/OpenSim/ConsoleClient/ConsoleClient.cs b/OpenSim/ConsoleClient/ConsoleClient.cs
index 319584f..783adef 100644
--- a/OpenSim/ConsoleClient/ConsoleClient.cs
+++ b/OpenSim/ConsoleClient/ConsoleClient.cs
@@ -39,10 +39,6 @@ namespace OpenSim.ConsoleClient
39{ 39{
40 public class OpenSimConsoleClient 40 public class OpenSimConsoleClient
41 { 41 {
42 private static readonly ILog m_log =
43 LogManager.GetLogger(
44 MethodBase.GetCurrentMethod().DeclaringType);
45
46 protected static ServicesServerBase m_Server = null; 42 protected static ServicesServerBase m_Server = null;
47 private static string m_Host; 43 private static string m_Host;
48 private static int m_Port; 44 private static int m_Port;
diff --git a/OpenSim/ConsoleClient/Requester.cs b/OpenSim/ConsoleClient/Requester.cs
index af7860d..fefe969 100644
--- a/OpenSim/ConsoleClient/Requester.cs
+++ b/OpenSim/ConsoleClient/Requester.cs
@@ -40,8 +40,6 @@ namespace OpenSim.ConsoleClient
40 40
41 public class Requester 41 public class Requester
42 { 42 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44
45 public static void MakeRequest(string requestUrl, string data, 43 public static void MakeRequest(string requestUrl, string data,
46 ReplyDelegate action) 44 ReplyDelegate action)
47 { 45 {
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index 1b4377a..66c34fe 100644
--- a/OpenSim/Data/MySQL/MySQLAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLAssetData.cs
@@ -168,7 +168,7 @@ namespace OpenSim.Data.MySQL
168 } 168 }
169 asset.Name = (string) dbReader["name"]; 169 asset.Name = (string) dbReader["name"];
170 asset.Type = (sbyte) dbReader["assetType"]; 170 asset.Type = (sbyte) dbReader["assetType"];
171 asset.Temporary = (bool)dbReader["temporary"]; 171 asset.Temporary = Convert.ToBoolean(dbReader["temporary"]);
172 } 172 }
173 dbReader.Close(); 173 dbReader.Close();
174 cmd.Dispose(); 174 cmd.Dispose();
@@ -359,7 +359,7 @@ namespace OpenSim.Data.MySQL
359 metadata.Name = (string) dbReader["name"]; 359 metadata.Name = (string) dbReader["name"];
360 metadata.Description = (string) dbReader["description"]; 360 metadata.Description = (string) dbReader["description"];
361 metadata.Type = (sbyte) dbReader["assetType"]; 361 metadata.Type = (sbyte) dbReader["assetType"];
362 metadata.Temporary = (bool) dbReader["temporary"]; // Not sure if this is correct. 362 metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct.
363 metadata.FullID = new UUID((string) dbReader["id"]); 363 metadata.FullID = new UUID((string) dbReader["id"]);
364 364
365 // Current SHA1s are not stored/computed. 365 // Current SHA1s are not stored/computed.
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index 1fb01ba..940ae3b 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -510,6 +510,13 @@ namespace OpenSim.Framework
510 if (te != null && te.Length > 0) 510 if (te != null && te.Length > 0)
511 Texture = new Primitive.TextureEntry(te, 0, te.Length); 511 Texture = new Primitive.TextureEntry(te, 0, te.Length);
512 } 512 }
513 else
514 {
515 // We shouldn't be receiving appearance hashtables without a TextureEntry,
516 // but in case we do this will prevent a failure when saving to the database
517 Texture = GetDefaultTexture();
518 }
519
513 520
514 AvatarHeight = (float)Convert.ToDouble((string)h["avatar_height"]); 521 AvatarHeight = (float)Convert.ToDouble((string)h["avatar_height"]);
515 522
diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
index 6f86704..57a908e 100644
--- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
+++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
@@ -532,6 +532,11 @@ namespace OpenSim.Framework.Communications.Tests
532 return false; 532 return false;
533 } 533 }
534 534
535 public bool DeleteFolders(UUID ownerID, List<UUID> ids)
536 {
537 return false;
538 }
539
535 public bool PurgeFolder(InventoryFolderBase folder) 540 public bool PurgeFolder(InventoryFolderBase folder)
536 { 541 {
537 return false; 542 return false;
diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs
index 3387013..06136ff 100644
--- a/OpenSim/Framework/Console/CommandConsole.cs
+++ b/OpenSim/Framework/Console/CommandConsole.cs
@@ -576,7 +576,7 @@ namespace OpenSim.Framework.Console
576 576
577 public void Prompt() 577 public void Prompt()
578 { 578 {
579 string line = ReadLine(m_defaultPrompt, true, true); 579 string line = ReadLine(m_defaultPrompt + "# ", true, true);
580 580
581 if (line != String.Empty) 581 if (line != String.Empty)
582 { 582 {
@@ -592,7 +592,7 @@ namespace OpenSim.Framework.Console
592 592
593 public override string ReadLine(string p, bool isCommand, bool e) 593 public override string ReadLine(string p, bool isCommand, bool e)
594 { 594 {
595 System.Console.Write("{0}", prompt); 595 System.Console.Write("{0}", p);
596 string cmdinput = System.Console.ReadLine(); 596 string cmdinput = System.Console.ReadLine();
597 597
598 if (isCommand) 598 if (isCommand)
diff --git a/OpenSim/Framework/Console/ConsoleBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs
index 5e258ae..0a51266 100644
--- a/OpenSim/Framework/Console/ConsoleBase.cs
+++ b/OpenSim/Framework/Console/ConsoleBase.cs
@@ -48,7 +48,7 @@ namespace OpenSim.Framework.Console
48 /// </summary> 48 /// </summary>
49 public string DefaultPrompt 49 public string DefaultPrompt
50 { 50 {
51 set { m_defaultPrompt = value + "# "; } 51 set { m_defaultPrompt = value; }
52 get { return m_defaultPrompt; } 52 get { return m_defaultPrompt; }
53 } 53 }
54 protected string m_defaultPrompt; 54 protected string m_defaultPrompt;
@@ -123,7 +123,7 @@ namespace OpenSim.Framework.Console
123 123
124 public virtual string ReadLine(string p, bool isCommand, bool e) 124 public virtual string ReadLine(string p, bool isCommand, bool e)
125 { 125 {
126 System.Console.Write("{0}", prompt); 126 System.Console.Write("{0}", p);
127 string cmdinput = System.Console.ReadLine(); 127 string cmdinput = System.Console.ReadLine();
128 128
129 return cmdinput; 129 return cmdinput;
diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs
index da8556a..67bff4c 100644
--- a/OpenSim/Framework/Console/RemoteConsole.cs
+++ b/OpenSim/Framework/Console/RemoteConsole.cs
@@ -50,8 +50,6 @@ namespace OpenSim.Framework.Console
50 // 50 //
51 public class RemoteConsole : CommandConsole 51 public class RemoteConsole : CommandConsole
52 { 52 {
53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54
55 private IHttpServer m_Server = null; 53 private IHttpServer m_Server = null;
56 private IConfigSource m_Config = null; 54 private IConfigSource m_Config = null;
57 55
@@ -217,6 +215,12 @@ namespace OpenSim.Framework.Console
217 id.AppendChild(xmldoc.CreateTextNode(sessionID.ToString())); 215 id.AppendChild(xmldoc.CreateTextNode(sessionID.ToString()));
218 216
219 rootElement.AppendChild(id); 217 rootElement.AppendChild(id);
218
219 XmlElement prompt = xmldoc.CreateElement("", "Prompt", "");
220 prompt.AppendChild(xmldoc.CreateTextNode(DefaultPrompt));
221
222 rootElement.AppendChild(prompt);
223
220 rootElement.AppendChild(MainConsole.Instance.Commands.GetXml(xmldoc)); 224 rootElement.AppendChild(MainConsole.Instance.Commands.GetXml(xmldoc));
221 225
222 reply["str_response_string"] = xmldoc.InnerXml; 226 reply["str_response_string"] = xmldoc.InnerXml;
diff --git a/OpenSim/Framework/GridConfig.cs b/OpenSim/Framework/GridConfig.cs
index 87fd3f0..9aa5d03 100644
--- a/OpenSim/Framework/GridConfig.cs
+++ b/OpenSim/Framework/GridConfig.cs
@@ -98,10 +98,10 @@ namespace OpenSim.Framework
98 "True", 98 "True",
99 false); 99 false);
100 m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING, 100 m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
101 "Remote console access user name [Default: disabled]", "0", false); 101 "Remote console access user name [Default: disabled]", "", false);
102 102
103 m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, 103 m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
104 "Remote console access password [Default: disabled]", "0", false); 104 "Remote console access password [Default: disabled]", "", false);
105 105
106 } 106 }
107 107
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index c6cdcaa..444adf9 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -260,7 +260,7 @@ namespace OpenSim.Framework
260 IClientAPI remoteClient, List<UUID> itemIDs); 260 IClientAPI remoteClient, List<UUID> itemIDs);
261 261
262 public delegate void RemoveInventoryFolder( 262 public delegate void RemoveInventoryFolder(
263 IClientAPI remoteClient, UUID folderID); 263 IClientAPI remoteClient, List<UUID> folderIDs);
264 264
265 public delegate void RequestAsset(IClientAPI remoteClient, RequestAssetArgs transferRequest); 265 public delegate void RequestAsset(IClientAPI remoteClient, RequestAssetArgs transferRequest);
266 266
diff --git a/OpenSim/Framework/MessageServerConfig.cs b/OpenSim/Framework/MessageServerConfig.cs
index 61e5ea7..884c0ea 100644
--- a/OpenSim/Framework/MessageServerConfig.cs
+++ b/OpenSim/Framework/MessageServerConfig.cs
@@ -91,10 +91,10 @@ namespace OpenSim.Framework
91 m_configMember.addConfigurationOption("published_ip", ConfigurationOption.ConfigurationTypes.TYPE_STRING, 91 m_configMember.addConfigurationOption("published_ip", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
92 "My Published IP Address", "127.0.0.1", false); 92 "My Published IP Address", "127.0.0.1", false);
93 m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING, 93 m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
94 "Remote console access user name [Default: disabled]", "0", false); 94 "Remote console access user name [Default: disabled]", "", false);
95 95
96 m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, 96 m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
97 "Remote console access password [Default: disabled]", "0", false); 97 "Remote console access password [Default: disabled]", "", false);
98 98
99 } 99 }
100 100
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
index d8cbeac..41fb376 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
@@ -59,6 +59,8 @@ using System.IO;
59using System.Text; 59using System.Text;
60using HttpServer; 60using HttpServer;
61using OpenMetaverse; 61using OpenMetaverse;
62using System.Reflection;
63using log4net;
62 64
63namespace OpenSim.Framework.Servers.HttpServer 65namespace OpenSim.Framework.Servers.HttpServer
64{ 66{
@@ -66,6 +68,10 @@ namespace OpenSim.Framework.Servers.HttpServer
66 68
67 public class PollServiceWorkerThread 69 public class PollServiceWorkerThread
68 { 70 {
71 private static readonly ILog m_log =
72 LogManager.GetLogger(
73 MethodBase.GetCurrentMethod().DeclaringType);
74
69 public event ReQueuePollServiceItem ReQueue; 75 public event ReQueuePollServiceItem ReQueue;
70 76
71 private readonly BaseHttpServer m_server; 77 private readonly BaseHttpServer m_server;
@@ -92,31 +98,36 @@ namespace OpenSim.Framework.Servers.HttpServer
92 while (m_running) 98 while (m_running)
93 { 99 {
94 PollServiceHttpRequest req = m_request.Dequeue(); 100 PollServiceHttpRequest req = m_request.Dequeue();
95 if (req.PollServiceArgs.HasEvents(req.PollServiceArgs.Id)) 101 try
96 { 102 {
97 StreamReader str = new StreamReader(req.Request.Body); 103 if (req.PollServiceArgs.HasEvents(req.PollServiceArgs.Id))
98
99 Hashtable responsedata = req.PollServiceArgs.GetEvents(req.PollServiceArgs.Id, str.ReadToEnd());
100 m_server.DoHTTPGruntWork(responsedata,
101 new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext));
102 }
103 else
104 {
105 if ((Environment.TickCount - req.RequestTime) > m_timeout)
106 { 104 {
107 m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(), 105 StreamReader str = new StreamReader(req.Request.Body);
106
107 Hashtable responsedata = req.PollServiceArgs.GetEvents(req.PollServiceArgs.Id, str.ReadToEnd());
108 m_server.DoHTTPGruntWork(responsedata,
108 new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext)); 109 new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext));
109 } 110 }
110 else 111 else
111 { 112 {
112 ReQueuePollServiceItem reQueueItem = ReQueue; 113 if ((Environment.TickCount - req.RequestTime) > m_timeout)
113 if (reQueueItem != null) 114 {
114 reQueueItem(req); 115 m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(),
116 new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext));
117 }
118 else
119 {
120 ReQueuePollServiceItem reQueueItem = ReQueue;
121 if (reQueueItem != null)
122 reQueueItem(req);
123 }
115 } 124 }
116 } 125 }
126 catch (Exception e)
127 {
128 m_log.ErrorFormat("Exception in poll service thread: " + e.ToString());
129 }
117 } 130 }
118
119
120 } 131 }
121 132
122 internal void Enqueue(PollServiceHttpRequest pPollServiceHttpRequest) 133 internal void Enqueue(PollServiceHttpRequest pPollServiceHttpRequest)
diff --git a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs
index ec2f9ec..2ef4a36 100644
--- a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs
+++ b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs
@@ -75,6 +75,7 @@ namespace OpenSim.Framework.Servers.HttpServer
75 WebRequest request = WebRequest.Create(requestUrl); 75 WebRequest request = WebRequest.Create(requestUrl);
76 request.Method = verb; 76 request.Method = verb;
77 request.ContentType = "text/xml"; 77 request.ContentType = "text/xml";
78 request.Timeout = 20000;
78 79
79 MemoryStream buffer = new MemoryStream(); 80 MemoryStream buffer = new MemoryStream();
80 81
@@ -98,7 +99,9 @@ namespace OpenSim.Framework.Servers.HttpServer
98 { 99 {
99 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); 100 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse));
100 deserial = (TResponse)deserializer.Deserialize(resp.GetResponseStream()); 101 deserial = (TResponse)deserializer.Deserialize(resp.GetResponseStream());
102 resp.Close();
101 } 103 }
104 requestStream.Close();
102 return deserial; 105 return deserial;
103 } 106 }
104 } 107 }
diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs
index 09ef95b..ec9bd4f 100644
--- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs
+++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs
@@ -62,7 +62,7 @@ namespace OpenSim.Framework.Servers.HttpServer
62 WebRequest request = WebRequest.Create(requestUrl); 62 WebRequest request = WebRequest.Create(requestUrl);
63 request.Method = verb; 63 request.Method = verb;
64 64
65 if (verb == "POST") 65 if ((verb == "POST") || (verb == "PUT"))
66 { 66 {
67 request.ContentType = "text/xml"; 67 request.ContentType = "text/xml";
68 68
diff --git a/OpenSim/Framework/UserConfig.cs b/OpenSim/Framework/UserConfig.cs
index b9e3665..16f265c 100644
--- a/OpenSim/Framework/UserConfig.cs
+++ b/OpenSim/Framework/UserConfig.cs
@@ -158,10 +158,10 @@ namespace OpenSim.Framework
158 "Minimum Level a user should have to login [0 default]", "0", false); 158 "Minimum Level a user should have to login [0 default]", "0", false);
159 159
160 m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING, 160 m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
161 "Remote console access user name [Default: disabled]", "0", false); 161 "Remote console access user name [Default: disabled]", "", false);
162 162
163 m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, 163 m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
164 "Remote console access password [Default: disabled]", "0", false); 164 "Remote console access password [Default: disabled]", "", false);
165 165
166 } 166 }
167 167
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs
index e3ad52a..d63ac2e 100644
--- a/OpenSim/Grid/GridServer/GridServerBase.cs
+++ b/OpenSim/Grid/GridServer/GridServerBase.cs
@@ -49,6 +49,7 @@ namespace OpenSim.Grid.GridServer
49 protected GridConfig m_config; 49 protected GridConfig m_config;
50 public string m_consoleType = "local"; 50 public string m_consoleType = "local";
51 public IConfigSource m_configSource = null; 51 public IConfigSource m_configSource = null;
52 public string m_configFile = "GridServer_Config.xml";
52 53
53 public GridConfig Config 54 public GridConfig Config
54 { 55 {
@@ -91,7 +92,7 @@ namespace OpenSim.Grid.GridServer
91 break; 92 break;
92 } 93 }
93 MainConsole.Instance = m_console; 94 MainConsole.Instance = m_console;
94 m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml"))); 95 m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), m_configFile)));
95 96
96 m_log.Info("[GRID]: Starting HTTP process"); 97 m_log.Info("[GRID]: Starting HTTP process");
97 m_httpServer = new BaseHttpServer(m_config.HttpPort); 98 m_httpServer = new BaseHttpServer(m_config.HttpPort);
diff --git a/OpenSim/Grid/GridServer/Program.cs b/OpenSim/Grid/GridServer/Program.cs
index c7ba897..741a01b 100644
--- a/OpenSim/Grid/GridServer/Program.cs
+++ b/OpenSim/Grid/GridServer/Program.cs
@@ -36,6 +36,7 @@ namespace OpenSim.Grid.GridServer
36 { 36 {
37 ArgvConfigSource argvSource = new ArgvConfigSource(args); 37 ArgvConfigSource argvSource = new ArgvConfigSource(args);
38 argvSource.AddSwitch("Startup", "console", "c"); 38 argvSource.AddSwitch("Startup", "console", "c");
39 argvSource.AddSwitch("Startup", "xmlfile", "x");
39 40
40 XmlConfigurator.Configure(); 41 XmlConfigurator.Configure();
41 42
@@ -45,6 +46,7 @@ namespace OpenSim.Grid.GridServer
45 if (startupConfig != null) 46 if (startupConfig != null)
46 { 47 {
47 app.m_consoleType = startupConfig.GetString("console", "local"); 48 app.m_consoleType = startupConfig.GetString("console", "local");
49 app.m_configFile = startupConfig.GetString("xmlfile", "GridServer_Config.xml");
48 } 50 }
49 51
50 app.m_configSource = argvSource; 52 app.m_configSource = argvSource;
diff --git a/OpenSim/Framework/Communications/Cache/AuthedSessionCache.cs b/OpenSim/Grid/InventoryServer/AuthedSessionCache.cs
index d56e48a..dadf34a 100644
--- a/OpenSim/Framework/Communications/Cache/AuthedSessionCache.cs
+++ b/OpenSim/Grid/InventoryServer/AuthedSessionCache.cs
@@ -28,7 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30 30
31namespace OpenSim.Framework.Communications.Cache 31namespace OpenSim.Grid.InventoryServer
32{ 32{
33 public class AuthedSessionCache 33 public class AuthedSessionCache
34 { 34 {
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Grid/InventoryServer/InventoryServiceBase.cs
index 309c415..f8b4949 100644
--- a/OpenSim/Framework/Communications/InventoryServiceBase.cs
+++ b/OpenSim/Grid/InventoryServer/InventoryServiceBase.cs
@@ -30,8 +30,10 @@ using System.Reflection;
30using log4net; 30using log4net;
31using OpenMetaverse; 31using OpenMetaverse;
32using OpenSim.Data; 32using OpenSim.Data;
33using OpenSim.Framework;
34using OpenSim.Framework.Communications;
33 35
34namespace OpenSim.Framework.Communications 36namespace OpenSim.Grid.InventoryServer
35{ 37{
36 /// <summary> 38 /// <summary>
37 /// Abstract base class used by local and grid implementations of an inventory service. 39 /// Abstract base class used by local and grid implementations of an inventory service.
diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs
index 654e770..f2631a7 100644
--- a/OpenSim/Grid/MessagingServer/Main.cs
+++ b/OpenSim/Grid/MessagingServer/Main.cs
@@ -59,16 +59,19 @@ namespace OpenSim.Grid.MessagingServer
59 59
60 protected static string m_consoleType = "local"; 60 protected static string m_consoleType = "local";
61 protected static IConfigSource m_config = null; 61 protected static IConfigSource m_config = null;
62 protected static string m_configFile = "MessagingServer_Config.xml";
62 63
63 public static void Main(string[] args) 64 public static void Main(string[] args)
64 { 65 {
65 ArgvConfigSource argvSource = new ArgvConfigSource(args); 66 ArgvConfigSource argvSource = new ArgvConfigSource(args);
66 argvSource.AddSwitch("Startup", "console", "c"); 67 argvSource.AddSwitch("Startup", "console", "c");
68 argvSource.AddSwitch("Startup", "xmlfile", "x");
67 69
68 IConfig startupConfig = argvSource.Configs["Startup"]; 70 IConfig startupConfig = argvSource.Configs["Startup"];
69 if (startupConfig != null) 71 if (startupConfig != null)
70 { 72 {
71 m_consoleType = startupConfig.GetString("console", "local"); 73 m_consoleType = startupConfig.GetString("console", "local");
74 m_configFile = startupConfig.GetString("xmlfile", "MessagingServer_Config.xml");
72 } 75 }
73 76
74 m_config = argvSource; 77 m_config = argvSource;
@@ -164,7 +167,7 @@ namespace OpenSim.Grid.MessagingServer
164 167
165 protected override void StartupSpecific() 168 protected override void StartupSpecific()
166 { 169 {
167 Cfg = new MessageServerConfig("MESSAGING SERVER", (Path.Combine(Util.configDir(), "MessagingServer_Config.xml"))); 170 Cfg = new MessageServerConfig("MESSAGING SERVER", (Path.Combine(Util.configDir(), m_configFile)));
168 171
169 m_userDataBaseService = new UserDataBaseService(); 172 m_userDataBaseService = new UserDataBaseService();
170 m_userDataBaseService.AddPlugin(Cfg.DatabaseProvider, Cfg.DatabaseConnect); 173 m_userDataBaseService.AddPlugin(Cfg.DatabaseProvider, Cfg.DatabaseConnect);
diff --git a/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs b/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs
index 7941679..88918d1 100644
--- a/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs
+++ b/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs
@@ -110,7 +110,12 @@ namespace OpenSim.Grid.UserServer.Modules
110 if (requestData.Contains("owner")) 110 if (requestData.Contains("owner"))
111 { 111 {
112 AvatarAppearance appearance = new AvatarAppearance(requestData); 112 AvatarAppearance appearance = new AvatarAppearance(requestData);
113 m_userDataBaseService.UpdateUserAppearance(new UUID((string)requestData["owner"]), appearance); 113
114 // TODO: Sometime in the future we may have a database layer that is capable of updating appearance when
115 // the TextureEntry is null. When that happens, this check can be removed
116 if (appearance.Texture != null)
117 m_userDataBaseService.UpdateUserAppearance(new UUID((string)requestData["owner"]), appearance);
118
114 responseData = new Hashtable(); 119 responseData = new Hashtable();
115 responseData["returnString"] = "TRUE"; 120 responseData["returnString"] = "TRUE";
116 } 121 }
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index 1ee53ef..baf0fd3 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -76,16 +76,19 @@ namespace OpenSim.Grid.UserServer
76 76
77 protected static string m_consoleType = "local"; 77 protected static string m_consoleType = "local";
78 protected static IConfigSource m_config = null; 78 protected static IConfigSource m_config = null;
79 protected static string m_configFile = "UserServer_Config.xml";
79 80
80 public static void Main(string[] args) 81 public static void Main(string[] args)
81 { 82 {
82 ArgvConfigSource argvSource = new ArgvConfigSource(args); 83 ArgvConfigSource argvSource = new ArgvConfigSource(args);
83 argvSource.AddSwitch("Startup", "console", "c"); 84 argvSource.AddSwitch("Startup", "console", "c");
85 argvSource.AddSwitch("Startup", "xmlfile", "x");
84 86
85 IConfig startupConfig = argvSource.Configs["Startup"]; 87 IConfig startupConfig = argvSource.Configs["Startup"];
86 if (startupConfig != null) 88 if (startupConfig != null)
87 { 89 {
88 m_consoleType = startupConfig.GetString("console", "local"); 90 m_consoleType = startupConfig.GetString("console", "local");
91 m_configFile = startupConfig.GetString("xmlfile", "UserServer_Config.xml");
89 } 92 }
90 93
91 m_config = argvSource; 94 m_config = argvSource;
@@ -151,7 +154,7 @@ namespace OpenSim.Grid.UserServer
151 154
152 protected virtual IInterServiceInventoryServices StartupCoreComponents() 155 protected virtual IInterServiceInventoryServices StartupCoreComponents()
153 { 156 {
154 Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml"))); 157 Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), m_configFile)));
155 158
156 m_httpServer = new BaseHttpServer(Cfg.HttpPort); 159 m_httpServer = new BaseHttpServer(Cfg.HttpPort);
157 160
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index a7a5aa3..dd01780 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -7090,14 +7090,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7090 if (OnRemoveInventoryFolder != null) 7090 if (OnRemoveInventoryFolder != null)
7091 { 7091 {
7092 handlerRemoveInventoryFolder = null; 7092 handlerRemoveInventoryFolder = null;
7093 List<UUID> uuids = new List<UUID>();
7093 foreach (RemoveInventoryFolderPacket.FolderDataBlock datablock in removeFolder.FolderData) 7094 foreach (RemoveInventoryFolderPacket.FolderDataBlock datablock in removeFolder.FolderData)
7094 { 7095 {
7095 handlerRemoveInventoryFolder = OnRemoveInventoryFolder; 7096 uuids.Add(datablock.FolderID);
7096 7097 }
7097 if (handlerRemoveInventoryFolder != null) 7098 handlerRemoveInventoryFolder = OnRemoveInventoryFolder;
7098 { 7099 if (handlerRemoveInventoryFolder != null)
7099 handlerRemoveInventoryFolder(this, datablock.FolderID); 7100 {
7100 } 7101 handlerRemoveInventoryFolder(this, uuids);
7101 } 7102 }
7102 } 7103 }
7103 break; 7104 break;
@@ -7114,14 +7115,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7114 if (OnRemoveInventoryFolder != null) 7115 if (OnRemoveInventoryFolder != null)
7115 { 7116 {
7116 handlerRemoveInventoryFolder = null; 7117 handlerRemoveInventoryFolder = null;
7118 List<UUID> uuids = new List<UUID>();
7117 foreach (RemoveInventoryObjectsPacket.FolderDataBlock datablock in removeObject.FolderData) 7119 foreach (RemoveInventoryObjectsPacket.FolderDataBlock datablock in removeObject.FolderData)
7118 { 7120 {
7119 handlerRemoveInventoryFolder = OnRemoveInventoryFolder; 7121 uuids.Add(datablock.FolderID);
7120 7122 }
7121 if (handlerRemoveInventoryFolder != null) 7123 handlerRemoveInventoryFolder = OnRemoveInventoryFolder;
7122 { 7124 if (handlerRemoveInventoryFolder != null)
7123 handlerRemoveInventoryFolder(this, datablock.FolderID); 7125 {
7124 } 7126 handlerRemoveInventoryFolder(this, uuids);
7125 } 7127 }
7126 } 7128 }
7127 7129
diff --git a/OpenSim/Region/CoreModules/Avatar/NPC/INPCModule.cs b/OpenSim/Region/CoreModules/Avatar/NPC/INPCModule.cs
new file mode 100644
index 0000000..cd2fe4f
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Avatar/NPC/INPCModule.cs
@@ -0,0 +1,40 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
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
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
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29using OpenSim.Region.Framework.Scenes;
30
31namespace OpenSim.Region.CoreModules.Avatar.NPC
32{
33 public interface INPCModule
34 {
35 UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, UUID cloneAppearanceFrom);
36 void Autopilot(UUID agentID, Scene scene, Vector3 pos);
37 void Say(UUID agentID, Scene scene, string text);
38 void DeleteNPC(UUID agentID, Scene scene);
39 }
40} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
index 2640f08..e577fbe 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
@@ -443,7 +443,16 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
443 endPoint.X = (int) x; 443 endPoint.X = (int) x;
444 endPoint.Y = (int) y; 444 endPoint.Y = (int) y;
445 Image image = ImageHttpRequest(nextLine); 445 Image image = ImageHttpRequest(nextLine);
446 graph.DrawImage(image, (float) startPoint.X, (float) startPoint.Y, x, y); 446 if (image != null)
447 {
448 graph.DrawImage(image, (float)startPoint.X, (float)startPoint.Y, x, y);
449 }
450 else
451 {
452 graph.DrawString("URL couldn't be resolved or is", new Font("Arial",6), myBrush, startPoint);
453 graph.DrawString("not an image. Please check URL.", new Font("Arial", 6), myBrush, new Point(startPoint.X, 12 + startPoint.Y));
454 graph.DrawRectangle(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y);
455 }
447 startPoint.X += endPoint.X; 456 startPoint.X += endPoint.X;
448 startPoint.Y += endPoint.Y; 457 startPoint.Y += endPoint.Y;
449 } 458 }
@@ -469,13 +478,19 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
469 startPoint.X += endPoint.X; 478 startPoint.X += endPoint.X;
470 startPoint.Y += endPoint.Y; 479 startPoint.Y += endPoint.Y;
471 } 480 }
481 else if (nextLine.StartsWith("FillPolygon"))
482 {
483 PointF[] points = null;
484 GetParams(partsDelimiter, ref nextLine, 11, ref points);
485 graph.FillPolygon(myBrush, points);
486 }
472 else if (nextLine.StartsWith("Ellipse")) 487 else if (nextLine.StartsWith("Ellipse"))
473 { 488 {
474 float x = 0; 489 float x = 0;
475 float y = 0; 490 float y = 0;
476 GetParams(partsDelimiter, ref nextLine, 7, ref x, ref y); 491 GetParams(partsDelimiter, ref nextLine, 7, ref x, ref y);
477 endPoint.X = (int) x; 492 endPoint.X = (int)x;
478 endPoint.Y = (int) y; 493 endPoint.Y = (int)y;
479 graph.DrawEllipse(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); 494 graph.DrawEllipse(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y);
480 startPoint.X += endPoint.X; 495 startPoint.X += endPoint.X;
481 startPoint.Y += endPoint.Y; 496 startPoint.Y += endPoint.Y;
@@ -492,30 +507,31 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
492 nextLine = nextLine.Remove(0, 8); 507 nextLine = nextLine.Remove(0, 8);
493 nextLine = nextLine.Trim(); 508 nextLine = nextLine.Trim();
494 509
495 string [] fprops = nextLine.Split(partsDelimiter); 510 string[] fprops = nextLine.Split(partsDelimiter);
496 foreach (string prop in fprops) { 511 foreach (string prop in fprops)
497 512 {
513
498 switch (prop) 514 switch (prop)
499 { 515 {
500 case "B": 516 case "B":
501 if (!(myFont.Bold)) 517 if (!(myFont.Bold))
502 myFont = new Font(myFont, myFont.Style | FontStyle.Bold); 518 myFont = new Font(myFont, myFont.Style | FontStyle.Bold);
503 break; 519 break;
504 case "I": 520 case "I":
505 if (!(myFont.Italic)) 521 if (!(myFont.Italic))
506 myFont = new Font(myFont, myFont.Style | FontStyle.Italic); 522 myFont = new Font(myFont, myFont.Style | FontStyle.Italic);
507 break; 523 break;
508 case "U": 524 case "U":
509 if (!(myFont.Underline)) 525 if (!(myFont.Underline))
510 myFont = new Font(myFont, myFont.Style | FontStyle.Underline); 526 myFont = new Font(myFont, myFont.Style | FontStyle.Underline);
511 break; 527 break;
512 case "S": 528 case "S":
513 if (!(myFont.Strikeout)) 529 if (!(myFont.Strikeout))
514 myFont = new Font(myFont, myFont.Style | FontStyle.Strikeout); 530 myFont = new Font(myFont, myFont.Style | FontStyle.Strikeout);
515 break; 531 break;
516 case "R": 532 case "R":
517 myFont = new Font(myFont, FontStyle.Regular); 533 myFont = new Font(myFont, FontStyle.Regular);
518 break; 534 break;
519 } 535 }
520 } 536 }
521 } 537 }
@@ -532,6 +548,57 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
532 float size = Convert.ToSingle(nextLine, CultureInfo.InvariantCulture); 548 float size = Convert.ToSingle(nextLine, CultureInfo.InvariantCulture);
533 drawPen.Width = size; 549 drawPen.Width = size;
534 } 550 }
551 else if (nextLine.StartsWith("PenCap"))
552 {
553 bool start = true, end = true;
554 nextLine = nextLine.Remove(0, 6);
555 nextLine = nextLine.Trim();
556 string[] cap = nextLine.Split(partsDelimiter);
557 if (cap[0].ToLower() == "start")
558 end = false;
559 else if (cap[0].ToLower() == "end")
560 start = false;
561 else if (cap[0].ToLower() != "both")
562 return;
563 string type = cap[1].ToLower();
564
565 if (end)
566 {
567 switch (type)
568 {
569 case "arrow":
570 drawPen.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
571 break;
572 case "round":
573 drawPen.EndCap = System.Drawing.Drawing2D.LineCap.RoundAnchor;
574 break;
575 case "diamond":
576 drawPen.EndCap = System.Drawing.Drawing2D.LineCap.DiamondAnchor;
577 break;
578 case "flat":
579 drawPen.EndCap = System.Drawing.Drawing2D.LineCap.Flat;
580 break;
581 }
582 }
583 if (start)
584 {
585 switch (type)
586 {
587 case "arrow":
588 drawPen.StartCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
589 break;
590 case "round":
591 drawPen.StartCap = System.Drawing.Drawing2D.LineCap.RoundAnchor;
592 break;
593 case "diamond":
594 drawPen.StartCap = System.Drawing.Drawing2D.LineCap.DiamondAnchor;
595 break;
596 case "flat":
597 drawPen.StartCap = System.Drawing.Drawing2D.LineCap.Flat;
598 break;
599 }
600 }
601 }
535 else if (nextLine.StartsWith("PenColour")) 602 else if (nextLine.StartsWith("PenColour"))
536 { 603 {
537 nextLine = nextLine.Remove(0, 9); 604 nextLine = nextLine.Remove(0, 9);
@@ -542,7 +609,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
542 if (Int32.TryParse(nextLine, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex)) 609 if (Int32.TryParse(nextLine, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex))
543 { 610 {
544 newColour = Color.FromArgb(hex); 611 newColour = Color.FromArgb(hex);
545 } 612 }
546 else 613 else
547 { 614 {
548 // this doesn't fail, it just returns black if nothing is found 615 // this doesn't fail, it just returns black if nothing is found
@@ -582,18 +649,40 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
582 } 649 }
583 } 650 }
584 651
652 private static void GetParams(char[] partsDelimiter, ref string line, int startLength, ref PointF[] points)
653 {
654 line = line.Remove(0, startLength);
655 string[] parts = line.Split(partsDelimiter);
656 if (parts.Length > 1 && parts.Length % 2 == 0)
657 {
658 points = new PointF[parts.Length / 2];
659 for (int i = 0; i < parts.Length; i = i + 2)
660 {
661 string xVal = parts[i].Trim();
662 string yVal = parts[i+1].Trim();
663 float x = Convert.ToSingle(xVal, CultureInfo.InvariantCulture);
664 float y = Convert.ToSingle(yVal, CultureInfo.InvariantCulture);
665 PointF point = new PointF(x, y);
666 points[i / 2] = point;
667 }
668 }
669 }
670
585 private Bitmap ImageHttpRequest(string url) 671 private Bitmap ImageHttpRequest(string url)
586 { 672 {
673 try
674 {
587 WebRequest request = HttpWebRequest.Create(url); 675 WebRequest request = HttpWebRequest.Create(url);
588//Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used. 676//Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used.
589//Ckrinke Stream str = null; 677//Ckrinke Stream str = null;
590 HttpWebResponse response = (HttpWebResponse) (request).GetResponse(); 678 HttpWebResponse response = (HttpWebResponse)(request).GetResponse();
591 if (response.StatusCode == HttpStatusCode.OK) 679 if (response.StatusCode == HttpStatusCode.OK)
592 { 680 {
593 Bitmap image = new Bitmap(response.GetResponseStream()); 681 Bitmap image = new Bitmap(response.GetResponseStream());
594 return image; 682 return image;
683 }
595 } 684 }
596 685 catch { }
597 return null; 686 return null;
598 } 687 }
599 } 688 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
index d4cb616..bd32f3b 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
@@ -139,6 +139,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
139 public abstract bool MoveFolder(InventoryFolderBase folder); 139 public abstract bool MoveFolder(InventoryFolderBase folder);
140 140
141 /// <summary> 141 /// <summary>
142 /// Delete a list of inventory folders (from trash)
143 /// </summary>
144 public abstract bool DeleteFolders(UUID ownerID, List<UUID> folderIDs);
145
146 /// <summary>
142 /// Purge an inventory folder of all its items and subfolders. 147 /// Purge an inventory folder of all its items and subfolders.
143 /// </summary> 148 /// </summary>
144 /// <param name="folder"></param> 149 /// <param name="folder"></param>
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index 787c6c8..1c66254 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -330,6 +330,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
330 } 330 }
331 } 331 }
332 332
333 public override bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)
334 {
335 if (folderIDs == null)
336 return false;
337 if (folderIDs.Count == 0)
338 return false;
339
340 if (IsLocalGridUser(ownerID))
341 return m_GridService.DeleteFolders(ownerID, folderIDs);
342 else
343 {
344 UUID sessionID = GetSessionID(ownerID);
345 string uri = GetUserInventoryURI(ownerID) + "/" + ownerID.ToString();
346 return m_HGService.DeleteFolders(uri, folderIDs, sessionID);
347 }
348 }
349
333 public override bool MoveFolder(InventoryFolderBase folder) 350 public override bool MoveFolder(InventoryFolderBase folder)
334 { 351 {
335 if (folder == null) 352 if (folder == null)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
index e6edcf2..66d11dd 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
@@ -258,6 +258,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
258 return m_InventoryService.MoveFolder(folder); 258 return m_InventoryService.MoveFolder(folder);
259 } 259 }
260 260
261 public override bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)
262 {
263 return m_InventoryService.DeleteFolders(ownerID, folderIDs);
264 }
265
261 /// <summary> 266 /// <summary>
262 /// Purge an inventory folder of all its items and subfolders. 267 /// Purge an inventory folder of all its items and subfolders.
263 /// </summary> 268 /// </summary>
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
index 201442c..0d32c77 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
@@ -243,6 +243,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
243 return m_RemoteConnector.MoveFolder(folder.Owner.ToString(), folder, sessionID); 243 return m_RemoteConnector.MoveFolder(folder.Owner.ToString(), folder, sessionID);
244 } 244 }
245 245
246 public override bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)
247 {
248 if (folderIDs == null)
249 return false;
250 if (folderIDs.Count == 0)
251 return false;
252
253 UUID sessionID = GetSessionID(ownerID);
254 return m_RemoteConnector.DeleteFolders(ownerID.ToString(), folderIDs, sessionID);
255 }
256
257
246 public override bool PurgeFolder(InventoryFolderBase folder) 258 public override bool PurgeFolder(InventoryFolderBase folder)
247 { 259 {
248 if (folder == null) 260 if (folder == null)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index a9d361b..3301536 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -789,23 +789,15 @@ namespace OpenSim.Region.Framework.Scenes
789 } 789 }
790 790
791 /// <summary> 791 /// <summary>
792 /// Removes an inventory folder. Although there is a packet in the Linden protocol for this, it may be 792 /// Removes an inventory folder. This packet is sent when the user
793 /// legacy and not currently used (purge folder is used to remove folders from trash instead). 793 /// right-clicks a folder that's already in trash and chooses "purge"
794 /// </summary> 794 /// </summary>
795 /// <param name="remoteClient"></param> 795 /// <param name="remoteClient"></param>
796 /// <param name="folderID"></param> 796 /// <param name="folderID"></param>
797 private void RemoveInventoryFolder(IClientAPI remoteClient, UUID folderID) 797 private void RemoveInventoryFolder(IClientAPI remoteClient, List<UUID> folderIDs)
798 { 798 {
799 // Unclear is this handler is ever called by the Linden client, but it might 799 m_log.DebugFormat("[SCENE INVENTORY]: RemoveInventoryFolders count {0}", folderIDs.Count);
800 800 InventoryService.DeleteFolders(remoteClient.AgentId, folderIDs);
801 InventoryFolderBase folder = new InventoryFolderBase(folderID);
802 folder.Owner = remoteClient.AgentId;
803 InventoryFolderBase trash = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.TrashFolder);
804 if (trash != null)
805 {
806 folder.ParentID = trash.ID;
807 InventoryService.MoveFolder(folder);
808 }
809 } 801 }
810 802
811 private SceneObjectGroup GetGroupByPrim(uint localID) 803 private SceneObjectGroup GetGroupByPrim(uint localID)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index d722e23..d3e414f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -441,9 +441,24 @@ namespace OpenSim.Region.Framework.Scenes
441 return; 441 return;
442 } 442 }
443 443
444 // We're going to send the reply async, because there may be
445 // an enormous quantity of packets -- basically the entire inventory!
446 // We don't want to block the client thread while all that is happening.
447 SendInventoryDelegate d = SendInventoryAsync;
448 d.BeginInvoke(remoteClient, folderID, ownerID, fetchFolders, fetchItems, sortOrder, SendInventoryComplete, d);
449 }
450
451 delegate void SendInventoryDelegate(IClientAPI remoteClient, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder);
452
453 void SendInventoryAsync(IClientAPI remoteClient, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder)
454 {
444 SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems); 455 SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems);
445 } 456 }
446 457
458 void SendInventoryComplete(IAsyncResult iar)
459 {
460 }
461
447 /// <summary> 462 /// <summary>
448 /// Handle the caps inventory descendents fetch. 463 /// Handle the caps inventory descendents fetch.
449 /// 464 ///
@@ -537,7 +552,7 @@ namespace OpenSim.Region.Framework.Scenes
537 552
538 public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID) 553 public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID)
539 { 554 {
540 InventoryFolderBase folder = new InventoryFolderBase(folderID); 555 InventoryFolderBase folder = new InventoryFolderBase(folderID, remoteClient.AgentId);
541 folder = InventoryService.GetFolder(folder); 556 folder = InventoryService.GetFolder(folder);
542 if (folder != null) 557 if (folder != null)
543 { 558 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index cb4e443..acf0375 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2143,9 +2143,14 @@ namespace OpenSim.Region.Framework.Scenes
2143 { 2143 {
2144 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); 2144 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
2145 2145
2146 m_log.DebugFormat( 2146 m_log.Debug("[Scene] Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName);
2147 "[SCENE]: Adding new {0} agent for {1} in {2}", 2147 /*
2148 ((aCircuit.child == true) ? "child" : "root"), client.Name, RegionInfo.RegionName); 2148 string logMsg = string.Format("[SCENE]: Adding new {0} agent for {1} in {2}",
2149 ((aCircuit.child == true) ? "child" : "root"), client.Name,
2150 RegionInfo.RegionName);
2151
2152 m_log.Debug(logMsg);
2153 */
2149 2154
2150 CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); 2155 CommsManager.UserProfileCacheService.AddNewUser(client.AgentId);
2151 2156
@@ -2154,7 +2159,7 @@ namespace OpenSim.Region.Framework.Scenes
2154 // HERE!!! Do the initial attachments right here 2159 // HERE!!! Do the initial attachments right here
2155 // first agent upon login is a root agent by design. 2160 // first agent upon login is a root agent by design.
2156 // All other AddNewClient calls find aCircuit.child to be true 2161 // All other AddNewClient calls find aCircuit.child to be true
2157 if (aCircuit.child == false) 2162 if (aCircuit == null || aCircuit.child == false)
2158 { 2163 {
2159 sp.IsChildAgent = false; 2164 sp.IsChildAgent = false;
2160 sp.RezAttachments(); 2165 sp.RezAttachments();
diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs
index b61959f..3c5e8c9 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs
@@ -213,7 +213,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
213 m_log.DebugFormat("[IRC-Channel-{0}] AccessPassword : <{1}>", cs.idn, cs.AccessPassword); 213 m_log.DebugFormat("[IRC-Channel-{0}] AccessPassword : <{1}>", cs.idn, cs.AccessPassword);
214 string[] excludes = config.GetString("exclude_list", "").Trim().Split(new Char[] { ',' }); 214 string[] excludes = config.GetString("exclude_list", "").Trim().Split(new Char[] { ',' });
215 cs.ExcludeList = new List<string>(excludes.Length); 215 cs.ExcludeList = new List<string>(excludes.Length);
216 foreach(string name in excludes) 216 foreach (string name in excludes)
217 { 217 {
218 cs.ExcludeList.Add(name.Trim().ToLower()); 218 cs.ExcludeList.Add(name.Trim().ToLower());
219 } 219 }
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index a3cefc9..b3bfe07 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -26,73 +26,157 @@
26 */ 26 */
27 27
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Threading;
29using OpenMetaverse; 30using OpenMetaverse;
30using Nini.Config; 31using Nini.Config;
31using OpenSim.Region.Framework.Interfaces; 32using OpenSim.Region.Framework.Interfaces;
32using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
34using OpenSim.Region.CoreModules.Avatar.NPC;
33using OpenSim.Framework; 35using OpenSim.Framework;
36using Timer=System.Timers.Timer;
34 37
35namespace OpenSim.Region.OptionalModules.World.NPC 38namespace OpenSim.Region.OptionalModules.World.NPC
36{ 39{
37 public interface INPCModule
38 {
39 UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom);
40 void Autopilot(UUID agentID, Scene scene, Vector3 pos);
41 void Say(UUID agentID, Scene scene, string text);
42 void DeleteNPC(UUID agentID, Scene scene);
43 }
44
45 public class NPCModule : IRegionModule, INPCModule 40 public class NPCModule : IRegionModule, INPCModule
46 { 41 {
47 // private const bool m_enabled = false; 42 // private const bool m_enabled = false;
48 43
44 private Mutex m_createMutex = new Mutex(false);
45
46 private Timer m_timer = new Timer(500);
47
49 private Dictionary<UUID,NPCAvatar> m_avatars = new Dictionary<UUID, NPCAvatar>(); 48 private Dictionary<UUID,NPCAvatar> m_avatars = new Dictionary<UUID, NPCAvatar>();
50 49
50 private Dictionary<UUID,AvatarAppearance> m_appearanceCache = new Dictionary<UUID, AvatarAppearance>();
51
52 // Timer vars.
53 private bool p_inUse = false;
54 private readonly object p_lock = new object();
55 // Private Temporary Variables.
56 private string p_firstname;
57 private string p_lastname;
58 private Vector3 p_position;
59 private Scene p_scene;
60 private UUID p_cloneAppearanceFrom;
61 private UUID p_returnUuid;
62
63 private AvatarAppearance GetAppearance(UUID target, Scene scene)
64 {
65 if (m_appearanceCache.ContainsKey(target))
66 return m_appearanceCache[target];
67
68 AvatarAppearance x = scene.CommsManager.AvatarService.GetUserAppearance(target);
69
70 m_appearanceCache.Add(target, x);
71
72 return x;
73 }
74
51 public UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom) 75 public UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom)
52 { 76 {
53 NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, scene); 77 // Block.
54 scene.AddNewClient(npcAvatar); 78 m_createMutex.WaitOne();
55 79
56 ScenePresence sp; 80 // Copy Temp Variables for Timer to pick up.
57 if(scene.TryGetAvatar(npcAvatar.AgentId, out sp)) 81 lock (p_lock)
58 { 82 {
59 AvatarAppearance x = scene.CommsManager.AvatarService.GetUserAppearance(cloneAppearanceFrom); 83 p_firstname = firstname;
60 84 p_lastname = lastname;
61 List<byte> wearbyte = new List<byte>(); 85 p_position = position;
62 for (int i = 0; i < x.VisualParams.Length; i++) 86 p_scene = scene;
63 { 87 p_cloneAppearanceFrom = cloneAppearanceFrom;
64 wearbyte.Add(x.VisualParams[i]); 88 p_inUse = true;
65 } 89 p_returnUuid = UUID.Zero;
90 }
66 91
67 sp.SetAppearance(x.Texture.GetBytes(), wearbyte); 92 while (p_returnUuid == UUID.Zero)
93 {
94 Thread.Sleep(250);
68 } 95 }
69 96
70 m_avatars.Add(npcAvatar.AgentId, npcAvatar); 97 m_createMutex.ReleaseMutex();
71 98
72 return npcAvatar.AgentId; 99 return p_returnUuid;
73 } 100 }
74 101
75 public void Autopilot(UUID agentID, Scene scene, Vector3 pos) 102 public void Autopilot(UUID agentID, Scene scene, Vector3 pos)
76 { 103 {
77 ScenePresence sp; 104 lock (m_avatars)
78 scene.TryGetAvatar(agentID, out sp); 105 {
79 sp.DoAutoPilot(0,pos,m_avatars[agentID]); 106 if (m_avatars.ContainsKey(agentID))
107 {
108 ScenePresence sp;
109 scene.TryGetAvatar(agentID, out sp);
110 sp.DoAutoPilot(0, pos, m_avatars[agentID]);
111 }
112 }
80 } 113 }
81 114
82 public void Say(UUID agentID, Scene scene, string text) 115 public void Say(UUID agentID, Scene scene, string text)
83 { 116 {
84 m_avatars[agentID].Say(text); 117 lock (m_avatars)
118 {
119 if (m_avatars.ContainsKey(agentID))
120 {
121 m_avatars[agentID].Say(text);
122 }
123 }
85 } 124 }
86 125
87 public void DeleteNPC(UUID agentID, Scene scene) 126 public void DeleteNPC(UUID agentID, Scene scene)
88 { 127 {
89 scene.RemoveClient(agentID); 128 lock (m_avatars)
129 {
130 if (m_avatars.ContainsKey(agentID))
131 {
132 scene.RemoveClient(agentID);
133 m_avatars.Remove(agentID);
134 }
135 }
90 } 136 }
91 137
92 138
93 public void Initialise(Scene scene, IConfigSource source) 139 public void Initialise(Scene scene, IConfigSource source)
94 { 140 {
95 scene.RegisterModuleInterface<INPCModule>(this); 141 scene.RegisterModuleInterface<INPCModule>(this);
142
143 m_timer.Elapsed += m_timer_Elapsed;
144 m_timer.Start();
145 }
146
147 void m_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
148 {
149 lock (p_lock)
150 {
151 if (p_inUse)
152 {
153 p_inUse = false;
154
155 NPCAvatar npcAvatar = new NPCAvatar(p_firstname, p_lastname, p_position, p_scene);
156 npcAvatar.CircuitCode = (uint) Util.RandomClass.Next(0, int.MaxValue);
157
158 p_scene.ClientManager.Add(npcAvatar.CircuitCode, npcAvatar);
159 p_scene.AddNewClient(npcAvatar);
160
161 ScenePresence sp;
162 if (p_scene.TryGetAvatar(npcAvatar.AgentId, out sp))
163 {
164 AvatarAppearance x = GetAppearance(p_cloneAppearanceFrom, p_scene);
165
166 List<byte> wearbyte = new List<byte>();
167 for (int i = 0; i < x.VisualParams.Length; i++)
168 {
169 wearbyte.Add(x.VisualParams[i]);
170 }
171
172 sp.SetAppearance(x.Texture.GetBytes(), wearbyte);
173 }
174
175 m_avatars.Add(npcAvatar.AgentId, npcAvatar);
176
177 p_returnUuid = npcAvatar.AgentId;
178 }
179 }
96 } 180 }
97 181
98 public void PostInitialise() 182 public void PostInitialise()
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
index a74eb0c..8d8b3fe 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
@@ -43,6 +43,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
43 private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; 43 private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero;
44 private bool flying; 44 private bool flying;
45 private bool iscolliding; 45 private bool iscolliding;
46
46 public BasicActor() 47 public BasicActor()
47 { 48 {
48 _velocity = new PhysicsVector(); 49 _velocity = new PhysicsVector();
diff --git a/OpenSim/Region/Physics/Manager/PhysicsVector.cs b/OpenSim/Region/Physics/Manager/PhysicsVector.cs
index c275021..d6f4d0d 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsVector.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsVector.cs
@@ -46,12 +46,17 @@ namespace OpenSim.Region.Physics.Manager
46 Z = z; 46 Z = z;
47 } 47 }
48 48
49 public PhysicsVector(PhysicsVector pv) : this(pv.X, pv.Y, pv.Z)
50 {
51 }
52
49 public void setValues(float x, float y, float z) 53 public void setValues(float x, float y, float z)
50 { 54 {
51 X = x; 55 X = x;
52 Y = y; 56 Y = y;
53 Z = z; 57 Z = z;
54 } 58 }
59
55 public static readonly PhysicsVector Zero = new PhysicsVector(0f, 0f, 0f); 60 public static readonly PhysicsVector Zero = new PhysicsVector(0f, 0f, 0f);
56 61
57 public override string ToString() 62 public override string ToString()
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 35433c6..38df751 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -1025,7 +1025,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1025 } 1025 }
1026 } 1026 }
1027 1027
1028
1029 if (flying) 1028 if (flying)
1030 { 1029 {
1031 vec.Z = (_target_velocity.Z - vel.Z) * (PID_D); 1030 vec.Z = (_target_velocity.Z - vel.Z) * (PID_D);
@@ -1044,7 +1043,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1044 vec.Z += (target_altitude - _position.Z) * PID_P * 5.0f; 1043 vec.Z += (target_altitude - _position.Z) * PID_P * 5.0f;
1045 } 1044 }
1046 // end add Kitto Flora 1045 // end add Kitto Flora
1047
1048 } 1046 }
1049 if (PhysicsVector.isFinite(vec)) 1047 if (PhysicsVector.isFinite(vec))
1050 { 1048 {
@@ -1080,8 +1078,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1080 _parent_scene.geom_name_map.Remove(Shell); 1078 _parent_scene.geom_name_map.Remove(Shell);
1081 Shell = IntPtr.Zero; 1079 Shell = IntPtr.Zero;
1082 } 1080 }
1083
1084 return;
1085 } 1081 }
1086 } 1082 }
1087 1083
diff --git a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
index 1973adf..35fc616 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
@@ -43,7 +43,7 @@ namespace OpenSim.Region.Physics.POSPlugin
43 private PhysicsVector _acceleration; 43 private PhysicsVector _acceleration;
44 private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; 44 private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero;
45 private bool flying; 45 private bool flying;
46 private bool iscolliding; 46 private bool isColliding;
47 47
48 public POSCharacter() 48 public POSCharacter()
49 { 49 {
@@ -116,8 +116,8 @@ namespace OpenSim.Region.Physics.POSPlugin
116 116
117 public override bool IsColliding 117 public override bool IsColliding
118 { 118 {
119 get { return iscolliding; } 119 get { return isColliding; }
120 set { iscolliding = value; } 120 set { isColliding = value; }
121 } 121 }
122 122
123 public override bool CollidingGround 123 public override bool CollidingGround
diff --git a/OpenSim/Region/Physics/POSPlugin/POSScene.cs b/OpenSim/Region/Physics/POSPlugin/POSScene.cs
index 5361be0..fa8cc70 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSScene.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSScene.cs
@@ -113,20 +113,16 @@ namespace OpenSim.Region.Physics.POSPlugin
113 c.Position.Z - p.Position.Z) * Quaternion.Inverse(p.Orientation); 113 c.Position.Z - p.Position.Z) * Quaternion.Inverse(p.Orientation);
114 Vector3 avatarSize = new Vector3(c.Size.X, c.Size.Y, c.Size.Z) * Quaternion.Inverse(p.Orientation); 114 Vector3 avatarSize = new Vector3(c.Size.X, c.Size.Y, c.Size.Z) * Quaternion.Inverse(p.Orientation);
115 115
116 if (Math.Abs(rotatedPos.X) >= (p.Size.X*0.5 + Math.Abs(avatarSize.X)) || 116 return (Math.Abs(rotatedPos.X) < (p.Size.X*0.5 + Math.Abs(avatarSize.X)) &&
117 Math.Abs(rotatedPos.Y) >= (p.Size.Y*0.5 + Math.Abs(avatarSize.Y)) || 117 Math.Abs(rotatedPos.Y) < (p.Size.Y*0.5 + Math.Abs(avatarSize.Y)) &&
118 Math.Abs(rotatedPos.Z) >= (p.Size.Z*0.5 + Math.Abs(avatarSize.Z))) 118 Math.Abs(rotatedPos.Z) < (p.Size.Z*0.5 + Math.Abs(avatarSize.Z)));
119 {
120 return false;
121 }
122 return true;
123 } 119 }
124 120
125 private bool isCollidingWithPrim(POSCharacter c) 121 private bool isCollidingWithPrim(POSCharacter c)
126 { 122 {
127 for (int i = 0; i < _prims.Count; ++i) 123 foreach (POSPrim p in _prims)
128 { 124 {
129 if (isColliding(c, _prims[i])) 125 if (isColliding(c, p))
130 { 126 {
131 return true; 127 return true;
132 } 128 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 972e71c..16dd834 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1978,25 +1978,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1978 return new LSL_Rotation(q.X, q.Y, q.Z, q.W); 1978 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
1979 } 1979 }
1980 1980
1981 private LSL_Rotation GetPartRot( SceneObjectPart part ) 1981 private LSL_Rotation GetPartRot(SceneObjectPart part)
1982 { 1982 {
1983 Quaternion q; 1983 Quaternion q;
1984 if (part.LinkNum == 0 || part.LinkNum == 1) // unlinked or root prim 1984 if (part.LinkNum == 0 || part.LinkNum == 1) // unlinked or root prim
1985 { 1985 {
1986 if (part.ParentGroup.RootPart.AttachmentPoint != 0) 1986 if (part.ParentGroup.RootPart.AttachmentPoint != 0)
1987 { 1987 {
1988 ScenePresence avatar = World.GetScenePresence(part.AttachedAvatar); 1988 ScenePresence avatar = World.GetScenePresence(part.AttachedAvatar);
1989 if (avatar != null) 1989 if (avatar != null)
1990 if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) 1990 {
1991 q = avatar.CameraRotation; // Mouselook 1991 if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
1992 else 1992 q = avatar.CameraRotation; // Mouselook
1993 q = avatar.Rotation; // Currently infrequently updated so may be inaccurate 1993 else
1994 else 1994 q = avatar.Rotation; // Currently infrequently updated so may be inaccurate
1995 q = part.ParentGroup.GroupRotation; // Likely never get here but just in case 1995 }
1996 } 1996 else
1997 else 1997 q = part.ParentGroup.GroupRotation; // Likely never get here but just in case
1998 q = part.ParentGroup.GroupRotation; // just the group rotation 1998 }
1999 return new LSL_Rotation(q.X, q.Y, q.Z, q.W); 1999 else
2000 q = part.ParentGroup.GroupRotation; // just the group rotation
2001 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
2000 } 2002 }
2001 q = part.GetWorldRotation(); 2003 q = part.GetWorldRotation();
2002 return new LSL_Rotation(q.X, q.Y, q.Z, q.W); 2004 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 6e3a3ab..b1c357c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -31,12 +31,14 @@ using System.Collections.Generic;
31using System.Runtime.Remoting.Lifetime; 31using System.Runtime.Remoting.Lifetime;
32using System.Text; 32using System.Text;
33using System.Net; 33using System.Net;
34using System.Threading;
34using OpenMetaverse; 35using OpenMetaverse;
35using Nini.Config; 36using Nini.Config;
36using OpenSim; 37using OpenSim;
37using OpenSim.Framework; 38using OpenSim.Framework;
38using OpenSim.Framework.Communications.Cache; 39using OpenSim.Framework.Communications.Cache;
39using OpenSim.Framework.Console; 40using OpenSim.Framework.Console;
41using OpenSim.Region.CoreModules.Avatar.NPC;
40using OpenSim.Region.Framework.Interfaces; 42using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Framework.Scenes; 43using OpenSim.Region.Framework.Scenes;
42using OpenSim.Region.Framework.Scenes.Hypergrid; 44using OpenSim.Region.Framework.Scenes.Hypergrid;
@@ -831,6 +833,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
831 return drawList; 833 return drawList;
832 } 834 }
833 835
836 public string osDrawFilledPolygon(string drawList, LSL_List x, LSL_List y)
837 {
838 CheckThreatLevel(ThreatLevel.None, "osDrawFilledPolygon");
839
840 m_host.AddScriptLPS(1);
841
842 if (x.Length != y.Length || x.Length < 3)
843 {
844 return "";
845 }
846 drawList += "FillPolygon " + x.GetLSLStringItem(0) + "," + y.GetLSLStringItem(0);
847 for (int i = 1; i < x.Length; i++)
848 {
849 drawList += "," + x.GetLSLStringItem(i) + "," + y.GetLSLStringItem(i);
850 }
851 drawList += "; ";
852 return drawList;
853 }
854
834 public string osSetFontSize(string drawList, int fontSize) 855 public string osSetFontSize(string drawList, int fontSize)
835 { 856 {
836 CheckThreatLevel(ThreatLevel.None, "osSetFontSize"); 857 CheckThreatLevel(ThreatLevel.None, "osSetFontSize");
@@ -858,6 +879,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
858 return drawList; 879 return drawList;
859 } 880 }
860 881
882 public string osSetPenCap(string drawList, string direction, string type)
883 {
884 CheckThreatLevel(ThreatLevel.None, "osSetPenColour");
885
886 m_host.AddScriptLPS(1);
887 drawList += "PenCap " + direction + "," + type + "; ";
888 return drawList;
889 }
890
861 public string osDrawImage(string drawList, int width, int height, string imageUrl) 891 public string osDrawImage(string drawList, int width, int height, string imageUrl)
862 { 892 {
863 CheckThreatLevel(ThreatLevel.None, "osDrawImage"); 893 CheckThreatLevel(ThreatLevel.None, "osDrawImage");
@@ -1762,5 +1792,57 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1762 return retVal; 1792 return retVal;
1763 } 1793 }
1764 1794
1795 public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, LSL_Key cloneFrom)
1796 {
1797 CheckThreatLevel(ThreatLevel.High, "osNpcCreate");
1798 //QueueUserWorkItem
1799
1800 INPCModule module = World.RequestModuleInterface<INPCModule>();
1801 if (module != null)
1802 {
1803 UUID x = module.CreateNPC(firstname,
1804 lastname,
1805 new Vector3((float) position.x, (float) position.y, (float) position.z),
1806 World,
1807 new UUID(cloneFrom));
1808
1809 return new LSL_Key(x.ToString());
1810 }
1811 return new LSL_Key(UUID.Zero.ToString());
1812 }
1813
1814 public void osNpcMoveTo(LSL_Key npc, LSL_Vector position)
1815 {
1816 CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo");
1817
1818 INPCModule module = World.RequestModuleInterface<INPCModule>();
1819 if (module != null)
1820 {
1821 Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z);
1822 module.Autopilot(new UUID(npc.m_string), World, pos);
1823 }
1824 }
1825
1826 public void osNpcSay(LSL_Key npc, string message)
1827 {
1828 CheckThreatLevel(ThreatLevel.High, "osNpcSay");
1829
1830 INPCModule module = World.RequestModuleInterface<INPCModule>();
1831 if (module != null)
1832 {
1833 module.Say(new UUID(npc.m_string), World, message);
1834 }
1835 }
1836
1837 public void osNpcRemove(LSL_Key npc)
1838 {
1839 CheckThreatLevel(ThreatLevel.High, "osNpcRemove");
1840
1841 INPCModule module = World.RequestModuleInterface<INPCModule>();
1842 if (module != null)
1843 {
1844 module.DeleteNPC(new UUID(npc.m_string), World);
1845 }
1846 }
1765 } 1847 }
1766} 1848}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 0be29f2..2365bee 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -97,9 +97,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
97 string osDrawEllipse(string drawList, int width, int height); 97 string osDrawEllipse(string drawList, int width, int height);
98 string osDrawRectangle(string drawList, int width, int height); 98 string osDrawRectangle(string drawList, int width, int height);
99 string osDrawFilledRectangle(string drawList, int width, int height); 99 string osDrawFilledRectangle(string drawList, int width, int height);
100 string osDrawFilledPolygon(string drawList, LSL_List x, LSL_List y);
100 string osSetFontSize(string drawList, int fontSize); 101 string osSetFontSize(string drawList, int fontSize);
101 string osSetPenSize(string drawList, int penSize); 102 string osSetPenSize(string drawList, int penSize);
102 string osSetPenColour(string drawList, string colour); 103 string osSetPenColour(string drawList, string colour);
104 string osSetPenCap(string drawList, string direction, string type);
103 string osDrawImage(string drawList, int width, int height, string imageUrl); 105 string osDrawImage(string drawList, int width, int height, string imageUrl);
104 vector osGetDrawStringSize(string contentType, string text, string fontName, int fontSize); 106 vector osGetDrawStringSize(string contentType, string text, string fontName, int fontSize);
105 void osSetStateEvents(int events); 107 void osSetStateEvents(int events);
@@ -149,5 +151,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
149 151
150 LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules); 152 LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules);
151 153
154
155 key osNpcCreate(string user, string name, vector position, key cloneFrom);
156 void osNpcMoveTo(key npc, vector position);
157 void osNpcSay(key npc, string message);
158 void osNpcRemove(key npc);
159
152 } 160 }
153} 161}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index abdba05..f877acb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -267,6 +267,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
267 return m_OSSL_Functions.osDrawFilledRectangle(drawList, width, height); 267 return m_OSSL_Functions.osDrawFilledRectangle(drawList, width, height);
268 } 268 }
269 269
270 public string osDrawFilledPolygon(string drawList, LSL_List x, LSL_List y)
271 {
272 return m_OSSL_Functions.osDrawFilledPolygon(drawList, x, y);
273 }
274
270 public string osSetFontSize(string drawList, int fontSize) 275 public string osSetFontSize(string drawList, int fontSize)
271 { 276 {
272 return m_OSSL_Functions.osSetFontSize(drawList, fontSize); 277 return m_OSSL_Functions.osSetFontSize(drawList, fontSize);
@@ -277,6 +282,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
277 return m_OSSL_Functions.osSetPenSize(drawList, penSize); 282 return m_OSSL_Functions.osSetPenSize(drawList, penSize);
278 } 283 }
279 284
285 public string osSetPenCap(string drawList, string direction, string type)
286 {
287 return m_OSSL_Functions.osSetPenCap(drawList, direction, type);
288 }
289
280 public string osSetPenColour(string drawList, string colour) 290 public string osSetPenColour(string drawList, string colour)
281 { 291 {
282 return m_OSSL_Functions.osSetPenColour(drawList, colour); 292 return m_OSSL_Functions.osSetPenColour(drawList, colour);
@@ -393,6 +403,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
393 return m_OSSL_Functions.osGetLinkPrimitiveParams(linknumber, rules); 403 return m_OSSL_Functions.osGetLinkPrimitiveParams(linknumber, rules);
394 } 404 }
395 405
406 public key osNpcCreate(string user, string name, vector position, key cloneFrom)
407 {
408 return m_OSSL_Functions.osNpcCreate(user, name, position, cloneFrom);
409 }
410
411 public void osNpcMoveTo(key npc, vector position)
412 {
413 m_OSSL_Functions.osNpcMoveTo(npc, position);
414 }
415
416 public void osNpcSay(key npc, string message)
417 {
418 m_OSSL_Functions.osNpcSay(npc, message);
419 }
420
421 public void osNpcRemove(key npc)
422 {
423 m_OSSL_Functions.osNpcRemove(npc);
424 }
396 425
397 public OSSLPrim Prim; 426 public OSSLPrim Prim;
398 427
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index bdacf8b..2842f6b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -439,6 +439,13 @@ namespace OpenSim.Region.ScriptEngine.Shared
439 439
440 set {m_data = value; } 440 set {m_data = value; }
441 } 441 }
442 // Function to obtain LSL type from an index. This is needed
443 // because LSL lists allow for multiple types, and safely
444 // iterating in them requires a type check.
445 public Type GetLSLListItemType(int itemIndex)
446 {
447 return m_data[itemIndex].GetType();
448 }
442 449
443 // Member functions to obtain item as specific types. 450 // Member functions to obtain item as specific types.
444 // For cases where implicit conversions would apply if items 451 // For cases where implicit conversions would apply if items
@@ -465,6 +472,10 @@ namespace OpenSim.Region.ScriptEngine.Shared
465 { 472 {
466 return new LSL_Types.LSLFloat((Double)m_data[itemIndex]); 473 return new LSL_Types.LSLFloat((Double)m_data[itemIndex]);
467 } 474 }
475 else if (m_data[itemIndex] is LSL_Types.LSLString)
476 {
477 return new LSL_Types.LSLFloat(m_data[itemIndex].ToString());
478 }
468 else 479 else
469 { 480 {
470 return (LSL_Types.LSLFloat)m_data[itemIndex]; 481 return (LSL_Types.LSLFloat)m_data[itemIndex];
@@ -481,20 +492,32 @@ namespace OpenSim.Region.ScriptEngine.Shared
481 { 492 {
482 return new LSL_Types.LSLString((string)m_data[itemIndex]); 493 return new LSL_Types.LSLString((string)m_data[itemIndex]);
483 } 494 }
495 else if (m_data[itemIndex] is LSL_Types.LSLFloat)
496 {
497 return new LSL_Types.LSLString((LSLFloat)m_data[itemIndex]);
498 }
499 else if (m_data[itemIndex] is LSL_Types.LSLInteger)
500 {
501 return new LSL_Types.LSLString((LSLInteger)m_data[itemIndex]);
502 }
484 else 503 else
485 { 504 {
486 return (LSL_Types.LSLString)m_data[itemIndex]; 505 return (LSL_Types.LSLString)m_data[itemIndex];
487 } 506 }
488 } 507 }
489 508
490 public LSL_Types.LSLInteger GetLSLIntegerItem(int itemIndex) 509 public LSL_Types.LSLInteger GetLSLIntegerItem(int itemIndex)
491 { 510 {
492 if (m_data[itemIndex] is LSL_Types.LSLInteger) 511 if (m_data[itemIndex] is LSL_Types.LSLInteger)
493 return (LSL_Types.LSLInteger)m_data[itemIndex]; 512 return (LSL_Types.LSLInteger)m_data[itemIndex];
494 else if (m_data[itemIndex] is Int32) 513 if (m_data[itemIndex] is LSL_Types.LSLFloat)
495 return new LSLInteger((int)m_data[itemIndex]); 514 return new LSLInteger((int)m_data[itemIndex]);
496 else 515 else if (m_data[itemIndex] is Int32)
497 throw new InvalidCastException(); 516 return new LSLInteger((int)m_data[itemIndex]);
517 else if (m_data[itemIndex] is LSL_Types.LSLString)
518 return new LSLInteger((string)m_data[itemIndex]);
519 else
520 throw new InvalidCastException();
498 } 521 }
499 522
500 public LSL_Types.Vector3 GetVector3Item(int itemIndex) 523 public LSL_Types.Vector3 GetVector3Item(int itemIndex)
@@ -1331,6 +1354,12 @@ namespace OpenSim.Region.ScriptEngine.Shared
1331 m_string=s; 1354 m_string=s;
1332 } 1355 }
1333 1356
1357 public LSLString(LSLInteger i)
1358 {
1359 string s = String.Format("{0}", i);
1360 m_string = s;
1361 }
1362
1334 #endregion 1363 #endregion
1335 1364
1336 #region Operators 1365 #region Operators
diff --git a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs
index 6ef1d9d..998b322 100644
--- a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs
+++ b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs
@@ -106,6 +106,10 @@ namespace OpenSim.Server.Handlers.Inventory
106 106
107 m_httpServer.AddStreamHandler( 107 m_httpServer.AddStreamHandler(
108 new RestDeserialiseSecureHandler<List<Guid>, bool>( 108 new RestDeserialiseSecureHandler<List<Guid>, bool>(
109 "POST", "/DeleteFolders/", DeleteFolders, CheckAuthSession));
110
111 m_httpServer.AddStreamHandler(
112 new RestDeserialiseSecureHandler<List<Guid>, bool>(
109 "POST", "/DeleteItem/", DeleteItems, CheckAuthSession)); 113 "POST", "/DeleteItem/", DeleteItems, CheckAuthSession));
110 114
111 m_httpServer.AddStreamHandler( 115 m_httpServer.AddStreamHandler(
@@ -143,6 +147,9 @@ namespace OpenSim.Server.Handlers.Inventory
143 m_httpServer.AddStreamHandler( 147 m_httpServer.AddStreamHandler(
144 new RestDeserialiseSecureHandler<List<InventoryItemBase>, bool>( 148 new RestDeserialiseSecureHandler<List<InventoryItemBase>, bool>(
145 "POST", "/MoveItems/", MoveItems, CheckAuthSession)); 149 "POST", "/MoveItems/", MoveItems, CheckAuthSession));
150
151 m_httpServer.AddStreamHandler(new InventoryServerMoveItemsHandler(m_InventoryService));
152
146 153
147 // for persistent active gestures 154 // for persistent active gestures
148 m_httpServer.AddStreamHandler( 155 m_httpServer.AddStreamHandler(
@@ -251,6 +258,15 @@ namespace OpenSim.Server.Handlers.Inventory
251 return m_InventoryService.GetAssetPermissions(item.Owner, item.AssetID); 258 return m_InventoryService.GetAssetPermissions(item.Owner, item.AssetID);
252 } 259 }
253 260
261 public bool DeleteFolders(List<Guid> items)
262 {
263 List<UUID> uuids = new List<UUID>();
264 foreach (Guid g in items)
265 uuids.Add(new UUID(g));
266 // oops we lost the user info here. Bad bad handlers
267 return m_InventoryService.DeleteFolders(UUID.Zero, uuids);
268 }
269
254 public bool DeleteItems(List<Guid> items) 270 public bool DeleteItems(List<Guid> items)
255 { 271 {
256 List<UUID> uuids = new List<UUID>(); 272 List<UUID> uuids = new List<UUID>();
diff --git a/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs
new file mode 100644
index 0000000..850bf14
--- /dev/null
+++ b/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs
@@ -0,0 +1,81 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
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
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
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using Nini.Config;
29using log4net;
30using System;
31using System.Collections.Generic;
32using System.Reflection;
33using System.IO;
34using System.Net;
35using System.Text;
36using System.Text.RegularExpressions;
37using System.Xml;
38using System.Xml.Serialization;
39using OpenSim.Server.Base;
40using OpenSim.Services.Interfaces;
41using OpenSim.Framework;
42using OpenSim.Framework.Servers.HttpServer;
43using OpenMetaverse;
44
45namespace OpenSim.Server.Handlers.Inventory
46{
47 public class InventoryServerMoveItemsHandler : BaseStreamHandler
48 {
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50
51 private IInventoryService m_InventoryService;
52
53 public InventoryServerMoveItemsHandler(IInventoryService service) :
54 base("PUT", "/inventory")
55 {
56 m_InventoryService = service;
57 }
58
59 public override byte[] Handle(string path, Stream request,
60 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
61 {
62 XmlSerializer xs = new XmlSerializer(typeof (List<InventoryItemBase>));
63 List<InventoryItemBase> items = (List<InventoryItemBase>)xs.Deserialize(request);
64
65 bool result = false;
66 string[] p = SplitParams(path);
67
68 if (p.Length > 0)
69 {
70 UUID ownerID = UUID.Zero;
71 UUID.TryParse(p[0], out ownerID);
72 result = m_InventoryService.MoveItems(ownerID, items);
73 }
74 else
75 m_log.WarnFormat("[MOVEITEMS HANDLER]: ownerID not provided in request. Unable to serve.");
76
77 xs = new XmlSerializer(typeof(bool));
78 return ServerUtils.SerializeResult(xs, result);
79 }
80 }
81}
diff --git a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs
index 45e921a..1004fb9 100644
--- a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs
@@ -201,6 +201,19 @@ namespace OpenSim.Services.Connectors.Inventory
201 return false; 201 return false;
202 } 202 }
203 203
204 public bool DeleteFolders(string id, List<UUID> folders, UUID sessionID)
205 {
206 string url = string.Empty;
207 string userID = string.Empty;
208
209 if (StringToUrlAndUserID(id, out url, out userID))
210 {
211 ISessionAuthInventoryService connector = GetConnector(url);
212 return connector.DeleteFolders(userID, folders, sessionID);
213 }
214 return false;
215 }
216
204 public bool PurgeFolder(string id, InventoryFolderBase folder, UUID sessionID) 217 public bool PurgeFolder(string id, InventoryFolderBase folder, UUID sessionID)
205 { 218 {
206 string url = string.Empty; 219 string url = string.Empty;
diff --git a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs
index c89c9b7..da8c7e2 100644
--- a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs
+++ b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs
@@ -89,6 +89,11 @@ namespace OpenSim.Services.Connectors
89 bool MoveFolder(string userID, InventoryFolderBase folder, UUID session_id); 89 bool MoveFolder(string userID, InventoryFolderBase folder, UUID session_id);
90 90
91 /// <summary> 91 /// <summary>
92 /// Delete a list of inventory folders (from trash)
93 /// </summary>
94 bool DeleteFolders(string userID, List<UUID> folders, UUID session_id);
95
96 /// <summary>
92 /// Purge an inventory folder of all its items and subfolders. 97 /// Purge an inventory folder of all its items and subfolders.
93 /// </summary> 98 /// </summary>
94 /// <param name="folder"></param> 99 /// <param name="folder"></param>
diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs
index b573a06..a2261ba 100644
--- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs
@@ -229,6 +229,11 @@ namespace OpenSim.Services.Connectors
229 return SynchronousRestSessionObjectPoster<Guid, InventoryCollection>.BeginPostObject( 229 return SynchronousRestSessionObjectPoster<Guid, InventoryCollection>.BeginPostObject(
230 "POST", m_ServerURI + "/GetFolderContent/", folderID.Guid, sessionID.ToString(), userID.ToString()); 230 "POST", m_ServerURI + "/GetFolderContent/", folderID.Guid, sessionID.ToString(), userID.ToString());
231 } 231 }
232 catch (TimeoutException e)
233 {
234 m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderContent operation to {0} timed out {0} {1}.", m_ServerURI,
235 e.Source, e.Message);
236 }
232 catch (Exception e) 237 catch (Exception e)
233 { 238 {
234 // Maybe we're talking to an old inventory server. Try this other thing. 239 // Maybe we're talking to an old inventory server. Try this other thing.
@@ -308,6 +313,25 @@ namespace OpenSim.Services.Connectors
308 return false; 313 return false;
309 } 314 }
310 315
316 public bool DeleteFolders(string userID, List<UUID> folderIDs, UUID sessionID)
317 {
318 try
319 {
320 List<Guid> guids = new List<Guid>();
321 foreach (UUID u in folderIDs)
322 guids.Add(u.Guid);
323 return SynchronousRestSessionObjectPoster<List<Guid>, bool>.BeginPostObject(
324 "POST", m_ServerURI + "/DeleteFolders/", guids, sessionID.ToString(), userID);
325 }
326 catch (Exception e)
327 {
328 m_log.ErrorFormat("[INVENTORY CONNECTOR]: Delete inventory folders operation failed, {0} {1}",
329 e.Source, e.Message);
330 }
331
332 return false;
333 }
334
311 public bool MoveFolder(string userID, InventoryFolderBase folder, UUID sessionID) 335 public bool MoveFolder(string userID, InventoryFolderBase folder, UUID sessionID)
312 { 336 {
313 try 337 try
@@ -397,13 +421,28 @@ namespace OpenSim.Services.Connectors
397 421
398 private void MoveItemsAsync(string userID, List<InventoryItemBase> items, UUID sessionID) 422 private void MoveItemsAsync(string userID, List<InventoryItemBase> items, UUID sessionID)
399 { 423 {
424 if (items == null)
425 {
426 m_log.WarnFormat("[INVENTORY CONNECTOR]: request to move items got a null list.");
427 return;
428 }
429
400 try 430 try
401 { 431 {
402 SynchronousRestSessionObjectPoster<List<InventoryItemBase>, bool>.BeginPostObject( 432 //SynchronousRestSessionObjectPoster<List<InventoryItemBase>, bool>.BeginPostObject(
403 "POST", m_ServerURI + "/MoveItems/", items, sessionID.ToString(), userID.ToString()); 433 // "POST", m_ServerURI + "/MoveItems/", items, sessionID.ToString(), userID.ToString());
434
435 //// Success
436 //return;
437 string uri = m_ServerURI + "/inventory/" + userID;
438 if (SynchronousRestObjectRequester.
439 MakeRequest<List<InventoryItemBase>, bool>("PUT", uri, items))
440 m_log.DebugFormat("[INVENTORY CONNECTOR]: move {0} items poster succeeded {1}", items.Count, uri);
441 else
442 m_log.DebugFormat("[INVENTORY CONNECTOR]: move {0} items poster failed {1}", items.Count, uri); ;
404 443
405 // Success
406 return; 444 return;
445
407 } 446 }
408 catch (Exception e) 447 catch (Exception e)
409 { 448 {
@@ -466,12 +505,12 @@ namespace OpenSim.Services.Connectors
466 return null; 505 return null;
467 } 506 }
468 507
469 public InventoryFolderBase QueryFolder(string userID, InventoryFolderBase item, UUID sessionID) 508 public InventoryFolderBase QueryFolder(string userID, InventoryFolderBase folder, UUID sessionID)
470 { 509 {
471 try 510 try
472 { 511 {
473 return SynchronousRestSessionObjectPoster<InventoryFolderBase, InventoryFolderBase>.BeginPostObject( 512 return SynchronousRestSessionObjectPoster<InventoryFolderBase, InventoryFolderBase>.BeginPostObject(
474 "POST", m_ServerURI + "/QueryFolder/", item, sessionID.ToString(), item.Owner.ToString()); 513 "POST", m_ServerURI + "/QueryFolder/", folder, sessionID.ToString(), userID);
475 } 514 }
476 catch (Exception e) 515 catch (Exception e)
477 { 516 {
diff --git a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs
index cd283ff..a7aa138 100644
--- a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs
@@ -136,6 +136,12 @@ namespace OpenSim.Services.Connectors
136 return false; 136 return false;
137 } 137 }
138 138
139 public bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)
140 {
141 return false;
142 }
143
144
139 public bool PurgeFolder(InventoryFolderBase folder) 145 public bool PurgeFolder(InventoryFolderBase folder)
140 { 146 {
141 return false; 147 return false;
diff --git a/OpenSim/Services/Interfaces/IInventoryService.cs b/OpenSim/Services/Interfaces/IInventoryService.cs
index ebdb09a..c775090 100644
--- a/OpenSim/Services/Interfaces/IInventoryService.cs
+++ b/OpenSim/Services/Interfaces/IInventoryService.cs
@@ -122,6 +122,14 @@ namespace OpenSim.Services.Interfaces
122 bool MoveFolder(InventoryFolderBase folder); 122 bool MoveFolder(InventoryFolderBase folder);
123 123
124 /// <summary> 124 /// <summary>
125 /// Delete an item from the user's inventory
126 /// </summary>
127 /// <param name="item"></param>
128 /// <returns>true if the item was successfully deleted</returns>
129 //bool DeleteItem(InventoryItemBase item);
130 bool DeleteFolders(UUID userID, List<UUID> folderIDs);
131
132 /// <summary>
125 /// Purge an inventory folder of all its items and subfolders. 133 /// Purge an inventory folder of all its items and subfolders.
126 /// </summary> 134 /// </summary>
127 /// <param name="folder"></param> 135 /// <param name="folder"></param>
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs
index 6310254..19b1fd8 100644
--- a/OpenSim/Services/InventoryService/InventoryService.cs
+++ b/OpenSim/Services/InventoryService/InventoryService.cs
@@ -235,8 +235,6 @@ namespace OpenSim.Services.InventoryService
235 235
236 public InventoryCollection GetFolderContent(UUID userID, UUID folderID) 236 public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
237 { 237 {
238 m_log.Info("[INVENTORY SERVICE]: Processing request for folder " + folderID);
239
240 // Uncomment me to simulate a slow responding inventory server 238 // Uncomment me to simulate a slow responding inventory server
241 //Thread.Sleep(16000); 239 //Thread.Sleep(16000);
242 240
@@ -249,7 +247,7 @@ namespace OpenSim.Services.InventoryService
249 invCollection.Folders = folders; 247 invCollection.Folders = folders;
250 invCollection.Items = items; 248 invCollection.Items = items;
251 249
252 m_log.DebugFormat("[INVENTORY SERVICE]: Found {0} items and {1} folders", items.Count, folders.Count); 250 m_log.DebugFormat("[INVENTORY SERVICE]: Found {0} items and {1} folders in folder {2}", items.Count, folders.Count, folderID);
253 251
254 return invCollection; 252 return invCollection;
255 } 253 }
@@ -427,15 +425,27 @@ namespace OpenSim.Services.InventoryService
427 return null; 425 return null;
428 } 426 }
429 427
430 public virtual InventoryFolderBase GetFolder(InventoryFolderBase item) 428 public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder)
431 { 429 {
432 InventoryFolderBase result = m_Database.getInventoryFolder(item.ID); 430 InventoryFolderBase result = m_Database.getInventoryFolder(folder.ID);
433 if (result != null) 431 if (result != null)
434 return result; 432 return result;
435 433
434 m_log.DebugFormat("[INVENTORY SERVICE]: GetFolder failed to find folder {0}", folder.ID);
436 return null; 435 return null;
437 } 436 }
438 437
438 public virtual bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)
439 {
440 foreach (UUID id in folderIDs)
441 {
442 InventoryFolderBase folder = new InventoryFolderBase(id, ownerID);
443 PurgeFolder(folder);
444 m_Database.deleteInventoryFolder(id);
445 }
446 return true;
447 }
448
439 /// <summary> 449 /// <summary>
440 /// Purge a folder of all items items and subfolders. 450 /// Purge a folder of all items items and subfolders.
441 /// 451 ///
diff --git a/OpenSim/Tests/Common/Mock/TestInventoryService.cs b/OpenSim/Tests/Common/Mock/TestInventoryService.cs
index ee22e5e..5a0ee7c 100644
--- a/OpenSim/Tests/Common/Mock/TestInventoryService.cs
+++ b/OpenSim/Tests/Common/Mock/TestInventoryService.cs
@@ -128,6 +128,11 @@ namespace OpenSim.Tests.Common.Mock
128 return false; 128 return false;
129 } 129 }
130 130
131 public bool DeleteFolders(UUID ownerID, List<UUID> ids)
132 {
133 return false;
134 }
135
131 public bool PurgeFolder(InventoryFolderBase folder) 136 public bool PurgeFolder(InventoryFolderBase folder)
132 { 137 {
133 return false; 138 return false;