aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.Framework/UserProfileManagerBase.cs
diff options
context:
space:
mode:
authorMW2007-04-02 15:48:01 +0000
committerMW2007-04-02 15:48:01 +0000
commitfdc9ed89b4adaa7f23ca06613b2ee36c30895021 (patch)
tree3c90368815d37055bac61ee3bdce5b5593715e2a /OpenSim.Framework/UserProfileManagerBase.cs
parentAdded OpenSim.GenericConfig.Xml project, so we can swap to a more generic con... (diff)
downloadopensim-SC_OLD-fdc9ed89b4adaa7f23ca06613b2ee36c30895021.zip
opensim-SC_OLD-fdc9ed89b4adaa7f23ca06613b2ee36c30895021.tar.gz
opensim-SC_OLD-fdc9ed89b4adaa7f23ca06613b2ee36c30895021.tar.bz2
opensim-SC_OLD-fdc9ed89b4adaa7f23ca06613b2ee36c30895021.tar.xz
OpenSim no longer uses OpenSim.Config.SimConfigDb4o, it now uses OpenSim.GenericConfig.Xml (or a class implementing IGenericConfig).
Diffstat (limited to 'OpenSim.Framework/UserProfileManagerBase.cs')
-rw-r--r--OpenSim.Framework/UserProfileManagerBase.cs62
1 files changed, 33 insertions, 29 deletions
diff --git a/OpenSim.Framework/UserProfileManagerBase.cs b/OpenSim.Framework/UserProfileManagerBase.cs
index c022feb..4428831 100644
--- a/OpenSim.Framework/UserProfileManagerBase.cs
+++ b/OpenSim.Framework/UserProfileManagerBase.cs
@@ -13,36 +13,40 @@ namespace OpenSim.Framework.User
13 13
14 public Dictionary<LLUUID, UserProfile> UserProfiles = new Dictionary<LLUUID, UserProfile>(); 14 public Dictionary<LLUUID, UserProfile> UserProfiles = new Dictionary<LLUUID, UserProfile>();
15 15
16 public UserProfileManagerBase() { 16 public UserProfileManagerBase()
17 } 17 {
18 }
18 19
19 public virtual void InitUserProfiles() 20 public virtual void InitUserProfiles()
20 { 21 {
21 IObjectContainer db; 22 IObjectContainer db;
22 db = Db4oFactory.OpenFile("userprofiles.yap"); 23 db = Db4oFactory.OpenFile("userprofiles.yap");
23 IObjectSet result = db.Get(typeof(UserProfile)); 24 IObjectSet result = db.Get(typeof(UserProfile));
24 foreach (UserProfile userprof in result) { 25 foreach (UserProfile userprof in result)
25 UserProfiles.Add(userprof.UUID, userprof); 26 {
26 } 27 UserProfiles.Add(userprof.UUID, userprof);
27 Console.WriteLine("UserProfiles.Cs:InitUserProfiles() - Successfully loaded " + result.Count.ToString() + " from database"); 28 }
28 db.Close(); 29 Console.WriteLine("UserProfiles.Cs:InitUserProfiles() - Successfully loaded " + result.Count.ToString() + " from database");
30 db.Close();
29 } 31 }
30 32
31 public virtual void SaveUserProfiles() // ZOMG! INEFFICIENT! 33 public virtual void SaveUserProfiles() // ZOMG! INEFFICIENT!
32 { 34 {
33 IObjectContainer db; 35 IObjectContainer db;
34 db = Db4oFactory.OpenFile("userprofiles.yap"); 36 db = Db4oFactory.OpenFile("userprofiles.yap");
35 IObjectSet result = db.Get(typeof(UserProfile)); 37 IObjectSet result = db.Get(typeof(UserProfile));
36 foreach (UserProfile userprof in result) { 38 foreach (UserProfile userprof in result)
37 db.Delete(userprof); 39 {
38 db.Commit(); 40 db.Delete(userprof);
39 } 41 db.Commit();
40 foreach (UserProfile userprof in UserProfiles.Values) { 42 }
41 db.Set(userprof); 43 foreach (UserProfile userprof in UserProfiles.Values)
42 db.Commit(); 44 {
43 } 45 db.Set(userprof);
44 db.Close(); 46 db.Commit();
45 } 47 }
48 db.Close();
49 }
46 50
47 public UserProfile GetProfileByName(string firstname, string lastname) 51 public UserProfile GetProfileByName(string firstname, string lastname)
48 { 52 {
@@ -74,13 +78,13 @@ namespace OpenSim.Framework.User
74 } 78 }
75 else 79 else
76 { 80 {
77 Console.WriteLine("UserProfile - not authorised, password not match "+ TheUser.MD5passwd +" and "+ passwd); 81 Console.WriteLine("UserProfile - not authorised, password not match " + TheUser.MD5passwd + " and " + passwd);
78 return false; 82 return false;
79 } 83 }
80 } 84 }
81 else 85 else
82 { 86 {
83 Console.WriteLine("UserProfile - not authorised , unkown: "+ firstname +" , " + lastname); 87 Console.WriteLine("UserProfile - not authorised , unkown: " + firstname + " , " + lastname);
84 return false; 88 return false;
85 } 89 }
86 90
@@ -102,8 +106,8 @@ namespace OpenSim.Framework.User
102 newprofile.UUID = LLUUID.Random(); 106 newprofile.UUID = LLUUID.Random();
103 newprofile.Inventory.CreateRootFolder(newprofile.UUID, true); 107 newprofile.Inventory.CreateRootFolder(newprofile.UUID, true);
104 this.UserProfiles.Add(newprofile.UUID, newprofile); 108 this.UserProfiles.Add(newprofile.UUID, newprofile);
105 return newprofile; 109 return newprofile;
106 } 110 }
107 111
108 public virtual AgentInventory GetUsersInventory(LLUUID agentID) 112 public virtual AgentInventory GetUsersInventory(LLUUID agentID)
109 { 113 {