Merge branch 'master' into httptests

httptests
UbitUmarov 2016-12-07 20:34:11 +00:00
commit 55c04a2410
10 changed files with 82 additions and 26 deletions

View File

@ -320,12 +320,11 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
UUID targetID; UUID targetID;
UUID.TryParse(args[0], out targetID); UUID.TryParse(args[0], out targetID);
// Can't handle NPC yet...
ScenePresence p = FindPresence(targetID);
if (null != p) ScenePresence p = FindPresence(targetID);
if (p != null && p.isNPC)
{ {
if (p.PresenceType == PresenceType.Npc) remoteClient.SendAvatarClassifiedReply(new UUID(args[0]), new Dictionary<UUID, string>());
return; return;
} }
@ -575,9 +574,9 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
// Can't handle NPC yet... // Can't handle NPC yet...
ScenePresence p = FindPresence(targetId); ScenePresence p = FindPresence(targetId);
if (null != p) if (p != null && p.isNPC)
{ {
if (p.PresenceType == PresenceType.Npc) remoteClient.SendAvatarPicksReply(new UUID(args[0]), new Dictionary<UUID, string>());
return; return;
} }
@ -860,6 +859,14 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
/// </param> /// </param>
public void NotesUpdate(IClientAPI remoteClient, UUID queryTargetID, string queryNotes) public void NotesUpdate(IClientAPI remoteClient, UUID queryTargetID, string queryNotes)
{ {
ScenePresence p = FindPresence(queryTargetID);
if (p != null && p.isNPC)
{
remoteClient.SendAgentAlertMessage(
"Notes for NPCs not available", false);
return;
}
UserProfileNotes note = new UserProfileNotes(); UserProfileNotes note = new UserProfileNotes();
note.UserId = remoteClient.AgentId; note.UserId = remoteClient.AgentId;
@ -1000,9 +1007,13 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
// Can't handle NPC yet... // Can't handle NPC yet...
ScenePresence p = FindPresence(avatarID); ScenePresence p = FindPresence(avatarID);
if (null != p) if (p != null && p.isNPC)
{ {
if (p.PresenceType == PresenceType.Npc) remoteClient.SendAvatarProperties(avatarID, ((INPC)(p.ControllingClient)).profileAbout, "5/25/1977",
Utils.StringToBytes("Non Player Character (NPC)"), "NPCs have no life", 16,
UUID.Zero, UUID.Zero, "", UUID.Zero);
remoteClient.SendAvatarInterestsReply(avatarID, 0, "",
0, "Getting into trouble", "Droidspeak");
return; return;
} }

View File

@ -776,6 +776,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
else if (sp.Flying) else if (sp.Flying)
teleportFlags |= (uint)TeleportFlags.IsFlying; teleportFlags |= (uint)TeleportFlags.IsFlying;
sp.IsInTransit = true;
if (DisableInterRegionTeleportCancellation) if (DisableInterRegionTeleportCancellation)
teleportFlags |= (uint)TeleportFlags.DisableCancel; teleportFlags |= (uint)TeleportFlags.DisableCancel;
@ -878,7 +880,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName, reason); sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName, reason);
sp.ControllingClient.SendTeleportFailed(reason); sp.ControllingClient.SendTeleportFailed(reason);
sp.IsInTransit = false;
return; return;
} }
@ -889,7 +891,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_log.DebugFormat( m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after CreateAgent on client request", "[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after CreateAgent on client request",
sp.Name, finalDestination.RegionName, sp.Scene.Name); sp.Name, finalDestination.RegionName, sp.Scene.Name);
sp.IsInTransit = false;
return; return;
} }
else if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) else if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting)
@ -899,7 +901,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_log.DebugFormat( m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after CreateAgent due to previous client close.", "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after CreateAgent due to previous client close.",
sp.Name, finalDestination.RegionName, sp.Scene.Name); sp.Name, finalDestination.RegionName, sp.Scene.Name);
sp.IsInTransit = false;
return; return;
} }
@ -960,7 +962,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_log.DebugFormat( m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} before UpdateAgent", "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} before UpdateAgent",
sp.Name, finalDestination.RegionName, sp.Scene.Name); sp.Name, finalDestination.RegionName, sp.Scene.Name);
sp.IsInTransit = false;
return; return;
} }
@ -977,7 +979,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_log.DebugFormat( m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after UpdateAgent due to previous client close.", "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after UpdateAgent due to previous client close.",
sp.Name, finalDestination.RegionName, sp.Scene.Name); sp.Name, finalDestination.RegionName, sp.Scene.Name);
sp.IsInTransit = false;
return; return;
} }
@ -986,6 +988,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
sp.Name, finalDestination.RegionName, sp.Scene.Name); sp.Name, finalDestination.RegionName, sp.Scene.Name);
Fail(sp, finalDestination, logout, currentAgentCircuit.SessionID.ToString(), "Connection between viewer and destination region could not be established."); Fail(sp, finalDestination, logout, currentAgentCircuit.SessionID.ToString(), "Connection between viewer and destination region could not be established.");
sp.IsInTransit = false;
return; return;
} }
@ -998,7 +1001,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
sp.Name, finalDestination.RegionName, sp.Scene.Name); sp.Name, finalDestination.RegionName, sp.Scene.Name);
CleanupFailedInterRegionTeleport(sp, currentAgentCircuit.SessionID.ToString(), finalDestination); CleanupFailedInterRegionTeleport(sp, currentAgentCircuit.SessionID.ToString(), finalDestination);
sp.IsInTransit = false;
return; return;
} }
@ -1035,7 +1038,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_log.DebugFormat( m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after WaitForAgentArrivedAtDestination due to previous client close.", "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after WaitForAgentArrivedAtDestination due to previous client close.",
sp.Name, finalDestination.RegionName, sp.Scene.Name); sp.Name, finalDestination.RegionName, sp.Scene.Name);
sp.IsInTransit = false;
return; return;
} }
@ -1044,7 +1047,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName);
Fail(sp, finalDestination, logout, currentAgentCircuit.SessionID.ToString(), "Destination region did not signal teleport completion."); Fail(sp, finalDestination, logout, currentAgentCircuit.SessionID.ToString(), "Destination region did not signal teleport completion.");
sp.IsInTransit = false;
return; return;
} }
@ -1093,6 +1096,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
Thread.Sleep(500); Thread.Sleep(500);
sp.Scene.CloseAgent(sp.UUID, false); sp.Scene.CloseAgent(sp.UUID, false);
} }
sp.IsInTransit = false;
} }
private void TransferAgent_V2(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, private void TransferAgent_V2(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination,
@ -1115,7 +1119,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName, reason); sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName, reason);
sp.ControllingClient.SendTeleportFailed(reason); sp.ControllingClient.SendTeleportFailed(reason);
sp.IsInTransit = false;
return; return;
} }
@ -1127,6 +1131,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
"[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after CreateAgent on client request", "[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after CreateAgent on client request",
sp.Name, finalDestination.RegionName, sp.Scene.Name); sp.Name, finalDestination.RegionName, sp.Scene.Name);
sp.IsInTransit = false;
return; return;
} }
else if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) else if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting)
@ -1137,6 +1142,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
"[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after CreateAgent due to previous client close.", "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after CreateAgent due to previous client close.",
sp.Name, finalDestination.RegionName, sp.Scene.Name); sp.Name, finalDestination.RegionName, sp.Scene.Name);
sp.IsInTransit = false;
return; return;
} }
@ -1189,7 +1195,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_log.DebugFormat( m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after UpdateAgent due to previous client close.", "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after UpdateAgent due to previous client close.",
sp.Name, finalDestination.RegionName, sp.Scene.Name); sp.Name, finalDestination.RegionName, sp.Scene.Name);
sp.IsInTransit = false;
return; return;
} }
@ -1198,6 +1204,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
sp.Name, finalDestination.RegionName, sp.Scene.Name); sp.Name, finalDestination.RegionName, sp.Scene.Name);
Fail(sp, finalDestination, logout, currentAgentCircuit.SessionID.ToString(), "Connection between viewer and destination region could not be established."); Fail(sp, finalDestination, logout, currentAgentCircuit.SessionID.ToString(), "Connection between viewer and destination region could not be established.");
sp.IsInTransit = false;
return; return;
} }
@ -1255,6 +1262,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
sp.Reset(); sp.Reset();
} }
*/ */
sp.IsInTransit = false;
} }
/// <summary> /// <summary>

View File

@ -805,7 +805,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
return !userdata.IsUnknownUser; return !userdata.IsUnknownUser;
} }
public virtual void AddUser(UUID uuid, string first, string last) public virtual void AddUser(UUID uuid, string first, string last, bool isNPC = false)
{ {
lock(m_UserCache) lock(m_UserCache)
{ {
@ -816,7 +816,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
user.FirstName = first; user.FirstName = first;
user.LastName = last; user.LastName = last;
user.IsUnknownUser = false; user.IsUnknownUser = false;
user.HasGridUserTried = false; user.HasGridUserTried = isNPC;
m_UserCache.Add(uuid, user); m_UserCache.Add(uuid, user);
} }
} }

View File

@ -58,6 +58,7 @@ namespace OpenSim.Region.Framework.Interfaces
bool SenseAsAgent { get; } bool SenseAsAgent { get; }
UUID ActiveGroupId { get; set; } UUID ActiveGroupId { get; set; }
UUID Owner { get; } UUID Owner { get; }
string profileAbout { get; set; }
} }
public interface INPCModule public interface INPCModule

View File

@ -3226,7 +3226,7 @@ namespace OpenSim.Region.Framework.Scenes
if (sp != null && sp.PresenceType == PresenceType.Npc) if (sp != null && sp.PresenceType == PresenceType.Npc)
{ {
UserManagementModule.AddUser(aCircuit.AgentID, first, last); UserManagementModule.AddUser(aCircuit.AgentID, first, last, true);
} }
else else
{ {

View File

@ -69,7 +69,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
private readonly Scene m_scene; private readonly Scene m_scene;
private readonly UUID m_ownerID; private readonly UUID m_ownerID;
private UUID m_hostGroupID; private UUID m_hostGroupID;
private string m_profileAbout = "";
public List<uint> SelectedObjects {get; private set;} public List<uint> SelectedObjects {get; private set;}
public NPCAvatar( public NPCAvatar(
@ -98,6 +98,17 @@ namespace OpenSim.Region.OptionalModules.World.NPC
m_hostGroupID = UUID.Zero; m_hostGroupID = UUID.Zero;
} }
public string profileAbout
{
get { return m_profileAbout; }
set
{
if(value.Length > 255)
m_profileAbout = value.Substring(0,255);
else
m_profileAbout = value;
}
}
public IScene Scene public IScene Scene
{ {
get { return m_scene; } get { return m_scene; }

View File

@ -2999,6 +2999,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
} }
public void osNpcSetProfileAbout(LSL_Key npc, string about)
{
CheckThreatLevel(ThreatLevel.High, "osNpcCreate");
m_host.AddScriptLPS(1);
INPCModule module = World.RequestModuleInterface<INPCModule>();
if (module != null)
{
UUID npcId = new UUID(npc.m_string);
if (!module.CheckPermissions(npcId, m_host.OwnerID))
return;
ScenePresence sp = World.GetScenePresence(npcId);
if (sp != null)
((INPC)(sp.ControllingClient)).profileAbout = about;
}
}
public void osNpcSay(LSL_Key npc, string message) public void osNpcSay(LSL_Key npc, string message)
{ {
osNpcSay(npc, 0, message); osNpcSay(npc, 0, message);

View File

@ -343,6 +343,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
rotation osNpcGetRot(key npc); rotation osNpcGetRot(key npc);
void osNpcSetRot(LSL_Key npc, rotation rot); void osNpcSetRot(LSL_Key npc, rotation rot);
void osNpcStopMoveToTarget(LSL_Key npc); void osNpcStopMoveToTarget(LSL_Key npc);
void osNpcSetProfileAbout(LSL_Key npc, string about);
void osNpcSay(key npc, string message); void osNpcSay(key npc, string message);
void osNpcSay(key npc, int channel, string message); void osNpcSay(key npc, int channel, string message);
void osNpcShout(key npc, int channel, string message); void osNpcShout(key npc, int channel, string message);

View File

@ -637,6 +637,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_OSSL_Functions.osNpcStopMoveToTarget(npc); m_OSSL_Functions.osNpcStopMoveToTarget(npc);
} }
public void osNpcSetProfileAbout(LSL_Key npc, string about)
{
m_OSSL_Functions.osNpcSetProfileAbout(npc, about);
}
public void osNpcSay(key npc, string message) public void osNpcSay(key npc, string message)
{ {
m_OSSL_Functions.osNpcSay(npc, message); m_OSSL_Functions.osNpcSay(npc, message);

View File

@ -79,7 +79,7 @@ namespace OpenSim.Services.Interfaces
/// <param name="uuid"></param> /// <param name="uuid"></param>
/// <param name="firstName"></param> /// <param name="firstName"></param>
/// <param name="lastName"></param> /// <param name="lastName"></param>
void AddUser(UUID uuid, string firstName, string lastName); void AddUser(UUID uuid, string first, string last, bool isNPC = false);
/// <summary> /// <summary>
/// Add a user. /// Add a user.