From febe78d06249cd4d36a86e97610dd45ab518a757 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sat, 31 May 2008 12:18:29 +0000 Subject: * 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. --- .../Communications/Local/LocalBackEndServices.cs | 10 ++++++++ .../Region/Communications/OGS1/OGS1GridServices.cs | 26 +++++++++++++++++++ .../Region/Communications/OGS1/OGS1UserServices.cs | 30 ++++++++++++++++++++++ 3 files changed, 66 insertions(+) (limited to 'OpenSim/Region/Communications') 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 } } + public void TriggerLogOffUser(ulong regionHandle, LLUUID agentID, LLUUID RegionSecret, string message) + { + if (m_regionListeners.ContainsKey(regionHandle)) + { + //m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: FoundLocalRegion To send it to: " + agent.firstname + " " + agent.lastname); + + m_regionListeners[regionHandle].TriggerLogOffUser(regionHandle, agentID, RegionSecret, message); + } + } + public void TriggerExpectPrim(ulong regionHandle, LLUUID primID, string objData, int XMLMethod) { 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 httpServer = httpServe; //Respond to Grid Services requests httpServer.AddXmlRPCHandler("expect_user", ExpectUser); + httpServer.AddXmlRPCHandler("logoff_user", LogOffUser); httpServer.AddXmlRPCHandler("check", PingCheckReply); StartRemoting(); @@ -603,6 +604,31 @@ namespace OpenSim.Region.Communications.OGS1 return new XmlRpcResponse(); } + // Grid Request Processing + /// + /// Ooops, our Agent must be dead if we're getting this request! + /// + /// + /// + public XmlRpcResponse LogOffUser(XmlRpcRequest request) + { + m_log.Debug("[CONNECTION DEBUGGING]: LogOff User Called "); + Hashtable requestData = (Hashtable)request.Params[0]; + string message = (string)requestData["message"]; + LLUUID agentID = LLUUID.Zero; + LLUUID RegionSecret = LLUUID.Zero; + Helpers.TryParse((string)requestData["agent_id"], out agentID); + Helpers.TryParse((string)requestData["region_secret"], out RegionSecret); + + ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); + + + m_localBackend.TriggerLogOffUser(regionHandle, agentID, RegionSecret,message); + + + + return new XmlRpcResponse(); + } #region m_interRegion Comms 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 return GetUserProfile(firstName + " " + lastName); } + public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle) + { + Hashtable param = new Hashtable(); + param.Add("avatar_id", avatarid.ToString()); + param.Add("region_uuid", regionuuid.ToString()); + param.Add("region_handle", regionhandle.ToString()); + IList parameters = new ArrayList(); + parameters.Add(param); + XmlRpcRequest req = new XmlRpcRequest("update_user_current_region", parameters); + XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); + Hashtable respData = (Hashtable)resp.Value; + if (respData.ContainsKey("returnString")) + { + if ((string)respData["returnString"] == "TRUE") + { + m_log.Info("[OSG1 USER SERVICES]: Successfully updated user record"); + } + else + { + m_log.Error("[OSG1 USER SERVICES]: Error updating user record"); + } + } + else + { + m_log.Warn("[OSG1 USER SERVICES]: Error updating user record, Grid server may not be updated."); + } + + + } + public List GenerateAgentPickerRequestResponse(LLUUID queryID, string query) { List pickerlist = new List(); -- cgit v1.1