From 9a0b105ad78f802d6fe08806a1b975cd9fdf317f Mon Sep 17 00:00:00 2001 From: gareth Date: Mon, 2 Apr 2007 12:19:13 +0000 Subject: Added DB backing for user profiles Added "create profile command" --- OpenSim.Framework/UserProfileManagerBase.cs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'OpenSim.Framework') diff --git a/OpenSim.Framework/UserProfileManagerBase.cs b/OpenSim.Framework/UserProfileManagerBase.cs index 73f325d..c022feb 100644 --- a/OpenSim.Framework/UserProfileManagerBase.cs +++ b/OpenSim.Framework/UserProfileManagerBase.cs @@ -28,6 +28,22 @@ namespace OpenSim.Framework.User db.Close(); } + public virtual void SaveUserProfiles() // ZOMG! INEFFICIENT! + { + IObjectContainer db; + db = Db4oFactory.OpenFile("userprofiles.yap"); + IObjectSet result = db.Get(typeof(UserProfile)); + foreach (UserProfile userprof in result) { + db.Delete(userprof); + db.Commit(); + } + foreach (UserProfile userprof in UserProfiles.Values) { + db.Set(userprof); + db.Commit(); + } + db.Close(); + } + public UserProfile GetProfileByName(string firstname, string lastname) { foreach (libsecondlife.LLUUID UUID in UserProfiles.Keys) @@ -86,8 +102,8 @@ namespace OpenSim.Framework.User newprofile.UUID = LLUUID.Random(); newprofile.Inventory.CreateRootFolder(newprofile.UUID, true); this.UserProfiles.Add(newprofile.UUID, newprofile); - return newprofile; - } + return newprofile; + } public virtual AgentInventory GetUsersInventory(LLUUID agentID) { -- cgit v1.1