diff options
author | Melanie Thielker | 2008-11-22 23:54:53 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-11-22 23:54:53 +0000 |
commit | e082f108844484a2a5ea130e6f89c61ef4e8ccc2 (patch) | |
tree | f2cf135ddc7e78d213c148f0062c60751cca6605 | |
parent | Add root agent tracking to presence module (diff) | |
download | opensim-SC-e082f108844484a2a5ea130e6f89c61ef4e8ccc2.zip opensim-SC-e082f108844484a2a5ea130e6f89c61ef4e8ccc2.tar.gz opensim-SC-e082f108844484a2a5ea130e6f89c61ef4e8ccc2.tar.bz2 opensim-SC-e082f108844484a2a5ea130e6f89c61ef4e8ccc2.tar.xz |
Adding root agent position messages to the message server
-rw-r--r-- | OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs index 003ca8e..1b18f3c 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs | |||
@@ -130,11 +130,19 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage | |||
130 | return; | 130 | return; |
131 | 131 | ||
132 | m_RootAgents.Remove(client.AgentId); | 132 | m_RootAgents.Remove(client.AgentId); |
133 | |||
134 | NotifyMessageServerOfAgentLeaving(client.AgentId, scene.RegionInfo.RegionName); | ||
133 | } | 135 | } |
134 | 136 | ||
135 | public void OnSetRootAgentScene(UUID agentID, Scene scene) | 137 | public void OnSetRootAgentScene(UUID agentID, Scene scene) |
136 | { | 138 | { |
139 | if (m_RootAgents.ContainsKey(agentID)) | ||
140 | { | ||
141 | if (m_RootAgents[agentID] == scene) | ||
142 | return; | ||
143 | } | ||
137 | m_RootAgents[agentID] = scene; | 144 | m_RootAgents[agentID] = scene; |
145 | NotifyMessageServerOfAgentLocation(agentID, scene.RegionInfo.RegionName); | ||
138 | } | 146 | } |
139 | 147 | ||
140 | private void NotifyMessageServerOfStartup(Scene scene) | 148 | private void NotifyMessageServerOfStartup(Scene scene) |
@@ -168,5 +176,39 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage | |||
168 | m_log.ErrorFormat("[PRESENCE] Failed to notify message server of region shutdown for region {0}", scene.RegionInfo.RegionName); | 176 | m_log.ErrorFormat("[PRESENCE] Failed to notify message server of region shutdown for region {0}", scene.RegionInfo.RegionName); |
169 | } | 177 | } |
170 | } | 178 | } |
179 | |||
180 | private void NotifyMessageServerOfAgentLocation(UUID agentID, string region) | ||
181 | { | ||
182 | Hashtable xmlrpcdata = new Hashtable(); | ||
183 | xmlrpcdata["AgentID"] = agentID.ToString(); | ||
184 | xmlrpcdata["RegionName"] = region; | ||
185 | ArrayList SendParams = new ArrayList(); | ||
186 | SendParams.Add(xmlrpcdata); | ||
187 | XmlRpcRequest LocationRequest = new XmlRpcRequest("agent_location", SendParams); | ||
188 | XmlRpcResponse resp = LocationRequest.Send(m_Scenes[0].CommsManager.NetworkServersInfo.MessagingURL, 5000); | ||
189 | |||
190 | Hashtable responseData = (Hashtable)resp.Value; | ||
191 | if ((!responseData.ContainsKey("success")) || (string)responseData["success"] != "TRUE") | ||
192 | { | ||
193 | m_log.ErrorFormat("[PRESENCE] Failed to notify message server of agent location for {0}", agentID.ToString()); | ||
194 | } | ||
195 | } | ||
196 | |||
197 | private void NotifyMessageServerOfAgentLeaving(UUID agentID, string region) | ||
198 | { | ||
199 | Hashtable xmlrpcdata = new Hashtable(); | ||
200 | xmlrpcdata["AgentID"] = agentID.ToString(); | ||
201 | xmlrpcdata["RegionName"] = region; | ||
202 | ArrayList SendParams = new ArrayList(); | ||
203 | SendParams.Add(xmlrpcdata); | ||
204 | XmlRpcRequest LeavingRequest = new XmlRpcRequest("agent_leaving", SendParams); | ||
205 | XmlRpcResponse resp = LeavingRequest.Send(m_Scenes[0].CommsManager.NetworkServersInfo.MessagingURL, 5000); | ||
206 | |||
207 | Hashtable responseData = (Hashtable)resp.Value; | ||
208 | if ((!responseData.ContainsKey("success")) || (string)responseData["success"] != "TRUE") | ||
209 | { | ||
210 | m_log.ErrorFormat("[PRESENCE] Failed to notify message server of agent leaving for {0}", agentID.ToString()); | ||
211 | } | ||
212 | } | ||
171 | } | 213 | } |
172 | } | 214 | } |