- 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
0.6.0-stable
Dr Scofield 2008-11-06 13:13:08 +00:00
parent 44b0c59ba9
commit 09f86d7e99
5 changed files with 40 additions and 40 deletions

View File

@ -486,10 +486,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
{ {
m_log.InfoFormat("[IRC-Channel-{0}] Closing channel <{1} to server <{2}:{3}>", 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", m_log.InfoFormat("[IRC-Channel-{0}] There are {1} active clients",
idn, clientregions.Count); idn, clientregions.Count);
irc.Close(); irc.Close();
@ -498,7 +498,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
public void Open() public void Open()
{ {
m_log.InfoFormat("[IRC-Channel-{0}] Opening channel <{1} to server <{2}:{3}>", m_log.InfoFormat("[IRC-Channel-{0}] Opening channel <{1} to server <{2}:{3}>",
idn, IrcChannel, Server, Port); idn, IrcChannel, Server, Port);
irc.Open(); irc.Open();
@ -524,7 +524,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
public void AddRegion(RegionState rs) public void AddRegion(RegionState rs)
{ {
m_log.InfoFormat("[IRC-Channel-{0}] Adding region {1} to channel <{2} to server <{3}:{4}>", 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)) if (!clientregions.Contains(rs))
{ {
clientregions.Add(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}>", 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)) if (clientregions.Contains(rs))
{ {

View File

@ -241,7 +241,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
if (rs.Region == region) if (rs.Region == region)
{ {
responseData["server"] = rs.cs.Server; responseData["server"] = rs.cs.Server;
responseData["port"] = rs.cs.Port; responseData["port"] = (int)rs.cs.Port;
responseData["user"] = rs.cs.User; responseData["user"] = rs.cs.User;
responseData["channel"] = rs.cs.IrcChannel; responseData["channel"] = rs.cs.IrcChannel;
responseData["enabled"] = rs.cs.irc.Enabled; responseData["enabled"] = rs.cs.irc.Enabled;

View File

@ -183,7 +183,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
m_baseNick = cs.BaseNickname; m_baseNick = cs.BaseNickname;
m_randomizeNick = cs.RandomizeNickname; m_randomizeNick = cs.RandomizeNickname;
m_ircChannel = cs.IrcChannel; m_ircChannel = cs.IrcChannel;
m_port = (uint) cs.Port; m_port = cs.Port;
m_user = cs.User; m_user = cs.User;
if (m_watchdog == null) if (m_watchdog == null)

View File

@ -53,7 +53,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge
private List<IScene> _scenes = new List<IScene>(); private List<IScene> _scenes = new List<IScene>();
private List<IScene> _conciergedScenes = new List<IScene>(); private List<IScene> _conciergedScenes = new List<IScene>();
private Dictionary<IScene, List<ScenePresence>> _sceneAttendees = new Dictionary<IScene, List<ScenePresence>>(); private Dictionary<IScene, List<UUID>> _sceneAttendees = new Dictionary<IScene, List<UUID>>();
private bool _replacingChatModule = false; private bool _replacingChatModule = false;
private IConfig _config; private IConfig _config;
@ -271,10 +271,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge
if (_conciergedScenes.Contains(client.Scene)) if (_conciergedScenes.Contains(client.Scene))
{ {
_log.DebugFormat("[Concierge]: {0} logs off from {1}", client.Name, client.Scene.RegionInfo.RegionName); _log.DebugFormat("[Concierge]: {0} logs off from {1}", client.Name, client.Scene.RegionInfo.RegionName);
ScenePresence agent = (client.Scene as Scene).GetScenePresence(client.AgentId); RemoveFromAttendeeList(client.AgentId, client.Name, client.Scene);
RemoveFromAttendeeList(agent, agent.Scene); AnnounceToAgentsRegion(client.Scene, String.Format(_announceLeaving, client.Name, client.Scene.RegionInfo.RegionName,
AnnounceToAgentsRegion(agent, String.Format(_announceLeaving, agent.Name, agent.Scene.RegionInfo.RegionName, _sceneAttendees[client.Scene].Count));
_sceneAttendees[agent.Scene].Count));
} }
} }
@ -284,10 +283,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge
if (_conciergedScenes.Contains(agent.Scene)) if (_conciergedScenes.Contains(agent.Scene))
{ {
_log.DebugFormat("[Concierge]: {0} enters {1}", agent.Name, agent.Scene.RegionInfo.RegionName); _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); WelcomeAvatar(agent, agent.Scene);
AnnounceToAgentsRegion(agent, String.Format(_announceEntering, agent.Name, agent.Scene.RegionInfo.RegionName, AnnounceToAgentsRegion(agent.Scene, String.Format(_announceEntering, agent.Name, agent.Scene.RegionInfo.RegionName,
_sceneAttendees[agent.Scene].Count)); _sceneAttendees[agent.Scene].Count));
} }
} }
@ -297,25 +296,25 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge
if (_conciergedScenes.Contains(agent.Scene)) if (_conciergedScenes.Contains(agent.Scene))
{ {
_log.DebugFormat("[Concierge]: {0} leaves {1}", agent.Name, agent.Scene.RegionInfo.RegionName); _log.DebugFormat("[Concierge]: {0} leaves {1}", agent.Name, agent.Scene.RegionInfo.RegionName);
RemoveFromAttendeeList(agent, agent.Scene); RemoveFromAttendeeList(agent.UUID, agent.Name, agent.Scene);
AnnounceToAgentsRegion(agent, String.Format(_announceLeaving, agent.Name, agent.Scene.RegionInfo.RegionName, AnnounceToAgentsRegion(agent.Scene, String.Format(_announceLeaving, agent.Name, agent.Scene.RegionInfo.RegionName,
_sceneAttendees[agent.Scene].Count)); _sceneAttendees[agent.Scene].Count));
} }
} }
protected void AddToAttendeeList(ScenePresence agent, Scene scene) protected void AddToAttendeeList(UUID agentID, Scene scene)
{ {
lock (_sceneAttendees) lock (_sceneAttendees)
{ {
if (!_sceneAttendees.ContainsKey(scene)) if (!_sceneAttendees.ContainsKey(scene))
_sceneAttendees[scene] = new List<ScenePresence>(); _sceneAttendees[scene] = new List<UUID>();
List<ScenePresence> attendees = _sceneAttendees[scene]; List<UUID> attendees = _sceneAttendees[scene];
if (!attendees.Contains(agent)) if (!attendees.Contains(agentID))
attendees.Add(agent); attendees.Add(agentID);
} }
} }
protected void RemoveFromAttendeeList(ScenePresence agent, Scene scene) protected void RemoveFromAttendeeList(UUID agentID, String name, IScene scene)
{ {
lock (_sceneAttendees) 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); _log.WarnFormat("[Concierge]: attendee list missing for region {0}", scene.RegionInfo.RegionName);
return; return;
} }
List<ScenePresence> attendees = _sceneAttendees[scene]; List<UUID> attendees = _sceneAttendees[scene];
if (!attendees.Contains(agent)) if (!attendees.Contains(agentID))
{ {
_log.WarnFormat("[Concierge]: avatar {0} sneaked in (not on attendee list of region {1})", _log.WarnFormat("[Concierge]: avatar {0} sneaked in (not on attendee list of region {1})",
agent.Name, scene.RegionInfo.RegionName); name, scene.RegionInfo.RegionName);
return; 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); static private Vector3 PosOfGod = new Vector3(128, 128, 9999);
protected void AnnounceToAgentsRegion(IClientAPI client, string msg) // protected void AnnounceToAgentsRegion(Scene scene, string msg)
{ // {
ScenePresence agent = null; // ScenePresence agent = null;
if ((client.Scene is Scene) && (client.Scene as Scene).TryGetAvatar(client.AgentId, out agent)) // if ((client.Scene is Scene) && (client.Scene as Scene).TryGetAvatar(client.AgentId, out agent))
AnnounceToAgentsRegion(agent, msg); // AnnounceToAgentsRegion(agent, msg);
else // else
_log.DebugFormat("[Concierge]: could not find an agent for client {0}", client.Name); // _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(); OSChatMessage c = new OSChatMessage();
c.Message = msg; c.Message = msg;
@ -394,9 +393,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge
c.From = _whoami; c.From = _whoami;
c.Sender = null; c.Sender = null;
c.SenderUUID = UUID.Zero; 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) protected void AnnounceToAgent(ScenePresence agent, string msg)

View File

@ -2360,7 +2360,7 @@ namespace OpenSim.Region.Environment.Scenes
public void AttachObject(IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att) public void AttachObject(IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att)
{ {
if (null == itemID) if (UUID.Zero == itemID)
{ {
m_log.Error("[SCENE INVENTORY]: Unable to save attachment. Error inventory item ID."); m_log.Error("[SCENE INVENTORY]: Unable to save attachment. Error inventory item ID.");
return; return;