diff options
author | Diva Canto | 2011-05-02 08:48:55 -0700 |
---|---|---|
committer | Diva Canto | 2011-05-02 08:48:55 -0700 |
commit | 10180760b741edf22cec23db0ec490669407425f (patch) | |
tree | 66f52dc38657213e03470aab161a0d2ffa3fffe6 /OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | |
parent | Start to drill down on GetTexture. Read the config and do different things. (diff) | |
download | opensim-SC-10180760b741edf22cec23db0ec490669407425f.zip opensim-SC-10180760b741edf22cec23db0ec490669407425f.tar.gz opensim-SC-10180760b741edf22cec23db0ec490669407425f.tar.bz2 opensim-SC-10180760b741edf22cec23db0ec490669407425f.tar.xz |
Works!
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 21041ec..d697f5e 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | |||
@@ -52,13 +52,15 @@ namespace OpenSim.Region.ClientStack.Linden | |||
52 | { | 52 | { |
53 | 53 | ||
54 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 54 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
55 | public class GetTextureModule : ISharedRegionModule | 55 | public class GetTextureModule : INonSharedRegionModule |
56 | { | 56 | { |
57 | private static readonly ILog m_log = | 57 | private static readonly ILog m_log = |
58 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 58 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
59 | private Scene m_scene; | 59 | private Scene m_scene; |
60 | private IAssetService m_assetService; | 60 | private IAssetService m_assetService; |
61 | 61 | ||
62 | private bool m_Enabled = false; | ||
63 | |||
62 | // TODO: Change this to a config option | 64 | // TODO: Change this to a config option |
63 | const string REDIRECT_URL = null; | 65 | const string REDIRECT_URL = null; |
64 | 66 | ||
@@ -72,11 +74,18 @@ namespace OpenSim.Region.ClientStack.Linden | |||
72 | if (config == null) | 74 | if (config == null) |
73 | return; | 75 | return; |
74 | 76 | ||
75 | m_URL = config.GetString("Cap_GetTexture", "localhost"); | 77 | m_URL = config.GetString("Cap_GetTexture", string.Empty); |
78 | // Cap doesn't exist | ||
79 | if (m_URL != string.Empty) | ||
80 | m_Enabled = true; | ||
76 | } | 81 | } |
77 | 82 | ||
78 | public void AddRegion(Scene s) | 83 | public void AddRegion(Scene s) |
79 | { | 84 | { |
85 | if (!m_Enabled) | ||
86 | return; | ||
87 | |||
88 | m_scene = s; | ||
80 | } | 89 | } |
81 | 90 | ||
82 | public void RemoveRegion(Scene s) | 91 | public void RemoveRegion(Scene s) |
@@ -85,12 +94,15 @@ namespace OpenSim.Region.ClientStack.Linden | |||
85 | 94 | ||
86 | public void RegionLoaded(Scene s) | 95 | public void RegionLoaded(Scene s) |
87 | { | 96 | { |
97 | if (!m_Enabled) | ||
98 | return; | ||
99 | |||
100 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); | ||
101 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | ||
88 | } | 102 | } |
89 | 103 | ||
90 | public void PostInitialise() | 104 | public void PostInitialise() |
91 | { | 105 | { |
92 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); | ||
93 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | ||
94 | } | 106 | } |
95 | 107 | ||
96 | public void Close() { } | 108 | public void Close() { } |
@@ -108,12 +120,17 @@ namespace OpenSim.Region.ClientStack.Linden | |||
108 | { | 120 | { |
109 | UUID capID = UUID.Random(); | 121 | UUID capID = UUID.Random(); |
110 | 122 | ||
111 | // m_log.InfoFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); | ||
112 | //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); | 123 | //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); |
113 | if (m_URL == "localhost") | 124 | if (m_URL == "localhost") |
125 | { | ||
126 | m_log.InfoFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); | ||
114 | caps.RegisterHandler("GetTexture", new GetTextureHandler("/CAPS/" + capID + "/", m_assetService)); | 127 | caps.RegisterHandler("GetTexture", new GetTextureHandler("/CAPS/" + capID + "/", m_assetService)); |
128 | } | ||
115 | else | 129 | else |
130 | { | ||
131 | m_log.InfoFormat("[GETTEXTURE]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); | ||
116 | caps.RegisterHandler("GetTexture", m_URL); | 132 | caps.RegisterHandler("GetTexture", m_URL); |
133 | } | ||
117 | } | 134 | } |
118 | 135 | ||
119 | } | 136 | } |