clear userAgent state on client shutdown, which fixes the issue
where you could only login once with a given id in standalone mode.afrisby
parent
7db7ad0722
commit
55b569069d
|
@ -35,6 +35,7 @@ namespace OpenSim.Framework.Communications
|
||||||
UserProfileData GetUserProfile(string firstName, string lastName);
|
UserProfileData GetUserProfile(string firstName, string lastName);
|
||||||
UserProfileData GetUserProfile(string name);
|
UserProfileData GetUserProfile(string name);
|
||||||
UserProfileData GetUserProfile(LLUUID avatarID);
|
UserProfileData GetUserProfile(LLUUID avatarID);
|
||||||
|
void clearUserAgent(LLUUID avatarID);
|
||||||
|
|
||||||
UserProfileData SetupMasterUser(string firstName, string lastName);
|
UserProfileData SetupMasterUser(string firstName, string lastName);
|
||||||
UserProfileData SetupMasterUser(string firstName, string lastName, string password);
|
UserProfileData SetupMasterUser(string firstName, string lastName, string password);
|
||||||
|
|
|
@ -129,26 +129,31 @@ namespace OpenSim.Framework.Data.DB4o
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a new profile to the database (Warning: Probably slow.)
|
/// Adds or updates a record to the user database. Do this when changes are needed
|
||||||
|
/// in the user profile that need to be persistant.
|
||||||
|
///
|
||||||
|
/// TODO: the logic here is not ACID, the local cache will be
|
||||||
|
/// updated even if the persistant data is not. This may lead
|
||||||
|
/// to unexpected results.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="row">The profile to add</param>
|
/// <param name="record">The profile to update</param>
|
||||||
/// <returns>Successful?</returns>
|
/// <returns>true on success, false on fail to persist to db</returns>
|
||||||
public bool AddRow(UserProfileData row)
|
public bool UpdateRecord(UserProfileData record)
|
||||||
{
|
{
|
||||||
if (userProfiles.ContainsKey(row.UUID))
|
if (userProfiles.ContainsKey(record.UUID))
|
||||||
{
|
{
|
||||||
userProfiles[row.UUID] = row;
|
userProfiles[record.UUID] = record;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
userProfiles.Add(row.UUID, row);
|
userProfiles.Add(record.UUID, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IObjectContainer database;
|
IObjectContainer database;
|
||||||
database = Db4oFactory.OpenFile(dbfl);
|
database = Db4oFactory.OpenFile(dbfl);
|
||||||
database.Set(row);
|
database.Set(record);
|
||||||
database.Close();
|
database.Close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -157,7 +162,5 @@ namespace OpenSim.Framework.Data.DB4o
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,13 +139,30 @@ namespace OpenSim.Framework.Data.DB4o
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
manager.AddRow(user);
|
manager.UpdateRecord(user);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Console.WriteLine(e.ToString());
|
Console.WriteLine(e.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new user profile
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user">The profile to add to the database</param>
|
||||||
|
/// <returns>True on success, false on error</returns>
|
||||||
|
public bool updateUserProfile(UserProfileData user)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
return manager.UpdateRecord(user);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Console.WriteLine(e.ToString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new user agent
|
/// Creates a new user agent
|
||||||
|
|
|
@ -224,6 +224,13 @@ namespace OpenSim.Framework.Data.MySQL
|
||||||
{
|
{
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public bool updateUserProfile(UserProfileData user)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
// TODO: implement
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Performs a money transfer request between two accounts
|
/// Performs a money transfer request between two accounts
|
||||||
|
|
|
@ -84,6 +84,12 @@ namespace OpenSim.Framework.Data
|
||||||
/// <param name="user">UserProfile to add</param>
|
/// <param name="user">UserProfile to add</param>
|
||||||
void addNewUserProfile(UserProfileData user);
|
void addNewUserProfile(UserProfileData user);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates an existing user profile
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user">UserProfile to update</param>
|
||||||
|
bool updateUserProfile(UserProfileData user);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a new agent to the database
|
/// Adds a new agent to the database
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -155,6 +155,28 @@ namespace OpenSim.Framework.UserManagement
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set's user profile from object
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fname">First name</param>
|
||||||
|
/// <param name="lname">Last name</param>
|
||||||
|
/// <returns>A user profile</returns>
|
||||||
|
public bool setUserProfile(UserProfileData data)
|
||||||
|
{
|
||||||
|
foreach (KeyValuePair<string, IUserData> plugin in _plugins)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
plugin.Value.updateUserProfile(data);
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
MainLog.Instance.Verbose( "Unable to set user via " + plugin.Key + "(" + e.ToString() + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Get UserAgent
|
#region Get UserAgent
|
||||||
|
@ -202,6 +224,15 @@ namespace OpenSim.Framework.UserManagement
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: document
|
||||||
|
public void clearUserAgent(LLUUID agentID)
|
||||||
|
{
|
||||||
|
UserProfileData profile = getUserProfile(agentID);
|
||||||
|
profile.currentAgent = null;
|
||||||
|
setUserProfile(profile);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads a user agent by name (not called directly)
|
/// Loads a user agent by name (not called directly)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -86,6 +86,11 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearUserAgent(LLUUID avatarID)
|
||||||
|
{
|
||||||
|
// TODO: implement
|
||||||
|
}
|
||||||
|
|
||||||
public UserProfileData SetupMasterUser(string firstName, string lastName)
|
public UserProfileData SetupMasterUser(string firstName, string lastName)
|
||||||
{
|
{
|
||||||
return SetupMasterUser(firstName, lastName, "");
|
return SetupMasterUser(firstName, lastName, "");
|
||||||
|
|
|
@ -674,7 +674,9 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: Add the removal from physics ?
|
// TODO: Add the removal from physics ?
|
||||||
|
|
||||||
|
// Remove client agent from profile, so new logins will work
|
||||||
|
commsManager.UserServer.clearUserAgent(agentID);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue