Plumb in the partner and the account title fields for profile info.

0.6.0-stable
Melanie Thielker 2008-08-15 22:49:26 +00:00
parent c1fa7592c7
commit 04488d9d38
9 changed files with 110 additions and 9 deletions

View File

@ -590,7 +590,21 @@ namespace OpenSim.Data.MySQL
retval.UserFlags = Convert.ToInt32(reader["userFlags"].ToString());
retval.GodLevel = Convert.ToInt32(reader["godLevel"].ToString());
if (reader.IsDBNull(reader.GetOrdinal("customType")))
retval.CustomType = "";
else
retval.CustomType = reader["customType"].ToString();
if (reader.IsDBNull(reader.GetOrdinal("partner")))
{
retval.Partner = LLUUID.Zero;
}
else
{
LLUUID tmp;
LLUUID.TryParse((string)reader["partner"], out tmp);
retval.Partner = tmp;
}
}
else
{
@ -731,14 +745,14 @@ namespace OpenSim.Data.MySQL
"`homeLocationX`, `homeLocationY`, `homeLocationZ`, `homeLookAtX`, `homeLookAtY`, `homeLookAtZ`, `created`, ";
sql +=
"`lastLogin`, `userInventoryURI`, `userAssetURI`, `profileCanDoMask`, `profileWantDoMask`, `profileAboutText`, ";
sql += "`profileFirstText`, `profileImage`, `profileFirstImage`, `webLoginKey`, `userFlags`, `godLevel`) VALUES ";
sql += "`profileFirstText`, `profileImage`, `profileFirstImage`, `webLoginKey`, `userFlags`, `godLevel`, `customType`, `partner`) VALUES ";
sql += "(?UUID, ?username, ?lastname, ?passwordHash, ?passwordSalt, ?homeRegion, ";
sql +=
"?homeLocationX, ?homeLocationY, ?homeLocationZ, ?homeLookAtX, ?homeLookAtY, ?homeLookAtZ, ?created, ";
sql +=
"?lastLogin, ?userInventoryURI, ?userAssetURI, ?profileCanDoMask, ?profileWantDoMask, ?profileAboutText, ";
sql += "?profileFirstText, ?profileImage, ?profileFirstImage, ?webLoginKey, ?userFlags, ?godLevel)";
sql += "?profileFirstText, ?profileImage, ?profileFirstImage, ?webLoginKey, ?userFlags, ?godLevel, ?customType, ?partner)";
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters["?UUID"] = uuid.ToString();
@ -766,6 +780,8 @@ namespace OpenSim.Data.MySQL
parameters["?webLoginKey"] = string.Empty;
parameters["?userFlags"] = "0";
parameters["?godLevel"] = "0";
parameters["?customType"] = "";
parameters["?partner"] = "";
bool returnval = false;
@ -821,7 +837,7 @@ namespace OpenSim.Data.MySQL
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, int userFlags, int godLevel)
LLUUID profileImage, LLUUID firstImage, LLUUID webLoginKey, int userFlags, int godLevel, string customType, LLUUID partner)
{
string sql = "UPDATE users SET `username` = ?username , `lastname` = ?lastname ";
sql += ", `passwordHash` = ?passwordHash , `passwordSalt` = ?passwordSalt , ";
@ -834,6 +850,7 @@ namespace OpenSim.Data.MySQL
sql += "`profileAboutText` = ?profileAboutText , `profileFirstText` = ?profileFirstText, ";
sql += "`profileImage` = ?profileImage , `profileFirstImage` = ?profileFirstImage , ";
sql += "`userFlags` = ?userFlags , `godLevel` = ?godLevel , ";
sql += "`customType` = ?customType , `partner` = ?partner , ";
sql += "`webLoginKey` = ?webLoginKey WHERE UUID = ?UUID";
Dictionary<string, string> parameters = new Dictionary<string, string>();
@ -863,6 +880,8 @@ namespace OpenSim.Data.MySQL
parameters["?webLoginKey"] = webLoginKey.ToString();
parameters["?userFlags"] = userFlags.ToString();
parameters["?godLevel"] = godLevel.ToString();
parameters["?customType"] = customType.ToString();
parameters["?partner"] = partner.ToString();
bool returnval = false;
try

View File

@ -685,7 +685,7 @@ namespace OpenSim.Data.MySQL
user.HomeRegion, user.HomeRegionID, 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.CanDoMask, user.WantDoMask, user.AboutText,
user.FirstLifeAboutText, user.Image, user.FirstLifeImage, user.WebLoginKey, user.UserFlags, user.GodLevel);
user.FirstLifeAboutText, user.Image, user.FirstLifeImage, user.WebLoginKey, user.UserFlags, user.GodLevel, user.CustomType, user.Partner);
}
return true;

View File

@ -0,0 +1,6 @@
BEGIN;
ALTER TABLE users add customType varchar(32) not null default '';
ALTER TABLE users add partner char(36) not null default '00000000-0000-0000-0000-000000000000';
COMMIT;

View File

@ -0,0 +1,6 @@
BEGIN;
ALTER TABLE users add customType varchar(32) not null default '';
ALTER TABLE users add partner char(36) not null default '00000000-0000-0000-0000-000000000000';
COMMIT;

View File

@ -683,6 +683,8 @@ namespace OpenSim.Data.SQLite
SQLiteUtil.createCol(users, "webLoginKey", typeof(String));
SQLiteUtil.createCol(users, "userFlags", typeof (Int32));
SQLiteUtil.createCol(users, "godLevel", typeof (Int32));
SQLiteUtil.createCol(users, "customType", typeof (String));
SQLiteUtil.createCol(users, "partner", typeof (String));
// Add in contraints
users.PrimaryKey = new DataColumn[] {users.Columns["UUID"]};
return users;
@ -793,6 +795,8 @@ namespace OpenSim.Data.SQLite
user.WebLoginKey = new LLUUID((String) row["webLoginKey"]);
user.UserFlags = Convert.ToInt32(row["userFlags"]);
user.GodLevel = Convert.ToInt32(row["godLevel"]);
user.CustomType = row["customType"].ToString();
user.Partner = new LLUUID((String) row["partner"]);
return user;
}
@ -835,6 +839,8 @@ namespace OpenSim.Data.SQLite
row["webLoginKey"] = user.WebLoginKey;
row["userFlags"] = user.UserFlags;
row["godLevel"] = user.GodLevel;
row["customType"] = user.CustomType;
row["partner"] = user.Partner.ToString();
// ADO.NET doesn't handle NULL very well
foreach (DataColumn col in ds.Tables["users"].Columns)

View File

@ -141,6 +141,8 @@ namespace OpenSim.Framework
//
private int _userFlags;
private int _godLevel;
private string _customType;
private LLUUID _partner;
/// <summary>
/// The regionhandle of the users preffered home region. If multiple sims occupy the same spot, the grid may decide which region the user logs into
@ -348,5 +350,17 @@ namespace OpenSim.Framework
get { return _godLevel; }
set { _godLevel = value; }
}
public virtual string CustomType
{
get { return _customType; }
set { _customType = value; }
}
public virtual LLUUID Partner
{
get { return _partner; }
set { _partner = value; }
}
}
}

View File

@ -159,6 +159,8 @@ namespace OpenSim.Grid.UserServer
responseData["user_flags"] = profile.UserFlags.ToString();
responseData["god_level"] = profile.GodLevel.ToString();
responseData["custom_type"] = profile.CustomType.ToString();
responseData["partner"] = profile.Partner.ToString();
response.Value = responseData;
return response;
@ -663,6 +665,33 @@ namespace OpenSim.Grid.UserServer
m_log.Error("[PROFILE]:Failed to set god level");
}
}
if (requestData.Contains("custom_type"))
{
try
{
userProfile.CustomType = (string)requestData["custom_type"];
}
catch (InvalidCastException)
{
m_log.Error("[PROFILE]:Failed to set custom type");
}
}
if (requestData.Contains("partner"))
{
try
{
userProfile.Partner = new LLUUID((string)requestData["partner"]);
}
catch (InvalidCastException)
{
m_log.Error("[PROFILE]:Failed to set partner");
}
}
else
{
userProfile.Partner = LLUUID.Zero;
}
// call plugin!
bool ret = UpdateUserProfileProperties(userProfile);
responseData["returnString"] = ret.ToString();

View File

@ -92,6 +92,18 @@ namespace OpenSim.Region.Communications.OGS1
if (data.Contains("god_level"))
userData.GodLevel = Convert.ToInt32((string) data["god_level"]);
if (data.Contains("custom_type"))
userData.CustomType = (string) data["custom_type"];
else
userData.CustomType = "";
if(userData.CustomType == null)
userData.CustomType = "";
if (data.Contains("partner"))
userData.Partner = new LLUUID((string) data["partner"]);
else
userData.Partner = LLUUID.Zero;
return userData;
}
@ -471,6 +483,8 @@ namespace OpenSim.Region.Communications.OGS1
param["home_look_z"] = UserProfile.HomeLookAtZ.ToString();
param["user_flags"] = UserProfile.UserFlags.ToString();
param["god_level"] = UserProfile.GodLevel.ToString();
param["custom_type"] = UserProfile.CustomType.ToString();
param["partner"] = UserProfile.Partner.ToString();
IList parameters = new ArrayList();
parameters.Add(param);

View File

@ -93,17 +93,24 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Profiles
public void RequestAvatarProperty(IClientAPI remoteClient, LLUUID avatarID)
{
// FIXME: finish adding fields such as url, masking, etc.
LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000");
UserProfileData profile = m_scene.CommsManager.UserService.GetUserProfile(avatarID);
if (null != profile)
{
Byte[] charterMember = new Byte[1];
charterMember[0] = (Byte)((profile.UserFlags & 0xf00) >> 8);
Byte[] charterMember;
if(profile.CustomType == "")
{
charterMember = new Byte[1];
charterMember[0] = (Byte)((profile.UserFlags & 0xf00) >> 8);
}
else
{
charterMember = Helpers.StringToField(profile.CustomType);
}
remoteClient.SendAvatarProperties(profile.ID, profile.AboutText,
Util.ToDateTime(profile.Created).ToString(),
charterMember, profile.FirstLifeAboutText, (uint)(profile.UserFlags & 0xff),
profile.FirstLifeImage, profile.Image, String.Empty, partner);
profile.FirstLifeImage, profile.Image, String.Empty, profile.Partner);
}
else
{