GridUserService in place. Replaces the contrived concept of storing user's home and position info in the presence service. WARNING: I violated a taboo by deleting 2 migration files and simplifying the original table creation for Presence. This should not cause any problems to anyone, though. Things will work with the new simplified table, as well as with the previous contrived one. If there are any problems, solving them is as easy as dropping the presence table and deleting its row in the migrations table. The presence info only exists during a user's session anyway.
BTW, the Meshing files want to be committed too -- EOFs.slimupdates2
parent
eb6d63ab8e
commit
a58859a0d4
|
@ -1611,7 +1611,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
GridRegion home = m_app.SceneManager.CurrentOrFirstScene.GridService.GetRegionByPosition(scopeID,
|
||||
(int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize));
|
||||
if (home != null)
|
||||
m_app.SceneManager.CurrentOrFirstScene.PresenceService.SetHomeLocation(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
|
||||
m_app.SceneManager.CurrentOrFirstScene.GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -37,6 +37,11 @@ namespace OpenSim.Data
|
|||
{
|
||||
public string UserID;
|
||||
public Dictionary<string, string> Data;
|
||||
|
||||
public GridUserData()
|
||||
{
|
||||
Data = new Dictionary<string, string>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -44,7 +49,7 @@ namespace OpenSim.Data
|
|||
/// </summary>
|
||||
public interface IGridUserData
|
||||
{
|
||||
GridUserData GetGridUserData(string userID);
|
||||
bool StoreGridUserData(GridUserData data);
|
||||
GridUserData Get(string userID);
|
||||
bool Store(GridUserData data);
|
||||
}
|
||||
}
|
|
@ -50,10 +50,8 @@ namespace OpenSim.Data
|
|||
|
||||
PresenceData Get(UUID sessionID);
|
||||
void LogoutRegionAgents(UUID regionID);
|
||||
bool ReportAgent(UUID sessionID, UUID regionID, string position, string lookAt);
|
||||
bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt);
|
||||
bool ReportAgent(UUID sessionID, UUID regionID);
|
||||
PresenceData[] Get(string field, string data);
|
||||
void Prune(string userID);
|
||||
bool Delete(string field, string val);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,11 +46,11 @@ namespace OpenSim.Data.MSSQL
|
|||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public MSSQLGridUserData(string connectionString, string realm) :
|
||||
base(connectionString, realm, "UserGrid")
|
||||
base(connectionString, realm, "GridUserStore")
|
||||
{
|
||||
}
|
||||
|
||||
public GridUserData GetGridUserData(string userID)
|
||||
public GridUserData Get(string userID)
|
||||
{
|
||||
GridUserData[] ret = Get("UserID", userID);
|
||||
|
||||
|
@ -60,9 +60,5 @@ namespace OpenSim.Data.MSSQL
|
|||
return ret[0];
|
||||
}
|
||||
|
||||
public bool StoreGridUserData(GridUserData data)
|
||||
{
|
||||
return Store(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace OpenSim.Data.MSSQL
|
|||
using (SqlCommand cmd = new SqlCommand())
|
||||
{
|
||||
|
||||
cmd.CommandText = String.Format("UPDATE {0} SET Online='false' WHERE [RegionID]=@RegionID", m_Realm);
|
||||
cmd.CommandText = String.Format("DELETE FROM {0} WHERE [RegionID]=@RegionID", m_Realm);
|
||||
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@RegionID", regionID.ToString()));
|
||||
cmd.Connection = conn;
|
||||
|
@ -76,8 +76,7 @@ namespace OpenSim.Data.MSSQL
|
|||
}
|
||||
}
|
||||
|
||||
public bool ReportAgent(UUID sessionID, UUID regionID, string position,
|
||||
string lookAt)
|
||||
public bool ReportAgent(UUID sessionID, UUID regionID)
|
||||
{
|
||||
PresenceData[] pd = Get("SessionID", sessionID.ToString());
|
||||
if (pd.Length == 0)
|
||||
|
@ -88,16 +87,11 @@ namespace OpenSim.Data.MSSQL
|
|||
{
|
||||
|
||||
cmd.CommandText = String.Format(@"UPDATE {0} SET
|
||||
[RegionID] = @RegionID,
|
||||
[Position] = @Position,
|
||||
[LookAt] = @LookAt,
|
||||
[Online] = 'true'
|
||||
[RegionID] = @RegionID
|
||||
WHERE [SessionID] = @SessionID", m_Realm);
|
||||
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@SessionID", sessionID.ToString()));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@RegionID", regionID.ToString()));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@Position", position.ToString()));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@LookAt", lookAt.ToString()));
|
||||
cmd.Connection = conn;
|
||||
conn.Open();
|
||||
if (cmd.ExecuteNonQuery() == 0)
|
||||
|
@ -106,65 +100,5 @@ namespace OpenSim.Data.MSSQL
|
|||
return true;
|
||||
}
|
||||
|
||||
public bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt)
|
||||
{
|
||||
PresenceData[] pd = Get("UserID", userID);
|
||||
if (pd.Length == 0)
|
||||
return false;
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
using (SqlCommand cmd = new SqlCommand())
|
||||
{
|
||||
|
||||
cmd.CommandText = String.Format(@"UPDATE {0} SET
|
||||
[HomeRegionID] = @HomeRegionID,
|
||||
[HomePosition] = @HomePosition,
|
||||
[HomeLookAt] = @HomeLookAt
|
||||
WHERE [UserID] = @UserID", m_Realm);
|
||||
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@UserID", userID));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@HomeRegionID", regionID.ToString()));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@HomePosition", position));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@HomeLookAt", lookAt));
|
||||
cmd.Connection = conn;
|
||||
conn.Open();
|
||||
if (cmd.ExecuteNonQuery() == 0)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Prune(string userID)
|
||||
{
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
using (SqlCommand cmd = new SqlCommand())
|
||||
{
|
||||
cmd.CommandText = String.Format("SELECT * from {0} WHERE [UserID] = @UserID", m_Realm);
|
||||
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@UserID", userID));
|
||||
cmd.Connection = conn;
|
||||
conn.Open();
|
||||
|
||||
using (SqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
List<UUID> deleteSessions = new List<UUID>();
|
||||
int online = 0;
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
if (bool.Parse(reader["Online"].ToString()))
|
||||
online++;
|
||||
else
|
||||
deleteSessions.Add(new UUID(reader["SessionID"].ToString()));
|
||||
}
|
||||
|
||||
if (online == 0 && deleteSessions.Count > 0)
|
||||
deleteSessions.RemoveAt(0);
|
||||
|
||||
foreach (UUID s in deleteSessions)
|
||||
Delete("SessionID", s.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,9 +44,9 @@ namespace OpenSim.Data.MySQL
|
|||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public MySQLGridUserData(string connectionString, string realm) : base(connectionString, realm, "UserGrid") {}
|
||||
public MySQLGridUserData(string connectionString, string realm) : base(connectionString, realm, "GridUserStore") {}
|
||||
|
||||
public GridUserData GetGridUserData(string userID)
|
||||
public GridUserData Get(string userID)
|
||||
{
|
||||
GridUserData[] ret = Get("UserID", userID);
|
||||
|
||||
|
@ -56,9 +56,6 @@ namespace OpenSim.Data.MySQL
|
|||
return ret[0];
|
||||
}
|
||||
|
||||
public bool StoreGridUserData(GridUserData data)
|
||||
{
|
||||
return Store(data);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -65,15 +65,14 @@ namespace OpenSim.Data.MySQL
|
|||
{
|
||||
MySqlCommand cmd = new MySqlCommand();
|
||||
|
||||
cmd.CommandText = String.Format("update {0} set Online='false' where `RegionID`=?RegionID", m_Realm);
|
||||
cmd.CommandText = String.Format("delete from {0} where `RegionID`=?RegionID", m_Realm);
|
||||
|
||||
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
|
||||
public bool ReportAgent(UUID sessionID, UUID regionID, string position,
|
||||
string lookAt)
|
||||
public bool ReportAgent(UUID sessionID, UUID regionID)
|
||||
{
|
||||
PresenceData[] pd = Get("SessionID", sessionID.ToString());
|
||||
if (pd.Length == 0)
|
||||
|
@ -81,12 +80,10 @@ namespace OpenSim.Data.MySQL
|
|||
|
||||
MySqlCommand cmd = new MySqlCommand();
|
||||
|
||||
cmd.CommandText = String.Format("update {0} set RegionID=?RegionID, Position=?Position, LookAt=?LookAt, Online='true' where `SessionID`=?SessionID", m_Realm);
|
||||
cmd.CommandText = String.Format("update {0} set RegionID=?RegionID where `SessionID`=?SessionID", m_Realm);
|
||||
|
||||
cmd.Parameters.AddWithValue("?SessionID", sessionID.ToString());
|
||||
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
||||
cmd.Parameters.AddWithValue("?Position", position.ToString());
|
||||
cmd.Parameters.AddWithValue("?LookAt", lookAt.ToString());
|
||||
|
||||
if (ExecuteNonQuery(cmd) == 0)
|
||||
return false;
|
||||
|
@ -94,62 +91,5 @@ namespace OpenSim.Data.MySQL
|
|||
return true;
|
||||
}
|
||||
|
||||
public bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt)
|
||||
{
|
||||
PresenceData[] pd = Get("UserID", userID);
|
||||
if (pd.Length == 0)
|
||||
return false;
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand();
|
||||
|
||||
cmd.CommandText = String.Format("update {0} set HomeRegionID=?HomeRegionID, HomePosition=?HomePosition, HomeLookAt=?HomeLookAt where UserID=?UserID", m_Realm);
|
||||
|
||||
cmd.Parameters.AddWithValue("?UserID", userID);
|
||||
cmd.Parameters.AddWithValue("?HomeRegionID", regionID.ToString());
|
||||
cmd.Parameters.AddWithValue("?HomePosition", position);
|
||||
cmd.Parameters.AddWithValue("?HomeLookAt", lookAt);
|
||||
|
||||
if (ExecuteNonQuery(cmd) == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Prune(string userID)
|
||||
{
|
||||
MySqlCommand cmd = new MySqlCommand();
|
||||
|
||||
cmd.CommandText = String.Format("select * from {0} where UserID=?UserID", m_Realm);
|
||||
|
||||
cmd.Parameters.AddWithValue("?UserID", userID);
|
||||
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
cmd.Connection = dbcon;
|
||||
|
||||
using (IDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
List<UUID> deleteSessions = new List<UUID>();
|
||||
int online = 0;
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
if (bool.Parse(reader["Online"].ToString()))
|
||||
online++;
|
||||
else
|
||||
deleteSessions.Add(new UUID(reader["SessionID"].ToString()));
|
||||
}
|
||||
|
||||
// Leave one session behind so that we can pick up details such as home location
|
||||
if (online == 0 && deleteSessions.Count > 0)
|
||||
deleteSessions.RemoveAt(0);
|
||||
|
||||
foreach (UUID s in deleteSessions)
|
||||
Delete("SessionID", s.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,12 +4,10 @@ CREATE TABLE `Presence` (
|
|||
`UserID` VARCHAR(255) NOT NULL,
|
||||
`RegionID` CHAR(36) NOT NULL,
|
||||
`SessionID` CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
|
||||
`SecureSessionID` CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
|
||||
`Online` CHAR(5) NOT NULL DEFAULT 'false',
|
||||
`Login` CHAR(16) NOT NULL DEFAULT '0',
|
||||
`Logout` CHAR(16) NOT NULL DEFAULT '0',
|
||||
`Position` CHAR(64) NOT NULL DEFAULT '<0,0,0>',
|
||||
`LookAt` CHAR(64) NOT NULL DEFAULT '<0,0,0>'
|
||||
`SecureSessionID` CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE UNIQUE INDEX SessionID ON Presence(SessionID);
|
||||
CREATE INDEX UserID ON Presence(UserID);
|
||||
|
||||
COMMIT;
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
BEGIN;
|
||||
|
||||
ALTER TABLE Presence ADD COLUMN `HomeRegionID` CHAR(36) NOT NULL;
|
||||
ALTER TABLE Presence ADD COLUMN `HomePosition` CHAR(64) NOT NULL DEFAULT '<0,0,0>';
|
||||
ALTER TABLE Presence ADD COLUMN `HomeLookAt` CHAR(64) NOT NULL DEFAULT '<0,0,0>';
|
||||
|
||||
COMMIT;
|
|
@ -1,6 +0,0 @@
|
|||
BEGIN;
|
||||
|
||||
CREATE UNIQUE INDEX SessionID ON Presence(SessionID);
|
||||
CREATE INDEX UserID ON Presence(UserID);
|
||||
|
||||
COMMIT;
|
|
@ -96,45 +96,20 @@ namespace OpenSim.Data.Null
|
|||
m_presenceData.Remove(u);
|
||||
}
|
||||
|
||||
public bool ReportAgent(UUID sessionID, UUID regionID, string position, string lookAt)
|
||||
public bool ReportAgent(UUID sessionID, UUID regionID)
|
||||
{
|
||||
if (Instance != this)
|
||||
return Instance.ReportAgent(sessionID, regionID, position, lookAt);
|
||||
return Instance.ReportAgent(sessionID, regionID);
|
||||
|
||||
if (m_presenceData.ContainsKey(sessionID))
|
||||
{
|
||||
m_presenceData[sessionID].RegionID = regionID;
|
||||
m_presenceData[sessionID].Data["Position"] = position;
|
||||
m_presenceData[sessionID].Data["LookAt"] = lookAt;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt)
|
||||
{
|
||||
if (Instance != this)
|
||||
return Instance.SetHomeLocation(userID, regionID, position, lookAt);
|
||||
|
||||
bool foundone = false;
|
||||
foreach (PresenceData p in m_presenceData.Values)
|
||||
{
|
||||
if (p.UserID == userID)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[NULL PRESENCE DATA]: Setting home location {0} {1} {2} for {3}",
|
||||
// regionID, position, lookAt, p.UserID);
|
||||
|
||||
p.Data["HomeRegionID"] = regionID.ToString();
|
||||
p.Data["HomePosition"] = position.ToString();
|
||||
p.Data["HomeLookAt"] = lookAt.ToString();
|
||||
foundone = true;
|
||||
}
|
||||
}
|
||||
|
||||
return foundone;
|
||||
}
|
||||
|
||||
public PresenceData[] Get(string field, string data)
|
||||
{
|
||||
|
@ -193,39 +168,6 @@ namespace OpenSim.Data.Null
|
|||
return presences.ToArray();
|
||||
}
|
||||
|
||||
public void Prune(string userID)
|
||||
{
|
||||
if (Instance != this)
|
||||
{
|
||||
Instance.Prune(userID);
|
||||
return;
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[NULL PRESENCE DATA]: Prune called for {0}", userID);
|
||||
|
||||
List<UUID> deleteSessions = new List<UUID>();
|
||||
int online = 0;
|
||||
|
||||
foreach (KeyValuePair<UUID, PresenceData> kvp in m_presenceData)
|
||||
{
|
||||
// m_log.DebugFormat("Online: {0}", kvp.Value.Data["Online"]);
|
||||
|
||||
bool on = false;
|
||||
if (bool.TryParse(kvp.Value.Data["Online"], out on) && on)
|
||||
online++;
|
||||
else
|
||||
deleteSessions.Add(kvp.Key);
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[NULL PRESENCE DATA]: online [{0}], deleteSession.Count [{1}]", online, deleteSessions.Count);
|
||||
|
||||
// Leave one session behind so that we can pick up details such as home location
|
||||
if (online == 0 && deleteSessions.Count > 0)
|
||||
deleteSessions.RemoveAt(0);
|
||||
|
||||
foreach (UUID s in deleteSessions)
|
||||
m_presenceData.Remove(s);
|
||||
}
|
||||
|
||||
public bool Delete(string field, string data)
|
||||
{
|
||||
|
|
|
@ -526,11 +526,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
{
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName);
|
||||
|
||||
OpenSim.Services.Interfaces.PresenceInfo pinfo = m_aScene.PresenceService.GetAgent(client.SessionId);
|
||||
//OpenSim.Services.Interfaces.PresenceInfo pinfo = m_aScene.PresenceService.GetAgent(client.SessionId);
|
||||
GridUserInfo uinfo = m_aScene.GridUserService.GetGridUserInfo(client.AgentId.ToString());
|
||||
|
||||
if (pinfo != null)
|
||||
if (uinfo != null)
|
||||
{
|
||||
GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, pinfo.HomeRegionID);
|
||||
GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID);
|
||||
if (regionInfo == null)
|
||||
{
|
||||
// can't find the Home region: Tell viewer and abort
|
||||
|
@ -539,7 +540,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
}
|
||||
// a little eekie that this goes back to Scene and with a forced cast, will fix that at some point...
|
||||
((Scene)(client.Scene)).RequestTeleportLocation(
|
||||
client, regionInfo.RegionHandle, pinfo.HomePosition, pinfo.HomeLookAt,
|
||||
client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt,
|
||||
(uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason);
|
||||
if (success)
|
||||
// Log them out of this grid
|
||||
m_aScene.PresenceService.LogoutAgent(agentCircuit.SessionID, sp.AbsolutePosition, sp.Lookat);
|
||||
m_aScene.PresenceService.LogoutAgent(agentCircuit.SessionID);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
@ -238,6 +238,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
{
|
||||
if (obj.IsLoggingOut)
|
||||
{
|
||||
object sp = null;
|
||||
if (obj.Scene.TryGetScenePresence(obj.AgentId, out sp))
|
||||
{
|
||||
if (((ScenePresence)sp).IsChildAgent)
|
||||
return;
|
||||
}
|
||||
|
||||
AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode);
|
||||
|
||||
if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
|
||||
|
|
|
@ -59,9 +59,11 @@
|
|||
<RegionModule id="RemoteUserAccountServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts.RemoteUserAccountServicesConnector" />
|
||||
|
||||
<RegionModule id="LocalGridUserServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser.LocalGridUserServicesConnector" />
|
||||
<RegionModule id="RemoteGridUserServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser.RemoteGridUserServicesConnector" />
|
||||
|
||||
<RegionModule id="LocalSimulationConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation.LocalSimulationConnectorModule" />
|
||||
<RegionModule id="RemoteSimulationConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation.RemoteSimulationConnectorModule" />
|
||||
|
||||
<!-- Service connectors IN modules -->
|
||||
<RegionModule id="AssetServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset.AssetServiceInConnectorModule" />
|
||||
<RegionModule id="InventoryServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory.InventoryServiceInConnectorModule" />
|
||||
|
|
|
@ -41,12 +41,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
|
|||
{
|
||||
public class LocalGridUserServicesConnector : ISharedRegionModule, IGridUserService
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IGridUserService m_service;
|
||||
private IGridUserService m_GridUserService;
|
||||
|
||||
private ActivityDetector m_ActivityDetector;
|
||||
|
||||
private bool m_Enabled = false;
|
||||
|
||||
#region ISharedRegionModule
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
|
@ -68,7 +74,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
|
|||
IConfig userConfig = source.Configs["GridUserService"];
|
||||
if (userConfig == null)
|
||||
{
|
||||
m_log.Error("[LOCAL GRID USER SERVICE CONNECTOR]: GridUserService missing from ini files");
|
||||
m_log.Error("[LOCAL GRID USER SERVICE CONNECTOR]: GridUserService missing from OpenSim.ini");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -81,15 +87,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
|
|||
}
|
||||
|
||||
Object[] args = new Object[] { source };
|
||||
m_service = ServerUtils.LoadPlugin<IGridUserService>(serviceDll, args);
|
||||
m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(serviceDll, args);
|
||||
|
||||
if (m_service == null)
|
||||
if (m_GridUserService == null)
|
||||
{
|
||||
m_log.Error("[LOCAL GRID USER SERVICE CONNECTOR]: Can't load GridUser service");
|
||||
m_log.ErrorFormat(
|
||||
"[LOCAL GRID USER SERVICE CONNECTOR]: Cannot load user account service specified as {0}", serviceDll);
|
||||
return;
|
||||
}
|
||||
|
||||
m_ActivityDetector = new ActivityDetector(this);
|
||||
|
||||
m_Enabled = true;
|
||||
m_log.Info("[LOCAL GRID USER SERVICE CONNECTOR]: Local GridUser connector enabled");
|
||||
|
||||
m_log.Info("[LOCAL GRID USER SERVICE CONNECTOR]: Local grid user connector enabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -111,29 +122,57 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
|
|||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
scene.RegisterModuleInterface<IGridUserService>(m_service);
|
||||
scene.RegisterModuleInterface<IGridUserService>(m_GridUserService);
|
||||
m_ActivityDetector.AddRegion(scene);
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
scene.UnregisterModuleInterface<IGridUserService>(this);
|
||||
m_ActivityDetector.RemoveRegion(scene);
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_log.InfoFormat("[LOCAL GRID USER SERVICE CONNECTOR]: Enabled local grid user for region {0}", scene.RegionInfo.RegionName);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridUserService
|
||||
|
||||
public GridUserInfo LoggedIn(string userID)
|
||||
{
|
||||
return m_GridUserService.LoggedIn(userID);
|
||||
}
|
||||
|
||||
public bool LoggedOut(string userID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt)
|
||||
{
|
||||
return m_GridUserService.LoggedOut(userID, regionID, lastPosition, lastLookAt);
|
||||
}
|
||||
|
||||
public bool SetHome(string userID, UUID homeID, Vector3 homePosition, Vector3 homeLookAt)
|
||||
{
|
||||
return m_GridUserService.SetHome(userID, homeID, homePosition, homeLookAt);
|
||||
}
|
||||
|
||||
public bool SetLastPosition(string userID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt)
|
||||
{
|
||||
return m_GridUserService.SetLastPosition(userID, regionID, lastPosition, lastLookAt);
|
||||
}
|
||||
|
||||
public GridUserInfo GetGridUserInfo(string userID)
|
||||
{
|
||||
return m_service.GetGridUserInfo(userID);
|
||||
return m_GridUserService.GetGridUserInfo(userID);
|
||||
}
|
||||
|
||||
public bool StoreGridUserInfo(GridUserInfo info)
|
||||
{
|
||||
return m_service.StoreGridUserInfo(info);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
|
@ -167,9 +167,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
|||
return false;
|
||||
}
|
||||
|
||||
public bool LogoutAgent(UUID sessionID, Vector3 position, Vector3 lookat)
|
||||
public bool LogoutAgent(UUID sessionID)
|
||||
{
|
||||
return m_PresenceService.LogoutAgent(sessionID, position, lookat);
|
||||
return m_PresenceService.LogoutAgent(sessionID);
|
||||
}
|
||||
|
||||
|
||||
|
@ -178,9 +178,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
|||
return m_PresenceService.LogoutRegionAgents(regionID);
|
||||
}
|
||||
|
||||
public bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt)
|
||||
public bool ReportAgent(UUID sessionID, UUID regionID)
|
||||
{
|
||||
return m_PresenceService.ReportAgent(sessionID, regionID, position, lookAt);
|
||||
return m_PresenceService.ReportAgent(sessionID, regionID);
|
||||
}
|
||||
|
||||
public PresenceInfo GetAgent(UUID sessionID)
|
||||
|
@ -193,11 +193,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
|||
return m_PresenceService.GetAgents(userIDs);
|
||||
}
|
||||
|
||||
public bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt)
|
||||
{
|
||||
return m_PresenceService.SetHomeLocation(userID, regionID, position, lookAt);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
|||
public void OnMakeRootAgent(ScenePresence sp)
|
||||
{
|
||||
m_log.DebugFormat("[PRESENCE DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName);
|
||||
m_PresenceService.ReportAgent(sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
|
||||
m_PresenceService.ReportAgent(sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID);
|
||||
}
|
||||
|
||||
public void OnNewClient(IClientAPI client)
|
||||
|
@ -85,19 +85,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
|||
if (client.IsLoggingOut)
|
||||
{
|
||||
object sp = null;
|
||||
Vector3 position = new Vector3(128, 128, 0);
|
||||
Vector3 lookat = new Vector3(0, 1, 0);
|
||||
|
||||
if (client.Scene.TryGetScenePresence(client.AgentId, out sp))
|
||||
{
|
||||
if (sp is ScenePresence)
|
||||
{
|
||||
position = ((ScenePresence)sp).AbsolutePosition;
|
||||
lookat = ((ScenePresence)sp).Lookat;
|
||||
if (((ScenePresence)sp).IsChildAgent)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_PresenceService.LogoutAgent(client.SessionId, position, lookat);
|
||||
m_log.DebugFormat("[PRESENCE DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName);
|
||||
m_PresenceService.LogoutAgent(client.SessionId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -127,9 +127,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
|||
return false;
|
||||
}
|
||||
|
||||
public bool LogoutAgent(UUID sessionID, Vector3 position, Vector3 lookat)
|
||||
public bool LogoutAgent(UUID sessionID)
|
||||
{
|
||||
return m_RemoteConnector.LogoutAgent(sessionID, position, lookat);
|
||||
return m_RemoteConnector.LogoutAgent(sessionID);
|
||||
}
|
||||
|
||||
|
||||
|
@ -138,9 +138,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
|||
return m_RemoteConnector.LogoutRegionAgents(regionID);
|
||||
}
|
||||
|
||||
public bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt)
|
||||
public bool ReportAgent(UUID sessionID, UUID regionID)
|
||||
{
|
||||
return m_RemoteConnector.ReportAgent(sessionID, regionID, position, lookAt);
|
||||
return m_RemoteConnector.ReportAgent(sessionID, regionID);
|
||||
}
|
||||
|
||||
public PresenceInfo GetAgent(UUID sessionID)
|
||||
|
@ -153,11 +153,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
|||
return m_RemoteConnector.GetAgents(userIDs);
|
||||
}
|
||||
|
||||
public bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt)
|
||||
{
|
||||
return m_RemoteConnector.SetHomeLocation(userID, regionID, position, lookAt);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
|
|
@ -93,24 +93,24 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.Tests
|
|||
Assert.IsTrue(result.Online, "Agent just logged in but is offline");
|
||||
|
||||
UUID region1 = UUID.Random();
|
||||
bool r = m_LocalConnector.ReportAgent(session1, region1, Vector3.Zero, Vector3.Zero);
|
||||
bool r = m_LocalConnector.ReportAgent(session1, region1);
|
||||
Assert.IsTrue(r, "First ReportAgent returned false");
|
||||
result = m_LocalConnector.GetAgent(session1);
|
||||
Assert.That(result.RegionID, Is.EqualTo(region1), "Agent is not in the right region (region1)");
|
||||
|
||||
UUID region2 = UUID.Random();
|
||||
r = m_LocalConnector.ReportAgent(session1, region2, Vector3.Zero, Vector3.Zero);
|
||||
r = m_LocalConnector.ReportAgent(session1, region2);
|
||||
Assert.IsTrue(r, "Second ReportAgent returned false");
|
||||
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, Vector3.Zero, Vector3.UnitY);
|
||||
r = m_LocalConnector.LogoutAgent(session1);
|
||||
Assert.IsTrue(r, "LogoutAgent returned false");
|
||||
result = m_LocalConnector.GetAgent(session1);
|
||||
Assert.IsNotNull(result, "Agent session disappeared from storage after logout");
|
||||
Assert.IsFalse(result.Online, "Agent is reported to be Online after logout");
|
||||
|
||||
r = m_LocalConnector.ReportAgent(session1, region1, Vector3.Zero, Vector3.Zero);
|
||||
r = m_LocalConnector.ReportAgent(session1, region1);
|
||||
Assert.IsFalse(r, "ReportAgent of non-logged in user returned true");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -305,6 +305,17 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
protected IGridUserService m_GridUserService;
|
||||
public IGridUserService GridUserService
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_GridUserService == null)
|
||||
m_GridUserService = RequestModuleInterface<IGridUserService>();
|
||||
return m_GridUserService;
|
||||
}
|
||||
}
|
||||
|
||||
protected IXMLRPC m_xmlrpcModule;
|
||||
protected IWorldComm m_worldCommModule;
|
||||
public IAttachmentsModule AttachmentsModule { get; set; }
|
||||
|
@ -1306,8 +1317,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (defaultRegions != null && defaultRegions.Count >= 1)
|
||||
home = defaultRegions[0];
|
||||
|
||||
if (PresenceService != null && home != null)
|
||||
PresenceService.SetHomeLocation(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
|
||||
if (GridUserService != null && home != null)
|
||||
GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
|
||||
else
|
||||
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set home for account {0} {1}.",
|
||||
first, last);
|
||||
|
@ -3095,7 +3106,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="flags"></param>
|
||||
public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags)
|
||||
{
|
||||
if (PresenceService.SetHomeLocation(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt))
|
||||
if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt))
|
||||
// FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot.
|
||||
m_dialogModule.SendAlertToUser(remoteClient, "Home position set.");
|
||||
else
|
||||
|
@ -3543,7 +3554,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
OpenSim.Services.Interfaces.PresenceInfo pinfo = presence.GetAgent(agent.SessionID);
|
||||
|
||||
if (pinfo == null || (pinfo != null && pinfo.Online == false))
|
||||
if (pinfo == null)
|
||||
{
|
||||
reason = String.Format("Failed to verify user {0} {1}, access denied to region {2}.", agent.firstname, agent.lastname, RegionInfo.RegionName);
|
||||
return false;
|
||||
|
|
|
@ -90,8 +90,6 @@ namespace OpenSim.Server.Handlers.Presence
|
|||
return GetAgent(request);
|
||||
case "getagents":
|
||||
return GetAgents(request);
|
||||
case "sethome":
|
||||
return SetHome(request);
|
||||
}
|
||||
m_log.DebugFormat("[PRESENCE HANDLER]: unknown method request: {0}", method);
|
||||
}
|
||||
|
@ -140,12 +138,7 @@ namespace OpenSim.Server.Handlers.Presence
|
|||
if (!UUID.TryParse(request["SessionID"].ToString(), out session))
|
||||
return FailureResult();
|
||||
|
||||
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))
|
||||
if (m_PresenceService.LogoutAgent(session))
|
||||
return SuccessResult();
|
||||
|
||||
return FailureResult();
|
||||
|
@ -171,8 +164,6 @@ namespace OpenSim.Server.Handlers.Presence
|
|||
{
|
||||
UUID session = UUID.Zero;
|
||||
UUID region = UUID.Zero;
|
||||
Vector3 position = new Vector3(128, 128, 70);
|
||||
Vector3 look = Vector3.Zero;
|
||||
|
||||
if (!request.ContainsKey("SessionID") || !request.ContainsKey("RegionID"))
|
||||
return FailureResult();
|
||||
|
@ -183,13 +174,7 @@ namespace OpenSim.Server.Handlers.Presence
|
|||
if (!UUID.TryParse(request["RegionID"].ToString(), out region))
|
||||
return FailureResult();
|
||||
|
||||
if (request.ContainsKey("position"))
|
||||
Vector3.TryParse(request["position"].ToString(), out position);
|
||||
|
||||
if (request.ContainsKey("lookAt"))
|
||||
Vector3.TryParse(request["lookAt"].ToString(), out look);
|
||||
|
||||
if (m_PresenceService.ReportAgent(session, region, position, look))
|
||||
if (m_PresenceService.ReportAgent(session, region))
|
||||
{
|
||||
return SuccessResult();
|
||||
}
|
||||
|
@ -318,31 +303,5 @@ namespace OpenSim.Server.Handlers.Presence
|
|||
return ms.ToArray();
|
||||
}
|
||||
|
||||
byte[] SetHome(Dictionary<string, object> request)
|
||||
{
|
||||
UUID region = UUID.Zero;
|
||||
Vector3 position = new Vector3(128, 128, 70);
|
||||
Vector3 look = Vector3.Zero;
|
||||
|
||||
if (!request.ContainsKey("UserID") || !request.ContainsKey("RegionID"))
|
||||
return FailureResult();
|
||||
|
||||
string user = request["UserID"].ToString();
|
||||
|
||||
if (!UUID.TryParse(request["RegionID"].ToString(), out region))
|
||||
return FailureResult();
|
||||
|
||||
if (request.ContainsKey("position"))
|
||||
Vector3.TryParse(request["position"].ToString(), out position);
|
||||
|
||||
if (request.ContainsKey("lookAt"))
|
||||
Vector3.TryParse(request["lookAt"].ToString(), out look);
|
||||
|
||||
if (m_PresenceService.SetHomeLocation(user, region, position, look))
|
||||
return SuccessResult();
|
||||
|
||||
return FailureResult();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,14 +25,206 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using log4net;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Services.Connectors
|
||||
{
|
||||
public class GridUserServiceConnector
|
||||
public class GridUserServicesConnector : IGridUserService
|
||||
{
|
||||
public GridUserServiceConnector()
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private string m_ServerURI = String.Empty;
|
||||
|
||||
public GridUserServicesConnector()
|
||||
{
|
||||
}
|
||||
|
||||
public GridUserServicesConnector(string serverURI)
|
||||
{
|
||||
m_ServerURI = serverURI.TrimEnd('/');
|
||||
}
|
||||
|
||||
public GridUserServicesConnector(IConfigSource source)
|
||||
{
|
||||
Initialise(source);
|
||||
}
|
||||
|
||||
public virtual void Initialise(IConfigSource source)
|
||||
{
|
||||
IConfig gridConfig = source.Configs["GridUserService"];
|
||||
if (gridConfig == null)
|
||||
{
|
||||
m_log.Error("[GRID USER CONNECTOR]: GridUserService missing from OpenSim.ini");
|
||||
throw new Exception("GridUser connector init error");
|
||||
}
|
||||
|
||||
string serviceURI = gridConfig.GetString("GridUserServerURI",
|
||||
String.Empty);
|
||||
|
||||
if (serviceURI == String.Empty)
|
||||
{
|
||||
m_log.Error("[GRID USER CONNECTOR]: No Server URI named in section GridUserService");
|
||||
throw new Exception("GridUser connector init error");
|
||||
}
|
||||
m_ServerURI = serviceURI;
|
||||
}
|
||||
|
||||
|
||||
#region IPresenceService
|
||||
|
||||
|
||||
public GridUserInfo LoggedIn(string userID)
|
||||
{
|
||||
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
||||
//sendData["SCOPEID"] = scopeID.ToString();
|
||||
sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
|
||||
sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
|
||||
sendData["METHOD"] = "loggedin";
|
||||
|
||||
sendData["UserID"] = userID;
|
||||
|
||||
return Get(sendData);
|
||||
|
||||
}
|
||||
|
||||
public bool LoggedOut(string userID, UUID region, Vector3 position, Vector3 lookat)
|
||||
{
|
||||
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
||||
//sendData["SCOPEID"] = scopeID.ToString();
|
||||
sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
|
||||
sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
|
||||
sendData["METHOD"] = "loggedout";
|
||||
|
||||
return Set(sendData, userID, region, position, lookat);
|
||||
}
|
||||
|
||||
public bool SetHome(string userID, UUID regionID, Vector3 position, Vector3 lookAt)
|
||||
{
|
||||
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
||||
//sendData["SCOPEID"] = scopeID.ToString();
|
||||
sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
|
||||
sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
|
||||
sendData["METHOD"] = "sethome";
|
||||
|
||||
return Set(sendData, userID, regionID, position, lookAt);
|
||||
}
|
||||
|
||||
public bool SetLastPosition(string userID, UUID regionID, Vector3 position, Vector3 lookAt)
|
||||
{
|
||||
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
||||
//sendData["SCOPEID"] = scopeID.ToString();
|
||||
sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
|
||||
sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
|
||||
sendData["METHOD"] = "setposition";
|
||||
|
||||
return Set(sendData, userID, regionID, position, lookAt);
|
||||
}
|
||||
|
||||
public GridUserInfo GetGridUserInfo(string userID)
|
||||
{
|
||||
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
||||
//sendData["SCOPEID"] = scopeID.ToString();
|
||||
sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
|
||||
sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
|
||||
sendData["METHOD"] = "getgriduserinfo";
|
||||
|
||||
sendData["UserID"] = userID;
|
||||
|
||||
return Get(sendData);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected bool Set(Dictionary<string, object> sendData, string userID, UUID regionID, Vector3 position, Vector3 lookAt)
|
||||
{
|
||||
sendData["UserID"] = userID;
|
||||
sendData["RegionID"] = regionID.ToString();
|
||||
sendData["Position"] = position.ToString();
|
||||
sendData["LookAt"] = lookAt.ToString();
|
||||
|
||||
string reqString = ServerUtils.BuildQueryString(sendData);
|
||||
// m_log.DebugFormat("[GRID USER CONNECTOR]: queryString = {0}", reqString);
|
||||
try
|
||||
{
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
m_ServerURI + "/griduser",
|
||||
reqString);
|
||||
if (reply != string.Empty)
|
||||
{
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||
|
||||
if (replyData.ContainsKey("result"))
|
||||
{
|
||||
if (replyData["result"].ToString().ToLower() == "success")
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
m_log.DebugFormat("[GRID USER CONNECTOR]: SetPosition reply data does not contain result field");
|
||||
|
||||
}
|
||||
else
|
||||
m_log.DebugFormat("[GRID USER CONNECTOR]: SetPosition received empty reply");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[GRID USER CONNECTOR]: Exception when contacting grid user server: {0}", e.Message);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected GridUserInfo Get(Dictionary<string, object> sendData)
|
||||
{
|
||||
string reqString = ServerUtils.BuildQueryString(sendData);
|
||||
// m_log.DebugFormat("[GRID USER CONNECTOR]: queryString = {0}", reqString);
|
||||
try
|
||||
{
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
m_ServerURI + "/griduser",
|
||||
reqString);
|
||||
if (reply != string.Empty)
|
||||
{
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||
GridUserInfo guinfo = null;
|
||||
|
||||
if ((replyData != null) && replyData.ContainsKey("result") && (replyData["result"] != null))
|
||||
{
|
||||
if (replyData["result"] is Dictionary<string, object>)
|
||||
{
|
||||
guinfo = new GridUserInfo((Dictionary<string, object>)replyData["result"]);
|
||||
}
|
||||
}
|
||||
|
||||
return guinfo;
|
||||
|
||||
}
|
||||
else
|
||||
m_log.DebugFormat("[GRID USER CONNECTOR]: Loggedin received empty reply");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[GRID USER CONNECTOR]: Exception when contacting grid user server: {0}", e.Message);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ namespace OpenSim.Services.Connectors
|
|||
|
||||
}
|
||||
|
||||
public bool LogoutAgent(UUID sessionID, Vector3 position, Vector3 lookat)
|
||||
public bool LogoutAgent(UUID sessionID)
|
||||
{
|
||||
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
||||
//sendData["SCOPEID"] = scopeID.ToString();
|
||||
|
@ -141,8 +141,6 @@ 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);
|
||||
|
@ -220,7 +218,7 @@ namespace OpenSim.Services.Connectors
|
|||
return false;
|
||||
}
|
||||
|
||||
public bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt)
|
||||
public bool ReportAgent(UUID sessionID, UUID regionID)
|
||||
{
|
||||
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
||||
//sendData["SCOPEID"] = scopeID.ToString();
|
||||
|
@ -230,8 +228,6 @@ namespace OpenSim.Services.Connectors
|
|||
|
||||
sendData["SessionID"] = sessionID.ToString();
|
||||
sendData["RegionID"] = regionID.ToString();
|
||||
sendData["position"] = position.ToString();
|
||||
sendData["lookAt"] = lookAt.ToString();
|
||||
|
||||
string reqString = ServerUtils.BuildQueryString(sendData);
|
||||
// m_log.DebugFormat("[PRESENCE CONNECTOR]: queryString = {0}", reqString);
|
||||
|
@ -371,52 +367,6 @@ namespace OpenSim.Services.Connectors
|
|||
}
|
||||
|
||||
|
||||
public bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt)
|
||||
{
|
||||
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
||||
//sendData["SCOPEID"] = scopeID.ToString();
|
||||
sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
|
||||
sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
|
||||
sendData["METHOD"] = "sethome";
|
||||
|
||||
sendData["UserID"] = userID;
|
||||
sendData["RegionID"] = regionID.ToString();
|
||||
sendData["position"] = position.ToString();
|
||||
sendData["lookAt"] = lookAt.ToString();
|
||||
|
||||
string reqString = ServerUtils.BuildQueryString(sendData);
|
||||
// m_log.DebugFormat("[PRESENCE CONNECTOR]: queryString = {0}", reqString);
|
||||
try
|
||||
{
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
m_ServerURI + "/presence",
|
||||
reqString);
|
||||
if (reply != string.Empty)
|
||||
{
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||
|
||||
if (replyData.ContainsKey("result"))
|
||||
{
|
||||
if (replyData["result"].ToString().ToLower() == "success")
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
m_log.DebugFormat("[PRESENCE CONNECTOR]: SetHomeLocation reply data does not contain result field");
|
||||
|
||||
}
|
||||
else
|
||||
m_log.DebugFormat("[PRESENCE CONNECTOR]: SetHomeLocation received empty reply");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[PRESENCE CONNECTOR]: Exception when contacting presence server: {0}", e.Message);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
/// message routing) to the SimianGrid backend
|
||||
/// </summary>
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class SimianPresenceServiceConnector : IPresenceService, ISharedRegionModule
|
||||
public class SimianPresenceServiceConnector : IPresenceService, IGridUserService, ISharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
|
@ -73,6 +73,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
if (!String.IsNullOrEmpty(m_serverUrl))
|
||||
{
|
||||
scene.RegisterModuleInterface<IPresenceService>(this);
|
||||
scene.RegisterModuleInterface<IGridUserService>(this);
|
||||
|
||||
scene.EventManager.OnMakeRootAgent += MakeRootAgentHandler;
|
||||
scene.EventManager.OnNewClient += NewClientHandler;
|
||||
|
@ -86,6 +87,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
if (!String.IsNullOrEmpty(m_serverUrl))
|
||||
{
|
||||
scene.UnregisterModuleInterface<IPresenceService>(this);
|
||||
scene.UnregisterModuleInterface<IGridUserService>(this);
|
||||
|
||||
scene.EventManager.OnMakeRootAgent -= MakeRootAgentHandler;
|
||||
scene.EventManager.OnNewClient -= NewClientHandler;
|
||||
|
@ -151,7 +153,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
return success;
|
||||
}
|
||||
|
||||
public bool LogoutAgent(UUID sessionID, Vector3 position, Vector3 lookAt)
|
||||
public bool LogoutAgent(UUID sessionID)
|
||||
{
|
||||
m_log.InfoFormat("[SIMIAN PRESENCE CONNECTOR]: Logout requested for agent with sessionID " + sessionID);
|
||||
|
||||
|
@ -189,7 +191,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
return success;
|
||||
}
|
||||
|
||||
public bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt)
|
||||
public bool ReportAgent(UUID sessionID, UUID regionID)
|
||||
{
|
||||
return ReportAgent(sessionID, regionID, Vector3.Zero, Vector3.Zero);
|
||||
}
|
||||
|
||||
protected bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt)
|
||||
{
|
||||
//m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Updating session data for agent with sessionID " + sessionID);
|
||||
|
||||
|
@ -261,7 +268,23 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
return presences.ToArray();
|
||||
}
|
||||
|
||||
public bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt)
|
||||
#endregion IPresenceService
|
||||
|
||||
#region IGridUserService
|
||||
|
||||
public GridUserInfo LoggedIn(string userID)
|
||||
{
|
||||
// never implemented at the sim
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool LoggedOut(string userID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt)
|
||||
{
|
||||
// Not needed for simian grid, event handler is doing it
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool SetHome(string userID, UUID regionID, Vector3 position, Vector3 lookAt)
|
||||
{
|
||||
m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Setting home location for user " + userID);
|
||||
|
||||
|
@ -281,7 +304,35 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
return success;
|
||||
}
|
||||
|
||||
#endregion IPresenceService
|
||||
public bool SetLastPosition(string userID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt)
|
||||
{
|
||||
// Not needed for simian grid, presence detection is doing it
|
||||
return true;
|
||||
}
|
||||
|
||||
public GridUserInfo GetGridUserInfo(string user)
|
||||
{
|
||||
m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for agent " + user);
|
||||
|
||||
UUID userID = new UUID(user);
|
||||
m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting user data for " + userID);
|
||||
|
||||
NameValueCollection requestArgs = new NameValueCollection
|
||||
{
|
||||
{ "RequestMethod", "GetUser" },
|
||||
{ "UserID", userID.ToString() }
|
||||
};
|
||||
|
||||
OSDMap userResponse = WebUtil.PostToService(m_serverUrl, requestArgs);
|
||||
if (userResponse["Success"].AsBoolean())
|
||||
return ResponseToGridUserInfo(userResponse);
|
||||
else
|
||||
m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve user data for " + userID + ": " + userResponse["Message"].AsString());
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Presence Detection
|
||||
|
||||
|
@ -325,7 +376,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
SetLastLocation(client.SessionId);
|
||||
}
|
||||
|
||||
LogoutAgent(client.SessionId, Vector3.Zero, Vector3.UnitX);
|
||||
LogoutAgent(client.SessionId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -478,6 +529,31 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
return info;
|
||||
}
|
||||
|
||||
private GridUserInfo ResponseToGridUserInfo(OSDMap userResponse)
|
||||
{
|
||||
if (userResponse != null && userResponse["User"] is OSDMap)
|
||||
{
|
||||
|
||||
GridUserInfo info = new GridUserInfo();
|
||||
|
||||
info.Online = true;
|
||||
info.UserID = userResponse["UserID"].AsUUID().ToString();
|
||||
info.LastRegionID = userResponse["SceneID"].AsUUID();
|
||||
info.LastPosition = userResponse["ScenePosition"].AsVector3();
|
||||
info.LastLookAt = userResponse["SceneLookAt"].AsVector3();
|
||||
|
||||
OSDMap user = (OSDMap)userResponse["User"];
|
||||
|
||||
info.Login = user["LastLoginDate"].AsDate();
|
||||
info.Logout = user["LastLogoutDate"].AsDate();
|
||||
DeserializeLocation(user["HomeLocation"].AsString(), out info.HomeRegionID, out info.HomePosition, out info.HomeLookAt);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private string SerializeLocation(UUID regionID, Vector3 position, Vector3 lookAt)
|
||||
{
|
||||
return "{" + String.Format("\"SceneID\":\"{0}\",\"Position\":\"{1}\",\"LookAt\":\"{2}\"", regionID, position, lookAt) + "}";
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace OpenSim.Services.HypergridService
|
|||
|
||||
static bool m_Initialized = false;
|
||||
|
||||
protected static IPresenceService m_PresenceService;
|
||||
protected static IGridUserService m_GridUserService;
|
||||
protected static IGridService m_GridService;
|
||||
protected static GatekeeperServiceConnector m_GatekeeperConnector;
|
||||
|
||||
|
@ -74,14 +74,14 @@ namespace OpenSim.Services.HypergridService
|
|||
throw new Exception(String.Format("No section UserAgentService in config file"));
|
||||
|
||||
string gridService = serverConfig.GetString("GridService", String.Empty);
|
||||
string presenceService = serverConfig.GetString("PresenceService", String.Empty);
|
||||
string gridUserService = serverConfig.GetString("GridUserService", String.Empty);
|
||||
|
||||
if (gridService == string.Empty || presenceService == string.Empty)
|
||||
if (gridService == string.Empty || gridUserService == string.Empty)
|
||||
throw new Exception(String.Format("Incomplete specifications, UserAgent Service cannot function."));
|
||||
|
||||
Object[] args = new Object[] { config };
|
||||
m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
|
||||
m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);
|
||||
m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args);
|
||||
m_GatekeeperConnector = new GatekeeperServiceConnector();
|
||||
|
||||
m_Initialized = true;
|
||||
|
@ -95,15 +95,14 @@ namespace OpenSim.Services.HypergridService
|
|||
m_log.DebugFormat("[USER AGENT SERVICE]: Request to get home region of user {0}", userID);
|
||||
|
||||
GridRegion home = null;
|
||||
PresenceInfo[] presences = m_PresenceService.GetAgents(new string[] { userID.ToString() });
|
||||
if (presences != null && presences.Length > 0)
|
||||
GridUserInfo uinfo = m_GridUserService.GetGridUserInfo(userID.ToString());
|
||||
if (uinfo != null)
|
||||
{
|
||||
UUID homeID = presences[0].HomeRegionID;
|
||||
if (homeID != UUID.Zero)
|
||||
if (uinfo.HomeRegionID != UUID.Zero)
|
||||
{
|
||||
home = m_GridService.GetRegionByUUID(UUID.Zero, homeID);
|
||||
position = presences[0].HomePosition;
|
||||
lookAt = presences[0].HomeLookAt;
|
||||
home = m_GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID);
|
||||
position = uinfo.HomePosition;
|
||||
lookAt = uinfo.HomeLookAt;
|
||||
}
|
||||
if (home == null)
|
||||
{
|
||||
|
|
|
@ -37,39 +37,79 @@ namespace OpenSim.Services.Interfaces
|
|||
public class GridUserInfo
|
||||
{
|
||||
public string UserID;
|
||||
|
||||
public UUID HomeRegionID;
|
||||
public Vector3 HomePosition;
|
||||
public Vector3 HomeLookAt;
|
||||
|
||||
public UUID LastRegionID;
|
||||
public Vector3 LastPosition;
|
||||
public Vector3 LastLookAt;
|
||||
|
||||
public bool Online;
|
||||
public DateTime Login;
|
||||
public DateTime Logout;
|
||||
|
||||
public GridUserInfo() {}
|
||||
|
||||
public GridUserInfo(Dictionary<string, object> kvp)
|
||||
{
|
||||
if (kvp.ContainsKey("UserID"))
|
||||
UserID = kvp["UserID"].ToString();
|
||||
|
||||
if (kvp.ContainsKey("HomeRegionID"))
|
||||
UUID.TryParse(kvp["HomeRegionID"].ToString(), out HomeRegionID);
|
||||
if (kvp.ContainsKey("HomePosition"))
|
||||
Vector3.TryParse(kvp["HomePosition"].ToString(), out HomePosition);
|
||||
if (kvp.ContainsKey("HomeLookAt"))
|
||||
Vector3.TryParse(kvp["HomeLookAt"].ToString(), out HomeLookAt);
|
||||
|
||||
if (kvp.ContainsKey("LastRegionID"))
|
||||
UUID.TryParse(kvp["LastRegionID"].ToString(), out HomeRegionID);
|
||||
if (kvp.ContainsKey("LastPosition"))
|
||||
Vector3.TryParse(kvp["LastPosition"].ToString(), out LastPosition);
|
||||
if (kvp.ContainsKey("LastLookAt"))
|
||||
Vector3.TryParse(kvp["LastLookAt"].ToString(), out LastLookAt);
|
||||
|
||||
if (kvp.ContainsKey("Login"))
|
||||
DateTime.TryParse(kvp["Login"].ToString(), out Login);
|
||||
if (kvp.ContainsKey("Logout"))
|
||||
DateTime.TryParse(kvp["Logout"].ToString(), out Logout);
|
||||
if (kvp.ContainsKey("Online"))
|
||||
Boolean.TryParse(kvp["Online"].ToString(), out Online);
|
||||
|
||||
}
|
||||
|
||||
public Dictionary<string, object> ToKeyValuePairs()
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
result["UserID"] = UserID;
|
||||
|
||||
result["HomeRegionID"] = HomeRegionID.ToString();
|
||||
result["HomePosition"] = HomePosition.ToString();
|
||||
result["HomeLookAt"] = HomeLookAt.ToString();
|
||||
|
||||
result["LastRegionID"] = LastRegionID.ToString();
|
||||
result["LastPosition"] = LastPosition.ToString();
|
||||
result["LastLookAt"] = LastLookAt.ToString();
|
||||
|
||||
result["Online"] = Online.ToString();
|
||||
result["Login"] = Login.ToString();
|
||||
result["Logout"] = Logout.ToString();
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public interface IGridUserService
|
||||
{
|
||||
GridUserInfo LoggedIn(string userID);
|
||||
bool LoggedOut(string userID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt);
|
||||
|
||||
bool SetHome(string userID, UUID homeID, Vector3 homePosition, Vector3 homeLookAt);
|
||||
bool SetLastPosition(string userID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt);
|
||||
|
||||
GridUserInfo GetGridUserInfo(string userID);
|
||||
bool StoreGridUserInfo(GridUserInfo info);
|
||||
}
|
||||
}
|
|
@ -55,23 +55,10 @@ namespace OpenSim.Services.Interfaces
|
|||
UserID = kvp["UserID"].ToString();
|
||||
if (kvp.ContainsKey("RegionID"))
|
||||
UUID.TryParse(kvp["RegionID"].ToString(), out RegionID);
|
||||
if (kvp.ContainsKey("login"))
|
||||
DateTime.TryParse(kvp["login"].ToString(), out Login);
|
||||
if (kvp.ContainsKey("logout"))
|
||||
DateTime.TryParse(kvp["logout"].ToString(), out Logout);
|
||||
if (kvp.ContainsKey("lookAt"))
|
||||
Vector3.TryParse(kvp["lookAt"].ToString(), out LookAt);
|
||||
if (kvp.ContainsKey("online"))
|
||||
Boolean.TryParse(kvp["online"].ToString(), out Online);
|
||||
if (kvp.ContainsKey("position"))
|
||||
Vector3.TryParse(kvp["position"].ToString(), out Position);
|
||||
if (kvp.ContainsKey("HomeRegionID"))
|
||||
UUID.TryParse(kvp["HomeRegionID"].ToString(), out HomeRegionID);
|
||||
if (kvp.ContainsKey("HomePosition"))
|
||||
Vector3.TryParse(kvp["HomePosition"].ToString(), out HomePosition);
|
||||
if (kvp.ContainsKey("HomeLookAt"))
|
||||
Vector3.TryParse(kvp["HomeLookAt"].ToString(), out HomeLookAt);
|
||||
|
||||
}
|
||||
|
||||
public Dictionary<string, object> ToKeyValuePairs()
|
||||
|
@ -79,14 +66,8 @@ namespace OpenSim.Services.Interfaces
|
|||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
result["UserID"] = UserID;
|
||||
result["RegionID"] = RegionID.ToString();
|
||||
result["online"] = Online.ToString();
|
||||
result["login"] = Login.ToString();
|
||||
result["logout"] = Logout.ToString();
|
||||
result["position"] = Position.ToString();
|
||||
result["lookAt"] = LookAt.ToString();
|
||||
result["HomeRegionID"] = HomeRegionID.ToString();
|
||||
result["HomePosition"] = HomePosition.ToString();
|
||||
result["HomeLookAt"] = HomeLookAt.ToString();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -115,11 +96,10 @@ namespace OpenSim.Services.Interfaces
|
|||
public interface IPresenceService
|
||||
{
|
||||
bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID);
|
||||
bool LogoutAgent(UUID sessionID, Vector3 position, Vector3 lookAt);
|
||||
bool LogoutAgent(UUID sessionID);
|
||||
bool LogoutRegionAgents(UUID regionID);
|
||||
|
||||
bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt);
|
||||
bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt);
|
||||
bool ReportAgent(UUID sessionID, UUID regionID);
|
||||
|
||||
PresenceInfo GetAgent(UUID sessionID);
|
||||
PresenceInfo[] GetAgents(string[] userIDs);
|
||||
|
|
|
@ -215,7 +215,7 @@ namespace OpenSim.Services.LLLoginService
|
|||
SetDefaultValues();
|
||||
}
|
||||
|
||||
public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, PresenceInfo pinfo,
|
||||
public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo,
|
||||
GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService,
|
||||
string where, string startlocation, Vector3 position, Vector3 lookAt, string message,
|
||||
GridRegion home, IPEndPoint clientIP)
|
||||
|
@ -283,7 +283,7 @@ namespace OpenSim.Services.LLLoginService
|
|||
}
|
||||
}
|
||||
|
||||
private void FillOutHomeData(PresenceInfo pinfo, GridRegion home)
|
||||
private void FillOutHomeData(GridUserInfo pinfo, GridRegion home)
|
||||
{
|
||||
int x = 1000 * (int)Constants.RegionSize, y = 1000 * (int)Constants.RegionSize;
|
||||
if (home != null)
|
||||
|
|
|
@ -53,6 +53,7 @@ namespace OpenSim.Services.LLLoginService
|
|||
private static bool Initialized = false;
|
||||
|
||||
protected IUserAccountService m_UserAccountService;
|
||||
protected IGridUserService m_GridUserService;
|
||||
protected IAuthenticationService m_AuthenticationService;
|
||||
protected IInventoryService m_InventoryService;
|
||||
protected IGridService m_GridService;
|
||||
|
@ -82,6 +83,7 @@ namespace OpenSim.Services.LLLoginService
|
|||
throw new Exception(String.Format("No section LoginService in config file"));
|
||||
|
||||
string accountService = m_LoginServerConfig.GetString("UserAccountService", String.Empty);
|
||||
string gridUserService = m_LoginServerConfig.GetString("GridUserService", String.Empty);
|
||||
string agentService = m_LoginServerConfig.GetString("UserAgentService", String.Empty);
|
||||
string authService = m_LoginServerConfig.GetString("AuthenticationService", String.Empty);
|
||||
string invService = m_LoginServerConfig.GetString("InventoryService", String.Empty);
|
||||
|
@ -105,8 +107,10 @@ namespace OpenSim.Services.LLLoginService
|
|||
|
||||
Object[] args = new Object[] { config };
|
||||
m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
|
||||
m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args);
|
||||
m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args);
|
||||
m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args);
|
||||
|
||||
if (gridService != string.Empty)
|
||||
m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
|
||||
if (presenceService != string.Empty)
|
||||
|
@ -271,8 +275,6 @@ namespace OpenSim.Services.LLLoginService
|
|||
//
|
||||
// Login the presence
|
||||
//
|
||||
PresenceInfo presence = null;
|
||||
GridRegion home = null;
|
||||
if (m_PresenceService != null)
|
||||
{
|
||||
success = m_PresenceService.LoginAgent(account.PrincipalID.ToString(), session, secureSession);
|
||||
|
@ -281,15 +283,22 @@ namespace OpenSim.Services.LLLoginService
|
|||
m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: could not login presence");
|
||||
return LLFailedLoginResponse.GridProblem;
|
||||
}
|
||||
|
||||
// Get the updated presence info
|
||||
presence = m_PresenceService.GetAgent(session);
|
||||
|
||||
// Get the home region
|
||||
if ((presence.HomeRegionID != UUID.Zero) && m_GridService != null)
|
||||
{
|
||||
home = m_GridService.GetRegionByUUID(scopeID, presence.HomeRegionID);
|
||||
}
|
||||
|
||||
//
|
||||
// Change Online status and get the home region
|
||||
//
|
||||
GridRegion home = null;
|
||||
GridUserInfo guinfo = m_GridUserService.LoggedIn(account.PrincipalID.ToString());
|
||||
if (guinfo != null && (guinfo.HomeRegionID != UUID.Zero) && m_GridService != null)
|
||||
{
|
||||
home = m_GridService.GetRegionByUUID(scopeID, guinfo.HomeRegionID);
|
||||
}
|
||||
if (guinfo == null)
|
||||
{
|
||||
// something went wrong, make something up, so that we don't have to test this anywhere else
|
||||
guinfo = new GridUserInfo();
|
||||
guinfo.LastPosition = guinfo.HomePosition = new Vector3(128, 128, 30);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -299,10 +308,10 @@ namespace OpenSim.Services.LLLoginService
|
|||
Vector3 position = Vector3.Zero;
|
||||
Vector3 lookAt = Vector3.Zero;
|
||||
GridRegion gatekeeper = null;
|
||||
GridRegion destination = FindDestination(account, scopeID, presence, session, startLocation, out gatekeeper, out where, out position, out lookAt);
|
||||
GridRegion destination = FindDestination(account, scopeID, guinfo, session, startLocation, home, out gatekeeper, out where, out position, out lookAt);
|
||||
if (destination == null)
|
||||
{
|
||||
m_PresenceService.LogoutAgent(session, presence.Position, presence.LookAt);
|
||||
m_PresenceService.LogoutAgent(session);
|
||||
m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: destination not found");
|
||||
return LLFailedLoginResponse.GridProblem;
|
||||
}
|
||||
|
@ -324,7 +333,7 @@ namespace OpenSim.Services.LLLoginService
|
|||
|
||||
if (aCircuit == null)
|
||||
{
|
||||
m_PresenceService.LogoutAgent(session, presence.Position, presence.LookAt);
|
||||
m_PresenceService.LogoutAgent(session);
|
||||
m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: {0}", reason);
|
||||
return LLFailedLoginResponse.AuthorizationProblem;
|
||||
|
||||
|
@ -340,7 +349,7 @@ namespace OpenSim.Services.LLLoginService
|
|||
//
|
||||
// Finally, fill out the response and return it
|
||||
//
|
||||
LLLoginResponse response = new LLLoginResponse(account, aCircuit, presence, destination, inventorySkel, friendsList, m_LibraryService,
|
||||
LLLoginResponse response = new LLLoginResponse(account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService,
|
||||
where, startLocation, position, lookAt, m_WelcomeMessage, home, clientIP);
|
||||
|
||||
m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client.");
|
||||
|
@ -350,12 +359,12 @@ namespace OpenSim.Services.LLLoginService
|
|||
{
|
||||
m_log.WarnFormat("[LLOGIN SERVICE]: Exception processing login for {0} {1}: {2} {3}", firstName, lastName, e.ToString(), e.StackTrace);
|
||||
if (m_PresenceService != null)
|
||||
m_PresenceService.LogoutAgent(session, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
|
||||
m_PresenceService.LogoutAgent(session);
|
||||
return LLFailedLoginResponse.InternalError;
|
||||
}
|
||||
}
|
||||
|
||||
protected GridRegion FindDestination(UserAccount account, UUID scopeID, PresenceInfo pinfo, UUID sessionID, string startLocation, out GridRegion gatekeeper, out string where, out Vector3 position, out Vector3 lookAt)
|
||||
protected GridRegion FindDestination(UserAccount account, UUID scopeID, GridUserInfo pinfo, UUID sessionID, string startLocation, GridRegion home, out GridRegion gatekeeper, out string where, out Vector3 position, out Vector3 lookAt)
|
||||
{
|
||||
m_log.DebugFormat("[LLOGIN SERVICE]: FindDestination for start location {0}", startLocation);
|
||||
|
||||
|
@ -377,7 +386,7 @@ namespace OpenSim.Services.LLLoginService
|
|||
|
||||
bool tryDefaults = false;
|
||||
|
||||
if (pinfo.HomeRegionID.Equals(UUID.Zero))
|
||||
if (home == null)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[LLOGIN SERVICE]: User {0} {1} tried to login to a 'home' start location but they have none set",
|
||||
|
@ -387,16 +396,10 @@ namespace OpenSim.Services.LLLoginService
|
|||
}
|
||||
else
|
||||
{
|
||||
region = m_GridService.GetRegionByUUID(scopeID, pinfo.HomeRegionID);
|
||||
region = home;
|
||||
|
||||
if (null == region)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[LLOGIN SERVICE]: User {0} {1} has a recorded home region of {2} but this cannot be found by the grid service",
|
||||
account.FirstName, account.LastName, pinfo.HomeRegionID);
|
||||
|
||||
tryDefaults = true;
|
||||
}
|
||||
position = pinfo.HomePosition;
|
||||
lookAt = pinfo.HomeLookAt;
|
||||
}
|
||||
|
||||
if (tryDefaults)
|
||||
|
@ -432,7 +435,7 @@ namespace OpenSim.Services.LLLoginService
|
|||
|
||||
GridRegion region = null;
|
||||
|
||||
if (pinfo.RegionID.Equals(UUID.Zero) || (region = m_GridService.GetRegionByUUID(scopeID, pinfo.RegionID)) == null)
|
||||
if (pinfo.LastRegionID.Equals(UUID.Zero) || (region = m_GridService.GetRegionByUUID(scopeID, pinfo.LastRegionID)) == null)
|
||||
{
|
||||
List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID);
|
||||
if (defaults != null && defaults.Count > 0)
|
||||
|
@ -454,8 +457,8 @@ namespace OpenSim.Services.LLLoginService
|
|||
}
|
||||
else
|
||||
{
|
||||
position = pinfo.Position;
|
||||
lookAt = pinfo.LookAt;
|
||||
position = pinfo.LastPosition;
|
||||
lookAt = pinfo.LastLookAt;
|
||||
}
|
||||
|
||||
return region;
|
||||
|
|
|
@ -54,8 +54,6 @@ namespace OpenSim.Services.PresenceService
|
|||
public bool LoginAgent(string userID, UUID sessionID,
|
||||
UUID secureSessionID)
|
||||
{
|
||||
m_Database.Prune(userID);
|
||||
|
||||
PresenceData[] d = m_Database.Get("UserID", userID);
|
||||
|
||||
PresenceData data = new PresenceData();
|
||||
|
@ -65,24 +63,6 @@ namespace OpenSim.Services.PresenceService
|
|||
data.SessionID = sessionID;
|
||||
data.Data = new Dictionary<string, string>();
|
||||
data.Data["SecureSessionID"] = secureSessionID.ToString();
|
||||
data.Data["Online"] = "true";
|
||||
data.Data["Login"] = Util.UnixTimeSinceEpoch().ToString();
|
||||
if (d != null && d.Length > 0)
|
||||
{
|
||||
data.Data["HomeRegionID"] = d[0].Data["HomeRegionID"];
|
||||
data.Data["HomePosition"] = d[0].Data["HomePosition"];
|
||||
data.Data["HomeLookAt"] = d[0].Data["HomeLookAt"];
|
||||
data.Data["Position"] = d[0].Data["Position"];
|
||||
data.Data["LookAt"] = d[0].Data["LookAt"];
|
||||
|
||||
data.RegionID = d[0].RegionID;
|
||||
}
|
||||
else
|
||||
{
|
||||
data.Data["HomeRegionID"] = UUID.Zero.ToString();
|
||||
data.Data["HomePosition"] = new Vector3(128, 128, 0).ToString();
|
||||
data.Data["HomeLookAt"] = new Vector3(0, 1, 0).ToString();
|
||||
}
|
||||
|
||||
m_Database.Store(data);
|
||||
|
||||
|
@ -91,28 +71,10 @@ namespace OpenSim.Services.PresenceService
|
|||
return true;
|
||||
}
|
||||
|
||||
public bool LogoutAgent(UUID sessionID, Vector3 position, Vector3 lookat)
|
||||
public bool LogoutAgent(UUID sessionID)
|
||||
{
|
||||
PresenceData data = m_Database.Get(sessionID);
|
||||
if (data == null)
|
||||
return false;
|
||||
|
||||
PresenceData[] d = m_Database.Get("UserID", data.UserID);
|
||||
|
||||
m_log.DebugFormat("[PRESENCE SERVICE]: LogoutAgent {0} with {1} sessions currently present", data.UserID, d.Length);
|
||||
if (d.Length > 1)
|
||||
{
|
||||
m_Database.Delete("UserID", data.UserID);
|
||||
}
|
||||
|
||||
data.Data["Online"] = "false";
|
||||
data.Data["Logout"] = Util.UnixTimeSinceEpoch().ToString();
|
||||
data.Data["Position"] = position.ToString();
|
||||
data.Data["LookAt"] = lookat.ToString();
|
||||
|
||||
m_Database.Store(data);
|
||||
|
||||
return true;
|
||||
m_log.DebugFormat("[PRESENCE SERVICE]: Session {0} logout", sessionID);
|
||||
return m_Database.Delete("SessionID", sessionID.ToString());
|
||||
}
|
||||
|
||||
public bool LogoutRegionAgents(UUID regionID)
|
||||
|
@ -123,7 +85,7 @@ namespace OpenSim.Services.PresenceService
|
|||
}
|
||||
|
||||
|
||||
public bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt)
|
||||
public bool ReportAgent(UUID sessionID, UUID regionID)
|
||||
{
|
||||
m_log.DebugFormat("[PRESENCE SERVICE]: ReportAgent with session {0} in region {1}", sessionID, regionID);
|
||||
try
|
||||
|
@ -134,14 +96,7 @@ namespace OpenSim.Services.PresenceService
|
|||
if (pdata.Data == null)
|
||||
return false;
|
||||
|
||||
if (!pdata.Data.ContainsKey("Online") || (pdata.Data.ContainsKey("Online") && pdata.Data["Online"] == "false"))
|
||||
{
|
||||
m_log.WarnFormat("[PRESENCE SERVICE]: Someone tried to report presence of an agent who's not online");
|
||||
return false;
|
||||
}
|
||||
|
||||
return m_Database.ReportAgent(sessionID, regionID,
|
||||
position.ToString(), lookAt.ToString());
|
||||
return m_Database.ReportAgent(sessionID, regionID);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -160,22 +115,10 @@ namespace OpenSim.Services.PresenceService
|
|||
|
||||
ret.UserID = data.UserID;
|
||||
ret.RegionID = data.RegionID;
|
||||
if (data.Data.ContainsKey("Online"))
|
||||
ret.Online = bool.Parse(data.Data["Online"]);
|
||||
if (data.Data.ContainsKey("Login"))
|
||||
ret.Login = Util.ToDateTime(Convert.ToInt32(data.Data["Login"]));
|
||||
if (data.Data.ContainsKey("Logout"))
|
||||
ret.Logout = Util.ToDateTime(Convert.ToInt32(data.Data["Logout"]));
|
||||
if (data.Data.ContainsKey("Position"))
|
||||
ret.Position = Vector3.Parse(data.Data["Position"]);
|
||||
if (data.Data.ContainsKey("LookAt"))
|
||||
ret.LookAt = Vector3.Parse(data.Data["LookAt"]);
|
||||
if (data.Data.ContainsKey("HomeRegionID"))
|
||||
ret.HomeRegionID = new UUID(data.Data["HomeRegionID"]);
|
||||
if (data.Data.ContainsKey("HomePosition"))
|
||||
ret.HomePosition = Vector3.Parse(data.Data["HomePosition"]);
|
||||
if (data.Data.ContainsKey("HomeLookAt"))
|
||||
ret.HomeLookAt = Vector3.Parse(data.Data["HomeLookAt"]);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -195,16 +138,8 @@ namespace OpenSim.Services.PresenceService
|
|||
|
||||
ret.UserID = d.UserID;
|
||||
ret.RegionID = d.RegionID;
|
||||
ret.Online = bool.Parse(d.Data["Online"]);
|
||||
ret.Login = Util.ToDateTime(Convert.ToInt32(
|
||||
d.Data["Login"]));
|
||||
ret.Logout = Util.ToDateTime(Convert.ToInt32(
|
||||
d.Data["Logout"]));
|
||||
ret.Position = Vector3.Parse(d.Data["Position"]);
|
||||
ret.LookAt = Vector3.Parse(d.Data["LookAt"]);
|
||||
ret.HomeRegionID = new UUID(d.Data["HomeRegionID"]);
|
||||
ret.HomePosition = Vector3.Parse(d.Data["HomePosition"]);
|
||||
ret.HomeLookAt = Vector3.Parse(d.Data["HomeLookAt"]);
|
||||
|
||||
info.Add(ret);
|
||||
}
|
||||
|
@ -214,9 +149,5 @@ namespace OpenSim.Services.PresenceService
|
|||
return info.ToArray();
|
||||
}
|
||||
|
||||
public bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt)
|
||||
{
|
||||
return m_Database.SetHomeLocation(userID, regionID, position, lookAt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ using System.Reflection;
|
|||
using Nini.Config;
|
||||
using OpenSim.Data;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
|
@ -50,7 +51,10 @@ namespace OpenSim.Services.UserAccountService
|
|||
|
||||
public GridUserInfo GetGridUserInfo(string userID)
|
||||
{
|
||||
GridUserData d = m_Database.GetGridUserData(userID);
|
||||
GridUserData d = m_Database.Get(userID);
|
||||
|
||||
if (d == null)
|
||||
return null;
|
||||
|
||||
GridUserInfo info = new GridUserInfo();
|
||||
info.UserID = d.UserID;
|
||||
|
@ -58,19 +62,98 @@ namespace OpenSim.Services.UserAccountService
|
|||
info.HomePosition = Vector3.Parse(d.Data["HomePosition"]);
|
||||
info.HomeLookAt = Vector3.Parse(d.Data["HomeLookAt"]);
|
||||
|
||||
info.LastRegionID = new UUID(d.Data["LastRegionID"]);
|
||||
info.LastPosition = Vector3.Parse(d.Data["LastPosition"]);
|
||||
info.LastLookAt = Vector3.Parse(d.Data["LastLookAt"]);
|
||||
|
||||
info.Online = bool.Parse(d.Data["Online"]);
|
||||
info.Login = Util.ToDateTime(Convert.ToInt32(d.Data["Login"]));
|
||||
info.Logout = Util.ToDateTime(Convert.ToInt32(d.Data["Logout"]));
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
public bool StoreGridUserInfo(GridUserInfo info)
|
||||
public GridUserInfo LoggedIn(string userID)
|
||||
{
|
||||
m_log.DebugFormat("[GRID USER SERVICE]: User {0} is online", userID);
|
||||
GridUserData d = m_Database.Get(userID);
|
||||
|
||||
if (d == null)
|
||||
{
|
||||
d = new GridUserData();
|
||||
d.UserID = userID;
|
||||
}
|
||||
|
||||
d.Data["Online"] = true.ToString();
|
||||
d.Data["Login"] = Util.UnixTimeSinceEpoch().ToString();
|
||||
|
||||
m_Database.Store(d);
|
||||
|
||||
return GetGridUserInfo(userID);
|
||||
}
|
||||
|
||||
public bool LoggedOut(string userID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt)
|
||||
{
|
||||
m_log.DebugFormat("[GRID USER SERVICE]: User {0} is offline", userID);
|
||||
GridUserData d = m_Database.Get(userID);
|
||||
|
||||
if (d == null)
|
||||
{
|
||||
d = new GridUserData();
|
||||
d.UserID = userID;
|
||||
}
|
||||
|
||||
d.Data["Online"] = false.ToString();
|
||||
d.Data["Logout"] = Util.UnixTimeSinceEpoch().ToString();
|
||||
d.Data["LastRegionID"] = regionID.ToString();
|
||||
d.Data["LastPosition"] = lastPosition.ToString();
|
||||
d.Data["LastLookAt"] = lastLookAt.ToString();
|
||||
|
||||
return m_Database.Store(d);
|
||||
}
|
||||
|
||||
protected bool StoreGridUserInfo(GridUserInfo info)
|
||||
{
|
||||
GridUserData d = new GridUserData();
|
||||
|
||||
d.Data["UserID"] = info.UserID;
|
||||
d.Data["HomeRegionID"] = info.HomeRegionID.ToString();
|
||||
d.Data["HomePosition"] = info.HomePosition.ToString();
|
||||
d.Data["HomeLookAt"] = info.HomeLookAt.ToString();
|
||||
|
||||
return m_Database.StoreGridUserData(d);
|
||||
return m_Database.Store(d);
|
||||
}
|
||||
|
||||
public bool SetHome(string userID, UUID homeID, Vector3 homePosition, Vector3 homeLookAt)
|
||||
{
|
||||
GridUserData d = m_Database.Get(userID);
|
||||
if (d == null)
|
||||
{
|
||||
d = new GridUserData();
|
||||
d.UserID = userID;
|
||||
}
|
||||
|
||||
d.Data["HomeRegionID"] = homeID.ToString();
|
||||
d.Data["HomePosition"] = homePosition.ToString();
|
||||
d.Data["HomeLookAt"] = homeLookAt.ToString();
|
||||
|
||||
return m_Database.Store(d);
|
||||
}
|
||||
|
||||
public bool SetLastPosition(string userID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt)
|
||||
{
|
||||
//m_log.DebugFormat("[Grid User Service]: SetLastPosition for {0}", userID);
|
||||
GridUserData d = m_Database.Get(userID);
|
||||
if (d == null)
|
||||
{
|
||||
d = new GridUserData();
|
||||
d.UserID = userID;
|
||||
}
|
||||
|
||||
d.Data["LastRegionID"] = regionID.ToString();
|
||||
d.Data["LastPosition"] = lastPosition.ToString();
|
||||
d.Data["LastLookAt"] = lastLookAt.ToString();
|
||||
|
||||
return m_Database.Store(d);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -46,7 +46,7 @@ namespace OpenSim.Services.UserAccountService
|
|||
|
||||
protected IGridService m_GridService;
|
||||
protected IAuthenticationService m_AuthenticationService;
|
||||
protected IPresenceService m_PresenceService;
|
||||
protected IGridUserService m_GridUserService;
|
||||
protected IInventoryService m_InventoryService;
|
||||
|
||||
public UserAccountService(IConfigSource config)
|
||||
|
@ -69,9 +69,9 @@ namespace OpenSim.Services.UserAccountService
|
|||
if (authServiceDll != string.Empty)
|
||||
m_AuthenticationService = LoadPlugin<IAuthenticationService>(authServiceDll, new Object[] { config });
|
||||
|
||||
string presenceServiceDll = userConfig.GetString("PresenceService", string.Empty);
|
||||
string presenceServiceDll = userConfig.GetString("GridUserService", string.Empty);
|
||||
if (presenceServiceDll != string.Empty)
|
||||
m_PresenceService = LoadPlugin<IPresenceService>(presenceServiceDll, new Object[] { config });
|
||||
m_GridUserService = LoadPlugin<IGridUserService>(presenceServiceDll, new Object[] { config });
|
||||
|
||||
string invServiceDll = userConfig.GetString("InventoryService", string.Empty);
|
||||
if (invServiceDll != string.Empty)
|
||||
|
@ -333,8 +333,8 @@ namespace OpenSim.Services.UserAccountService
|
|||
if (defaultRegions != null && defaultRegions.Count >= 1)
|
||||
home = defaultRegions[0];
|
||||
|
||||
if (m_PresenceService != null && home != null)
|
||||
m_PresenceService.SetHomeLocation(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
|
||||
if (m_GridUserService != null && home != null)
|
||||
m_GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
|
||||
else
|
||||
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set home for account {0} {1}.",
|
||||
firstName, lastName);
|
||||
|
|
|
@ -77,7 +77,7 @@ namespace OpenSim.Tests.Clients.PresenceClient
|
|||
pinfo.UserID, pinfo.Online, pinfo.RegionID, pinfo.HomeRegionID);
|
||||
|
||||
System.Console.WriteLine("\n");
|
||||
success = m_Connector.ReportAgent(session1, region1, new Vector3(128, 128, 128), new Vector3(4, 5, 6));
|
||||
success = m_Connector.ReportAgent(session1, region1);
|
||||
if (success)
|
||||
m_log.InfoFormat("[PRESENCE CLIENT]: Successfully reported session {0} in region {1}", user1, region1);
|
||||
else
|
||||
|
@ -90,20 +90,7 @@ namespace OpenSim.Tests.Clients.PresenceClient
|
|||
pinfo.UserID, pinfo.Online, pinfo.RegionID, pinfo.HomeRegionID);
|
||||
|
||||
System.Console.WriteLine("\n");
|
||||
success = m_Connector.SetHomeLocation(user1.ToString(), region1, new Vector3(128, 128, 128), new Vector3(4, 5, 6));
|
||||
if (success)
|
||||
m_log.InfoFormat("[PRESENCE CLIENT]: Successfully set home for user {0} in region {1}", user1, region1);
|
||||
else
|
||||
m_log.InfoFormat("[PRESENCE CLIENT]: failed to set home for user {0}", user1);
|
||||
pinfo = m_Connector.GetAgent(session1);
|
||||
if (pinfo == null)
|
||||
m_log.InfoFormat("[PRESENCE CLIENT]: Unable to retrieve presence for {0} for third time", user1);
|
||||
else
|
||||
m_log.InfoFormat("[PRESENCE CLIENT]: Presence retrieved correctly: userID={0}; Online={1}; regionID={2}; homeRegion={3}",
|
||||
pinfo.UserID, pinfo.Online, pinfo.RegionID, pinfo.HomeRegionID);
|
||||
|
||||
System.Console.WriteLine("\n");
|
||||
success = m_Connector.LogoutAgent(session1, Vector3.Zero, Vector3.UnitY);
|
||||
success = m_Connector.LogoutAgent(session1);
|
||||
if (success)
|
||||
m_log.InfoFormat("[PRESENCE CLIENT]: Successfully logged out user {0}", user1);
|
||||
else
|
||||
|
@ -116,7 +103,7 @@ namespace OpenSim.Tests.Clients.PresenceClient
|
|||
pinfo.UserID, pinfo.Online, pinfo.RegionID, pinfo.HomeRegionID);
|
||||
|
||||
System.Console.WriteLine("\n");
|
||||
success = m_Connector.ReportAgent(session1, UUID.Random(), Vector3.Zero, Vector3.Zero);
|
||||
success = m_Connector.ReportAgent(session1, UUID.Random());
|
||||
if (success)
|
||||
m_log.InfoFormat("[PRESENCE CLIENT]: Report agent succeeded, but this is wrong");
|
||||
else
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
;;
|
||||
|
||||
[Startup]
|
||||
ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryServiceInConnector,8002/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8003/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector,8002/OpenSim.Server.Handlers.dll:GatekeeperServiceInConnector,8002/OpenSim.Server.Handlers.dll:UserAgentServerConnector,HGInventoryService@8002/OpenSim.Server.Handlers.dll:XInventoryInConnector,8002/OpenSim.Server.Handlers.dll:AssetServiceConnector"
|
||||
ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryServiceInConnector,8002/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8003/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector,8002/OpenSim.Server.Handlers.dll:GatekeeperServiceInConnector,8002/OpenSim.Server.Handlers.dll:UserAgentServerConnector,HGInventoryService@8002/OpenSim.Server.Handlers.dll:XInventoryInConnector,8002/OpenSim.Server.Handlers.dll:AssetServiceConnector"
|
||||
|
||||
; * This is common for all services, it's the network setup for the entire
|
||||
; * server instance, if none if specified above
|
||||
|
@ -93,6 +93,10 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
|
|||
GridService = "OpenSim.Services.GridService.dll:GridService"
|
||||
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
|
||||
|
||||
[GridUserService]
|
||||
; for the server connector
|
||||
LocalServiceModule = "OpenSim.Services.UserAccountService.dll:GridUserService"
|
||||
|
||||
[PresenceService]
|
||||
; for the server connector
|
||||
LocalServiceModule = "OpenSim.Services.PresenceService.dll:PresenceService"
|
||||
|
@ -114,6 +118,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
|
|||
LocalServiceModule = "OpenSim.Services.LLLoginService.dll:LLLoginService"
|
||||
; for the service
|
||||
UserAccountService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
|
||||
GridUserService = "OpenSim.Services.UserAccountService.dll:GridUserService"
|
||||
AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
||||
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
|
||||
AvatarService = "OpenSim.Services.AvatarService.dll:AvatarService"
|
||||
|
@ -196,7 +201,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
|
|||
[UserAgentService]
|
||||
LocalServiceModule = "OpenSim.Services.HypergridService.dll:UserAgentService"
|
||||
;; for the service
|
||||
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
|
||||
GridUserService = "OpenSim.Services.UserAccountService.dll:GridUserService"
|
||||
GridService = "OpenSim.Services.GridService.dll:GridService"
|
||||
|
||||
;; The interface that local users get when they are in other grids.
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
; *
|
||||
[Startup]
|
||||
|
||||
ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8002/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector"
|
||||
ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8002/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector"
|
||||
|
||||
; * This is common for all services, it's the network setup for the entire
|
||||
; * server instance, if none if specified above
|
||||
|
@ -95,6 +95,10 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
|
|||
GridService = "OpenSim.Services.GridService.dll:GridService"
|
||||
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
|
||||
|
||||
[GridUserService]
|
||||
; for the server connector
|
||||
LocalServiceModule = "OpenSim.Services.UserAccountService.dll:GridUserService"
|
||||
|
||||
[PresenceService]
|
||||
; for the server connector
|
||||
LocalServiceModule = "OpenSim.Services.PresenceService.dll:PresenceService"
|
||||
|
@ -116,6 +120,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
|
|||
LocalServiceModule = "OpenSim.Services.LLLoginService.dll:LLLoginService"
|
||||
; for the service
|
||||
UserAccountService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
|
||||
GridUserService = "OpenSim.Services.UserAccountService.dll:GridUserService"
|
||||
AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
||||
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
|
||||
AvatarService = "OpenSim.Services.AvatarService.dll:AvatarService"
|
||||
|
|
|
@ -14,11 +14,14 @@
|
|||
AvatarServices = "RemoteAvatarServicesConnector"
|
||||
NeighbourServices = "RemoteNeighbourServicesConnector"
|
||||
AuthenticationServices = "RemoteAuthenticationServicesConnector"
|
||||
AuthorizationServices = "RemoteAuthorizationServicesConnector"
|
||||
PresenceServices = "RemotePresenceServicesConnector"
|
||||
UserAccountServices = "RemoteUserAccountServicesConnector"
|
||||
GridUserServices = "RemoteGridUserServicesConnector"
|
||||
SimulationServices = "RemoteSimulationConnectorModule"
|
||||
EntityTransferModule = "BasicEntityTransferModule"
|
||||
InventoryAccessModule = "BasicInventoryAccessModule"
|
||||
|
||||
LandServiceInConnector = true
|
||||
NeighbourServiceInConnector = true
|
||||
SimulationServiceInConnector = true
|
||||
|
|
|
@ -40,6 +40,12 @@
|
|||
;
|
||||
UserAccountServerURI = "http://mygridserver.com:8003"
|
||||
|
||||
[GridUserService]
|
||||
;
|
||||
; change this to your grid-wide user accounts server
|
||||
;
|
||||
GridUserServerURI = "http://mygridserver.com:8003"
|
||||
|
||||
[AuthenticationService]
|
||||
;
|
||||
; change this to your grid-wide authentication server
|
||||
|
|
|
@ -14,12 +14,14 @@
|
|||
AvatarServices = "RemoteAvatarServicesConnector"
|
||||
NeighbourServices = "RemoteNeighbourServicesConnector"
|
||||
AuthenticationServices = "RemoteAuthenticationServicesConnector"
|
||||
AuthorizationServices = "LocalAuthorizationServicesConnector"
|
||||
AuthorizationServices = "RemoteAuthorizationServicesConnector"
|
||||
PresenceServices = "RemotePresenceServicesConnector"
|
||||
UserAccountServices = "RemoteUserAccountServicesConnector"
|
||||
GridUserServices = "RemoteGridUserServicesConnector"
|
||||
SimulationServices = "RemoteSimulationConnectorModule"
|
||||
EntityTransferModule = "HGEntityTransferModule"
|
||||
InventoryAccessModule = "HGInventoryAccessModule"
|
||||
|
||||
LandServiceInConnector = true
|
||||
NeighbourServiceInConnector = true
|
||||
SimulationServiceInConnector = true
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
AvatarServices = "LocalAvatarServicesConnector"
|
||||
EntityTransferModule = "BasicEntityTransferModule"
|
||||
InventoryAccessModule = "BasicInventoryAccessModule"
|
||||
|
||||
LibraryModule = true
|
||||
LLLoginServiceInConnector = true
|
||||
|
||||
|
@ -54,7 +55,7 @@
|
|||
|
||||
;; These are for creating new accounts
|
||||
AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
||||
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
|
||||
GridUserService = "OpenSim.Services.UserAccountService.dll:GridUserService"
|
||||
GridService = "OpenSim.Services.GridService.dll:GridService"
|
||||
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
|
||||
|
||||
|
@ -70,6 +71,7 @@
|
|||
[LoginService]
|
||||
LocalServiceModule = "OpenSim.Services.LLLoginService.dll:LLLoginService"
|
||||
UserAccountService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
|
||||
GridUserService = "OpenSim.Services.UserAccountService.dll:GridUserService"
|
||||
AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
||||
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
|
||||
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
|
||||
|
|
|
@ -12,10 +12,12 @@
|
|||
GridServices = "LocalGridServicesConnector"
|
||||
PresenceServices = "LocalPresenceServicesConnector"
|
||||
UserAccountServices = "LocalUserAccountServicesConnector"
|
||||
GridUserServices = "LocalGridUserServicesConnector"
|
||||
SimulationServices = "RemoteSimulationConnectorModule"
|
||||
AvatarServices = "LocalAvatarServicesConnector"
|
||||
EntityTransferModule = "HGEntityTransferModule"
|
||||
InventoryAccessModule = "HGInventoryAccessModule"
|
||||
|
||||
InventoryServiceInConnector = true
|
||||
AssetServiceInConnector = true
|
||||
HypergridServiceInConnector = true
|
||||
|
@ -68,10 +70,10 @@
|
|||
|
||||
[UserAccountService]
|
||||
LocalServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService"
|
||||
ConnectionString = "URI=file:userprofiles.db,version=3"
|
||||
|
||||
;; These are for creating new accounts by the service
|
||||
AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
||||
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
|
||||
GridUserService = "OpenSim.Services.UserAccountService.dll:GridUserService"
|
||||
GridService = "OpenSim.Services.GridService.dll:GridService"
|
||||
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
|
||||
|
||||
|
@ -85,6 +87,7 @@
|
|||
[LoginService]
|
||||
LocalServiceModule = "OpenSim.Services.LLLoginService.dll:LLLoginService"
|
||||
UserAccountService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
|
||||
GridUserService = "OpenSim.Services.UserAccountService.dll:GridUserService"
|
||||
UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService"
|
||||
AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
||||
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
|
||||
|
@ -106,7 +109,7 @@
|
|||
[UserAgentService]
|
||||
LocalServiceModule = "OpenSim.Services.HypergridService.dll:UserAgentService"
|
||||
;; for the service
|
||||
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
|
||||
GridUserService = "OpenSim.Services.UserAccountService.dll:GridUserService"
|
||||
GridService = "OpenSim.Services.GridService.dll:GridService"
|
||||
|
||||
;; The interface that local users get when they are in other grids
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
[UserAccountService]
|
||||
ConnectionString = "URI=file:userprofiles.db,version=3"
|
||||
|
||||
[GridUserService]
|
||||
ConnectionString = "URI=file:griduser.db,version=3"
|
||||
|
||||
[FriendsService]
|
||||
ConnectionString = "URI=file:friends.db,version=3"
|
||||
|
||||
|
|
Loading…
Reference in New Issue