SandBox mode login now shares a base class with the grid mode user server.
To allow people to login without creating accounts first in sandbox mode anytime a login request is received without a matching account already being in the database, a new account will be made. (also in sandbox mode, passwords aren't currently used).Sugilite
parent
2028cc5896
commit
a9dde515ba
|
@ -36,9 +36,9 @@ namespace OpenGrid.Framework.Communications
|
|||
{
|
||||
public interface IUserServices
|
||||
{
|
||||
UserProfileData GetUserProfile(string first_name, string last_name);
|
||||
UserProfileData GetUserProfile(string firstName, string lastName);
|
||||
UserProfileData GetUserProfile(string name);
|
||||
UserProfileData GetUserProfile(LLUUID avatar_id);
|
||||
UserProfileData GetUserProfile(LLUUID avatarID);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,656 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Collections;
|
||||
using System.Xml;
|
||||
using libsecondlife;
|
||||
using OpenSim.Framework.Utilities;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
using Nwc.XmlRpc;
|
||||
|
||||
namespace OpenGrid.Framework.UserManagement
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// A temp class to handle login response.
|
||||
/// Should make use of UserProfileManager where possible.
|
||||
/// </summary>
|
||||
|
||||
public class LoginResponse
|
||||
{
|
||||
private Hashtable loginFlagsHash;
|
||||
private Hashtable globalTexturesHash;
|
||||
private Hashtable loginError;
|
||||
private Hashtable eventCategoriesHash;
|
||||
private Hashtable uiConfigHash;
|
||||
private Hashtable classifiedCategoriesHash;
|
||||
|
||||
private ArrayList loginFlags;
|
||||
private ArrayList globalTextures;
|
||||
private ArrayList eventCategories;
|
||||
private ArrayList uiConfig;
|
||||
private ArrayList classifiedCategories;
|
||||
private ArrayList inventoryRoot;
|
||||
private ArrayList initialOutfit;
|
||||
private ArrayList agentInventory;
|
||||
|
||||
private UserInfo userProfile;
|
||||
|
||||
private LLUUID agentID;
|
||||
private LLUUID sessionID;
|
||||
private LLUUID secureSessionID;
|
||||
private LLUUID baseFolderID;
|
||||
private LLUUID inventoryFolderID;
|
||||
|
||||
// Login Flags
|
||||
private string dst;
|
||||
private string stipendSinceLogin;
|
||||
private string gendered;
|
||||
private string everLoggedIn;
|
||||
private string login;
|
||||
private int simPort;
|
||||
private string simAddress;
|
||||
private string agentAccess;
|
||||
private Int32 circuitCode;
|
||||
private uint regionX;
|
||||
private uint regionY;
|
||||
|
||||
// Login
|
||||
private string firstname;
|
||||
private string lastname;
|
||||
|
||||
// Global Textures
|
||||
private string sunTexture;
|
||||
private string cloudTexture;
|
||||
private string moonTexture;
|
||||
|
||||
// Error Flags
|
||||
private string errorReason;
|
||||
private string errorMessage;
|
||||
|
||||
// Response
|
||||
private XmlRpcResponse xmlRpcResponse;
|
||||
private XmlRpcResponse defaultXmlRpcResponse;
|
||||
|
||||
private string welcomeMessage;
|
||||
private string startLocation;
|
||||
private string allowFirstLife;
|
||||
private string home;
|
||||
private string seedCapability;
|
||||
private string lookAt;
|
||||
|
||||
public LoginResponse()
|
||||
{
|
||||
this.loginFlags = new ArrayList();
|
||||
this.globalTextures = new ArrayList();
|
||||
this.eventCategories = new ArrayList();
|
||||
this.uiConfig = new ArrayList();
|
||||
this.classifiedCategories = new ArrayList();
|
||||
|
||||
this.loginError = new Hashtable();
|
||||
this.eventCategoriesHash = new Hashtable();
|
||||
this.classifiedCategoriesHash = new Hashtable();
|
||||
this.uiConfigHash = new Hashtable();
|
||||
|
||||
this.defaultXmlRpcResponse = new XmlRpcResponse();
|
||||
this.userProfile = new UserInfo();
|
||||
this.inventoryRoot = new ArrayList();
|
||||
this.initialOutfit = new ArrayList();
|
||||
this.agentInventory = new ArrayList();
|
||||
|
||||
this.xmlRpcResponse = new XmlRpcResponse();
|
||||
this.defaultXmlRpcResponse = new XmlRpcResponse();
|
||||
|
||||
this.SetDefaultValues();
|
||||
} // LoginServer
|
||||
|
||||
public void SetDefaultValues()
|
||||
{
|
||||
try
|
||||
{
|
||||
this.DST = "N";
|
||||
this.StipendSinceLogin = "N";
|
||||
this.Gendered = "Y";
|
||||
this.EverLoggedIn = "Y";
|
||||
this.login = "false";
|
||||
this.firstname = "Test";
|
||||
this.lastname = "User";
|
||||
this.agentAccess = "M";
|
||||
this.startLocation = "last";
|
||||
this.allowFirstLife = "Y";
|
||||
|
||||
this.SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271";
|
||||
this.CloudTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
|
||||
this.MoonTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
|
||||
|
||||
this.ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock.";
|
||||
this.ErrorReason = "key";
|
||||
this.welcomeMessage = "Welcome to OpenSim!";
|
||||
this.seedCapability = "";
|
||||
this.home = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + this.userProfile.homepos.X.ToString() + ",r" + this.userProfile.homepos.Y.ToString() + ",r" + this.userProfile.homepos.Z.ToString() + "], 'look_at':[r" + this.userProfile.homelookat.X.ToString() + ",r" + this.userProfile.homelookat.Y.ToString() + ",r" + this.userProfile.homelookat.Z.ToString() + "]}";
|
||||
this.lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]";
|
||||
this.RegionX = (uint)255232;
|
||||
this.RegionY = (uint)254976;
|
||||
|
||||
// Classifieds;
|
||||
this.AddClassifiedCategory((Int32)1, "Shopping");
|
||||
this.AddClassifiedCategory((Int32)2, "Land Rental");
|
||||
this.AddClassifiedCategory((Int32)3, "Property Rental");
|
||||
this.AddClassifiedCategory((Int32)4, "Special Attraction");
|
||||
this.AddClassifiedCategory((Int32)5, "New Products");
|
||||
this.AddClassifiedCategory((Int32)6, "Employment");
|
||||
this.AddClassifiedCategory((Int32)7, "Wanted");
|
||||
this.AddClassifiedCategory((Int32)8, "Service");
|
||||
this.AddClassifiedCategory((Int32)9, "Personal");
|
||||
|
||||
|
||||
this.SessionID = LLUUID.Random();
|
||||
this.SecureSessionID = LLUUID.Random();
|
||||
this.AgentID = LLUUID.Random();
|
||||
|
||||
Hashtable InitialOutfitHash = new Hashtable();
|
||||
InitialOutfitHash["folder_name"] = "Nightclub Female";
|
||||
InitialOutfitHash["gender"] = "female";
|
||||
this.initialOutfit.Add(InitialOutfitHash);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
OpenSim.Framework.Console.MainLog.Instance.WriteLine(
|
||||
OpenSim.Framework.Console.LogPriority.LOW,
|
||||
"LoginResponse: Unable to set default values: " + e.Message
|
||||
);
|
||||
}
|
||||
|
||||
} // SetDefaultValues
|
||||
|
||||
#region Login Failure Methods
|
||||
public XmlRpcResponse GenerateFailureResponse(string reason, string message, string login)
|
||||
{
|
||||
// Overwrite any default values;
|
||||
this.xmlRpcResponse = new XmlRpcResponse();
|
||||
|
||||
// Ensure Login Failed message/reason;
|
||||
this.ErrorMessage = message;
|
||||
this.ErrorReason = reason;
|
||||
|
||||
this.loginError["reason"] = this.ErrorReason;
|
||||
this.loginError["message"] = this.ErrorMessage;
|
||||
this.loginError["login"] = login;
|
||||
this.xmlRpcResponse.Value = this.loginError;
|
||||
return (this.xmlRpcResponse);
|
||||
} // GenerateResponse
|
||||
|
||||
public XmlRpcResponse CreateFailedResponse()
|
||||
{
|
||||
return (this.CreateLoginFailedResponse());
|
||||
} // CreateErrorConnectingToGridResponse()
|
||||
|
||||
public XmlRpcResponse CreateLoginFailedResponse()
|
||||
{
|
||||
return (this.GenerateFailureResponse("key", "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.", "false"));
|
||||
} // LoginFailedResponse
|
||||
|
||||
public XmlRpcResponse CreateAlreadyLoggedInResponse()
|
||||
{
|
||||
return (this.GenerateFailureResponse("presence", "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner", "false"));
|
||||
} // CreateAlreadyLoggedInResponse()
|
||||
|
||||
public XmlRpcResponse CreateDeadRegionResponse()
|
||||
{
|
||||
return (this.GenerateFailureResponse("key", "The region you are attempting to log into is not responding. Please select another region and try again.", "false"));
|
||||
}
|
||||
|
||||
public XmlRpcResponse CreateGridErrorResponse()
|
||||
{
|
||||
return (this.GenerateFailureResponse("key", "Error connecting to grid. Could not percieve credentials from login XML.", "false"));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public XmlRpcResponse ToXmlRpcResponse()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
Hashtable responseData = new Hashtable();
|
||||
|
||||
this.loginFlagsHash = new Hashtable();
|
||||
this.loginFlagsHash["daylight_savings"] = this.DST;
|
||||
this.loginFlagsHash["stipend_since_login"] = this.StipendSinceLogin;
|
||||
this.loginFlagsHash["gendered"] = this.Gendered;
|
||||
this.loginFlagsHash["ever_logged_in"] = this.EverLoggedIn;
|
||||
this.loginFlags.Add(this.loginFlagsHash);
|
||||
|
||||
responseData["first_name"] = this.Firstname;
|
||||
responseData["last_name"] = this.Lastname;
|
||||
responseData["agent_access"] = this.agentAccess;
|
||||
|
||||
this.globalTexturesHash = new Hashtable();
|
||||
this.globalTexturesHash["sun_texture_id"] = this.SunTexture;
|
||||
this.globalTexturesHash["cloud_texture_id"] = this.CloudTexture;
|
||||
this.globalTexturesHash["moon_texture_id"] = this.MoonTexture;
|
||||
this.globalTextures.Add(this.globalTexturesHash);
|
||||
this.eventCategories.Add(this.eventCategoriesHash);
|
||||
|
||||
this.AddToUIConfig("allow_first_life", this.allowFirstLife);
|
||||
this.uiConfig.Add(this.uiConfigHash);
|
||||
|
||||
responseData["sim_port"] =(Int32) this.SimPort;
|
||||
responseData["sim_ip"] = this.SimAddress;
|
||||
responseData["agent_id"] = this.AgentID.ToStringHyphenated();
|
||||
responseData["session_id"] = this.SessionID.ToStringHyphenated();
|
||||
responseData["secure_session_id"] = this.SecureSessionID.ToStringHyphenated();
|
||||
responseData["circuit_code"] = this.CircuitCode;
|
||||
responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
|
||||
responseData["login-flags"] = this.loginFlags;
|
||||
responseData["global-textures"] = this.globalTextures;
|
||||
responseData["seed_capability"] = this.seedCapability;
|
||||
|
||||
responseData["event_categories"] = this.eventCategories;
|
||||
responseData["event_notifications"] = new ArrayList(); // todo
|
||||
responseData["classified_categories"] = this.classifiedCategories;
|
||||
responseData["ui-config"] = this.uiConfig;
|
||||
|
||||
responseData["inventory-skeleton"] = this.agentInventory;
|
||||
responseData["inventory-skel-lib"] = new ArrayList(); // todo
|
||||
responseData["inventory-root"] = this.inventoryRoot;
|
||||
responseData["gestures"] = new ArrayList(); // todo
|
||||
responseData["inventory-lib-owner"] = new ArrayList(); // todo
|
||||
responseData["initial-outfit"] = this.initialOutfit;
|
||||
responseData["start_location"] = this.startLocation;
|
||||
responseData["seed_capability"] = this.seedCapability;
|
||||
responseData["home"] = this.home;
|
||||
responseData["look_at"] = this.lookAt;
|
||||
responseData["message"] = this.welcomeMessage;
|
||||
responseData["region_x"] = (Int32)this.RegionX * 256;
|
||||
responseData["region_y"] = (Int32)this.RegionY * 256;
|
||||
|
||||
//responseData["inventory-lib-root"] = new ArrayList(); // todo
|
||||
//responseData["buddy-list"] = new ArrayList(); // todo
|
||||
|
||||
responseData["login"] = "true";
|
||||
this.xmlRpcResponse.Value = responseData;
|
||||
|
||||
return (this.xmlRpcResponse);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
OpenSim.Framework.Console.MainLog.Instance.WriteLine(
|
||||
OpenSim.Framework.Console.LogPriority.LOW,
|
||||
"LoginResponse: Error creating XML-RPC Response: " + e.Message
|
||||
);
|
||||
return (this.GenerateFailureResponse("Internal Error", "Error generating Login Response", "false"));
|
||||
|
||||
}
|
||||
|
||||
} // ToXmlRpcResponse
|
||||
|
||||
public void SetEventCategories(string category, string value)
|
||||
{
|
||||
this.eventCategoriesHash[category] = value;
|
||||
} // SetEventCategories
|
||||
|
||||
public void AddToUIConfig(string itemName, string item)
|
||||
{
|
||||
this.uiConfigHash[itemName] = item;
|
||||
} // SetUIConfig
|
||||
|
||||
public void AddClassifiedCategory(Int32 ID, string categoryName)
|
||||
{
|
||||
this.classifiedCategoriesHash["category_name"] = categoryName;
|
||||
this.classifiedCategoriesHash["category_id"] = ID;
|
||||
this.classifiedCategories.Add(this.classifiedCategoriesHash);
|
||||
// this.classifiedCategoriesHash.Clear();
|
||||
} // SetClassifiedCategory
|
||||
|
||||
#region Properties
|
||||
public string Login
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.login;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.login = value;
|
||||
}
|
||||
} // Login
|
||||
|
||||
public string DST
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.dst;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.dst = value;
|
||||
}
|
||||
} // DST
|
||||
|
||||
public string StipendSinceLogin
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.stipendSinceLogin;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.stipendSinceLogin = value;
|
||||
}
|
||||
} // StipendSinceLogin
|
||||
|
||||
public string Gendered
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.gendered;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.gendered = value;
|
||||
}
|
||||
} // Gendered
|
||||
|
||||
public string EverLoggedIn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.everLoggedIn;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.everLoggedIn = value;
|
||||
}
|
||||
} // EverLoggedIn
|
||||
|
||||
public int SimPort
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.simPort;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.simPort = value;
|
||||
}
|
||||
} // SimPort
|
||||
|
||||
public string SimAddress
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.simAddress;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.simAddress = value;
|
||||
}
|
||||
} // SimAddress
|
||||
|
||||
public LLUUID AgentID
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.agentID;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.agentID = value;
|
||||
}
|
||||
} // AgentID
|
||||
|
||||
public LLUUID SessionID
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.sessionID;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.sessionID = value;
|
||||
}
|
||||
} // SessionID
|
||||
|
||||
public LLUUID SecureSessionID
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.secureSessionID;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.secureSessionID = value;
|
||||
}
|
||||
} // SecureSessionID
|
||||
|
||||
public Int32 CircuitCode
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.circuitCode;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.circuitCode = value;
|
||||
}
|
||||
} // CircuitCode
|
||||
|
||||
public uint RegionX
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.regionX;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.regionX = value;
|
||||
}
|
||||
} // RegionX
|
||||
|
||||
public uint RegionY
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.regionY;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.regionY = value;
|
||||
}
|
||||
} // RegionY
|
||||
|
||||
public string SunTexture
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.sunTexture;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.sunTexture = value;
|
||||
}
|
||||
} // SunTexture
|
||||
|
||||
public string CloudTexture
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.cloudTexture;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.cloudTexture = value;
|
||||
}
|
||||
} // CloudTexture
|
||||
|
||||
public string MoonTexture
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.moonTexture;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.moonTexture = value;
|
||||
}
|
||||
} // MoonTexture
|
||||
|
||||
public string Firstname
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.firstname;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.firstname = value;
|
||||
}
|
||||
} // Firstname
|
||||
|
||||
public string Lastname
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.lastname;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.lastname = value;
|
||||
}
|
||||
} // Lastname
|
||||
|
||||
public string AgentAccess
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.agentAccess;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.agentAccess = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string StartLocation
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.startLocation;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.startLocation = value;
|
||||
}
|
||||
} // StartLocation
|
||||
|
||||
public string LookAt
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.lookAt;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.lookAt = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string SeedCapability
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.seedCapability;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.seedCapability = value;
|
||||
}
|
||||
} // SeedCapability
|
||||
|
||||
public string ErrorReason
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.errorReason;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.errorReason = value;
|
||||
}
|
||||
} // ErrorReason
|
||||
|
||||
public string ErrorMessage
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.errorMessage;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.errorMessage = value;
|
||||
}
|
||||
} // ErrorMessage
|
||||
|
||||
public ArrayList InventoryRoot
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.inventoryRoot;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.inventoryRoot = value;
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList InventorySkeleton
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.agentInventory;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.agentInventory = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string Home
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.home;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.home = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string Message
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.welcomeMessage;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.welcomeMessage = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
public class UserInfo
|
||||
{
|
||||
public string firstname;
|
||||
public string lastname;
|
||||
public ulong homeregionhandle;
|
||||
public LLVector3 homepos;
|
||||
public LLVector3 homelookat;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -108,6 +108,9 @@
|
|||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="LoginResponse.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UserManagerBase.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<resources prefix="OpenGrid.Framework.UserManagement" dynamicprefix="true" >
|
||||
</resources>
|
||||
<sources failonempty="true">
|
||||
<include name="LoginResponse.cs" />
|
||||
<include name="UserManagerBase.cs" />
|
||||
</sources>
|
||||
<references basedir="${project::get-base-directory()}">
|
||||
|
|
|
@ -79,37 +79,7 @@ namespace OpenGrid.Framework.UserManagement
|
|||
pluginAssembly = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
public void AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY)
|
||||
{
|
||||
UserProfileData user = new UserProfileData();
|
||||
user.homeLocation = new LLVector3(128, 128, 100);
|
||||
user.UUID = LLUUID.Random();
|
||||
user.username = firstName;
|
||||
user.surname = lastName;
|
||||
user.passwordHash = pass;
|
||||
user.passwordSalt = "";
|
||||
user.created = Util.UnixTimeSinceEpoch();
|
||||
user.homeLookAt = new LLVector3(100, 100, 100);
|
||||
user.homeRegion = Util.UIntsToLong((regX * 256), (regY * 256));
|
||||
|
||||
foreach (KeyValuePair<string, IUserData> plugin in _plugins)
|
||||
{
|
||||
try
|
||||
{
|
||||
plugin.Value.addNewUserProfile(user);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
OpenSim.Framework.Console.MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region Get UserProfile
|
||||
/// <summary>
|
||||
/// Loads a user profile from a database by UUID
|
||||
/// </summary>
|
||||
|
@ -190,7 +160,9 @@ namespace OpenGrid.Framework.UserManagement
|
|||
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Get UserAgent
|
||||
/// <summary>
|
||||
/// Loads a user agent by uuid (not called directly)
|
||||
/// </summary>
|
||||
|
@ -258,94 +230,9 @@ namespace OpenGrid.Framework.UserManagement
|
|||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a error response caused by invalid XML
|
||||
/// </summary>
|
||||
/// <returns>An XMLRPC response</returns>
|
||||
private static XmlRpcResponse CreateErrorConnectingToGridResponse()
|
||||
{
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable ErrorRespData = new Hashtable();
|
||||
ErrorRespData["reason"] = "key";
|
||||
ErrorRespData["message"] = "Error connecting to grid. Could not percieve credentials from login XML.";
|
||||
ErrorRespData["login"] = "false";
|
||||
response.Value = ErrorRespData;
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an error response caused by bad login credentials
|
||||
/// </summary>
|
||||
/// <returns>An XMLRPC response</returns>
|
||||
private static XmlRpcResponse CreateLoginErrorResponse()
|
||||
{
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable ErrorRespData = new Hashtable();
|
||||
ErrorRespData["reason"] = "key";
|
||||
ErrorRespData["message"] = "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.";
|
||||
ErrorRespData["login"] = "false";
|
||||
response.Value = ErrorRespData;
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an error response caused by being logged in already
|
||||
/// </summary>
|
||||
/// <returns>An XMLRPC Response</returns>
|
||||
private static XmlRpcResponse CreateAlreadyLoggedInResponse()
|
||||
{
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable PresenceErrorRespData = new Hashtable();
|
||||
PresenceErrorRespData["reason"] = "presence";
|
||||
PresenceErrorRespData["message"] = "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner";
|
||||
PresenceErrorRespData["login"] = "false";
|
||||
response.Value = PresenceErrorRespData;
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an error response caused by target region being down
|
||||
/// </summary>
|
||||
/// <returns>An XMLRPC Response</returns>
|
||||
private static XmlRpcResponse CreateDeadRegionResponse()
|
||||
{
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable PresenceErrorRespData = new Hashtable();
|
||||
PresenceErrorRespData["reason"] = "key";
|
||||
PresenceErrorRespData["message"] = "The region you are attempting to log into is not responding. Please select another region and try again.";
|
||||
PresenceErrorRespData["login"] = "false";
|
||||
response.Value = PresenceErrorRespData;
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Customises the login response and fills in missing values.
|
||||
/// </summary>
|
||||
/// <param name="response">The existing response</param>
|
||||
/// <param name="theUser">The user profile</param>
|
||||
public virtual void CustomiseResponse(ref Hashtable response, ref UserProfileData theUser)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks a user against it's password hash
|
||||
/// </summary>
|
||||
/// <param name="profile">The users profile</param>
|
||||
/// <param name="password">The supplied password</param>
|
||||
/// <returns>Authenticated?</returns>
|
||||
public bool AuthenticateUser(ref UserProfileData profile, string password)
|
||||
{
|
||||
OpenSim.Framework.Console.MainLog.Instance.Verbose(
|
||||
"Authenticating " + profile.username + " " + profile.surname);
|
||||
|
||||
password = password.Remove(0, 3); //remove $1$
|
||||
|
||||
string s = Util.Md5Hash(password + ":" + profile.passwordSalt);
|
||||
|
||||
return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region CreateAgent
|
||||
/// <summary>
|
||||
/// Creates and initialises a new user agent - make sure to use CommitAgent when done to submit to the DB
|
||||
/// </summary>
|
||||
|
@ -424,6 +311,58 @@ namespace OpenGrid.Framework.UserManagement
|
|||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Checks a user against it's password hash
|
||||
/// </summary>
|
||||
/// <param name="profile">The users profile</param>
|
||||
/// <param name="password">The supplied password</param>
|
||||
/// <returns>Authenticated?</returns>
|
||||
public virtual bool AuthenticateUser(ref UserProfileData profile, string password)
|
||||
{
|
||||
OpenSim.Framework.Console.MainLog.Instance.Verbose(
|
||||
"Authenticating " + profile.username + " " + profile.surname);
|
||||
|
||||
password = password.Remove(0, 3); //remove $1$
|
||||
|
||||
string s = Util.Md5Hash(password + ":" + profile.passwordSalt);
|
||||
|
||||
return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
|
||||
#region Xml Response
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="firstname"></param>
|
||||
/// <param name="lastname"></param>
|
||||
/// <returns></returns>
|
||||
public virtual UserProfileData GetTheUser(string firstname, string lastname)
|
||||
{
|
||||
return getUserProfile(firstname, lastname);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual string GetMessage()
|
||||
{
|
||||
return _config.DefaultStartupMsg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Customises the login response and fills in missing values.
|
||||
/// </summary>
|
||||
/// <param name="response">The existing response</param>
|
||||
/// <param name="theUser">The user profile</param>
|
||||
public virtual void CustomiseResponse(ref LoginResponse response, ref UserProfileData theUser)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Main user login function
|
||||
/// </summary>
|
||||
|
@ -441,6 +380,7 @@ namespace OpenGrid.Framework.UserManagement
|
|||
string passwd = "";
|
||||
|
||||
UserProfileData TheUser;
|
||||
LoginResponse logResponse = new LoginResponse();
|
||||
|
||||
if (GoodXML)
|
||||
{
|
||||
|
@ -448,20 +388,20 @@ namespace OpenGrid.Framework.UserManagement
|
|||
lastname = (string)requestData["last"];
|
||||
passwd = (string)requestData["passwd"];
|
||||
|
||||
TheUser = getUserProfile(firstname, lastname);
|
||||
TheUser = GetTheUser(firstname, lastname);
|
||||
if (TheUser == null)
|
||||
return CreateLoginErrorResponse();
|
||||
return logResponse.CreateLoginFailedResponse();
|
||||
|
||||
GoodLogin = AuthenticateUser(ref TheUser, passwd);
|
||||
}
|
||||
else
|
||||
{
|
||||
return CreateErrorConnectingToGridResponse();
|
||||
return logResponse.CreateGridErrorResponse();
|
||||
}
|
||||
|
||||
if (!GoodLogin)
|
||||
{
|
||||
return CreateLoginErrorResponse();
|
||||
return logResponse.CreateLoginFailedResponse();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -469,7 +409,7 @@ namespace OpenGrid.Framework.UserManagement
|
|||
if (TheUser.currentAgent != null && TheUser.currentAgent.agentOnline)
|
||||
{
|
||||
// Reject the login
|
||||
return CreateAlreadyLoggedInResponse();
|
||||
return logResponse.CreateAlreadyLoggedInResponse();
|
||||
}
|
||||
// Otherwise...
|
||||
// Create a new agent session
|
||||
|
@ -477,40 +417,9 @@ namespace OpenGrid.Framework.UserManagement
|
|||
|
||||
try
|
||||
{
|
||||
Hashtable responseData = new Hashtable();
|
||||
|
||||
LLUUID AgentID = TheUser.UUID;
|
||||
|
||||
// Global Texture Section
|
||||
Hashtable GlobalT = new Hashtable();
|
||||
GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271";
|
||||
GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
|
||||
GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
|
||||
ArrayList GlobalTextures = new ArrayList();
|
||||
GlobalTextures.Add(GlobalT);
|
||||
|
||||
// Login Flags Section
|
||||
Hashtable LoginFlagsHash = new Hashtable();
|
||||
LoginFlagsHash["daylight_savings"] = "N";
|
||||
LoginFlagsHash["stipend_since_login"] = "N";
|
||||
LoginFlagsHash["gendered"] = "Y"; // Needs to be combined with below...
|
||||
LoginFlagsHash["ever_logged_in"] = "Y"; // Should allow male/female av selection
|
||||
ArrayList LoginFlags = new ArrayList();
|
||||
LoginFlags.Add(LoginFlagsHash);
|
||||
|
||||
// UI Customisation Section
|
||||
Hashtable uiconfig = new Hashtable();
|
||||
uiconfig["allow_first_life"] = "Y";
|
||||
ArrayList ui_config = new ArrayList();
|
||||
ui_config.Add(uiconfig);
|
||||
|
||||
// Classified Categories Section
|
||||
Hashtable ClassifiedCategoriesHash = new Hashtable();
|
||||
ClassifiedCategoriesHash["category_name"] = "Generic";
|
||||
ClassifiedCategoriesHash["category_id"] = (Int32)1;
|
||||
ArrayList ClassifiedCategories = new ArrayList();
|
||||
ClassifiedCategories.Add(ClassifiedCategoriesHash);
|
||||
|
||||
// Inventory Library Section
|
||||
ArrayList AgentInventoryArray = new ArrayList();
|
||||
Hashtable TempHash;
|
||||
|
@ -534,62 +443,37 @@ namespace OpenGrid.Framework.UserManagement
|
|||
ArrayList InventoryRoot = new ArrayList();
|
||||
InventoryRoot.Add(InventoryRootHash);
|
||||
|
||||
Hashtable InitialOutfitHash = new Hashtable();
|
||||
InitialOutfitHash["folder_name"] = "Nightclub Female";
|
||||
InitialOutfitHash["gender"] = "female";
|
||||
ArrayList InitialOutfit = new ArrayList();
|
||||
InitialOutfit.Add(InitialOutfitHash);
|
||||
|
||||
// Circuit Code
|
||||
uint circode = (uint)(Util.RandomClass.Next());
|
||||
|
||||
// Generics
|
||||
responseData["last_name"] = TheUser.surname;
|
||||
responseData["ui-config"] = ui_config;
|
||||
responseData["sim_ip"] = "127.0.0.1"; //SimInfo.sim_ip.ToString();
|
||||
responseData["login-flags"] = LoginFlags;
|
||||
responseData["global-textures"] = GlobalTextures;
|
||||
responseData["classified_categories"] = ClassifiedCategories;
|
||||
responseData["event_categories"] = new ArrayList();
|
||||
responseData["inventory-skeleton"] = AgentInventoryArray;
|
||||
responseData["inventory-skel-lib"] = new ArrayList();
|
||||
responseData["inventory-root"] = InventoryRoot;
|
||||
responseData["event_notifications"] = new ArrayList();
|
||||
responseData["gestures"] = new ArrayList();
|
||||
responseData["inventory-lib-owner"] = new ArrayList();
|
||||
responseData["initial-outfit"] = InitialOutfit;
|
||||
responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
|
||||
responseData["start_location"] = "last";
|
||||
responseData["home"] = "!!null temporary value {home}!!"; // Overwritten
|
||||
responseData["message"] = _config.DefaultStartupMsg;
|
||||
responseData["first_name"] = TheUser.username;
|
||||
responseData["circuit_code"] = (Int32)circode;
|
||||
responseData["sim_port"] = 0; //(Int32)SimInfo.sim_port;
|
||||
responseData["secure_session_id"] = TheUser.currentAgent.secureSessionID.ToStringHyphenated();
|
||||
responseData["look_at"] = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n";
|
||||
responseData["agent_id"] = AgentID.ToStringHyphenated();
|
||||
responseData["region_y"] = (Int32)0; // Overwritten
|
||||
responseData["region_x"] = (Int32)0; // Overwritten
|
||||
responseData["seed_capability"] = "";
|
||||
responseData["agent_access"] = "M";
|
||||
responseData["session_id"] = TheUser.currentAgent.sessionID.ToStringHyphenated();
|
||||
responseData["login"] = "true";
|
||||
logResponse.Lastname = TheUser.surname;
|
||||
logResponse.Firstname = TheUser.username;
|
||||
logResponse.AgentID = AgentID.ToStringHyphenated();
|
||||
logResponse.SessionID = TheUser.currentAgent.sessionID.ToStringHyphenated();
|
||||
logResponse.SecureSessionID = TheUser.currentAgent.secureSessionID.ToStringHyphenated();
|
||||
logResponse.InventoryRoot = InventoryRoot;
|
||||
logResponse.InventorySkeleton = AgentInventoryArray;
|
||||
logResponse.CircuitCode = (Int32)circode;
|
||||
logResponse.RegionX = 0; //overwritten
|
||||
logResponse.RegionY = 0; //overwritten
|
||||
logResponse.Home = "!!null temporary value {home}!!"; // Overwritten
|
||||
//logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n";
|
||||
logResponse.SimAddress = "127.0.0.1"; //overwritten
|
||||
logResponse.SimPort = 0; //overwritten
|
||||
logResponse.Message = this.GetMessage();
|
||||
|
||||
try
|
||||
{
|
||||
this.CustomiseResponse(ref responseData, ref TheUser);
|
||||
this.CustomiseResponse(ref logResponse, ref TheUser);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.ToString());
|
||||
return CreateDeadRegionResponse();
|
||||
return logResponse.CreateDeadRegionResponse();
|
||||
}
|
||||
|
||||
CommitAgent(ref TheUser);
|
||||
|
||||
response.Value = responseData;
|
||||
// TheUser.SendDataToSim(SimInfo);
|
||||
return response;
|
||||
return logResponse.ToXmlRpcResponse();
|
||||
|
||||
}
|
||||
catch (Exception E)
|
||||
|
@ -602,6 +486,8 @@ namespace OpenGrid.Framework.UserManagement
|
|||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Deletes an active agent session
|
||||
/// </summary>
|
||||
|
@ -616,6 +502,37 @@ namespace OpenGrid.Framework.UserManagement
|
|||
return "OK";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
public void AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY)
|
||||
{
|
||||
UserProfileData user = new UserProfileData();
|
||||
user.homeLocation = new LLVector3(128, 128, 100);
|
||||
user.UUID = LLUUID.Random();
|
||||
user.username = firstName;
|
||||
user.surname = lastName;
|
||||
user.passwordHash = pass;
|
||||
user.passwordSalt = "";
|
||||
user.created = Util.UnixTimeSinceEpoch();
|
||||
user.homeLookAt = new LLVector3(100, 100, 100);
|
||||
user.homeRegion = Util.UIntsToLong((regX * 256), (regY * 256));
|
||||
|
||||
foreach (KeyValuePair<string, IUserData> plugin in _plugins)
|
||||
{
|
||||
try
|
||||
{
|
||||
plugin.Value.addNewUserProfile(user);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
OpenSim.Framework.Console.MainLog.Instance.Verbose("Unable to add user via " + plugin.Key + "(" + e.ToString() + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an error message that the user could not be found in the database
|
||||
/// </summary>
|
||||
|
@ -693,6 +610,8 @@ namespace OpenGrid.Framework.UserManagement
|
|||
return sw.ToString();
|
||||
}
|
||||
|
||||
#region REST Methods
|
||||
//should most likely move out of here and into the grid's userserver sub class
|
||||
public string RestGetUserMethodName(string request, string path, string param)
|
||||
{
|
||||
UserProfileData userProfile = getUserProfile(param.Trim());
|
||||
|
@ -716,6 +635,7 @@ namespace OpenGrid.Framework.UserManagement
|
|||
|
||||
return ProfileToXml(userProfile);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,16 +45,47 @@ namespace OpenSim.Framework.Types
|
|||
public string UserRecvKey = "";
|
||||
public bool isSandbox;
|
||||
|
||||
public uint DefaultHomeLocX = 0;
|
||||
public uint DefaultHomeLocY = 0;
|
||||
|
||||
public void InitConfig(bool sandboxMode, IGenericConfig configData)
|
||||
{
|
||||
this.isSandbox = sandboxMode;
|
||||
|
||||
try
|
||||
{
|
||||
string attri = "";
|
||||
// default home location X
|
||||
attri = "";
|
||||
attri = configData.GetAttribute("DefaultLocationX");
|
||||
if (attri == "")
|
||||
{
|
||||
string location = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Default Home Location X", "1000");
|
||||
configData.SetAttribute("DefaultLocationX", location);
|
||||
this.DefaultHomeLocX = (uint)Convert.ToUInt32(location);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.DefaultHomeLocX = (uint)Convert.ToUInt32(attri);
|
||||
}
|
||||
|
||||
// default home location Y
|
||||
attri = "";
|
||||
attri = configData.GetAttribute("DefaultLocationY");
|
||||
if (attri == "")
|
||||
{
|
||||
string location = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Default Home Location Y", "1000");
|
||||
configData.SetAttribute("DefaultLocationY", location);
|
||||
this.DefaultHomeLocY = (uint)Convert.ToUInt32(location);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.DefaultHomeLocY = (uint)Convert.ToUInt32(attri);
|
||||
}
|
||||
|
||||
if (!isSandbox)
|
||||
{
|
||||
string attri = "";
|
||||
//Grid Server URL
|
||||
//Grid Server
|
||||
attri = "";
|
||||
attri = configData.GetAttribute("GridServerURL");
|
||||
if (attri == "")
|
||||
|
|
|
@ -60,7 +60,6 @@ namespace OpenSim.Framework.Types
|
|||
public sbyte PathTwistBegin;
|
||||
public byte[] Texture;
|
||||
|
||||
|
||||
public Int32 CreationDate;
|
||||
public uint OwnerMask = FULL_MASK_PERMISSIONS;
|
||||
public uint NextOwnerMask = FULL_MASK_PERMISSIONS;
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace OpenSim.UserServer
|
|||
private ArrayList initialOutfit;
|
||||
private ArrayList agentInventory;
|
||||
|
||||
private UserProfile userProfile;
|
||||
private UserInfo userProfile;
|
||||
|
||||
private LLUUID agentID;
|
||||
private LLUUID sessionID;
|
||||
|
@ -131,7 +131,7 @@ namespace OpenSim.UserServer
|
|||
this.uiConfigHash = new Hashtable();
|
||||
|
||||
this.defaultXmlRpcResponse = new XmlRpcResponse();
|
||||
this.userProfile = new UserProfile();
|
||||
this.userProfile = new UserInfo();
|
||||
this.inventoryRoot = new ArrayList();
|
||||
this.initialOutfit = new ArrayList();
|
||||
this.agentInventory = new ArrayList();
|
||||
|
@ -181,28 +181,9 @@ namespace OpenSim.UserServer
|
|||
this.AddClassifiedCategory((Int32)8, "Service");
|
||||
this.AddClassifiedCategory((Int32)9, "Personal");
|
||||
|
||||
int SessionRand = Util.RandomClass.Next(1, 999);
|
||||
this.SessionID = new LLUUID("aaaabbbb-0200-" + SessionRand.ToString("0000") + "-8664-58f53e442797");
|
||||
this.SessionID = LLUUID.Random();
|
||||
this.SecureSessionID = LLUUID.Random();
|
||||
|
||||
this.userProfile.Inventory.CreateRootFolder(this.userProfile.UUID, true);
|
||||
this.baseFolderID = this.userProfile.Inventory.GetFolderID("Textures");
|
||||
this.inventoryFolderID = this.userProfile.Inventory.GetFolderID("My Inventory-");
|
||||
Hashtable InventoryRootHash = new Hashtable();
|
||||
InventoryRootHash["folder_id"] = this.userProfile.Inventory.InventoryRoot.FolderID.ToStringHyphenated();
|
||||
this.inventoryRoot.Add(InventoryRootHash);
|
||||
|
||||
Hashtable TempHash;
|
||||
foreach (InventoryFolder InvFolder in this.userProfile.Inventory.InventoryFolders.Values)
|
||||
{
|
||||
TempHash = new Hashtable();
|
||||
TempHash["name"] = InvFolder.FolderName;
|
||||
TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
|
||||
TempHash["version"] = (Int32)InvFolder.Version;
|
||||
TempHash["type_default"] = (Int32)InvFolder.DefaultType;
|
||||
TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
|
||||
this.agentInventory.Add(TempHash);
|
||||
}
|
||||
this.AgentID = LLUUID.Random();
|
||||
|
||||
Hashtable InitialOutfitHash = new Hashtable();
|
||||
InitialOutfitHash["folder_name"] = "Nightclub Female";
|
||||
|
@ -219,15 +200,6 @@ namespace OpenSim.UserServer
|
|||
|
||||
} // SetDefaultValues
|
||||
|
||||
protected virtual LLUUID GetAgentId()
|
||||
{
|
||||
// todo
|
||||
LLUUID Agent;
|
||||
int AgentRand = Util.RandomClass.Next(1, 9999);
|
||||
Agent = new LLUUID("99998888-0100-" + AgentRand.ToString("0000") + "-8ec1-0b1d5cd6aead");
|
||||
return Agent;
|
||||
} // GetAgentId
|
||||
|
||||
private XmlRpcResponse GenerateFailureResponse(string reason, string message, string login)
|
||||
{
|
||||
// Overwrite any default values;
|
||||
|
@ -287,9 +259,6 @@ namespace OpenSim.UserServer
|
|||
this.AddToUIConfig("allow_first_life", this.allowFirstLife);
|
||||
this.uiConfig.Add(this.uiConfigHash);
|
||||
|
||||
// Create a agent and session LLUUID
|
||||
this.agentID = this.GetAgentId();
|
||||
|
||||
responseData["sim_port"] = this.SimPort;
|
||||
responseData["sim_ip"] = this.SimAddress;
|
||||
responseData["agent_id"] = this.AgentID.ToStringHyphenated();
|
||||
|
@ -320,6 +289,9 @@ namespace OpenSim.UserServer
|
|||
responseData["region_x"] = (Int32)this.RegionX * 256;
|
||||
responseData["region_y"] = (Int32)this.RegionY * 256;
|
||||
|
||||
//responseData["inventory-lib-root"] = new ArrayList(); // todo
|
||||
//responseData["buddy-list"] = new ArrayList(); // todo
|
||||
|
||||
responseData["login"] = "true";
|
||||
this.xmlRpcResponse.Value = responseData;
|
||||
|
||||
|
@ -355,6 +327,7 @@ namespace OpenSim.UserServer
|
|||
// this.classifiedCategoriesHash.Clear();
|
||||
} // SetClassifiedCategory
|
||||
|
||||
#region Properties
|
||||
public string Login
|
||||
{
|
||||
get
|
||||
|
@ -667,5 +640,16 @@ namespace OpenSim.UserServer
|
|||
}
|
||||
} // ErrorMessage
|
||||
|
||||
} // LoginResponse
|
||||
} // namespace OpenSim.UserServer
|
||||
#endregion
|
||||
|
||||
|
||||
public class UserInfo
|
||||
{
|
||||
public string firstname;
|
||||
public string lastname;
|
||||
public ulong homeregionhandle;
|
||||
public LLVector3 homepos;
|
||||
public LLVector3 homelookat;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -148,36 +148,14 @@ namespace OpenSim.UserServer
|
|||
|
||||
NumClients++;
|
||||
|
||||
// Create a agent and session LLUUID
|
||||
// Agent = GetAgentId(first, last);
|
||||
// int SessionRand = Util.RandomClass.Next(1, 999);
|
||||
// Session = new LLUUID("aaaabbbb-0200-" + SessionRand.ToString("0000") + "-8664-58f53e442797");
|
||||
// LLUUID secureSess = LLUUID.Random();
|
||||
|
||||
loginResponse.SimPort = m_simPort.ToString();
|
||||
loginResponse.SimAddress = m_simAddr.ToString();
|
||||
// loginResponse.AgentID = Agent.ToStringHyphenated();
|
||||
// loginResponse.SessionID = Session.ToStringHyphenated();
|
||||
// loginResponse.SecureSessionID = secureSess.ToStringHyphenated();
|
||||
|
||||
loginResponse.CircuitCode = (Int32)(Util.RandomClass.Next());
|
||||
XmlRpcResponse response = loginResponse.ToXmlRpcResponse();
|
||||
Hashtable responseData = (Hashtable)response.Value;
|
||||
|
||||
//inventory
|
||||
/* ArrayList InventoryList = (ArrayList)responseData["inventory-skeleton"];
|
||||
Hashtable Inventory1 = (Hashtable)InventoryList[0];
|
||||
Hashtable Inventory2 = (Hashtable)InventoryList[1];
|
||||
LLUUID BaseFolderID = LLUUID.Random();
|
||||
LLUUID InventoryFolderID = LLUUID.Random();
|
||||
Inventory2["name"] = "Textures";
|
||||
Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated();
|
||||
Inventory2["type_default"] = 0;
|
||||
Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated();
|
||||
|
||||
ArrayList InventoryRoot = (ArrayList)responseData["inventory-root"];
|
||||
Hashtable Inventoryroot = (Hashtable)InventoryRoot[0];
|
||||
Inventoryroot["folder_id"] = InventoryFolderID.ToStringHyphenated();
|
||||
*/
|
||||
CustomiseLoginResponse(responseData, first, last);
|
||||
|
||||
Login _login = new Login();
|
||||
|
@ -191,11 +169,6 @@ namespace OpenSim.UserServer
|
|||
_login.BaseFolder = loginResponse.BaseFolderID;
|
||||
_login.InventoryFolder = loginResponse.InventoryFolderID;
|
||||
|
||||
//working on local computer if so lets add to the gridserver's list of sessions?
|
||||
/* if (m_gridServer.GetName() == "Local")
|
||||
{
|
||||
((LocalGridBase)m_gridServer).AddNewSession(_login);
|
||||
}*/
|
||||
ulong reghand = Helpers.UIntsToLong((regionX * 256), (regionY * 256));
|
||||
AddSession(reghand,_login);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
# Visual C# Express 2005
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGrid.Config.GridConfigDb4o", "OpenGridServices\OpenGrid.Config\GridConfigDb4o\OpenGrid.Config.GridConfigDb4o.csproj", "{B0027747-0000-0000-0000-000000000000}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGrid.Framework.Data", "Common\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj", "{62CDF671-0000-0000-0000-000000000000}"
|
||||
|
@ -29,16 +29,6 @@ Global
|
|||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectDependencies) = postSolution
|
||||
({39BD9497-0000-0000-0000-000000000000}).2 = ({62CDF671-0000-0000-0000-000000000000})
|
||||
({0A563AC1-0000-0000-0000-000000000000}).1 = ({62CDF671-0000-0000-0000-000000000000})
|
||||
({0F3C3AC1-0000-0000-0000-000000000000}).2 = ({62CDF671-0000-0000-0000-000000000000})
|
||||
({1E3F341A-0000-0000-0000-000000000000}).1 = ({62CDF671-0000-0000-0000-000000000000})
|
||||
({DA9A7391-0000-0000-0000-000000000000}).2 = ({62CDF671-0000-0000-0000-000000000000})
|
||||
({21BFC8E2-0000-0000-0000-000000000000}).2 = ({62CDF671-0000-0000-0000-000000000000})
|
||||
({21BFC8E2-0000-0000-0000-000000000000}).3 = ({7924FD35-0000-0000-0000-000000000000})
|
||||
({66591469-0000-0000-0000-000000000000}).2 = ({62CDF671-0000-0000-0000-000000000000})
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{B0027747-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B0027747-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace OpenGridServices.UserServer
|
|||
/// </summary>
|
||||
/// <param name="response">The existing response</param>
|
||||
/// <param name="theUser">The user profile</param>
|
||||
public override void CustomiseResponse(ref Hashtable response, ref UserProfileData theUser)
|
||||
public override void CustomiseResponse(ref LoginResponse response, ref UserProfileData theUser)
|
||||
{
|
||||
// Load information from the gridserver
|
||||
SimProfile SimInfo = new SimProfile();
|
||||
|
@ -63,15 +63,15 @@ namespace OpenGridServices.UserServer
|
|||
|
||||
// Customise the response
|
||||
// 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
|
||||
response["sim_ip"] = SimInfo.sim_ip;
|
||||
response["sim_port"] = (Int32)SimInfo.sim_port;
|
||||
response["region_y"] = (Int32)SimInfo.RegionLocY * 256;
|
||||
response["region_x"] = (Int32)SimInfo.RegionLocX * 256;
|
||||
response.SimAddress = SimInfo.sim_ip;
|
||||
response.SimPort = (Int32)SimInfo.sim_port;
|
||||
response.RegionX = SimInfo.RegionLocY ;
|
||||
response.RegionY = SimInfo.RegionLocX ;
|
||||
|
||||
// Notify the target of an incoming user
|
||||
Console.WriteLine("Notifying " + SimInfo.regionname + " (" + SimInfo.caps_url + ")");
|
||||
|
@ -83,7 +83,7 @@ namespace OpenGridServices.UserServer
|
|||
SimParams["firstname"] = theUser.username;
|
||||
SimParams["lastname"] = theUser.surname;
|
||||
SimParams["agent_id"] = theUser.UUID.ToString();
|
||||
SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response["circuit_code"]);
|
||||
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();
|
||||
|
|
80
OpenSim.sln
80
OpenSim.sln
|
@ -1,5 +1,5 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
# Visual C# Express 2005
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGrid.Framework.Communications", "Common\OpenGrid.Framework.Communications\OpenGrid.Framework.Communications.csproj", "{683344D5-0000-0000-0000-000000000000}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGrid.Framework.Data", "Common\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj", "{62CDF671-0000-0000-0000-000000000000}"
|
||||
|
@ -55,84 +55,6 @@ Global
|
|||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectDependencies) = postSolution
|
||||
({683344D5-0000-0000-0000-000000000000}).1 = ({62CDF671-0000-0000-0000-000000000000})
|
||||
({683344D5-0000-0000-0000-000000000000}).2 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({39BD9497-0000-0000-0000-000000000000}).2 = ({62CDF671-0000-0000-0000-000000000000})
|
||||
({DA9A7391-0000-0000-0000-000000000000}).2 = ({62CDF671-0000-0000-0000-000000000000})
|
||||
({DA9A7391-0000-0000-0000-000000000000}).3 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({DA9A7391-0000-0000-0000-000000000000}).4 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||
({DA9A7391-0000-0000-0000-000000000000}).5 = ({E88EF749-0000-0000-0000-000000000000})
|
||||
({DA9A7391-0000-0000-0000-000000000000}).6 = ({8BB20F0A-0000-0000-0000-000000000000})
|
||||
({DA9A7391-0000-0000-0000-000000000000}).10 = ({8E81D43C-0000-0000-0000-000000000000})
|
||||
({438A9556-0000-0000-0000-000000000000}).3 = ({683344D5-0000-0000-0000-000000000000})
|
||||
({438A9556-0000-0000-0000-000000000000}).4 = ({1938EB12-0000-0000-0000-000000000000})
|
||||
({438A9556-0000-0000-0000-000000000000}).5 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({438A9556-0000-0000-0000-000000000000}).6 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||
({438A9556-0000-0000-0000-000000000000}).7 = ({E88EF749-0000-0000-0000-000000000000})
|
||||
({438A9556-0000-0000-0000-000000000000}).8 = ({79CED992-0000-0000-0000-000000000000})
|
||||
({438A9556-0000-0000-0000-000000000000}).9 = ({8BE16150-0000-0000-0000-000000000000})
|
||||
({438A9556-0000-0000-0000-000000000000}).10 = ({196916AF-0000-0000-0000-000000000000})
|
||||
({438A9556-0000-0000-0000-000000000000}).11 = ({632E1BFD-0000-0000-0000-000000000000})
|
||||
({438A9556-0000-0000-0000-000000000000}).12 = ({8BB20F0A-0000-0000-0000-000000000000})
|
||||
({438A9556-0000-0000-0000-000000000000}).13 = ({2270B8FE-0000-0000-0000-000000000000})
|
||||
({438A9556-0000-0000-0000-000000000000}).16 = ({8E81D43C-0000-0000-0000-000000000000})
|
||||
({1938EB12-0000-0000-0000-000000000000}).1 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({8ACA2445-0000-0000-0000-000000000000}).2 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||
({8ACA2445-0000-0000-0000-000000000000}).5 = ({8E81D43C-0000-0000-0000-000000000000})
|
||||
({E88EF749-0000-0000-0000-000000000000}).0 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({546099CD-0000-0000-0000-000000000000}).2 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({546099CD-0000-0000-0000-000000000000}).3 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||
({B55C0B5D-0000-0000-0000-000000000000}).1 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({B55C0B5D-0000-0000-0000-000000000000}).2 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||
({B55C0B5D-0000-0000-0000-000000000000}).5 = ({8E81D43C-0000-0000-0000-000000000000})
|
||||
({79CED992-0000-0000-0000-000000000000}).1 = ({683344D5-0000-0000-0000-000000000000})
|
||||
({79CED992-0000-0000-0000-000000000000}).2 = ({62CDF671-0000-0000-0000-000000000000})
|
||||
({79CED992-0000-0000-0000-000000000000}).3 = ({DA9A7391-0000-0000-0000-000000000000})
|
||||
({79CED992-0000-0000-0000-000000000000}).4 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({4F874463-0000-0000-0000-000000000000}).1 = ({8BE16150-0000-0000-0000-000000000000})
|
||||
({8BE16150-0000-0000-0000-000000000000}).1 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({8BE16150-0000-0000-0000-000000000000}).2 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||
({63A05FE9-0000-0000-0000-000000000000}).2 = ({8BE16150-0000-0000-0000-000000000000})
|
||||
({988F0AC4-0000-0000-0000-000000000000}).1 = ({8BE16150-0000-0000-0000-000000000000})
|
||||
({196916AF-0000-0000-0000-000000000000}).3 = ({683344D5-0000-0000-0000-000000000000})
|
||||
({196916AF-0000-0000-0000-000000000000}).4 = ({1938EB12-0000-0000-0000-000000000000})
|
||||
({196916AF-0000-0000-0000-000000000000}).5 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({196916AF-0000-0000-0000-000000000000}).6 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||
({196916AF-0000-0000-0000-000000000000}).7 = ({E88EF749-0000-0000-0000-000000000000})
|
||||
({196916AF-0000-0000-0000-000000000000}).8 = ({8BE16150-0000-0000-0000-000000000000})
|
||||
({196916AF-0000-0000-0000-000000000000}).9 = ({8BB20F0A-0000-0000-0000-000000000000})
|
||||
({196916AF-0000-0000-0000-000000000000}).10 = ({2270B8FE-0000-0000-0000-000000000000})
|
||||
({196916AF-0000-0000-0000-000000000000}).13 = ({8E81D43C-0000-0000-0000-000000000000})
|
||||
({632E1BFD-0000-0000-0000-000000000000}).3 = ({1938EB12-0000-0000-0000-000000000000})
|
||||
({632E1BFD-0000-0000-0000-000000000000}).4 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({632E1BFD-0000-0000-0000-000000000000}).5 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||
({632E1BFD-0000-0000-0000-000000000000}).6 = ({E88EF749-0000-0000-0000-000000000000})
|
||||
({632E1BFD-0000-0000-0000-000000000000}).7 = ({8BE16150-0000-0000-0000-000000000000})
|
||||
({632E1BFD-0000-0000-0000-000000000000}).8 = ({196916AF-0000-0000-0000-000000000000})
|
||||
({632E1BFD-0000-0000-0000-000000000000}).9 = ({8BB20F0A-0000-0000-0000-000000000000})
|
||||
({632E1BFD-0000-0000-0000-000000000000}).10 = ({2270B8FE-0000-0000-0000-000000000000})
|
||||
({632E1BFD-0000-0000-0000-000000000000}).13 = ({8E81D43C-0000-0000-0000-000000000000})
|
||||
({8BB20F0A-0000-0000-0000-000000000000}).1 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({8BB20F0A-0000-0000-0000-000000000000}).2 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||
({8BB20F0A-0000-0000-0000-000000000000}).5 = ({8E81D43C-0000-0000-0000-000000000000})
|
||||
({EE9E5D96-0000-0000-0000-000000000000}).3 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({EE9E5D96-0000-0000-0000-000000000000}).4 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||
({E1B79ECF-0000-0000-0000-000000000000}).2 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({E1B79ECF-0000-0000-0000-000000000000}).3 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||
({6B20B603-0000-0000-0000-000000000000}).1 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({6B20B603-0000-0000-0000-000000000000}).2 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||
({24B12448-0000-0000-0000-000000000000}).1 = ({683344D5-0000-0000-0000-000000000000})
|
||||
({24B12448-0000-0000-0000-000000000000}).2 = ({1938EB12-0000-0000-0000-000000000000})
|
||||
({24B12448-0000-0000-0000-000000000000}).3 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||
({24B12448-0000-0000-0000-000000000000}).4 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||
({24B12448-0000-0000-0000-000000000000}).5 = ({546099CD-0000-0000-0000-000000000000})
|
||||
({24B12448-0000-0000-0000-000000000000}).6 = ({79CED992-0000-0000-0000-000000000000})
|
||||
({24B12448-0000-0000-0000-000000000000}).7 = ({196916AF-0000-0000-0000-000000000000})
|
||||
({24B12448-0000-0000-0000-000000000000}).8 = ({632E1BFD-0000-0000-0000-000000000000})
|
||||
({24B12448-0000-0000-0000-000000000000}).9 = ({8BB20F0A-0000-0000-0000-000000000000})
|
||||
({24B12448-0000-0000-0000-000000000000}).13 = ({8E81D43C-0000-0000-0000-000000000000})
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{683344D5-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{683344D5-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace SimpleApp
|
|||
|
||||
ClientView.TerrainManager = new TerrainManager(new SecondLife());
|
||||
|
||||
CommunicationsManager communicationsManager = new CommunicationsLocal();
|
||||
CommunicationsManager communicationsManager = new CommunicationsLocal(1000, 1000);
|
||||
|
||||
RegionInfo regionInfo = new RegionInfo( );
|
||||
|
||||
|
|
|
@ -41,13 +41,20 @@ namespace OpenSim.LocalCommunications
|
|||
public class CommunicationsLocal : CommunicationsManager
|
||||
{
|
||||
public LocalBackEndServices SandBoxServices = new LocalBackEndServices();
|
||||
protected LocalUserServices UserServices = new LocalUserServices();
|
||||
public LocalUserServices UserServices;
|
||||
|
||||
public CommunicationsLocal()
|
||||
public CommunicationsLocal(uint defaultHomeX , uint defaultHomeY)
|
||||
{
|
||||
UserServices = new LocalUserServices(this , defaultHomeX, defaultHomeY);
|
||||
UserServices.AddPlugin("OpenGrid.Framework.Data.DB4o.dll");
|
||||
UserServer = UserServices;
|
||||
GridServer = SandBoxServices;
|
||||
InterRegion = SandBoxServices;
|
||||
}
|
||||
|
||||
internal void InformRegionOfLogin(ulong regionHandle, Login login)
|
||||
{
|
||||
this.SandBoxServices.AddNewSession(regionHandle, login);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,9 +4,11 @@ using System.Collections.Generic;
|
|||
using System.Text;
|
||||
|
||||
using OpenGrid.Framework.Communications;
|
||||
using OpenSim.Framework.User;
|
||||
//using OpenSim.Framework.User;
|
||||
using OpenGrid.Framework.UserManagement;
|
||||
using OpenGrid.Framework.Data;
|
||||
using OpenSim.Framework.Types;
|
||||
using OpenSim.Framework.Utilities;
|
||||
|
||||
using libsecondlife;
|
||||
|
||||
|
@ -14,28 +16,100 @@ namespace OpenSim.LocalCommunications
|
|||
{
|
||||
public class LocalUserServices : UserManagerBase, IUserServices
|
||||
{
|
||||
private CommunicationsLocal m_Parent;
|
||||
|
||||
public LocalUserServices()
|
||||
private uint defaultHomeX ;
|
||||
private uint defaultHomeY;
|
||||
public LocalUserServices(CommunicationsLocal parent, uint defHomeX, uint defHomeY)
|
||||
{
|
||||
|
||||
m_Parent = parent;
|
||||
defaultHomeX = defHomeX;
|
||||
defaultHomeY = defHomeY;
|
||||
}
|
||||
|
||||
public UserProfileData GetUserProfile(string first_name, string last_name)
|
||||
public UserProfileData GetUserProfile(string firstName, string lastName)
|
||||
{
|
||||
return GetUserProfile(first_name + " " + last_name);
|
||||
return GetUserProfile(firstName + " " + lastName);
|
||||
}
|
||||
|
||||
public UserProfileData GetUserProfile(string name)
|
||||
{
|
||||
return null;
|
||||
return this.getUserProfile(name);
|
||||
}
|
||||
public UserProfileData GetUserProfile(LLUUID avatar_id)
|
||||
public UserProfileData GetUserProfile(LLUUID avatarID)
|
||||
{
|
||||
return null;
|
||||
return this.getUserProfile(avatarID);
|
||||
}
|
||||
|
||||
public override void CustomiseResponse(ref Hashtable response, ref UserProfileData theUser)
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string GetMessage()
|
||||
{
|
||||
return "Welcome to OpenSim";
|
||||
}
|
||||
|
||||
public override UserProfileData GetTheUser(string firstname, string lastname)
|
||||
{
|
||||
UserProfileData profile = getUserProfile(firstname, lastname);
|
||||
if (profile != null)
|
||||
{
|
||||
|
||||
return profile;
|
||||
}
|
||||
|
||||
//no current user account so make one
|
||||
Console.WriteLine("No User account found so creating a new one ");
|
||||
this.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY);
|
||||
|
||||
profile = getUserProfile(firstname, lastname);
|
||||
|
||||
return profile;
|
||||
}
|
||||
|
||||
public override bool AuthenticateUser(ref UserProfileData profile, string password)
|
||||
{
|
||||
//for now we will accept any password in sandbox mode
|
||||
Console.WriteLine("authorising user");
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void CustomiseResponse(ref LoginResponse response, ref UserProfileData theUser)
|
||||
{
|
||||
ulong currentRegion = theUser.currentAgent.currentHandle;
|
||||
RegionInfo reg = m_Parent.GridServer.RequestNeighbourInfo(currentRegion);
|
||||
|
||||
|
||||
if (reg != null)
|
||||
{
|
||||
response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.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() + "]}";
|
||||
|
||||
response.SimAddress = reg.IPListenAddr;
|
||||
response.SimPort = (Int32)reg.IPListenPort;
|
||||
response.RegionX = reg.RegionLocX ;
|
||||
response.RegionY = reg.RegionLocY ;
|
||||
|
||||
theUser.currentAgent.currentRegion = reg.SimUUID;
|
||||
theUser.currentAgent.currentHandle = reg.RegionHandle;
|
||||
|
||||
Login _login = new Login();
|
||||
//copy data to login object
|
||||
_login.First = response.Firstname;
|
||||
_login.Last = response.Lastname;
|
||||
_login.Agent = response.AgentID;
|
||||
_login.Session = response.SessionID;
|
||||
_login.SecureSession = response.SecureSessionID;
|
||||
_login.CircuitCode = (uint)response.CircuitCode;
|
||||
|
||||
m_Parent.InformRegionOfLogin(currentRegion, _login);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("not found region " + currentRegion);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -425,7 +425,7 @@ namespace OpenSim.Region.Scenes
|
|||
Console.WriteLine("No default terrain, procedurally generating...");
|
||||
this.Terrain.hills();
|
||||
|
||||
// this.localStorage.SaveMap(this.Terrain.getHeights1D());
|
||||
this.localStorage.SaveMap(this.Terrain.getHeights1D());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -439,7 +439,7 @@ namespace OpenSim.Region.Scenes
|
|||
Console.WriteLine("Unable to load default terrain, procedurally generating instead...");
|
||||
Terrain.hills();
|
||||
}
|
||||
// this.localStorage.SaveMap(this.Terrain.getHeights1D());
|
||||
this.localStorage.SaveMap(this.Terrain.getHeights1D());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -189,6 +189,14 @@ namespace OpenSim
|
|||
OutPacket(mov);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="fromPos"></param>
|
||||
/// <param name="fromName"></param>
|
||||
/// <param name="fromAgentID"></param>
|
||||
public void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
|
||||
{
|
||||
SendChatMessage(Helpers.StringToField(message), type, fromPos, fromName, fromAgentID);
|
||||
|
|
|
@ -1,120 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.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;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
|
||||
namespace OpenSim
|
||||
{
|
||||
|
||||
public class NetworkServersInfo
|
||||
{
|
||||
public string AssetURL = "http://127.0.0.1:8003/";
|
||||
public string AssetSendKey = "";
|
||||
|
||||
public string GridURL = "";
|
||||
public string GridSendKey = "";
|
||||
public string GridRecvKey = "";
|
||||
public string UserURL = "";
|
||||
public string UserSendKey = "";
|
||||
public string UserRecvKey = "";
|
||||
public bool isSandbox;
|
||||
|
||||
public void InitConfig(bool sandboxMode, IGenericConfig configData)
|
||||
{
|
||||
this.isSandbox = sandboxMode;
|
||||
|
||||
try
|
||||
{
|
||||
if (!isSandbox)
|
||||
{
|
||||
string attri = "";
|
||||
//Grid Server URL
|
||||
attri = "";
|
||||
attri = configData.GetAttribute("GridServerURL");
|
||||
if (attri == "")
|
||||
{
|
||||
this.GridURL = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Grid server URL", "http://127.0.0.1:8001/");
|
||||
configData.SetAttribute("GridServerURL", this.GridURL);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.GridURL = attri;
|
||||
}
|
||||
|
||||
//Grid Send Key
|
||||
attri = "";
|
||||
attri = configData.GetAttribute("GridSendKey");
|
||||
if (attri == "")
|
||||
{
|
||||
this.GridSendKey = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Key to send to grid server", "null");
|
||||
configData.SetAttribute("GridSendKey", this.GridSendKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.GridSendKey = attri;
|
||||
}
|
||||
|
||||
//Grid Receive Key
|
||||
attri = "";
|
||||
attri = configData.GetAttribute("GridRecvKey");
|
||||
if (attri == "")
|
||||
{
|
||||
this.GridRecvKey = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Key to expect from grid server", "null");
|
||||
configData.SetAttribute("GridRecvKey", this.GridRecvKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.GridRecvKey = attri;
|
||||
}
|
||||
|
||||
attri = "";
|
||||
attri = configData.GetAttribute("AssetServerURL");
|
||||
if (attri == "")
|
||||
{
|
||||
this.AssetURL = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Asset server URL", "http://127.0.0.1:8003/");
|
||||
configData.SetAttribute("AssetServerURL", this.GridURL);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.AssetURL = attri;
|
||||
}
|
||||
|
||||
}
|
||||
configData.Commit();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
OpenSim.Framework.Console.MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured");
|
||||
OpenSim.Framework.Console.MainLog.Instance.Warn(e.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -157,9 +157,6 @@
|
|||
<Compile Include="ClientViewBase.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="NetworkServersInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="PacketServer.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
<include name="ClientView.PacketHandlers.cs" />
|
||||
<include name="ClientView.ProcessPackets.cs" />
|
||||
<include name="ClientViewBase.cs" />
|
||||
<include name="NetworkServersInfo.cs" />
|
||||
<include name="PacketServer.cs" />
|
||||
<include name="RegionApplicationBase.cs" />
|
||||
<include name="UDPServer.cs" />
|
||||
|
|
|
@ -86,6 +86,12 @@
|
|||
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Common\OpenGrid.Framework.UserManager\OpenGrid.Framework.UserManagement.csproj">
|
||||
<Name>OpenGrid.Framework.UserManagement</Name>
|
||||
<Project>{DA9A7391-0000-0000-0000-000000000000}</Project>
|
||||
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\OpenSim.Caches\OpenSim.Caches.csproj">
|
||||
<Name>OpenSim.Caches</Name>
|
||||
<Project>{1938EB12-0000-0000-0000-000000000000}</Project>
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
<include name="../../bin/Db4objects.Db4o.dll" />
|
||||
<include name="../../bin/libsecondlife.dll" />
|
||||
<include name="../../bin/OpenGrid.Framework.Communications.dll" />
|
||||
<include name="../../bin/OpenGrid.Framework.UserManagement.dll" />
|
||||
<include name="../../bin/OpenSim.Caches.dll" />
|
||||
<include name="../../bin/OpenSim.Framework.dll" />
|
||||
<include name="../../bin/OpenSim.Framework.Console.dll" />
|
||||
|
|
|
@ -106,13 +106,13 @@ namespace OpenSim
|
|||
this.SetupLocalGridServers();
|
||||
this.checkServer = new CheckSumServer(12036);
|
||||
this.checkServer.ServerListener();
|
||||
sandboxCommunications = new CommunicationsLocal();
|
||||
sandboxCommunications = new CommunicationsLocal(this.serversData.DefaultHomeLocX, this.serversData.DefaultHomeLocY);
|
||||
this.commsManager = sandboxCommunications;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SetupRemoteGridServers();
|
||||
this.commsManager = new CommunicationsLocal(); //shouldn't be using the local communications manager
|
||||
this.commsManager = new CommunicationsLocal(this.serversData.DefaultHomeLocX, this.serversData.DefaultHomeLocY); //shouldn't be using the local communications manager
|
||||
}
|
||||
|
||||
startuptime = DateTime.Now;
|
||||
|
@ -132,11 +132,15 @@ namespace OpenSim
|
|||
|
||||
if (m_sandbox)
|
||||
{
|
||||
httpServer.AddXmlRPCHandler("login_to_simulator", sandboxCommunications.UserServices.XmlRpcLoginMethod);
|
||||
|
||||
/*
|
||||
loginServer = new LoginServer(regionData[0].IPListenAddr, regionData[0].IPListenPort, regionData[0].RegionLocX, regionData[0].RegionLocY, false);
|
||||
loginServer.Startup();
|
||||
loginServer.SetSessionHandler(sandboxCommunications.SandBoxServices.AddNewSession);
|
||||
//sandbox mode with loginserver not using accounts
|
||||
httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod);
|
||||
*/
|
||||
}
|
||||
|
||||
//Start http server
|
||||
|
|
|
@ -638,6 +638,7 @@
|
|||
<Reference name="OpenGrid.Framework.Communications"/>
|
||||
<Reference name="OpenSim.Caches"/>
|
||||
<Reference name="XMLRPC"/>
|
||||
<Reference name="OpenGrid.Framework.UserManagement" />
|
||||
<Reference name="OpenSim.LocalCommunications"/>
|
||||
|
||||
<Files>
|
||||
|
|
Loading…
Reference in New Issue