From 601beec8b36b5b069885bd2e74e0e3cbf601c49e Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 20 May 2007 14:21:55 +0000 Subject: [PATCH] * Updated UserAgentData class, adding new properties, modifying existing ones datatypes. * Added read-only support for new userserver to MySQL Data Interface. (TODO: Add write capabilities to the Agent table.) * Added new regionMapTextureID support to MySQL Data server. (thanks MorphW!) --- OpenGrid.Framework.Data.MySQL/MySQLManager.cs | 81 +++++++++++++++++++ OpenGrid.Framework.Data/UserProfileData.cs | 13 +-- 2 files changed, 89 insertions(+), 5 deletions(-) diff --git a/OpenGrid.Framework.Data.MySQL/MySQLManager.cs b/OpenGrid.Framework.Data.MySQL/MySQLManager.cs index e4622a8f41..a476e97548 100644 --- a/OpenGrid.Framework.Data.MySQL/MySQLManager.cs +++ b/OpenGrid.Framework.Data.MySQL/MySQLManager.cs @@ -118,6 +118,87 @@ namespace OpenGrid.Framework.Data.MySQL retval.regionUserURI = (string)reader["regionUserURI"]; retval.regionUserRecvKey = (string)reader["regionUserRecvKey"]; retval.regionUserSendKey = (string)reader["regionUserSendKey"]; + + // World Map Addition + retval.regionMapTextureID = new libsecondlife.LLUUID((string)reader["regionMapTexture"]); + } + else + { + return null; + } + return retval; + } + + public UserAgentData getAgentRow(IDataReader reader) + { + UserAgentData retval = new UserAgentData(); + + if (reader.Read()) + { + // Agent IDs + retval.UUID = new libsecondlife.LLUUID((string)reader["UUID"]); + retval.sessionID = new libsecondlife.LLUUID((string)reader["sessionID"]); + retval.secureSessionID = new libsecondlife.LLUUID((string)reader["secureSessionID"]); + + // Agent Who? + retval.agentIP = (string)reader["agentIP"]; + retval.agentPort = Convert.ToUInt32(reader["agentPort"].ToString()); + retval.agentOnline = Convert.ToBoolean(reader["agentOnline"].ToString()); + + // Login/Logout times (UNIX Epoch) + retval.loginTime = Convert.ToInt32(reader["loginTime"].ToString()); + retval.logoutTime = Convert.ToInt32(reader["logoutTime"].ToString()); + + // Current position + retval.currentRegion = (string)reader["currentRegion"]; + retval.currentHandle = Convert.ToUInt64(reader["currentHandle"].ToString()); + libsecondlife.LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos); + } + else + { + return null; + } + return retval; + } + + public UserProfileData getUserRow(IDataReader reader) + { + UserProfileData retval = new UserProfileData(); + + if (reader.Read()) + { + retval.UUID = new libsecondlife.LLUUID((string)reader["UUID"]); + retval.username = (string)reader["username"]; + retval.surname = (string)reader["lastname"]; + + retval.passwordHash = (string)reader["passwordHash"]; + retval.passwordSalt = (string)reader["passwordSalt"]; + + retval.homeRegion = Convert.ToUInt64(reader["homeRegion"].ToString()); + retval.homeLocation = new libsecondlife.LLVector3( + Convert.ToSingle(reader["homeLocationX"].ToString()), + Convert.ToSingle(reader["homeLocationY"].ToString()), + Convert.ToSingle(reader["homeLocationZ"].ToString())); + retval.homeLookAt = new libsecondlife.LLVector3( + Convert.ToSingle(reader["homeLookAtX"].ToString()), + Convert.ToSingle(reader["homeLookAtY"].ToString()), + Convert.ToSingle(reader["homeLookAtZ"].ToString())); + + retval.created = Convert.ToInt32(reader["created"].ToString()); + retval.lastLogin = Convert.ToInt32(reader["lastLogin"].ToString()); + + retval.userInventoryURI = (string)reader["userInventoryURI"]; + retval.userAssetURI = (string)reader["userAssetURI"]; + + retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString()); + retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString()); + + retval.profileAboutText = (string)reader["profileAboutText"]; + retval.profileFirstText = (string)reader["profileFirstText"]; + + retval.profileImage = new libsecondlife.LLUUID((string)reader["profileImage"]); + retval.profileFirstImage = new libsecondlife.LLUUID((string)reader["profileFirstImage"]); + } else { diff --git a/OpenGrid.Framework.Data/UserProfileData.cs b/OpenGrid.Framework.Data/UserProfileData.cs index 3d8eec4a9d..ec8910765f 100644 --- a/OpenGrid.Framework.Data/UserProfileData.cs +++ b/OpenGrid.Framework.Data/UserProfileData.cs @@ -38,14 +38,17 @@ namespace OpenGrid.Framework.Data public class UserAgentData { + public LLUUID UUID; // Internal session ID public string agentIP; // The IP of the agent public uint agentPort; // The port of the agent public bool agentOnline; // The online status of the agent - public LLUUID sessionID; // The session ID for the agent - public LLUUID secureSessionID; // The secure session ID for the agent + public LLUUID sessionID; // The session ID for the agent (used by client) + public LLUUID secureSessionID; // The secure session ID for the agent (used by client) public LLUUID regionID; // The region ID the agent occupies - public uint loginTime; // EPOCH based Timestamp - public uint logoutTime; // Timestamp or 0 if N/A - + public int loginTime; // EPOCH based Timestamp + public int logoutTime; // Timestamp or 0 if N/A + public LLUUID currentRegion; // UUID of the users current region + public ulong currentHandle; // RegionHandle of the users current region + public LLVector3 currentPos; // Current position in the region } }