aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-07-12 20:18:10 +0100
committerJustin Clark-Casey (justincc)2010-07-26 23:34:19 +0100
commitc76e2ce250fc2d0d7880fa1125628f0a13d53f9a (patch)
tree1fc1b1df51d47032cdb0df71ae7d3702f32a70e7
parentfactor out common face parameter checking code (diff)
downloadopensim-SC_OLD-c76e2ce250fc2d0d7880fa1125628f0a13d53f9a.zip
opensim-SC_OLD-c76e2ce250fc2d0d7880fa1125628f0a13d53f9a.tar.gz
opensim-SC_OLD-c76e2ce250fc2d0d7880fa1125628f0a13d53f9a.tar.bz2
opensim-SC_OLD-c76e2ce250fc2d0d7880fa1125628f0a13d53f9a.tar.xz
factor out common code for updating the media url
-rw-r--r--OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs68
1 files changed, 27 insertions, 41 deletions
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
index 9dd46eb..242ff6c 100644
--- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
+++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
@@ -124,19 +124,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
124 part.Shape.Media = new List<MediaEntry>(part.GetNumberOfSides()); 124 part.Shape.Media = new List<MediaEntry>(part.GetNumberOfSides());
125 125
126 part.Shape.Media[face] = me; 126 part.Shape.Media[face] = me;
127 127 UpdateMediaUrl(part);
128 if (null == part.MediaUrl)
129 {
130 // TODO: We can't set the last changer until we start tracking which cap we give to which agent id
131 part.MediaUrl = "x-mv:0000000000/" + UUID.Zero;
132 }
133 else
134 {
135 string rawVersion = part.MediaUrl.Substring(5, 10);
136 int version = int.Parse(rawVersion);
137 part.MediaUrl = string.Format("x-mv:{0:D10}/{1}", ++version, UUID.Zero);
138 }
139
140 part.ScheduleFullUpdate(); 128 part.ScheduleFullUpdate();
141 } 129 }
142 130
@@ -223,23 +211,11 @@ namespace OpenSim.Region.CoreModules.Media.Moap
223 return string.Empty; 211 return string.Empty;
224 } 212 }
225 213
226 m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId); 214 m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId);
227 215
228 part.Shape.Media = new List<MediaEntry>(omu.FaceMedia); 216 part.Shape.Media = new List<MediaEntry>(omu.FaceMedia);
229 217
230 if (null == part.MediaUrl) 218 UpdateMediaUrl(part);
231 {
232 // TODO: We can't set the last changer until we start tracking which cap we give to which agent id
233 part.MediaUrl = "x-mv:0000000000/" + UUID.Zero;
234 }
235 else
236 {
237 string rawVersion = part.MediaUrl.Substring(5, 10);
238 int version = int.Parse(rawVersion);
239 part.MediaUrl = string.Format("x-mv:{0:D10}/{1}", ++version, UUID.Zero);
240 }
241
242 m_log.DebugFormat("[MOAP]: Storing media url [{0}] in prim {1} {2}", part.MediaUrl, part.Name, part.UUID);
243 219
244 // Arguably, we could avoid sending a full update to the avatar that just changed the texture. 220 // Arguably, we could avoid sending a full update to the avatar that just changed the texture.
245 part.ScheduleFullUpdate(); 221 part.ScheduleFullUpdate();
@@ -267,7 +243,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
267 243
268 UUID primId = omn.PrimID; 244 UUID primId = omn.PrimID;
269 245
270 SceneObjectPart part = m_scene.GetSceneObjectPart(primId); 246 SceneObjectPart part = m_scene.GetSceneObjectPart(primId);
271 247
272 if (null == part) 248 if (null == part)
273 { 249 {
@@ -284,20 +260,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap
284 MediaEntry me = part.Shape.Media[omn.Face]; 260 MediaEntry me = part.Shape.Media[omn.Face];
285 me.CurrentURL = omn.URL; 261 me.CurrentURL = omn.URL;
286 262
287 string oldMediaUrl = part.MediaUrl; 263 UpdateMediaUrl(part);
288
289 // TODO: refactor into common method
290 string rawVersion = oldMediaUrl.Substring(5, 10);
291 int version = int.Parse(rawVersion);
292 part.MediaUrl = string.Format("x-mv:{0:D10}/{1}", ++version, UUID.Zero);
293
294 m_log.DebugFormat(
295 "[MOAP]: Updating media url in prim {0} {1} from [{2}] to [{3}]",
296 part.Name, part.UUID, oldMediaUrl, part.MediaUrl);
297
298 part.ScheduleFullUpdate();
299 264
300 // TODO: Persist in database 265 part.ScheduleFullUpdate();
301 266
302 return string.Empty; 267 return string.Empty;
303 } 268 }
@@ -317,5 +282,26 @@ namespace OpenSim.Region.CoreModules.Media.Moap
317 throw new ArgumentException( 282 throw new ArgumentException(
318 string.Format("Face argument was {0} but max is {1}", face, maxFaces)); 283 string.Format("Face argument was {0} but max is {1}", face, maxFaces));
319 } 284 }
285
286 /// <summary>
287 /// Update the media url of the given part
288 /// </summary>
289 /// <param name="part"></param>
290 protected void UpdateMediaUrl(SceneObjectPart part)
291 {
292 if (null == part.MediaUrl)
293 {
294 // TODO: We can't set the last changer until we start tracking which cap we give to which agent id
295 part.MediaUrl = "x-mv:0000000000/" + UUID.Zero;
296 }
297 else
298 {
299 string rawVersion = part.MediaUrl.Substring(5, 10);
300 int version = int.Parse(rawVersion);
301 part.MediaUrl = string.Format("x-mv:{0:D10}/{1}", ++version, UUID.Zero);
302 }
303
304 m_log.DebugFormat("[MOAP]: Storing media url [{0}] in prim {1} {2}", part.MediaUrl, part.Name, part.UUID);
305 }
320 } 306 }
321} \ No newline at end of file 307} \ No newline at end of file