aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeModule.cs55
1 files changed, 45 insertions, 10 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeModule.cs
index 1a903fe..dbf4a70 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeModule.cs
@@ -29,8 +29,10 @@ using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.IO; 31using System.IO;
32using System.Net;
32using System.Net.Sockets; 33using System.Net.Sockets;
33using System.Reflection; 34using System.Reflection;
35using System.Text;
34using System.Text.RegularExpressions; 36using System.Text.RegularExpressions;
35using System.Threading; 37using System.Threading;
36using log4net; 38using log4net;
@@ -53,7 +55,11 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge
53 55
54 private List<IScene> _scenes = new List<IScene>(); 56 private List<IScene> _scenes = new List<IScene>();
55 private List<IScene> _conciergedScenes = new List<IScene>(); 57 private List<IScene> _conciergedScenes = new List<IScene>();
56 private Dictionary<IScene, List<UUID>> _sceneAttendees = new Dictionary<IScene, List<UUID>>(); 58 private Dictionary<IScene, List<UUID>> _sceneAttendees =
59 new Dictionary<IScene, List<UUID>>();
60 private Dictionary<UUID, string> _attendeeNames =
61 new Dictionary<UUID, string>();
62
57 private bool _replacingChatModule = false; 63 private bool _replacingChatModule = false;
58 64
59 private IConfig _config; 65 private IConfig _config;
@@ -287,7 +293,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge
287 if (_conciergedScenes.Contains(agent.Scene)) 293 if (_conciergedScenes.Contains(agent.Scene))
288 { 294 {
289 _log.DebugFormat("[Concierge]: {0} enters {1}", agent.Name, agent.Scene.RegionInfo.RegionName); 295 _log.DebugFormat("[Concierge]: {0} enters {1}", agent.Name, agent.Scene.RegionInfo.RegionName);
290 AddToAttendeeList(agent.UUID, agent.Scene); 296 AddToAttendeeList(agent.UUID, agent.Name, agent.Scene);
291 WelcomeAvatar(agent, agent.Scene); 297 WelcomeAvatar(agent, agent.Scene);
292 AnnounceToAgentsRegion(agent.Scene, String.Format(_announceEntering, agent.Name, agent.Scene.RegionInfo.RegionName, 298 AnnounceToAgentsRegion(agent.Scene, String.Format(_announceEntering, agent.Name, agent.Scene.RegionInfo.RegionName,
293 _sceneAttendees[agent.Scene].Count)); 299 _sceneAttendees[agent.Scene].Count));
@@ -308,15 +314,19 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge
308 } 314 }
309 } 315 }
310 316
311 protected void AddToAttendeeList(UUID agentID, Scene scene) 317 protected void AddToAttendeeList(UUID agentID, string name, Scene scene)
312 { 318 {
313 lock (_sceneAttendees) 319 lock (_sceneAttendees)
314 { 320 {
315 if (!_sceneAttendees.ContainsKey(scene)) 321 if (!_sceneAttendees.ContainsKey(scene))
316 _sceneAttendees[scene] = new List<UUID>(); 322 _sceneAttendees[scene] = new List<UUID>();
323
317 List<UUID> attendees = _sceneAttendees[scene]; 324 List<UUID> attendees = _sceneAttendees[scene];
318 if (!attendees.Contains(agentID)) 325 if (!attendees.Contains(agentID))
326 {
319 attendees.Add(agentID); 327 attendees.Add(agentID);
328 _attendeeNames[agentID] = name;
329 }
320 } 330 }
321 } 331 }
322 332
@@ -329,6 +339,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge
329 _log.WarnFormat("[Concierge]: attendee list missing for region {0}", scene.RegionInfo.RegionName); 339 _log.WarnFormat("[Concierge]: attendee list missing for region {0}", scene.RegionInfo.RegionName);
330 return; 340 return;
331 } 341 }
342
332 List<UUID> attendees = _sceneAttendees[scene]; 343 List<UUID> attendees = _sceneAttendees[scene];
333 if (!attendees.Contains(agentID)) 344 if (!attendees.Contains(agentID))
334 { 345 {
@@ -336,7 +347,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge
336 name, scene.RegionInfo.RegionName); 347 name, scene.RegionInfo.RegionName);
337 return; 348 return;
338 } 349 }
350
339 attendees.Remove(agentID); 351 attendees.Remove(agentID);
352 _attendeeNames.Remove(agentID);
340 } 353 }
341 } 354 }
342 355
@@ -362,21 +375,43 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge
362 StringBuilder list = new StringBuilder(); 375 StringBuilder list = new StringBuilder();
363 if (0 == attendees.Count) 376 if (0 == attendees.Count)
364 { 377 {
365 list.Append("<avatars count=\"0\" region_name=\"{0}\" region_uuid=\"{1}\" timestamp=\"{2}\" />", 378 list.Append(String.Format("<avatars count=\"0\" region_name=\"{0}\" region_uuid=\"{1}\" timestamp=\"{2}\" />",
366 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, 379 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
367 System.DateTime.UtcNow.ToString("s")); 380 DateTime.UtcNow.ToString("s")));
368 } 381 }
369 else 382 else
370 { 383 {
371 list.Append("<avatars count=\"{0}\" region_name=\"{1}\" region_uuid=\"{2}\" timestamp=\"{3}\" />", 384 list.Append(String.Format("<avatars count=\"{0}\" region_name=\"{1}\" region_uuid=\"{2}\" timestamp=\"{3}\">\n",
372 attendees.Count, scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, 385 attendees.Count, scene.RegionInfo.RegionName,
373 System.DateTime.UtcNow.ToString("s")); 386 scene.RegionInfo.RegionID,
374 387 DateTime.UtcNow.ToString("s")));
388 foreach(UUID uuid in attendees)
389 {
390 string name = _attendeeNames[uuid];
391 list.Append(String.Format(" <avatar name=\"{0}\" uuid=\"{1}\" />\n", name, uuid));
392 }
393 list.Append("</avatar>");
375 } 394 }
395 string payload = list.ToString();
396 _log.DebugFormat("[Concierge]: posting to {0}:\n{1}", _brokerURI, payload);
376 397
377 // post via REST to broker 398 // post via REST to broker
399 HttpWebRequest updatePost = WebRequest.Create(_brokerURI) as HttpWebRequest;
400 updatePost.Method = "POST";
401 updatePost.ContentType = "text/xml";
402 updatePost.ContentLength = payload.Length;
403 updatePost.UserAgent = "OpenSim.Concierge";
404
405 StreamWriter payloadStream = new StreamWriter(updatePost.GetRequestStream());
406 payloadStream.Write(payload);
407 payloadStream.Close();
408
409 HttpWebResponse response = updatePost.GetResponse() as HttpWebResponse;
410 response.Close();
411 _log.DebugFormat("[Concierge] broker update: status {0}", response.StatusCode);
378 } 412 }
379 413
414
380 protected void WelcomeAvatar(ScenePresence agent, Scene scene) 415 protected void WelcomeAvatar(ScenePresence agent, Scene scene)
381 { 416 {
382 // welcome mechanics: check whether we have a welcomes 417 // welcome mechanics: check whether we have a welcomes