minor changes on profiles module; add some .trim() to create user avatar

names
This commit is contained in:
UbitUmarov
2022-02-17 10:53:42 +00:00
parent fd993addc0
commit 5beffddf2a
3 changed files with 38 additions and 53 deletions

View File

@@ -244,7 +244,7 @@ namespace OpenSim.Region.ClientStack.Linden
public void ChatterBoxSessionAgentListUpdates(UUID sessionID, UUID toAgent, List<GroupChatListAgentUpdateData> updates) public void ChatterBoxSessionAgentListUpdates(UUID sessionID, UUID toAgent, List<GroupChatListAgentUpdateData> updates)
{ {
osUTF8 sb = StartEvent("ChatterBoxSessionAgentListUpdates",1024); osUTF8 sb = StartEvent("ChatterBoxSessionAgentListUpdates");
LLSDxmlEncode2.AddMap("agent_updates",sb); LLSDxmlEncode2.AddMap("agent_updates",sb);
foreach (GroupChatListAgentUpdateData up in updates) foreach (GroupChatListAgentUpdateData up in updates)
{ {

View File

@@ -557,26 +557,22 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
return; return;
} }
OSDMap parameters= new OSDMap(); OSDMap parameters= new OSDMap() {{"creatorId", OSD.FromUUID(targetID) }};
OSD osdtmp = parameters;
parameters.Add("creatorId", OSD.FromUUID(targetID)); if(!rpc.JsonRpcRequest(ref osdtmp, "avatarclassifiedsrequest", serverURI, UUID.Random().ToString()))
OSD Params = (OSD)parameters;
if(!rpc.JsonRpcRequest(ref Params, "avatarclassifiedsrequest", serverURI, UUID.Random().ToString()))
{ {
remoteClient.SendAvatarClassifiedReply(targetID, classifieds); remoteClient.SendAvatarClassifiedReply(targetID, classifieds);
return; return;
} }
parameters = (OSDMap)Params; parameters = (OSDMap)osdtmp;
if(!parameters.TryGetValue("result", out osdtmp) || !(osdtmp is OSDArray))
if(!parameters.ContainsKey("result") || parameters["result"] == null)
{ {
remoteClient.SendAvatarClassifiedReply(targetID, classifieds); remoteClient.SendAvatarClassifiedReply(targetID, classifieds);
return; return;
} }
OSDArray list = (OSDArray)parameters["result"]; OSDArray list = (OSDArray)osdtmp;
foreach(OSD map in list) foreach(OSD map in list)
{ {
OSDMap m = (OSDMap)map; OSDMap m = (OSDMap)map;
@@ -658,14 +654,14 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
return; return;
} }
object Ad = (object)ad; object Adobject = ad;
if(!rpc.JsonRpcRequest(ref Ad, "classifieds_info_query", serverURI, UUID.Random().ToString())) if(!rpc.JsonRpcRequest(ref Adobject, "classifieds_info_query", serverURI, UUID.Random().ToString()))
{ {
remoteClient.SendAgentAlertMessage( remoteClient.SendAgentAlertMessage(
"Error getting classified info", false); "Error getting classified info", false);
return; return;
} }
ad = (UserClassifiedAdd) Ad; ad = (UserClassifiedAdd) Adobject;
if(ad.CreatorId.IsZero()) if(ad.CreatorId.IsZero())
return; return;
@@ -759,13 +755,13 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
} }
OSDMap parameters = new OSDMap {{"creatorId", OSD.FromUUID(creatorId)}}; OSDMap parameters = new OSDMap {{"creatorId", OSD.FromUUID(creatorId)}};
OSD Params = (OSD)parameters; OSD osdtmp = parameters;
if (!rpc.JsonRpcRequest(ref Params, "avatarclassifiedsrequest", serverURI, UUID.Random().ToString())) if (!rpc.JsonRpcRequest(ref osdtmp, "avatarclassifiedsrequest", serverURI, UUID.Random().ToString()))
{ {
remoteClient.SendAgentAlertMessage("Error fetching classifieds", false); remoteClient.SendAgentAlertMessage("Error fetching classifieds", false);
return; return;
} }
parameters = (OSDMap)Params; parameters = (OSDMap)osdtmp;
OSDArray list = (OSDArray)parameters["result"]; OSDArray list = (OSDArray)parameters["result"];
bool exists = list.Cast<OSDMap>().Where(map => map.ContainsKey("classifieduuid")) bool exists = list.Cast<OSDMap>().Where(map => map.ContainsKey("classifieduuid"))
.Any(map => map["classifieduuid"].AsUUID().Equals(queryclassifiedID)); .Any(map => map["classifieduuid"].AsUUID().Equals(queryclassifiedID));
@@ -783,7 +779,6 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
remoteClient.SendAvatarClassifiedReply(remoteClient.AgentId, uce.classifiedsLists); remoteClient.SendAvatarClassifiedReply(remoteClient.AgentId, uce.classifiedsLists);
return; return;
} }
// money.ApplyCharge(remoteClient.AgentId, queryclassifiedPrice, MoneyTransactionType.ClassifiedCharge);
} }
} }
@@ -804,9 +799,6 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
ad.ParcelId = p.currentParcelUUID; ad.ParcelId = p.currentParcelUUID;
object Ad = ad; object Ad = ad;
OSD.SerializeMembers(Ad);
if(!rpc.JsonRpcRequest(ref Ad, "classified_update", serverURI, UUID.Random().ToString())) if(!rpc.JsonRpcRequest(ref Ad, "classified_update", serverURI, UUID.Random().ToString()))
{ {
remoteClient.SendAgentAlertMessage("Error updating classified", false); remoteClient.SendAgentAlertMessage("Error updating classified", false);
@@ -828,7 +820,6 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
uce.classifiedsLists = null; uce.classifiedsLists = null;
} }
} }
} }
/// <summary> /// <summary>
@@ -842,7 +833,6 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
/// </param> /// </param>
public void ClassifiedDelete(UUID queryClassifiedID, IClientAPI remoteClient) public void ClassifiedDelete(UUID queryClassifiedID, IClientAPI remoteClient)
{ {
string serverURI = string.Empty; string serverURI = string.Empty;
bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI); bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
if(string.IsNullOrWhiteSpace(serverURI)) if(string.IsNullOrWhiteSpace(serverURI))
@@ -858,13 +848,11 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
if(!UUID.TryParse(queryClassifiedID.ToString(), out classifiedId)) if(!UUID.TryParse(queryClassifiedID.ToString(), out classifiedId))
return; return;
OSDMap parameters= new OSDMap(); OSD Params = new OSDMap() {{ "classifiedId", OSD.FromUUID(classifiedId) }};
parameters.Add("classifiedId", OSD.FromUUID(classifiedId));
OSD Params = (OSD)parameters;
if(!rpc.JsonRpcRequest(ref Params, "classified_delete", serverURI, UUID.Random().ToString())) if(!rpc.JsonRpcRequest(ref Params, "classified_delete", serverURI, UUID.Random().ToString()))
{ {
remoteClient.SendAgentAlertMessage( remoteClient.SendAgentAlertMessage(
"Error classified delete", false); "Error deleting classified", false);
return; return;
} }
@@ -878,8 +866,6 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
uce.classifiedsLists = null; uce.classifiedsLists = null;
} }
} }
parameters = (OSDMap)Params;
} }
#endregion Classified #endregion Classified
@@ -943,23 +929,22 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
return; return;
} }
OSDMap parameters= new OSDMap(); OSDMap parameters= new OSDMap() {{"creatorId", OSD.FromUUID(targetId)}};
parameters.Add("creatorId", OSD.FromUUID(targetId)); OSD osdtmp = parameters;
OSD Params = (OSD)parameters; if(!rpc.JsonRpcRequest(ref osdtmp, "avatarpicksrequest", serverURI, UUID.Random().ToString()))
if(!rpc.JsonRpcRequest(ref Params, "avatarpicksrequest", serverURI, UUID.Random().ToString()))
{ {
remoteClient.SendAvatarPicksReply(targetId, picks); remoteClient.SendAvatarPicksReply(targetId, picks);
return; return;
} }
parameters = (OSDMap)Params; parameters = (OSDMap)osdtmp;
if(!parameters.ContainsKey("result") || parameters["result"] == null) if(!parameters.TryGetValue("result", out osdtmp) || !(osdtmp is OSDArray))
{ {
remoteClient.SendAvatarPicksReply(targetId, picks); remoteClient.SendAvatarPicksReply(targetId, picks);
return; return;
} }
OSDArray list = (OSDArray)parameters["result"];
OSDArray list = (OSDArray)osdtmp;
foreach(OSD map in list) foreach(OSD map in list)
{ {
OSDMap m = (OSDMap)map; OSDMap m = (OSDMap)map;
@@ -1086,7 +1071,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
} }
} }
m_log.DebugFormat("[PROFILES]: PickInfoRequest: {0} : {1}", pick.Name.ToString(), pick.SnapshotId.ToString()); //m_log.DebugFormat("[PROFILES]: PickInfoRequest: {0} : {1}", pick.Name.ToString(), pick.SnapshotId.ToString());
lock(m_profilesCache) lock(m_profilesCache)
{ {
@@ -1137,7 +1122,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
/// </param> /// </param>
public void PickInfoUpdate(IClientAPI remoteClient, UUID pickID, UUID creatorID, bool topPick, string name, string desc, UUID snapshotID, int sortOrder, bool enabled) public void PickInfoUpdate(IClientAPI remoteClient, UUID pickID, UUID creatorID, bool topPick, string name, string desc, UUID snapshotID, int sortOrder, bool enabled)
{ {
m_log.DebugFormat("[PROFILES]: Start PickInfoUpdate Name: {0} PickId: {1} SnapshotId: {2}", name, pickID.ToString(), snapshotID.ToString()); //m_log.DebugFormat("[PROFILES]: Start PickInfoUpdate Name: {0} PickId: {1} SnapshotId: {2}", name, pickID.ToString(), snapshotID.ToString());
UserProfilePick pick = new UserProfilePick(); UserProfilePick pick = new UserProfilePick();
string serverURI = string.Empty; string serverURI = string.Empty;
@@ -1217,7 +1202,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
pick.Desc,pick.SnapshotId,pick.ParcelName,pick.OriginalName,pick.SimName, pick.Desc,pick.SnapshotId,pick.ParcelName,pick.OriginalName,pick.SimName,
posGlobal,pick.SortOrder,pick.Enabled); posGlobal,pick.SortOrder,pick.Enabled);
m_log.DebugFormat("[PROFILES]: Finish PickInfoUpdate {0} {1}", pick.Name, pick.PickId.ToString()); //m_log.DebugFormat("[PROFILES]: Finish PickInfoUpdate {0} {1}", pick.Name, pick.PickId.ToString());
} }
/// <summary> /// <summary>
@@ -1448,22 +1433,20 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
/// </param> /// </param>
public void AvatarInterestsUpdate(IClientAPI remoteClient, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages) public void AvatarInterestsUpdate(IClientAPI remoteClient, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages)
{ {
GetUserProfileServerURI(remoteClient.AgentId, out string serverURI);
UserProfileProperties prop = new UserProfileProperties(); if (string.IsNullOrWhiteSpace(serverURI))
prop.UserId = remoteClient.AgentId;
prop.WantToMask = (int)wantmask;
prop.WantToText = wanttext;
prop.SkillsMask = (int)skillsmask;
prop.SkillsText = skillstext;
prop.Language = languages;
string serverURI = string.Empty;
GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
if(string.IsNullOrWhiteSpace(serverURI))
return; return;
object Param = prop; object Param = new UserProfileProperties()
{
UserId = remoteClient.AgentId,
WantToMask = (int)wantmask,
WantToText = wanttext,
SkillsMask = (int)skillsmask,
SkillsText = skillstext,
Language = languages
};
if(!rpc.JsonRpcRequest(ref Param, "avatar_interests_update", serverURI, UUID.Random().ToString())) if(!rpc.JsonRpcRequest(ref Param, "avatar_interests_update", serverURI, UUID.Random().ToString()))
{ {
remoteClient.SendAgentAlertMessage( remoteClient.SendAgentAlertMessage(

View File

@@ -591,6 +591,8 @@ namespace OpenSim.Services.UserAccountService
/// <param name="model"></param> /// <param name="model"></param>
public UserAccount CreateUser(UUID scopeID, UUID principalID, string firstName, string lastName, string password, string email, string model = "") public UserAccount CreateUser(UUID scopeID, UUID principalID, string firstName, string lastName, string password, string email, string model = "")
{ {
firstName = firstName.Trim();
lastName = lastName.Trim();
UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName); UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
if (null == account) if (null == account)
{ {