From c164b85ea6351f7a00ea6ec2776101287976da10 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Mon, 28 Dec 2009 20:26:44 -0800
Subject: * Added packing/unpacking of the Home fields in PresenceInfo *
Cleaned up IUserService and beefed up UserAccoutData
---
OpenSim/Data/IUserAccountData.cs | 2 +-
OpenSim/Services/Interfaces/IPresenceService.cs | 9 ++++
OpenSim/Services/Interfaces/IUserService.cs | 66 ++++++++++++++-----------
3 files changed, 48 insertions(+), 29 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Data/IUserAccountData.cs b/OpenSim/Data/IUserAccountData.cs
index 6bec188..d1d6c66 100644
--- a/OpenSim/Data/IUserAccountData.cs
+++ b/OpenSim/Data/IUserAccountData.cs
@@ -40,7 +40,7 @@ namespace OpenSim.Data
}
///
- /// An interface for connecting to the authentication datastore
+ /// An interface for connecting to the user accounts datastore
///
public interface IUserAccountData
{
diff --git a/OpenSim/Services/Interfaces/IPresenceService.cs b/OpenSim/Services/Interfaces/IPresenceService.cs
index 2582648..2dad7e6 100644
--- a/OpenSim/Services/Interfaces/IPresenceService.cs
+++ b/OpenSim/Services/Interfaces/IPresenceService.cs
@@ -65,6 +65,12 @@ namespace OpenSim.Services.Interfaces
Boolean.TryParse(kvp["online"].ToString(), out Online);
if (kvp.ContainsKey("position"))
Vector3.TryParse(kvp["position"].ToString(), out Position);
+ if (kvp.ContainsKey("HomeRegionID"))
+ UUID.TryParse(kvp["HomeRegionID"].ToString(), out HomeRegionID);
+ if (kvp.ContainsKey("HomePosition"))
+ Vector3.TryParse(kvp["HomePosition"].ToString(), out HomePosition);
+ if (kvp.ContainsKey("HomeLookAt"))
+ Vector3.TryParse(kvp["HomeLookAt"].ToString(), out HomeLookAt);
}
@@ -78,6 +84,9 @@ namespace OpenSim.Services.Interfaces
result["logout"] = Logout.ToString();
result["position"] = Position.ToString();
result["lookAt"] = LookAt.ToString();
+ result["HomeRegionID"] = HomeRegionID.ToString();
+ result["HomePosition"] = HomePosition.ToString();
+ result["HomeLookAt"] = HomeLookAt.ToString();
return result;
}
diff --git a/OpenSim/Services/Interfaces/IUserService.cs b/OpenSim/Services/Interfaces/IUserService.cs
index 92bd8ef..02d5459 100644
--- a/OpenSim/Services/Interfaces/IUserService.cs
+++ b/OpenSim/Services/Interfaces/IUserService.cs
@@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+using System;
using System.Collections.Generic;
using OpenMetaverse;
@@ -36,37 +37,17 @@ namespace OpenSim.Services.Interfaces
{
}
- public UserAccount(UUID userID, UUID homeRegionID, float homePositionX,
- float homePositionY, float homePositionZ, float homeLookAtX,
- float homeLookAtY, float homeLookAtZ)
+ public UserAccount(UUID userID)
{
UserID = userID;
- HomeRegionID = homeRegionID;
- HomePositionX = homePositionX;
- HomePositionY = homePositionY;
- HomePositionZ = homePositionZ;
- HomeLookAtX = homeLookAtX;
- HomeLookAtY = homeLookAtY;
- HomeLookAtZ = homeLookAtZ;
}
public string FirstName;
public string LastName;
+ public string Email;
public UUID UserID;
public UUID ScopeID;
- // For informational purposes only!
- //
- public string HomeRegionName;
-
- public UUID HomeRegionID;
- public float HomePositionX;
- public float HomePositionY;
- public float HomePositionZ;
- public float HomeLookAtX;
- public float HomeLookAtY;
- public float HomeLookAtZ;
-
// These are here because they
// concern the account rather than
// the profile. They just happen to
@@ -76,6 +57,41 @@ namespace OpenSim.Services.Interfaces
public int UserFlags;
public string AccountType;
+ public UserAccount(Dictionary kvp)
+ {
+ if (kvp.ContainsKey("FirstName"))
+ FirstName = kvp["FirstName"].ToString();
+ if (kvp.ContainsKey("LastName"))
+ LastName = kvp["LastName"].ToString();
+ if (kvp.ContainsKey("Email"))
+ Email = kvp["Email"].ToString();
+ if (kvp.ContainsKey("UserID"))
+ UUID.TryParse(kvp["UserID"].ToString(), out UserID);
+ if (kvp.ContainsKey("ScopeID"))
+ UUID.TryParse(kvp["ScopeID"].ToString(), out ScopeID);
+ if (kvp.ContainsKey("GodLevel"))
+ Int32.TryParse(kvp["GodLevel"].ToString(), out GodLevel);
+ if (kvp.ContainsKey("UserFlags"))
+ Int32.TryParse(kvp["UserFlags"].ToString(), out UserFlags);
+ if (kvp.ContainsKey("AccountType"))
+ AccountType = kvp["AccountType"].ToString();
+
+ }
+
+ public Dictionary ToKeyValuePairs()
+ {
+ Dictionary result = new Dictionary();
+ result["FirstName"] = FirstName;
+ result["LastName"] = LastName;
+ result["Email"] = Email;
+ result["UserID"] = UserID.ToString();
+ result["ScopeID"] = ScopeID.ToString();
+ result["GodLevel"] = GodLevel.ToString();
+ result["UserFlags"] = UserFlags.ToString();
+ result["AccountType"] = AccountType.ToString();
+
+ return result;
+ }
};
public interface IUserAccountService
@@ -87,12 +103,6 @@ namespace OpenSim.Services.Interfaces
//
List GetUserAccount(UUID scopeID, string query);
-
- // This will set only the home region portion of the data!
- // Can't be used to set god level, flags, type or change the name!
- //
- bool SetHomePosition(UserAccount data, UUID RegionID, UUID RegionSecret);
-
// Update all updatable fields
//
bool SetUserAccount(UserAccount data, UUID PrincipalID, string token);
--
cgit v1.1