diff options
author | Melanie Thielker | 2008-11-23 05:16:07 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-11-23 05:16:07 +0000 |
commit | cbd02218704287640ba5c7b564440a6590e038cf (patch) | |
tree | e600fd4868bce3e3d007d6d1894dd814d948692a /OpenSim/Region/Environment/Modules | |
parent | Mantis#2660. Thank you kindly, Ruud Lathrop for a patch that: (diff) | |
download | opensim-SC_OLD-cbd02218704287640ba5c7b564440a6590e038cf.zip opensim-SC_OLD-cbd02218704287640ba5c7b564440a6590e038cf.tar.gz opensim-SC_OLD-cbd02218704287640ba5c7b564440a6590e038cf.tar.bz2 opensim-SC_OLD-cbd02218704287640ba5c7b564440a6590e038cf.tar.xz |
Plumb in the presence notifications and region shutdown/restart messages
from the presence module to the message server, through the user server
and on into the database. This should fix the "Already logged in" issue
that grids see after a sim crashes, or a user crashes out of a sim.
Not yet a 100% solution for friends, but getting there.
Diffstat (limited to 'OpenSim/Region/Environment/Modules')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs index aa1db1d..7b358c2 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs | |||
@@ -114,10 +114,14 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage | |||
114 | public void OnNewClient(IClientAPI client) | 114 | public void OnNewClient(IClientAPI client) |
115 | { | 115 | { |
116 | client.OnConnectionClosed += OnConnectionClosed; | 116 | client.OnConnectionClosed += OnConnectionClosed; |
117 | client.OnLogout += OnConnectionClosed; | ||
117 | } | 118 | } |
118 | 119 | ||
119 | public void OnConnectionClosed(IClientAPI client) | 120 | public void OnConnectionClosed(IClientAPI client) |
120 | { | 121 | { |
122 | if (!(client.Scene is Scene)) | ||
123 | return; | ||
124 | |||
121 | if (!(m_RootAgents.ContainsKey(client.AgentId))) | 125 | if (!(m_RootAgents.ContainsKey(client.AgentId))) |
122 | return; | 126 | return; |
123 | 127 | ||
@@ -128,7 +132,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage | |||
128 | 132 | ||
129 | m_RootAgents.Remove(client.AgentId); | 133 | m_RootAgents.Remove(client.AgentId); |
130 | 134 | ||
131 | NotifyMessageServerOfAgentLeaving(client.AgentId, scene.RegionInfo.RegionName); | 135 | NotifyMessageServerOfAgentLeaving(client.AgentId, scene.RegionInfo.RegionID, scene.RegionInfo.RegionHandle); |
132 | } | 136 | } |
133 | 137 | ||
134 | public void OnSetRootAgentScene(UUID agentID, Scene scene) | 138 | public void OnSetRootAgentScene(UUID agentID, Scene scene) |
@@ -139,13 +143,13 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage | |||
139 | return; | 143 | return; |
140 | } | 144 | } |
141 | m_RootAgents[agentID] = scene; | 145 | m_RootAgents[agentID] = scene; |
142 | NotifyMessageServerOfAgentLocation(agentID, scene.RegionInfo.RegionName); | 146 | NotifyMessageServerOfAgentLocation(agentID, scene.RegionInfo.RegionID, scene.RegionInfo.RegionHandle); |
143 | } | 147 | } |
144 | 148 | ||
145 | private void NotifyMessageServerOfStartup(Scene scene) | 149 | private void NotifyMessageServerOfStartup(Scene scene) |
146 | { | 150 | { |
147 | Hashtable xmlrpcdata = new Hashtable(); | 151 | Hashtable xmlrpcdata = new Hashtable(); |
148 | xmlrpcdata["RegionName"] = scene.RegionInfo.RegionName; | 152 | xmlrpcdata["RegionUUID"] = scene.RegionInfo.RegionID.ToString(); |
149 | ArrayList SendParams = new ArrayList(); | 153 | ArrayList SendParams = new ArrayList(); |
150 | SendParams.Add(xmlrpcdata); | 154 | SendParams.Add(xmlrpcdata); |
151 | try | 155 | try |
@@ -154,7 +158,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage | |||
154 | XmlRpcResponse resp = UpRequest.Send(scene.CommsManager.NetworkServersInfo.MessagingURL, 5000); | 158 | XmlRpcResponse resp = UpRequest.Send(scene.CommsManager.NetworkServersInfo.MessagingURL, 5000); |
155 | 159 | ||
156 | Hashtable responseData = (Hashtable)resp.Value; | 160 | Hashtable responseData = (Hashtable)resp.Value; |
157 | if ((!responseData.ContainsKey("success")) || (string)responseData["success"] != "TRUE") | 161 | if (responseData == null || (!responseData.ContainsKey("success")) || (string)responseData["success"] != "TRUE") |
158 | { | 162 | { |
159 | m_log.ErrorFormat("[PRESENCE] Failed to notify message server of region startup for region {0}", scene.RegionInfo.RegionName); | 163 | m_log.ErrorFormat("[PRESENCE] Failed to notify message server of region startup for region {0}", scene.RegionInfo.RegionName); |
160 | } | 164 | } |
@@ -168,7 +172,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage | |||
168 | private void NotifyMessageServerOfShutdown(Scene scene) | 172 | private void NotifyMessageServerOfShutdown(Scene scene) |
169 | { | 173 | { |
170 | Hashtable xmlrpcdata = new Hashtable(); | 174 | Hashtable xmlrpcdata = new Hashtable(); |
171 | xmlrpcdata["RegionName"] = scene.RegionInfo.RegionName; | 175 | xmlrpcdata["RegionUUID"] = scene.RegionInfo.RegionID.ToString(); |
172 | ArrayList SendParams = new ArrayList(); | 176 | ArrayList SendParams = new ArrayList(); |
173 | SendParams.Add(xmlrpcdata); | 177 | SendParams.Add(xmlrpcdata); |
174 | try | 178 | try |
@@ -188,11 +192,12 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage | |||
188 | } | 192 | } |
189 | } | 193 | } |
190 | 194 | ||
191 | private void NotifyMessageServerOfAgentLocation(UUID agentID, string region) | 195 | private void NotifyMessageServerOfAgentLocation(UUID agentID, UUID region, ulong regionHandle) |
192 | { | 196 | { |
193 | Hashtable xmlrpcdata = new Hashtable(); | 197 | Hashtable xmlrpcdata = new Hashtable(); |
194 | xmlrpcdata["AgentID"] = agentID.ToString(); | 198 | xmlrpcdata["AgentID"] = agentID.ToString(); |
195 | xmlrpcdata["RegionName"] = region; | 199 | xmlrpcdata["RegionUUID"] = region.ToString(); |
200 | xmlrpcdata["RegionHandle"] = regionHandle.ToString(); | ||
196 | ArrayList SendParams = new ArrayList(); | 201 | ArrayList SendParams = new ArrayList(); |
197 | SendParams.Add(xmlrpcdata); | 202 | SendParams.Add(xmlrpcdata); |
198 | try | 203 | try |
@@ -212,11 +217,12 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage | |||
212 | } | 217 | } |
213 | } | 218 | } |
214 | 219 | ||
215 | private void NotifyMessageServerOfAgentLeaving(UUID agentID, string region) | 220 | private void NotifyMessageServerOfAgentLeaving(UUID agentID, UUID region, ulong regionHandle) |
216 | { | 221 | { |
217 | Hashtable xmlrpcdata = new Hashtable(); | 222 | Hashtable xmlrpcdata = new Hashtable(); |
218 | xmlrpcdata["AgentID"] = agentID.ToString(); | 223 | xmlrpcdata["AgentID"] = agentID.ToString(); |
219 | xmlrpcdata["RegionName"] = region; | 224 | xmlrpcdata["RegionUUID"] = region.ToString(); |
225 | xmlrpcdata["RegionHandle"] = regionHandle.ToString(); | ||
220 | ArrayList SendParams = new ArrayList(); | 226 | ArrayList SendParams = new ArrayList(); |
221 | SendParams.Add(xmlrpcdata); | 227 | SendParams.Add(xmlrpcdata); |
222 | try | 228 | try |