From 09f86d7e99a4c577a2f6e2c650ad430a45c86aca Mon Sep 17 00:00:00 2001 From: Dr Scofield Date: Thu, 6 Nov 2008 13:13:08 +0000 Subject: - 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 --- .../Modules/Avatar/Chat/ChannelState.cs | 10 ++-- .../Modules/Avatar/Chat/IRCBridgeModule.cs | 2 +- .../Modules/Avatar/Chat/IRCConnector.cs | 2 +- .../Modules/Avatar/Concierge/ConciergeModule.cs | 64 +++++++++++----------- 4 files changed, 39 insertions(+), 39 deletions(-) (limited to 'OpenSim/Region/Environment/Modules') diff --git a/OpenSim/Region/Environment/Modules/Avatar/Chat/ChannelState.cs b/OpenSim/Region/Environment/Modules/Avatar/Chat/ChannelState.cs index 4fc744b..6265698 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Chat/ChannelState.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Chat/ChannelState.cs @@ -486,10 +486,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat { m_log.InfoFormat("[IRC-Channel-{0}] Closing channel <{1} to server <{2}:{3}>", - idn, IrcChannel, Server, Port); + idn, IrcChannel, Server, Port); m_log.InfoFormat("[IRC-Channel-{0}] There are {1} active clients", - idn, clientregions.Count); + idn, clientregions.Count); irc.Close(); @@ -498,7 +498,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat public void Open() { m_log.InfoFormat("[IRC-Channel-{0}] Opening channel <{1} to server <{2}:{3}>", - idn, IrcChannel, Server, Port); + idn, IrcChannel, Server, Port); irc.Open(); @@ -524,7 +524,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat public void AddRegion(RegionState rs) { m_log.InfoFormat("[IRC-Channel-{0}] Adding region {1} to channel <{2} to server <{3}:{4}>", - idn, rs.Region, IrcChannel, Server, Port); + idn, rs.Region, IrcChannel, Server, Port); if (!clientregions.Contains(rs)) { clientregions.Add(rs); @@ -540,7 +540,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat { m_log.InfoFormat("[IRC-Channel-{0}] Removing region {1} from channel <{2} to server <{3}:{4}>", - idn, rs.Region, IrcChannel, Server, Port); + idn, rs.Region, IrcChannel, Server, Port); if (clientregions.Contains(rs)) { diff --git a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs index 094fa6d..47d3265 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs @@ -241,7 +241,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat if (rs.Region == region) { responseData["server"] = rs.cs.Server; - responseData["port"] = rs.cs.Port; + responseData["port"] = (int)rs.cs.Port; responseData["user"] = rs.cs.User; responseData["channel"] = rs.cs.IrcChannel; responseData["enabled"] = rs.cs.irc.Enabled; diff --git a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCConnector.cs b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCConnector.cs index 3ebb226..c52375d 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCConnector.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCConnector.cs @@ -183,7 +183,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat m_baseNick = cs.BaseNickname; m_randomizeNick = cs.RandomizeNickname; m_ircChannel = cs.IrcChannel; - m_port = (uint) cs.Port; + m_port = cs.Port; m_user = cs.User; if (m_watchdog == null) 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 private List _scenes = new List(); private List _conciergedScenes = new List(); - private Dictionary> _sceneAttendees = new Dictionary>(); + private Dictionary> _sceneAttendees = new Dictionary>(); private bool _replacingChatModule = false; private IConfig _config; @@ -271,10 +271,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge if (_conciergedScenes.Contains(client.Scene)) { _log.DebugFormat("[Concierge]: {0} logs off from {1}", client.Name, client.Scene.RegionInfo.RegionName); - ScenePresence agent = (client.Scene as Scene).GetScenePresence(client.AgentId); - RemoveFromAttendeeList(agent, agent.Scene); - AnnounceToAgentsRegion(agent, String.Format(_announceLeaving, agent.Name, agent.Scene.RegionInfo.RegionName, - _sceneAttendees[agent.Scene].Count)); + RemoveFromAttendeeList(client.AgentId, client.Name, client.Scene); + AnnounceToAgentsRegion(client.Scene, String.Format(_announceLeaving, client.Name, client.Scene.RegionInfo.RegionName, + _sceneAttendees[client.Scene].Count)); } } @@ -284,10 +283,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge if (_conciergedScenes.Contains(agent.Scene)) { _log.DebugFormat("[Concierge]: {0} enters {1}", agent.Name, agent.Scene.RegionInfo.RegionName); - AddToAttendeeList(agent, agent.Scene); + AddToAttendeeList(agent.UUID, agent.Scene); WelcomeAvatar(agent, agent.Scene); - AnnounceToAgentsRegion(agent, String.Format(_announceEntering, agent.Name, agent.Scene.RegionInfo.RegionName, - _sceneAttendees[agent.Scene].Count)); + AnnounceToAgentsRegion(agent.Scene, String.Format(_announceEntering, agent.Name, agent.Scene.RegionInfo.RegionName, + _sceneAttendees[agent.Scene].Count)); } } @@ -297,25 +296,25 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge if (_conciergedScenes.Contains(agent.Scene)) { _log.DebugFormat("[Concierge]: {0} leaves {1}", agent.Name, agent.Scene.RegionInfo.RegionName); - RemoveFromAttendeeList(agent, agent.Scene); - AnnounceToAgentsRegion(agent, String.Format(_announceLeaving, agent.Name, agent.Scene.RegionInfo.RegionName, - _sceneAttendees[agent.Scene].Count)); + RemoveFromAttendeeList(agent.UUID, agent.Name, agent.Scene); + AnnounceToAgentsRegion(agent.Scene, String.Format(_announceLeaving, agent.Name, agent.Scene.RegionInfo.RegionName, + _sceneAttendees[agent.Scene].Count)); } } - protected void AddToAttendeeList(ScenePresence agent, Scene scene) + protected void AddToAttendeeList(UUID agentID, Scene scene) { lock (_sceneAttendees) { if (!_sceneAttendees.ContainsKey(scene)) - _sceneAttendees[scene] = new List(); - List attendees = _sceneAttendees[scene]; - if (!attendees.Contains(agent)) - attendees.Add(agent); + _sceneAttendees[scene] = new List(); + List attendees = _sceneAttendees[scene]; + if (!attendees.Contains(agentID)) + attendees.Add(agentID); } } - protected void RemoveFromAttendeeList(ScenePresence agent, Scene scene) + protected void RemoveFromAttendeeList(UUID agentID, String name, IScene scene) { lock (_sceneAttendees) { @@ -324,14 +323,14 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge _log.WarnFormat("[Concierge]: attendee list missing for region {0}", scene.RegionInfo.RegionName); return; } - List attendees = _sceneAttendees[scene]; - if (!attendees.Contains(agent)) + List attendees = _sceneAttendees[scene]; + if (!attendees.Contains(agentID)) { _log.WarnFormat("[Concierge]: avatar {0} sneaked in (not on attendee list of region {1})", - agent.Name, scene.RegionInfo.RegionName); + name, scene.RegionInfo.RegionName); return; } - attendees.Remove(agent); + attendees.Remove(agentID); } } @@ -375,16 +374,16 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge static private Vector3 PosOfGod = new Vector3(128, 128, 9999); - protected void AnnounceToAgentsRegion(IClientAPI client, string msg) - { - ScenePresence agent = null; - if ((client.Scene is Scene) && (client.Scene as Scene).TryGetAvatar(client.AgentId, out agent)) - AnnounceToAgentsRegion(agent, msg); - else - _log.DebugFormat("[Concierge]: could not find an agent for client {0}", client.Name); - } + // protected void AnnounceToAgentsRegion(Scene scene, string msg) + // { + // ScenePresence agent = null; + // if ((client.Scene is Scene) && (client.Scene as Scene).TryGetAvatar(client.AgentId, out agent)) + // AnnounceToAgentsRegion(agent, msg); + // else + // _log.DebugFormat("[Concierge]: could not find an agent for client {0}", client.Name); + // } - protected void AnnounceToAgentsRegion(ScenePresence scenePresence, string msg) + protected void AnnounceToAgentsRegion(IScene scene, string msg) { OSChatMessage c = new OSChatMessage(); c.Message = msg; @@ -394,9 +393,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge c.From = _whoami; c.Sender = null; c.SenderUUID = UUID.Zero; - c.Scene = scenePresence.Scene; + c.Scene = scene; - scenePresence.Scene.EventManager.TriggerOnChatBroadcast(this, c); + if (scene is Scene) + (scene as Scene).EventManager.TriggerOnChatBroadcast(this, c); } protected void AnnounceToAgent(ScenePresence agent, string msg) -- cgit v1.1