* Applying Ahzz's profile patch. Thanks Ahzz!
* Fixed a few bugs in the patch that are sim crashers. * There's still a bug in mySQL mode/ grid mode where the main userprofile text doesn't save.0.6.0-stable
parent
c953e51c11
commit
fe49c96ee0
|
@ -229,6 +229,12 @@ namespace OpenSim.Framework.Communications
|
||||||
|
|
||||||
#region Packet Handlers
|
#region Packet Handlers
|
||||||
|
|
||||||
|
public void UpdateAvatarPropertiesRequest(IClientAPI remote_client, UserProfileData UserProfile)
|
||||||
|
{
|
||||||
|
m_userService.UpdateUserProfileProperties(UserProfile);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
public void HandleUUIDNameRequest(LLUUID uuid, IClientAPI remote_client)
|
public void HandleUUIDNameRequest(LLUUID uuid, IClientAPI remote_client)
|
||||||
{
|
{
|
||||||
if (uuid == m_userProfileCacheService.libraryRoot.agentID)
|
if (uuid == m_userProfileCacheService.libraryRoot.agentID)
|
||||||
|
|
|
@ -139,11 +139,10 @@ namespace OpenSim.Framework.UserManagement
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set's user profile from object
|
/// Set's user profile from data object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="fname">First name</param>
|
/// <param name="data"></param>
|
||||||
/// <param name="lname">Last name</param>
|
/// <returns></returns>
|
||||||
/// <returns>A user profile</returns>
|
|
||||||
public bool setUserProfile(UserProfileData data)
|
public bool setUserProfile(UserProfileData data)
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<string, IUserData> plugin in _plugins)
|
foreach (KeyValuePair<string, IUserData> plugin in _plugins)
|
||||||
|
@ -158,7 +157,6 @@ namespace OpenSim.Framework.UserManagement
|
||||||
m_log.Info("[USERSTORAGE]: Unable to set user via " + plugin.Key + "(" + e.ToString() + ")");
|
m_log.Info("[USERSTORAGE]: Unable to set user via " + plugin.Key + "(" + e.ToString() + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -534,6 +532,29 @@ namespace OpenSim.Framework.UserManagement
|
||||||
return user.UUID;
|
return user.UUID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool UpdateUserProfileProperties(UserProfileData UserProfile)
|
||||||
|
{
|
||||||
|
if (null == GetUserProfile(UserProfile.UUID))
|
||||||
|
{
|
||||||
|
m_log.Info("[USERSTORAGE]: Failed to find User by UUID " + UserProfile.UUID.ToString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
foreach (KeyValuePair<string, IUserData> plugin in _plugins)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
plugin.Value.UpdateUserProfile(UserProfile);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Info("[USERSTORAGE]: Unable to update user " + UserProfile.UUID.ToString()
|
||||||
|
+ " via " + plugin.Key + "(" + e.ToString() + ")");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public abstract UserProfileData SetupMasterUser(string firstName, string lastName);
|
public abstract UserProfileData SetupMasterUser(string firstName, string lastName);
|
||||||
public abstract UserProfileData SetupMasterUser(string firstName, string lastName, string password);
|
public abstract UserProfileData SetupMasterUser(string firstName, string lastName, string password);
|
||||||
public abstract UserProfileData SetupMasterUser(LLUUID uuid);
|
public abstract UserProfileData SetupMasterUser(LLUUID uuid);
|
||||||
|
|
|
@ -588,10 +588,10 @@ namespace OpenSim.Framework.Data.MSSQL
|
||||||
parameters["userAssetURI"] = String.Empty;
|
parameters["userAssetURI"] = String.Empty;
|
||||||
parameters["profileCanDoMask"] = "0";
|
parameters["profileCanDoMask"] = "0";
|
||||||
parameters["profileWantDoMask"] = "0";
|
parameters["profileWantDoMask"] = "0";
|
||||||
parameters["profileAboutText"] = String.Empty;
|
parameters["profileAboutText"] = aboutText;
|
||||||
parameters["profileFirstText"] = String.Empty;
|
parameters["profileFirstText"] = firstText;
|
||||||
parameters["profileImage"] = LLUUID.Zero.ToString();
|
parameters["profileImage"] = profileImage.ToString();
|
||||||
parameters["profileFirstImage"] = LLUUID.Zero.ToString();
|
parameters["profileFirstImage"] = firstImage.ToString();
|
||||||
parameters["webLoginKey"] = LLUUID.Random().ToString();
|
parameters["webLoginKey"] = LLUUID.Random().ToString();
|
||||||
|
|
||||||
bool returnval = false;
|
bool returnval = false;
|
||||||
|
@ -670,8 +670,8 @@ namespace OpenSim.Framework.Data.MSSQL
|
||||||
SqlParameter param18 = new SqlParameter("@profileWantDoMask", Convert.ToInt32(user.profileWantDoMask));
|
SqlParameter param18 = new SqlParameter("@profileWantDoMask", Convert.ToInt32(user.profileWantDoMask));
|
||||||
SqlParameter param19 = new SqlParameter("@profileAboutText", user.profileAboutText);
|
SqlParameter param19 = new SqlParameter("@profileAboutText", user.profileAboutText);
|
||||||
SqlParameter param20 = new SqlParameter("@profileFirstText", user.profileFirstText);
|
SqlParameter param20 = new SqlParameter("@profileFirstText", user.profileFirstText);
|
||||||
SqlParameter param21 = new SqlParameter("@profileImage", LLUUID.Zero.ToString());
|
SqlParameter param21 = new SqlParameter("@profileImage", user.profileImage.ToString());
|
||||||
SqlParameter param22 = new SqlParameter("@profileFirstImage", LLUUID.Zero.ToString());
|
SqlParameter param22 = new SqlParameter("@profileFirstImage", user.profileFirstImage.ToString());
|
||||||
SqlParameter param23 = new SqlParameter("@keyUUUID", user.UUID.ToString());
|
SqlParameter param23 = new SqlParameter("@keyUUUID", user.UUID.ToString());
|
||||||
SqlParameter param24 = new SqlParameter("@webLoginKey", user.webLoginKey.UUID.ToString());
|
SqlParameter param24 = new SqlParameter("@webLoginKey", user.webLoginKey.UUID.ToString());
|
||||||
command.Parameters.Add(param1);
|
command.Parameters.Add(param1);
|
||||||
|
@ -768,4 +768,4 @@ namespace OpenSim.Framework.Data.MSSQL
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -452,11 +452,25 @@ namespace OpenSim.Framework.Data.MySQL
|
||||||
retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString());
|
retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString());
|
||||||
retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString());
|
retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString());
|
||||||
|
|
||||||
retval.profileAboutText = (string) reader["profileAboutText"];
|
if (reader.IsDBNull(reader.GetOrdinal("profileAboutText")))
|
||||||
retval.profileFirstText = (string) reader["profileFirstText"];
|
retval.profileAboutText = "";
|
||||||
|
else
|
||||||
|
retval.profileAboutText = (string) reader["profileAboutText"];
|
||||||
|
|
||||||
LLUUID.TryParse((string)reader["profileImage"], out retval.profileImage);
|
if (reader.IsDBNull( reader.GetOrdinal( "profileFirstText" ) ) )
|
||||||
LLUUID.TryParse((string)reader["profileFirstImage"], out retval.profileFirstImage);
|
retval.profileFirstText = "";
|
||||||
|
else
|
||||||
|
retval.profileFirstText = (string)reader["profileFirstText"];
|
||||||
|
|
||||||
|
if (reader.IsDBNull( reader.GetOrdinal( "profileImage" ) ) )
|
||||||
|
retval.profileImage = LLUUID.Zero;
|
||||||
|
else
|
||||||
|
LLUUID.TryParse((string)reader["profileImage"], out retval.profileImage);
|
||||||
|
|
||||||
|
if (reader.IsDBNull( reader.GetOrdinal( "profileFirstImage" ) ) )
|
||||||
|
retval.profileFirstImage = LLUUID.Zero;
|
||||||
|
else
|
||||||
|
LLUUID.TryParse((string)reader["profileFirstImage"], out retval.profileFirstImage);
|
||||||
|
|
||||||
if( reader.IsDBNull( reader.GetOrdinal( "webLoginKey" ) ) )
|
if( reader.IsDBNull( reader.GetOrdinal( "webLoginKey" ) ) )
|
||||||
{
|
{
|
||||||
|
@ -553,6 +567,7 @@ namespace OpenSim.Framework.Data.MySQL
|
||||||
string aboutText, string firstText,
|
string aboutText, string firstText,
|
||||||
LLUUID profileImage, LLUUID firstImage, LLUUID webLoginKey)
|
LLUUID profileImage, LLUUID firstImage, LLUUID webLoginKey)
|
||||||
{
|
{
|
||||||
|
m_log.Debug("[MySQLManager]: Fetching profile for " + uuid.ToString());
|
||||||
string sql =
|
string sql =
|
||||||
"INSERT INTO users (`UUID`, `username`, `lastname`, `passwordHash`, `passwordSalt`, `homeRegion`, ";
|
"INSERT INTO users (`UUID`, `username`, `lastname`, `passwordHash`, `passwordSalt`, `homeRegion`, ";
|
||||||
sql +=
|
sql +=
|
||||||
|
@ -610,9 +625,99 @@ namespace OpenSim.Framework.Data.MySQL
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_log.Debug("[MySQLManager]: Fetch user retval == " + returnval.ToString());
|
||||||
return returnval;
|
return returnval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new user and inserts it into the database
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="uuid">User ID</param>
|
||||||
|
/// <param name="username">First part of the login</param>
|
||||||
|
/// <param name="lastname">Second part of the login</param>
|
||||||
|
/// <param name="passwordHash">A salted hash of the users password</param>
|
||||||
|
/// <param name="passwordSalt">The salt used for the password hash</param>
|
||||||
|
/// <param name="homeRegion">A regionHandle of the users home region</param>
|
||||||
|
/// <param name="homeLocX">Home region position vector</param>
|
||||||
|
/// <param name="homeLocY">Home region position vector</param>
|
||||||
|
/// <param name="homeLocZ">Home region position vector</param>
|
||||||
|
/// <param name="homeLookAtX">Home region 'look at' vector</param>
|
||||||
|
/// <param name="homeLookAtY">Home region 'look at' vector</param>
|
||||||
|
/// <param name="homeLookAtZ">Home region 'look at' vector</param>
|
||||||
|
/// <param name="created">Account created (unix timestamp)</param>
|
||||||
|
/// <param name="lastlogin">Last login (unix timestamp)</param>
|
||||||
|
/// <param name="inventoryURI">Users inventory URI</param>
|
||||||
|
/// <param name="assetURI">Users asset URI</param>
|
||||||
|
/// <param name="canDoMask">I can do mask</param>
|
||||||
|
/// <param name="wantDoMask">I want to do mask</param>
|
||||||
|
/// <param name="aboutText">Profile text</param>
|
||||||
|
/// <param name="firstText">Firstlife text</param>
|
||||||
|
/// <param name="profileImage">UUID for profile image</param>
|
||||||
|
/// <param name="firstImage">UUID for firstlife image</param>
|
||||||
|
/// <returns>Success?</returns>
|
||||||
|
public bool updateUserRow(LLUUID uuid, string username, string lastname, string passwordHash,
|
||||||
|
string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ,
|
||||||
|
float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin,
|
||||||
|
string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask,
|
||||||
|
string aboutText, string firstText,
|
||||||
|
LLUUID profileImage, LLUUID firstImage, LLUUID webLoginKey)
|
||||||
|
{
|
||||||
|
string sql = "UPDATE users SET `username` = ?username , `lastname` = ?lastname ";
|
||||||
|
sql += ", `passwordHash` = ?passwordHash , `passwordSalt` = ?passwordSalt , ";
|
||||||
|
sql += "`homeRegion` = ?homeRegion , `homeLocationX` = ?homeLocationX , ";
|
||||||
|
sql += "`homeLocationY` = ?homeLocationY , `homeLocationZ` = ?homeLocationZ , ";
|
||||||
|
sql += "`homeLookAtX` = ?homeLookAtX , `homeLookAtY` = ?homeLookAtY , ";
|
||||||
|
sql += "`homeLookAtZ` = ?homeLookAtZ , `created` = ?created , `lastLogin` = ?lastLogin , ";
|
||||||
|
sql += "`userInventoryURI` = ?userInventoryURI , `userAssetURI` = ?userAssetURI , ";
|
||||||
|
sql += "`profileCanDoMask` = ?profileCanDoMask , `profileWantDoMask` = ?profileWantDoMask , ";
|
||||||
|
sql += "`profileAboutText` = ?profileAboutText , `profileFirstText` = ?profileFirstText, ";
|
||||||
|
sql += "`profileImage` = ?profileImage , `profileFirstImage` = ?profileFirstImage , ";
|
||||||
|
sql += "`webLoginKey` = ?webLoginKey WHERE UUID = ?UUID";
|
||||||
|
|
||||||
|
Dictionary<string, string> parameters = new Dictionary<string, string>();
|
||||||
|
parameters["?UUID"] = uuid.ToString();
|
||||||
|
parameters["?username"] = username.ToString();
|
||||||
|
parameters["?lastname"] = lastname.ToString();
|
||||||
|
parameters["?passwordHash"] = passwordHash.ToString();
|
||||||
|
parameters["?passwordSalt"] = passwordSalt.ToString();
|
||||||
|
parameters["?homeRegion"] = homeRegion.ToString();
|
||||||
|
parameters["?homeLocationX"] = homeLocX.ToString();
|
||||||
|
parameters["?homeLocationY"] = homeLocY.ToString();
|
||||||
|
parameters["?homeLocationZ"] = homeLocZ.ToString();
|
||||||
|
parameters["?homeLookAtX"] = homeLookAtX.ToString();
|
||||||
|
parameters["?homeLookAtY"] = homeLookAtY.ToString();
|
||||||
|
parameters["?homeLookAtZ"] = homeLookAtZ.ToString();
|
||||||
|
parameters["?created"] = created.ToString();
|
||||||
|
parameters["?lastLogin"] = lastlogin.ToString();
|
||||||
|
parameters["?userInventoryURI"] = inventoryURI;
|
||||||
|
parameters["?userAssetURI"] = assetURI;
|
||||||
|
parameters["?profileCanDoMask"] = "0";
|
||||||
|
parameters["?profileWantDoMask"] = "0";
|
||||||
|
parameters["?profileAboutText"] = aboutText;
|
||||||
|
parameters["?profileFirstText"] = firstText;
|
||||||
|
parameters["?profileImage"] = profileImage.ToString();
|
||||||
|
parameters["?profileFirstImage"] = firstImage.ToString();
|
||||||
|
parameters["?webLoginKey"] = webLoginKey.ToString();
|
||||||
|
|
||||||
|
bool returnval = false;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
IDbCommand result = Query(sql, parameters);
|
||||||
|
|
||||||
|
if (result.ExecuteNonQuery() == 1)
|
||||||
|
returnval = true;
|
||||||
|
|
||||||
|
result.Dispose();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Error(e.ToString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_log.Debug("[MySQLManager]: update user retval == " + returnval.ToString());
|
||||||
|
return returnval;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Inserts a new region into the database
|
/// Inserts a new region into the database
|
||||||
|
|
|
@ -594,7 +594,11 @@ namespace OpenSim.Framework.Data.MySQL
|
||||||
/// <param name="user">The profile data to use to update the DB</param>
|
/// <param name="user">The profile data to use to update the DB</param>
|
||||||
public bool UpdateUserProfile(UserProfileData user)
|
public bool UpdateUserProfile(UserProfileData user)
|
||||||
{
|
{
|
||||||
// TODO: implement
|
database.updateUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt
|
||||||
|
, user.homeRegion, user.homeLocation.X, user.homeLocation.Y, user.homeLocation.Z, user.homeLookAt.X
|
||||||
|
, user.homeLookAt.Y, user.homeLookAt.Z, user.created, user.lastLogin, user.userInventoryURI
|
||||||
|
, user.userAssetURI, user.profileCanDoMask, user.profileWantDoMask, user.profileAboutText
|
||||||
|
, user.profileFirstText, user.profileImage, user.profileFirstImage, user.webLoginKey);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -641,4 +645,4 @@ namespace OpenSim.Framework.Data.MySQL
|
||||||
return "0.1";
|
return "0.1";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -590,7 +590,7 @@ namespace OpenSim.Framework.Data.SQLite
|
||||||
// interesting has to be done to actually get these values
|
// interesting has to be done to actually get these values
|
||||||
// back out. Not enough time to figure it out yet.
|
// back out. Not enough time to figure it out yet.
|
||||||
UserProfileData user = new UserProfileData();
|
UserProfileData user = new UserProfileData();
|
||||||
user.UUID = new LLUUID((String) row["UUID"]);
|
LLUUID.TryParse((String)row["UUID"], out user.UUID);
|
||||||
user.username = (String) row["username"];
|
user.username = (String) row["username"];
|
||||||
user.surname = (String) row["surname"];
|
user.surname = (String) row["surname"];
|
||||||
user.passwordHash = (String) row["passwordHash"];
|
user.passwordHash = (String) row["passwordHash"];
|
||||||
|
@ -617,8 +617,8 @@ namespace OpenSim.Framework.Data.SQLite
|
||||||
user.profileWantDoMask = Convert.ToUInt32(row["profileWantDoMask"]);
|
user.profileWantDoMask = Convert.ToUInt32(row["profileWantDoMask"]);
|
||||||
user.profileAboutText = (String) row["profileAboutText"];
|
user.profileAboutText = (String) row["profileAboutText"];
|
||||||
user.profileFirstText = (String) row["profileFirstText"];
|
user.profileFirstText = (String) row["profileFirstText"];
|
||||||
user.profileImage = new LLUUID((String) row["profileImage"]);
|
LLUUID.TryParse((String)row["profileImage"], out user.profileImage);
|
||||||
user.profileFirstImage = new LLUUID((String) row["profileFirstImage"]);
|
LLUUID.TryParse((String)row["profileFirstImage"], out user.profileFirstImage);
|
||||||
user.webLoginKey = new LLUUID((String) row["webLoginKey"]);
|
user.webLoginKey = new LLUUID((String) row["webLoginKey"]);
|
||||||
|
|
||||||
return user;
|
return user;
|
||||||
|
@ -832,4 +832,4 @@ namespace OpenSim.Framework.Data.SQLite
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -264,6 +264,8 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
public delegate void RequestAvatarProperties(IClientAPI remoteClient, LLUUID avatarID);
|
public delegate void RequestAvatarProperties(IClientAPI remoteClient, LLUUID avatarID);
|
||||||
|
|
||||||
|
public delegate void UpdateAvatarProperties(IClientAPI remoteClient, UserProfileData ProfileData);
|
||||||
|
|
||||||
public delegate void SetAlwaysRun(IClientAPI remoteClient, bool SetAlwaysRun);
|
public delegate void SetAlwaysRun(IClientAPI remoteClient, bool SetAlwaysRun);
|
||||||
|
|
||||||
public delegate void GenericCall2();
|
public delegate void GenericCall2();
|
||||||
|
@ -530,6 +532,7 @@ namespace OpenSim.Framework
|
||||||
event MoneyTransferRequest OnMoneyTransferRequest;
|
event MoneyTransferRequest OnMoneyTransferRequest;
|
||||||
|
|
||||||
event MoneyBalanceRequest OnMoneyBalanceRequest;
|
event MoneyBalanceRequest OnMoneyBalanceRequest;
|
||||||
|
event UpdateAvatarProperties OnUpdateAvatarProperties;
|
||||||
|
|
||||||
|
|
||||||
LLVector3 StartPos { get; set; }
|
LLVector3 StartPos { get; set; }
|
||||||
|
|
|
@ -86,6 +86,13 @@ namespace OpenSim.Framework
|
||||||
/// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
|
/// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
|
||||||
void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms);
|
void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a user profile
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="UserProfile">Profile to update</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
bool UpdateUserProfileProperties(UserProfileData UserProfile);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logs off a user on the user server
|
/// Logs off a user on the user server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -181,9 +181,25 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
public static int UnixTimeSinceEpoch()
|
public static int UnixTimeSinceEpoch()
|
||||||
{
|
{
|
||||||
TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1));
|
return ToUnixTime(DateTime.UtcNow);
|
||||||
int timestamp = (int) t.TotalSeconds;
|
}
|
||||||
return timestamp;
|
|
||||||
|
public static int ToUnixTime(DateTime stamp)
|
||||||
|
{
|
||||||
|
TimeSpan t = (stamp.ToUniversalTime() - Convert.ToDateTime("1/1/1970 8:00:00 AM"));
|
||||||
|
return (int)t.TotalSeconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DateTime ToDateTime(ulong seconds)
|
||||||
|
{
|
||||||
|
DateTime epoch = Convert.ToDateTime("1/1/1970 8:00:00 AM");
|
||||||
|
return epoch.AddSeconds(seconds);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DateTime ToDateTime(int seconds)
|
||||||
|
{
|
||||||
|
DateTime epoch = Convert.ToDateTime("1/1/1970 8:00:00 AM");
|
||||||
|
return epoch.AddSeconds(seconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string Md5Hash(string pass)
|
public static string Md5Hash(string pass)
|
||||||
|
|
|
@ -127,6 +127,7 @@ namespace OpenSim.Grid.UserServer
|
||||||
httpServer.AddStreamHandler(
|
httpServer.AddStreamHandler(
|
||||||
new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod));
|
new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod));
|
||||||
|
|
||||||
|
httpServer.AddXmlRPCHandler("update_user_profile", m_userManager.XmlRpcResponseXmlRPCUpdateUserProfile);
|
||||||
httpServer.Start();
|
httpServer.Start();
|
||||||
m_log.Info("[SERVER]: Userserver 0.5 - Startup complete");
|
m_log.Info("[SERVER]: Userserver 0.5 - Startup complete");
|
||||||
}
|
}
|
||||||
|
|
|
@ -313,6 +313,61 @@ namespace OpenSim.Grid.UserServer
|
||||||
return ProfileToXmlRPCResponse(userProfile);
|
return ProfileToXmlRPCResponse(userProfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserProfile(XmlRpcRequest request)
|
||||||
|
{
|
||||||
|
m_log.Debug("[UserManager]: Got request to update user profile");
|
||||||
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
|
Hashtable requestData = (Hashtable)request.Params[0];
|
||||||
|
Hashtable responseData = new Hashtable();
|
||||||
|
|
||||||
|
UserProfileData userProfile;
|
||||||
|
if (!requestData.Contains("avatar_uuid"))
|
||||||
|
{
|
||||||
|
return CreateUnknownUserErrorResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
LLUUID UserUUID = new LLUUID((string)requestData["avatar_uuid"]);
|
||||||
|
userProfile = GetUserProfile(UserUUID);
|
||||||
|
if (null == userProfile)
|
||||||
|
{
|
||||||
|
return CreateUnknownUserErrorResponse();
|
||||||
|
}
|
||||||
|
// don't know how yet.
|
||||||
|
if (requestData.Contains("AllowPublish"))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
if (requestData.Contains("FLImageID"))
|
||||||
|
{
|
||||||
|
userProfile.profileFirstImage = new LLUUID((string)requestData["FLImageID"]);
|
||||||
|
}
|
||||||
|
if (requestData.Contains("ImageID"))
|
||||||
|
{
|
||||||
|
userProfile.profileImage = new LLUUID((string)requestData["ImageID"]);
|
||||||
|
}
|
||||||
|
// dont' know how yet
|
||||||
|
if (requestData.Contains("MaturePublish"))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
if (requestData.Contains("AboutText"))
|
||||||
|
{
|
||||||
|
userProfile.profileAboutText = (string)requestData["AboutText"];
|
||||||
|
}
|
||||||
|
if (requestData.Contains("FLAboutText"))
|
||||||
|
{
|
||||||
|
userProfile.profileFirstText = (string)requestData["FLAboutText"];
|
||||||
|
}
|
||||||
|
// not in DB yet.
|
||||||
|
if (requestData.Contains("ProfileURL"))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
// call plugin!
|
||||||
|
bool ret = UpdateUserProfileProperties(userProfile);
|
||||||
|
responseData["returnString"] = ret.ToString();
|
||||||
|
response.Value = responseData;
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
public XmlRpcResponse XmlRPCLogOffUserMethodUUID(XmlRpcRequest request)
|
public XmlRpcResponse XmlRPCLogOffUserMethodUUID(XmlRpcRequest request)
|
||||||
{
|
{
|
||||||
XmlRpcResponse response = new XmlRpcResponse();
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
|
|
|
@ -123,6 +123,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
//- used so we don't create new objects for each incoming packet and then toss it out later */
|
//- used so we don't create new objects for each incoming packet and then toss it out later */
|
||||||
|
|
||||||
private RequestAvatarProperties handlerRequestAvatarProperties = null; //OnRequestAvatarProperties;
|
private RequestAvatarProperties handlerRequestAvatarProperties = null; //OnRequestAvatarProperties;
|
||||||
|
private UpdateAvatarProperties handlerUpdateAvatarProperties = null; // OnUpdateAvatarProperties;
|
||||||
private ChatFromViewer handlerChatFromViewer = null; //OnChatFromViewer;
|
private ChatFromViewer handlerChatFromViewer = null; //OnChatFromViewer;
|
||||||
private ChatFromViewer handlerChatFromViewer2 = null; //OnChatFromViewer;
|
private ChatFromViewer handlerChatFromViewer2 = null; //OnChatFromViewer;
|
||||||
private ImprovedInstantMessage handlerInstantMessage = null; //OnInstantMessage;
|
private ImprovedInstantMessage handlerInstantMessage = null; //OnInstantMessage;
|
||||||
|
@ -217,7 +218,6 @@ namespace OpenSim.Region.ClientStack
|
||||||
private PacketStats handlerPacketStats = null; // OnPacketStats;#
|
private PacketStats handlerPacketStats = null; // OnPacketStats;#
|
||||||
private RequestAsset handlerRequestAsset = null; // OnRequestAsset;
|
private RequestAsset handlerRequestAsset = null; // OnRequestAsset;
|
||||||
|
|
||||||
|
|
||||||
/* Properties */
|
/* Properties */
|
||||||
|
|
||||||
public LLUUID SecureSessionId
|
public LLUUID SecureSessionId
|
||||||
|
@ -670,6 +670,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
public event FetchInventory OnAgentDataUpdateRequest;
|
public event FetchInventory OnAgentDataUpdateRequest;
|
||||||
public event FetchInventory OnUserInfoRequest;
|
public event FetchInventory OnUserInfoRequest;
|
||||||
public event TeleportLocationRequest OnSetStartLocationRequest;
|
public event TeleportLocationRequest OnSetStartLocationRequest;
|
||||||
|
public event UpdateAvatarProperties OnUpdateAvatarProperties;
|
||||||
|
|
||||||
|
|
||||||
public event CreateNewInventoryItem OnCreateNewInventoryItem;
|
public event CreateNewInventoryItem OnCreateNewInventoryItem;
|
||||||
|
@ -1591,7 +1592,10 @@ namespace OpenSim.Region.ClientStack
|
||||||
avatarReply.PropertiesData.AboutText = Helpers.StringToField(aboutText);
|
avatarReply.PropertiesData.AboutText = Helpers.StringToField(aboutText);
|
||||||
avatarReply.PropertiesData.BornOn = Helpers.StringToField(bornOn);
|
avatarReply.PropertiesData.BornOn = Helpers.StringToField(bornOn);
|
||||||
avatarReply.PropertiesData.CharterMember = Helpers.StringToField(charterMember);
|
avatarReply.PropertiesData.CharterMember = Helpers.StringToField(charterMember);
|
||||||
avatarReply.PropertiesData.FLAboutText = Helpers.StringToField(flAbout);
|
if (flAbout != null)
|
||||||
|
avatarReply.PropertiesData.FLAboutText = Helpers.StringToField(flAbout);
|
||||||
|
else
|
||||||
|
avatarReply.PropertiesData.FLAboutText = Helpers.StringToField("");
|
||||||
avatarReply.PropertiesData.Flags = 0;
|
avatarReply.PropertiesData.Flags = 0;
|
||||||
avatarReply.PropertiesData.FLImageID = flImageID;
|
avatarReply.PropertiesData.FLImageID = flImageID;
|
||||||
avatarReply.PropertiesData.ImageID = imageID;
|
avatarReply.PropertiesData.ImageID = imageID;
|
||||||
|
@ -2901,10 +2905,25 @@ namespace OpenSim.Region.ClientStack
|
||||||
if (handlerChatFromViewer != null)
|
if (handlerChatFromViewer != null)
|
||||||
handlerChatFromViewer(this, args);
|
handlerChatFromViewer(this, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
case PacketType.AvatarPropertiesUpdate:
|
||||||
|
AvatarPropertiesUpdatePacket Packet = (AvatarPropertiesUpdatePacket)Pack;
|
||||||
|
|
||||||
|
handlerUpdateAvatarProperties = OnUpdateAvatarProperties;
|
||||||
|
if (handlerUpdateAvatarProperties != null)
|
||||||
|
{
|
||||||
|
AvatarPropertiesUpdatePacket.PropertiesDataBlock Properties = Packet.PropertiesData;
|
||||||
|
UserProfileData UserProfile = new UserProfileData();
|
||||||
|
UserProfile.UUID = AgentId;
|
||||||
|
UserProfile.profileAboutText = Util.FieldToString(Properties.AboutText);
|
||||||
|
UserProfile.profileFirstText = Util.FieldToString(Properties.FLAboutText);
|
||||||
|
UserProfile.profileFirstImage = Properties.FLImageID;
|
||||||
|
UserProfile.profileImage = Properties.ImageID;
|
||||||
|
|
||||||
|
handlerUpdateAvatarProperties(this, UserProfile);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case PacketType.ScriptDialogReply:
|
case PacketType.ScriptDialogReply:
|
||||||
ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack;
|
ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack;
|
||||||
int ch = rdialog.Data.ChatChannel;
|
int ch = rdialog.Data.ChatChannel;
|
||||||
|
|
|
@ -270,6 +270,48 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
throw new Exception("The method or operation is not implemented.");
|
throw new Exception("The method or operation is not implemented.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool UpdateUserProfileProperties(UserProfileData UserProfile)
|
||||||
|
{
|
||||||
|
m_log.Debug("[OGS1UserService]: Asking UserServer to update profile.");
|
||||||
|
Hashtable param = new Hashtable();
|
||||||
|
param["avatar_uuid"] = UserProfile.UUID.ToString();
|
||||||
|
//param["AllowPublish"] = UserProfile.ToString();
|
||||||
|
param["FLImageID"] = UserProfile.profileFirstImage.ToString();
|
||||||
|
param["ImageID"] = UserProfile.profileImage.ToString();
|
||||||
|
//param["MaturePublish"] = MaturePublish.ToString();
|
||||||
|
param["AboutText"] = UserProfile.profileAboutText;
|
||||||
|
param["FLAboutText"] = UserProfile.profileFirstText;
|
||||||
|
//param["ProfileURL"] = UserProfile.ProfileURL.ToString();
|
||||||
|
IList parameters = new ArrayList();
|
||||||
|
parameters.Add(param);
|
||||||
|
|
||||||
|
XmlRpcRequest req = new XmlRpcRequest("update_user_profile", parameters);
|
||||||
|
XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
|
||||||
|
Hashtable respData = (Hashtable)resp.Value;
|
||||||
|
if (respData != null)
|
||||||
|
{
|
||||||
|
if (respData.Contains("returnString"))
|
||||||
|
{
|
||||||
|
if (((string)respData["returnString"]).ToUpper() != "TRUE")
|
||||||
|
{
|
||||||
|
m_log.Warn("[GRID]: Unable to update user profile, User Server Reported an issue");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.Warn("[GRID]: Unable to update user profile, UserServer didn't understand me!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.Warn("[GRID]: Unable to update user profile, UserServer didn't understand me!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
#region IUserServices Friend Methods
|
#region IUserServices Friend Methods
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a new friend to the database for XUser
|
/// Adds a new friend to the database for XUser
|
||||||
|
|
|
@ -36,6 +36,7 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
{
|
{
|
||||||
public class AvatarProfilesModule : IRegionModule
|
public class AvatarProfilesModule : IRegionModule
|
||||||
{
|
{
|
||||||
|
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
private Scene m_scene;
|
private Scene m_scene;
|
||||||
|
|
||||||
public AvatarProfilesModule()
|
public AvatarProfilesModule()
|
||||||
|
@ -69,11 +70,13 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
public void NewClient(IClientAPI client)
|
public void NewClient(IClientAPI client)
|
||||||
{
|
{
|
||||||
client.OnRequestAvatarProperties += RequestAvatarProperty;
|
client.OnRequestAvatarProperties += RequestAvatarProperty;
|
||||||
|
client.OnUpdateAvatarProperties += UpdateAvatarProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveClient(IClientAPI client)
|
public void RemoveClient(IClientAPI client)
|
||||||
{
|
{
|
||||||
client.OnRequestAvatarProperties -= RequestAvatarProperty;
|
client.OnRequestAvatarProperties -= RequestAvatarProperty;
|
||||||
|
client.OnUpdateAvatarProperties -= UpdateAvatarProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -83,12 +86,42 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
/// <param name="avatarID"></param>
|
/// <param name="avatarID"></param>
|
||||||
public void RequestAvatarProperty(IClientAPI remoteClient, LLUUID avatarID)
|
public void RequestAvatarProperty(IClientAPI remoteClient, LLUUID avatarID)
|
||||||
{
|
{
|
||||||
string about = "OpenSim crash test dummy";
|
// FIXME: finish adding fields such as url, masking, etc.
|
||||||
string bornOn = "Before now";
|
|
||||||
string flAbout = "First life? What is one of those? OpenSim is my life!";
|
|
||||||
LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000");
|
LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000");
|
||||||
remoteClient.SendAvatarProperties(avatarID, about, bornOn, System.String.Empty, flAbout, 0, LLUUID.Zero, LLUUID.Zero, System.String.Empty,
|
UserProfileData profile = m_scene.CommsManager.UserService.GetUserProfile(avatarID);
|
||||||
partner);
|
if (null != profile)
|
||||||
|
{
|
||||||
|
remoteClient.SendAvatarProperties(profile.UUID, profile.profileAboutText,
|
||||||
|
Util.ToDateTime(profile.created).ToString(),
|
||||||
|
System.String.Empty, profile.profileFirstText, profile.profileCanDoMask,
|
||||||
|
profile.profileFirstImage, profile.profileImage, System.String.Empty, partner);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.Debug("[AvatarProfilesModule]: Got null for profile for " + avatarID.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateAvatarProperties(IClientAPI remoteClient, UserProfileData newProfile)
|
||||||
|
{
|
||||||
|
UserProfileData Profile = m_scene.CommsManager.UserService.GetUserProfile(newProfile.UUID);
|
||||||
|
|
||||||
|
// if it's the profile of the user requesting the update, then we change only a few things.
|
||||||
|
if (remoteClient.AgentId.CompareTo(Profile.UUID) == 0)
|
||||||
|
{
|
||||||
|
Profile.profileImage = newProfile.profileImage;
|
||||||
|
Profile.profileFirstImage = newProfile.profileFirstImage;
|
||||||
|
Profile.profileAboutText = newProfile.profileAboutText;
|
||||||
|
Profile.profileFirstText = newProfile.profileFirstText;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (m_scene.CommsManager.UserService.UpdateUserProfileProperties(Profile))
|
||||||
|
{
|
||||||
|
RequestAvatarProperty(remoteClient, newProfile.UUID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,6 +154,8 @@ namespace SimpleApp
|
||||||
public event FriendshipTermination OnTerminateFriendship;
|
public event FriendshipTermination OnTerminateFriendship;
|
||||||
public event PacketStats OnPacketStats;
|
public event PacketStats OnPacketStats;
|
||||||
public event MoneyBalanceRequest OnMoneyBalanceRequest;
|
public event MoneyBalanceRequest OnMoneyBalanceRequest;
|
||||||
|
public event UpdateAvatarProperties OnUpdateAvatarProperties;
|
||||||
|
|
||||||
|
|
||||||
#pragma warning restore 67
|
#pragma warning restore 67
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue