* Changed IPresenceService Logout, so that it takes a position and a lookat

* CommsManager.AvatarService rerouted
slimupdates
Diva Canto 2010-01-10 15:34:56 -08:00
parent 6998668bbc
commit 4dd523b45d
18 changed files with 99 additions and 61 deletions

View File

@ -1430,8 +1430,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
private void establishAppearance(UUID dest, UUID srca)
{
m_log.DebugFormat("[RADMIN] Initializing inventory for {0} from {1}", dest, srca);
AvatarAppearance ava = m_app.CommunicationsManager.AvatarService.GetUserAppearance(srca);
AvatarAppearance ava = null;
AvatarData avatar = m_app.SceneManager.CurrentOrFirstScene.AvatarService.GetAvatar(srca);
if (avatar != null)
ava = avatar.ToAvatarAppearance();
// If the model has no associated appearance we're done.
@ -1524,7 +1526,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
throw new Exception("Unable to load both inventories");
}
m_app.CommunicationsManager.AvatarService.UpdateUserAppearance(dest, ava);
AvatarData adata = new AvatarData(ava);
m_app.SceneManager.CurrentOrFirstScene.AvatarService.SetAvatar(dest, adata);
}
catch (Exception e)
{
@ -1671,10 +1674,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
iserv.GetUserInventory(ID, uic.callback);
// While the inventory is being fetched, setup for appearance processing
if ((mava = m_app.CommunicationsManager.AvatarService.GetUserAppearance(ID)) == null)
{
AvatarData adata = m_app.SceneManager.CurrentOrFirstScene.AvatarService.GetAvatar(ID);
if (adata != null)
mava = adata.ToAvatarAppearance();
else
mava = new AvatarAppearance();
}
{
AvatarWearable[] wearables = mava.Wearables;
@ -1809,7 +1813,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
m_log.DebugFormat("[RADMIN] Outfit {0} load completed", oname);
} // foreach outfit
m_log.DebugFormat("[RADMIN] Inventory update complete for {0}", name);
m_app.CommunicationsManager.AvatarService.UpdateUserAppearance(ID, mava);
AvatarData adata2 = new AvatarData(mava);
m_app.SceneManager.CurrentOrFirstScene.AvatarService.SetAvatar(ID, adata2);
}
catch (Exception e)
{

View File

@ -36,7 +36,7 @@ using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Services.Interfaces;
using IUserService = OpenSim.Framework.Communications.IUserService;
using IAvatarService = OpenSim.Framework.Communications.IAvatarService;
using IAvatarService = OpenSim.Services.Interfaces.IAvatarService;
namespace OpenSim.ApplicationPlugins.Rest.Inventory
{
@ -93,11 +93,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
/// initializes.
/// </summary>
internal static CommunicationsManager Comms
{
get { return main.CommunicationsManager; }
}
internal static IInventoryService InventoryServices
{
get { return main.SceneManager.CurrentOrFirstScene.InventoryService; }
@ -115,7 +110,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
internal static IAvatarService AvatarServices
{
get { return Comms.AvatarService; }
get { return main.SceneManager.CurrentOrFirstScene.AvatarService; }
}
internal static IAssetService AssetServices

View File

@ -32,6 +32,7 @@ using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.Interfaces;
namespace OpenSim.ApplicationPlugins.Rest.Inventory
{
@ -295,15 +296,15 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
private void DoGet(AppearanceRequestData rdata)
{
AvatarData adata = Rest.AvatarServices.GetAvatar(rdata.userProfile.ID);
rdata.userAppearance = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
if (rdata.userAppearance == null)
if (adata == null)
{
rdata.Fail(Rest.HttpStatusCodeNoContent,
String.Format("appearance data not found for user {0} {1}",
rdata.userProfile.FirstName, rdata.userProfile.SurName));
}
rdata.userAppearance = adata.ToAvatarAppearance();
rdata.initXmlWriter();
@ -342,18 +343,20 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// increasingly doubtful that it is appropriate for REST. If I attempt to
// add a new record, and it already exists, then it seems to me that the
// attempt should fail, rather than update the existing record.
AvatarData adata = null;
if (GetUserAppearance(rdata))
{
modified = rdata.userAppearance != null;
created = !modified;
Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
adata = new AvatarData(rdata.userAppearance);
Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
// Rest.UserServices.UpdateUserProfile(rdata.userProfile);
}
else
{
created = true;
Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
adata = new AvatarData(rdata.userAppearance);
Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
// Rest.UserServices.UpdateUserProfile(rdata.userProfile);
}
@ -439,21 +442,22 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
private void DoDelete(AppearanceRequestData rdata)
{
AvatarData adata = Rest.AvatarServices.GetAvatar(rdata.userProfile.ID);
AvatarAppearance old = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
if (old != null)
if (adata != null)
{
AvatarAppearance old = adata.ToAvatarAppearance();
rdata.userAppearance = new AvatarAppearance();
rdata.userAppearance.Owner = old.Owner;
adata = new AvatarData(rdata.userAppearance);
Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
rdata.Complete();
}
else
{
rdata.Complete(Rest.HttpStatusCodeNoContent);
}

View File

@ -46,8 +46,6 @@
<RegionModule id="RemoteNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.RemoteNeighbourServicesConnector" />
<RegionModule id="LocalLandServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Land.LocalLandServicesConnector" />
<RegionModule id="RemoteLandServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Land.RemoteLandServicesConnector" />
<RegionModule id="LocalInterregionComms" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion.LocalInterregionComms" />
<RegionModule id="RESTInterregionComms" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion.RESTInterregionComms" />
<RegionModule id="LocalGridServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.LocalGridServicesConnector" />
<RegionModule id="RemoteGridServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.RemoteGridServicesConnector" />
<RegionModule id="HGGridConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.HGGridConnector" />

View File

@ -781,13 +781,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
ipaddr = Util.GetHostFromDNS(parts[0]);
if (parts.Length == 2)
UInt32.TryParse(parts[1], out port);
return true;
// local authority (standalone), local call
if (m_thisIP.Equals(ipaddr) && (m_aScene.RegionInfo.HttpPort == port))
return ((IAuthentication)m_aScene.CommsManager.UserAdminService).VerifyKey(userID, key);
// remote call
else
return AuthClient.VerifyKey("http://" + authority, userID, key);
//// local authority (standalone), local call
//if (m_thisIP.Equals(ipaddr) && (m_aScene.RegionInfo.HttpPort == port))
// return ((IAuthentication)m_aScene.CommsManager.UserAdminService).VerifyKey(userID, key);
//// remote call
//else
// return AuthClient.VerifyKey("http://" + authority, userID, key);
}

View File

@ -163,9 +163,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
return false;
}
public bool LogoutAgent(UUID sessionID)
public bool LogoutAgent(UUID sessionID, Vector3 position, Vector3 lookat)
{
return m_PresenceService.LogoutAgent(sessionID);
return m_PresenceService.LogoutAgent(sessionID, position, lookat);
}

View File

@ -42,6 +42,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IPresenceService m_PresenceService;
private Scene m_aScene;
public PresenceDetector(IPresenceService presenceservice)
{
@ -54,6 +55,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
scene.EventManager.OnNewClient += OnNewClient;
m_PresenceService.LogoutRegionAgents(scene.RegionInfo.RegionID);
if (m_aScene == null)
m_aScene = scene;
}
public void RemoveRegion(Scene scene)
@ -62,6 +66,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
scene.EventManager.OnNewClient -= OnNewClient;
m_PresenceService.LogoutRegionAgents(scene.RegionInfo.RegionID);
}
public void OnMakeRootAgent(ScenePresence sp)
@ -78,7 +83,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
public void OnLogout(IClientAPI client)
{
client.OnLogout -= OnLogout;
m_PresenceService.LogoutAgent(client.SessionId);
ScenePresence sp = null;
Vector3 position = new Vector3(128, 128, 0);
Vector3 lookat = new Vector3(0, 1, 0);
if (m_aScene.TryGetAvatar(client.AgentId, out sp))
{
position = sp.AbsolutePosition;
lookat = sp.Lookat;
}
m_PresenceService.LogoutAgent(client.SessionId, position, lookat);
}
}
}

View File

@ -127,9 +127,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
return false;
}
public bool LogoutAgent(UUID sessionID)
public bool LogoutAgent(UUID sessionID, Vector3 position, Vector3 lookat)
{
return m_RemoteConnector.LogoutAgent(sessionID);
return m_RemoteConnector.LogoutAgent(sessionID, position, lookat);
}

View File

@ -91,7 +91,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.Tests
result = m_LocalConnector.GetAgent(session1);
Assert.That(result.RegionID, Is.EqualTo(region2), "Agent is not in the right region (region2)");
r = m_LocalConnector.LogoutAgent(session1);
r = m_LocalConnector.LogoutAgent(session1, Vector3.Zero, Vector3.UnitY);
Assert.IsTrue(r, "LogoutAgent returned false");
result = m_LocalConnector.GetAgent(session1);
Assert.IsNotNull(result, "Agent session disappeared from storage after logout");

View File

@ -3213,7 +3213,6 @@ namespace OpenSim.Region.Framework.Scenes
if (!avatar.IsChildAgent)
{
m_sceneGridService.LogOffUser(agentID, RegionInfo.RegionID, RegionInfo.RegionHandle, avatar.AbsolutePosition, avatar.Lookat);
//List<ulong> childknownRegions = new List<ulong>();
//List<ulong> ckn = avatar.KnownChildRegionHandles;
//for (int i = 0; i < ckn.Count; i++)

View File

@ -1444,19 +1444,6 @@ namespace OpenSim.Region.Framework.Scenes
//m_log.DebugFormat("[SCENE COMM]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname);
}
public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat)
{
m_commsProvider.LogOffUser(userid, regionid, regionhandle, position, lookat);
}
// deprecated as of 2008-08-27
public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz)
{
m_commsProvider.LogOffUser(userid, regionid, regionhandle, posx, posy, posz);
}
public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(UUID queryID, string query)
{
return m_commsProvider.GenerateAgentPickerRequestResponse(queryID, query);

View File

@ -131,6 +131,8 @@ namespace OpenSim.Server.Handlers.Presence
byte[] LogoutAgent(Dictionary<string, object> request)
{
UUID session = UUID.Zero;
Vector3 position = Vector3.Zero;
Vector3 lookat = Vector3.Zero;
if (!request.ContainsKey("SessionID"))
return FailureResult();
@ -138,7 +140,12 @@ namespace OpenSim.Server.Handlers.Presence
if (!UUID.TryParse(request["SessionID"].ToString(), out session))
return FailureResult();
if (m_PresenceService.LogoutAgent(session))
if (request.ContainsKey("Position") && request["Position"] != null)
Vector3.TryParse(request["Position"].ToString(), out position);
if (request.ContainsKey("LookAt") && request["Position"] != null)
Vector3.TryParse(request["LookAt"].ToString(), out lookat);
if (m_PresenceService.LogoutAgent(session, position, lookat))
return SuccessResult();
return FailureResult();

View File

@ -132,7 +132,7 @@ namespace OpenSim.Services.Connectors
}
public bool LogoutAgent(UUID sessionID)
public bool LogoutAgent(UUID sessionID, Vector3 position, Vector3 lookat)
{
Dictionary<string, object> sendData = new Dictionary<string, object>();
//sendData["SCOPEID"] = scopeID.ToString();
@ -141,6 +141,8 @@ namespace OpenSim.Services.Connectors
sendData["METHOD"] = "logout";
sendData["SessionID"] = sessionID.ToString();
sendData["Position"] = position.ToString();
sendData["LookAt"] = lookat.ToString();
string reqString = ServerUtils.BuildQueryString(sendData);
// m_log.DebugFormat("[PRESENCE CONNECTOR]: queryString = {0}", reqString);

View File

@ -115,7 +115,7 @@ namespace OpenSim.Services.Interfaces
public interface IPresenceService
{
bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID);
bool LogoutAgent(UUID sessionID);
bool LogoutAgent(UUID sessionID, Vector3 position, Vector3 lookAt);
bool LogoutRegionAgents(UUID regionID);
bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt);

View File

@ -163,7 +163,7 @@ namespace OpenSim.Services.LLLoginService
GridRegion destination = FindDestination(account, presence, session, startLocation, out where, out position, out lookAt);
if (destination == null)
{
m_PresenceService.LogoutAgent(session);
m_PresenceService.LogoutAgent(session, presence.Position, presence.LookAt);
m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: destination not found");
return LLFailedLoginResponse.GridProblem;
}
@ -195,7 +195,7 @@ namespace OpenSim.Services.LLLoginService
}
if (aCircuit == null)
{
m_PresenceService.LogoutAgent(session);
m_PresenceService.LogoutAgent(session, presence.Position, presence.LookAt);
m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: {0}", reason);
return LLFailedLoginResponse.AuthorizationProblem;
}
@ -212,7 +212,7 @@ namespace OpenSim.Services.LLLoginService
{
m_log.WarnFormat("[LLOGIN SERVICE]: Exception processing login for {0} {1}: {2}", firstName, lastName, e.StackTrace);
if (m_PresenceService != null)
m_PresenceService.LogoutAgent(session);
m_PresenceService.LogoutAgent(session, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
return LLFailedLoginResponse.InternalError;
}
}

View File

@ -87,7 +87,7 @@ namespace OpenSim.Services.PresenceService
return true;
}
public bool LogoutAgent(UUID sessionID)
public bool LogoutAgent(UUID sessionID, Vector3 position, Vector3 lookat)
{
PresenceData data = m_Database.Get(sessionID);
if (data == null)
@ -103,6 +103,8 @@ namespace OpenSim.Services.PresenceService
data.Data["Online"] = "false";
data.Data["Logout"] = Util.UnixTimeSinceEpoch().ToString();
data.Data["Position"] = position.ToString();
data.Data["LookAt"] = lookat.ToString();
m_Database.Store(data);

View File

@ -103,7 +103,7 @@ namespace OpenSim.Tests.Clients.PresenceClient
pinfo.UserID, pinfo.Online, pinfo.RegionID, pinfo.HomeRegionID);
System.Console.WriteLine("\n");
success = m_Connector.LogoutAgent(session1);
success = m_Connector.LogoutAgent(session1, Vector3.Zero, Vector3.UnitY);
if (success)
m_log.InfoFormat("[PRESENCE CLIENT]: Successfully logged out user {0}", user1);
else

View File

@ -15,7 +15,9 @@
GridServices = "LocalGridServicesConnector"
PresenceServices = "LocalPresenceServicesConnector"
UserAccountServices = "LocalUserAccountServicesConnector"
SimulationServices = "LocalSimulationConnectorModule"
LibraryModule = true
LLLoginServiceInConnector = true
[AssetService]
LocalServiceModule = "OpenSim.Services.AssetService.dll:AssetService"
@ -23,6 +25,11 @@
[InventoryService]
LocalServiceModule = "OpenSim.Services.InventoryService.dll:InventoryService"
[LibraryService]
LocalServiceModule = "OpenSim.Services.InventoryService.dll:LibraryService"
LibraryName = "OpenSim Library"
DefaultLibrary = "./inventory/Libraries.xml"
[AuthorizationService]
LocalServiceModule = "OpenSim.Services.AuthorizationService.dll:AuthorizationService"
@ -35,3 +42,18 @@
[UserAccountService]
LocalServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService"
;; These are for creating new accounts
AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
GridService = "OpenSim.Services.GridService.dll:GridService"
[LoginService]
LocalServiceModule = "OpenSim.Services.LLLoginService.dll:LLLoginService"
UserAccountService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
InventoryService = "OpenSim.Services.InventoryService.dll:InventoryService"
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
GridService = "OpenSim.Services.GridService.dll:GridService"
DefaultRegion = "OpenSim Test"
WelcomeMessage = "Welcome, Avatar!"