aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules
diff options
context:
space:
mode:
authorMW2007-09-04 13:43:56 +0000
committerMW2007-09-04 13:43:56 +0000
commitbfd36e2e836f92539e68bba077104d5016c5bf8b (patch)
tree36491a61df9cb936500cf349fa7a1ac377b2f350 /OpenSim/Region/Environment/Modules
parentreverting opensim.ini to proper default state (diff)
downloadopensim-SC-bfd36e2e836f92539e68bba077104d5016c5bf8b.zip
opensim-SC-bfd36e2e836f92539e68bba077104d5016c5bf8b.tar.gz
opensim-SC-bfd36e2e836f92539e68bba077104d5016c5bf8b.tar.bz2
opensim-SC-bfd36e2e836f92539e68bba077104d5016c5bf8b.tar.xz
Some work on Module loading/management.
Some more modules templates classes (hoping that someone will pick some of these and work on implementing them). Early version of the "Dynamic Texture Module", although currently there are no render modules included (so not really functional without them). Added osSetDynamicTextureURL script function, for attaching a dynamic texture to a prim. Some work on the console command handling. Added "change-region <regionname>" and "exit-region" so that after the use of change-region, the commands entered will apply to that region only. Then use exit-region to return to the top level (so commands then function as they did before and either apply to all regions or to the first region) (Note: this hasn't been tested very much)
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Modules/AssetDownloadModule.cs5
-rw-r--r--OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs10
-rw-r--r--OpenSim/Region/Environment/Modules/ChatModule.cs11
-rw-r--r--OpenSim/Region/Environment/Modules/DynamicTextureModule.cs136
-rw-r--r--OpenSim/Region/Environment/Modules/EmailModule.cs10
-rw-r--r--OpenSim/Region/Environment/Modules/FriendsModule.cs5
-rw-r--r--OpenSim/Region/Environment/Modules/GroupsModule.cs5
-rw-r--r--OpenSim/Region/Environment/Modules/InstantMessageModule.cs5
-rw-r--r--OpenSim/Region/Environment/Modules/InventoryModule.cs5
-rw-r--r--OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs10
-rw-r--r--OpenSim/Region/Environment/Modules/TeleportModule.cs10
-rw-r--r--OpenSim/Region/Environment/Modules/TextureDownloadModule.cs5
-rw-r--r--OpenSim/Region/Environment/Modules/XferModule.cs5
13 files changed, 220 insertions, 2 deletions
diff --git a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
index 5d7e6a6..21a7e61 100644
--- a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
+++ b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
@@ -38,6 +38,11 @@ namespace OpenSim.Region.Environment.Modules
38 return "AssetDownloadModule"; 38 return "AssetDownloadModule";
39 } 39 }
40 40
41 public bool IsSharedModule()
42 {
43 return false;
44 }
45
41 public void NewClient(IClientAPI client) 46 public void NewClient(IClientAPI client)
42 { 47 {
43 } 48 }
diff --git a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs
index 1427c58..1ad061a 100644
--- a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs
+++ b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs
@@ -39,11 +39,21 @@ namespace OpenSim.Region.Environment.Modules
39 return "AvatarProfilesModule"; 39 return "AvatarProfilesModule";
40 } 40 }
41 41
42 public bool IsSharedModule()
43 {
44 return false;
45 }
46
42 public void NewClient(IClientAPI client) 47 public void NewClient(IClientAPI client)
43 { 48 {
44 client.OnRequestAvatarProperties += RequestAvatarProperty; 49 client.OnRequestAvatarProperties += RequestAvatarProperty;
45 } 50 }
46 51
52 public void RemoveClient(IClientAPI client)
53 {
54 client.OnRequestAvatarProperties -= RequestAvatarProperty;
55 }
56
47 /// <summary> 57 /// <summary>
48 /// 58 ///
49 /// </summary> 59 /// </summary>
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs
index 752cde4..ac91b78 100644
--- a/OpenSim/Region/Environment/Modules/ChatModule.cs
+++ b/OpenSim/Region/Environment/Modules/ChatModule.cs
@@ -14,7 +14,7 @@ using OpenSim.Framework.Console;
14 14
15namespace OpenSim.Region.Environment.Modules 15namespace OpenSim.Region.Environment.Modules
16{ 16{
17 public class ChatModule : IRegionModule 17 public class ChatModule : IRegionModule, ISimChat
18 { 18 {
19 private Scene m_scene; 19 private Scene m_scene;
20 20
@@ -45,11 +45,12 @@ namespace OpenSim.Region.Environment.Modules
45 m_scene = scene; 45 m_scene = scene;
46 m_scene.EventManager.OnNewClient += NewClient; 46 m_scene.EventManager.OnNewClient += NewClient;
47 47
48 //should register a optional API Method, so other modules can send chat messages using this module 48 m_scene.RegisterModuleInterface<ISimChat>(this);
49 } 49 }
50 50
51 public void PostInitialise() 51 public void PostInitialise()
52 { 52 {
53 /*
53 try 54 try
54 { 55 {
55 m_irc = new TcpClient(m_server, m_port); 56 m_irc = new TcpClient(m_server, m_port);
@@ -75,6 +76,7 @@ namespace OpenSim.Region.Environment.Modules
75 { 76 {
76 Console.WriteLine(e.ToString()); 77 Console.WriteLine(e.ToString());
77 } 78 }
79 */
78 } 80 }
79 81
80 public void CloseDown() 82 public void CloseDown()
@@ -89,6 +91,11 @@ namespace OpenSim.Region.Environment.Modules
89 return "ChatModule"; 91 return "ChatModule";
90 } 92 }
91 93
94 public bool IsSharedModule()
95 {
96 return false;
97 }
98
92 public void NewClient(IClientAPI client) 99 public void NewClient(IClientAPI client)
93 { 100 {
94 client.OnChatFromViewer += SimChat; 101 client.OnChatFromViewer += SimChat;
diff --git a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs
new file mode 100644
index 0000000..6edebe7
--- /dev/null
+++ b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs
@@ -0,0 +1,136 @@
1using System.Text;
2using System.Net;
3using System.Net.Sockets;
4using System.Threading;
5using System.IO;
6using System.Collections.Generic;
7using libsecondlife;
8using OpenJPEGNet;
9using OpenSim.Region.Environment.Scenes;
10using OpenSim.Region.Environment.Interfaces;
11using OpenSim.Framework.Interfaces;
12using OpenSim.Framework.Utilities;
13using OpenSim.Framework.Console;
14using OpenSim.Framework.Types;
15
16namespace OpenSim.Region.Environment.Modules
17{
18 public class DynamicTextureModule :IRegionModule, IDynamicTextureManager
19 {
20 private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
21 private Dictionary<string, IDynamicTextureRender> RenderPlugins= new Dictionary<string, IDynamicTextureRender>();
22 private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>();
23
24 public void Initialise(Scene scene)
25 {
26 if (!RegisteredScenes.ContainsKey(scene.RegionInfo.SimUUID))
27 {
28 RegisteredScenes.Add(scene.RegionInfo.SimUUID, scene);
29 scene.RegisterModuleInterface<IDynamicTextureManager>(this);
30 }
31 }
32
33 public void PostInitialise()
34 {
35
36 }
37
38 public void CloseDown()
39 {
40 }
41
42 public string GetName()
43 {
44 return "DynamicTextureModule";
45 }
46
47 public bool IsSharedModule()
48 {
49 return true;
50 }
51
52 public void RegisterRender(string handleType, IDynamicTextureRender render)
53 {
54 if (!RenderPlugins.ContainsKey(handleType))
55 {
56 RenderPlugins.Add(handleType, render);
57 }
58 }
59
60 public void ReturnData(LLUUID id, byte[] data)
61 {
62 if (Updaters.ContainsKey(id))
63 {
64 DynamicTextureUpdater updater = Updaters[id];
65 if (RegisteredScenes.ContainsKey(updater.SimUUID))
66 {
67 Scene scene = RegisteredScenes[updater.SimUUID];
68 updater.DataReceived(data, scene);
69 }
70 }
71 }
72
73 public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams, int updateTimer)
74 {
75 System.Console.WriteLine("dynamic texture being created " + url + " of type " + contentType);
76 if (this.RenderPlugins.ContainsKey(contentType))
77 {
78 DynamicTextureUpdater updater = new DynamicTextureUpdater();
79 updater.SimUUID = simID;
80 updater.PrimID = primID;
81 updater.ContentType = contentType;
82 updater.Url = url;
83 updater.UpdateTimer = updateTimer;
84 updater.UpdaterID = LLUUID.Random();
85 updater.Params = extraParams;
86
87 if (!this.Updaters.ContainsKey(updater.UpdaterID))
88 {
89 Updaters.Add(updater.UpdaterID, updater);
90 }
91
92 RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams);
93 return updater.UpdaterID;
94 }
95 return LLUUID.Zero;
96 }
97
98 public class DynamicTextureUpdater
99 {
100 public LLUUID SimUUID;
101 public LLUUID UpdaterID;
102 public string ContentType;
103 public string Url;
104 public Stream StreamData;
105 public LLUUID PrimID;
106 public int UpdateTimer;
107 public LLUUID LastAssetID;
108 public string Params;
109
110 public DynamicTextureUpdater()
111 {
112 LastAssetID = LLUUID.Zero;
113 UpdateTimer = 0;
114 StreamData = null;
115 }
116
117 public void DataReceived(byte[] data, Scene scene)
118 {
119 //TODO delete the last asset(data), if it was a dynamic texture
120
121 AssetBase asset = new AssetBase();
122 asset.FullID = LLUUID.Random();
123 asset.Data = data;
124 asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000);
125 asset.Type = 0;
126 scene.commsManager.AssetCache.AddAsset(asset);
127
128 this.LastAssetID = asset.FullID;
129
130 SceneObjectPart part = scene.GetSceneObjectPart(PrimID);
131 part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes();
132 part.ScheduleFullUpdate();
133 }
134 }
135 }
136}
diff --git a/OpenSim/Region/Environment/Modules/EmailModule.cs b/OpenSim/Region/Environment/Modules/EmailModule.cs
new file mode 100644
index 0000000..2a90dd3
--- /dev/null
+++ b/OpenSim/Region/Environment/Modules/EmailModule.cs
@@ -0,0 +1,10 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Region.Environment.Modules
6{
7 class EmailModule
8 {
9 }
10}
diff --git a/OpenSim/Region/Environment/Modules/FriendsModule.cs b/OpenSim/Region/Environment/Modules/FriendsModule.cs
index f952bb2..d46039c 100644
--- a/OpenSim/Region/Environment/Modules/FriendsModule.cs
+++ b/OpenSim/Region/Environment/Modules/FriendsModule.cs
@@ -31,5 +31,10 @@ namespace OpenSim.Region.Environment.Modules
31 { 31 {
32 return "FriendsModule"; 32 return "FriendsModule";
33 } 33 }
34
35 public bool IsSharedModule()
36 {
37 return false;
38 }
34 } 39 }
35} 40}
diff --git a/OpenSim/Region/Environment/Modules/GroupsModule.cs b/OpenSim/Region/Environment/Modules/GroupsModule.cs
index 607b395..8e4b409 100644
--- a/OpenSim/Region/Environment/Modules/GroupsModule.cs
+++ b/OpenSim/Region/Environment/Modules/GroupsModule.cs
@@ -30,6 +30,11 @@ namespace OpenSim.Region.Environment.Modules
30 { 30 {
31 return "GroupsModule"; 31 return "GroupsModule";
32 } 32 }
33
34 public bool IsSharedModule()
35 {
36 return false;
37 }
33 } 38 }
34} 39}
35 40
diff --git a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
index 9c09c48..acf031b 100644
--- a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
+++ b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
@@ -31,5 +31,10 @@ namespace OpenSim.Region.Environment.Modules
31 { 31 {
32 return "InstantMessageModule"; 32 return "InstantMessageModule";
33 } 33 }
34
35 public bool IsSharedModule()
36 {
37 return false;
38 }
34 } 39 }
35} 40}
diff --git a/OpenSim/Region/Environment/Modules/InventoryModule.cs b/OpenSim/Region/Environment/Modules/InventoryModule.cs
index 94e7ba7..00b4d8e 100644
--- a/OpenSim/Region/Environment/Modules/InventoryModule.cs
+++ b/OpenSim/Region/Environment/Modules/InventoryModule.cs
@@ -31,5 +31,10 @@ namespace OpenSim.Region.Environment.Modules
31 { 31 {
32 return "InventoryModule"; 32 return "InventoryModule";
33 } 33 }
34
35 public bool IsSharedModule()
36 {
37 return false;
38 }
34 } 39 }
35} 40}
diff --git a/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs b/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs
new file mode 100644
index 0000000..11af718
--- /dev/null
+++ b/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs
@@ -0,0 +1,10 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Region.Environment.Modules
6{
7 class ScriptsHttpRequests
8 {
9 }
10}
diff --git a/OpenSim/Region/Environment/Modules/TeleportModule.cs b/OpenSim/Region/Environment/Modules/TeleportModule.cs
new file mode 100644
index 0000000..08fc202
--- /dev/null
+++ b/OpenSim/Region/Environment/Modules/TeleportModule.cs
@@ -0,0 +1,10 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Region.Environment.Modules
6{
7 class TeleportModule
8 {
9 }
10}
diff --git a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
index a92566d..7d31644 100644
--- a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
+++ b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
@@ -37,6 +37,11 @@ namespace OpenSim.Region.Environment.Modules
37 return "TextureDownloadModule"; 37 return "TextureDownloadModule";
38 } 38 }
39 39
40 public bool IsSharedModule()
41 {
42 return false;
43 }
44
40 public void NewClient(IClientAPI client) 45 public void NewClient(IClientAPI client)
41 { 46 {
42 } 47 }
diff --git a/OpenSim/Region/Environment/Modules/XferModule.cs b/OpenSim/Region/Environment/Modules/XferModule.cs
index a0327e9..eec9f97 100644
--- a/OpenSim/Region/Environment/Modules/XferModule.cs
+++ b/OpenSim/Region/Environment/Modules/XferModule.cs
@@ -45,6 +45,11 @@ namespace OpenSim.Region.Environment.Modules
45 return "XferModule"; 45 return "XferModule";
46 } 46 }
47 47
48 public bool IsSharedModule()
49 {
50 return false;
51 }
52
48 public void NewClient(IClientAPI client) 53 public void NewClient(IClientAPI client)
49 { 54 {
50 client.OnRequestXfer += RequestXfer; 55 client.OnRequestXfer += RequestXfer;