* Added packing/unpacking of the Home fields in PresenceInfo

* Cleaned up IUserService and beefed up UserAccoutData
slimupdates
Diva Canto 2009-12-28 20:26:44 -08:00
parent 3249d5be9a
commit c164b85ea6
3 changed files with 48 additions and 29 deletions

View File

@ -40,7 +40,7 @@ namespace OpenSim.Data
} }
/// <summary> /// <summary>
/// An interface for connecting to the authentication datastore /// An interface for connecting to the user accounts datastore
/// </summary> /// </summary>
public interface IUserAccountData public interface IUserAccountData
{ {

View File

@ -65,6 +65,12 @@ namespace OpenSim.Services.Interfaces
Boolean.TryParse(kvp["online"].ToString(), out Online); Boolean.TryParse(kvp["online"].ToString(), out Online);
if (kvp.ContainsKey("position")) if (kvp.ContainsKey("position"))
Vector3.TryParse(kvp["position"].ToString(), out 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["logout"] = Logout.ToString();
result["position"] = Position.ToString(); result["position"] = Position.ToString();
result["lookAt"] = LookAt.ToString(); result["lookAt"] = LookAt.ToString();
result["HomeRegionID"] = HomeRegionID.ToString();
result["HomePosition"] = HomePosition.ToString();
result["HomeLookAt"] = HomeLookAt.ToString();
return result; return result;
} }

View File

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System;
using System.Collections.Generic; using System.Collections.Generic;
using OpenMetaverse; using OpenMetaverse;
@ -36,37 +37,17 @@ namespace OpenSim.Services.Interfaces
{ {
} }
public UserAccount(UUID userID, UUID homeRegionID, float homePositionX, public UserAccount(UUID userID)
float homePositionY, float homePositionZ, float homeLookAtX,
float homeLookAtY, float homeLookAtZ)
{ {
UserID = userID; UserID = userID;
HomeRegionID = homeRegionID;
HomePositionX = homePositionX;
HomePositionY = homePositionY;
HomePositionZ = homePositionZ;
HomeLookAtX = homeLookAtX;
HomeLookAtY = homeLookAtY;
HomeLookAtZ = homeLookAtZ;
} }
public string FirstName; public string FirstName;
public string LastName; public string LastName;
public string Email;
public UUID UserID; public UUID UserID;
public UUID ScopeID; 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 // These are here because they
// concern the account rather than // concern the account rather than
// the profile. They just happen to // the profile. They just happen to
@ -76,6 +57,41 @@ namespace OpenSim.Services.Interfaces
public int UserFlags; public int UserFlags;
public string AccountType; public string AccountType;
public UserAccount(Dictionary<string, object> 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<string, object> ToKeyValuePairs()
{
Dictionary<string, object> result = new Dictionary<string, object>();
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 public interface IUserAccountService
@ -87,12 +103,6 @@ namespace OpenSim.Services.Interfaces
// //
List<UserAccount> GetUserAccount(UUID scopeID, string query); List<UserAccount> 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 // Update all updatable fields
// //
bool SetUserAccount(UserAccount data, UUID PrincipalID, string token); bool SetUserAccount(UserAccount data, UUID PrincipalID, string token);