diff options
author | Diva Canto | 2011-05-26 10:04:48 -0700 |
---|---|---|
committer | Diva Canto | 2011-05-26 10:04:48 -0700 |
commit | 0c58a9e68074f3593920dc9f2356bbed96416497 (patch) | |
tree | 6bccb313c233ab6486195e8a3663cfa1d30c41b9 /OpenSim/Region/CoreModules | |
parent | HG: Renamed, shuffled some interfaces around. Move them all to IHypergridServ... (diff) | |
download | opensim-SC-0c58a9e68074f3593920dc9f2356bbed96416497.zip opensim-SC-0c58a9e68074f3593920dc9f2356bbed96416497.tar.gz opensim-SC-0c58a9e68074f3593920dc9f2356bbed96416497.tar.bz2 opensim-SC-0c58a9e68074f3593920dc9f2356bbed96416497.tar.xz |
HG IM in grid mode working fairly well. Unknown target user references looked back in source user's User Agent service.
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs index 9ba4e49..ed02119 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs | |||
@@ -194,6 +194,22 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
194 | Util.FireAndForget(delegate | 194 | Util.FireAndForget(delegate |
195 | { | 195 | { |
196 | bool success = m_IMService.OutgoingInstantMessage(im, url); | 196 | bool success = m_IMService.OutgoingInstantMessage(im, url); |
197 | if (!success && account == null) | ||
198 | { | ||
199 | // One last chance | ||
200 | string recipientUUI = TryGetRecipientUUI(new UUID(im.fromAgentID), toAgentID); | ||
201 | m_log.DebugFormat("[HG MESSAGE TRANSFER]: Got UUI {0}", recipientUUI); | ||
202 | if (recipientUUI != string.Empty) | ||
203 | { | ||
204 | UUID id; string u = string.Empty, first = string.Empty, last = string.Empty, secret = string.Empty; | ||
205 | if (Util.ParseUniversalUserIdentifier(recipientUUI, out id, out u, out first, out last, out secret)) | ||
206 | { | ||
207 | success = m_IMService.OutgoingInstantMessage(im, u); | ||
208 | if (success) | ||
209 | UserManagementModule.AddUser(toAgentID, u + ";" + first + " " + last); | ||
210 | } | ||
211 | } | ||
212 | } | ||
197 | result(success); | 213 | result(success); |
198 | }); | 214 | }); |
199 | 215 | ||
@@ -254,6 +270,64 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
254 | result(false); | 270 | result(false); |
255 | } | 271 | } |
256 | 272 | ||
273 | private string TryGetRecipientUUI(UUID fromAgent, UUID toAgent) | ||
274 | { | ||
275 | // Let's call back the fromAgent's user agent service | ||
276 | // Maybe that service knows about the toAgent | ||
277 | IClientAPI client = LocateClientObject(fromAgent); | ||
278 | if (client != null) | ||
279 | { | ||
280 | AgentCircuitData circuit = m_Scenes[0].AuthenticateHandler.GetAgentCircuitData(client.AgentId); | ||
281 | if (circuit != null) | ||
282 | { | ||
283 | if (circuit.ServiceURLs.ContainsKey("HomeURI")) | ||
284 | { | ||
285 | string uasURL = circuit.ServiceURLs["HomeURI"].ToString(); | ||
286 | m_log.DebugFormat("[HG MESSAGE TRANSFER]: getting UUI of user {0} from {1}", toAgent, uasURL); | ||
287 | UserAgentServiceConnector uasConn = new UserAgentServiceConnector(uasURL); | ||
288 | return uasConn.GetUUI(fromAgent, toAgent); | ||
289 | } | ||
290 | } | ||
291 | } | ||
292 | |||
293 | return string.Empty; | ||
294 | } | ||
295 | |||
296 | |||
297 | /// <summary> | ||
298 | /// Find the scene for an agent | ||
299 | /// </summary> | ||
300 | private Scene GetClientScene(UUID agentId) | ||
301 | { | ||
302 | lock (m_Scenes) | ||
303 | { | ||
304 | foreach (Scene scene in m_Scenes) | ||
305 | { | ||
306 | ScenePresence presence = scene.GetScenePresence(agentId); | ||
307 | if (presence != null && !presence.IsChildAgent) | ||
308 | return scene; | ||
309 | } | ||
310 | } | ||
311 | |||
312 | return null; | ||
313 | } | ||
314 | |||
315 | /// <summary> | ||
316 | /// Find the client for a ID | ||
317 | /// </summary> | ||
318 | public IClientAPI LocateClientObject(UUID agentID) | ||
319 | { | ||
320 | Scene scene = GetClientScene(agentID); | ||
321 | if (scene != null) | ||
322 | { | ||
323 | ScenePresence presence = scene.GetScenePresence(agentID); | ||
324 | if (presence != null) | ||
325 | return presence.ControllingClient; | ||
326 | } | ||
327 | |||
328 | return null; | ||
329 | } | ||
330 | |||
257 | #region IInstantMessageSimConnector | 331 | #region IInstantMessageSimConnector |
258 | public bool SendInstantMessage(GridInstantMessage im) | 332 | public bool SendInstantMessage(GridInstantMessage im) |
259 | { | 333 | { |