diff options
Removed use of 'is' operator and casting to find the root ScenePresence in MessageTransfer modules and Groups module.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | 52 |
1 files changed, 19 insertions, 33 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 45b84f4..0dad3c4 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | |||
@@ -136,24 +136,19 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
136 | // Try root avatar only first | 136 | // Try root avatar only first |
137 | foreach (Scene scene in m_Scenes) | 137 | foreach (Scene scene in m_Scenes) |
138 | { | 138 | { |
139 | if (scene.Entities.ContainsKey(toAgentID) && | 139 | // m_log.DebugFormat( |
140 | scene.Entities[toAgentID] is ScenePresence) | 140 | // "[INSTANT MESSAGE]: Looking for root agent {0} in {1}", |
141 | // toAgentID.ToString(), scene.RegionInfo.RegionName); | ||
142 | ScenePresence sp = scene.GetScenePresence(toAgentID); | ||
143 | if (sp != null && !sp.IsChildAgent) | ||
141 | { | 144 | { |
142 | // m_log.DebugFormat( | 145 | // Local message |
143 | // "[INSTANT MESSAGE]: Looking for root agent {0} in {1}", | 146 | // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", user.Name, toAgentID); |
144 | // toAgentID.ToString(), scene.RegionInfo.RegionName); | 147 | sp.ControllingClient.SendInstantMessage(im); |
145 | 148 | ||
146 | ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; | 149 | // Message sent |
147 | if (!user.IsChildAgent) | 150 | result(true); |
148 | { | 151 | return; |
149 | // Local message | ||
150 | // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", user.Name, toAgentID); | ||
151 | user.ControllingClient.SendInstantMessage(im); | ||
152 | |||
153 | // Message sent | ||
154 | result(true); | ||
155 | return; | ||
156 | } | ||
157 | } | 152 | } |
158 | } | 153 | } |
159 | 154 | ||
@@ -162,15 +157,12 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
162 | { | 157 | { |
163 | // m_log.DebugFormat( | 158 | // m_log.DebugFormat( |
164 | // "[INSTANT MESSAGE]: Looking for child of {0} in {1}", toAgentID, scene.RegionInfo.RegionName); | 159 | // "[INSTANT MESSAGE]: Looking for child of {0} in {1}", toAgentID, scene.RegionInfo.RegionName); |
165 | 160 | ScenePresence sp = scene.GetScenePresence(toAgentID); | |
166 | if (scene.Entities.ContainsKey(toAgentID) && | 161 | if (sp != null) |
167 | scene.Entities[toAgentID] is ScenePresence) | ||
168 | { | 162 | { |
169 | // Local message | 163 | // Local message |
170 | ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; | ||
171 | |||
172 | // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID); | 164 | // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID); |
173 | user.ControllingClient.SendInstantMessage(im); | 165 | sp.ControllingClient.SendInstantMessage(im); |
174 | 166 | ||
175 | // Message sent | 167 | // Message sent |
176 | result(true); | 168 | result(true); |
@@ -389,17 +381,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
389 | // Trigger the Instant message in the scene. | 381 | // Trigger the Instant message in the scene. |
390 | foreach (Scene scene in m_Scenes) | 382 | foreach (Scene scene in m_Scenes) |
391 | { | 383 | { |
392 | if (scene.Entities.ContainsKey(toAgentID) && | 384 | ScenePresence sp = scene.GetScenePresence(toAgentID); |
393 | scene.Entities[toAgentID] is ScenePresence) | 385 | if (sp != null && !sp.IsChildAgent) |
394 | { | 386 | { |
395 | ScenePresence user = | 387 | scene.EventManager.TriggerIncomingInstantMessage(gim); |
396 | (ScenePresence)scene.Entities[toAgentID]; | 388 | successful = true; |
397 | |||
398 | if (!user.IsChildAgent) | ||
399 | { | ||
400 | scene.EventManager.TriggerIncomingInstantMessage(gim); | ||
401 | successful = true; | ||
402 | } | ||
403 | } | 389 | } |
404 | } | 390 | } |
405 | if (!successful) | 391 | if (!successful) |