diff options
author | Dr Scofield | 2008-11-06 13:13:08 +0000 |
---|---|---|
committer | Dr Scofield | 2008-11-06 13:13:08 +0000 |
commit | 09f86d7e99a4c577a2f6e2c650ad430a45c86aca (patch) | |
tree | cc3d8774c7256c0a08e6c65aba92f5cb55ceb0bf /OpenSim/Region/Environment/Modules/Avatar/Concierge | |
parent | From: Christopher Yeoh <cyeoh@au1.ibm.com> (diff) | |
download | opensim-SC_OLD-09f86d7e99a4c577a2f6e2c650ad430a45c86aca.zip opensim-SC_OLD-09f86d7e99a4c577a2f6e2c650ad430a45c86aca.tar.gz opensim-SC_OLD-09f86d7e99a4c577a2f6e2c650ad430a45c86aca.tar.bz2 opensim-SC_OLD-09f86d7e99a4c577a2f6e2c650ad430a45c86aca.tar.xz |
- fixes comparison of struct against null (no no no)
- fixes IRCBridgeModule's XmlRpc method really paying attention to
region parameter
- cleans up indentation in IRCBridge code
- fixes ConciergeModule exception on client logout
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Avatar/Concierge')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeModule.cs | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeModule.cs index c941b0e..023dc33 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeModule.cs | |||
@@ -53,7 +53,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge | |||
53 | 53 | ||
54 | private List<IScene> _scenes = new List<IScene>(); | 54 | private List<IScene> _scenes = new List<IScene>(); |
55 | private List<IScene> _conciergedScenes = new List<IScene>(); | 55 | private List<IScene> _conciergedScenes = new List<IScene>(); |
56 | private Dictionary<IScene, List<ScenePresence>> _sceneAttendees = new Dictionary<IScene, List<ScenePresence>>(); | 56 | private Dictionary<IScene, List<UUID>> _sceneAttendees = new Dictionary<IScene, List<UUID>>(); |
57 | private bool _replacingChatModule = false; | 57 | private bool _replacingChatModule = false; |
58 | 58 | ||
59 | private IConfig _config; | 59 | private IConfig _config; |
@@ -271,10 +271,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge | |||
271 | if (_conciergedScenes.Contains(client.Scene)) | 271 | if (_conciergedScenes.Contains(client.Scene)) |
272 | { | 272 | { |
273 | _log.DebugFormat("[Concierge]: {0} logs off from {1}", client.Name, client.Scene.RegionInfo.RegionName); | 273 | _log.DebugFormat("[Concierge]: {0} logs off from {1}", client.Name, client.Scene.RegionInfo.RegionName); |
274 | ScenePresence agent = (client.Scene as Scene).GetScenePresence(client.AgentId); | 274 | RemoveFromAttendeeList(client.AgentId, client.Name, client.Scene); |
275 | RemoveFromAttendeeList(agent, agent.Scene); | 275 | AnnounceToAgentsRegion(client.Scene, String.Format(_announceLeaving, client.Name, client.Scene.RegionInfo.RegionName, |
276 | AnnounceToAgentsRegion(agent, String.Format(_announceLeaving, agent.Name, agent.Scene.RegionInfo.RegionName, | 276 | _sceneAttendees[client.Scene].Count)); |
277 | _sceneAttendees[agent.Scene].Count)); | ||
278 | } | 277 | } |
279 | } | 278 | } |
280 | 279 | ||
@@ -284,10 +283,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge | |||
284 | if (_conciergedScenes.Contains(agent.Scene)) | 283 | if (_conciergedScenes.Contains(agent.Scene)) |
285 | { | 284 | { |
286 | _log.DebugFormat("[Concierge]: {0} enters {1}", agent.Name, agent.Scene.RegionInfo.RegionName); | 285 | _log.DebugFormat("[Concierge]: {0} enters {1}", agent.Name, agent.Scene.RegionInfo.RegionName); |
287 | AddToAttendeeList(agent, agent.Scene); | 286 | AddToAttendeeList(agent.UUID, agent.Scene); |
288 | WelcomeAvatar(agent, agent.Scene); | 287 | WelcomeAvatar(agent, agent.Scene); |
289 | AnnounceToAgentsRegion(agent, String.Format(_announceEntering, agent.Name, agent.Scene.RegionInfo.RegionName, | 288 | AnnounceToAgentsRegion(agent.Scene, String.Format(_announceEntering, agent.Name, agent.Scene.RegionInfo.RegionName, |
290 | _sceneAttendees[agent.Scene].Count)); | 289 | _sceneAttendees[agent.Scene].Count)); |
291 | } | 290 | } |
292 | } | 291 | } |
293 | 292 | ||
@@ -297,25 +296,25 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge | |||
297 | if (_conciergedScenes.Contains(agent.Scene)) | 296 | if (_conciergedScenes.Contains(agent.Scene)) |
298 | { | 297 | { |
299 | _log.DebugFormat("[Concierge]: {0} leaves {1}", agent.Name, agent.Scene.RegionInfo.RegionName); | 298 | _log.DebugFormat("[Concierge]: {0} leaves {1}", agent.Name, agent.Scene.RegionInfo.RegionName); |
300 | RemoveFromAttendeeList(agent, agent.Scene); | 299 | RemoveFromAttendeeList(agent.UUID, agent.Name, agent.Scene); |
301 | AnnounceToAgentsRegion(agent, String.Format(_announceLeaving, agent.Name, agent.Scene.RegionInfo.RegionName, | 300 | AnnounceToAgentsRegion(agent.Scene, String.Format(_announceLeaving, agent.Name, agent.Scene.RegionInfo.RegionName, |
302 | _sceneAttendees[agent.Scene].Count)); | 301 | _sceneAttendees[agent.Scene].Count)); |
303 | } | 302 | } |
304 | } | 303 | } |
305 | 304 | ||
306 | protected void AddToAttendeeList(ScenePresence agent, Scene scene) | 305 | protected void AddToAttendeeList(UUID agentID, Scene scene) |
307 | { | 306 | { |
308 | lock (_sceneAttendees) | 307 | lock (_sceneAttendees) |
309 | { | 308 | { |
310 | if (!_sceneAttendees.ContainsKey(scene)) | 309 | if (!_sceneAttendees.ContainsKey(scene)) |
311 | _sceneAttendees[scene] = new List<ScenePresence>(); | 310 | _sceneAttendees[scene] = new List<UUID>(); |
312 | List<ScenePresence> attendees = _sceneAttendees[scene]; | 311 | List<UUID> attendees = _sceneAttendees[scene]; |
313 | if (!attendees.Contains(agent)) | 312 | if (!attendees.Contains(agentID)) |
314 | attendees.Add(agent); | 313 | attendees.Add(agentID); |
315 | } | 314 | } |
316 | } | 315 | } |
317 | 316 | ||
318 | protected void RemoveFromAttendeeList(ScenePresence agent, Scene scene) | 317 | protected void RemoveFromAttendeeList(UUID agentID, String name, IScene scene) |
319 | { | 318 | { |
320 | lock (_sceneAttendees) | 319 | lock (_sceneAttendees) |
321 | { | 320 | { |
@@ -324,14 +323,14 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge | |||
324 | _log.WarnFormat("[Concierge]: attendee list missing for region {0}", scene.RegionInfo.RegionName); | 323 | _log.WarnFormat("[Concierge]: attendee list missing for region {0}", scene.RegionInfo.RegionName); |
325 | return; | 324 | return; |
326 | } | 325 | } |
327 | List<ScenePresence> attendees = _sceneAttendees[scene]; | 326 | List<UUID> attendees = _sceneAttendees[scene]; |
328 | if (!attendees.Contains(agent)) | 327 | if (!attendees.Contains(agentID)) |
329 | { | 328 | { |
330 | _log.WarnFormat("[Concierge]: avatar {0} sneaked in (not on attendee list of region {1})", | 329 | _log.WarnFormat("[Concierge]: avatar {0} sneaked in (not on attendee list of region {1})", |
331 | agent.Name, scene.RegionInfo.RegionName); | 330 | name, scene.RegionInfo.RegionName); |
332 | return; | 331 | return; |
333 | } | 332 | } |
334 | attendees.Remove(agent); | 333 | attendees.Remove(agentID); |
335 | } | 334 | } |
336 | } | 335 | } |
337 | 336 | ||
@@ -375,16 +374,16 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge | |||
375 | 374 | ||
376 | static private Vector3 PosOfGod = new Vector3(128, 128, 9999); | 375 | static private Vector3 PosOfGod = new Vector3(128, 128, 9999); |
377 | 376 | ||
378 | protected void AnnounceToAgentsRegion(IClientAPI client, string msg) | 377 | // protected void AnnounceToAgentsRegion(Scene scene, string msg) |
379 | { | 378 | // { |
380 | ScenePresence agent = null; | 379 | // ScenePresence agent = null; |
381 | if ((client.Scene is Scene) && (client.Scene as Scene).TryGetAvatar(client.AgentId, out agent)) | 380 | // if ((client.Scene is Scene) && (client.Scene as Scene).TryGetAvatar(client.AgentId, out agent)) |
382 | AnnounceToAgentsRegion(agent, msg); | 381 | // AnnounceToAgentsRegion(agent, msg); |
383 | else | 382 | // else |
384 | _log.DebugFormat("[Concierge]: could not find an agent for client {0}", client.Name); | 383 | // _log.DebugFormat("[Concierge]: could not find an agent for client {0}", client.Name); |
385 | } | 384 | // } |
386 | 385 | ||
387 | protected void AnnounceToAgentsRegion(ScenePresence scenePresence, string msg) | 386 | protected void AnnounceToAgentsRegion(IScene scene, string msg) |
388 | { | 387 | { |
389 | OSChatMessage c = new OSChatMessage(); | 388 | OSChatMessage c = new OSChatMessage(); |
390 | c.Message = msg; | 389 | c.Message = msg; |
@@ -394,9 +393,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge | |||
394 | c.From = _whoami; | 393 | c.From = _whoami; |
395 | c.Sender = null; | 394 | c.Sender = null; |
396 | c.SenderUUID = UUID.Zero; | 395 | c.SenderUUID = UUID.Zero; |
397 | c.Scene = scenePresence.Scene; | 396 | c.Scene = scene; |
398 | 397 | ||
399 | scenePresence.Scene.EventManager.TriggerOnChatBroadcast(this, c); | 398 | if (scene is Scene) |
399 | (scene as Scene).EventManager.TriggerOnChatBroadcast(this, c); | ||
400 | } | 400 | } |
401 | 401 | ||
402 | protected void AnnounceToAgent(ScenePresence agent, string msg) | 402 | protected void AnnounceToAgent(ScenePresence agent, string msg) |