diff options
author | Diva Canto | 2010-01-07 15:53:55 -0800 |
---|---|---|
committer | Diva Canto | 2010-01-07 15:53:55 -0800 |
commit | f11a97f12d328af8bb39b92fec5cb5780983b66a (patch) | |
tree | 00f96f853b91e105786b416dd18f2c76e56fd1fd /OpenSim/Region/CoreModules | |
parent | Merge branch 'master' into presence-refactor (diff) | |
download | opensim-SC_OLD-f11a97f12d328af8bb39b92fec5cb5780983b66a.zip opensim-SC_OLD-f11a97f12d328af8bb39b92fec5cb5780983b66a.tar.gz opensim-SC_OLD-f11a97f12d328af8bb39b92fec5cb5780983b66a.tar.bz2 opensim-SC_OLD-f11a97f12d328af8bb39b92fec5cb5780983b66a.tar.xz |
* Finished SimulationServiceConnector
* Started rerouting calls to UserService.
* Compiles. May run.
Diffstat (limited to 'OpenSim/Region/CoreModules')
7 files changed, 83 insertions, 60 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 2d4b421..c0d3f31 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | |||
@@ -37,6 +37,8 @@ using OpenSim.Framework; | |||
37 | using OpenSim.Region.Framework.Interfaces; | 37 | using OpenSim.Region.Framework.Interfaces; |
38 | using OpenSim.Region.Framework.Scenes; | 38 | using OpenSim.Region.Framework.Scenes; |
39 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 39 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
40 | using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; | ||
41 | using OpenSim.Services.Interfaces; | ||
40 | 42 | ||
41 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | 43 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage |
42 | { | 44 | { |
@@ -46,10 +48,21 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
46 | 48 | ||
47 | private bool m_Enabled = false; | 49 | private bool m_Enabled = false; |
48 | protected List<Scene> m_Scenes = new List<Scene>(); | 50 | protected List<Scene> m_Scenes = new List<Scene>(); |
49 | protected Dictionary<UUID, ulong> m_UserRegionMap = new Dictionary<UUID, ulong>(); | 51 | protected Dictionary<UUID, UUID> m_UserRegionMap = new Dictionary<UUID, UUID>(); |
50 | 52 | ||
51 | public event UndeliveredMessage OnUndeliveredMessage; | 53 | public event UndeliveredMessage OnUndeliveredMessage; |
52 | 54 | ||
55 | private IPresenceService m_PresenceService; | ||
56 | protected IPresenceService PresenceService | ||
57 | { | ||
58 | get | ||
59 | { | ||
60 | if (m_PresenceService == null) | ||
61 | m_PresenceService = m_Scenes[0].RequestModuleInterface<IPresenceService>(); | ||
62 | return m_PresenceService; | ||
63 | } | ||
64 | } | ||
65 | |||
53 | public virtual void Initialise(IConfigSource config) | 66 | public virtual void Initialise(IConfigSource config) |
54 | { | 67 | { |
55 | IConfig cnf = config.Configs["Messaging"]; | 68 | IConfig cnf = config.Configs["Messaging"]; |
@@ -416,7 +429,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
416 | /// <summary> | 429 | /// <summary> |
417 | /// delegate for sending a grid instant message asynchronously | 430 | /// delegate for sending a grid instant message asynchronously |
418 | /// </summary> | 431 | /// </summary> |
419 | public delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result, ulong prevRegionHandle); | 432 | public delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID); |
420 | 433 | ||
421 | protected virtual void GridInstantMessageCompleted(IAsyncResult iar) | 434 | protected virtual void GridInstantMessageCompleted(IAsyncResult iar) |
422 | { | 435 | { |
@@ -430,7 +443,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
430 | { | 443 | { |
431 | GridInstantMessageDelegate d = SendGridInstantMessageViaXMLRPCAsync; | 444 | GridInstantMessageDelegate d = SendGridInstantMessageViaXMLRPCAsync; |
432 | 445 | ||
433 | d.BeginInvoke(im, result, 0, GridInstantMessageCompleted, d); | 446 | d.BeginInvoke(im, result, UUID.Zero, GridInstantMessageCompleted, d); |
434 | } | 447 | } |
435 | 448 | ||
436 | /// <summary> | 449 | /// <summary> |
@@ -445,11 +458,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
445 | /// Pass in 0 the first time this method is called. It will be called recursively with the last | 458 | /// Pass in 0 the first time this method is called. It will be called recursively with the last |
446 | /// regionhandle tried | 459 | /// regionhandle tried |
447 | /// </param> | 460 | /// </param> |
448 | protected virtual void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result, ulong prevRegionHandle) | 461 | protected virtual void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID) |
449 | { | 462 | { |
450 | UUID toAgentID = new UUID(im.toAgentID); | 463 | UUID toAgentID = new UUID(im.toAgentID); |
451 | 464 | ||
452 | UserAgentData upd = null; | 465 | PresenceInfo upd = null; |
453 | 466 | ||
454 | bool lookupAgent = false; | 467 | bool lookupAgent = false; |
455 | 468 | ||
@@ -457,13 +470,13 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
457 | { | 470 | { |
458 | if (m_UserRegionMap.ContainsKey(toAgentID)) | 471 | if (m_UserRegionMap.ContainsKey(toAgentID)) |
459 | { | 472 | { |
460 | upd = new UserAgentData(); | 473 | upd = new PresenceInfo(); |
461 | upd.AgentOnline = true; | 474 | upd.Online = true; |
462 | upd.Handle = m_UserRegionMap[toAgentID]; | 475 | upd.RegionID = m_UserRegionMap[toAgentID]; |
463 | 476 | ||
464 | // We need to compare the current regionhandle with the previous region handle | 477 | // We need to compare the current regionhandle with the previous region handle |
465 | // or the recursive loop will never end because it will never try to lookup the agent again | 478 | // or the recursive loop will never end because it will never try to lookup the agent again |
466 | if (prevRegionHandle == upd.Handle) | 479 | if (prevRegionID == upd.RegionID) |
467 | { | 480 | { |
468 | lookupAgent = true; | 481 | lookupAgent = true; |
469 | } | 482 | } |
@@ -479,14 +492,23 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
479 | if (lookupAgent) | 492 | if (lookupAgent) |
480 | { | 493 | { |
481 | // Non-cached user agent lookup. | 494 | // Non-cached user agent lookup. |
482 | upd = m_Scenes[0].CommsManager.UserService.GetAgentByUUID(toAgentID); | 495 | PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() }); |
496 | if (presences != null) | ||
497 | { | ||
498 | foreach (PresenceInfo p in presences) | ||
499 | if (p.Online) | ||
500 | { | ||
501 | upd = presences[0]; | ||
502 | break; | ||
503 | } | ||
504 | } | ||
483 | 505 | ||
484 | if (upd != null) | 506 | if (upd != null) |
485 | { | 507 | { |
486 | // check if we've tried this before.. | 508 | // check if we've tried this before.. |
487 | // This is one way to end the recursive loop | 509 | // This is one way to end the recursive loop |
488 | // | 510 | // |
489 | if (upd.Handle == prevRegionHandle) | 511 | if (upd.RegionID == prevRegionID) |
490 | { | 512 | { |
491 | m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); | 513 | m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); |
492 | HandleUndeliveredMessage(im, result); | 514 | HandleUndeliveredMessage(im, result); |
@@ -503,12 +525,10 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
503 | 525 | ||
504 | if (upd != null) | 526 | if (upd != null) |
505 | { | 527 | { |
506 | if (upd.AgentOnline) | 528 | if (upd.Online) |
507 | { | 529 | { |
508 | uint x = 0, y = 0; | 530 | GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, |
509 | Utils.LongToUInts(upd.Handle, out x, out y); | 531 | upd.RegionID); |
510 | GridRegion reginfo = m_Scenes[0].GridService.GetRegionByPosition(m_Scenes[0].RegionInfo.ScopeID, | ||
511 | (int)x, (int)y); | ||
512 | if (reginfo != null) | 532 | if (reginfo != null) |
513 | { | 533 | { |
514 | Hashtable msgdata = ConvertGridInstantMessageToXMLRPC(im); | 534 | Hashtable msgdata = ConvertGridInstantMessageToXMLRPC(im); |
@@ -524,11 +544,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
524 | { | 544 | { |
525 | if (m_UserRegionMap.ContainsKey(toAgentID)) | 545 | if (m_UserRegionMap.ContainsKey(toAgentID)) |
526 | { | 546 | { |
527 | m_UserRegionMap[toAgentID] = upd.Handle; | 547 | m_UserRegionMap[toAgentID] = upd.RegionID; |
528 | } | 548 | } |
529 | else | 549 | else |
530 | { | 550 | { |
531 | m_UserRegionMap.Add(toAgentID, upd.Handle); | 551 | m_UserRegionMap.Add(toAgentID, upd.RegionID); |
532 | } | 552 | } |
533 | } | 553 | } |
534 | result(true); | 554 | result(true); |
@@ -543,12 +563,12 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
543 | 563 | ||
544 | // This is recursive!!!!! | 564 | // This is recursive!!!!! |
545 | SendGridInstantMessageViaXMLRPCAsync(im, result, | 565 | SendGridInstantMessageViaXMLRPCAsync(im, result, |
546 | upd.Handle); | 566 | upd.RegionID); |
547 | } | 567 | } |
548 | } | 568 | } |
549 | else | 569 | else |
550 | { | 570 | { |
551 | m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", upd.Handle); | 571 | m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", upd.RegionID); |
552 | HandleUndeliveredMessage(im, result); | 572 | HandleUndeliveredMessage(im, result); |
553 | } | 573 | } |
554 | } | 574 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index ecd60bd..6da43a8 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -335,7 +335,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
335 | 335 | ||
336 | try | 336 | try |
337 | { | 337 | { |
338 | if (m_aScene.CommsManager.UserService.AuthenticateUserByPassword(userInfo.UserProfile.ID, pass)) | 338 | if (m_aScene.AuthenticationService.Authenticate(userInfo.UserProfile.ID, pass, 1) != string.Empty) |
339 | { | 339 | { |
340 | return userInfo; | 340 | return userInfo; |
341 | } | 341 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs b/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs index 8cf58c6..718ee2f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs | |||
@@ -110,7 +110,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profiles | |||
110 | public void RequestAvatarProperty(IClientAPI remoteClient, UUID avatarID) | 110 | public void RequestAvatarProperty(IClientAPI remoteClient, UUID avatarID) |
111 | { | 111 | { |
112 | // FIXME: finish adding fields such as url, masking, etc. | 112 | // FIXME: finish adding fields such as url, masking, etc. |
113 | UserProfileData profile = m_scene.CommsManager.UserService.GetUserProfile(avatarID); | 113 | UserProfileData profile = null; // m_scene.CommsManager.UserService.GetUserProfile(avatarID); |
114 | if (null != profile) | 114 | if (null != profile) |
115 | { | 115 | { |
116 | Byte[] charterMember; | 116 | Byte[] charterMember; |
@@ -143,26 +143,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Profiles | |||
143 | 143 | ||
144 | public void UpdateAvatarProperties(IClientAPI remoteClient, UserProfileData newProfile) | 144 | public void UpdateAvatarProperties(IClientAPI remoteClient, UserProfileData newProfile) |
145 | { | 145 | { |
146 | UserProfileData Profile = m_scene.CommsManager.UserService.GetUserProfile(newProfile.ID); | 146 | return; |
147 | 147 | //UserProfileData Profile = m_scene.CommsManager.UserService.GetUserProfile(newProfile.ID); | |
148 | // if it's the profile of the user requesting the update, then we change only a few things. | 148 | |
149 | if (remoteClient.AgentId.CompareTo(Profile.ID) == 0) | 149 | //// if it's the profile of the user requesting the update, then we change only a few things. |
150 | { | 150 | //if (remoteClient.AgentId.CompareTo(Profile.ID) == 0) |
151 | Profile.Image = newProfile.Image; | 151 | //{ |
152 | Profile.FirstLifeImage = newProfile.FirstLifeImage; | 152 | // Profile.Image = newProfile.Image; |
153 | Profile.AboutText = newProfile.AboutText; | 153 | // Profile.FirstLifeImage = newProfile.FirstLifeImage; |
154 | Profile.FirstLifeAboutText = newProfile.FirstLifeAboutText; | 154 | // Profile.AboutText = newProfile.AboutText; |
155 | Profile.ProfileUrl = newProfile.ProfileUrl; | 155 | // Profile.FirstLifeAboutText = newProfile.FirstLifeAboutText; |
156 | } | 156 | // Profile.ProfileUrl = newProfile.ProfileUrl; |
157 | else | 157 | //} |
158 | { | 158 | //else |
159 | return; | 159 | //{ |
160 | } | 160 | // return; |
161 | 161 | //} | |
162 | if (m_scene.CommsManager.UserService.UpdateUserProfile(Profile)) | 162 | |
163 | { | 163 | //if (m_scene.CommsManager.UserService.UpdateUserProfile(Profile)) |
164 | RequestAvatarProperty(remoteClient, newProfile.ID); | 164 | //{ |
165 | } | 165 | // RequestAvatarProperty(remoteClient, newProfile.ID); |
166 | //} | ||
166 | } | 167 | } |
167 | } | 168 | } |
168 | } | 169 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs index 68499f3..01a2615 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs | |||
@@ -139,9 +139,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization | |||
139 | 139 | ||
140 | if (scene != null) | 140 | if (scene != null) |
141 | { | 141 | { |
142 | UserProfileData profile = scene.CommsManager.UserService.GetUserProfile(new UUID(userID)); | 142 | UserAccount account = scene.UserAccountService.GetUserAccount(UUID.Zero, userID); |
143 | isAuthorized = IsAuthorizedForRegion(userID, profile.FirstName, profile.SurName, | 143 | isAuthorized = IsAuthorizedForRegion(userID, account.FirstName, account.LastName, |
144 | profile.Email, scene.RegionInfo.RegionName, regionID, out message); | 144 | account.Email, scene.RegionInfo.RegionName, regionID, out message); |
145 | } | 145 | } |
146 | else | 146 | else |
147 | { | 147 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs index e8e140a..6c69570 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs | |||
@@ -59,7 +59,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence | |||
59 | 59 | ||
60 | public string Name | 60 | public string Name |
61 | { | 61 | { |
62 | get { return "RemotePresenceServiceConnector"; } | 62 | get { return "RemotePresenceServicesConnector"; } |
63 | } | 63 | } |
64 | 64 | ||
65 | public void Initialise(IConfigSource source) | 65 | public void Initialise(IConfigSource source) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index 074bfb5..c6c6af0 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs | |||
@@ -172,12 +172,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
172 | { | 172 | { |
173 | if (s.RegionInfo.RegionHandle == destination.RegionHandle) | 173 | if (s.RegionInfo.RegionHandle == destination.RegionHandle) |
174 | { | 174 | { |
175 | // m_log.DebugFormat("[LOCAL COMMS]: Found region {0} to send SendCreateChildAgent", regionHandle); | 175 | m_log.DebugFormat("[LOCAL COMMS]: Found region {0} to send SendCreateChildAgent", destination.RegionName); |
176 | return s.NewUserConnection(aCircuit, teleportFlags, out reason); | 176 | return s.NewUserConnection(aCircuit, teleportFlags, out reason); |
177 | } | 177 | } |
178 | } | 178 | } |
179 | 179 | ||
180 | // m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for SendCreateChildAgent", regionHandle); | 180 | m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for SendCreateChildAgent", destination.RegionName); |
181 | reason = "Did not find region " + destination.RegionName; | 181 | reason = "Did not find region " + destination.RegionName; |
182 | return false; | 182 | return false; |
183 | } | 183 | } |
@@ -241,14 +241,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
241 | return false; | 241 | return false; |
242 | } | 242 | } |
243 | 243 | ||
244 | public bool ReleaseAgent(GridRegion destination, UUID id, string uri) | 244 | public bool ReleaseAgent(UUID origin, UUID id, string uri) |
245 | { | 245 | { |
246 | if (destination == null) | ||
247 | return false; | ||
248 | |||
249 | foreach (Scene s in m_sceneList) | 246 | foreach (Scene s in m_sceneList) |
250 | { | 247 | { |
251 | if (s.RegionInfo.RegionHandle == destination.RegionHandle) | 248 | if (s.RegionInfo.RegionID == origin) |
252 | { | 249 | { |
253 | //m_log.Debug("[LOCAL COMMS]: Found region to SendReleaseAgent"); | 250 | //m_log.Debug("[LOCAL COMMS]: Found region to SendReleaseAgent"); |
254 | return s.IncomingReleaseAgent(id); | 251 | return s.IncomingReleaseAgent(id); |
@@ -334,6 +331,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
334 | return false; | 331 | return false; |
335 | } | 332 | } |
336 | 333 | ||
334 | public bool IsLocalRegion(UUID id) | ||
335 | { | ||
336 | foreach (Scene s in m_sceneList) | ||
337 | if (s.RegionInfo.RegionID == id) | ||
338 | return true; | ||
339 | return false; | ||
340 | } | ||
341 | |||
337 | #endregion | 342 | #endregion |
338 | } | 343 | } |
339 | } | 344 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index c9cc368..f485cd1 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs | |||
@@ -245,18 +245,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
245 | 245 | ||
246 | } | 246 | } |
247 | 247 | ||
248 | public bool ReleaseAgent(GridRegion destination, UUID id, string uri) | 248 | public bool ReleaseAgent(UUID origin, UUID id, string uri) |
249 | { | 249 | { |
250 | if (destination == null) | ||
251 | return false; | ||
252 | |||
253 | // Try local first | 250 | // Try local first |
254 | if (m_localBackend.ReleaseAgent(destination, id, uri)) | 251 | if (m_localBackend.ReleaseAgent(origin, id, uri)) |
255 | return true; | 252 | return true; |
256 | 253 | ||
257 | // else do the remote thing | 254 | // else do the remote thing |
258 | if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) | 255 | if (!m_localBackend.IsLocalRegion(origin)) |
259 | return m_remoteConnector.ReleaseAgent(destination, id, uri); | 256 | return m_remoteConnector.ReleaseAgent(origin, id, uri); |
260 | 257 | ||
261 | return false; | 258 | return false; |
262 | } | 259 | } |