From 99ad7aac7f854eaae075e93880c39796183ba7e4 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 31 Dec 2009 01:34:03 +0000 Subject: Implement saving user account data --- OpenSim/Data/IUserAccountData.cs | 4 ++-- OpenSim/Data/MSSQL/MSSQLUserAccountData.cs | 2 +- OpenSim/Data/MySQL/MySQLUserAccountData.cs | 2 +- .../UserAccountService/UserAccountService.cs | 23 +++++++++++++++++++++- 4 files changed, 26 insertions(+), 5 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/IUserAccountData.cs b/OpenSim/Data/IUserAccountData.cs index 5ebe7d3..e350a18 100644 --- a/OpenSim/Data/IUserAccountData.cs +++ b/OpenSim/Data/IUserAccountData.cs @@ -38,7 +38,7 @@ namespace OpenSim.Data public UUID ScopeID; public string FirstName; public string LastName; - public Dictionary Data; + public Dictionary Data; } /// @@ -47,6 +47,6 @@ namespace OpenSim.Data public interface IUserAccountData { UserAccountData[] Get(string[] fields, string[] values); - bool Store(UserAccountData data, UUID principalID, string token); + bool Store(UserAccountData data); } } diff --git a/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs b/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs index 01750d8..ca09029 100644 --- a/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs +++ b/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs @@ -65,7 +65,7 @@ namespace OpenSim.Data.MSSQL public UserAccountData Get(UUID principalID, UUID scopeID) { UserAccountData ret = new UserAccountData(); - ret.Data = new Dictionary(); + ret.Data = new Dictionary(); string sql = string.Format("select * from {0} where UUID = @principalID", m_Realm); if (scopeID != UUID.Zero) diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs index e2ce6d1..ae7d5ca 100644 --- a/OpenSim/Data/MySQL/MySQLUserAccountData.cs +++ b/OpenSim/Data/MySQL/MySQLUserAccountData.cs @@ -42,7 +42,7 @@ namespace OpenSim.Data.MySQL { } - public bool Store(UserAccountData data, UUID principalID, string token) + public bool Store(UserAccountData data) { return Store(data); } diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index 706da84..2954589 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs @@ -142,7 +142,28 @@ namespace OpenSim.Services.UserAccountService public bool StoreUserAccount(UserAccount data) { - return false; + UserAccountData d = new UserAccountData(); + + d.FirstName = data.FirstName; + d.LastName = data.LastName; + d.PrincipalID = data.PrincipalID; + d.ScopeID = data.ScopeID; + d.Data = new Dictionary(); + d.Data["Email"] = data.Email; + d.Data["Created"] = data.Created.ToString(); + + List parts = new List(); + + foreach (KeyValuePair kvp in data.ServiceURLs) + { + string key = System.Web.HttpUtility.UrlEncode(kvp.Key); + string val = System.Web.HttpUtility.UrlEncode(kvp.Value.ToString()); + parts.Add(key + "=" + val); + } + + d.Data["ServiceURLs"] = string.Join(" ", parts.ToArray()); + + return m_Database.Store(d); } public List GetUserAccounts(UUID scopeID, string query) -- cgit v1.1