* Rex merges, user server.
parent
7caa40e301
commit
b526c42d06
|
@ -36,21 +36,22 @@ using OpenSim.Framework.Communications.Cache;
|
|||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Servers;
|
||||
using Nwc.XmlRpc;
|
||||
using OpenSim.Framework.Statistics;
|
||||
|
||||
namespace OpenSim.Grid.UserServer
|
||||
{
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
public class OpenUser_Main : conscmd_callback
|
||||
public class OpenUser_Main : BaseOpenSimServer, conscmd_callback
|
||||
{
|
||||
private UserConfig Cfg;
|
||||
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private UserConfig Cfg;
|
||||
|
||||
public UserManager m_userManager;
|
||||
public UserLoginService m_loginService;
|
||||
public MessageServersConnector m_messagesService;
|
||||
|
||||
private LogBase m_console;
|
||||
private LLUUID m_lastCreatedUser = LLUUID.Random();
|
||||
|
||||
private Boolean m_rexMode;
|
||||
|
@ -58,7 +59,9 @@ namespace OpenSim.Grid.UserServer
|
|||
[STAThread]
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Launching UserServer...");
|
||||
log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
m_log.Info("Launching UserServer...");
|
||||
|
||||
OpenUser_Main userserver = new OpenUser_Main();
|
||||
|
||||
|
@ -68,13 +71,8 @@ namespace OpenSim.Grid.UserServer
|
|||
|
||||
private OpenUser_Main()
|
||||
{
|
||||
if (!Directory.Exists(Util.logDir()))
|
||||
{
|
||||
Directory.CreateDirectory(Util.logDir());
|
||||
}
|
||||
m_console =
|
||||
new LogBase((Path.Combine(Util.logDir(), "opengrid-userserver-console.log")), "OpenUser", this, true);
|
||||
MainLog.Instance = m_console;
|
||||
m_console = new ConsoleBase("OpenUser", this);
|
||||
MainConsole.Instance = m_console;
|
||||
}
|
||||
|
||||
private void Work()
|
||||
|
@ -83,7 +81,7 @@ namespace OpenSim.Grid.UserServer
|
|||
|
||||
while (true)
|
||||
{
|
||||
m_console.MainLogPrompt();
|
||||
m_console.Prompt();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,7 +89,9 @@ namespace OpenSim.Grid.UserServer
|
|||
{
|
||||
Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml")));
|
||||
|
||||
MainLog.Instance.Verbose("REGION", "Establishing data connection");
|
||||
StatsManager.StartCollectingUserStats();
|
||||
|
||||
m_log.Info("[REGION]: Establishing data connection");
|
||||
m_userManager = new UserManager();
|
||||
m_userManager._config = Cfg;
|
||||
m_userManager.AddPlugin(Cfg.DatabaseProvider);
|
||||
|
@ -100,18 +100,19 @@ namespace OpenSim.Grid.UserServer
|
|||
m_userManager, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg);
|
||||
m_rexMode = Cfg.RexMode;
|
||||
|
||||
m_messagesService = new MessageServersConnector(MainLog.Instance);
|
||||
m_messagesService = new MessageServersConnector();
|
||||
|
||||
m_loginService.OnUserLoggedInAtLocation += NotifyMessageServersUserLoggedInToLocation;
|
||||
|
||||
MainLog.Instance.Verbose("REGION", "Starting HTTP process");
|
||||
m_log.Info("[REGION]: Starting HTTP process");
|
||||
BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort);
|
||||
|
||||
httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod);
|
||||
|
||||
httpServer.AddHTTPHandler("login", m_loginService.ProcessHTMLLogin);
|
||||
|
||||
httpServer.SetLLSDHandler(m_loginService.LLSDLoginMethod);
|
||||
|
||||
if (!m_rexMode) {
|
||||
httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName);
|
||||
httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID);
|
||||
httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", m_userManager.XmlRPCGetAvatarPickerAvatar);
|
||||
|
@ -119,6 +120,12 @@ namespace OpenSim.Grid.UserServer
|
|||
httpServer.AddXmlRPCHandler("remove_user_friend", m_userManager.XmlRpcResponseXmlRPCRemoveUserFriend);
|
||||
httpServer.AddXmlRPCHandler("update_user_friend_perms", m_userManager.XmlRpcResponseXmlRPCUpdateUserFriendPerms);
|
||||
httpServer.AddXmlRPCHandler("get_user_friend_list", m_userManager.XmlRpcResponseXmlRPCGetUserFriendList);
|
||||
httpServer.AddXmlRPCHandler("logout_of_simulator", m_userManager.XmlRPCLogOffUserMethodUUID);
|
||||
|
||||
// Message Server ---> User Server
|
||||
httpServer.AddXmlRPCHandler("register_messageserver", m_messagesService.XmlRPCRegisterMessageServer);
|
||||
httpServer.AddXmlRPCHandler("agent_change_region", m_messagesService.XmlRPCUserMovedtoRegion);
|
||||
httpServer.AddXmlRPCHandler("deregister_messageserver", m_messagesService.XmlRPCDeRegisterMessageServer);
|
||||
|
||||
// Message Server ---> User Server
|
||||
httpServer.AddXmlRPCHandler("register_messageserver", m_messagesService.XmlRPCRegisterMessageServer);
|
||||
|
@ -144,10 +151,9 @@ namespace OpenSim.Grid.UserServer
|
|||
new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod));
|
||||
|
||||
httpServer.Start();
|
||||
m_console.Status("SERVER", "Userserver 0.4 - Startup complete");
|
||||
m_log.Info("[SERVER]: Userserver 0.5 - Startup complete");
|
||||
}
|
||||
|
||||
|
||||
public void do_create(string what)
|
||||
{
|
||||
switch (what)
|
||||
|
@ -161,11 +167,18 @@ namespace OpenSim.Grid.UserServer
|
|||
|
||||
tempfirstname = m_console.CmdPrompt("First name");
|
||||
templastname = m_console.CmdPrompt("Last name");
|
||||
tempMD5Passwd = m_console.PasswdPrompt("Password");
|
||||
//tempMD5Passwd = m_console.PasswdPrompt("Password");
|
||||
tempMD5Passwd = m_console.CmdPrompt("Password");
|
||||
regX = Convert.ToUInt32(m_console.CmdPrompt("Start Region X"));
|
||||
regY = Convert.ToUInt32(m_console.CmdPrompt("Start Region Y"));
|
||||
|
||||
tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + "");
|
||||
if (null != m_userManager.GetUserProfile(tempfirstname, templastname))
|
||||
{
|
||||
m_log.ErrorFormat("[USERS]: A user with the name {0} {1} already exists!", tempfirstname, templastname);
|
||||
break;
|
||||
}
|
||||
|
||||
tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + String.Empty);
|
||||
|
||||
LLUUID userID = new LLUUID();
|
||||
try
|
||||
|
@ -174,7 +187,7 @@ namespace OpenSim.Grid.UserServer
|
|||
m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
|
||||
} catch (Exception ex)
|
||||
{
|
||||
m_console.Error("SERVER", "Error creating user: {0}", ex.ToString());
|
||||
m_log.ErrorFormat("[USERS]: Error creating user: {0}", ex.ToString());
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -184,19 +197,22 @@ namespace OpenSim.Grid.UserServer
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_console.Error("SERVER", "Error creating inventory for user: {0}", ex.ToString());
|
||||
m_log.ErrorFormat("[USERS]: Error creating inventory for user: {0}", ex.ToString());
|
||||
}
|
||||
m_lastCreatedUser = userID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void RunCmd(string cmd, string[] cmdparams)
|
||||
public override void RunCmd(string cmd, string[] cmdparams)
|
||||
{
|
||||
base.RunCmd(cmd, cmdparams);
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
case "help":
|
||||
m_console.Notice("create user - create a new user");
|
||||
m_console.Notice("stats - statistical information for this server");
|
||||
m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
|
||||
break;
|
||||
|
||||
|
@ -210,11 +226,14 @@ namespace OpenSim.Grid.UserServer
|
|||
Environment.Exit(0);
|
||||
break;
|
||||
|
||||
case "stats":
|
||||
m_console.Notice(StatsManager.UserStats.Report());
|
||||
break;
|
||||
|
||||
case "test-inventory":
|
||||
// RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>();
|
||||
// requester.ReturnResponseVal = TestResponse;
|
||||
// requester.BeginPostObject<LLUUID>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser);
|
||||
List<InventoryFolderBase> folders =
|
||||
SynchronousRestObjectPoster.BeginPostObject<LLUUID, List<InventoryFolderBase>>("POST",
|
||||
m_userManager.
|
||||
_config.
|
||||
|
@ -227,8 +246,9 @@ namespace OpenSim.Grid.UserServer
|
|||
|
||||
public void TestResponse(List<InventoryFolderBase> resp)
|
||||
{
|
||||
Console.WriteLine("response got");
|
||||
m_console.Notice("response got");
|
||||
}
|
||||
|
||||
public void NotifyMessageServersUserLoggedInToLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, ulong regionhandle, LLVector3 Position)
|
||||
{
|
||||
m_messagesService.TellMessageServersAboutUser(agentID, sessionID, RegionID, regionhandle, Position);
|
||||
|
@ -238,9 +258,9 @@ namespace OpenSim.Grid.UserServer
|
|||
{
|
||||
try
|
||||
{
|
||||
string attri = "";
|
||||
string attri = String.Empty;
|
||||
attri = configData.GetAttribute("DataBaseProvider");
|
||||
if (attri == "")
|
||||
if (attri == String.Empty)
|
||||
{
|
||||
StorageDll = "OpenSim.Framework.Data.DB4o.dll";
|
||||
configData.SetAttribute("DataBaseProvider", "OpenSim.Framework.Data.DB4o.dll");
|
||||
|
@ -256,10 +276,6 @@ namespace OpenSim.Grid.UserServer
|
|||
|
||||
}
|
||||
}*/
|
||||
|
||||
public void Show(string ShowWhat)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -39,15 +39,14 @@ using OpenSim.Framework.Servers;
|
|||
|
||||
namespace OpenSim.Grid.UserServer
|
||||
{
|
||||
|
||||
public class MessageServersConnector
|
||||
{
|
||||
private LogBase m_log;
|
||||
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public Dictionary<string, MessageServerInfo> MessageServers;
|
||||
|
||||
public MessageServersConnector(LogBase log)
|
||||
public MessageServersConnector()
|
||||
{
|
||||
m_log=log;
|
||||
MessageServers = new Dictionary<string, MessageServerInfo>();
|
||||
}
|
||||
|
||||
|
@ -65,7 +64,7 @@ namespace OpenSim.Grid.UserServer
|
|||
{
|
||||
if (!MessageServers.ContainsKey(URI))
|
||||
{
|
||||
m_log.Warn("MSGSERVER", "Got addResponsibleRegion Request for a MessageServer that isn't registered");
|
||||
m_log.Warn("[MSGSERVER]: Got addResponsibleRegion Request for a MessageServer that isn't registered");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -78,7 +77,7 @@ namespace OpenSim.Grid.UserServer
|
|||
{
|
||||
if (!MessageServers.ContainsKey(URI))
|
||||
{
|
||||
m_log.Warn("MSGSERVER", "Got RemoveResponsibleRegion Request for a MessageServer that isn't registered");
|
||||
m_log.Warn("[MSGSERVER]: Got RemoveResponsibleRegion Request for a MessageServer that isn't registered");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -175,10 +174,7 @@ namespace OpenSim.Grid.UserServer
|
|||
|
||||
XmlRpcRequest GridReq = new XmlRpcRequest("login_to_simulator", SendParams);
|
||||
XmlRpcResponse GridResp = GridReq.Send(serv.URI, 6000);
|
||||
m_log.Verbose("LOGIN","Notified : " + serv.URI + " about user login");
|
||||
|
||||
}
|
||||
|
||||
|
||||
m_log.Info("[LOGIN]: Notified : " + serv.URI + " about user login");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
@ -10,7 +38,7 @@ using System.Runtime.InteropServices;
|
|||
[assembly : AssemblyConfiguration("")]
|
||||
[assembly : AssemblyCompany("")]
|
||||
[assembly : AssemblyProduct("OGS-UserServer")]
|
||||
[assembly : AssemblyCopyright("Copyright © 2007")]
|
||||
[assembly : AssemblyCopyright("Copyright © OpenSimulator.org Developers 2007-2008")]
|
||||
[assembly : AssemblyTrademark("")]
|
||||
[assembly : AssemblyCulture("")]
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
|
@ -38,6 +38,7 @@ using OpenSim.Framework.Communications.Cache;
|
|||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Data;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Statistics;
|
||||
using OpenSim.Framework.UserManagement;
|
||||
using InventoryFolder=OpenSim.Framework.InventoryFolder;
|
||||
|
||||
|
@ -45,15 +46,19 @@ namespace OpenSim.Grid.UserServer
|
|||
{
|
||||
public delegate void UserLoggedInAtLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, ulong regionhandle, LLVector3 Position);
|
||||
|
||||
|
||||
public class UserLoginService : LoginService
|
||||
{
|
||||
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public event UserLoggedInAtLocation OnUserLoggedInAtLocation;
|
||||
|
||||
private UserLoggedInAtLocation handler001 = null;
|
||||
|
||||
public UserConfig m_config;
|
||||
|
||||
public UserLoginService(
|
||||
UserManagerBase userManager, LibraryRootFolder libraryRootFolder, UserConfig config, string welcomeMess)
|
||||
UserManagerBase userManager, LibraryRootFolder libraryRootFolder,
|
||||
UserConfig config, string welcomeMess)
|
||||
: base(userManager, libraryRootFolder, welcomeMess, config.RexMode)
|
||||
{
|
||||
m_config = config;
|
||||
|
@ -68,19 +73,20 @@ namespace OpenSim.Grid.UserServer
|
|||
{
|
||||
bool tryDefault = false;
|
||||
//CFK: Since the try is always "tried", the "Home Location" message should always appear, so comment this one.
|
||||
//CFK: MainLog.Instance.Verbose("LOGIN", "Load information from the gridserver");
|
||||
RegionProfileData SimInfo = new RegionProfileData();
|
||||
//CFK: m_log.Info("[LOGIN]: Load information from the gridserver");
|
||||
|
||||
try
|
||||
{
|
||||
SimInfo =
|
||||
SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, m_config.GridServerURL,
|
||||
RegionProfileData SimInfo =
|
||||
RegionProfileData.RequestSimProfileData(
|
||||
theUser.currentAgent.currentHandle, m_config.GridServerURL,
|
||||
m_config.GridSendKey, m_config.GridRecvKey);
|
||||
|
||||
// Customise the response
|
||||
//CFK: This is redundant and the next message should always appear.
|
||||
//CFK: MainLog.Instance.Verbose("LOGIN", "Home Location");
|
||||
response.Home = "{'region_handle':[r" + (SimInfo.regionLocX*256).ToString() + ",r" +
|
||||
(SimInfo.regionLocY*256).ToString() + "], " +
|
||||
//CFK: m_log.Info("[LOGIN]: Home Location");
|
||||
response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize).ToString() + ",r" +
|
||||
(SimInfo.regionLocY * Constants.RegionSize).ToString() + "], " +
|
||||
"'position':[r" + theUser.homeLocation.X.ToString() + ",r" +
|
||||
theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
|
||||
"'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" +
|
||||
|
@ -89,7 +95,7 @@ namespace OpenSim.Grid.UserServer
|
|||
// Destination
|
||||
//CFK: The "Notifying" message always seems to appear, so subsume the data from this message into
|
||||
//CFK: the next one for X & Y and comment this one.
|
||||
//CFK: MainLog.Instance.Verbose("LOGIN", "CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX +
|
||||
//CFK: m_log.Info("[LOGIN]: CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX +
|
||||
//CFK: "; Region Y: " + SimInfo.regionLocY);
|
||||
response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString();
|
||||
response.SimPort = (uint) SimInfo.serverPort;
|
||||
|
@ -103,7 +109,7 @@ namespace OpenSim.Grid.UserServer
|
|||
// Notify the target of an incoming user
|
||||
//CFK: The "Notifying" message always seems to appear, so subsume the data from this message into
|
||||
//CFK: the next one for X & Y and comment this one.
|
||||
//CFK: MainLog.Instance.Verbose("LOGIN", SimInfo.regionName + " (" + SimInfo.serverURI + ") " +
|
||||
//CFK: m_log.Info("[LOGIN]: " + SimInfo.regionName + " (" + SimInfo.serverURI + ") " +
|
||||
//CFK: SimInfo.regionLocX + "," + SimInfo.regionLocY);
|
||||
|
||||
// Prepare notification
|
||||
|
@ -132,45 +138,52 @@ namespace OpenSim.Grid.UserServer
|
|||
theUser.currentAgent.currentRegion = SimInfo.UUID;
|
||||
theUser.currentAgent.currentHandle = SimInfo.regionHandle;
|
||||
|
||||
MainLog.Instance.Verbose("LOGIN", SimInfo.regionName + " @ " + SimInfo.httpServerURI + " " +
|
||||
SimInfo.regionLocX + "," + SimInfo.regionLocY);
|
||||
m_log.Info("[LOGIN]: Telling "
|
||||
+ SimInfo.regionName + " @ " + SimInfo.httpServerURI + " " +
|
||||
SimInfo.regionLocX + "," + SimInfo.regionLocY + " to expect user connection");
|
||||
|
||||
XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
|
||||
XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
|
||||
|
||||
if (GridResp.IsFault)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}",
|
||||
SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
tryDefault = true;
|
||||
}
|
||||
|
||||
if (tryDefault)
|
||||
{
|
||||
// Send him to default region instead
|
||||
// Load information from the gridserver
|
||||
|
||||
ulong defaultHandle = (((ulong) m_config.DefaultX*256) << 32) | ((ulong) m_config.DefaultY*256);
|
||||
ulong defaultHandle = (((ulong)m_config.DefaultX * Constants.RegionSize) << 32) | ((ulong)m_config.DefaultY * Constants.RegionSize);
|
||||
|
||||
MainLog.Instance.Warn(
|
||||
"LOGIN",
|
||||
"Home region not available: sending to default " + defaultHandle.ToString());
|
||||
m_log.Warn(
|
||||
"[LOGIN]: Home region not available: sending to default " + defaultHandle.ToString());
|
||||
|
||||
SimInfo = new RegionProfileData();
|
||||
try
|
||||
{
|
||||
SimInfo =
|
||||
SimInfo.RequestSimProfileData(defaultHandle, m_config.GridServerURL,
|
||||
RegionProfileData SimInfo = RegionProfileData.RequestSimProfileData(
|
||||
defaultHandle, m_config.GridServerURL,
|
||||
m_config.GridSendKey, m_config.GridRecvKey);
|
||||
|
||||
// Customise the response
|
||||
MainLog.Instance.Verbose("LOGIN", "Home Location");
|
||||
response.Home = "{'region_handle':[r" + (SimInfo.regionLocX*256).ToString() + ",r" +
|
||||
(SimInfo.regionLocY*256).ToString() + "], " +
|
||||
m_log.Info("[LOGIN]: Home Location");
|
||||
response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize).ToString() + ",r" +
|
||||
(SimInfo.regionLocY * Constants.RegionSize).ToString() + "], " +
|
||||
"'position':[r" + theUser.homeLocation.X.ToString() + ",r" +
|
||||
theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
|
||||
"'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" +
|
||||
theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
|
||||
|
||||
// Destination
|
||||
MainLog.Instance.Verbose("LOGIN",
|
||||
m_log.Info("[LOGIN]: " +
|
||||
"CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " +
|
||||
SimInfo.regionLocY);
|
||||
response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString();
|
||||
|
@ -183,7 +196,7 @@ namespace OpenSim.Grid.UserServer
|
|||
response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/";
|
||||
|
||||
// Notify the target of an incoming user
|
||||
MainLog.Instance.Verbose("LOGIN", "Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI + ")");
|
||||
m_log.Info("[LOGIN]: Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI + ")");
|
||||
|
||||
// Update agent with target sim
|
||||
theUser.currentAgent.currentRegion = SimInfo.UUID;
|
||||
|
@ -211,20 +224,21 @@ namespace OpenSim.Grid.UserServer
|
|||
ArrayList SendParams = new ArrayList();
|
||||
SendParams.Add(SimParams);
|
||||
|
||||
MainLog.Instance.Verbose("LOGIN", "Informing region at " + SimInfo.httpServerURI);
|
||||
m_log.Info("[LOGIN]: Informing region at " + SimInfo.httpServerURI);
|
||||
// Send
|
||||
XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
|
||||
XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
|
||||
if (OnUserLoggedInAtLocation != null)
|
||||
handler001 = OnUserLoggedInAtLocation;
|
||||
if (handler001 != null)
|
||||
{
|
||||
OnUserLoggedInAtLocation(theUser.UUID, theUser.currentAgent.sessionID, theUser.currentAgent.currentRegion, theUser.currentAgent.currentHandle, theUser.currentAgent.currentPos);
|
||||
handler001(theUser.UUID, theUser.currentAgent.sessionID, theUser.currentAgent.currentRegion, theUser.currentAgent.currentHandle, theUser.currentAgent.currentPos);
|
||||
}
|
||||
}
|
||||
|
||||
catch (Exception e)
|
||||
{
|
||||
MainLog.Instance.Warn("LOGIN", "Default region also not available");
|
||||
MainLog.Instance.Warn("LOGIN", e.ToString());
|
||||
m_log.Warn("[LOGIN]: Default region also not available");
|
||||
m_log.Warn("[LOGIN]: " + e.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -240,10 +254,9 @@ namespace OpenSim.Grid.UserServer
|
|||
// which does.
|
||||
if (null == folders | folders.Count == 0)
|
||||
{
|
||||
MainLog.Instance.Warn(
|
||||
"LOGIN",
|
||||
"A root inventory folder for user ID " + userID + " was not found. A new set"
|
||||
+ " of empty inventory folders is being created.");
|
||||
m_log.Warn(
|
||||
"[LOGIN]: " +
|
||||
"root inventory folder user " + userID + " not found. Creating.");
|
||||
|
||||
RestObjectPoster.BeginPostObject<Guid>(
|
||||
m_config.InventoryUrl + "CreateInventory/", userID.UUID);
|
||||
|
@ -279,7 +292,7 @@ namespace OpenSim.Grid.UserServer
|
|||
}
|
||||
else
|
||||
{
|
||||
MainLog.Instance.Warn("LOGIN", "The root inventory folder could still not be retrieved" +
|
||||
m_log.Warn("[LOGIN]: The root inventory folder could still not be retrieved" +
|
||||
" for user ID " + userID);
|
||||
|
||||
AgentInventory userInventory = new AgentInventory();
|
||||
|
|
|
@ -32,16 +32,14 @@ using System.Text.RegularExpressions;
|
|||
using libsecondlife;
|
||||
using Nwc.XmlRpc;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Statistics;
|
||||
using OpenSim.Framework.UserManagement;
|
||||
|
||||
namespace OpenSim.Grid.UserServer
|
||||
{
|
||||
public class UserManager : UserManagerBase
|
||||
{
|
||||
public UserManager()
|
||||
{
|
||||
}
|
||||
|
||||
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes an active agent session
|
||||
|
@ -110,6 +108,7 @@ namespace OpenSim.Grid.UserServer
|
|||
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a user profile to an XML element which can be returned
|
||||
/// </summary>
|
||||
|
@ -206,7 +205,6 @@ namespace OpenSim.Grid.UserServer
|
|||
responseData["returnString"] = returnString;
|
||||
response.Value = responseData;
|
||||
return response;
|
||||
|
||||
}
|
||||
|
||||
public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserFriendPerms(XmlRpcRequest request)
|
||||
|
@ -216,8 +214,6 @@ namespace OpenSim.Grid.UserServer
|
|||
Hashtable responseData = new Hashtable();
|
||||
string returnString = "FALSE";
|
||||
|
||||
|
||||
|
||||
if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms"))
|
||||
{
|
||||
UpdateUserFriendPerms(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]), (uint)Convert.ToInt32((string)requestData["friendPerms"]));
|
||||
|
@ -237,8 +233,6 @@ namespace OpenSim.Grid.UserServer
|
|||
|
||||
List<FriendListItem> returndata = new List<FriendListItem>();
|
||||
|
||||
|
||||
|
||||
if (requestData.Contains("ownerID"))
|
||||
{
|
||||
returndata = this.GetUserFriendList(new LLUUID((string)requestData["ownerID"]));
|
||||
|
@ -324,10 +318,43 @@ namespace OpenSim.Grid.UserServer
|
|||
return CreateUnknownUserErrorResponse();
|
||||
}
|
||||
|
||||
|
||||
return ProfileToXmlRPCResponse(userProfile);
|
||||
}
|
||||
|
||||
public XmlRpcResponse XmlRPCLogOffUserMethodUUID(XmlRpcRequest request)
|
||||
{
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
|
||||
UserProfileData userProfile;
|
||||
|
||||
if (requestData.Contains("avatar_uuid"))
|
||||
{
|
||||
try
|
||||
{
|
||||
LLUUID userUUID = new LLUUID((string)requestData["avatar_uuid"]);
|
||||
LLUUID RegionID = new LLUUID((string)requestData["region_uuid"]);
|
||||
ulong regionhandle = (ulong)Convert.ToInt64((string)requestData["region_handle"]);
|
||||
float posx = (float)Convert.ToDecimal((string)requestData["region_pos_x"]);
|
||||
float posy = (float)Convert.ToDecimal((string)requestData["region_pos_y"]);
|
||||
float posz = (float)Convert.ToDecimal((string)requestData["region_pos_z"]);
|
||||
|
||||
LogOffUser(userUUID, RegionID, regionhandle, posx, posy, posz);
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
m_log.Warn("[LOGOUT]: Error in Logout XMLRPC Params");
|
||||
return response;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return CreateUnknownUserErrorResponse();
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public override UserProfileData SetupMasterUser(string firstName, string lastName)
|
||||
|
|
Loading…
Reference in New Issue