aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Scripting
diff options
context:
space:
mode:
authorAdam Frisby2008-04-30 21:43:47 +0000
committerAdam Frisby2008-04-30 21:43:47 +0000
commitbe20f41637b6c06ce3ab16bc25851b6e43468e12 (patch)
treec41081329891f4c24de704fc760fb9012954ac9d /OpenSim/Region/Environment/Modules/Scripting
parent* Sometimes you know, you do something really stupid. (diff)
downloadopensim-SC-be20f41637b6c06ce3ab16bc25851b6e43468e12.zip
opensim-SC-be20f41637b6c06ce3ab16bc25851b6e43468e12.tar.gz
opensim-SC-be20f41637b6c06ce3ab16bc25851b6e43468e12.tar.bz2
opensim-SC-be20f41637b6c06ce3ab16bc25851b6e43468e12.tar.xz
* Cruft removal step #1. Cleaning Modules directory.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Scripting')
-rw-r--r--OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs82
-rw-r--r--OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs94
-rw-r--r--OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs82
-rw-r--r--OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs132
-rw-r--r--OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs79
-rw-r--r--OpenSim/Region/Environment/Modules/Scripting/XMLRPC/XMLRPCModule.cs214
6 files changed, 365 insertions, 318 deletions
diff --git a/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs
index 63eee97..735a3cf 100644
--- a/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs
+++ b/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs
@@ -47,32 +47,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture
47 47
48 private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>(); 48 private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>();
49 49
50 public void Initialise(Scene scene, IConfigSource config) 50 #region IDynamicTextureManager Members
51 {
52 if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
53 {
54 RegisteredScenes.Add(scene.RegionInfo.RegionID, scene);
55 scene.RegisterModuleInterface<IDynamicTextureManager>(this);
56 }
57 }
58
59 public void PostInitialise()
60 {
61 }
62
63 public void Close()
64 {
65 }
66
67 public string Name
68 {
69 get { return "DynamicTextureModule"; }
70 }
71
72 public bool IsSharedModule
73 {
74 get { return true; }
75 }
76 51
77 public void RegisterRender(string handleType, IDynamicTextureRender render) 52 public void RegisterRender(string handleType, IDynamicTextureRender render)
78 { 53 {
@@ -164,20 +139,55 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture
164 return LLUUID.Zero; 139 return LLUUID.Zero;
165 } 140 }
166 141
142 #endregion
143
144 #region IRegionModule Members
145
146 public void Initialise(Scene scene, IConfigSource config)
147 {
148 if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
149 {
150 RegisteredScenes.Add(scene.RegionInfo.RegionID, scene);
151 scene.RegisterModuleInterface<IDynamicTextureManager>(this);
152 }
153 }
154
155 public void PostInitialise()
156 {
157 }
158
159 public void Close()
160 {
161 }
162
163 public string Name
164 {
165 get { return "DynamicTextureModule"; }
166 }
167
168 public bool IsSharedModule
169 {
170 get { return true; }
171 }
172
173 #endregion
174
175 #region Nested type: DynamicTextureUpdater
176
167 public class DynamicTextureUpdater 177 public class DynamicTextureUpdater
168 { 178 {
169 public LLUUID SimUUID; 179 public bool BlendWithOldTexture = false;
170 public LLUUID UpdaterID;
171 public string ContentType;
172 public string Url;
173 public string BodyData; 180 public string BodyData;
174 public LLUUID PrimID; 181 public string ContentType;
175 public int UpdateTimer; 182 public byte FrontAlpha = 255;
176 public LLUUID LastAssetID; 183 public LLUUID LastAssetID;
177 public string Params; 184 public string Params;
178 public bool BlendWithOldTexture = false; 185 public LLUUID PrimID;
179 public bool SetNewFrontAlpha = false; 186 public bool SetNewFrontAlpha = false;
180 public byte FrontAlpha = 255; 187 public LLUUID SimUUID;
188 public LLUUID UpdaterID;
189 public int UpdateTimer;
190 public string Url;
181 191
182 public DynamicTextureUpdater() 192 public DynamicTextureUpdater()
183 { 193 {
@@ -224,7 +234,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture
224 234
225 LastAssetID = asset.FullID; 235 LastAssetID = asset.FullID;
226 236
227 237
228 part.Shape.Textures = new LLObject.TextureEntry(asset.FullID); 238 part.Shape.Textures = new LLObject.TextureEntry(asset.FullID);
229 part.ScheduleFullUpdate(); 239 part.ScheduleFullUpdate();
230 } 240 }
@@ -273,5 +283,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture
273 } 283 }
274 } 284 }
275 } 285 }
286
287 #endregion
276 } 288 }
277} \ No newline at end of file 289} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs
index 4977a86..184e026 100644
--- a/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs
@@ -84,45 +84,20 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest
84{ 84{
85 public class HttpRequestModule : IRegionModule, IHttpRequests 85 public class HttpRequestModule : IRegionModule, IHttpRequests
86 { 86 {
87 private Scene m_scene;
88 private Queue<HttpRequestClass> rpcQueue = new Queue<HttpRequestClass>();
89 private object HttpListLock = new object(); 87 private object HttpListLock = new object();
90 private string m_name = "HttpScriptRequests";
91 private int httpTimeout = 30000; 88 private int httpTimeout = 30000;
89 private string m_name = "HttpScriptRequests";
92 90
93 // <request id, HttpRequestClass> 91 // <request id, HttpRequestClass>
94 private Dictionary<LLUUID, HttpRequestClass> m_pendingRequests; 92 private Dictionary<LLUUID, HttpRequestClass> m_pendingRequests;
93 private Scene m_scene;
94 private Queue<HttpRequestClass> rpcQueue = new Queue<HttpRequestClass>();
95 95
96 public HttpRequestModule() 96 public HttpRequestModule()
97 { 97 {
98 } 98 }
99 99
100 public void Initialise(Scene scene, IConfigSource config) 100 #region IHttpRequests Members
101 {
102 m_scene = scene;
103
104 m_scene.RegisterModuleInterface<IHttpRequests>(this);
105
106 m_pendingRequests = new Dictionary<LLUUID, HttpRequestClass>();
107 }
108
109 public void PostInitialise()
110 {
111 }
112
113 public void Close()
114 {
115 }
116
117 public string Name
118 {
119 get { return m_name; }
120 }
121
122 public bool IsSharedModule
123 {
124 get { return true; }
125 }
126 101
127 public LLUUID MakeHttpRequest(string url, string parameters, string body) 102 public LLUUID MakeHttpRequest(string url, string parameters, string body)
128 { 103 {
@@ -141,7 +116,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest
141 if (parameters != null) 116 if (parameters != null)
142 { 117 {
143 string[] parms = parameters.ToArray(); 118 string[] parms = parameters.ToArray();
144 for (int i = 0; i < parms.Length/2; i += 2) 119 for (int i = 0; i < parms.Length / 2; i += 2)
145 { 120 {
146 switch (Int32.Parse(parms[i])) 121 switch (Int32.Parse(parms[i]))
147 { 122 {
@@ -187,7 +162,8 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest
187 162
188 public void StopHttpRequest(uint m_localID, LLUUID m_itemID) 163 public void StopHttpRequest(uint m_localID, LLUUID m_itemID)
189 { 164 {
190 if(m_pendingRequests != null) { 165 if (m_pendingRequests != null)
166 {
191 lock (HttpListLock) 167 lock (HttpListLock)
192 { 168 {
193 HttpRequestClass tmpReq; 169 HttpRequestClass tmpReq;
@@ -243,36 +219,68 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest
243 } 219 }
244 } 220 }
245 221
222 #endregion
223
224 #region IRegionModule Members
225
226 public void Initialise(Scene scene, IConfigSource config)
227 {
228 m_scene = scene;
229
230 m_scene.RegisterModuleInterface<IHttpRequests>(this);
231
232 m_pendingRequests = new Dictionary<LLUUID, HttpRequestClass>();
233 }
234
235 public void PostInitialise()
236 {
237 }
238
239 public void Close()
240 {
241 }
242
243 public string Name
244 {
245 get { return m_name; }
246 }
247
248 public bool IsSharedModule
249 {
250 get { return true; }
251 }
252
253 #endregion
246 } 254 }
247 255
248 public class HttpRequestClass 256 public class HttpRequestClass
249 { 257 {
250 // Constants for parameters 258 // Constants for parameters
259 public const int HTTP_BODY_MAXLENGTH = 2;
251 public const int HTTP_METHOD = 0; 260 public const int HTTP_METHOD = 0;
252 public const int HTTP_MIMETYPE = 1; 261 public const int HTTP_MIMETYPE = 1;
253 public const int HTTP_BODY_MAXLENGTH = 2;
254 public const int HTTP_VERIFY_CERT = 3; 262 public const int HTTP_VERIFY_CERT = 3;
263 public bool finished;
264 public int httpBodyMaxLen = 2048; // not implemented
255 265
256 // Parameter members and default values 266 // Parameter members and default values
257 public string httpMethod = "GET"; 267 public string httpMethod = "GET";
258 public string httpMIMEType = "text/plain;charset=utf-8"; 268 public string httpMIMEType = "text/plain;charset=utf-8";
259 public int httpBodyMaxLen = 2048; // not implemented 269 private Thread httpThread;
270 public int httpTimeout;
260 public bool httpVerifyCert = true; // not implemented 271 public bool httpVerifyCert = true; // not implemented
261 272
262 // Request info 273 // Request info
263 public uint localID;
264 public LLUUID itemID; 274 public LLUUID itemID;
265 public LLUUID reqID; 275 public uint localID;
266 public int httpTimeout;
267 public string url;
268 public string outbound_body;
269 public DateTime next; 276 public DateTime next;
270 public int status; 277 public string outbound_body;
271 public bool finished; 278 public LLUUID reqID;
272 public List<string> response_metadata;
273 public string response_body;
274 public HttpWebRequest request; 279 public HttpWebRequest request;
275 private Thread httpThread; 280 public string response_body;
281 public List<string> response_metadata;
282 public int status;
283 public string url;
276 284
277 public void process() 285 public void process()
278 { 286 {
diff --git a/OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs
index eaf9d36..a0408cd 100644
--- a/OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs
+++ b/OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs
@@ -40,39 +40,10 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
40 public class LoadImageURLModule : IRegionModule, IDynamicTextureRender 40 public class LoadImageURLModule : IRegionModule, IDynamicTextureRender
41 { 41 {
42 private string m_name = "LoadImageURL"; 42 private string m_name = "LoadImageURL";
43 private IDynamicTextureManager m_textureManager;
44 private Scene m_scene; 43 private Scene m_scene;
44 private IDynamicTextureManager m_textureManager;
45 45
46 public void Initialise(Scene scene, IConfigSource config) 46 #region IDynamicTextureRender Members
47 {
48 if (m_scene == null)
49 {
50 m_scene = scene;
51 }
52 }
53
54 public void PostInitialise()
55 {
56 m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>();
57 if (m_textureManager != null)
58 {
59 m_textureManager.RegisterRender(GetContentType(), this);
60 }
61 }
62
63 public void Close()
64 {
65 }
66
67 public string Name
68 {
69 get { return m_name; }
70 }
71
72 public bool IsSharedModule
73 {
74 get { return true; }
75 }
76 47
77 public string GetName() 48 public string GetName()
78 { 49 {
@@ -110,6 +81,43 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
110 return false; 81 return false;
111 } 82 }
112 83
84 #endregion
85
86 #region IRegionModule Members
87
88 public void Initialise(Scene scene, IConfigSource config)
89 {
90 if (m_scene == null)
91 {
92 m_scene = scene;
93 }
94 }
95
96 public void PostInitialise()
97 {
98 m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>();
99 if (m_textureManager != null)
100 {
101 m_textureManager.RegisterRender(GetContentType(), this);
102 }
103 }
104
105 public void Close()
106 {
107 }
108
109 public string Name
110 {
111 get { return m_name; }
112 }
113
114 public bool IsSharedModule
115 {
116 get { return true; }
117 }
118
119 #endregion
120
113 private void MakeHttpRequest(string url, LLUUID requestID) 121 private void MakeHttpRequest(string url, LLUUID requestID)
114 { 122 {
115 WebRequest request = HttpWebRequest.Create(url); 123 WebRequest request = HttpWebRequest.Create(url);
@@ -138,8 +146,8 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
138 else if ((image.Height < 128) && (image.Width < 128)) 146 else if ((image.Height < 128) && (image.Width < 128))
139 { 147 {
140 newsize = new Size(64, 64); 148 newsize = new Size(64, 64);
141 } 149 }
142 else if ((image.Height <256) && (image.Width < 256)) 150 else if ((image.Height < 256) && (image.Width < 256))
143 { 151 {
144 newsize = new Size(128, 128); 152 newsize = new Size(128, 128);
145 } 153 }
@@ -153,8 +161,8 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
153 } 161 }
154 else 162 else
155 { 163 {
156 newsize = new Size(1024,1024); 164 newsize = new Size(1024, 1024);
157 } 165 }
158 166
159 Bitmap resize = new Bitmap(image, newsize); 167 Bitmap resize = new Bitmap(image, newsize);
160 byte[] imageJ2000 = OpenJPEG.EncodeFromImage(resize, true); 168 byte[] imageJ2000 = OpenJPEG.EncodeFromImage(resize, true);
@@ -163,6 +171,8 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
163 } 171 }
164 } 172 }
165 173
174 #region Nested type: RequestState
175
166 public class RequestState 176 public class RequestState
167 { 177 {
168 public HttpWebRequest Request = null; 178 public HttpWebRequest Request = null;
@@ -175,5 +185,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
175 RequestID = requestID; 185 RequestID = requestID;
176 } 186 }
177 } 187 }
188
189 #endregion
178 } 190 }
179} \ No newline at end of file 191} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs
index 4fba5b9..386c2b5 100644
--- a/OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs
+++ b/OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs
@@ -44,14 +44,56 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
44{ 44{
45 public class VectorRenderModule : IRegionModule, IDynamicTextureRender 45 public class VectorRenderModule : IRegionModule, IDynamicTextureRender
46 { 46 {
47 private Scene m_scene;
48 private string m_name = "VectorRenderModule"; 47 private string m_name = "VectorRenderModule";
48 private Scene m_scene;
49 private IDynamicTextureManager m_textureManager; 49 private IDynamicTextureManager m_textureManager;
50 50
51 public VectorRenderModule() 51 public VectorRenderModule()
52 { 52 {
53 } 53 }
54 54
55 #region IDynamicTextureRender Members
56
57 public string GetContentType()
58 {
59 return ("vector");
60 }
61
62 public string GetName()
63 {
64 return m_name;
65 }
66
67 public bool SupportsAsynchronous()
68 {
69 return true;
70 }
71
72 public byte[] ConvertUrl(string url, string extraParams)
73 {
74 return null;
75 }
76
77 public byte[] ConvertStream(Stream data, string extraParams)
78 {
79 return null;
80 }
81
82 public bool AsyncConvertUrl(LLUUID id, string url, string extraParams)
83 {
84 return false;
85 }
86
87 public bool AsyncConvertData(LLUUID id, string bodyData, string extraParams)
88 {
89 Draw(bodyData, id, extraParams);
90 return true;
91 }
92
93 #endregion
94
95 #region IRegionModule Members
96
55 public void Initialise(Scene scene, IConfigSource config) 97 public void Initialise(Scene scene, IConfigSource config)
56 { 98 {
57 if (m_scene == null) 99 if (m_scene == null)
@@ -83,21 +125,25 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
83 get { return true; } 125 get { return true; }
84 } 126 }
85 127
128 #endregion
129
86 private void Draw(string data, LLUUID id, string extraParams) 130 private void Draw(string data, LLUUID id, string extraParams)
87 { 131 {
88 // TODO: this is a brutal hack. extraParams should actually be parsed reasonably. 132 // TODO: this is a brutal hack. extraParams should actually be parsed reasonably.
89 int size = 256; 133 int size = 256;
90 try { 134 try
135 {
91 size = Convert.ToInt32(extraParams); 136 size = Convert.ToInt32(extraParams);
92 } catch (Exception e) { 137 }
93 138 catch (Exception e)
139 {
94//Ckrinke: Add a WriteLine to remove the warning about 'e' defined but not used 140//Ckrinke: Add a WriteLine to remove the warning about 'e' defined but not used
95 Console.WriteLine("Problem with Draw. Please verify parameters." + e.ToString()); 141 Console.WriteLine("Problem with Draw. Please verify parameters." + e.ToString());
96 } 142 }
97 143
98 if ((size < 128) || (size > 1024)) 144 if ((size < 128) || (size > 1024))
99 size = 256; 145 size = 256;
100 146
101 Bitmap bitmap = new Bitmap(size, size, PixelFormat.Format32bppArgb); 147 Bitmap bitmap = new Bitmap(size, size, PixelFormat.Format32bppArgb);
102 148
103 Graphics graph = Graphics.FromImage(bitmap); 149 Graphics graph = Graphics.FromImage(bitmap);
@@ -121,13 +167,11 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
121 } 167 }
122 } 168 }
123 169
124
125 170
126 GDIDraw(data, graph); 171 GDIDraw(data, graph);
127 172
128 byte[] imageJ2000 = OpenJPEG.EncodeFromImage(bitmap, true); 173 byte[] imageJ2000 = OpenJPEG.EncodeFromImage(bitmap, true);
129 m_textureManager.ReturnData(id, imageJ2000); 174 m_textureManager.ReturnData(id, imageJ2000);
130
131 } 175 }
132 176
133/* 177/*
@@ -175,10 +219,10 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
175 Pen drawPen = new Pen(Color.Black, 7); 219 Pen drawPen = new Pen(Color.Black, 7);
176 Font myFont = new Font("Times New Roman", 14); 220 Font myFont = new Font("Times New Roman", 14);
177 SolidBrush myBrush = new SolidBrush(Color.Black); 221 SolidBrush myBrush = new SolidBrush(Color.Black);
178 char[] lineDelimiter = { ';' }; 222 char[] lineDelimiter = {';'};
179 char[] partsDelimiter = { ',' }; 223 char[] partsDelimiter = {','};
180 string[] lines = data.Split(lineDelimiter); 224 string[] lines = data.Split(lineDelimiter);
181 225
182 foreach (string line in lines) 226 foreach (string line in lines)
183 { 227 {
184 string nextLine = line.Trim(); 228 string nextLine = line.Trim();
@@ -188,16 +232,16 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
188 float x = 0; 232 float x = 0;
189 float y = 0; 233 float y = 0;
190 GetParams(partsDelimiter, ref nextLine, 6, ref x, ref y); 234 GetParams(partsDelimiter, ref nextLine, 6, ref x, ref y);
191 startPoint.X = (int)x; 235 startPoint.X = (int) x;
192 startPoint.Y = (int)y; 236 startPoint.Y = (int) y;
193 } 237 }
194 else if (nextLine.StartsWith("LineTo")) 238 else if (nextLine.StartsWith("LineTo"))
195 { 239 {
196 float x = 0; 240 float x = 0;
197 float y = 0; 241 float y = 0;
198 GetParams(partsDelimiter, ref nextLine, 6, ref x, ref y); 242 GetParams(partsDelimiter, ref nextLine, 6, ref x, ref y);
199 endPoint.X = (int)x; 243 endPoint.X = (int) x;
200 endPoint.Y = (int)y; 244 endPoint.Y = (int) y;
201 graph.DrawLine(drawPen, startPoint, endPoint); 245 graph.DrawLine(drawPen, startPoint, endPoint);
202 startPoint.X = endPoint.X; 246 startPoint.X = endPoint.X;
203 startPoint.Y = endPoint.Y; 247 startPoint.Y = endPoint.Y;
@@ -213,10 +257,10 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
213 float x = 0; 257 float x = 0;
214 float y = 0; 258 float y = 0;
215 GetParams(partsDelimiter, ref nextLine, 5, ref x, ref y); 259 GetParams(partsDelimiter, ref nextLine, 5, ref x, ref y);
216 endPoint.X = (int)x; 260 endPoint.X = (int) x;
217 endPoint.Y = (int)y; 261 endPoint.Y = (int) y;
218 Image image = ImageHttpRequest(nextLine); 262 Image image = ImageHttpRequest(nextLine);
219 graph.DrawImage(image, (float)startPoint.X, (float)startPoint.Y, x, y); 263 graph.DrawImage(image, (float) startPoint.X, (float) startPoint.Y, x, y);
220 startPoint.X += endPoint.X; 264 startPoint.X += endPoint.X;
221 startPoint.Y += endPoint.Y; 265 startPoint.Y += endPoint.Y;
222 } 266 }
@@ -225,8 +269,8 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
225 float x = 0; 269 float x = 0;
226 float y = 0; 270 float y = 0;
227 GetParams(partsDelimiter, ref nextLine, 9, ref x, ref y); 271 GetParams(partsDelimiter, ref nextLine, 9, ref x, ref y);
228 endPoint.X = (int)x; 272 endPoint.X = (int) x;
229 endPoint.Y = (int)y; 273 endPoint.Y = (int) y;
230 graph.DrawRectangle(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); 274 graph.DrawRectangle(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y);
231 startPoint.X += endPoint.X; 275 startPoint.X += endPoint.X;
232 startPoint.Y += endPoint.Y; 276 startPoint.Y += endPoint.Y;
@@ -236,8 +280,8 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
236 float x = 0; 280 float x = 0;
237 float y = 0; 281 float y = 0;
238 GetParams(partsDelimiter, ref nextLine, 13, ref x, ref y); 282 GetParams(partsDelimiter, ref nextLine, 13, ref x, ref y);
239 endPoint.X = (int)x; 283 endPoint.X = (int) x;
240 endPoint.Y = (int)y; 284 endPoint.Y = (int) y;
241 graph.FillRectangle(myBrush, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); 285 graph.FillRectangle(myBrush, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y);
242 startPoint.X += endPoint.X; 286 startPoint.X += endPoint.X;
243 startPoint.Y += endPoint.Y; 287 startPoint.Y += endPoint.Y;
@@ -247,8 +291,8 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
247 float x = 0; 291 float x = 0;
248 float y = 0; 292 float y = 0;
249 GetParams(partsDelimiter, ref nextLine, 7, ref x, ref y); 293 GetParams(partsDelimiter, ref nextLine, 7, ref x, ref y);
250 endPoint.X = (int)x; 294 endPoint.X = (int) x;
251 endPoint.Y = (int)y; 295 endPoint.Y = (int) y;
252 graph.DrawEllipse(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); 296 graph.DrawEllipse(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y);
253 startPoint.X += endPoint.X; 297 startPoint.X += endPoint.X;
254 startPoint.Y += endPoint.Y; 298 startPoint.Y += endPoint.Y;
@@ -271,7 +315,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
271 { 315 {
272 nextLine = nextLine.Remove(0, 9); 316 nextLine = nextLine.Remove(0, 9);
273 nextLine = nextLine.Trim(); 317 nextLine = nextLine.Trim();
274 318
275 Color newColour = Color.FromName(nextLine); 319 Color newColour = Color.FromName(nextLine);
276 320
277 myBrush.Color = newColour; 321 myBrush.Color = newColour;
@@ -312,7 +356,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
312 WebRequest request = HttpWebRequest.Create(url); 356 WebRequest request = HttpWebRequest.Create(url);
313//Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used. 357//Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used.
314//Ckrinke Stream str = null; 358//Ckrinke Stream str = null;
315 HttpWebResponse response = (HttpWebResponse)(request).GetResponse(); 359 HttpWebResponse response = (HttpWebResponse) (request).GetResponse();
316 if (response.StatusCode == HttpStatusCode.OK) 360 if (response.StatusCode == HttpStatusCode.OK)
317 { 361 {
318 Bitmap image = new Bitmap(response.GetResponseStream()); 362 Bitmap image = new Bitmap(response.GetResponseStream());
@@ -321,41 +365,5 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
321 365
322 return null; 366 return null;
323 } 367 }
324
325 public string GetContentType()
326 {
327 return ("vector");
328 }
329
330 public string GetName()
331 {
332 return m_name;
333 }
334
335 public bool SupportsAsynchronous()
336 {
337 return true;
338 }
339
340 public byte[] ConvertUrl(string url, string extraParams)
341 {
342 return null;
343 }
344
345 public byte[] ConvertStream(Stream data, string extraParams)
346 {
347 return null;
348 }
349
350 public bool AsyncConvertUrl(LLUUID id, string url, string extraParams)
351 {
352 return false;
353 }
354
355 public bool AsyncConvertData(LLUUID id, string bodyData, string extraParams)
356 {
357 Draw(bodyData, id, extraParams);
358 return true;
359 }
360 } 368 }
361} \ No newline at end of file 369} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs
index a949fb6..ff3b31e 100644
--- a/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs
+++ b/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs
@@ -67,18 +67,20 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
67{ 67{
68 public class WorldCommModule : IRegionModule, IWorldComm 68 public class WorldCommModule : IRegionModule, IWorldComm
69 { 69 {
70 private Scene m_scene;
71 private object CommListLock = new object(); 70 private object CommListLock = new object();
72 private object ListLock = new object(); 71 private object ListLock = new object();
73 private string m_name = "WorldCommModule";
74 private ListenerManager m_listenerManager; 72 private ListenerManager m_listenerManager;
75 private Queue m_pendingQ; 73 private string m_name = "WorldCommModule";
76 private Queue m_pending; 74 private Queue m_pending;
75 private Queue m_pendingQ;
76 private Scene m_scene;
77 77
78 public WorldCommModule() 78 public WorldCommModule()
79 { 79 {
80 } 80 }
81 81
82 #region IRegionModule Members
83
82 public void Initialise(Scene scene, IConfigSource config) 84 public void Initialise(Scene scene, IConfigSource config)
83 { 85 {
84 m_scene = scene; 86 m_scene = scene;
@@ -107,23 +109,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
107 get { return false; } 109 get { return false; }
108 } 110 }
109 111
110 public void NewClient(IClientAPI client) 112 #endregion
111 {
112 client.OnChatFromViewer += DeliverClientMessage;
113 }
114 113
115 /******************************************************************** 114 #region IWorldComm Members
116 *
117 * Listener Stuff
118 *
119 * *****************************************************************/
120 private void DeliverClientMessage(Object sender, ChatFromViewerArgs e)
121 {
122 DeliverMessage(e.Sender.AgentId.ToString(),
123 e.Type, e.Channel,
124 e.Sender.FirstName + " " + e.Sender.LastName,
125 e.Message);
126 }
127 115
128 public int Listen(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg) 116 public int Listen(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg)
129 { 117 {
@@ -295,7 +283,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
295 283
296 lock (m_pending.SyncRoot) 284 lock (m_pending.SyncRoot)
297 { 285 {
298 li = (ListenerInfo)m_pending.Dequeue(); 286 li = (ListenerInfo) m_pending.Dequeue();
299 } 287 }
300 288
301 return li; 289 return li;
@@ -303,20 +291,41 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
303 291
304 public uint PeekNextMessageLocalID() 292 public uint PeekNextMessageLocalID()
305 { 293 {
306 return ((ListenerInfo)m_pending.Peek()).GetLocalID(); 294 return ((ListenerInfo) m_pending.Peek()).GetLocalID();
307 } 295 }
308 296
309 public LLUUID PeekNextMessageItemID() 297 public LLUUID PeekNextMessageItemID()
310 { 298 {
311 return ((ListenerInfo)m_pending.Peek()).GetItemID(); 299 return ((ListenerInfo) m_pending.Peek()).GetItemID();
300 }
301
302 #endregion
303
304 public void NewClient(IClientAPI client)
305 {
306 client.OnChatFromViewer += DeliverClientMessage;
307 }
308
309 /********************************************************************
310 *
311 * Listener Stuff
312 *
313 * *****************************************************************/
314
315 private void DeliverClientMessage(Object sender, ChatFromViewerArgs e)
316 {
317 DeliverMessage(e.Sender.AgentId.ToString(),
318 e.Type, e.Channel,
319 e.Sender.FirstName + " " + e.Sender.LastName,
320 e.Message);
312 } 321 }
313 } 322 }
314 323
315 public class ListenerManager 324 public class ListenerManager
316 { 325 {
317 //private Dictionary<int, ListenerInfo> m_listeners; 326 //private Dictionary<int, ListenerInfo> m_listeners;
318 private Hashtable m_listeners = Hashtable.Synchronized(new Hashtable());
319 private object ListenersLock = new object(); 327 private object ListenersLock = new object();
328 private Hashtable m_listeners = Hashtable.Synchronized(new Hashtable());
320 private int m_MaxListeners = 100; 329 private int m_MaxListeners = 100;
321 330
322 public int AddListener(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg) 331 public int AddListener(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg)
@@ -363,7 +372,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
363 IDictionaryEnumerator en = m_listeners.GetEnumerator(); 372 IDictionaryEnumerator en = m_listeners.GetEnumerator();
364 while (en.MoveNext()) 373 while (en.MoveNext())
365 { 374 {
366 ListenerInfo li = (ListenerInfo)en.Value; 375 ListenerInfo li = (ListenerInfo) en.Value;
367 if (li.GetItemID().Equals(itemID)) 376 if (li.GetItemID().Equals(itemID))
368 { 377 {
369 removedListeners.Add(li.GetHandle()); 378 removedListeners.Add(li.GetHandle());
@@ -400,12 +409,11 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
400 409
401 public void Activate(int handle) 410 public void Activate(int handle)
402 { 411 {
403
404 if (m_listeners.ContainsKey(handle)) 412 if (m_listeners.ContainsKey(handle))
405 { 413 {
406 lock (m_listeners.SyncRoot) 414 lock (m_listeners.SyncRoot)
407 { 415 {
408 ListenerInfo li = (ListenerInfo)m_listeners[handle]; 416 ListenerInfo li = (ListenerInfo) m_listeners[handle];
409 li.Activate(); 417 li.Activate();
410 } 418 }
411 } 419 }
@@ -413,10 +421,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
413 421
414 public void Dectivate(int handle) 422 public void Dectivate(int handle)
415 { 423 {
416
417 if (m_listeners.ContainsKey(handle)) 424 if (m_listeners.ContainsKey(handle))
418 { 425 {
419 ListenerInfo li = (ListenerInfo)m_listeners[handle]; 426 ListenerInfo li = (ListenerInfo) m_listeners[handle];
420 li.Deactivate(); 427 li.Deactivate();
421 } 428 }
422 } 429 }
@@ -432,9 +439,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
432 IDictionaryEnumerator en = m_listeners.GetEnumerator(); 439 IDictionaryEnumerator en = m_listeners.GetEnumerator();
433 while (en.MoveNext()) 440 while (en.MoveNext())
434 { 441 {
435 ListenerInfo li = (ListenerInfo)en.Value; 442 ListenerInfo li = (ListenerInfo) en.Value;
436 443
437 if (li.IsActive()) 444 if (li.IsActive())
438 { 445 {
439 if (li.GetHostID().Equals(listenerKey)) 446 if (li.GetHostID().Equals(listenerKey))
440 { 447 {
@@ -478,16 +485,16 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
478 485
479 public class ListenerInfo 486 public class ListenerInfo
480 { 487 {
481 private LLUUID m_itemID; // ID of the host script engine 488 private bool m_active; // Listener is active or not
482 private LLUUID m_hostID; // ID of the host/scene part
483 private LLUUID m_sourceItemID; // ID of the scenePart or avatar source of the message
484 private int m_channel; // Channel 489 private int m_channel; // Channel
485 private int m_handle; // Assigned handle of this listener 490 private int m_handle; // Assigned handle of this listener
486 private uint m_localID; // Local ID from script engine 491 private LLUUID m_hostID; // ID of the host/scene part
487 private string m_name; // Object name to filter messages from
488 private LLUUID m_id; // ID to filter messages from 492 private LLUUID m_id; // ID to filter messages from
493 private LLUUID m_itemID; // ID of the host script engine
494 private uint m_localID; // Local ID from script engine
489 private string m_message; // The message 495 private string m_message; // The message
490 private bool m_active; // Listener is active or not 496 private string m_name; // Object name to filter messages from
497 private LLUUID m_sourceItemID; // ID of the scenePart or avatar source of the message
491 498
492 public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, string message) 499 public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, string message)
493 { 500 {
diff --git a/OpenSim/Region/Environment/Modules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/Environment/Modules/Scripting/XMLRPC/XMLRPCModule.cs
index 1139b4b..6ca8136 100644
--- a/OpenSim/Region/Environment/Modules/Scripting/XMLRPC/XMLRPCModule.cs
+++ b/OpenSim/Region/Environment/Modules/Scripting/XMLRPC/XMLRPCModule.cs
@@ -79,20 +79,21 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
79 { 79 {
80 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 80 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
81 81
82 private object XMLRPCListLock = new object();
83 private string m_name = "XMLRPCModule"; 82 private string m_name = "XMLRPCModule";
84 private int RemoteReplyScriptWait = 300;
85 private int RemoteReplyScriptTimeout = 9000;
86 private int m_remoteDataPort = 0;
87 private List<Scene> m_scenes = new List<Scene>();
88 83
89 // <channel id, RPCChannelInfo> 84 // <channel id, RPCChannelInfo>
90 private Dictionary<LLUUID, RPCChannelInfo> m_openChannels; 85 private Dictionary<LLUUID, RPCChannelInfo> m_openChannels;
86 private Dictionary<LLUUID, SendRemoteDataRequest> m_pendingSRDResponses;
87 private int m_remoteDataPort = 0;
91 88
92 private Dictionary<LLUUID, RPCRequestInfo> m_rpcPending; 89 private Dictionary<LLUUID, RPCRequestInfo> m_rpcPending;
93 private Dictionary<LLUUID, RPCRequestInfo> m_rpcPendingResponses; 90 private Dictionary<LLUUID, RPCRequestInfo> m_rpcPendingResponses;
91 private List<Scene> m_scenes = new List<Scene>();
92 private int RemoteReplyScriptTimeout = 9000;
93 private int RemoteReplyScriptWait = 300;
94 private object XMLRPCListLock = new object();
94 95
95 private Dictionary<LLUUID, SendRemoteDataRequest> m_pendingSRDResponses; 96 #region IRegionModule Members
96 97
97 public void Initialise(Scene scene, IConfigSource config) 98 public void Initialise(Scene scene, IConfigSource config)
98 { 99 {
@@ -125,7 +126,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
125 // Attach xmlrpc handlers 126 // Attach xmlrpc handlers
126 m_log.Info("[REMOTE_DATA]: " + 127 m_log.Info("[REMOTE_DATA]: " +
127 "Starting XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands."); 128 "Starting XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands.");
128 BaseHttpServer httpServer = new BaseHttpServer((uint)m_remoteDataPort); 129 BaseHttpServer httpServer = new BaseHttpServer((uint) m_remoteDataPort);
129 httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData); 130 httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData);
130 httpServer.Start(); 131 httpServer.Start();
131 } 132 }
@@ -145,6 +146,10 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
145 get { return true; } 146 get { return true; }
146 } 147 }
147 148
149 #endregion
150
151 #region IXMLRPC Members
152
148 public bool IsEnabled() 153 public bool IsEnabled()
149 { 154 {
150 return (m_remoteDataPort > 0); 155 return (m_remoteDataPort > 0);
@@ -196,7 +201,6 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
196 // for when a script is deleted 201 // for when a script is deleted
197 public void DeleteChannels(LLUUID itemID) 202 public void DeleteChannels(LLUUID itemID)
198 { 203 {
199
200 if (m_openChannels != null) 204 if (m_openChannels != null)
201 { 205 {
202 ArrayList tmp = new ArrayList(); 206 ArrayList tmp = new ArrayList();
@@ -212,12 +216,10 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
212 } 216 }
213 217
214 IEnumerator tmpEnumerator = tmp.GetEnumerator(); 218 IEnumerator tmpEnumerator = tmp.GetEnumerator();
215 while ( tmpEnumerator.MoveNext() ) 219 while (tmpEnumerator.MoveNext())
216 m_openChannels.Remove((LLUUID)tmpEnumerator.Current); 220 m_openChannels.Remove((LLUUID) tmpEnumerator.Current);
217 } 221 }
218
219 } 222 }
220
221 } 223 }
222 224
223 /********************************************** 225 /**********************************************
@@ -255,67 +257,6 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
255 } 257 }
256 258
257 259
258 public XmlRpcResponse XmlRpcRemoteData(XmlRpcRequest request)
259 {
260 XmlRpcResponse response = new XmlRpcResponse();
261
262 Hashtable requestData = (Hashtable)request.Params[0];
263 bool GoodXML = (requestData.Contains("Channel") && requestData.Contains("IntValue") &&
264 requestData.Contains("StringValue"));
265
266 if (GoodXML)
267 {
268 LLUUID channel = new LLUUID((string)requestData["Channel"]);
269 RPCChannelInfo rpcChanInfo;
270 if (m_openChannels.TryGetValue(channel, out rpcChanInfo))
271 {
272 string intVal = (string)requestData["IntValue"];
273 string strVal = (string)requestData["StringValue"];
274
275 RPCRequestInfo rpcInfo;
276
277 lock (XMLRPCListLock)
278 {
279 rpcInfo =
280 new RPCRequestInfo(rpcChanInfo.GetLocalID(), rpcChanInfo.GetItemID(), channel, strVal,
281 intVal);
282 m_rpcPending.Add(rpcInfo.GetMessageID(), rpcInfo);
283 }
284
285 int timeoutCtr = 0;
286
287 while (!rpcInfo.IsProcessed() && (timeoutCtr < RemoteReplyScriptTimeout))
288 {
289 Thread.Sleep(RemoteReplyScriptWait);
290 timeoutCtr += RemoteReplyScriptWait;
291 }
292 if (rpcInfo.IsProcessed())
293 {
294 Hashtable param = new Hashtable();
295 param["StringValue"] = rpcInfo.GetStrRetval();
296 param["IntValue"] = Convert.ToString(rpcInfo.GetIntRetval());
297
298 ArrayList parameters = new ArrayList();
299 parameters.Add(param);
300
301 response.Value = parameters;
302 rpcInfo = null;
303 }
304 else
305 {
306 response.SetFault(-1, "Script timeout");
307 rpcInfo = null;
308 }
309 }
310 else
311 {
312 response.SetFault(-1, "Invalid channel");
313 }
314 }
315
316 return response;
317 }
318
319 public bool hasRequests() 260 public bool hasRequests()
320 { 261 {
321 lock (XMLRPCListLock) 262 lock (XMLRPCListLock)
@@ -339,7 +280,6 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
339 280
340 if (m_rpcPending.TryGetValue(luid, out tmpReq)) 281 if (m_rpcPending.TryGetValue(luid, out tmpReq))
341 { 282 {
342
343 if (!tmpReq.IsProcessed()) return tmpReq; 283 if (!tmpReq.IsProcessed()) return tmpReq;
344 } 284 }
345 } 285 }
@@ -367,13 +307,11 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
367 307
368 public LLUUID SendRemoteData(uint localID, LLUUID itemID, string channel, string dest, int idata, string sdata) 308 public LLUUID SendRemoteData(uint localID, LLUUID itemID, string channel, string dest, int idata, string sdata)
369 { 309 {
370
371 SendRemoteDataRequest req = new SendRemoteDataRequest( 310 SendRemoteDataRequest req = new SendRemoteDataRequest(
372 localID, itemID, channel, dest, idata, sdata 311 localID, itemID, channel, dest, idata, sdata
373 ); 312 );
374 m_pendingSRDResponses.Add(req.GetReqID(), req); 313 m_pendingSRDResponses.Add(req.GetReqID(), req);
375 return req.process(); 314 return req.process();
376
377 } 315 }
378 316
379 public SendRemoteDataRequest GetNextCompletedSRDRequest() 317 public SendRemoteDataRequest GetNextCompletedSRDRequest()
@@ -423,19 +361,82 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
423 } 361 }
424 } 362 }
425 } 363 }
364
365 #endregion
366
367 public XmlRpcResponse XmlRpcRemoteData(XmlRpcRequest request)
368 {
369 XmlRpcResponse response = new XmlRpcResponse();
370
371 Hashtable requestData = (Hashtable) request.Params[0];
372 bool GoodXML = (requestData.Contains("Channel") && requestData.Contains("IntValue") &&
373 requestData.Contains("StringValue"));
374
375 if (GoodXML)
376 {
377 LLUUID channel = new LLUUID((string) requestData["Channel"]);
378 RPCChannelInfo rpcChanInfo;
379 if (m_openChannels.TryGetValue(channel, out rpcChanInfo))
380 {
381 string intVal = (string) requestData["IntValue"];
382 string strVal = (string) requestData["StringValue"];
383
384 RPCRequestInfo rpcInfo;
385
386 lock (XMLRPCListLock)
387 {
388 rpcInfo =
389 new RPCRequestInfo(rpcChanInfo.GetLocalID(), rpcChanInfo.GetItemID(), channel, strVal,
390 intVal);
391 m_rpcPending.Add(rpcInfo.GetMessageID(), rpcInfo);
392 }
393
394 int timeoutCtr = 0;
395
396 while (!rpcInfo.IsProcessed() && (timeoutCtr < RemoteReplyScriptTimeout))
397 {
398 Thread.Sleep(RemoteReplyScriptWait);
399 timeoutCtr += RemoteReplyScriptWait;
400 }
401 if (rpcInfo.IsProcessed())
402 {
403 Hashtable param = new Hashtable();
404 param["StringValue"] = rpcInfo.GetStrRetval();
405 param["IntValue"] = Convert.ToString(rpcInfo.GetIntRetval());
406
407 ArrayList parameters = new ArrayList();
408 parameters.Add(param);
409
410 response.Value = parameters;
411 rpcInfo = null;
412 }
413 else
414 {
415 response.SetFault(-1, "Script timeout");
416 rpcInfo = null;
417 }
418 }
419 else
420 {
421 response.SetFault(-1, "Invalid channel");
422 }
423 }
424
425 return response;
426 }
426 } 427 }
427 428
428 public class RPCRequestInfo 429 public class RPCRequestInfo
429 { 430 {
430 private string m_StrVal; 431 private LLUUID m_ChannelKey;
431 private string m_IntVal; 432 private string m_IntVal;
432 private bool m_processed;
433 private string m_respStr;
434 private int m_respInt;
435 private uint m_localID;
436 private LLUUID m_ItemID; 433 private LLUUID m_ItemID;
434 private uint m_localID;
437 private LLUUID m_MessageID; 435 private LLUUID m_MessageID;
438 private LLUUID m_ChannelKey; 436 private bool m_processed;
437 private int m_respInt;
438 private string m_respStr;
439 private string m_StrVal;
439 440
440 public RPCRequestInfo(uint localID, LLUUID itemID, LLUUID channelKey, string strVal, string intVal) 441 public RPCRequestInfo(uint localID, LLUUID itemID, LLUUID channelKey, string strVal, string intVal)
441 { 442 {
@@ -474,6 +475,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
474 { 475 {
475 return m_respStr; 476 return m_respStr;
476 } 477 }
478
477 public void SetIntRetval(int resp) 479 public void SetIntRetval(int resp)
478 { 480 {
479 m_respInt = resp; 481 m_respInt = resp;
@@ -483,6 +485,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
483 { 485 {
484 return m_respInt; 486 return m_respInt;
485 } 487 }
488
486 public uint GetLocalID() 489 public uint GetLocalID()
487 { 490 {
488 return m_localID; 491 return m_localID;
@@ -511,9 +514,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
511 514
512 public class RPCChannelInfo 515 public class RPCChannelInfo
513 { 516 {
517 private LLUUID m_ChannelKey;
514 private LLUUID m_itemID; 518 private LLUUID m_itemID;
515 private uint m_localID; 519 private uint m_localID;
516 private LLUUID m_ChannelKey;
517 520
518 public RPCChannelInfo(uint localID, LLUUID itemID, LLUUID channelID) 521 public RPCChannelInfo(uint localID, LLUUID itemID, LLUUID channelID)
519 { 522 {
@@ -536,38 +539,34 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
536 { 539 {
537 return m_localID; 540 return m_localID;
538 } 541 }
539
540 } 542 }
541 543
542 public class SendRemoteDataRequest 544 public class SendRemoteDataRequest
543 { 545 {
544 546 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
545 public LLUUID reqID;
546 public string destURL;
547 public string channel; 547 public string channel;
548 public string sdata; 548 public string destURL;
549 public int idata;
550 public bool finished; 549 public bool finished;
551 public string response_sdata;
552 public int response_idata;
553 public XmlRpcRequest request;
554 private Thread httpThread; 550 private Thread httpThread;
551 public int idata;
555 public LLUUID m_itemID; 552 public LLUUID m_itemID;
556 public uint m_localID; 553 public uint m_localID;
557 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 554 public LLUUID reqID;
555 public XmlRpcRequest request;
556 public int response_idata;
557 public string response_sdata;
558 public string sdata;
558 559
559 public SendRemoteDataRequest(uint localID, LLUUID itemID, string channel, string dest, int idata, string sdata) 560 public SendRemoteDataRequest(uint localID, LLUUID itemID, string channel, string dest, int idata, string sdata)
560 { 561 {
561
562 this.channel = channel; 562 this.channel = channel;
563 this.destURL = dest; 563 destURL = dest;
564 this.idata = idata; 564 this.idata = idata;
565 this.sdata = sdata; 565 this.sdata = sdata;
566 m_itemID = itemID; 566 m_itemID = itemID;
567 m_localID = localID; 567 m_localID = localID;
568 568
569 reqID = LLUUID.Random(); 569 reqID = LLUUID.Random();
570
571 } 570 }
572 571
573 public LLUUID process() 572 public LLUUID process()
@@ -581,7 +580,6 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
581 ThreadTracker.Add(httpThread); 580 ThreadTracker.Add(httpThread);
582 581
583 return reqID; 582 return reqID;
584
585 } 583 }
586 584
587 /* 585 /*
@@ -597,8 +595,8 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
597 // if not, use as method name 595 // if not, use as method name
598 LLUUID parseUID; 596 LLUUID parseUID;
599 string mName = "llRemoteData"; 597 string mName = "llRemoteData";
600 if( (channel != null) && (channel != "") ) 598 if ((channel != null) && (channel != ""))
601 if( !LLUUID.TryParse(channel, out parseUID) ) 599 if (!LLUUID.TryParse(channel, out parseUID))
602 mName = channel; 600 mName = channel;
603 else 601 else
604 param["Channel"] = channel; 602 param["Channel"] = channel;
@@ -615,26 +613,28 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
615 if (resp != null) 613 if (resp != null)
616 { 614 {
617 Hashtable respParms; 615 Hashtable respParms;
618 if(resp.Value.GetType().Equals(Type.GetType("System.Collections.Hashtable"))) { 616 if (resp.Value.GetType().Equals(Type.GetType("System.Collections.Hashtable")))
619 respParms = (Hashtable)resp.Value; 617 {
618 respParms = (Hashtable) resp.Value;
620 } 619 }
621 else { 620 else
622 ArrayList respData = (ArrayList)resp.Value; 621 {
623 respParms = (Hashtable)respData[0]; 622 ArrayList respData = (ArrayList) resp.Value;
623 respParms = (Hashtable) respData[0];
624 } 624 }
625 if (respParms != null) 625 if (respParms != null)
626 { 626 {
627 if (respParms.Contains("StringValue")) 627 if (respParms.Contains("StringValue"))
628 { 628 {
629 sdata = (string)respParms["StringValue"]; 629 sdata = (string) respParms["StringValue"];
630 } 630 }
631 if (respParms.Contains("IntValue")) 631 if (respParms.Contains("IntValue"))
632 { 632 {
633 idata = Convert.ToInt32((string)respParms["IntValue"]); 633 idata = Convert.ToInt32((string) respParms["IntValue"]);
634 } 634 }
635 if (respParms.Contains("faultString")) 635 if (respParms.Contains("faultString"))
636 { 636 {
637 sdata = (string)respParms["faultString"]; 637 sdata = (string) respParms["faultString"];
638 } 638 }
639 if (respParms.Contains("faultCode")) 639 if (respParms.Contains("faultCode"))
640 { 640 {