aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Modules/AssetDownloadModule.cs100
-rw-r--r--OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs142
-rw-r--r--OpenSim/Region/Environment/Modules/ChatModule.cs432
-rw-r--r--OpenSim/Region/Environment/Modules/DynamicTextureModule.cs318
-rw-r--r--OpenSim/Region/Environment/Modules/EmailModule.cs20
-rw-r--r--OpenSim/Region/Environment/Modules/FriendsModule.cs80
-rw-r--r--OpenSim/Region/Environment/Modules/GroupsModule.cs80
-rw-r--r--OpenSim/Region/Environment/Modules/InstantMessageModule.cs80
-rw-r--r--OpenSim/Region/Environment/Modules/InventoryModule.cs80
-rw-r--r--OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs20
-rw-r--r--OpenSim/Region/Environment/Modules/TeleportModule.cs20
-rw-r--r--OpenSim/Region/Environment/Modules/TextureDownloadModule.cs108
-rw-r--r--OpenSim/Region/Environment/Modules/XferModule.cs360
13 files changed, 920 insertions, 920 deletions
diff --git a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
index 21a7e61..7a53f6f 100644
--- a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
+++ b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
@@ -1,50 +1,50 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using libsecondlife; 4using libsecondlife;
5using OpenSim.Framework.Interfaces; 5using OpenSim.Framework.Interfaces;
6using OpenSim.Region.Environment.Scenes; 6using OpenSim.Region.Environment.Scenes;
7using OpenSim.Region.Environment.Interfaces; 7using OpenSim.Region.Environment.Interfaces;
8 8
9 9
10namespace OpenSim.Region.Environment.Modules 10namespace OpenSim.Region.Environment.Modules
11{ 11{
12 public class AssetDownloadModule : IRegionModule 12 public class AssetDownloadModule : IRegionModule
13 { 13 {
14 private Scene m_scene; 14 private Scene m_scene;
15 15
16 public AssetDownloadModule() 16 public AssetDownloadModule()
17 { 17 {
18 18
19 } 19 }
20 20
21 public void Initialise(Scene scene) 21 public void Initialise(Scene scene)
22 { 22 {
23 m_scene = scene; 23 m_scene = scene;
24 m_scene.EventManager.OnNewClient += NewClient; 24 m_scene.EventManager.OnNewClient += NewClient;
25 } 25 }
26 26
27 public void PostInitialise() 27 public void PostInitialise()
28 { 28 {
29 29
30 } 30 }
31 31
32 public void CloseDown() 32 public void CloseDown()
33 { 33 {
34 } 34 }
35 35
36 public string GetName() 36 public string GetName()
37 { 37 {
38 return "AssetDownloadModule"; 38 return "AssetDownloadModule";
39 } 39 }
40 40
41 public bool IsSharedModule() 41 public bool IsSharedModule()
42 { 42 {
43 return false; 43 return false;
44 } 44 }
45 45
46 public void NewClient(IClientAPI client) 46 public void NewClient(IClientAPI client)
47 { 47 {
48 } 48 }
49 } 49 }
50} 50}
diff --git a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs
index 1ad061a..c349888 100644
--- a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs
+++ b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs
@@ -1,71 +1,71 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using libsecondlife; 4using libsecondlife;
5using OpenSim.Framework.Interfaces; 5using OpenSim.Framework.Interfaces;
6using OpenSim.Region.Environment.Scenes; 6using OpenSim.Region.Environment.Scenes;
7using OpenSim.Region.Environment.Interfaces; 7using OpenSim.Region.Environment.Interfaces;
8 8
9namespace OpenSim.Region.Environment.Modules 9namespace OpenSim.Region.Environment.Modules
10{ 10{
11 public class AvatarProfilesModule :IRegionModule 11 public class AvatarProfilesModule :IRegionModule
12 { 12 {
13 13
14 private Scene m_scene; 14 private Scene m_scene;
15 15
16 public AvatarProfilesModule() 16 public AvatarProfilesModule()
17 { 17 {
18 18
19 } 19 }
20 20
21 public void Initialise(Scene scene) 21 public void Initialise(Scene scene)
22 { 22 {
23 m_scene = scene; 23 m_scene = scene;
24 m_scene.EventManager.OnNewClient += NewClient; 24 m_scene.EventManager.OnNewClient += NewClient;
25 } 25 }
26 26
27 public void PostInitialise() 27 public void PostInitialise()
28 { 28 {
29 29
30 } 30 }
31 31
32 public void CloseDown() 32 public void CloseDown()
33 { 33 {
34 34
35 } 35 }
36 36
37 public string GetName() 37 public string GetName()
38 { 38 {
39 return "AvatarProfilesModule"; 39 return "AvatarProfilesModule";
40 } 40 }
41 41
42 public bool IsSharedModule() 42 public bool IsSharedModule()
43 { 43 {
44 return false; 44 return false;
45 } 45 }
46 46
47 public void NewClient(IClientAPI client) 47 public void NewClient(IClientAPI client)
48 { 48 {
49 client.OnRequestAvatarProperties += RequestAvatarProperty; 49 client.OnRequestAvatarProperties += RequestAvatarProperty;
50 } 50 }
51 51
52 public void RemoveClient(IClientAPI client) 52 public void RemoveClient(IClientAPI client)
53 { 53 {
54 client.OnRequestAvatarProperties -= RequestAvatarProperty; 54 client.OnRequestAvatarProperties -= RequestAvatarProperty;
55 } 55 }
56 56
57 /// <summary> 57 /// <summary>
58 /// 58 ///
59 /// </summary> 59 /// </summary>
60 /// <param name="remoteClient"></param> 60 /// <param name="remoteClient"></param>
61 /// <param name="avatarID"></param> 61 /// <param name="avatarID"></param>
62 public void RequestAvatarProperty(IClientAPI remoteClient, LLUUID avatarID) 62 public void RequestAvatarProperty(IClientAPI remoteClient, LLUUID avatarID)
63 { 63 {
64 string about = "OpenSim crash test dummy"; 64 string about = "OpenSim crash test dummy";
65 string bornOn = "Before now"; 65 string bornOn = "Before now";
66 string flAbout = "First life? What is one of those? OpenSim is my life!"; 66 string flAbout = "First life? What is one of those? OpenSim is my life!";
67 LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000"); 67 LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000");
68 remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "", partner); 68 remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "", partner);
69 } 69 }
70 } 70 }
71} 71}
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs
index a46343b..8d3a553 100644
--- a/OpenSim/Region/Environment/Modules/ChatModule.cs
+++ b/OpenSim/Region/Environment/Modules/ChatModule.cs
@@ -1,216 +1,216 @@
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.Net.Sockets; 5using System.Net.Sockets;
6using System.Threading; 6using System.Threading;
7using System.IO; 7using System.IO;
8using libsecondlife; 8using libsecondlife;
9using OpenSim.Region.Environment.Scenes; 9using OpenSim.Region.Environment.Scenes;
10using OpenSim.Region.Environment.Interfaces; 10using OpenSim.Region.Environment.Interfaces;
11using OpenSim.Framework.Interfaces; 11using OpenSim.Framework.Interfaces;
12using OpenSim.Framework.Utilities; 12using OpenSim.Framework.Utilities;
13using OpenSim.Framework.Console; 13using OpenSim.Framework.Console;
14 14
15namespace OpenSim.Region.Environment.Modules 15namespace OpenSim.Region.Environment.Modules
16{ 16{
17 public class ChatModule : IRegionModule, ISimChat 17 public class ChatModule : IRegionModule, ISimChat
18 { 18 {
19 private Scene m_scene; 19 private Scene m_scene;
20 20
21 private string m_server = "irc2.choopa.net"; 21 private string m_server = "irc2.choopa.net";
22 22
23 // private int m_port = 6668; 23 // private int m_port = 6668;
24 //private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot"; 24 //private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot";
25 private string m_nick = "OSimBot"; 25 private string m_nick = "OSimBot";
26 private string m_channel = "#opensim"; 26 private string m_channel = "#opensim";
27 27
28 // private NetworkStream m_stream; 28 // private NetworkStream m_stream;
29 private TcpClient m_irc; 29 private TcpClient m_irc;
30 private StreamWriter m_ircWriter; 30 private StreamWriter m_ircWriter;
31 private StreamReader m_ircReader; 31 private StreamReader m_ircReader;
32 32
33 // private Thread pingSender; 33 // private Thread pingSender;
34 // private Thread listener; 34 // private Thread listener;
35 35
36 private bool connected = false; 36 private bool connected = false;
37 37
38 public ChatModule() 38 public ChatModule()
39 { 39 {
40 m_nick = "OSimBot" + Util.RandomClass.Next(1, 99); 40 m_nick = "OSimBot" + Util.RandomClass.Next(1, 99);
41 m_irc = null; 41 m_irc = null;
42 m_ircWriter = null; 42 m_ircWriter = null;
43 m_ircReader = null; 43 m_ircReader = null;
44 } 44 }
45 45
46 public void Initialise(Scene scene) 46 public void Initialise(Scene scene)
47 { 47 {
48 m_scene = scene; 48 m_scene = scene;
49 m_scene.EventManager.OnNewClient += NewClient; 49 m_scene.EventManager.OnNewClient += NewClient;
50 50
51 m_scene.RegisterModuleInterface<ISimChat>(this); 51 m_scene.RegisterModuleInterface<ISimChat>(this);
52 } 52 }
53 53
54 public void PostInitialise() 54 public void PostInitialise()
55 { 55 {
56 /* 56 /*
57 try 57 try
58 { 58 {
59 m_irc = new TcpClient(m_server, m_port); 59 m_irc = new TcpClient(m_server, m_port);
60 m_stream = m_irc.GetStream(); 60 m_stream = m_irc.GetStream();
61 m_ircReader = new StreamReader(m_stream); 61 m_ircReader = new StreamReader(m_stream);
62 m_ircWriter = new StreamWriter(m_stream); 62 m_ircWriter = new StreamWriter(m_stream);
63 63
64 pingSender = new Thread(new ThreadStart(this.PingRun)); 64 pingSender = new Thread(new ThreadStart(this.PingRun));
65 pingSender.Start(); 65 pingSender.Start();
66 66
67 listener = new Thread(new ThreadStart(this.ListenerRun)); 67 listener = new Thread(new ThreadStart(this.ListenerRun));
68 listener.Start(); 68 listener.Start();
69 69
70 m_ircWriter.WriteLine(m_user); 70 m_ircWriter.WriteLine(m_user);
71 m_ircWriter.Flush(); 71 m_ircWriter.Flush();
72 m_ircWriter.WriteLine("NICK " + m_nick); 72 m_ircWriter.WriteLine("NICK " + m_nick);
73 m_ircWriter.Flush(); 73 m_ircWriter.Flush();
74 m_ircWriter.WriteLine("JOIN " + m_channel); 74 m_ircWriter.WriteLine("JOIN " + m_channel);
75 m_ircWriter.Flush(); 75 m_ircWriter.Flush();
76 connected = true; 76 connected = true;
77 } 77 }
78 catch (Exception e) 78 catch (Exception e)
79 { 79 {
80 Console.WriteLine(e.ToString()); 80 Console.WriteLine(e.ToString());
81 } 81 }
82 */ 82 */
83 } 83 }
84 84
85 public void CloseDown() 85 public void CloseDown()
86 { 86 {
87 m_ircWriter.Close(); 87 m_ircWriter.Close();
88 m_ircReader.Close(); 88 m_ircReader.Close();
89 m_irc.Close(); 89 m_irc.Close();
90 } 90 }
91 91
92 public string GetName() 92 public string GetName()
93 { 93 {
94 return "ChatModule"; 94 return "ChatModule";
95 } 95 }
96 96
97 public bool IsSharedModule() 97 public bool IsSharedModule()
98 { 98 {
99 return false; 99 return false;
100 } 100 }
101 101
102 public void NewClient(IClientAPI client) 102 public void NewClient(IClientAPI client)
103 { 103 {
104 client.OnChatFromViewer += SimChat; 104 client.OnChatFromViewer += SimChat;
105 } 105 }
106 106
107 public void PingRun() 107 public void PingRun()
108 { 108 {
109 while (true) 109 while (true)
110 { 110 {
111 m_ircWriter.WriteLine("PING :" + m_server); 111 m_ircWriter.WriteLine("PING :" + m_server);
112 m_ircWriter.Flush(); 112 m_ircWriter.Flush();
113 Thread.Sleep(15000); 113 Thread.Sleep(15000);
114 } 114 }
115 } 115 }
116 116
117 public void ListenerRun() 117 public void ListenerRun()
118 { 118 {
119 string inputLine; 119 string inputLine;
120 LLVector3 pos = new LLVector3(128, 128, 20); 120 LLVector3 pos = new LLVector3(128, 128, 20);
121 while (true) 121 while (true)
122 { 122 {
123 while ((inputLine = m_ircReader.ReadLine()) != null) 123 while ((inputLine = m_ircReader.ReadLine()) != null)
124 { 124 {
125 Console.WriteLine(inputLine); 125 Console.WriteLine(inputLine);
126 if (inputLine.Contains(m_channel)) 126 if (inputLine.Contains(m_channel))
127 { 127 {
128 string mess = inputLine.Substring(inputLine.IndexOf(m_channel)); 128 string mess = inputLine.Substring(inputLine.IndexOf(m_channel));
129 m_scene.ForEachScenePresence(delegate(ScenePresence presence) 129 m_scene.ForEachScenePresence(delegate(ScenePresence presence)
130 { 130 {
131 presence.ControllingClient.SendChatMessage(Helpers.StringToField(mess), 255, pos, "IRC:", 131 presence.ControllingClient.SendChatMessage(Helpers.StringToField(mess), 255, pos, "IRC:",
132 LLUUID.Zero); 132 LLUUID.Zero);
133 }); 133 });
134 } 134 }
135 } 135 }
136 } 136 }
137 } 137 }
138 138
139 public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID) 139 public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
140 { 140 {
141 ScenePresence avatar = null; 141 ScenePresence avatar = null;
142 avatar = m_scene.RequestAvatar(fromAgentID); 142 avatar = m_scene.RequestAvatar(fromAgentID);
143 if (avatar != null) 143 if (avatar != null)
144 { 144 {
145 fromPos = avatar.AbsolutePosition; 145 fromPos = avatar.AbsolutePosition;
146 fromName = avatar.Firstname + " " + avatar.Lastname; 146 fromName = avatar.Firstname + " " + avatar.Lastname;
147 avatar = null; 147 avatar = null;
148 } 148 }
149 149
150 if (connected) 150 if (connected)
151 { 151 {
152 m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + ">: " + 152 m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + ">: " +
153 Util.FieldToString(message)); 153 Util.FieldToString(message));
154 m_ircWriter.Flush(); 154 m_ircWriter.Flush();
155 } 155 }
156 156
157 if (channel == 0) 157 if (channel == 0)
158 { 158 {
159 m_scene.ForEachScenePresence(delegate(ScenePresence presence) 159 m_scene.ForEachScenePresence(delegate(ScenePresence presence)
160 { 160 {
161 int dis = -1000; 161 int dis = -1000;
162 162
163 //err ??? the following code seems to be request a scenePresence when it already has a ref to it 163 //err ??? the following code seems to be request a scenePresence when it already has a ref to it
164 avatar = m_scene.RequestAvatar(presence.ControllingClient.AgentId); 164 avatar = m_scene.RequestAvatar(presence.ControllingClient.AgentId);
165 if (avatar != null) 165 if (avatar != null)
166 { 166 {
167 dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos); 167 dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos);
168 } 168 }
169 169
170 switch (type) 170 switch (type)
171 { 171 {
172 case 0: // Whisper 172 case 0: // Whisper
173 if ((dis < 10) && (dis > -10)) 173 if ((dis < 10) && (dis > -10))
174 { 174 {
175 //should change so the message is sent through the avatar rather than direct to the ClientView 175 //should change so the message is sent through the avatar rather than direct to the ClientView
176 presence.ControllingClient.SendChatMessage(message, 176 presence.ControllingClient.SendChatMessage(message,
177 type, 177 type,
178 fromPos, 178 fromPos,
179 fromName, 179 fromName,
180 fromAgentID); 180 fromAgentID);
181 } 181 }
182 break; 182 break;
183 case 1: // Say 183 case 1: // Say
184 if ((dis < 30) && (dis > -30)) 184 if ((dis < 30) && (dis > -30))
185 { 185 {
186 //Console.WriteLine("sending chat"); 186 //Console.WriteLine("sending chat");
187 presence.ControllingClient.SendChatMessage(message, 187 presence.ControllingClient.SendChatMessage(message,
188 type, 188 type,
189 fromPos, 189 fromPos,
190 fromName, 190 fromName,
191 fromAgentID); 191 fromAgentID);
192 } 192 }
193 break; 193 break;
194 case 2: // Shout 194 case 2: // Shout
195 if ((dis < 100) && (dis > -100)) 195 if ((dis < 100) && (dis > -100))
196 { 196 {
197 presence.ControllingClient.SendChatMessage(message, 197 presence.ControllingClient.SendChatMessage(message,
198 type, 198 type,
199 fromPos, 199 fromPos,
200 fromName, 200 fromName,
201 fromAgentID); 201 fromAgentID);
202 } 202 }
203 break; 203 break;
204 204
205 case 0xff: // Broadcast 205 case 0xff: // Broadcast
206 presence.ControllingClient.SendChatMessage(message, type, 206 presence.ControllingClient.SendChatMessage(message, type,
207 fromPos, 207 fromPos,
208 fromName, 208 fromName,
209 fromAgentID); 209 fromAgentID);
210 break; 210 break;
211 } 211 }
212 }); 212 });
213 } 213 }
214 } 214 }
215 } 215 }
216} 216}
diff --git a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs
index 8223919..bbd9810 100644
--- a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs
+++ b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs
@@ -1,159 +1,159 @@
1using System.Text; 1using System.Text;
2using System.Net; 2using System.Net;
3using System.Net.Sockets; 3using System.Net.Sockets;
4using System.Threading; 4using System.Threading;
5using System.IO; 5using System.IO;
6using System.Collections.Generic; 6using System.Collections.Generic;
7using libsecondlife; 7using libsecondlife;
8using OpenSim.Region.Environment.Scenes; 8using OpenSim.Region.Environment.Scenes;
9using OpenSim.Region.Environment.Interfaces; 9using OpenSim.Region.Environment.Interfaces;
10using OpenSim.Framework.Interfaces; 10using OpenSim.Framework.Interfaces;
11using OpenSim.Framework.Utilities; 11using OpenSim.Framework.Utilities;
12using OpenSim.Framework.Console; 12using OpenSim.Framework.Console;
13using OpenSim.Framework.Types; 13using OpenSim.Framework.Types;
14 14
15namespace OpenSim.Region.Environment.Modules 15namespace OpenSim.Region.Environment.Modules
16{ 16{
17 public class DynamicTextureModule :IRegionModule, IDynamicTextureManager 17 public class DynamicTextureModule :IRegionModule, IDynamicTextureManager
18 { 18 {
19 private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>(); 19 private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
20 private Dictionary<string, IDynamicTextureRender> RenderPlugins= new Dictionary<string, IDynamicTextureRender>(); 20 private Dictionary<string, IDynamicTextureRender> RenderPlugins= new Dictionary<string, IDynamicTextureRender>();
21 private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>(); 21 private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>();
22 22
23 public void Initialise(Scene scene) 23 public void Initialise(Scene scene)
24 { 24 {
25 if (!RegisteredScenes.ContainsKey(scene.RegionInfo.SimUUID)) 25 if (!RegisteredScenes.ContainsKey(scene.RegionInfo.SimUUID))
26 { 26 {
27 RegisteredScenes.Add(scene.RegionInfo.SimUUID, scene); 27 RegisteredScenes.Add(scene.RegionInfo.SimUUID, scene);
28 scene.RegisterModuleInterface<IDynamicTextureManager>(this); 28 scene.RegisterModuleInterface<IDynamicTextureManager>(this);
29 } 29 }
30 } 30 }
31 31
32 public void PostInitialise() 32 public void PostInitialise()
33 { 33 {
34 34
35 } 35 }
36 36
37 public void CloseDown() 37 public void CloseDown()
38 { 38 {
39 } 39 }
40 40
41 public string GetName() 41 public string GetName()
42 { 42 {
43 return "DynamicTextureModule"; 43 return "DynamicTextureModule";
44 } 44 }
45 45
46 public bool IsSharedModule() 46 public bool IsSharedModule()
47 { 47 {
48 return true; 48 return true;
49 } 49 }
50 50
51 public void RegisterRender(string handleType, IDynamicTextureRender render) 51 public void RegisterRender(string handleType, IDynamicTextureRender render)
52 { 52 {
53 if (!RenderPlugins.ContainsKey(handleType)) 53 if (!RenderPlugins.ContainsKey(handleType))
54 { 54 {
55 RenderPlugins.Add(handleType, render); 55 RenderPlugins.Add(handleType, render);
56 } 56 }
57 } 57 }
58 58
59 public void ReturnData(LLUUID id, byte[] data) 59 public void ReturnData(LLUUID id, byte[] data)
60 { 60 {
61 if (Updaters.ContainsKey(id)) 61 if (Updaters.ContainsKey(id))
62 { 62 {
63 DynamicTextureUpdater updater = Updaters[id]; 63 DynamicTextureUpdater updater = Updaters[id];
64 if (RegisteredScenes.ContainsKey(updater.SimUUID)) 64 if (RegisteredScenes.ContainsKey(updater.SimUUID))
65 { 65 {
66 Scene scene = RegisteredScenes[updater.SimUUID]; 66 Scene scene = RegisteredScenes[updater.SimUUID];
67 updater.DataReceived(data, scene); 67 updater.DataReceived(data, scene);
68 } 68 }
69 } 69 }
70 } 70 }
71 71
72 public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams, int updateTimer) 72 public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams, int updateTimer)
73 { 73 {
74 System.Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType); 74 System.Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType);
75 if (this.RenderPlugins.ContainsKey(contentType)) 75 if (this.RenderPlugins.ContainsKey(contentType))
76 { 76 {
77 DynamicTextureUpdater updater = new DynamicTextureUpdater(); 77 DynamicTextureUpdater updater = new DynamicTextureUpdater();
78 updater.SimUUID = simID; 78 updater.SimUUID = simID;
79 updater.PrimID = primID; 79 updater.PrimID = primID;
80 updater.ContentType = contentType; 80 updater.ContentType = contentType;
81 updater.Url = url; 81 updater.Url = url;
82 updater.UpdateTimer = updateTimer; 82 updater.UpdateTimer = updateTimer;
83 updater.UpdaterID = LLUUID.Random(); 83 updater.UpdaterID = LLUUID.Random();
84 updater.Params = extraParams; 84 updater.Params = extraParams;
85 85
86 if (!this.Updaters.ContainsKey(updater.UpdaterID)) 86 if (!this.Updaters.ContainsKey(updater.UpdaterID))
87 { 87 {
88 Updaters.Add(updater.UpdaterID, updater); 88 Updaters.Add(updater.UpdaterID, updater);
89 } 89 }
90 90
91 RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams); 91 RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams);
92 return updater.UpdaterID; 92 return updater.UpdaterID;
93 } 93 }
94 return LLUUID.Zero; 94 return LLUUID.Zero;
95 } 95 }
96 96
97 public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, string extraParams, int updateTimer) 97 public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, string extraParams, int updateTimer)
98 { 98 {
99 if (this.RenderPlugins.ContainsKey(contentType)) 99 if (this.RenderPlugins.ContainsKey(contentType))
100 { 100 {
101 DynamicTextureUpdater updater = new DynamicTextureUpdater(); 101 DynamicTextureUpdater updater = new DynamicTextureUpdater();
102 updater.SimUUID = simID; 102 updater.SimUUID = simID;
103 updater.PrimID = primID; 103 updater.PrimID = primID;
104 updater.ContentType = contentType; 104 updater.ContentType = contentType;
105 updater.BodyData = data; 105 updater.BodyData = data;
106 updater.UpdateTimer = updateTimer; 106 updater.UpdateTimer = updateTimer;
107 updater.UpdaterID = LLUUID.Random(); 107 updater.UpdaterID = LLUUID.Random();
108 updater.Params = extraParams; 108 updater.Params = extraParams;
109 109
110 if (!this.Updaters.ContainsKey(updater.UpdaterID)) 110 if (!this.Updaters.ContainsKey(updater.UpdaterID))
111 { 111 {
112 Updaters.Add(updater.UpdaterID, updater); 112 Updaters.Add(updater.UpdaterID, updater);
113 } 113 }
114 114
115 RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams); 115 RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams);
116 return updater.UpdaterID; 116 return updater.UpdaterID;
117 } 117 }
118 return LLUUID.Zero; 118 return LLUUID.Zero;
119 } 119 }
120 120
121 public class DynamicTextureUpdater 121 public class DynamicTextureUpdater
122 { 122 {
123 public LLUUID SimUUID; 123 public LLUUID SimUUID;
124 public LLUUID UpdaterID; 124 public LLUUID UpdaterID;
125 public string ContentType; 125 public string ContentType;
126 public string Url; 126 public string Url;
127 public string BodyData; 127 public string BodyData;
128 public LLUUID PrimID; 128 public LLUUID PrimID;
129 public int UpdateTimer; 129 public int UpdateTimer;
130 public LLUUID LastAssetID; 130 public LLUUID LastAssetID;
131 public string Params; 131 public string Params;
132 132
133 public DynamicTextureUpdater() 133 public DynamicTextureUpdater()
134 { 134 {
135 LastAssetID = LLUUID.Zero; 135 LastAssetID = LLUUID.Zero;
136 UpdateTimer = 0; 136 UpdateTimer = 0;
137 BodyData = null; 137 BodyData = null;
138 } 138 }
139 139
140 public void DataReceived(byte[] data, Scene scene) 140 public void DataReceived(byte[] data, Scene scene)
141 { 141 {
142 //TODO delete the last asset(data), if it was a dynamic texture 142 //TODO delete the last asset(data), if it was a dynamic texture
143 143
144 AssetBase asset = new AssetBase(); 144 AssetBase asset = new AssetBase();
145 asset.FullID = LLUUID.Random(); 145 asset.FullID = LLUUID.Random();
146 asset.Data = data; 146 asset.Data = data;
147 asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); 147 asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000);
148 asset.Type = 0; 148 asset.Type = 0;
149 scene.commsManager.AssetCache.AddAsset(asset); 149 scene.commsManager.AssetCache.AddAsset(asset);
150 150
151 this.LastAssetID = asset.FullID; 151 this.LastAssetID = asset.FullID;
152 152
153 SceneObjectPart part = scene.GetSceneObjectPart(PrimID); 153 SceneObjectPart part = scene.GetSceneObjectPart(PrimID);
154 part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes(); 154 part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes();
155 part.ScheduleFullUpdate(); 155 part.ScheduleFullUpdate();
156 } 156 }
157 } 157 }
158 } 158 }
159} 159}
diff --git a/OpenSim/Region/Environment/Modules/EmailModule.cs b/OpenSim/Region/Environment/Modules/EmailModule.cs
index 2a90dd3..fff9539 100644
--- a/OpenSim/Region/Environment/Modules/EmailModule.cs
+++ b/OpenSim/Region/Environment/Modules/EmailModule.cs
@@ -1,10 +1,10 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5namespace OpenSim.Region.Environment.Modules 5namespace OpenSim.Region.Environment.Modules
6{ 6{
7 class EmailModule 7 class EmailModule
8 { 8 {
9 } 9 }
10} 10}
diff --git a/OpenSim/Region/Environment/Modules/FriendsModule.cs b/OpenSim/Region/Environment/Modules/FriendsModule.cs
index d46039c..411b838 100644
--- a/OpenSim/Region/Environment/Modules/FriendsModule.cs
+++ b/OpenSim/Region/Environment/Modules/FriendsModule.cs
@@ -1,40 +1,40 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using libsecondlife; 4using libsecondlife;
5using OpenSim.Framework.Interfaces; 5using OpenSim.Framework.Interfaces;
6using OpenSim.Region.Environment.Scenes; 6using OpenSim.Region.Environment.Scenes;
7using OpenSim.Region.Environment.Interfaces; 7using OpenSim.Region.Environment.Interfaces;
8 8
9 9
10namespace OpenSim.Region.Environment.Modules 10namespace OpenSim.Region.Environment.Modules
11{ 11{
12 public class FriendsModule : IRegionModule 12 public class FriendsModule : IRegionModule
13 { 13 {
14 private Scene m_scene; 14 private Scene m_scene;
15 15
16 public void Initialise(Scene scene) 16 public void Initialise(Scene scene)
17 { 17 {
18 m_scene = scene; 18 m_scene = scene;
19 } 19 }
20 20
21 public void PostInitialise() 21 public void PostInitialise()
22 { 22 {
23 23
24 } 24 }
25 25
26 public void CloseDown() 26 public void CloseDown()
27 { 27 {
28 } 28 }
29 29
30 public string GetName() 30 public string GetName()
31 { 31 {
32 return "FriendsModule"; 32 return "FriendsModule";
33 } 33 }
34 34
35 public bool IsSharedModule() 35 public bool IsSharedModule()
36 { 36 {
37 return false; 37 return false;
38 } 38 }
39 } 39 }
40} 40}
diff --git a/OpenSim/Region/Environment/Modules/GroupsModule.cs b/OpenSim/Region/Environment/Modules/GroupsModule.cs
index 8e4b409..9ed0e96 100644
--- a/OpenSim/Region/Environment/Modules/GroupsModule.cs
+++ b/OpenSim/Region/Environment/Modules/GroupsModule.cs
@@ -1,40 +1,40 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using libsecondlife; 4using libsecondlife;
5using OpenSim.Framework.Interfaces; 5using OpenSim.Framework.Interfaces;
6using OpenSim.Region.Environment.Scenes; 6using OpenSim.Region.Environment.Scenes;
7using OpenSim.Region.Environment.Interfaces; 7using OpenSim.Region.Environment.Interfaces;
8 8
9namespace OpenSim.Region.Environment.Modules 9namespace OpenSim.Region.Environment.Modules
10{ 10{
11 public class GroupsModule : IRegionModule 11 public class GroupsModule : IRegionModule
12 { 12 {
13 private Scene m_scene; 13 private Scene m_scene;
14 14
15 public void Initialise(Scene scene) 15 public void Initialise(Scene scene)
16 { 16 {
17 m_scene = scene; 17 m_scene = scene;
18 } 18 }
19 19
20 public void PostInitialise() 20 public void PostInitialise()
21 { 21 {
22 22
23 } 23 }
24 24
25 public void CloseDown() 25 public void CloseDown()
26 { 26 {
27 } 27 }
28 28
29 public string GetName() 29 public string GetName()
30 { 30 {
31 return "GroupsModule"; 31 return "GroupsModule";
32 } 32 }
33 33
34 public bool IsSharedModule() 34 public bool IsSharedModule()
35 { 35 {
36 return false; 36 return false;
37 } 37 }
38 } 38 }
39} 39}
40 40
diff --git a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
index acf031b..25c118a 100644
--- a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
+++ b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
@@ -1,40 +1,40 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using libsecondlife; 4using libsecondlife;
5using OpenSim.Framework.Interfaces; 5using OpenSim.Framework.Interfaces;
6using OpenSim.Region.Environment.Scenes; 6using OpenSim.Region.Environment.Scenes;
7using OpenSim.Region.Environment.Interfaces; 7using OpenSim.Region.Environment.Interfaces;
8 8
9 9
10namespace OpenSim.Region.Environment.Modules 10namespace OpenSim.Region.Environment.Modules
11{ 11{
12 public class InstantMessageModule :IRegionModule 12 public class InstantMessageModule :IRegionModule
13 { 13 {
14 private Scene m_scene; 14 private Scene m_scene;
15 15
16 public void Initialise(Scene scene) 16 public void Initialise(Scene scene)
17 { 17 {
18 m_scene = scene; 18 m_scene = scene;
19 } 19 }
20 20
21 public void PostInitialise() 21 public void PostInitialise()
22 { 22 {
23 23
24 } 24 }
25 25
26 public void CloseDown() 26 public void CloseDown()
27 { 27 {
28 } 28 }
29 29
30 public string GetName() 30 public string GetName()
31 { 31 {
32 return "InstantMessageModule"; 32 return "InstantMessageModule";
33 } 33 }
34 34
35 public bool IsSharedModule() 35 public bool IsSharedModule()
36 { 36 {
37 return false; 37 return false;
38 } 38 }
39 } 39 }
40} 40}
diff --git a/OpenSim/Region/Environment/Modules/InventoryModule.cs b/OpenSim/Region/Environment/Modules/InventoryModule.cs
index 00b4d8e..bfcb7d7 100644
--- a/OpenSim/Region/Environment/Modules/InventoryModule.cs
+++ b/OpenSim/Region/Environment/Modules/InventoryModule.cs
@@ -1,40 +1,40 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using libsecondlife; 4using libsecondlife;
5using OpenSim.Framework.Interfaces; 5using OpenSim.Framework.Interfaces;
6using OpenSim.Region.Environment.Scenes; 6using OpenSim.Region.Environment.Scenes;
7using OpenSim.Region.Environment.Interfaces; 7using OpenSim.Region.Environment.Interfaces;
8 8
9 9
10namespace OpenSim.Region.Environment.Modules 10namespace OpenSim.Region.Environment.Modules
11{ 11{
12 public class InventoryModule :IRegionModule 12 public class InventoryModule :IRegionModule
13 { 13 {
14 private Scene m_scene; 14 private Scene m_scene;
15 15
16 public void Initialise(Scene scene) 16 public void Initialise(Scene scene)
17 { 17 {
18 m_scene = scene; 18 m_scene = scene;
19 } 19 }
20 20
21 public void PostInitialise() 21 public void PostInitialise()
22 { 22 {
23 23
24 } 24 }
25 25
26 public void CloseDown() 26 public void CloseDown()
27 { 27 {
28 } 28 }
29 29
30 public string GetName() 30 public string GetName()
31 { 31 {
32 return "InventoryModule"; 32 return "InventoryModule";
33 } 33 }
34 34
35 public bool IsSharedModule() 35 public bool IsSharedModule()
36 { 36 {
37 return false; 37 return false;
38 } 38 }
39 } 39 }
40} 40}
diff --git a/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs b/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs
index 11af718..e47cc9e 100644
--- a/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs
@@ -1,10 +1,10 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5namespace OpenSim.Region.Environment.Modules 5namespace OpenSim.Region.Environment.Modules
6{ 6{
7 class ScriptsHttpRequests 7 class ScriptsHttpRequests
8 { 8 {
9 } 9 }
10} 10}
diff --git a/OpenSim/Region/Environment/Modules/TeleportModule.cs b/OpenSim/Region/Environment/Modules/TeleportModule.cs
index 08fc202..1c01b27 100644
--- a/OpenSim/Region/Environment/Modules/TeleportModule.cs
+++ b/OpenSim/Region/Environment/Modules/TeleportModule.cs
@@ -1,10 +1,10 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5namespace OpenSim.Region.Environment.Modules 5namespace OpenSim.Region.Environment.Modules
6{ 6{
7 class TeleportModule 7 class TeleportModule
8 { 8 {
9 } 9 }
10} 10}
diff --git a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
index 7d31644..59c0839 100644
--- a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
+++ b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
@@ -1,54 +1,54 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using libsecondlife; 4using libsecondlife;
5using OpenSim.Framework.Interfaces; 5using OpenSim.Framework.Interfaces;
6using OpenSim.Region.Environment.Scenes; 6using OpenSim.Region.Environment.Scenes;
7using OpenSim.Region.Environment.Interfaces; 7using OpenSim.Region.Environment.Interfaces;
8 8
9namespace OpenSim.Region.Environment.Modules 9namespace OpenSim.Region.Environment.Modules
10{ 10{
11 public class TextureDownloadModule :IRegionModule 11 public class TextureDownloadModule :IRegionModule
12 { 12 {
13 private Scene m_scene; 13 private Scene m_scene;
14 14
15 public TextureDownloadModule() 15 public TextureDownloadModule()
16 { 16 {
17 17
18 } 18 }
19 19
20 public void Initialise(Scene scene) 20 public void Initialise(Scene scene)
21 { 21 {
22 m_scene = scene; 22 m_scene = scene;
23 m_scene.EventManager.OnNewClient += NewClient; 23 m_scene.EventManager.OnNewClient += NewClient;
24 } 24 }
25 25
26 public void PostInitialise() 26 public void PostInitialise()
27 { 27 {
28 28
29 } 29 }
30 30
31 public void CloseDown() 31 public void CloseDown()
32 { 32 {
33 } 33 }
34 34
35 public string GetName() 35 public string GetName()
36 { 36 {
37 return "TextureDownloadModule"; 37 return "TextureDownloadModule";
38 } 38 }
39 39
40 public bool IsSharedModule() 40 public bool IsSharedModule()
41 { 41 {
42 return false; 42 return false;
43 } 43 }
44 44
45 public void NewClient(IClientAPI client) 45 public void NewClient(IClientAPI client)
46 { 46 {
47 } 47 }
48 48
49 public void TextureAssetCallback(LLUUID texture, byte[] data) 49 public void TextureAssetCallback(LLUUID texture, byte[] data)
50 { 50 {
51 51
52 } 52 }
53 } 53 }
54} 54}
diff --git a/OpenSim/Region/Environment/Modules/XferModule.cs b/OpenSim/Region/Environment/Modules/XferModule.cs
index 44b4d7a..216d10a 100644
--- a/OpenSim/Region/Environment/Modules/XferModule.cs
+++ b/OpenSim/Region/Environment/Modules/XferModule.cs
@@ -1,180 +1,180 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5using libsecondlife; 5using libsecondlife;
6using OpenSim.Framework.Interfaces; 6using OpenSim.Framework.Interfaces;
7using OpenSim.Framework.Utilities; 7using OpenSim.Framework.Utilities;
8using OpenSim.Region.Environment.Scenes; 8using OpenSim.Region.Environment.Scenes;
9using OpenSim.Region.Environment.Interfaces; 9using OpenSim.Region.Environment.Interfaces;
10 10
11namespace OpenSim.Region.Environment.Modules 11namespace OpenSim.Region.Environment.Modules
12{ 12{
13 public class XferModule : IRegionModule, IXfer 13 public class XferModule : IRegionModule, IXfer
14 { 14 {
15 public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>(); 15 public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>();
16 public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>(); 16 public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>();
17 17
18 private Scene m_scene; 18 private Scene m_scene;
19 19
20 public XferModule() 20 public XferModule()
21 { 21 {
22 22
23 } 23 }
24 24
25 public void Initialise(Scene scene) 25 public void Initialise(Scene scene)
26 { 26 {
27 m_scene = scene; 27 m_scene = scene;
28 m_scene.EventManager.OnNewClient += NewClient; 28 m_scene.EventManager.OnNewClient += NewClient;
29 29
30 m_scene.RegisterModuleInterface<IXfer>(this); 30 m_scene.RegisterModuleInterface<IXfer>(this);
31 } 31 }
32 32
33 public void PostInitialise() 33 public void PostInitialise()
34 { 34 {
35 35
36 } 36 }
37 37
38 public void CloseDown() 38 public void CloseDown()
39 { 39 {
40 40
41 } 41 }
42 42
43 public string GetName() 43 public string GetName()
44 { 44 {
45 return "XferModule"; 45 return "XferModule";
46 } 46 }
47 47
48 public bool IsSharedModule() 48 public bool IsSharedModule()
49 { 49 {
50 return false; 50 return false;
51 } 51 }
52 52
53 public void NewClient(IClientAPI client) 53 public void NewClient(IClientAPI client)
54 { 54 {
55 client.OnRequestXfer += RequestXfer; 55 client.OnRequestXfer += RequestXfer;
56 client.OnConfirmXfer += AckPacket; 56 client.OnConfirmXfer += AckPacket;
57 } 57 }
58 58
59 /// <summary> 59 /// <summary>
60 /// 60 ///
61 /// </summary> 61 /// </summary>
62 /// <param name="remoteClient"></param> 62 /// <param name="remoteClient"></param>
63 /// <param name="xferID"></param> 63 /// <param name="xferID"></param>
64 /// <param name="fileName"></param> 64 /// <param name="fileName"></param>
65 public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName) 65 public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName)
66 { 66 {
67 lock (NewFiles) 67 lock (NewFiles)
68 { 68 {
69 if (NewFiles.ContainsKey(fileName)) 69 if (NewFiles.ContainsKey(fileName))
70 { 70 {
71 if (!Transfers.ContainsKey(xferID)) 71 if (!Transfers.ContainsKey(xferID))
72 { 72 {
73 byte[] fileData = NewFiles[fileName]; 73 byte[] fileData = NewFiles[fileName];
74 XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient); 74 XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient);
75 Transfers.Add(xferID, transaction); 75 Transfers.Add(xferID, transaction);
76 NewFiles.Remove(fileName); 76 NewFiles.Remove(fileName);
77 transaction.StartSend(); 77 transaction.StartSend();
78 } 78 }
79 } 79 }
80 } 80 }
81 } 81 }
82 82
83 public void AckPacket(IClientAPI remoteClient, ulong xferID, uint packet) 83 public void AckPacket(IClientAPI remoteClient, ulong xferID, uint packet)
84 { 84 {
85 if (this.Transfers.ContainsKey(xferID)) 85 if (this.Transfers.ContainsKey(xferID))
86 { 86 {
87 Transfers[xferID].AckPacket(packet); 87 Transfers[xferID].AckPacket(packet);
88 } 88 }
89 } 89 }
90 90
91 public bool AddNewFile(string fileName, byte[] data) 91 public bool AddNewFile(string fileName, byte[] data)
92 { 92 {
93 lock (NewFiles) 93 lock (NewFiles)
94 { 94 {
95 if (NewFiles.ContainsKey(fileName)) 95 if (NewFiles.ContainsKey(fileName))
96 { 96 {
97 NewFiles[fileName] = data; 97 NewFiles[fileName] = data;
98 } 98 }
99 else 99 else
100 { 100 {
101 NewFiles.Add(fileName, data); 101 NewFiles.Add(fileName, data);
102 } 102 }
103 } 103 }
104 return true; 104 return true;
105 } 105 }
106 106
107 107
108 public class XferDownLoad 108 public class XferDownLoad
109 { 109 {
110 public byte[] Data = new byte[0]; 110 public byte[] Data = new byte[0];
111 public string FileName = ""; 111 public string FileName = "";
112 public ulong XferID = 0; 112 public ulong XferID = 0;
113 public int DataPointer = 0; 113 public int DataPointer = 0;
114 public uint Packet = 0; 114 public uint Packet = 0;
115 public IClientAPI Client; 115 public IClientAPI Client;
116 public uint Serial = 1; 116 public uint Serial = 1;
117 private bool complete = false; 117 private bool complete = false;
118 118
119 public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client) 119 public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client)
120 { 120 {
121 FileName = fileName; 121 FileName = fileName;
122 Data = data; 122 Data = data;
123 XferID = xferID; 123 XferID = xferID;
124 Client = client; 124 Client = client;
125 } 125 }
126 126
127 public XferDownLoad() 127 public XferDownLoad()
128 { 128 {
129 129
130 } 130 }
131 131
132 public void StartSend() 132 public void StartSend()
133 { 133 {
134 if (Data.Length < 1000) 134 if (Data.Length < 1000)
135 { 135 {
136 // for now (testing ) we only support files under 1000 bytes 136 // for now (testing ) we only support files under 1000 bytes
137 byte[] transferData = new byte[Data.Length + 4]; 137 byte[] transferData = new byte[Data.Length + 4];
138 Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4); 138 Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4);
139 Array.Copy(Data, 0, transferData, 4, Data.Length); 139 Array.Copy(Data, 0, transferData, 4, Data.Length);
140 Client.SendXferPacket(XferID, 0 + 0x80000000, transferData); 140 Client.SendXferPacket(XferID, 0 + 0x80000000, transferData);
141 complete = true; 141 complete = true;
142 } 142 }
143 else 143 else
144 { 144 {
145 byte[] transferData = new byte[1000 +4]; 145 byte[] transferData = new byte[1000 +4];
146 Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4); 146 Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4);
147 Array.Copy(Data, 0, transferData, 4, 1000); 147 Array.Copy(Data, 0, transferData, 4, 1000);
148 Client.SendXferPacket(XferID, 0 , transferData); 148 Client.SendXferPacket(XferID, 0 , transferData);
149 Packet++; 149 Packet++;
150 DataPointer = 1000; 150 DataPointer = 1000;
151 } 151 }
152 } 152 }
153 153
154 public void AckPacket(uint packet) 154 public void AckPacket(uint packet)
155 { 155 {
156 if (!complete) 156 if (!complete)
157 { 157 {
158 if ((Data.Length - DataPointer) > 1000) 158 if ((Data.Length - DataPointer) > 1000)
159 { 159 {
160 byte[] transferData = new byte[1000]; 160 byte[] transferData = new byte[1000];
161 Array.Copy(Data, DataPointer, transferData, 0, 1000); 161 Array.Copy(Data, DataPointer, transferData, 0, 1000);
162 Client.SendXferPacket(XferID, Packet, transferData); 162 Client.SendXferPacket(XferID, Packet, transferData);
163 Packet++; 163 Packet++;
164 DataPointer += 1000; 164 DataPointer += 1000;
165 } 165 }
166 else 166 else
167 { 167 {
168 byte[] transferData = new byte[Data.Length - DataPointer]; 168 byte[] transferData = new byte[Data.Length - DataPointer];
169 Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer); 169 Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer);
170 uint endPacket = Packet |= (uint)0x80000000; 170 uint endPacket = Packet |= (uint)0x80000000;
171 Client.SendXferPacket(XferID, endPacket, transferData); 171 Client.SendXferPacket(XferID, endPacket, transferData);
172 Packet++; 172 Packet++;
173 DataPointer += (Data.Length - DataPointer); 173 DataPointer += (Data.Length - DataPointer);
174 complete = true; 174 complete = true;
175 } 175 }
176 } 176 }
177 } 177 }
178 } 178 }
179 } 179 }
180} 180}