From: Alan Webb <alan_webb@us.ibm.com>

Added two new (optional) attributes to create_user and update_user
  requests.

  <gender> - can be 'm' or 'f'. 'm' is default if not specified.
  <model>  - specifies another, existing, avatar that should be used
             as an appearance prototype for this user.

  If <model> is specified, then <gender> is ignored. If <model> is not
  specified, then 'm' implies a model avatar of "Default Male", and 'f'
  implies a default of "Default Female".

  At the moment the inventory is not copied. This change means that an
  avatar will only look like ruth if none of the possible models exist
  in the user database.
0.6.5-rc1
Dr Scofield 2009-04-29 09:35:35 +00:00
parent a89f60d4c9
commit d0753ad9ef
1 changed files with 67 additions and 9 deletions

View File

@ -948,6 +948,32 @@ namespace OpenSim.ApplicationPlugins.RemoteController
throw new Exception(String.Format("failed to create new user {0} {1}", throw new Exception(String.Format("failed to create new user {0} {1}",
firstname, lastname)); firstname, lastname));
// User has been created. Now establish gender and appearance.
// Default appearance is 'Default Male'. Specifying gender can
// establish "Default Female". Specifying a specific model can
// establish a specific appearance without regard for gender.
try
{
string model = "Default Male";
if (requestData.Contains("gender"))
if ((string)requestData["gender"] == "f")
model = "Default Female";
if (requestData.Contains("model"))
model = (string)requestData["model"];
string[] uname = model.Split();
UserProfileData udata = m_app.CommunicationsManager.UserService.GetUserProfile(uname[0],uname[1]);
AvatarAppearance ava = m_app.CommunicationsManager.AvatarService.GetUserAppearance(udata.ID);
m_app.CommunicationsManager.AvatarService.UpdateUserAppearance(userID, ava);
}
catch (Exception e)
{
m_log.ErrorFormat("[RADMIN] Error establishing initial appearance : {0}", e.Message);
}
responseData["success"] = "true"; responseData["success"] = "true";
responseData["avatar_uuid"] = userID.ToString(); responseData["avatar_uuid"] = userID.ToString();
@ -1170,6 +1196,38 @@ namespace OpenSim.ApplicationPlugins.RemoteController
if (String.Empty != aboutFirstLive) userProfile.FirstLifeAboutText = aboutFirstLive; if (String.Empty != aboutFirstLive) userProfile.FirstLifeAboutText = aboutFirstLive;
if (String.Empty != aboutAvatar) userProfile.AboutText = aboutAvatar; if (String.Empty != aboutAvatar) userProfile.AboutText = aboutAvatar;
// User has been created. Now establish gender and appearance.
// Default appearance is 'Default Male'. Specifying gender can
// establish "Default Female". Specifying a specific model can
// establish a specific appearance without regard for gender.
try
{
string model = "*none*";
if (requestData.Contains("gender"))
{
if ((string)requestData["gender"] == "f")
model = "Default Female";
else
model = "Default Male";
}
if (requestData.Contains("model"))
model = (string)requestData["model"];
if (model != "*none*")
{
string[] uname = model.Split();
UserProfileData udata = m_app.CommunicationsManager.UserService.GetUserProfile(uname[0],uname[1]);
AvatarAppearance ava = m_app.CommunicationsManager.AvatarService.GetUserAppearance(udata.ID);
m_app.CommunicationsManager.AvatarService.UpdateUserAppearance(userProfile.ID, ava);
}
}
catch (Exception e)
{
m_log.ErrorFormat("[RADMIN] Error establishing initial appearance : {0}", e.Message);
}
if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile)) if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile))
throw new Exception("did not manage to update user profile"); throw new Exception("did not manage to update user profile");