diff options
author | Teravus Ovares | 2008-05-31 12:18:29 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-05-31 12:18:29 +0000 |
commit | febe78d06249cd4d36a86e97610dd45ab518a757 (patch) | |
tree | 7b9733fc14045f09e874440b923cfe443b781b6a /OpenSim/Region | |
parent | Mantis#1425. Thank you kindly, Melanie for a patch that: (diff) | |
download | opensim-SC_OLD-febe78d06249cd4d36a86e97610dd45ab518a757.zip opensim-SC_OLD-febe78d06249cd4d36a86e97610dd45ab518a757.tar.gz opensim-SC_OLD-febe78d06249cd4d36a86e97610dd45ab518a757.tar.bz2 opensim-SC_OLD-febe78d06249cd4d36a86e97610dd45ab518a757.tar.xz |
* Implements UserServer logoff in a few situations
* User tries to log-in but is already logged in. Userserver will send message to simulator user was in to log the user out there.
* From the UserServer, admin types 'logoff-user firstname lastname message'.
* Some regions may not get the message because they're not updated yet.
Diffstat (limited to '')
6 files changed, 112 insertions, 2 deletions
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs index 0203821..989f08a 100644 --- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs +++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs | |||
@@ -419,6 +419,16 @@ namespace OpenSim.Region.Communications.Local | |||
419 | } | 419 | } |
420 | } | 420 | } |
421 | 421 | ||
422 | public void TriggerLogOffUser(ulong regionHandle, LLUUID agentID, LLUUID RegionSecret, string message) | ||
423 | { | ||
424 | if (m_regionListeners.ContainsKey(regionHandle)) | ||
425 | { | ||
426 | //m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: FoundLocalRegion To send it to: " + agent.firstname + " " + agent.lastname); | ||
427 | |||
428 | m_regionListeners[regionHandle].TriggerLogOffUser(regionHandle, agentID, RegionSecret, message); | ||
429 | } | ||
430 | } | ||
431 | |||
422 | public void TriggerExpectPrim(ulong regionHandle, LLUUID primID, string objData, int XMLMethod) | 432 | public void TriggerExpectPrim(ulong regionHandle, LLUUID primID, string objData, int XMLMethod) |
423 | { | 433 | { |
424 | if (m_regionListeners.ContainsKey(regionHandle)) | 434 | if (m_regionListeners.ContainsKey(regionHandle)) |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 309a795..2e892c2 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | |||
@@ -86,6 +86,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
86 | httpServer = httpServe; | 86 | httpServer = httpServe; |
87 | //Respond to Grid Services requests | 87 | //Respond to Grid Services requests |
88 | httpServer.AddXmlRPCHandler("expect_user", ExpectUser); | 88 | httpServer.AddXmlRPCHandler("expect_user", ExpectUser); |
89 | httpServer.AddXmlRPCHandler("logoff_user", LogOffUser); | ||
89 | httpServer.AddXmlRPCHandler("check", PingCheckReply); | 90 | httpServer.AddXmlRPCHandler("check", PingCheckReply); |
90 | 91 | ||
91 | StartRemoting(); | 92 | StartRemoting(); |
@@ -603,6 +604,31 @@ namespace OpenSim.Region.Communications.OGS1 | |||
603 | 604 | ||
604 | return new XmlRpcResponse(); | 605 | return new XmlRpcResponse(); |
605 | } | 606 | } |
607 | // Grid Request Processing | ||
608 | /// <summary> | ||
609 | /// Ooops, our Agent must be dead if we're getting this request! | ||
610 | /// </summary> | ||
611 | /// <param name="request"></param> | ||
612 | /// <returns></returns> | ||
613 | public XmlRpcResponse LogOffUser(XmlRpcRequest request) | ||
614 | { | ||
615 | m_log.Debug("[CONNECTION DEBUGGING]: LogOff User Called "); | ||
616 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
617 | string message = (string)requestData["message"]; | ||
618 | LLUUID agentID = LLUUID.Zero; | ||
619 | LLUUID RegionSecret = LLUUID.Zero; | ||
620 | Helpers.TryParse((string)requestData["agent_id"], out agentID); | ||
621 | Helpers.TryParse((string)requestData["region_secret"], out RegionSecret); | ||
622 | |||
623 | ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); | ||
624 | |||
625 | |||
626 | m_localBackend.TriggerLogOffUser(regionHandle, agentID, RegionSecret,message); | ||
627 | |||
628 | |||
629 | |||
630 | return new XmlRpcResponse(); | ||
631 | } | ||
606 | 632 | ||
607 | #region m_interRegion Comms | 633 | #region m_interRegion Comms |
608 | 634 | ||
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs index 8807eab..e0e17df 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs | |||
@@ -196,6 +196,36 @@ namespace OpenSim.Region.Communications.OGS1 | |||
196 | return GetUserProfile(firstName + " " + lastName); | 196 | return GetUserProfile(firstName + " " + lastName); |
197 | } | 197 | } |
198 | 198 | ||
199 | public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle) | ||
200 | { | ||
201 | Hashtable param = new Hashtable(); | ||
202 | param.Add("avatar_id", avatarid.ToString()); | ||
203 | param.Add("region_uuid", regionuuid.ToString()); | ||
204 | param.Add("region_handle", regionhandle.ToString()); | ||
205 | IList parameters = new ArrayList(); | ||
206 | parameters.Add(param); | ||
207 | XmlRpcRequest req = new XmlRpcRequest("update_user_current_region", parameters); | ||
208 | XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); | ||
209 | Hashtable respData = (Hashtable)resp.Value; | ||
210 | if (respData.ContainsKey("returnString")) | ||
211 | { | ||
212 | if ((string)respData["returnString"] == "TRUE") | ||
213 | { | ||
214 | m_log.Info("[OSG1 USER SERVICES]: Successfully updated user record"); | ||
215 | } | ||
216 | else | ||
217 | { | ||
218 | m_log.Error("[OSG1 USER SERVICES]: Error updating user record"); | ||
219 | } | ||
220 | } | ||
221 | else | ||
222 | { | ||
223 | m_log.Warn("[OSG1 USER SERVICES]: Error updating user record, Grid server may not be updated."); | ||
224 | } | ||
225 | |||
226 | |||
227 | } | ||
228 | |||
199 | public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query) | 229 | public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query) |
200 | { | 230 | { |
201 | List<AvatarPickerAvatar> pickerlist = new List<AvatarPickerAvatar>(); | 231 | List<AvatarPickerAvatar> pickerlist = new List<AvatarPickerAvatar>(); |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 6916c6d..c74dca4 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -2003,8 +2003,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
2003 | m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; | 2003 | m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; |
2004 | m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup; | 2004 | m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup; |
2005 | m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar; | 2005 | m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar; |
2006 | 2006 | m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid; | |
2007 | m_sceneGridService.KillObject = SendKillObject; | 2007 | m_sceneGridService.KillObject += SendKillObject; |
2008 | } | 2008 | } |
2009 | 2009 | ||
2010 | /// <summary> | 2010 | /// <summary> |
@@ -2012,6 +2012,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
2012 | /// </summary> | 2012 | /// </summary> |
2013 | public void UnRegisterReginWithComms() | 2013 | public void UnRegisterReginWithComms() |
2014 | { | 2014 | { |
2015 | m_sceneGridService.KillObject -= SendKillObject; | ||
2016 | m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid; | ||
2015 | m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar; | 2017 | m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar; |
2016 | m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup; | 2018 | m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup; |
2017 | m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; | 2019 | m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; |
@@ -2064,6 +2066,34 @@ namespace OpenSim.Region.Environment.Scenes | |||
2064 | } | 2066 | } |
2065 | } | 2067 | } |
2066 | 2068 | ||
2069 | protected void HandleLogOffUserFromGrid(ulong regionHandle, LLUUID AvatarID, LLUUID RegionSecret, string message) | ||
2070 | { | ||
2071 | if (RegionInfo.RegionHandle == regionHandle) | ||
2072 | { | ||
2073 | ScenePresence loggingOffUser = null; | ||
2074 | loggingOffUser = GetScenePresence(AvatarID); | ||
2075 | if (loggingOffUser != null) | ||
2076 | { | ||
2077 | if (RegionSecret == loggingOffUser.ControllingClient.SecureSessionId) | ||
2078 | { | ||
2079 | loggingOffUser.ControllingClient.Kick(message); | ||
2080 | // Give them a second to receive the message! | ||
2081 | System.Threading.Thread.Sleep(1000); | ||
2082 | loggingOffUser.ControllingClient.Close(true); | ||
2083 | } | ||
2084 | else | ||
2085 | { | ||
2086 | m_log.Info("[USERLOGOFF]: System sending the LogOff user message failed to sucessfully authenticate"); | ||
2087 | } | ||
2088 | } | ||
2089 | else | ||
2090 | { | ||
2091 | m_log.InfoFormat("[USERLOGOFF]: Got a logoff request for {0} but the user isn't here. The user might already have been logged out", AvatarID.ToString()); | ||
2092 | } | ||
2093 | } | ||
2094 | |||
2095 | |||
2096 | } | ||
2067 | /// <summary> | 2097 | /// <summary> |
2068 | /// Add a caps handler for the given agent. If the CAPS handler already exists for this agent, | 2098 | /// Add a caps handler for the given agent. If the CAPS handler already exists for this agent, |
2069 | /// then it is replaced by a new CAPS handler. | 2099 | /// then it is replaced by a new CAPS handler. |
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index d2d75e8..e841ad4 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs | |||
@@ -58,6 +58,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
58 | public event RegionUp OnRegionUp; | 58 | public event RegionUp OnRegionUp; |
59 | public event ChildAgentUpdate OnChildAgentUpdate; | 59 | public event ChildAgentUpdate OnChildAgentUpdate; |
60 | public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar; | 60 | public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar; |
61 | public event LogOffUser OnLogOffUser; | ||
61 | 62 | ||
62 | private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion; | 63 | private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion; |
63 | private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser; | 64 | private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser; |
@@ -67,6 +68,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
67 | private RegionUp handlerRegionUp = null; // OnRegionUp; | 68 | private RegionUp handlerRegionUp = null; // OnRegionUp; |
68 | private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate; | 69 | private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate; |
69 | private RemoveKnownRegionsFromAvatarList handlerRemoveKnownRegionFromAvatar = null; // OnRemoveKnownRegionFromAvatar; | 70 | private RemoveKnownRegionsFromAvatarList handlerRemoveKnownRegionFromAvatar = null; // OnRemoveKnownRegionFromAvatar; |
71 | private LogOffUser handlerLogOffUser = null; | ||
70 | 72 | ||
71 | public KillObjectDelegate KillObject; | 73 | public KillObjectDelegate KillObject; |
72 | public string _debugRegionName = String.Empty; | 74 | public string _debugRegionName = String.Empty; |
@@ -105,6 +107,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
105 | regionCommsHost.OnCloseAgentConnection += CloseConnection; | 107 | regionCommsHost.OnCloseAgentConnection += CloseConnection; |
106 | regionCommsHost.OnRegionUp += newRegionUp; | 108 | regionCommsHost.OnRegionUp += newRegionUp; |
107 | regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate; | 109 | regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate; |
110 | regionCommsHost.OnLogOffUser += GridLogOffUser; | ||
108 | } | 111 | } |
109 | else | 112 | else |
110 | { | 113 | { |
@@ -121,6 +124,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
121 | { | 124 | { |
122 | if (regionCommsHost != null) | 125 | if (regionCommsHost != null) |
123 | { | 126 | { |
127 | regionCommsHost.OnLogOffUser -= GridLogOffUser; | ||
124 | regionCommsHost.OnChildAgentUpdate -= ChildAgentUpdate; | 128 | regionCommsHost.OnChildAgentUpdate -= ChildAgentUpdate; |
125 | regionCommsHost.OnRegionUp -= newRegionUp; | 129 | regionCommsHost.OnRegionUp -= newRegionUp; |
126 | regionCommsHost.OnExpectUser -= NewUserConnection; | 130 | regionCommsHost.OnExpectUser -= NewUserConnection; |
@@ -150,6 +154,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
150 | } | 154 | } |
151 | } | 155 | } |
152 | 156 | ||
157 | protected void GridLogOffUser(ulong regionHandle, LLUUID AgentID, LLUUID RegionSecret, string message) | ||
158 | { | ||
159 | handlerLogOffUser = OnLogOffUser; | ||
160 | if (handlerLogOffUser != null) | ||
161 | { | ||
162 | handlerLogOffUser(regionHandle, AgentID, RegionSecret, message); | ||
163 | } | ||
164 | } | ||
165 | |||
153 | protected bool newRegionUp(RegionInfo region) | 166 | protected bool newRegionUp(RegionInfo region) |
154 | { | 167 | { |
155 | handlerRegionUp = OnRegionUp; | 168 | handlerRegionUp = OnRegionUp; |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 30075da..0fdd720 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -596,6 +596,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
596 | m_scene.SendAllSceneObjectsToClient(this); | 596 | m_scene.SendAllSceneObjectsToClient(this); |
597 | 597 | ||
598 | m_scene.EventManager.TriggerOnMakeRootAgent(this); | 598 | m_scene.EventManager.TriggerOnMakeRootAgent(this); |
599 | m_scene.CommsManager.UserService.UpdateUserCurrentRegion(UUID, m_scene.RegionInfo.RegionID, m_scene.RegionInfo.RegionHandle); | ||
599 | 600 | ||
600 | //m_gotAllObjectsInScene = true; | 601 | //m_gotAllObjectsInScene = true; |
601 | //} | 602 | //} |