aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs
diff options
context:
space:
mode:
authorDr Scofield2009-05-25 09:32:44 +0000
committerDr Scofield2009-05-25 09:32:44 +0000
commitb8405356220b81f81aa13295c878f7fc469ea757 (patch)
tree5e5493c32fcf502dac5099c2248e1820f345403f /OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs
parent* Attaches debug info to some DNS resolution code. (diff)
downloadopensim-SC-b8405356220b81f81aa13295c878f7fc469ea757.zip
opensim-SC-b8405356220b81f81aa13295c878f7fc469ea757.tar.gz
opensim-SC-b8405356220b81f81aa13295c878f7fc469ea757.tar.bz2
opensim-SC-b8405356220b81f81aa13295c878f7fc469ea757.tar.xz
dropping attendee list keeping from Concierge, relying on
Scene.GetAvatars() instead now. [test #487]
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs113
1 files changed, 26 insertions, 87 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs
index df3402d..4aee66d 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs
@@ -55,10 +55,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge
55 55
56 private List<IScene> m_scenes = new List<IScene>(); 56 private List<IScene> m_scenes = new List<IScene>();
57 private List<IScene> m_conciergedScenes = new List<IScene>(); 57 private List<IScene> m_conciergedScenes = new List<IScene>();
58 private Dictionary<IScene, List<UUID>> m_sceneAttendees =
59 new Dictionary<IScene, List<UUID>>();
60 private Dictionary<UUID, string> m_attendeeNames =
61 new Dictionary<UUID, string>();
62 58
63 private bool m_replacingChatModule = false; 59 private bool m_replacingChatModule = false;
64 60
@@ -103,6 +99,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge
103 { 99 {
104 if (config.Configs["Chat"] == null) 100 if (config.Configs["Chat"] == null)
105 { 101 {
102 // if Chat module has not been configured it's
103 // enabled by default, so we are not going to
104 // replace it.
106 m_replacingChatModule = false; 105 m_replacingChatModule = false;
107 } 106 }
108 else 107 else
@@ -312,15 +311,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge
312 311
313 if (m_conciergedScenes.Contains(client.Scene)) 312 if (m_conciergedScenes.Contains(client.Scene))
314 { 313 {
315 m_log.DebugFormat("[Concierge]: {0} logs off from {1}", client.Name, client.Scene.RegionInfo.RegionName); 314 Scene scene = client.Scene as Scene;
316 RemoveFromAttendeeList(client.AgentId, client.Name, client.Scene); 315 m_log.DebugFormat("[Concierge]: {0} logs off from {1}", client.Name, scene.RegionInfo.RegionName);
317 lock (m_sceneAttendees) 316 List<ScenePresence> avs = scene.GetAvatars();
318 { 317 AnnounceToAgentsRegion(scene, String.Format(m_announceLeaving, client.Name, scene.RegionInfo.RegionName, avs.Count));
319 AnnounceToAgentsRegion(client.Scene, String.Format(m_announceLeaving, client.Name, client.Scene.RegionInfo.RegionName, 318 UpdateBroker(scene, avs);
320 m_sceneAttendees[client.Scene].Count));
321 UpdateBroker(client.Scene);
322 m_attendeeNames.Remove(client.AgentId);
323 }
324 } 319 }
325 } 320 }
326 321
@@ -329,12 +324,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge
329 { 324 {
330 if (m_conciergedScenes.Contains(agent.Scene)) 325 if (m_conciergedScenes.Contains(agent.Scene))
331 { 326 {
332 m_log.DebugFormat("[Concierge]: {0} enters {1}", agent.Name, agent.Scene.RegionInfo.RegionName); 327 Scene scene = agent.Scene;
333 AddToAttendeeList(agent.UUID, agent.Name, agent.Scene); 328 m_log.DebugFormat("[Concierge]: {0} enters {1}", agent.Name, scene.RegionInfo.RegionName);
334 WelcomeAvatar(agent, agent.Scene); 329 List<ScenePresence> avs = scene.GetAvatars();
335 AnnounceToAgentsRegion(agent.Scene, String.Format(m_announceEntering, agent.Name, agent.Scene.RegionInfo.RegionName, 330 WelcomeAvatar(agent, scene);
336 m_sceneAttendees[agent.Scene].Count)); 331 AnnounceToAgentsRegion(scene, String.Format(m_announceEntering, agent.Name,
337 UpdateBroker(agent.Scene); 332 scene.RegionInfo.RegionName, avs.Count));
333 UpdateBroker(scene, avs);
338 } 334 }
339 } 335 }
340 336
@@ -343,49 +339,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge
343 { 339 {
344 if (m_conciergedScenes.Contains(agent.Scene)) 340 if (m_conciergedScenes.Contains(agent.Scene))
345 { 341 {
346 m_log.DebugFormat("[Concierge]: {0} leaves {1}", agent.Name, agent.Scene.RegionInfo.RegionName); 342 Scene scene = agent.Scene;
347 RemoveFromAttendeeList(agent.UUID, agent.Name, agent.Scene); 343 m_log.DebugFormat("[Concierge]: {0} leaves {1}", agent.Name, scene.RegionInfo.RegionName);
348 AnnounceToAgentsRegion(agent.Scene, String.Format(m_announceLeaving, agent.Name, agent.Scene.RegionInfo.RegionName, 344 List<ScenePresence> avs = scene.GetAvatars();
349 m_sceneAttendees[agent.Scene].Count)); 345 AnnounceToAgentsRegion(scene, String.Format(m_announceLeaving, agent.Name,
350 UpdateBroker(agent.Scene); 346 scene.RegionInfo.RegionName, avs.Count));
351 } 347 UpdateBroker(scene, avs);
352 }
353
354 protected void AddToAttendeeList(UUID agentID, string name, Scene scene)
355 {
356 lock (m_sceneAttendees)
357 {
358 if (!m_sceneAttendees.ContainsKey(scene))
359 m_sceneAttendees[scene] = new List<UUID>();
360
361 List<UUID> attendees = m_sceneAttendees[scene];
362 if (!attendees.Contains(agentID))
363 {
364 attendees.Add(agentID);
365 m_attendeeNames[agentID] = name;
366 }
367 }
368 }
369
370 protected void RemoveFromAttendeeList(UUID agentID, String name, IScene scene)
371 {
372 lock (m_sceneAttendees)
373 {
374 if (!m_sceneAttendees.ContainsKey(scene))
375 {
376 m_log.WarnFormat("[Concierge]: attendee list missing for region {0}", scene.RegionInfo.RegionName);
377 return;
378 }
379
380 List<UUID> attendees = m_sceneAttendees[scene];
381 if (!attendees.Contains(agentID))
382 {
383 m_log.WarnFormat("[Concierge]: avatar {0} must have sneaked in to region {1} earlier",
384 name, scene.RegionInfo.RegionName);
385 return;
386 }
387
388 attendees.Remove(agentID);
389 } 348 }
390 } 349 }
391 350
@@ -404,29 +363,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge
404 } 363 }
405 } 364 }
406 365
407 protected void UpdateBroker(IScene scene) 366 protected void UpdateBroker(IScene scene, List<ScenePresence> avatars)
408 { 367 {
409 if (String.IsNullOrEmpty(m_brokerURI)) 368 if (String.IsNullOrEmpty(m_brokerURI))
410 return; 369 return;
411 370
412 string uri = String.Format(m_brokerURI, scene.RegionInfo.RegionName, scene.RegionInfo.RegionID); 371 string uri = String.Format(m_brokerURI, scene.RegionInfo.RegionName, scene.RegionInfo.RegionID);
413 372
414 // get attendee list for the scene
415 List<UUID> attendees;
416 lock (m_sceneAttendees)
417 {
418 if (!m_sceneAttendees.ContainsKey(scene))
419 {
420 m_log.DebugFormat("[Concierge]: attendee list missing for region {0}", scene.RegionInfo.RegionName);
421 return;
422 }
423
424 attendees = m_sceneAttendees[scene];
425 }
426
427 // create XML sniplet 373 // create XML sniplet
428 StringBuilder list = new StringBuilder(); 374 StringBuilder list = new StringBuilder();
429 if (0 == attendees.Count) 375 if (0 == avatars.Count)
430 { 376 {
431 list.Append(String.Format("<avatars count=\"0\" region_name=\"{0}\" region_uuid=\"{1}\" timestamp=\"{2}\" />", 377 list.Append(String.Format("<avatars count=\"0\" region_name=\"{0}\" region_uuid=\"{1}\" timestamp=\"{2}\" />",
432 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, 378 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
@@ -435,19 +381,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge
435 else 381 else
436 { 382 {
437 list.Append(String.Format("<avatars count=\"{0}\" region_name=\"{1}\" region_uuid=\"{2}\" timestamp=\"{3}\">\n", 383 list.Append(String.Format("<avatars count=\"{0}\" region_name=\"{1}\" region_uuid=\"{2}\" timestamp=\"{3}\">\n",
438 attendees.Count, scene.RegionInfo.RegionName, 384 avatars.Count, scene.RegionInfo.RegionName,
439 scene.RegionInfo.RegionID, 385 scene.RegionInfo.RegionID,
440 DateTime.UtcNow.ToString("s"))); 386 DateTime.UtcNow.ToString("s")));
441 lock (m_sceneAttendees) 387 foreach (ScenePresence av in avatars)
442 { 388 {
443 foreach (UUID uuid in attendees) 389 list.Append(String.Format(" <avatar name=\"{0}\" uuid=\"{1}\" />\n", av.Name, av.UUID));
444 {
445 if (m_attendeeNames.ContainsKey(uuid))
446 {
447 string name = m_attendeeNames[uuid];
448 list.Append(String.Format(" <avatar name=\"{0}\" uuid=\"{1}\" />\n", name, uuid));
449 }
450 }
451 } 390 }
452 list.Append("</avatars>"); 391 list.Append("</avatars>");
453 } 392 }