aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorOren Hurvitz2014-04-09 17:00:02 +0300
committerOren Hurvitz2014-04-09 15:00:54 +0100
commitc725ad1577aeb453ed85c6b1601fa3300ace869a (patch)
treef980e784ef157a5206e796cdfaba3740faadd0ce /OpenSim/Region/Framework/Scenes
parentIn teleports, pass the source region to the destination (similar to an HTTP r... (diff)
downloadopensim-SC_OLD-c725ad1577aeb453ed85c6b1601fa3300ace869a.zip
opensim-SC_OLD-c725ad1577aeb453ed85c6b1601fa3300ace869a.tar.gz
opensim-SC_OLD-c725ad1577aeb453ed85c6b1601fa3300ace869a.tar.bz2
opensim-SC_OLD-c725ad1577aeb453ed85c6b1601fa3300ace869a.tar.xz
Fixed: when teleporting between grids, the avatar name wasn't always updated.
When an avatar is in their home grid, their name appears as "First Last". In other grids the name appears as "First.Last @grid.example.com". However, viewers have a bug and they don't always show the new name. We use a trick (changing the Group Title briefly) in order to make the viewers show the new name. This is only done after a Hypergrid teleport.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs73
1 files changed, 67 insertions, 6 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index fdc1f32..7a6ed5c 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -451,7 +451,19 @@ namespace OpenSim.Region.Framework.Scenes
451 public string Firstname { get; private set; } 451 public string Firstname { get; private set; }
452 public string Lastname { get; private set; } 452 public string Lastname { get; private set; }
453 453
454 public string Grouptitle { get; set; } 454 public string Grouptitle
455 {
456 get { return UseFakeGroupTitle ? "(Loading)" : m_groupTitle; }
457 set { m_groupTitle = value; }
458 }
459 private string m_groupTitle;
460
461 /// <summary>
462 /// When this is 'true', return a dummy group title instead of the real group title. This is
463 /// used as part of a hack to force viewers to update the displayed avatar name.
464 /// </summary>
465 public bool UseFakeGroupTitle { get; set; }
466
455 467
456 // Agent's Draw distance. 468 // Agent's Draw distance.
457 public float DrawDistance { get; set; } 469 public float DrawDistance { get; set; }
@@ -1051,6 +1063,17 @@ namespace OpenSim.Region.Framework.Scenes
1051 if (gm != null) 1063 if (gm != null)
1052 Grouptitle = gm.GetGroupTitle(m_uuid); 1064 Grouptitle = gm.GetGroupTitle(m_uuid);
1053 1065
1066 AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(ControllingClient.CircuitCode);
1067 uint teleportFlags = (aCircuit == null) ? 0 : aCircuit.teleportFlags;
1068 if ((teleportFlags & (uint)TeleportFlags.ViaHGLogin) != 0)
1069 {
1070 // The avatar is arriving from another grid. This means that we may have changed the
1071 // avatar's name to or from the special Hypergrid format ("First.Last @grid.example.com").
1072 // Unfortunately, due to a viewer bug, viewers don't always show the new name.
1073 // But we have a trick that can force them to update the name anyway.
1074 ForceViewersUpdateName();
1075 }
1076
1054 RegionHandle = m_scene.RegionInfo.RegionHandle; 1077 RegionHandle = m_scene.RegionInfo.RegionHandle;
1055 1078
1056 m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); 1079 m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene);
@@ -1247,6 +1270,36 @@ namespace OpenSim.Region.Framework.Scenes
1247 return true; 1270 return true;
1248 } 1271 }
1249 1272
1273 /// <summary>
1274 /// Force viewers to show the avatar's current name.
1275 /// </summary>
1276 /// <remarks>
1277 /// The avatar name that is shown above the avatar in the viewers is sent in ObjectUpdate packets,
1278 /// and they get the name from the ScenePresence. Unfortunately, viewers have a bug (as of April 2014)
1279 /// where they ignore changes to the avatar name. However, tey don't ignore changes to the avatar's
1280 /// Group Title. So the following trick makes viewers update the avatar's name by briefly changing
1281 /// the group title (to "(Loading)"), and then restoring it.
1282 /// </remarks>
1283 public void ForceViewersUpdateName()
1284 {
1285 m_log.DebugFormat("[SCENE PRESENCE]: Forcing viewers to update the avatar name for " + Name);
1286
1287 UseFakeGroupTitle = true;
1288 SendAvatarDataToAllAgents(false);
1289
1290 Util.FireAndForget(o =>
1291 {
1292 // Viewers only update the avatar name when idle. Therefore, we must wait long
1293 // enough for the viewer to show the fake name that we had set above, and only
1294 // then switch back to the true name. This delay was chosen because it has a high
1295 // chance of succeeding (we don't want to choose a value that's too low).
1296 Thread.Sleep(5000);
1297
1298 UseFakeGroupTitle = false;
1299 SendAvatarDataToAllAgents(false);
1300 });
1301 }
1302
1250 public int GetStateSource() 1303 public int GetStateSource()
1251 { 1304 {
1252 AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(UUID); 1305 AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(UUID);
@@ -3263,11 +3316,16 @@ namespace OpenSim.Region.Framework.Scenes
3263 } 3316 }
3264 } 3317 }
3265 3318
3319 public void SendAvatarDataToAllAgents()
3320 {
3321 SendAvatarDataToAllAgents(true);
3322 }
3323
3266 /// <summary> 3324 /// <summary>
3267 /// Send this agent's avatar data to all other root and child agents in the scene 3325 /// Send this agent's avatar data to all other root and child agents in the scene
3268 /// This agent must be root. This avatar will receive its own update. 3326 /// This agent must be root. This avatar will receive its own update.
3269 /// </summary> 3327 /// </summary>
3270 public void SendAvatarDataToAllAgents() 3328 public void SendAvatarDataToAllAgents(bool full)
3271 { 3329 {
3272 //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAllAgents: {0} ({1})", Name, UUID); 3330 //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAllAgents: {0} ({1})", Name, UUID);
3273 // only send update from root agents to other clients; children are only "listening posts" 3331 // only send update from root agents to other clients; children are only "listening posts"
@@ -3284,10 +3342,13 @@ namespace OpenSim.Region.Framework.Scenes
3284 3342
3285 int count = 0; 3343 int count = 0;
3286 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) 3344 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
3287 { 3345 {
3288 SendAvatarDataToAgent(scenePresence); 3346 if (full)
3289 count++; 3347 SendAvatarDataToAgent(scenePresence);
3290 }); 3348 else
3349 scenePresence.ControllingClient.SendAvatarDataImmediate(this);
3350 count++;
3351 });
3291 3352
3292 m_scene.StatsReporter.AddAgentUpdates(count); 3353 m_scene.StatsReporter.AddAgentUpdates(count);
3293 } 3354 }