diff options
author | Justin Clark-Casey (justincc) | 2010-07-01 00:24:30 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-07-26 23:34:17 +0100 |
commit | 701f39c8c256d77669fc88f73deb5217a785d0d6 (patch) | |
tree | e5a1710d6acd36e7b0b6ee1a38b171cb14dfa349 | |
parent | Register ObjectMedia and ObjectMediaNavigate capabilities from moap module. (diff) | |
download | opensim-SC-701f39c8c256d77669fc88f73deb5217a785d0d6.zip opensim-SC-701f39c8c256d77669fc88f73deb5217a785d0d6.tar.gz opensim-SC-701f39c8c256d77669fc88f73deb5217a785d0d6.tar.bz2 opensim-SC-701f39c8c256d77669fc88f73deb5217a785d0d6.tar.xz |
do a whole load of crappy hacking to get cubes to display google.com
currently, for smoe reason the page only appears when you click a face.
also, actually navigating anywhere always snaps you back to the google search box, for some unknown reason
you can still change the url and normal navigation will work again
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs | 95 |
2 files changed, 90 insertions, 7 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 8123f2f..f85cb57 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -362,7 +362,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
362 | string path = request.RawUrl; | 362 | string path = request.RawUrl; |
363 | string handlerKey = GetHandlerKey(request.HttpMethod, path); | 363 | string handlerKey = GetHandlerKey(request.HttpMethod, path); |
364 | 364 | ||
365 | //m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); | 365 | m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); |
366 | 366 | ||
367 | if (TryGetStreamHandler(handlerKey, out requestHandler)) | 367 | if (TryGetStreamHandler(handlerKey, out requestHandler)) |
368 | { | 368 | { |
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs index 68b9b43..b6fa53f 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs | |||
@@ -35,8 +35,10 @@ using log4net; | |||
35 | using Mono.Addins; | 35 | using Mono.Addins; |
36 | using Nini.Config; | 36 | using Nini.Config; |
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
38 | using OpenMetaverse.Messages.Linden; | ||
38 | using OpenMetaverse.StructuredData; | 39 | using OpenMetaverse.StructuredData; |
39 | using OpenSim.Framework; | 40 | using OpenSim.Framework; |
41 | using OpenSim.Framework.Capabilities; | ||
40 | using OpenSim.Framework.Servers; | 42 | using OpenSim.Framework.Servers; |
41 | using OpenSim.Framework.Servers.HttpServer; | 43 | using OpenSim.Framework.Servers.HttpServer; |
42 | using OpenSim.Region.Framework.Interfaces; | 44 | using OpenSim.Region.Framework.Interfaces; |
@@ -77,28 +79,109 @@ namespace OpenSim.Region.CoreModules.Media.Moap | |||
77 | m_log.DebugFormat( | 79 | m_log.DebugFormat( |
78 | "[MOAP]: Registering ObjectMedia and ObjectMediaNavigate capabilities for agent {0}", agentID); | 80 | "[MOAP]: Registering ObjectMedia and ObjectMediaNavigate capabilities for agent {0}", agentID); |
79 | 81 | ||
82 | // We do receive a post to ObjectMedia when a new avatar enters the region - though admittedly this is the | ||
83 | // avatar that set the texture in the first place. | ||
84 | // Even though we're registering for POST we're going to get GETS and UPDATES too | ||
80 | caps.RegisterHandler( | 85 | caps.RegisterHandler( |
81 | "ObjectMedia", new RestStreamHandler("GET", "/CAPS/" + UUID.Random(), OnObjectMediaRequest)); | 86 | "ObjectMedia", new RestStreamHandler("POST", "/CAPS/" + UUID.Random(), HandleObjectMediaRequest)); |
87 | |||
88 | // We do get these posts when the url has been changed. | ||
89 | // Even though we're registering for POST we're going to get GETS and UPDATES too | ||
82 | caps.RegisterHandler( | 90 | caps.RegisterHandler( |
83 | "ObjectMediaNavigate", new RestStreamHandler("GET", "/CAPS/" + UUID.Random(), OnObjectMediaNavigateRequest)); | 91 | "ObjectMediaNavigate", new RestStreamHandler("POST", "/CAPS/" + UUID.Random(), HandleObjectMediaNavigateRequest)); |
84 | } | 92 | } |
85 | 93 | ||
86 | protected string OnObjectMediaRequest( | 94 | /// <summary> |
95 | /// Sets or gets per face media textures. | ||
96 | /// </summary> | ||
97 | /// <param name="request"></param> | ||
98 | /// <param name="path"></param> | ||
99 | /// <param name="param"></param> | ||
100 | /// <param name="httpRequest"></param> | ||
101 | /// <param name="httpResponse"></param> | ||
102 | /// <returns></returns> | ||
103 | protected string HandleObjectMediaRequest( | ||
87 | string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 104 | string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
88 | { | 105 | { |
89 | m_log.DebugFormat("[MOAP]: Got ObjectMedia request for {0}", path); | 106 | m_log.DebugFormat("[MOAP]: Got ObjectMedia raw request [{0}]", request); |
107 | |||
108 | Hashtable osdParams = new Hashtable(); | ||
109 | osdParams = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request)); | ||
110 | |||
111 | foreach (Object key in osdParams.Keys) | ||
112 | m_log.DebugFormat("[MOAP]: Param {0}={1}", key, osdParams[key]); | ||
113 | |||
114 | string verb = (string)osdParams["verb"]; | ||
115 | |||
116 | if ("GET" == verb) | ||
117 | return HandleObjectMediaRequestGet(path, osdParams, httpRequest, httpResponse); | ||
118 | |||
90 | //NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); | 119 | //NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); |
91 | 120 | ||
121 | // TODO: Persist in memory | ||
122 | // TODO: Tell other agents in the region about the change via the ObjectMediaResponse (?) message | ||
123 | // TODO: Persist in database | ||
124 | |||
92 | return string.Empty; | 125 | return string.Empty; |
93 | } | 126 | } |
94 | 127 | ||
95 | protected string OnObjectMediaNavigateRequest( | 128 | protected string HandleObjectMediaRequestGet( |
129 | string path, Hashtable osdParams, OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
130 | { | ||
131 | // Yeah, only for cubes right now. I know it's dumb. | ||
132 | int faces = 6; | ||
133 | |||
134 | MediaEntry[] media = new MediaEntry[faces]; | ||
135 | for (int i = 0; i < faces; i++) | ||
136 | { | ||
137 | MediaEntry me = new MediaEntry(); | ||
138 | me.HomeURL = "google.com"; | ||
139 | me.CurrentURL = "google.com"; | ||
140 | me.AutoScale = true; | ||
141 | //me.Height = 300; | ||
142 | //me.Width = 240; | ||
143 | media[i] = me; | ||
144 | } | ||
145 | |||
146 | ObjectMediaResponse resp = new ObjectMediaResponse(); | ||
147 | |||
148 | resp.PrimID = (UUID)osdParams["object_id"]; | ||
149 | resp.FaceMedia = media; | ||
150 | |||
151 | // I know this has to end with the last avatar to edit and the version code shouldn't always be 16. Just trying | ||
152 | // to minimally satisfy for now to get something working | ||
153 | resp.Version = "x-mv:0000000016/" + UUID.Random(); | ||
154 | |||
155 | //string rawResp = resp.Serialize().ToString(); | ||
156 | string rawResp = OSDParser.SerializeLLSDXmlString(resp.Serialize()); | ||
157 | |||
158 | m_log.DebugFormat("[MOAP]: Got HandleObjectMediaRequestGet raw response is [{0}]", rawResp); | ||
159 | |||
160 | return rawResp; | ||
161 | } | ||
162 | |||
163 | /// <summary> | ||
164 | /// Received from the viewer if a user has changed the url of a media texture. | ||
165 | /// </summary> | ||
166 | /// <param name="request"></param> | ||
167 | /// <param name="path"></param> | ||
168 | /// <param name="param"></param> | ||
169 | /// <param name="httpRequest">/param> | ||
170 | /// <param name="httpResponse">/param> | ||
171 | /// <returns></returns> | ||
172 | protected string HandleObjectMediaNavigateRequest( | ||
96 | string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 173 | string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
97 | { | 174 | { |
98 | m_log.DebugFormat("[MOAP]: Got ObjectMediaNavigate request for {0}", path); | 175 | m_log.DebugFormat("[MOAP]: Got ObjectMediaNavigate request for {0}", path); |
99 | //NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); | 176 | //NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); |
100 | 177 | ||
178 | // TODO: Persist in memory | ||
179 | // TODO: Tell other agents in the region about the change via the ObjectMediaResponse (?) message | ||
180 | // TODO: Persist in database | ||
181 | |||
101 | return string.Empty; | 182 | return string.Empty; |
102 | } | 183 | } |
184 | |||
185 | |||
103 | } | 186 | } |
104 | } \ No newline at end of file | 187 | } \ No newline at end of file |