aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGrid.Framework.Data
diff options
context:
space:
mode:
authorMW2007-05-07 16:53:22 +0000
committerMW2007-05-07 16:53:22 +0000
commitca785403a10bc0a185d9f2e90479b0f8fb75ca31 (patch)
tree8d3433651a8670bb892b4f56c9feb27017a68253 /OpenGrid.Framework.Data
parentRenamed to DEVEL (diff)
downloadopensim-SC_OLD-ca785403a10bc0a185d9f2e90479b0f8fb75ca31.zip
opensim-SC_OLD-ca785403a10bc0a185d9f2e90479b0f8fb75ca31.tar.gz
opensim-SC_OLD-ca785403a10bc0a185d9f2e90479b0f8fb75ca31.tar.bz2
opensim-SC_OLD-ca785403a10bc0a185d9f2e90479b0f8fb75ca31.tar.xz
merged in missing file from 0.1-prestable
Diffstat (limited to '')
-rw-r--r--OpenGrid.Framework.Data.DB4o/DB4oUserData.cs75
-rw-r--r--OpenGrid.Framework.Data/UserData.cs24
2 files changed, 99 insertions, 0 deletions
diff --git a/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs b/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs
new file mode 100644
index 0000000..c21d7e2
--- /dev/null
+++ b/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs
@@ -0,0 +1,75 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenGrid.Framework.Data;
5using libsecondlife;
6
7namespace OpenGrid.Framework.Data.DB4o
8{
9 public class DB4oUserData : IUserData
10 {
11 DB4oUserManager manager = new DB4oUserManager("userprofiles.yap");
12
13 public UserProfileData getUserByUUID(LLUUID uuid)
14 {
15 if(manager.userProfiles.ContainsKey(uuid))
16 return manager.userProfiles[uuid];
17 return null;
18 }
19
20 public UserProfileData getUserByName(string name)
21 {
22 return getUserByName(name.Split(' ')[0], name.Split(' ')[1]);
23 }
24
25 public UserProfileData getUserByName(string fname, string lname)
26 {
27 foreach (UserProfileData profile in manager.userProfiles.Values)
28 {
29 if (profile.username == fname && profile.surname == lname)
30 return profile;
31 }
32 return null;
33 }
34
35 public UserAgentData getAgentByUUID(LLUUID uuid)
36 {
37 try
38 {
39 return getUserByUUID(uuid).currentAgent;
40 }
41 catch (Exception e)
42 {
43 return null;
44 }
45 }
46
47 public UserAgentData getAgentByName(string name)
48 {
49 return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]);
50 }
51
52 public UserAgentData getAgentByName(string fname, string lname)
53 {
54 try
55 {
56 return getUserByName(fname,lname).currentAgent;
57 }
58 catch (Exception e)
59 {
60 return null;
61 }
62 }
63
64 public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount)
65 {
66 return true;
67 }
68
69 public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item)
70 {
71 return true;
72 }
73
74 }
75}
diff --git a/OpenGrid.Framework.Data/UserData.cs b/OpenGrid.Framework.Data/UserData.cs
new file mode 100644
index 0000000..6b4f2ba
--- /dev/null
+++ b/OpenGrid.Framework.Data/UserData.cs
@@ -0,0 +1,24 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenGrid.Framework.Data
7{
8 public interface IUserData
9 {
10 // Retrieval
11 // User Profiles
12 UserProfileData getUserByUUID(LLUUID user);
13 UserProfileData getUserByName(string name);
14 UserProfileData getUserByName(string fname, string lname);
15 // User Agents
16 UserAgentData getAgentByUUID(LLUUID user);
17 UserAgentData getAgentByName(string name);
18 UserAgentData getAgentByName(string fname, string lname);
19
20 // Transactional
21 bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount);
22 bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory);
23 }
24}