mirror of
https://github.com/opensim/opensim.git
synced 2026-08-12 12:25:42 +08:00
* Optimized usings
* shortened references * Removed redundant 'this' * Normalized EOF
This commit is contained in:
@@ -129,7 +129,8 @@ namespace OpenSim.Grid.UserServer
|
||||
tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + "");
|
||||
|
||||
LLUUID userID = m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
|
||||
RestObjectPoster.BeginPostObject<Guid>(m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID);
|
||||
RestObjectPoster.BeginPostObject<Guid>(m_userManager._config.InventoryUrl + "CreateInventory/",
|
||||
userID.UUID);
|
||||
m_lastCreatedUser = userID;
|
||||
break;
|
||||
}
|
||||
@@ -154,17 +155,23 @@ namespace OpenSim.Grid.UserServer
|
||||
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.InventoryUrl + "RootFolders/", m_lastCreatedUser);
|
||||
// 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.
|
||||
InventoryUrl +
|
||||
"RootFolders/",
|
||||
m_lastCreatedUser);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void TestResponse(List<InventoryFolderBase> resp)
|
||||
{
|
||||
System.Console.WriteLine("response got");
|
||||
Console.WriteLine("response got");
|
||||
}
|
||||
|
||||
/*private void ConfigDB(IGenericConfig configData)
|
||||
@@ -194,4 +201,4 @@ namespace OpenSim.Grid.UserServer
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,16 +29,15 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using Nwc.XmlRpc;
|
||||
using libsecondlife;
|
||||
using Nwc.XmlRpc;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Data;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.UserManagement;
|
||||
using InventoryFolder = OpenSim.Framework.InventoryFolder;
|
||||
using InventoryFolder=OpenSim.Framework.InventoryFolder;
|
||||
|
||||
namespace OpenSim.Grid.UserServer
|
||||
{
|
||||
@@ -72,8 +71,8 @@ namespace OpenSim.Grid.UserServer
|
||||
// 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() + "], " +
|
||||
response.Home = "{'region_handle':[r" + (SimInfo.regionLocX*256).ToString() + ",r" +
|
||||
(SimInfo.regionLocY*256).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" +
|
||||
@@ -106,7 +105,7 @@ namespace OpenSim.Grid.UserServer
|
||||
SimParams["firstname"] = theUser.username;
|
||||
SimParams["lastname"] = theUser.surname;
|
||||
SimParams["agent_id"] = theUser.UUID.ToString();
|
||||
SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode);
|
||||
SimParams["circuit_code"] = (Int32) Convert.ToUInt32(response.CircuitCode);
|
||||
SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString();
|
||||
SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString();
|
||||
SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString();
|
||||
@@ -119,9 +118,9 @@ 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);
|
||||
|
||||
MainLog.Instance.Verbose("LOGIN", SimInfo.regionName + " @ " + SimInfo.httpServerURI + " " +
|
||||
SimInfo.regionLocX + "," + SimInfo.regionLocY);
|
||||
|
||||
XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
|
||||
XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
|
||||
}
|
||||
@@ -129,17 +128,17 @@ namespace OpenSim.Grid.UserServer
|
||||
{
|
||||
tryDefault = true;
|
||||
}
|
||||
if(tryDefault)
|
||||
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*256) << 32) | ((ulong) m_config.DefaultY*256);
|
||||
|
||||
MainLog.Instance.Warn(
|
||||
"LOGIN",
|
||||
"LOGIN",
|
||||
"Home region not available: sending to default " + defaultHandle.ToString());
|
||||
|
||||
|
||||
SimInfo = new RegionProfileData();
|
||||
try
|
||||
{
|
||||
@@ -149,15 +148,16 @@ namespace OpenSim.Grid.UserServer
|
||||
|
||||
// Customise the response
|
||||
MainLog.Instance.Verbose("LOGIN", "Home Location");
|
||||
response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" +
|
||||
(SimInfo.regionLocY * 256).ToString() + "], " +
|
||||
response.Home = "{'region_handle':[r" + (SimInfo.regionLocX*256).ToString() + ",r" +
|
||||
(SimInfo.regionLocY*256).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", "CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " +
|
||||
MainLog.Instance.Verbose("LOGIN",
|
||||
"CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " +
|
||||
SimInfo.regionLocY);
|
||||
response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString();
|
||||
response.SimPort = (uint) SimInfo.serverPort;
|
||||
@@ -182,7 +182,7 @@ namespace OpenSim.Grid.UserServer
|
||||
SimParams["firstname"] = theUser.username;
|
||||
SimParams["lastname"] = theUser.surname;
|
||||
SimParams["agent_id"] = theUser.UUID.ToString();
|
||||
SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode);
|
||||
SimParams["circuit_code"] = (Int32) Convert.ToUInt32(response.CircuitCode);
|
||||
SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString();
|
||||
SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString();
|
||||
SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString();
|
||||
@@ -202,35 +202,34 @@ namespace OpenSim.Grid.UserServer
|
||||
MainLog.Instance.Warn("LOGIN", "Default region also not available");
|
||||
MainLog.Instance.Warn("LOGIN", e.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected override InventoryData CreateInventoryData(LLUUID userID)
|
||||
{
|
||||
List<InventoryFolderBase> folders
|
||||
List<InventoryFolderBase> folders
|
||||
= SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
|
||||
"POST", m_config.InventoryUrl + "RootFolders/", userID.UUID);
|
||||
|
||||
|
||||
// In theory, the user will only ever be missing a root folder in situations where a grid
|
||||
// which didn't previously run a grid wide inventory server is being transitioned to one
|
||||
// which does.
|
||||
if (null == folders | folders.Count == 0)
|
||||
{
|
||||
MainLog.Instance.Warn(
|
||||
"LOGIN",
|
||||
"LOGIN",
|
||||
"A root inventory folder for user ID " + userID + " was not found. A new set"
|
||||
+ " of empty inventory folders is being created.");
|
||||
|
||||
|
||||
RestObjectPoster.BeginPostObject<Guid>(
|
||||
m_config.InventoryUrl + "CreateInventory/", userID.UUID);
|
||||
|
||||
|
||||
// A big delay should be okay here since the recreation of the user's root folders should
|
||||
// only ever happen once. We need to sleep to let the inventory server do its work -
|
||||
// previously 1000ms has been found to be too short.
|
||||
Thread.Sleep(10000);
|
||||
folders = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
|
||||
"POST", m_config.InventoryUrl + "RootFolders/", userID.UUID);
|
||||
"POST", m_config.InventoryUrl + "RootFolders/", userID.UUID);
|
||||
}
|
||||
|
||||
if (folders.Count > 0)
|
||||
@@ -247,8 +246,8 @@ namespace OpenSim.Grid.UserServer
|
||||
TempHash = new Hashtable();
|
||||
TempHash["name"] = InvFolder.name;
|
||||
TempHash["parent_id"] = InvFolder.parentID.ToString();
|
||||
TempHash["version"] = (Int32)InvFolder.version;
|
||||
TempHash["type_default"] = (Int32)InvFolder.type;
|
||||
TempHash["version"] = (Int32) InvFolder.version;
|
||||
TempHash["type_default"] = (Int32) InvFolder.type;
|
||||
TempHash["folder_id"] = InvFolder.folderID.ToString();
|
||||
AgentInventoryArray.Add(TempHash);
|
||||
}
|
||||
@@ -257,8 +256,8 @@ namespace OpenSim.Grid.UserServer
|
||||
else
|
||||
{
|
||||
MainLog.Instance.Warn("LOGIN", "The root inventory folder could still not be retrieved" +
|
||||
" for user ID " + userID);
|
||||
|
||||
" for user ID " + userID);
|
||||
|
||||
AgentInventory userInventory = new AgentInventory();
|
||||
userInventory.CreateRootFolder(userID, false);
|
||||
|
||||
@@ -269,8 +268,8 @@ namespace OpenSim.Grid.UserServer
|
||||
TempHash = new Hashtable();
|
||||
TempHash["name"] = InvFolder.FolderName;
|
||||
TempHash["parent_id"] = InvFolder.ParentID.ToString();
|
||||
TempHash["version"] = (Int32)InvFolder.Version;
|
||||
TempHash["type_default"] = (Int32)InvFolder.DefaultType;
|
||||
TempHash["version"] = (Int32) InvFolder.Version;
|
||||
TempHash["type_default"] = (Int32) InvFolder.DefaultType;
|
||||
TempHash["folder_id"] = InvFolder.FolderID.ToString();
|
||||
AgentInventoryArray.Add(TempHash);
|
||||
}
|
||||
@@ -279,4 +278,4 @@ namespace OpenSim.Grid.UserServer
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using libsecondlife;
|
||||
using Nwc.XmlRpc;
|
||||
using OpenSim.Framework;
|
||||
@@ -76,8 +77,8 @@ namespace OpenSim.Grid.UserServer
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable responseData = new Hashtable();
|
||||
// Query Result Information
|
||||
responseData["queryid"] = (string)queryID.ToString();
|
||||
responseData["avcount"] = (string)returnUsers.Count.ToString();
|
||||
responseData["queryid"] = (string) queryID.ToString();
|
||||
responseData["avcount"] = (string) returnUsers.Count.ToString();
|
||||
|
||||
for (int i = 0; i < returnUsers.Count; i++)
|
||||
{
|
||||
@@ -86,9 +87,10 @@ namespace OpenSim.Grid.UserServer
|
||||
responseData["lastname" + i.ToString()] = returnUsers[i].lastName;
|
||||
}
|
||||
response.Value = responseData;
|
||||
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a user profile to an XML element which can be returned
|
||||
/// </summary>
|
||||
@@ -135,18 +137,18 @@ namespace OpenSim.Grid.UserServer
|
||||
public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request)
|
||||
{
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
Hashtable requestData = (Hashtable) request.Params[0];
|
||||
List<AvatarPickerAvatar> returnAvatar = new List<AvatarPickerAvatar>();
|
||||
LLUUID queryID = new LLUUID(LLUUID.Zero.ToString());
|
||||
|
||||
if (requestData.Contains("avquery") && requestData.Contains("queryid"))
|
||||
{
|
||||
queryID = new LLUUID((string)requestData["queryid"]);
|
||||
returnAvatar = GenerateAgentPickerRequestResponse(queryID,(string)requestData["avquery"]);
|
||||
queryID = new LLUUID((string) requestData["queryid"]);
|
||||
returnAvatar = GenerateAgentPickerRequestResponse(queryID, (string) requestData["avquery"]);
|
||||
}
|
||||
|
||||
Console.WriteLine("[AVATARINFO]: Servicing Avatar Query: " + (string)requestData["avquery"]);
|
||||
return AvatarPickerListtoXmlRPCResponse(queryID,returnAvatar);
|
||||
Console.WriteLine("[AVATARINFO]: Servicing Avatar Query: " + (string) requestData["avquery"]);
|
||||
return AvatarPickerListtoXmlRPCResponse(queryID, returnAvatar);
|
||||
}
|
||||
|
||||
public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request)
|
||||
@@ -156,16 +158,16 @@ namespace OpenSim.Grid.UserServer
|
||||
UserProfileData userProfile;
|
||||
if (requestData.Contains("avatar_name"))
|
||||
{
|
||||
string query = (string)requestData["avatar_name"];
|
||||
string query = (string) requestData["avatar_name"];
|
||||
|
||||
System.Text.RegularExpressions.Regex objAlphaNumericPattern = new System.Text.RegularExpressions.Regex("[^a-zA-Z0-9]");
|
||||
Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]");
|
||||
|
||||
string[] querysplit;
|
||||
querysplit = query.Split(' ');
|
||||
|
||||
if (querysplit.Length == 2)
|
||||
{
|
||||
userProfile = GetUserProfile(querysplit[0],querysplit[1]);
|
||||
userProfile = GetUserProfile(querysplit[0], querysplit[1]);
|
||||
if (userProfile == null)
|
||||
{
|
||||
return CreateUnknownUserErrorResponse();
|
||||
@@ -196,11 +198,11 @@ namespace OpenSim.Grid.UserServer
|
||||
LLUUID guess = new LLUUID();
|
||||
try
|
||||
{
|
||||
guess = new LLUUID((string)requestData["avatar_uuid"]);
|
||||
guess = new LLUUID((string) requestData["avatar_uuid"]);
|
||||
|
||||
userProfile = GetUserProfile(guess);
|
||||
}
|
||||
catch (System.FormatException)
|
||||
catch (FormatException)
|
||||
{
|
||||
return CreateUnknownUserErrorResponse();
|
||||
}
|
||||
@@ -231,9 +233,9 @@ namespace OpenSim.Grid.UserServer
|
||||
throw new Exception("The method or operation is not implemented.");
|
||||
}
|
||||
|
||||
public override UserProfileData SetupMasterUser(libsecondlife.LLUUID uuid)
|
||||
public override UserProfileData SetupMasterUser(LLUUID uuid)
|
||||
{
|
||||
throw new Exception("The method or operation is not implemented.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user