diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
4 files changed, 154 insertions, 32 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index 7dd9087..14dee84 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs | |||
@@ -103,6 +103,10 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
103 | // If it's cached, return the cached results | 103 | // If it's cached, return the cached results |
104 | if (m_decodedCache.TryGetValue(assetID, out result)) | 104 | if (m_decodedCache.TryGetValue(assetID, out result)) |
105 | { | 105 | { |
106 | // m_log.DebugFormat( | ||
107 | // "[J2KDecoderModule]: Returning existing cached {0} layers j2k decode for {1}", | ||
108 | // result.Length, assetID); | ||
109 | |||
106 | callback(assetID, result); | 110 | callback(assetID, result); |
107 | } | 111 | } |
108 | else | 112 | else |
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index bc7bf66..9df0592 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -156,7 +156,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
156 | changed = sp.Appearance.SetTextureEntries(textureEntry) || changed; | 156 | changed = sp.Appearance.SetTextureEntries(textureEntry) || changed; |
157 | 157 | ||
158 | // WriteBakedTexturesReport(sp, m_log.DebugFormat); | 158 | // WriteBakedTexturesReport(sp, m_log.DebugFormat); |
159 | ValidateBakedTextureCache(sp, false); | 159 | if (!ValidateBakedTextureCache(sp)) |
160 | RequestRebake(sp, true); | ||
160 | 161 | ||
161 | // This appears to be set only in the final stage of the appearance | 162 | // This appears to be set only in the final stage of the appearance |
162 | // update transaction. In theory, we should be able to do an immediate | 163 | // update transaction. In theory, we should be able to do an immediate |
@@ -251,15 +252,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
251 | } | 252 | } |
252 | 253 | ||
253 | /// <summary> | 254 | /// <summary> |
254 | /// Check for the existence of the baked texture assets. | ||
255 | /// </summary> | ||
256 | /// <param name="sp"></param> | ||
257 | public bool ValidateBakedTextureCache(IScenePresence sp) | ||
258 | { | ||
259 | return ValidateBakedTextureCache(sp, true); | ||
260 | } | ||
261 | |||
262 | /// <summary> | ||
263 | /// Queue up a request to send appearance. | 255 | /// Queue up a request to send appearance. |
264 | /// </summary> | 256 | /// </summary> |
265 | /// <remarks> | 257 | /// <remarks> |
@@ -292,17 +284,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
292 | } | 284 | } |
293 | } | 285 | } |
294 | 286 | ||
295 | #endregion | 287 | public bool ValidateBakedTextureCache(IScenePresence sp) |
296 | |||
297 | #region AvatarFactoryModule private methods | ||
298 | |||
299 | /// <summary> | ||
300 | /// Check for the existence of the baked texture assets. Request a rebake | ||
301 | /// unless checkonly is true. | ||
302 | /// </summary> | ||
303 | /// <param name="client"></param> | ||
304 | /// <param name="checkonly"></param> | ||
305 | private bool ValidateBakedTextureCache(IScenePresence sp, bool checkonly) | ||
306 | { | 288 | { |
307 | bool defonly = true; // are we only using default textures | 289 | bool defonly = true; // are we only using default textures |
308 | 290 | ||
@@ -330,12 +312,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
330 | defonly = false; // found a non-default texture reference | 312 | defonly = false; // found a non-default texture reference |
331 | 313 | ||
332 | if (m_scene.AssetService.Get(face.TextureID.ToString()) == null) | 314 | if (m_scene.AssetService.Get(face.TextureID.ToString()) == null) |
333 | { | 315 | return false; |
334 | if (checkonly) | ||
335 | return false; | ||
336 | |||
337 | sp.ControllingClient.SendRebakeAvatarTextures(face.TextureID); | ||
338 | } | ||
339 | } | 316 | } |
340 | 317 | ||
341 | m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0}", sp.UUID); | 318 | m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0}", sp.UUID); |
@@ -344,6 +321,52 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
344 | return (defonly ? false : true); | 321 | return (defonly ? false : true); |
345 | } | 322 | } |
346 | 323 | ||
324 | public void RequestRebake(IScenePresence sp, bool missingTexturesOnly) | ||
325 | { | ||
326 | for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) | ||
327 | { | ||
328 | int idx = AvatarAppearance.BAKE_INDICES[i]; | ||
329 | Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; | ||
330 | |||
331 | // if there is no texture entry, skip it | ||
332 | if (face == null) | ||
333 | continue; | ||
334 | |||
335 | // m_log.DebugFormat( | ||
336 | // "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}", | ||
337 | // face.TextureID, idx, client.Name, client.AgentId); | ||
338 | |||
339 | // if the texture is one of the "defaults" then skip it | ||
340 | // this should probably be more intelligent (skirt texture doesnt matter | ||
341 | // if the avatar isnt wearing a skirt) but if any of the main baked | ||
342 | // textures is default then the rest should be as well | ||
343 | if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) | ||
344 | continue; | ||
345 | |||
346 | if (missingTexturesOnly) | ||
347 | { | ||
348 | if (m_scene.AssetService.Get(face.TextureID.ToString()) != null) | ||
349 | continue; | ||
350 | else | ||
351 | m_log.DebugFormat( | ||
352 | "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.", | ||
353 | face.TextureID, idx, sp.Name); | ||
354 | } | ||
355 | else | ||
356 | { | ||
357 | m_log.DebugFormat( | ||
358 | "[AVFACTORY]: Requesting rebake of {0} ({1}) for {2}.", | ||
359 | face.TextureID, idx, sp.Name); | ||
360 | } | ||
361 | |||
362 | sp.ControllingClient.SendRebakeAvatarTextures(face.TextureID); | ||
363 | } | ||
364 | } | ||
365 | |||
366 | #endregion | ||
367 | |||
368 | #region AvatarFactoryModule private methods | ||
369 | |||
347 | private Dictionary<BakeType, Primitive.TextureEntryFace> GetBakedTextureFaces(ScenePresence sp) | 370 | private Dictionary<BakeType, Primitive.TextureEntryFace> GetBakedTextureFaces(ScenePresence sp) |
348 | { | 371 | { |
349 | if (sp.IsChildAgent) | 372 | if (sp.IsChildAgent) |
diff --git a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs index dee0ad4..eb1e4b5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs | |||
@@ -43,7 +43,7 @@ using OpenSim.Services.Interfaces; | |||
43 | namespace OpenSim.Region.CoreModules.Avatar.Profile | 43 | namespace OpenSim.Region.CoreModules.Avatar.Profile |
44 | { | 44 | { |
45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
46 | public class BasicProfileModule : ISharedRegionModule | 46 | public class BasicProfileModule : IProfileModule, ISharedRegionModule |
47 | { | 47 | { |
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
49 | 49 | ||
@@ -57,6 +57,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile | |||
57 | 57 | ||
58 | public void Initialise(IConfigSource config) | 58 | public void Initialise(IConfigSource config) |
59 | { | 59 | { |
60 | // This can be reduced later as the loader will determine | ||
61 | // whether we are needed | ||
60 | if (config.Configs["Profile"] != null) | 62 | if (config.Configs["Profile"] != null) |
61 | { | 63 | { |
62 | if (config.Configs["Profile"].GetString("Module", string.Empty) != "BasicProfileModule") | 64 | if (config.Configs["Profile"].GetString("Module", string.Empty) != "BasicProfileModule") |
@@ -65,14 +67,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile | |||
65 | 67 | ||
66 | m_log.DebugFormat("[PROFILE MODULE]: Basic Profile Module enabled"); | 68 | m_log.DebugFormat("[PROFILE MODULE]: Basic Profile Module enabled"); |
67 | m_Enabled = true; | 69 | m_Enabled = true; |
68 | |||
69 | } | 70 | } |
70 | 71 | ||
71 | public void AddRegion(Scene scene) | 72 | public void AddRegion(Scene scene) |
72 | { | 73 | { |
73 | if (!m_Enabled) | 74 | if (!m_Enabled) |
74 | return; | 75 | return; |
75 | 76 | ||
76 | lock (m_Scenes) | 77 | lock (m_Scenes) |
77 | { | 78 | { |
78 | if (!m_Scenes.Contains(scene)) | 79 | if (!m_Scenes.Contains(scene)) |
@@ -80,6 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile | |||
80 | m_Scenes.Add(scene); | 81 | m_Scenes.Add(scene); |
81 | // Hook up events | 82 | // Hook up events |
82 | scene.EventManager.OnNewClient += OnNewClient; | 83 | scene.EventManager.OnNewClient += OnNewClient; |
84 | scene.RegisterModuleInterface<IProfileModule>(this); | ||
83 | } | 85 | } |
84 | } | 86 | } |
85 | } | 87 | } |
@@ -116,7 +118,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile | |||
116 | 118 | ||
117 | public Type ReplaceableInterface | 119 | public Type ReplaceableInterface |
118 | { | 120 | { |
119 | get { return null; } | 121 | get { return typeof(IProfileModule); } |
120 | } | 122 | } |
121 | 123 | ||
122 | #endregion | 124 | #endregion |
@@ -170,4 +172,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile | |||
170 | } | 172 | } |
171 | 173 | ||
172 | } | 174 | } |
173 | } \ No newline at end of file | 175 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index dbe2560..37292d6 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | |||
@@ -50,6 +50,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
50 | public string LastName { get; set; } | 50 | public string LastName { get; set; } |
51 | public string HomeURL { get; set; } | 51 | public string HomeURL { get; set; } |
52 | public Dictionary<string, object> ServerURLs { get; set; } | 52 | public Dictionary<string, object> ServerURLs { get; set; } |
53 | public string Title { get; set; } | ||
54 | public int Flags { get; set; } | ||
55 | public int Created { get; set; } | ||
53 | } | 56 | } |
54 | 57 | ||
55 | public class UserManagementModule : ISharedRegionModule, IUserManagement | 58 | public class UserManagementModule : ISharedRegionModule, IUserManagement |
@@ -281,6 +284,94 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
281 | return string.Empty; | 284 | return string.Empty; |
282 | } | 285 | } |
283 | 286 | ||
287 | public int GetUserFlags(UUID userID) | ||
288 | { | ||
289 | UserData userdata; | ||
290 | lock (m_UserCache) | ||
291 | m_UserCache.TryGetValue(userID, out userdata); | ||
292 | |||
293 | if (userdata.Flags == -1) | ||
294 | GetUserInfo(userID); | ||
295 | |||
296 | if (userdata.Flags != -1) | ||
297 | return userdata.Flags; | ||
298 | |||
299 | return 0; | ||
300 | } | ||
301 | |||
302 | public int GetUserCreated(UUID userID) | ||
303 | { | ||
304 | UserData userdata; | ||
305 | lock (m_UserCache) | ||
306 | m_UserCache.TryGetValue(userID, out userdata); | ||
307 | |||
308 | if (userdata.Flags == -1) | ||
309 | GetUserInfo(userID); | ||
310 | |||
311 | if (userdata.Created != -1) | ||
312 | return userdata.Created; | ||
313 | |||
314 | return 0; | ||
315 | } | ||
316 | |||
317 | public string GetUserTitle(UUID userID) | ||
318 | { | ||
319 | UserData userdata; | ||
320 | lock (m_UserCache) | ||
321 | m_UserCache.TryGetValue(userID, out userdata); | ||
322 | |||
323 | if (userdata.Flags == -1) | ||
324 | GetUserInfo(userID); | ||
325 | |||
326 | if (userdata.Created != -1) | ||
327 | return userdata.Title; | ||
328 | |||
329 | return string.Empty; | ||
330 | } | ||
331 | |||
332 | // This will cache the user data | ||
333 | // Change this to return bool | ||
334 | private bool GetUserInfo(UUID userID) | ||
335 | { | ||
336 | UserData userdata; | ||
337 | lock (m_UserCache) | ||
338 | m_UserCache.TryGetValue(userID, out userdata); | ||
339 | |||
340 | if (userdata != null) | ||
341 | { | ||
342 | // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Requested url type {0} for {1}", serverType, userID); | ||
343 | |||
344 | if (userdata.Flags >= 0) | ||
345 | { | ||
346 | // This is already populated | ||
347 | return true; | ||
348 | } | ||
349 | |||
350 | if (userdata.HomeURL != null && userdata.HomeURL != string.Empty) | ||
351 | { | ||
352 | m_log.DebugFormat( | ||
353 | "[USER MANAGEMENT MODULE]: Requesting user flags from '{0}' for {1}", | ||
354 | userdata.HomeURL, userID); | ||
355 | |||
356 | UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL); | ||
357 | Dictionary<string, object> info = uConn.GetUserInfo(userID); | ||
358 | |||
359 | // Pull our data now | ||
360 | if (info["result"].ToString() == "success") | ||
361 | { | ||
362 | userdata.Flags = (int)info["user_flags"]; | ||
363 | userdata.Created = (int)info["user_created"]; | ||
364 | userdata.Title = (string)info["user_title"]; | ||
365 | |||
366 | return true; | ||
367 | } | ||
368 | } | ||
369 | } | ||
370 | |||
371 | return false; | ||
372 | } | ||
373 | |||
374 | |||
284 | public string GetUserUUI(UUID userID) | 375 | public string GetUserUUI(UUID userID) |
285 | { | 376 | { |
286 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, userID); | 377 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, userID); |
@@ -352,6 +443,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
352 | { | 443 | { |
353 | UserData user = new UserData(); | 444 | UserData user = new UserData(); |
354 | user.Id = id; | 445 | user.Id = id; |
446 | user.Flags = -1; | ||
447 | user.Created = -1; | ||
355 | 448 | ||
356 | if (creatorData != null && creatorData != string.Empty) | 449 | if (creatorData != null && creatorData != string.Empty) |
357 | { | 450 | { |