2007-05-07 16:53:22 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Text;
|
|
|
|
using OpenGrid.Framework.Data;
|
|
|
|
using libsecondlife;
|
|
|
|
|
|
|
|
namespace OpenGrid.Framework.Data.DB4o
|
|
|
|
{
|
|
|
|
public class DB4oUserData : IUserData
|
|
|
|
{
|
2007-05-16 21:10:45 +00:00
|
|
|
DB4oUserManager manager;
|
|
|
|
|
|
|
|
public void Initialise()
|
|
|
|
{
|
|
|
|
manager = new DB4oUserManager("userprofiles.yap");
|
|
|
|
}
|
2007-05-07 16:53:22 +00:00
|
|
|
|
|
|
|
public UserProfileData getUserByUUID(LLUUID uuid)
|
|
|
|
{
|
|
|
|
if(manager.userProfiles.ContainsKey(uuid))
|
|
|
|
return manager.userProfiles[uuid];
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public UserProfileData getUserByName(string name)
|
|
|
|
{
|
|
|
|
return getUserByName(name.Split(' ')[0], name.Split(' ')[1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public UserProfileData getUserByName(string fname, string lname)
|
|
|
|
{
|
|
|
|
foreach (UserProfileData profile in manager.userProfiles.Values)
|
|
|
|
{
|
|
|
|
if (profile.username == fname && profile.surname == lname)
|
|
|
|
return profile;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public UserAgentData getAgentByUUID(LLUUID uuid)
|
2007-05-16 21:10:45 +00:00
|
|
|
{
|
2007-05-07 16:53:22 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
return getUserByUUID(uuid).currentAgent;
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public UserAgentData getAgentByName(string name)
|
|
|
|
{
|
|
|
|
return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public UserAgentData getAgentByName(string fname, string lname)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
return getUserByName(fname,lname).currentAgent;
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-05-25 16:27:07 +00:00
|
|
|
public void addNewUserProfile(UserProfileData user)
|
|
|
|
{
|
|
|
|
manager.AddRow(user);
|
|
|
|
}
|
|
|
|
|
2007-05-26 06:29:22 +00:00
|
|
|
public void addNewUserAgent(UserAgentData agent)
|
|
|
|
{
|
|
|
|
// Do nothing. yet.
|
|
|
|
}
|
|
|
|
|
2007-05-07 16:53:22 +00:00
|
|
|
public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2007-05-16 21:10:45 +00:00
|
|
|
|
|
|
|
public string getName()
|
|
|
|
{
|
|
|
|
return "DB4o Userdata";
|
|
|
|
}
|
|
|
|
|
|
|
|
public string getVersion()
|
|
|
|
{
|
|
|
|
return "0.1";
|
|
|
|
}
|
2007-05-07 16:53:22 +00:00
|
|
|
}
|
|
|
|
}
|