From b8c4e744f916354b5dfbfbb108013de40eb3f4b7 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 20 May 2007 14:33:53 +0000 Subject: Small fix (2/2) --- OpenGrid.Framework.Data.MySQL/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 05d65cf..0741272 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 ec89107..3f42762 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 -- cgit v1.1