aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules')
-rw-r--r--OpenSim/Region/Environment/Modules/AssetDownloadModule.cs3
-rw-r--r--OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs187
-rw-r--r--OpenSim/Region/Environment/Modules/ChatModule.cs485
-rw-r--r--OpenSim/Region/Environment/Modules/DynamicTextureModule.cs381
-rw-r--r--OpenSim/Region/Environment/Modules/FriendsModule.cs123
-rw-r--r--OpenSim/Region/Environment/Modules/GroupsModule.cs123
-rw-r--r--OpenSim/Region/Environment/Modules/InstantMessageModule.cs201
-rw-r--r--OpenSim/Region/Environment/Modules/InventoryModule.cs123
-rw-r--r--OpenSim/Region/Environment/Modules/LoadImageURLModule.cs247
-rw-r--r--OpenSim/Region/Environment/Modules/TextureDownloadModule.cs153
-rw-r--r--OpenSim/Region/Environment/Modules/WorldCommModule.cs3
-rw-r--r--OpenSim/Region/Environment/Modules/XMLRPCModule.cs3
-rw-r--r--OpenSim/Region/Environment/Modules/XferModule.cs403
13 files changed, 1224 insertions, 1211 deletions
diff --git a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
index 417e3bc..b53c05e 100644
--- a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
+++ b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
@@ -29,6 +29,7 @@
29using OpenSim.Framework.Interfaces; 29using OpenSim.Framework.Interfaces;
30using OpenSim.Region.Environment.Interfaces; 30using OpenSim.Region.Environment.Interfaces;
31using OpenSim.Region.Environment.Scenes; 31using OpenSim.Region.Environment.Scenes;
32using Nini.Config;
32 33
33namespace OpenSim.Region.Environment.Modules 34namespace OpenSim.Region.Environment.Modules
34{ 35{
@@ -40,7 +41,7 @@ namespace OpenSim.Region.Environment.Modules
40 { 41 {
41 } 42 }
42 43
43 public void Initialise(Scene scene) 44 public void Initialise(Scene scene, IConfigSource config)
44 { 45 {
45 m_scene = scene; 46 m_scene = scene;
46 m_scene.EventManager.OnNewClient += NewClient; 47 m_scene.EventManager.OnNewClient += NewClient;
diff --git a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs
index 9c627df..4bdb61b 100644
--- a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs
+++ b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs
@@ -1,93 +1,94 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using libsecondlife; 29using libsecondlife;
30using OpenSim.Framework.Interfaces; 30using OpenSim.Framework.Interfaces;
31using OpenSim.Region.Environment.Interfaces; 31using OpenSim.Region.Environment.Interfaces;
32using OpenSim.Region.Environment.Scenes; 32using OpenSim.Region.Environment.Scenes;
33 33using Nini.Config;
34namespace OpenSim.Region.Environment.Modules 34
35{ 35namespace OpenSim.Region.Environment.Modules
36 public class AvatarProfilesModule : IRegionModule 36{
37 { 37 public class AvatarProfilesModule : IRegionModule
38 private Scene m_scene; 38 {
39 39 private Scene m_scene;
40 public AvatarProfilesModule() 40
41 { 41 public AvatarProfilesModule()
42 } 42 {
43 43 }
44 public void Initialise(Scene scene) 44
45 { 45 public void Initialise(Scene scene, IConfigSource config)
46 m_scene = scene; 46 {
47 m_scene.EventManager.OnNewClient += NewClient; 47 m_scene = scene;
48 } 48 m_scene.EventManager.OnNewClient += NewClient;
49 49 }
50 public void PostInitialise() 50
51 { 51 public void PostInitialise()
52 } 52 {
53 53 }
54 public void Close() 54
55 { 55 public void Close()
56 } 56 {
57 57 }
58 public string Name 58
59 { 59 public string Name
60 get { return "AvatarProfilesModule"; } 60 {
61 } 61 get { return "AvatarProfilesModule"; }
62 62 }
63 public bool IsSharedModule 63
64 { 64 public bool IsSharedModule
65 get { return false; } 65 {
66 } 66 get { return false; }
67 67 }
68 public void NewClient(IClientAPI client) 68
69 { 69 public void NewClient(IClientAPI client)
70 client.OnRequestAvatarProperties += RequestAvatarProperty; 70 {
71 } 71 client.OnRequestAvatarProperties += RequestAvatarProperty;
72 72 }
73 public void RemoveClient(IClientAPI client) 73
74 { 74 public void RemoveClient(IClientAPI client)
75 client.OnRequestAvatarProperties -= RequestAvatarProperty; 75 {
76 } 76 client.OnRequestAvatarProperties -= RequestAvatarProperty;
77 77 }
78 /// <summary> 78
79 /// 79 /// <summary>
80 /// </summary> 80 ///
81 /// <param name="remoteClient"></param> 81 /// </summary>
82 /// <param name="avatarID"></param> 82 /// <param name="remoteClient"></param>
83 public void RequestAvatarProperty(IClientAPI remoteClient, LLUUID avatarID) 83 /// <param name="avatarID"></param>
84 { 84 public void RequestAvatarProperty(IClientAPI remoteClient, LLUUID avatarID)
85 string about = "OpenSim crash test dummy"; 85 {
86 string bornOn = "Before now"; 86 string about = "OpenSim crash test dummy";
87 string flAbout = "First life? What is one of those? OpenSim is my life!"; 87 string bornOn = "Before now";
88 LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000"); 88 string flAbout = "First life? What is one of those? OpenSim is my life!";
89 remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "", 89 LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000");
90 partner); 90 remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "",
91 } 91 partner);
92 } 92 }
93} 93 }
94}
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs
index 6b8050e..a85a12c 100644
--- a/OpenSim/Region/Environment/Modules/ChatModule.cs
+++ b/OpenSim/Region/Environment/Modules/ChatModule.cs
@@ -1,242 +1,243 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
30using System.IO; 30using System.IO;
31using System.Net.Sockets; 31using System.Net.Sockets;
32using System.Threading; 32using System.Threading;
33using libsecondlife; 33using libsecondlife;
34using OpenSim.Framework.Interfaces; 34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Utilities; 35using OpenSim.Framework.Utilities;
36using OpenSim.Region.Environment.Interfaces; 36using OpenSim.Region.Environment.Interfaces;
37using OpenSim.Region.Environment.Scenes; 37using OpenSim.Region.Environment.Scenes;
38 38using Nini.Config;
39namespace OpenSim.Region.Environment.Modules 39
40{ 40namespace OpenSim.Region.Environment.Modules
41 public class ChatModule : IRegionModule, ISimChat 41{
42 { 42 public class ChatModule : IRegionModule, ISimChat
43 private Scene m_scene; 43 {
44 44 private Scene m_scene;
45 private string m_server = "irc2.choopa.net"; 45
46 46 private string m_server = "irc2.choopa.net";
47 // private int m_port = 6668; 47
48 //private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot"; 48 // private int m_port = 6668;
49 private string m_nick = "OSimBot"; 49 //private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot";
50 private string m_channel = "#opensim"; 50 private string m_nick = "OSimBot";
51 51 private string m_channel = "#opensim";
52 // private NetworkStream m_stream; 52
53 private TcpClient m_irc; 53 // private NetworkStream m_stream;
54 private StreamWriter m_ircWriter; 54 private TcpClient m_irc;
55 private StreamReader m_ircReader; 55 private StreamWriter m_ircWriter;
56 56 private StreamReader m_ircReader;
57 // private Thread pingSender; 57
58 // private Thread listener; 58 // private Thread pingSender;
59 59 // private Thread listener;
60 private bool connected = false; 60
61 61 private bool connected = false;
62 public ChatModule() 62
63 { 63 public ChatModule()
64 m_nick = "OSimBot" + Util.RandomClass.Next(1, 99); 64 {
65 m_irc = null; 65 m_nick = "OSimBot" + Util.RandomClass.Next(1, 99);
66 m_ircWriter = null; 66 m_irc = null;
67 m_ircReader = null; 67 m_ircWriter = null;
68 } 68 m_ircReader = null;
69 69 }
70 public void Initialise(Scene scene) 70
71 { 71 public void Initialise(Scene scene, IConfigSource config)
72 m_scene = scene; 72 {
73 m_scene.EventManager.OnNewClient += NewClient; 73 m_scene = scene;
74 74 m_scene.EventManager.OnNewClient += NewClient;
75 m_scene.RegisterModuleInterface<ISimChat>(this); 75
76 } 76 m_scene.RegisterModuleInterface<ISimChat>(this);
77 77 }
78 public void PostInitialise() 78
79 { 79 public void PostInitialise()
80 /* 80 {
81 try 81 /*
82 { 82 try
83 m_irc = new TcpClient(m_server, m_port); 83 {
84 m_stream = m_irc.GetStream(); 84 m_irc = new TcpClient(m_server, m_port);
85 m_ircReader = new StreamReader(m_stream); 85 m_stream = m_irc.GetStream();
86 m_ircWriter = new StreamWriter(m_stream); 86 m_ircReader = new StreamReader(m_stream);
87 87 m_ircWriter = new StreamWriter(m_stream);
88 pingSender = new Thread(new ThreadStart(this.PingRun)); 88
89 pingSender.Start(); 89 pingSender = new Thread(new ThreadStart(this.PingRun));
90 90 pingSender.Start();
91 listener = new Thread(new ThreadStart(this.ListenerRun)); 91
92 listener.Start(); 92 listener = new Thread(new ThreadStart(this.ListenerRun));
93 93 listener.Start();
94 m_ircWriter.WriteLine(m_user); 94
95 m_ircWriter.Flush(); 95 m_ircWriter.WriteLine(m_user);
96 m_ircWriter.WriteLine("NICK " + m_nick); 96 m_ircWriter.Flush();
97 m_ircWriter.Flush(); 97 m_ircWriter.WriteLine("NICK " + m_nick);
98 m_ircWriter.WriteLine("JOIN " + m_channel); 98 m_ircWriter.Flush();
99 m_ircWriter.Flush(); 99 m_ircWriter.WriteLine("JOIN " + m_channel);
100 connected = true; 100 m_ircWriter.Flush();
101 } 101 connected = true;
102 catch (Exception e) 102 }
103 { 103 catch (Exception e)
104 Console.WriteLine(e.ToString()); 104 {
105 } 105 Console.WriteLine(e.ToString());
106 */ 106 }
107 } 107 */
108 108 }
109 public void Close() 109
110 { 110 public void Close()
111 m_ircWriter.Close(); 111 {
112 m_ircReader.Close(); 112 m_ircWriter.Close();
113 m_irc.Close(); 113 m_ircReader.Close();
114 } 114 m_irc.Close();
115 115 }
116 public string Name 116
117 { 117 public string Name
118 get { return "ChatModule"; } 118 {
119 } 119 get { return "ChatModule"; }
120 120 }
121 public bool IsSharedModule 121
122 { 122 public bool IsSharedModule
123 get { return false; } 123 {
124 } 124 get { return false; }
125 125 }
126 public void NewClient(IClientAPI client) 126
127 { 127 public void NewClient(IClientAPI client)
128 client.OnChatFromViewer += SimChat; 128 {
129 } 129 client.OnChatFromViewer += SimChat;
130 130 }
131 public void PingRun() 131
132 { 132 public void PingRun()
133 while (true) 133 {
134 { 134 while (true)
135 m_ircWriter.WriteLine("PING :" + m_server); 135 {
136 m_ircWriter.Flush(); 136 m_ircWriter.WriteLine("PING :" + m_server);
137 Thread.Sleep(15000); 137 m_ircWriter.Flush();
138 } 138 Thread.Sleep(15000);
139 } 139 }
140 140 }
141 public void ListenerRun() 141
142 { 142 public void ListenerRun()
143 string inputLine; 143 {
144 LLVector3 pos = new LLVector3(128, 128, 20); 144 string inputLine;
145 while (true) 145 LLVector3 pos = new LLVector3(128, 128, 20);
146 { 146 while (true)
147 while ((inputLine = m_ircReader.ReadLine()) != null) 147 {
148 { 148 while ((inputLine = m_ircReader.ReadLine()) != null)
149 Console.WriteLine(inputLine); 149 {
150 if (inputLine.Contains(m_channel)) 150 Console.WriteLine(inputLine);
151 { 151 if (inputLine.Contains(m_channel))
152 string mess = inputLine.Substring(inputLine.IndexOf(m_channel)); 152 {
153 m_scene.Broadcast(delegate(IClientAPI client) 153 string mess = inputLine.Substring(inputLine.IndexOf(m_channel));
154 { 154 m_scene.Broadcast(delegate(IClientAPI client)
155 client.SendChatMessage( 155 {
156 Helpers.StringToField(mess), 255, pos, "IRC:", 156 client.SendChatMessage(
157 LLUUID.Zero); 157 Helpers.StringToField(mess), 255, pos, "IRC:",
158 }); 158 LLUUID.Zero);
159 } 159 });
160 } 160 }
161 } 161 }
162 } 162 }
163 163 }
164 public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, 164
165 LLUUID fromAgentID) 165 public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName,
166 { 166 LLUUID fromAgentID)
167 ScenePresence avatar = null; 167 {
168 avatar = m_scene.GetScenePresence(fromAgentID); 168 ScenePresence avatar = null;
169 if (avatar != null) 169 avatar = m_scene.GetScenePresence(fromAgentID);
170 { 170 if (avatar != null)
171 fromPos = avatar.AbsolutePosition; 171 {
172 fromName = avatar.Firstname + " " + avatar.Lastname; 172 fromPos = avatar.AbsolutePosition;
173 avatar = null; 173 fromName = avatar.Firstname + " " + avatar.Lastname;
174 } 174 avatar = null;
175 175 }
176 if (connected) 176
177 { 177 if (connected)
178 m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + ">: " + 178 {
179 Util.FieldToString(message)); 179 m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + ">: " +
180 m_ircWriter.Flush(); 180 Util.FieldToString(message));
181 } 181 m_ircWriter.Flush();
182 182 }
183 if (channel == 0) 183
184 { 184 if (channel == 0)
185 m_scene.ForEachScenePresence(delegate(ScenePresence presence) 185 {
186 { 186 m_scene.ForEachScenePresence(delegate(ScenePresence presence)
187 int dis = -1000; 187 {
188 188 int dis = -1000;
189 //err ??? the following code seems to be request a scenePresence when it already has a ref to it 189
190 avatar = m_scene.GetScenePresence(presence.ControllingClient.AgentId); 190 //err ??? the following code seems to be request a scenePresence when it already has a ref to it
191 if (avatar != null) 191 avatar = m_scene.GetScenePresence(presence.ControllingClient.AgentId);
192 { 192 if (avatar != null)
193 dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos); 193 {
194 } 194 dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos);
195 195 }
196 switch (type) 196
197 { 197 switch (type)
198 case 0: // Whisper 198 {
199 if ((dis < 10) && (dis > -10)) 199 case 0: // Whisper
200 { 200 if ((dis < 10) && (dis > -10))
201 //should change so the message is sent through the avatar rather than direct to the ClientView 201 {
202 presence.ControllingClient.SendChatMessage(message, 202 //should change so the message is sent through the avatar rather than direct to the ClientView
203 type, 203 presence.ControllingClient.SendChatMessage(message,
204 fromPos, 204 type,
205 fromName, 205 fromPos,
206 fromAgentID); 206 fromName,
207 } 207 fromAgentID);
208 break; 208 }
209 case 1: // Say 209 break;
210 if ((dis < 30) && (dis > -30)) 210 case 1: // Say
211 { 211 if ((dis < 30) && (dis > -30))
212 //Console.WriteLine("sending chat"); 212 {
213 presence.ControllingClient.SendChatMessage(message, 213 //Console.WriteLine("sending chat");
214 type, 214 presence.ControllingClient.SendChatMessage(message,
215 fromPos, 215 type,
216 fromName, 216 fromPos,
217 fromAgentID); 217 fromName,
218 } 218 fromAgentID);
219 break; 219 }
220 case 2: // Shout 220 break;
221 if ((dis < 100) && (dis > -100)) 221 case 2: // Shout
222 { 222 if ((dis < 100) && (dis > -100))
223 presence.ControllingClient.SendChatMessage(message, 223 {
224 type, 224 presence.ControllingClient.SendChatMessage(message,
225 fromPos, 225 type,
226 fromName, 226 fromPos,
227 fromAgentID); 227 fromName,
228 } 228 fromAgentID);
229 break; 229 }
230 230 break;
231 case 0xff: // Broadcast 231
232 presence.ControllingClient.SendChatMessage(message, type, 232 case 0xff: // Broadcast
233 fromPos, 233 presence.ControllingClient.SendChatMessage(message, type,
234 fromName, 234 fromPos,
235 fromAgentID); 235 fromName,
236 break; 236 fromAgentID);
237 } 237 break;
238 }); 238 }
239 } 239 });
240 } 240 }
241 } 241 }
242} 242 }
243}
diff --git a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs
index e776717..4e29977 100644
--- a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs
+++ b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs
@@ -1,190 +1,191 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using libsecondlife; 31using libsecondlife;
32using OpenSim.Framework.Types; 32using OpenSim.Framework.Types;
33using OpenSim.Framework.Utilities; 33using OpenSim.Framework.Utilities;
34using OpenSim.Region.Environment.Interfaces; 34using OpenSim.Region.Environment.Interfaces;
35using OpenSim.Region.Environment.Scenes; 35using OpenSim.Region.Environment.Scenes;
36 36using Nini.Config;
37namespace OpenSim.Region.Environment.Modules 37
38{ 38namespace OpenSim.Region.Environment.Modules
39 public class DynamicTextureModule : IRegionModule, IDynamicTextureManager 39{
40 { 40 public class DynamicTextureModule : IRegionModule, IDynamicTextureManager
41 private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>(); 41 {
42 42 private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
43 private Dictionary<string, IDynamicTextureRender> RenderPlugins = 43
44 new Dictionary<string, IDynamicTextureRender>(); 44 private Dictionary<string, IDynamicTextureRender> RenderPlugins =
45 45 new Dictionary<string, IDynamicTextureRender>();
46 private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>(); 46
47 47 private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>();
48 public void Initialise(Scene scene) 48
49 { 49 public void Initialise(Scene scene, IConfigSource config)
50 if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID)) 50 {
51 { 51 if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
52 RegisteredScenes.Add(scene.RegionInfo.RegionID, scene); 52 {
53 scene.RegisterModuleInterface<IDynamicTextureManager>(this); 53 RegisteredScenes.Add(scene.RegionInfo.RegionID, scene);
54 } 54 scene.RegisterModuleInterface<IDynamicTextureManager>(this);
55 } 55 }
56 56 }
57 public void PostInitialise() 57
58 { 58 public void PostInitialise()
59 } 59 {
60 60 }
61 public void Close() 61
62 { 62 public void Close()
63 } 63 {
64 64 }
65 public string Name 65
66 { 66 public string Name
67 get { return "DynamicTextureModule"; } 67 {
68 } 68 get { return "DynamicTextureModule"; }
69 69 }
70 public bool IsSharedModule 70
71 { 71 public bool IsSharedModule
72 get { return true; } 72 {
73 } 73 get { return true; }
74 74 }
75 public void RegisterRender(string handleType, IDynamicTextureRender render) 75
76 { 76 public void RegisterRender(string handleType, IDynamicTextureRender render)
77 if (!RenderPlugins.ContainsKey(handleType)) 77 {
78 { 78 if (!RenderPlugins.ContainsKey(handleType))
79 RenderPlugins.Add(handleType, render); 79 {
80 } 80 RenderPlugins.Add(handleType, render);
81 } 81 }
82 82 }
83 public void ReturnData(LLUUID id, byte[] data) 83
84 { 84 public void ReturnData(LLUUID id, byte[] data)
85 if (Updaters.ContainsKey(id)) 85 {
86 { 86 if (Updaters.ContainsKey(id))
87 DynamicTextureUpdater updater = Updaters[id]; 87 {
88 if (RegisteredScenes.ContainsKey(updater.SimUUID)) 88 DynamicTextureUpdater updater = Updaters[id];
89 { 89 if (RegisteredScenes.ContainsKey(updater.SimUUID))
90 Scene scene = RegisteredScenes[updater.SimUUID]; 90 {
91 updater.DataReceived(data, scene); 91 Scene scene = RegisteredScenes[updater.SimUUID];
92 } 92 updater.DataReceived(data, scene);
93 } 93 }
94 } 94 }
95 95 }
96 public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, 96
97 string extraParams, int updateTimer) 97 public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url,
98 { 98 string extraParams, int updateTimer)
99 if (RenderPlugins.ContainsKey(contentType)) 99 {
100 { 100 if (RenderPlugins.ContainsKey(contentType))
101 //Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType); 101 {
102 102 //Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType);
103 DynamicTextureUpdater updater = new DynamicTextureUpdater(); 103
104 updater.SimUUID = simID; 104 DynamicTextureUpdater updater = new DynamicTextureUpdater();
105 updater.PrimID = primID; 105 updater.SimUUID = simID;
106 updater.ContentType = contentType; 106 updater.PrimID = primID;
107 updater.Url = url; 107 updater.ContentType = contentType;
108 updater.UpdateTimer = updateTimer; 108 updater.Url = url;
109 updater.UpdaterID = LLUUID.Random(); 109 updater.UpdateTimer = updateTimer;
110 updater.Params = extraParams; 110 updater.UpdaterID = LLUUID.Random();
111 111 updater.Params = extraParams;
112 if (!Updaters.ContainsKey(updater.UpdaterID)) 112
113 { 113 if (!Updaters.ContainsKey(updater.UpdaterID))
114 Updaters.Add(updater.UpdaterID, updater); 114 {
115 } 115 Updaters.Add(updater.UpdaterID, updater);
116 116 }
117 RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams); 117
118 return updater.UpdaterID; 118 RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams);
119 } 119 return updater.UpdaterID;
120 return LLUUID.Zero; 120 }
121 } 121 return LLUUID.Zero;
122 122 }
123 public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, 123
124 string extraParams, int updateTimer) 124 public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data,
125 { 125 string extraParams, int updateTimer)
126 if (RenderPlugins.ContainsKey(contentType)) 126 {
127 { 127 if (RenderPlugins.ContainsKey(contentType))
128 DynamicTextureUpdater updater = new DynamicTextureUpdater(); 128 {
129 updater.SimUUID = simID; 129 DynamicTextureUpdater updater = new DynamicTextureUpdater();
130 updater.PrimID = primID; 130 updater.SimUUID = simID;
131 updater.ContentType = contentType; 131 updater.PrimID = primID;
132 updater.BodyData = data; 132 updater.ContentType = contentType;
133 updater.UpdateTimer = updateTimer; 133 updater.BodyData = data;
134 updater.UpdaterID = LLUUID.Random(); 134 updater.UpdateTimer = updateTimer;
135 updater.Params = extraParams; 135 updater.UpdaterID = LLUUID.Random();
136 136 updater.Params = extraParams;
137 if (!Updaters.ContainsKey(updater.UpdaterID)) 137
138 { 138 if (!Updaters.ContainsKey(updater.UpdaterID))
139 Updaters.Add(updater.UpdaterID, updater); 139 {
140 } 140 Updaters.Add(updater.UpdaterID, updater);
141 141 }
142 RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams); 142
143 return updater.UpdaterID; 143 RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams);
144 } 144 return updater.UpdaterID;
145 return LLUUID.Zero; 145 }
146 } 146 return LLUUID.Zero;
147 147 }
148 public class DynamicTextureUpdater 148
149 { 149 public class DynamicTextureUpdater
150 public LLUUID SimUUID; 150 {
151 public LLUUID UpdaterID; 151 public LLUUID SimUUID;
152 public string ContentType; 152 public LLUUID UpdaterID;
153 public string Url; 153 public string ContentType;
154 public string BodyData; 154 public string Url;
155 public LLUUID PrimID; 155 public string BodyData;
156 public int UpdateTimer; 156 public LLUUID PrimID;
157 public LLUUID LastAssetID; 157 public int UpdateTimer;
158 public string Params; 158 public LLUUID LastAssetID;
159 159 public string Params;
160 public DynamicTextureUpdater() 160
161 { 161 public DynamicTextureUpdater()
162 LastAssetID = LLUUID.Zero; 162 {
163 UpdateTimer = 0; 163 LastAssetID = LLUUID.Zero;
164 BodyData = null; 164 UpdateTimer = 0;
165 } 165 BodyData = null;
166 166 }
167 public void DataReceived(byte[] data, Scene scene) 167
168 { 168 public void DataReceived(byte[] data, Scene scene)
169 //TODO delete the last asset(data), if it was a dynamic texture 169 {
170 byte[] assetData = new byte[data.Length]; 170 //TODO delete the last asset(data), if it was a dynamic texture
171 Array.Copy(data, assetData, data.Length); 171 byte[] assetData = new byte[data.Length];
172 AssetBase asset = new AssetBase(); 172 Array.Copy(data, assetData, data.Length);
173 asset.FullID = LLUUID.Random(); 173 AssetBase asset = new AssetBase();
174 asset.Data = assetData; 174 asset.FullID = LLUUID.Random();
175 asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); 175 asset.Data = assetData;
176 asset.Type = 0; 176 asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000);
177 asset.Description = "dynamic image"; 177 asset.Type = 0;
178 asset.Local = false; 178 asset.Description = "dynamic image";
179 asset.Temporary = false; 179 asset.Local = false;
180 scene.commsManager.AssetCache.AddAsset(asset); 180 asset.Temporary = false;
181 181 scene.commsManager.AssetCache.AddAsset(asset);
182 LastAssetID = asset.FullID; 182
183 183 LastAssetID = asset.FullID;
184 SceneObjectPart part = scene.GetSceneObjectPart(PrimID); 184
185 part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes(); 185 SceneObjectPart part = scene.GetSceneObjectPart(PrimID);
186 part.ScheduleFullUpdate(); 186 part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes();
187 } 187 part.ScheduleFullUpdate();
188 } 188 }
189 } 189 }
190} 190 }
191}
diff --git a/OpenSim/Region/Environment/Modules/FriendsModule.cs b/OpenSim/Region/Environment/Modules/FriendsModule.cs
index 1b51d9e..9144bee 100644
--- a/OpenSim/Region/Environment/Modules/FriendsModule.cs
+++ b/OpenSim/Region/Environment/Modules/FriendsModule.cs
@@ -1,61 +1,62 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using OpenSim.Region.Environment.Interfaces; 29using OpenSim.Region.Environment.Interfaces;
30using OpenSim.Region.Environment.Scenes; 30using OpenSim.Region.Environment.Scenes;
31 31using Nini.Config;
32namespace OpenSim.Region.Environment.Modules 32
33{ 33namespace OpenSim.Region.Environment.Modules
34 public class FriendsModule : IRegionModule 34{
35 { 35 public class FriendsModule : IRegionModule
36 private Scene m_scene; 36 {
37 37 private Scene m_scene;
38 public void Initialise(Scene scene) 38
39 { 39 public void Initialise(Scene scene, IConfigSource config)
40 m_scene = scene; 40 {
41 } 41 m_scene = scene;
42 42 }
43 public void PostInitialise() 43
44 { 44 public void PostInitialise()
45 } 45 {
46 46 }
47 public void Close() 47
48 { 48 public void Close()
49 } 49 {
50 50 }
51 public string Name 51
52 { 52 public string Name
53 get { return "FriendsModule"; } 53 {
54 } 54 get { return "FriendsModule"; }
55 55 }
56 public bool IsSharedModule 56
57 { 57 public bool IsSharedModule
58 get { return false; } 58 {
59 } 59 get { return false; }
60 } 60 }
61} 61 }
62}
diff --git a/OpenSim/Region/Environment/Modules/GroupsModule.cs b/OpenSim/Region/Environment/Modules/GroupsModule.cs
index a024ccd..150f294 100644
--- a/OpenSim/Region/Environment/Modules/GroupsModule.cs
+++ b/OpenSim/Region/Environment/Modules/GroupsModule.cs
@@ -1,61 +1,62 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using OpenSim.Region.Environment.Interfaces; 29using OpenSim.Region.Environment.Interfaces;
30using OpenSim.Region.Environment.Scenes; 30using OpenSim.Region.Environment.Scenes;
31 31using Nini.Config;
32namespace OpenSim.Region.Environment.Modules 32
33{ 33namespace OpenSim.Region.Environment.Modules
34 public class GroupsModule : IRegionModule 34{
35 { 35 public class GroupsModule : IRegionModule
36 private Scene m_scene; 36 {
37 37 private Scene m_scene;
38 public void Initialise(Scene scene) 38
39 { 39 public void Initialise(Scene scene, IConfigSource config)
40 m_scene = scene; 40 {
41 } 41 m_scene = scene;
42 42 }
43 public void PostInitialise() 43
44 { 44 public void PostInitialise()
45 } 45 {
46 46 }
47 public void Close() 47
48 { 48 public void Close()
49 } 49 {
50 50 }
51 public string Name 51
52 { 52 public string Name
53 get { return "GroupsModule"; } 53 {
54 } 54 get { return "GroupsModule"; }
55 55 }
56 public bool IsSharedModule 56
57 { 57 public bool IsSharedModule
58 get { return false; } 58 {
59 } 59 get { return false; }
60 } 60 }
61} 61 }
62}
diff --git a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
index dbd2434..7c4e2c8 100644
--- a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
+++ b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
@@ -1,100 +1,101 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenSim.Region.Environment.Interfaces; 30using OpenSim.Region.Environment.Interfaces;
31using OpenSim.Region.Environment.Scenes; 31using OpenSim.Region.Environment.Scenes;
32using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
33 33using Nini.Config;
34namespace OpenSim.Region.Environment.Modules 34
35{ 35namespace OpenSim.Region.Environment.Modules
36 public class InstantMessageModule : IRegionModule 36{
37 { 37 public class InstantMessageModule : IRegionModule
38 private List<Scene> m_scenes = new List<Scene>(); 38 {
39 private LogBase m_log; 39 private List<Scene> m_scenes = new List<Scene>();
40 40 private LogBase m_log;
41 public void Initialise(Scene scene) 41
42 { 42 public void Initialise(Scene scene, IConfigSource config)
43 if (!m_scenes.Contains(scene)) 43 {
44 { 44 if (!m_scenes.Contains(scene))
45 m_scenes.Add(scene); 45 {
46 46 m_scenes.Add(scene);
47 scene.EventManager.OnNewClient += OnNewClient; 47
48 m_log = OpenSim.Framework.Console.MainLog.Instance; 48 scene.EventManager.OnNewClient += OnNewClient;
49 } 49 m_log = OpenSim.Framework.Console.MainLog.Instance;
50 } 50 }
51 51 }
52 void OnNewClient(OpenSim.Framework.Interfaces.IClientAPI client) 52
53 { 53 void OnNewClient(OpenSim.Framework.Interfaces.IClientAPI client)
54 client.OnInstantMessage += OnInstantMessage; 54 {
55 } 55 client.OnInstantMessage += OnInstantMessage;
56 56 }
57 void OnInstantMessage(libsecondlife.LLUUID fromAgentID, 57
58 libsecondlife.LLUUID fromAgentSession, libsecondlife.LLUUID toAgentID, 58 void OnInstantMessage(libsecondlife.LLUUID fromAgentID,
59 libsecondlife.LLUUID imSessionID, uint timestamp, string fromAgentName, 59 libsecondlife.LLUUID fromAgentSession, libsecondlife.LLUUID toAgentID,
60 string message, byte dialog) 60 libsecondlife.LLUUID imSessionID, uint timestamp, string fromAgentName,
61 { 61 string message, byte dialog)
62 // TODO: Remove after debugging. Privacy implications. 62 {
63 m_log.Verbose("IM",fromAgentName + ": " + message); 63 // TODO: Remove after debugging. Privacy implications.
64 64 m_log.Verbose("IM",fromAgentName + ": " + message);
65 foreach (Scene m_scene in m_scenes) 65
66 { 66 foreach (Scene m_scene in m_scenes)
67 if (m_scene.Entities.ContainsKey(toAgentID) && m_scene.Entities[toAgentID] is ScenePresence) 67 {
68 { 68 if (m_scene.Entities.ContainsKey(toAgentID) && m_scene.Entities[toAgentID] is ScenePresence)
69 // Local Message 69 {
70 ScenePresence user = (ScenePresence)m_scene.Entities[toAgentID]; 70 // Local Message
71 user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, 71 ScenePresence user = (ScenePresence)m_scene.Entities[toAgentID];
72 toAgentID, imSessionID, user.Firstname + " " + user.Lastname, dialog, timestamp); 72 user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message,
73 73 toAgentID, imSessionID, user.Firstname + " " + user.Lastname, dialog, timestamp);
74 // Message sent 74
75 return; 75 // Message sent
76 } 76 return;
77 } 77 }
78 78 }
79 // Still here, try send via Grid 79
80 } 80 // Still here, try send via Grid
81 81 }
82 public void PostInitialise() 82
83 { 83 public void PostInitialise()
84 } 84 {
85 85 }
86 public void Close() 86
87 { 87 public void Close()
88 } 88 {
89 89 }
90 public string Name 90
91 { 91 public string Name
92 get { return "InstantMessageModule"; } 92 {
93 } 93 get { return "InstantMessageModule"; }
94 94 }
95 public bool IsSharedModule 95
96 { 96 public bool IsSharedModule
97 get { return true; } 97 {
98 } 98 get { return true; }
99 } 99 }
100} 100 }
101}
diff --git a/OpenSim/Region/Environment/Modules/InventoryModule.cs b/OpenSim/Region/Environment/Modules/InventoryModule.cs
index d3b90c2..3f8cd6e 100644
--- a/OpenSim/Region/Environment/Modules/InventoryModule.cs
+++ b/OpenSim/Region/Environment/Modules/InventoryModule.cs
@@ -1,61 +1,62 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using OpenSim.Region.Environment.Interfaces; 29using OpenSim.Region.Environment.Interfaces;
30using OpenSim.Region.Environment.Scenes; 30using OpenSim.Region.Environment.Scenes;
31 31using Nini.Config;
32namespace OpenSim.Region.Environment.Modules 32
33{ 33namespace OpenSim.Region.Environment.Modules
34 public class InventoryModule : IRegionModule 34{
35 { 35 public class InventoryModule : IRegionModule
36 private Scene m_scene; 36 {
37 37 private Scene m_scene;
38 public void Initialise(Scene scene) 38
39 { 39 public void Initialise(Scene scene, IConfigSource config)
40 m_scene = scene; 40 {
41 } 41 m_scene = scene;
42 42 }
43 public void PostInitialise() 43
44 { 44 public void PostInitialise()
45 } 45 {
46 46 }
47 public void Close() 47
48 { 48 public void Close()
49 } 49 {
50 50 }
51 public string Name 51
52 { 52 public string Name
53 get { return "InventoryModule"; } 53 {
54 } 54 get { return "InventoryModule"; }
55 55 }
56 public bool IsSharedModule 56
57 { 57 public bool IsSharedModule
58 get { return false; } 58 {
59 } 59 get { return false; }
60 } 60 }
61} 61 }
62}
diff --git a/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs b/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs
index f1f479d..8b8b386 100644
--- a/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs
+++ b/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs
@@ -1,123 +1,124 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using System.Net; 4using System.Net;
5using System.IO; 5using System.IO;
6using System.Drawing; 6using System.Drawing;
7using libsecondlife; 7using libsecondlife;
8using OpenJPEGNet; 8using OpenJPEGNet;
9using OpenSim.Region.Environment.Scenes; 9using OpenSim.Region.Environment.Scenes;
10using OpenSim.Region.Environment.Interfaces; 10using OpenSim.Region.Environment.Interfaces;
11 11using Nini.Config;
12namespace OpenSim.Region.Environment.Modules 12
13{ 13namespace OpenSim.Region.Environment.Modules
14 public class LoadImageURLModule : IRegionModule , IDynamicTextureRender 14{
15 { 15 public class LoadImageURLModule : IRegionModule , IDynamicTextureRender
16 private string m_name = "LoadImageURL"; 16 {
17 private IDynamicTextureManager m_textureManager; 17 private string m_name = "LoadImageURL";
18 private Scene m_scene; 18 private IDynamicTextureManager m_textureManager;
19 19 private Scene m_scene;
20 public void Initialise(Scene scene) 20
21 { 21 public void Initialise(Scene scene, IConfigSource config)
22 if (m_scene == null) 22 {
23 { 23 if (m_scene == null)
24 m_scene = scene; 24 {
25 } 25 m_scene = scene;
26 } 26 }
27 27 }
28 public void PostInitialise() 28
29 { 29 public void PostInitialise()
30 m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); 30 {
31 m_textureManager.RegisterRender(GetContentType(), this); 31 m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>();
32 } 32 m_textureManager.RegisterRender(GetContentType(), this);
33 33 }
34 public void Close() 34
35 { 35 public void Close()
36 } 36 {
37 37 }
38 public string Name 38
39 { 39 public string Name
40 get { return m_name; } 40 {
41 } 41 get { return m_name; }
42 42 }
43 public bool IsSharedModule 43
44 { 44 public bool IsSharedModule
45 get { return true; } 45 {
46 } 46 get { return true; }
47 47 }
48 public string GetName() 48
49 { 49 public string GetName()
50 return m_name; 50 {
51 } 51 return m_name;
52 52 }
53 public string GetContentType() 53
54 { 54 public string GetContentType()
55 return ("image"); 55 {
56 } 56 return ("image");
57 57 }
58 public bool SupportsAsynchronous() 58
59 { 59 public bool SupportsAsynchronous()
60 return true; 60 {
61 } 61 return true;
62 62 }
63 public byte[] ConvertUrl(string url, string extraParams) 63
64 { 64 public byte[] ConvertUrl(string url, string extraParams)
65 return null; 65 {
66 } 66 return null;
67 67 }
68 public byte[] ConvertStream(Stream data, string extraParams) 68
69 { 69 public byte[] ConvertStream(Stream data, string extraParams)
70 return null; 70 {
71 } 71 return null;
72 72 }
73 public bool AsyncConvertUrl(LLUUID id, string url, string extraParams) 73
74 { 74 public bool AsyncConvertUrl(LLUUID id, string url, string extraParams)
75 MakeHttpRequest(url, id); 75 {
76 return true; 76 MakeHttpRequest(url, id);
77 } 77 return true;
78 78 }
79 public bool AsyncConvertData(LLUUID id, string bodyData, string extraParams) 79
80 { 80 public bool AsyncConvertData(LLUUID id, string bodyData, string extraParams)
81 return false; 81 {
82 } 82 return false;
83 83 }
84 private void MakeHttpRequest(string url, LLUUID requestID) 84
85 { 85 private void MakeHttpRequest(string url, LLUUID requestID)
86 WebRequest request = HttpWebRequest.Create(url); 86 {
87 RequestState state = new RequestState((HttpWebRequest)request, requestID); 87 WebRequest request = HttpWebRequest.Create(url);
88 IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state); 88 RequestState state = new RequestState((HttpWebRequest)request, requestID);
89 89 IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state);
90 TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1)); 90
91 state.TimeOfRequest = (int)t.TotalSeconds; 91 TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1));
92 } 92 state.TimeOfRequest = (int)t.TotalSeconds;
93 93 }
94 private void HttpRequestReturn(IAsyncResult result) 94
95 { 95 private void HttpRequestReturn(IAsyncResult result)
96 RequestState state = (RequestState)result.AsyncState; 96 {
97 WebRequest request = (WebRequest)state.Request; 97 RequestState state = (RequestState)result.AsyncState;
98 HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result); 98 WebRequest request = (WebRequest)state.Request;
99 if (response.StatusCode == HttpStatusCode.OK) 99 HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result);
100 { 100 if (response.StatusCode == HttpStatusCode.OK)
101 Bitmap image = new Bitmap(response.GetResponseStream()); 101 {
102 Bitmap resize = new Bitmap(image, new Size(512, 512)); 102 Bitmap image = new Bitmap(response.GetResponseStream());
103 byte[] imageJ2000 = OpenJPEG.EncodeFromImage(resize, true); 103 Bitmap resize = new Bitmap(image, new Size(512, 512));
104 104 byte[] imageJ2000 = OpenJPEG.EncodeFromImage(resize, true);
105 m_textureManager.ReturnData(state.RequestID, imageJ2000); 105
106 } 106 m_textureManager.ReturnData(state.RequestID, imageJ2000);
107 } 107 }
108 108 }
109 public class RequestState 109
110 { 110 public class RequestState
111 public HttpWebRequest Request = null; 111 {
112 public LLUUID RequestID = LLUUID.Zero; 112 public HttpWebRequest Request = null;
113 public int TimeOfRequest = 0; 113 public LLUUID RequestID = LLUUID.Zero;
114 114 public int TimeOfRequest = 0;
115 public RequestState(HttpWebRequest request, LLUUID requestID) 115
116 { 116 public RequestState(HttpWebRequest request, LLUUID requestID)
117 Request = request; 117 {
118 RequestID = requestID; 118 Request = request;
119 } 119 RequestID = requestID;
120 } 120 }
121 121 }
122 } 122
123} 123 }
124}
diff --git a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
index 2531265..d3297c8 100644
--- a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
+++ b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
@@ -1,76 +1,77 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using libsecondlife; 29using libsecondlife;
30using OpenSim.Framework.Interfaces; 30using OpenSim.Framework.Interfaces;
31using OpenSim.Region.Environment.Interfaces; 31using OpenSim.Region.Environment.Interfaces;
32using OpenSim.Region.Environment.Scenes; 32using OpenSim.Region.Environment.Scenes;
33 33using Nini.Config;
34namespace OpenSim.Region.Environment.Modules 34
35{ 35namespace OpenSim.Region.Environment.Modules
36 public class TextureDownloadModule : IRegionModule 36{
37 { 37 public class TextureDownloadModule : IRegionModule
38 private Scene m_scene; 38 {
39 39 private Scene m_scene;
40 public TextureDownloadModule() 40
41 { 41 public TextureDownloadModule()
42 } 42 {
43 43 }
44 public void Initialise(Scene scene) 44
45 { 45 public void Initialise(Scene scene, IConfigSource config)
46 m_scene = scene; 46 {
47 m_scene.EventManager.OnNewClient += NewClient; 47 m_scene = scene;
48 } 48 m_scene.EventManager.OnNewClient += NewClient;
49 49 }
50 public void PostInitialise() 50
51 { 51 public void PostInitialise()
52 } 52 {
53 53 }
54 public void Close() 54
55 { 55 public void Close()
56 } 56 {
57 57 }
58 public string Name 58
59 { 59 public string Name
60 get { return "TextureDownloadModule"; } 60 {
61 } 61 get { return "TextureDownloadModule"; }
62 62 }
63 public bool IsSharedModule 63
64 { 64 public bool IsSharedModule
65 get { return false; } 65 {
66 } 66 get { return false; }
67 67 }
68 public void NewClient(IClientAPI client) 68
69 { 69 public void NewClient(IClientAPI client)
70 } 70 {
71 71 }
72 public void TextureAssetCallback(LLUUID texture, byte[] data) 72
73 { 73 public void TextureAssetCallback(LLUUID texture, byte[] data)
74 } 74 {
75 } 75 }
76} 76 }
77}
diff --git a/OpenSim/Region/Environment/Modules/WorldCommModule.cs b/OpenSim/Region/Environment/Modules/WorldCommModule.cs
index 994d07e..765f1b4 100644
--- a/OpenSim/Region/Environment/Modules/WorldCommModule.cs
+++ b/OpenSim/Region/Environment/Modules/WorldCommModule.cs
@@ -40,6 +40,7 @@ using OpenSim.Framework.Servers;
40using Nwc.XmlRpc; 40using Nwc.XmlRpc;
41using System.Collections; 41using System.Collections;
42using System.Collections.Generic; 42using System.Collections.Generic;
43using Nini.Config;
43 44
44/***************************************************** 45/*****************************************************
45 * 46 *
@@ -84,7 +85,7 @@ namespace OpenSim.Region.Environment.Modules
84 { 85 {
85 } 86 }
86 87
87 public void Initialise(Scene scene) 88 public void Initialise(Scene scene, IConfigSource config)
88 { 89 {
89 90
90 m_scene = scene; 91 m_scene = scene;
diff --git a/OpenSim/Region/Environment/Modules/XMLRPCModule.cs b/OpenSim/Region/Environment/Modules/XMLRPCModule.cs
index 941d3c1..3a5b3c6 100644
--- a/OpenSim/Region/Environment/Modules/XMLRPCModule.cs
+++ b/OpenSim/Region/Environment/Modules/XMLRPCModule.cs
@@ -39,6 +39,7 @@ using OpenSim.Framework.Servers;
39using Nwc.XmlRpc; 39using Nwc.XmlRpc;
40using System.Collections; 40using System.Collections;
41using System.Collections.Generic; 41using System.Collections.Generic;
42using Nini.Config;
42 43
43/***************************************************** 44/*****************************************************
44 * 45 *
@@ -93,7 +94,7 @@ namespace OpenSim.Region.Environment.Modules
93 { 94 {
94 } 95 }
95 96
96 public void Initialise(Scene scene) 97 public void Initialise(Scene scene, IConfigSource config)
97 { 98 {
98 m_scene = scene; 99 m_scene = scene;
99 100
diff --git a/OpenSim/Region/Environment/Modules/XferModule.cs b/OpenSim/Region/Environment/Modules/XferModule.cs
index 7bc831f..2adb1c9 100644
--- a/OpenSim/Region/Environment/Modules/XferModule.cs
+++ b/OpenSim/Region/Environment/Modules/XferModule.cs
@@ -1,201 +1,202 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using libsecondlife; 31using libsecondlife;
32using OpenSim.Framework.Interfaces; 32using OpenSim.Framework.Interfaces;
33using OpenSim.Region.Environment.Interfaces; 33using OpenSim.Region.Environment.Interfaces;
34using OpenSim.Region.Environment.Scenes; 34using OpenSim.Region.Environment.Scenes;
35 35using Nini.Config;
36namespace OpenSim.Region.Environment.Modules 36
37{ 37namespace OpenSim.Region.Environment.Modules
38 public class XferModule : IRegionModule, IXfer 38{
39 { 39 public class XferModule : IRegionModule, IXfer
40 public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>(); 40 {
41 public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>(); 41 public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>();
42 42 public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>();
43 private Scene m_scene; 43
44 44 private Scene m_scene;
45 public XferModule() 45
46 { 46 public XferModule()
47 } 47 {
48 48 }
49 public void Initialise(Scene scene) 49
50 { 50 public void Initialise(Scene scene, IConfigSource config)
51 m_scene = scene; 51 {
52 m_scene.EventManager.OnNewClient += NewClient; 52 m_scene = scene;
53 53 m_scene.EventManager.OnNewClient += NewClient;
54 m_scene.RegisterModuleInterface<IXfer>(this); 54
55 } 55 m_scene.RegisterModuleInterface<IXfer>(this);
56 56 }
57 public void PostInitialise() 57
58 { 58 public void PostInitialise()
59 } 59 {
60 60 }
61 public void Close() 61
62 { 62 public void Close()
63 } 63 {
64 64 }
65 public string Name 65
66 { 66 public string Name
67 get { return "XferModule"; } 67 {
68 } 68 get { return "XferModule"; }
69 69 }
70 public bool IsSharedModule 70
71 { 71 public bool IsSharedModule
72 get { return false; } 72 {
73 } 73 get { return false; }
74 74 }
75 public void NewClient(IClientAPI client) 75
76 { 76 public void NewClient(IClientAPI client)
77 client.OnRequestXfer += RequestXfer; 77 {
78 client.OnConfirmXfer += AckPacket; 78 client.OnRequestXfer += RequestXfer;
79 } 79 client.OnConfirmXfer += AckPacket;
80 80 }
81 /// <summary> 81
82 /// 82 /// <summary>
83 /// </summary> 83 ///
84 /// <param name="remoteClient"></param> 84 /// </summary>
85 /// <param name="xferID"></param> 85 /// <param name="remoteClient"></param>
86 /// <param name="fileName"></param> 86 /// <param name="xferID"></param>
87 public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName) 87 /// <param name="fileName"></param>
88 { 88 public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName)
89 lock (NewFiles) 89 {
90 { 90 lock (NewFiles)
91 if (NewFiles.ContainsKey(fileName)) 91 {
92 { 92 if (NewFiles.ContainsKey(fileName))
93 if (!Transfers.ContainsKey(xferID)) 93 {
94 { 94 if (!Transfers.ContainsKey(xferID))
95 byte[] fileData = NewFiles[fileName]; 95 {
96 XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient); 96 byte[] fileData = NewFiles[fileName];
97 Transfers.Add(xferID, transaction); 97 XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient);
98 NewFiles.Remove(fileName); 98 Transfers.Add(xferID, transaction);
99 transaction.StartSend(); 99 NewFiles.Remove(fileName);
100 } 100 transaction.StartSend();
101 } 101 }
102 } 102 }
103 } 103 }
104 104 }
105 public void AckPacket(IClientAPI remoteClient, ulong xferID, uint packet) 105
106 { 106 public void AckPacket(IClientAPI remoteClient, ulong xferID, uint packet)
107 if (Transfers.ContainsKey(xferID)) 107 {
108 { 108 if (Transfers.ContainsKey(xferID))
109 Transfers[xferID].AckPacket(packet); 109 {
110 } 110 Transfers[xferID].AckPacket(packet);
111 } 111 }
112 112 }
113 public bool AddNewFile(string fileName, byte[] data) 113
114 { 114 public bool AddNewFile(string fileName, byte[] data)
115 lock (NewFiles) 115 {
116 { 116 lock (NewFiles)
117 if (NewFiles.ContainsKey(fileName)) 117 {
118 { 118 if (NewFiles.ContainsKey(fileName))
119 NewFiles[fileName] = data; 119 {
120 } 120 NewFiles[fileName] = data;
121 else 121 }
122 { 122 else
123 NewFiles.Add(fileName, data); 123 {
124 } 124 NewFiles.Add(fileName, data);
125 } 125 }
126 return true; 126 }
127 } 127 return true;
128 128 }
129 129
130 public class XferDownLoad 130
131 { 131 public class XferDownLoad
132 public byte[] Data = new byte[0]; 132 {
133 public string FileName = ""; 133 public byte[] Data = new byte[0];
134 public ulong XferID = 0; 134 public string FileName = "";
135 public int DataPointer = 0; 135 public ulong XferID = 0;
136 public uint Packet = 0; 136 public int DataPointer = 0;
137 public IClientAPI Client; 137 public uint Packet = 0;
138 public uint Serial = 1; 138 public IClientAPI Client;
139 private bool complete = false; 139 public uint Serial = 1;
140 140 private bool complete = false;
141 public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client) 141
142 { 142 public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client)
143 FileName = fileName; 143 {
144 Data = data; 144 FileName = fileName;
145 XferID = xferID; 145 Data = data;
146 Client = client; 146 XferID = xferID;
147 } 147 Client = client;
148 148 }
149 public XferDownLoad() 149
150 { 150 public XferDownLoad()
151 } 151 {
152 152 }
153 public void StartSend() 153
154 { 154 public void StartSend()
155 if (Data.Length < 1000) 155 {
156 { 156 if (Data.Length < 1000)
157 // for now (testing ) we only support files under 1000 bytes 157 {
158 byte[] transferData = new byte[Data.Length + 4]; 158 // for now (testing ) we only support files under 1000 bytes
159 Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4); 159 byte[] transferData = new byte[Data.Length + 4];
160 Array.Copy(Data, 0, transferData, 4, Data.Length); 160 Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4);
161 Client.SendXferPacket(XferID, 0 + 0x80000000, transferData); 161 Array.Copy(Data, 0, transferData, 4, Data.Length);
162 complete = true; 162 Client.SendXferPacket(XferID, 0 + 0x80000000, transferData);
163 } 163 complete = true;
164 else 164 }
165 { 165 else
166 byte[] transferData = new byte[1000 + 4]; 166 {
167 Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4); 167 byte[] transferData = new byte[1000 + 4];
168 Array.Copy(Data, 0, transferData, 4, 1000); 168 Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4);
169 Client.SendXferPacket(XferID, 0, transferData); 169 Array.Copy(Data, 0, transferData, 4, 1000);
170 Packet++; 170 Client.SendXferPacket(XferID, 0, transferData);
171 DataPointer = 1000; 171 Packet++;
172 } 172 DataPointer = 1000;
173 } 173 }
174 174 }
175 public void AckPacket(uint packet) 175
176 { 176 public void AckPacket(uint packet)
177 if (!complete) 177 {
178 { 178 if (!complete)
179 if ((Data.Length - DataPointer) > 1000) 179 {
180 { 180 if ((Data.Length - DataPointer) > 1000)
181 byte[] transferData = new byte[1000]; 181 {
182 Array.Copy(Data, DataPointer, transferData, 0, 1000); 182 byte[] transferData = new byte[1000];
183 Client.SendXferPacket(XferID, Packet, transferData); 183 Array.Copy(Data, DataPointer, transferData, 0, 1000);
184 Packet++; 184 Client.SendXferPacket(XferID, Packet, transferData);
185 DataPointer += 1000; 185 Packet++;
186 } 186 DataPointer += 1000;
187 else 187 }
188 { 188 else
189 byte[] transferData = new byte[Data.Length - DataPointer]; 189 {
190 Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer); 190 byte[] transferData = new byte[Data.Length - DataPointer];
191 uint endPacket = Packet |= (uint) 0x80000000; 191 Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer);
192 Client.SendXferPacket(XferID, endPacket, transferData); 192 uint endPacket = Packet |= (uint) 0x80000000;
193 Packet++; 193 Client.SendXferPacket(XferID, endPacket, transferData);
194 DataPointer += (Data.Length - DataPointer); 194 Packet++;
195 complete = true; 195 DataPointer += (Data.Length - DataPointer);
196 } 196 complete = true;
197 } 197 }
198 } 198 }
199 } 199 }
200 } 200 }
201} 201 }
202}