From b8c4e744f916354b5dfbfbb108013de40eb3f4b7 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 20 May 2007 14:33:53 +0000 Subject: [PATCH] Small fix (2/2) --- .../MySQLUserData.cs | 27 +++++++++++++++++-- OpenGrid.Framework.Data/UserProfileData.cs | 2 +- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs b/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs index 05d65cf15a..0741272b57 100644 --- a/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs +++ b/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs @@ -82,12 +82,35 @@ namespace OpenGrid.Framework.Data.MySQL public UserAgentData getAgentByName(string user, string last) { - return new UserAgentData(); + UserProfileData profile = getUserByName(user, last); + return getAgentByUUID(profile.UUID); } public UserAgentData getAgentByUUID(LLUUID uuid) { - return new UserAgentData(); + try + { + lock (database) + { + Dictionary param = new Dictionary(); + param["?uuid"] = uuid.ToStringHyphenated(); + + System.Data.IDbCommand result = database.Query("SELECT * FROM agents WHERE UUID = ?uuid", param); + System.Data.IDataReader reader = result.ExecuteReader(); + + UserAgentData row = database.getAgentRow(reader); + + reader.Close(); + result.Dispose(); + + return row; + } + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + return null; + } } public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount) diff --git a/OpenGrid.Framework.Data/UserProfileData.cs b/OpenGrid.Framework.Data/UserProfileData.cs index ec8910765f..3f4276203f 100644 --- a/OpenGrid.Framework.Data/UserProfileData.cs +++ b/OpenGrid.Framework.Data/UserProfileData.cs @@ -38,7 +38,7 @@ namespace OpenGrid.Framework.Data public class UserAgentData { - public LLUUID UUID; // Internal session ID + public LLUUID UUID; // Account 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