Removed the login dat file.

zircon^2
andy 2007-05-11 19:33:32 +00:00
parent b865249b8c
commit 3e5d954057
1 changed files with 324 additions and 77 deletions

View File

@ -38,11 +38,13 @@ using System.Security.Cryptography;
using System.Xml; using System.Xml;
using libsecondlife; using libsecondlife;
using OpenSim; using OpenSim;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Grid;
using OpenSim.Framework.Inventory;
using OpenSim.Framework.User; using OpenSim.Framework.User;
using OpenSim.Framework.Inventory;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Framework.Interfaces;
// ?
using OpenSim.Framework.Grid;
namespace OpenSim.UserServer namespace OpenSim.UserServer
{ {
@ -56,9 +58,26 @@ namespace OpenSim.UserServer
private Hashtable loginFlagsHash; private Hashtable loginFlagsHash;
private Hashtable globalTexturesHash; private Hashtable globalTexturesHash;
private Hashtable loginError; private Hashtable loginError;
private Hashtable eventCategoriesHash;
private Hashtable uiConfigHash;
private Hashtable classifiedCategoriesHash;
private ArrayList loginFlags; private ArrayList loginFlags;
private ArrayList globalTextures; private ArrayList globalTextures;
private ArrayList eventCategories;
private ArrayList uiConfig;
private ArrayList classifiedCategories;
private ArrayList inventoryRoot;
private ArrayList initialOutfit;
private ArrayList agentInventory;
private UserProfile userProfile;
private LLUUID agentID;
private LLUUID sessionID;
private LLUUID secureSessionID;
private LLUUID baseFolderID;
private LLUUID inventoryFolderID;
// Login Flags // Login Flags
private string dst; private string dst;
@ -68,10 +87,14 @@ namespace OpenSim.UserServer
private string login; private string login;
private string simPort; private string simPort;
private string simAddress; private string simAddress;
private string agentID; private string agentAccess;
private string sessionID;
private string secureSessionID;
private Int32 circuitCode; private Int32 circuitCode;
private uint regionX;
private uint regionY;
// Login
private string firstname;
private string lastname;
// Global Textures // Global Textures
private string sunTexture; private string sunTexture;
@ -85,65 +108,115 @@ namespace OpenSim.UserServer
// Response // Response
private XmlRpcResponse xmlRpcResponse; private XmlRpcResponse xmlRpcResponse;
private XmlRpcResponse defaultXmlRpcResponse; private XmlRpcResponse defaultXmlRpcResponse;
private string defaultTextResponse;
private uint regionX; private string welcomeMessage;
private uint regionY; private string startLocation;
private string allowFirstLife;
private string home;
private string seedCapability;
private string lookAt;
public LoginResponse(uint regX, uint regY) public LoginResponse()
{ {
this.loginFlags = new ArrayList(); this.loginFlags = new ArrayList();
this.globalTextures = 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 UserProfile();
this.inventoryRoot = new ArrayList();
this.initialOutfit = new ArrayList();
this.agentInventory = new ArrayList();
this.xmlRpcResponse = new XmlRpcResponse();
this.defaultXmlRpcResponse = new XmlRpcResponse();
this.SetDefaultValues(); this.SetDefaultValues();
regionX = regX;
regionY = regY;
} // LoginServer } // LoginServer
// This will go away as we replace new-login.dat:
private void GetDefaultResponse()
{
try
{
// read in default response string
StreamReader SR;
string lines;
SR = File.OpenText("new-login.dat");
this.defaultTextResponse = "";
while (!SR.EndOfStream)
{
lines = SR.ReadLine();
this.defaultTextResponse += lines;
}
SR.Close();
this.defaultXmlRpcResponse = (XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(this.defaultTextResponse);
}
catch (Exception E)
{
Console.WriteLine(E.ToString());
}
} // GetDefaultResponse
public void SetDefaultValues() public void SetDefaultValues()
{ {
this.GetDefaultResponse(); 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.DST = "N"; this.SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271";
this.StipendSinceLogin = "N"; this.CloudTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
this.Gendered = "Y"; this.MoonTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
this.EverLoggedIn = "Y";
this.login = "false";
this.SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271"; this.ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock.";
this.CloudTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; this.ErrorReason = "key";
this.MoonTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; 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;
this.ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock."; // Classifieds;
this.ErrorReason = "key"; 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");
int SessionRand = Util.RandomClass.Next(1, 999);
this.SessionID = new LLUUID("aaaabbbb-0200-" + SessionRand.ToString("0000") + "-8664-58f53e442797");
this.SecureSessionID = LLUUID.Random();
this.userProfile.Inventory.CreateRootFolder(this.userProfile.UUID, true);
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);
}
Hashtable InitialOutfitHash = new Hashtable();
InitialOutfitHash["folder_name"] = "Nightclub Female";
InitialOutfitHash["gender"] = "female";
this.initialOutfit.Add(InitialOutfitHash);
} // SetDefaultValues } // SetDefaultValues
private XmlRpcResponse GenerateResponse(string reason, string message, string login) 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; // Overwrite any default values;
this.xmlRpcResponse = new XmlRpcResponse(); this.xmlRpcResponse = new XmlRpcResponse();
@ -152,7 +225,6 @@ namespace OpenSim.UserServer
this.ErrorMessage = message; this.ErrorMessage = message;
this.ErrorReason = reason; this.ErrorReason = reason;
this.loginError = new Hashtable();
this.loginError["reason"] = this.ErrorReason; this.loginError["reason"] = this.ErrorReason;
this.loginError["message"] = this.ErrorMessage; this.loginError["message"] = this.ErrorMessage;
this.loginError["login"] = login; this.loginError["login"] = login;
@ -162,7 +234,7 @@ namespace OpenSim.UserServer
public XmlRpcResponse LoginFailedResponse() public XmlRpcResponse LoginFailedResponse()
{ {
return (this.GenerateResponse("key", "You have entered an invalid name/password combination. Check Caps/lock.", "false")); return (this.GenerateFailureResponse("key", "You have entered an invalid name/password combination. Check Caps/lock.", "false"));
} // LoginFailedResponse } // LoginFailedResponse
public XmlRpcResponse ConnectionFailedResponse() public XmlRpcResponse ConnectionFailedResponse()
@ -172,43 +244,98 @@ namespace OpenSim.UserServer
public XmlRpcResponse CreateAlreadyLoggedInResponse() public XmlRpcResponse CreateAlreadyLoggedInResponse()
{ {
return(this.GenerateResponse("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")); 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() } // CreateAlreadyLoggedInResponse()
public XmlRpcResponse ToXmlRpcResponse() public XmlRpcResponse ToXmlRpcResponse()
{ {
this.xmlRpcResponse = this.defaultXmlRpcResponse; Hashtable responseData = new Hashtable();
Hashtable responseData = (Hashtable)this.xmlRpcResponse.Value;
this.loginFlagsHash = new Hashtable(); this.loginFlagsHash = new Hashtable();
this.loginFlagsHash["daylight_savings"] = this.DST; this.loginFlagsHash["daylight_savings"] = this.DST;
this.loginFlagsHash["stipend_since_login"] = this.StipendSinceLogin; this.loginFlagsHash["stipend_since_login"] = this.StipendSinceLogin;
this.loginFlagsHash["gendered"] = this.Gendered; this.loginFlagsHash["gendered"] = this.Gendered;
this.loginFlagsHash["ever_logged_in"] = this.EverLoggedIn; this.loginFlagsHash["ever_logged_in"] = this.EverLoggedIn;
this.loginFlags.Add(this.loginFlagsHash); this.loginFlags.Add(this.loginFlagsHash);
this.globalTexturesHash = new Hashtable(); responseData["first_name"] = this.Firstname;
this.globalTexturesHash["sun_texture_id"] = this.SunTexture; responseData["last_name"] = this.Lastname;
this.globalTexturesHash["cloud_texture_id"] = this.CloudTexture; responseData["agent_access"] = this.agentAccess;
this.globalTexturesHash["moon_texture_id"] = this.MoonTexture;
this.globalTextures.Add(this.globalTexturesHash);
responseData["sim_port"] = Int32.Parse(this.SimPort); this.globalTexturesHash = new Hashtable();
responseData["sim_ip"] = this.SimAddress; this.globalTexturesHash["sun_texture_id"] = this.SunTexture;
responseData["agent_id"] = this.AgentID; this.globalTexturesHash["cloud_texture_id"] = this.CloudTexture;
responseData["session_id"] = this.SessionID; this.globalTexturesHash["moon_texture_id"] = this.MoonTexture;
responseData["secure_session_id"] = this.SecureSessionID; this.globalTextures.Add(this.globalTexturesHash);
responseData["circuit_code"] = this.CircuitCode; this.eventCategories.Add(this.eventCategoriesHash);
responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
responseData["login-flags"] = this.loginFlags; this.AddToUIConfig("allow_first_life", this.allowFirstLife);
responseData["global-textures"] = this.globalTextures; this.uiConfig.Add(this.uiConfigHash);
responseData["region_y"] = (Int32)regionY * 256;
responseData["region_x"] = (Int32)regionX * 256; // 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();
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"] = this.regionX;
responseData["region_y"] = this.regionY;
responseData["login"] = "true";
this.xmlRpcResponse.Value = responseData;
// differential debuggery
// FileStream fs = new FileStream("loginresponse.xml", FileMode.OpenOrCreate);
// StreamWriter SW = new StreamWriter(fs);
// SW.Write(this.xmlRpcResponse.ToString());
// SW.Close();
return (this.xmlRpcResponse); return (this.xmlRpcResponse);
} // ToXmlRpcResponse } // 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
public string Login public string Login
{ {
get get
@ -293,7 +420,7 @@ namespace OpenSim.UserServer
} }
} // SimAddress } // SimAddress
public string AgentID public LLUUID AgentID
{ {
get get
{ {
@ -305,7 +432,7 @@ namespace OpenSim.UserServer
} }
} // AgentID } // AgentID
public string SessionID public LLUUID SessionID
{ {
get get
{ {
@ -317,7 +444,7 @@ namespace OpenSim.UserServer
} }
} // SessionID } // SessionID
public string SecureSessionID public LLUUID SecureSessionID
{ {
get get
{ {
@ -329,6 +456,30 @@ namespace OpenSim.UserServer
} }
} // SecureSessionID } // SecureSessionID
public LLUUID BaseFolderID
{
get
{
return this.baseFolderID;
}
set
{
this.baseFolderID = value;
}
} // BaseFolderID
public LLUUID InventoryFolderID
{
get
{
return this.inventoryFolderID;
}
set
{
this.inventoryFolderID = value;
}
} // InventoryFolderID
public Int32 CircuitCode public Int32 CircuitCode
{ {
get get
@ -341,6 +492,30 @@ namespace OpenSim.UserServer
} }
} // CircuitCode } // 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 public string SunTexture
{ {
get get
@ -377,6 +552,78 @@ namespace OpenSim.UserServer
} }
} // MoonTexture } // 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 public string ErrorReason
{ {
get get