Merge branch 'master' into careminster-presence-refactor
commit
14fcc2510e
|
@ -1729,7 +1729,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
GridRegion home = m_app.SceneManager.CurrentOrFirstScene.GridService.GetRegionByPosition(scopeID,
|
GridRegion home = m_app.SceneManager.CurrentOrFirstScene.GridService.GetRegionByPosition(scopeID,
|
||||||
(int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize));
|
(int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize));
|
||||||
if (home != null)
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,6 +37,11 @@ namespace OpenSim.Data
|
||||||
{
|
{
|
||||||
public string UserID;
|
public string UserID;
|
||||||
public Dictionary<string, string> Data;
|
public Dictionary<string, string> Data;
|
||||||
|
|
||||||
|
public GridUserData()
|
||||||
|
{
|
||||||
|
Data = new Dictionary<string, string>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -44,7 +49,7 @@ namespace OpenSim.Data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IGridUserData
|
public interface IGridUserData
|
||||||
{
|
{
|
||||||
GridUserData GetGridUserData(string userID);
|
GridUserData Get(string userID);
|
||||||
bool StoreGridUserData(GridUserData data);
|
bool Store(GridUserData data);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -50,10 +50,8 @@ namespace OpenSim.Data
|
||||||
|
|
||||||
PresenceData Get(UUID sessionID);
|
PresenceData Get(UUID sessionID);
|
||||||
void LogoutRegionAgents(UUID regionID);
|
void LogoutRegionAgents(UUID regionID);
|
||||||
bool ReportAgent(UUID sessionID, UUID regionID, string position, string lookAt);
|
bool ReportAgent(UUID sessionID, UUID regionID);
|
||||||
bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt);
|
|
||||||
PresenceData[] Get(string field, string data);
|
PresenceData[] Get(string field, string data);
|
||||||
void Prune(string userID);
|
|
||||||
bool Delete(string field, string val);
|
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);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
public MSSQLGridUserData(string connectionString, string realm) :
|
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);
|
GridUserData[] ret = Get("UserID", userID);
|
||||||
|
|
||||||
|
@ -60,9 +60,5 @@ namespace OpenSim.Data.MSSQL
|
||||||
return ret[0];
|
return ret[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool StoreGridUserData(GridUserData data)
|
|
||||||
{
|
|
||||||
return Store(data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace OpenSim.Data.MSSQL
|
||||||
using (SqlCommand cmd = new SqlCommand())
|
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.Parameters.Add(m_database.CreateParameter("@RegionID", regionID.ToString()));
|
||||||
cmd.Connection = conn;
|
cmd.Connection = conn;
|
||||||
|
@ -76,8 +76,7 @@ namespace OpenSim.Data.MSSQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ReportAgent(UUID sessionID, UUID regionID, string position,
|
public bool ReportAgent(UUID sessionID, UUID regionID)
|
||||||
string lookAt)
|
|
||||||
{
|
{
|
||||||
PresenceData[] pd = Get("SessionID", sessionID.ToString());
|
PresenceData[] pd = Get("SessionID", sessionID.ToString());
|
||||||
if (pd.Length == 0)
|
if (pd.Length == 0)
|
||||||
|
@ -88,16 +87,11 @@ namespace OpenSim.Data.MSSQL
|
||||||
{
|
{
|
||||||
|
|
||||||
cmd.CommandText = String.Format(@"UPDATE {0} SET
|
cmd.CommandText = String.Format(@"UPDATE {0} SET
|
||||||
[RegionID] = @RegionID,
|
[RegionID] = @RegionID
|
||||||
[Position] = @Position,
|
|
||||||
[LookAt] = @LookAt,
|
|
||||||
[Online] = 'true'
|
|
||||||
WHERE [SessionID] = @SessionID", m_Realm);
|
WHERE [SessionID] = @SessionID", m_Realm);
|
||||||
|
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("@SessionID", sessionID.ToString()));
|
cmd.Parameters.Add(m_database.CreateParameter("@SessionID", sessionID.ToString()));
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("@RegionID", regionID.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;
|
cmd.Connection = conn;
|
||||||
conn.Open();
|
conn.Open();
|
||||||
if (cmd.ExecuteNonQuery() == 0)
|
if (cmd.ExecuteNonQuery() == 0)
|
||||||
|
@ -106,65 +100,5 @@ namespace OpenSim.Data.MSSQL
|
||||||
return true;
|
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);
|
// 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);
|
GridUserData[] ret = Get("UserID", userID);
|
||||||
|
|
||||||
|
@ -56,9 +56,6 @@ namespace OpenSim.Data.MySQL
|
||||||
return ret[0];
|
return ret[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool StoreGridUserData(GridUserData data)
|
|
||||||
{
|
|
||||||
return Store(data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -65,15 +65,14 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
MySqlCommand cmd = new MySqlCommand();
|
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());
|
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
||||||
|
|
||||||
ExecuteNonQuery(cmd);
|
ExecuteNonQuery(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ReportAgent(UUID sessionID, UUID regionID, string position,
|
public bool ReportAgent(UUID sessionID, UUID regionID)
|
||||||
string lookAt)
|
|
||||||
{
|
{
|
||||||
PresenceData[] pd = Get("SessionID", sessionID.ToString());
|
PresenceData[] pd = Get("SessionID", sessionID.ToString());
|
||||||
if (pd.Length == 0)
|
if (pd.Length == 0)
|
||||||
|
@ -81,12 +80,10 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
MySqlCommand cmd = new MySqlCommand();
|
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("?SessionID", sessionID.ToString());
|
||||||
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
||||||
cmd.Parameters.AddWithValue("?Position", position.ToString());
|
|
||||||
cmd.Parameters.AddWithValue("?LookAt", lookAt.ToString());
|
|
||||||
|
|
||||||
if (ExecuteNonQuery(cmd) == 0)
|
if (ExecuteNonQuery(cmd) == 0)
|
||||||
return false;
|
return false;
|
||||||
|
@ -94,62 +91,5 @@ namespace OpenSim.Data.MySQL
|
||||||
return true;
|
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());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
BEGIN;
|
||||||
|
|
||||||
|
CREATE TABLE `GridUser` (
|
||||||
|
`UserID` VARCHAR(255) NOT NULL,
|
||||||
|
`HomeRegionID` CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
|
||||||
|
`HomePosition` CHAR(64) NOT NULL DEFAULT '<0,0,0>',
|
||||||
|
`HomeLookAt` CHAR(64) NOT NULL DEFAULT '<0,0,0>',
|
||||||
|
`LastRegionID` CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
|
||||||
|
`LastPosition` CHAR(64) NOT NULL DEFAULT '<0,0,0>',
|
||||||
|
`LastLookAt` CHAR(64) NOT NULL DEFAULT '<0,0,0>',
|
||||||
|
`Online` CHAR(5) NOT NULL DEFAULT 'false',
|
||||||
|
`Login` CHAR(16) NOT NULL DEFAULT '0',
|
||||||
|
`Logout` CHAR(16) NOT NULL DEFAULT '0',
|
||||||
|
PRIMARY KEY (`UserID`)
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
COMMIT;
|
|
@ -4,12 +4,10 @@ CREATE TABLE `Presence` (
|
||||||
`UserID` VARCHAR(255) NOT NULL,
|
`UserID` VARCHAR(255) NOT NULL,
|
||||||
`RegionID` CHAR(36) NOT NULL,
|
`RegionID` CHAR(36) NOT NULL,
|
||||||
`SessionID` CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
|
`SessionID` CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
|
||||||
`SecureSessionID` 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>'
|
|
||||||
) ENGINE=InnoDB;
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX SessionID ON Presence(SessionID);
|
||||||
|
CREATE INDEX UserID ON Presence(UserID);
|
||||||
|
|
||||||
COMMIT;
|
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);
|
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)
|
if (Instance != this)
|
||||||
return Instance.ReportAgent(sessionID, regionID, position, lookAt);
|
return Instance.ReportAgent(sessionID, regionID);
|
||||||
|
|
||||||
if (m_presenceData.ContainsKey(sessionID))
|
if (m_presenceData.ContainsKey(sessionID))
|
||||||
{
|
{
|
||||||
m_presenceData[sessionID].RegionID = regionID;
|
m_presenceData[sessionID].RegionID = regionID;
|
||||||
m_presenceData[sessionID].Data["Position"] = position;
|
|
||||||
m_presenceData[sessionID].Data["LookAt"] = lookAt;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
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)
|
public PresenceData[] Get(string field, string data)
|
||||||
{
|
{
|
||||||
|
@ -193,39 +168,6 @@ namespace OpenSim.Data.Null
|
||||||
return presences.ToArray();
|
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)
|
public bool Delete(string field, string data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
|
CREATE TABLE GridUser (
|
||||||
|
UserID VARCHAR(255) primary key,
|
||||||
|
HomeRegionID CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
|
||||||
|
HomePosition CHAR(64) NOT NULL DEFAULT '<0,0,0>',
|
||||||
|
HomeLookAt CHAR(64) NOT NULL DEFAULT '<0,0,0>',
|
||||||
|
LastRegionID CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
|
||||||
|
LastPosition CHAR(64) NOT NULL DEFAULT '<0,0,0>',
|
||||||
|
LastLookAt CHAR(64) NOT NULL DEFAULT '<0,0,0>',
|
||||||
|
Online CHAR(5) NOT NULL DEFAULT 'false',
|
||||||
|
Login CHAR(16) NOT NULL DEFAULT '0',
|
||||||
|
Logout CHAR(16) NOT NULL DEFAULT '0'
|
||||||
|
) ;
|
||||||
|
|
||||||
|
COMMIT;
|
|
@ -0,0 +1,61 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Threading;
|
||||||
|
using log4net;
|
||||||
|
using OpenMetaverse;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
|
||||||
|
namespace OpenSim.Data.SQLite
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A SQL Interface for user grid data
|
||||||
|
/// </summary>
|
||||||
|
public class SQLiteGridUserData : SQLiteGenericTableHandler<GridUserData>, IGridUserData
|
||||||
|
{
|
||||||
|
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
public SQLiteGridUserData(string connectionString, string realm)
|
||||||
|
: base(connectionString, realm, "GridUserStore") {}
|
||||||
|
|
||||||
|
public new GridUserData Get(string userID)
|
||||||
|
{
|
||||||
|
GridUserData[] ret = Get("UserID", userID);
|
||||||
|
|
||||||
|
if (ret.Length == 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return ret[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -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);
|
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)
|
if (regionInfo == null)
|
||||||
{
|
{
|
||||||
// can't find the Home region: Tell viewer and abort
|
// 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...
|
// a little eekie that this goes back to Scene and with a forced cast, will fix that at some point...
|
||||||
((Scene)(client.Scene)).RequestTeleportLocation(
|
((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));
|
(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);
|
bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason);
|
||||||
if (success)
|
if (success)
|
||||||
// Log them out of this grid
|
// Log them out of this grid
|
||||||
m_aScene.PresenceService.LogoutAgent(agentCircuit.SessionID, sp.AbsolutePosition, sp.Lookat);
|
m_aScene.PresenceService.LogoutAgent(agentCircuit.SessionID);
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
@ -238,6 +238,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
{
|
{
|
||||||
if (obj.IsLoggingOut)
|
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);
|
AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode);
|
||||||
|
|
||||||
if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
|
if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
|
||||||
|
|
|
@ -59,9 +59,11 @@
|
||||||
<RegionModule id="RemoteUserAccountServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts.RemoteUserAccountServicesConnector" />
|
<RegionModule id="RemoteUserAccountServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts.RemoteUserAccountServicesConnector" />
|
||||||
|
|
||||||
<RegionModule id="LocalGridUserServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser.LocalGridUserServicesConnector" />
|
<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="LocalSimulationConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation.LocalSimulationConnectorModule" />
|
||||||
<RegionModule id="RemoteSimulationConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation.RemoteSimulationConnectorModule" />
|
<RegionModule id="RemoteSimulationConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation.RemoteSimulationConnectorModule" />
|
||||||
|
|
||||||
<!-- Service connectors IN modules -->
|
<!-- Service connectors IN modules -->
|
||||||
<RegionModule id="AssetServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset.AssetServiceInConnectorModule" />
|
<RegionModule id="AssetServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset.AssetServiceInConnectorModule" />
|
||||||
<RegionModule id="InventoryServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory.InventoryServiceInConnectorModule" />
|
<RegionModule id="InventoryServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory.InventoryServiceInConnectorModule" />
|
||||||
|
|
|
@ -0,0 +1,116 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
|
||||||
|
using OpenMetaverse;
|
||||||
|
using log4net;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
|
||||||
|
{
|
||||||
|
public class ActivityDetector
|
||||||
|
{
|
||||||
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
private IGridUserService m_GridUserService;
|
||||||
|
private Scene m_aScene;
|
||||||
|
|
||||||
|
public ActivityDetector(IGridUserService guservice)
|
||||||
|
{
|
||||||
|
m_GridUserService = guservice;
|
||||||
|
m_log.DebugFormat("[ACTIVITY DETECTOR]: starting ");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddRegion(Scene scene)
|
||||||
|
{
|
||||||
|
// For now the only events we listen to are these
|
||||||
|
// But we could trigger the position update more often
|
||||||
|
scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
|
||||||
|
scene.EventManager.OnNewClient += OnNewClient;
|
||||||
|
scene.EventManager.OnAvatarEnteringNewParcel += OnEnteringNewParcel;
|
||||||
|
|
||||||
|
if (m_aScene == null)
|
||||||
|
m_aScene = scene;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveRegion(Scene scene)
|
||||||
|
{
|
||||||
|
scene.EventManager.OnMakeRootAgent -= OnMakeRootAgent;
|
||||||
|
scene.EventManager.OnNewClient -= OnNewClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnMakeRootAgent(ScenePresence sp)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
|
m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnNewClient(IClientAPI client)
|
||||||
|
{
|
||||||
|
client.OnConnectionClosed += OnConnectionClose;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnConnectionClose(IClientAPI client)
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
if (((ScenePresence)sp).IsChildAgent)
|
||||||
|
return;
|
||||||
|
|
||||||
|
position = ((ScenePresence)sp).AbsolutePosition;
|
||||||
|
lookat = ((ScenePresence)sp).Lookat;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName);
|
||||||
|
m_GridUserService.LoggedOut(client.AgentId.ToString(), client.Scene.RegionInfo.RegionID, position, lookat);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID)
|
||||||
|
{
|
||||||
|
// TODO: grab the parcel ID from ILandModule
|
||||||
|
// and send that along
|
||||||
|
m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -41,12 +41,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
|
||||||
{
|
{
|
||||||
public class LocalGridUserServicesConnector : ISharedRegionModule, IGridUserService
|
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;
|
private bool m_Enabled = false;
|
||||||
|
|
||||||
|
#region ISharedRegionModule
|
||||||
|
|
||||||
public Type ReplaceableInterface
|
public Type ReplaceableInterface
|
||||||
{
|
{
|
||||||
get { return null; }
|
get { return null; }
|
||||||
|
@ -68,7 +74,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
|
||||||
IConfig userConfig = source.Configs["GridUserService"];
|
IConfig userConfig = source.Configs["GridUserService"];
|
||||||
if (userConfig == null)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,15 +87,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
|
||||||
}
|
}
|
||||||
|
|
||||||
Object[] args = new Object[] { source };
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_ActivityDetector = new ActivityDetector(this);
|
||||||
|
|
||||||
m_Enabled = true;
|
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)
|
if (!m_Enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
scene.RegisterModuleInterface<IGridUserService>(m_service);
|
scene.RegisterModuleInterface<IGridUserService>(m_GridUserService);
|
||||||
|
m_ActivityDetector.AddRegion(scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveRegion(Scene scene)
|
public void RemoveRegion(Scene scene)
|
||||||
{
|
{
|
||||||
if (!m_Enabled)
|
if (!m_Enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
scene.UnregisterModuleInterface<IGridUserService>(this);
|
||||||
|
m_ActivityDetector.RemoveRegion(scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegionLoaded(Scene scene)
|
public void RegionLoaded(Scene scene)
|
||||||
{
|
{
|
||||||
if (!m_Enabled)
|
if (!m_Enabled)
|
||||||
return;
|
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)
|
public GridUserInfo GetGridUserInfo(string userID)
|
||||||
{
|
{
|
||||||
return m_service.GetGridUserInfo(userID);
|
return m_GridUserService.GetGridUserInfo(userID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool StoreGridUserInfo(GridUserInfo info)
|
#endregion
|
||||||
{
|
|
||||||
return m_service.StoreGridUserInfo(info);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,153 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using OpenSim.Server.Base;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
using OpenSim.Services.Connectors;
|
||||||
|
|
||||||
|
using OpenMetaverse;
|
||||||
|
using log4net;
|
||||||
|
using Nini.Config;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
|
||||||
|
{
|
||||||
|
public class RemoteGridUserServicesConnector : ISharedRegionModule, IGridUserService
|
||||||
|
{
|
||||||
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
#region ISharedRegionModule
|
||||||
|
|
||||||
|
private bool m_Enabled = false;
|
||||||
|
|
||||||
|
private ActivityDetector m_ActivityDetector;
|
||||||
|
private IGridUserService m_RemoteConnector;
|
||||||
|
|
||||||
|
public Type ReplaceableInterface
|
||||||
|
{
|
||||||
|
get { return null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return "RemoteGridUserServicesConnector"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Initialise(IConfigSource source)
|
||||||
|
{
|
||||||
|
IConfig moduleConfig = source.Configs["Modules"];
|
||||||
|
if (moduleConfig != null)
|
||||||
|
{
|
||||||
|
string name = moduleConfig.GetString("GridUserServices", "");
|
||||||
|
if (name == Name)
|
||||||
|
{
|
||||||
|
m_RemoteConnector = new GridUserServicesConnector(source);
|
||||||
|
|
||||||
|
m_Enabled = true;
|
||||||
|
|
||||||
|
m_ActivityDetector = new ActivityDetector(this);
|
||||||
|
|
||||||
|
m_log.Info("[REMOTE GRID USER CONNECTOR]: Remote grid user enabled");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PostInitialise()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddRegion(Scene scene)
|
||||||
|
{
|
||||||
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
scene.RegisterModuleInterface<IGridUserService>(this);
|
||||||
|
m_ActivityDetector.AddRegion(scene);
|
||||||
|
|
||||||
|
m_log.InfoFormat("[REMOTE GRID USER CONNECTOR]: Enabled remote grid user for region {0}", scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveRegion(Scene scene)
|
||||||
|
{
|
||||||
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_ActivityDetector.RemoveRegion(scene);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region IGridUserService
|
||||||
|
|
||||||
|
public GridUserInfo LoggedIn(string userID)
|
||||||
|
{
|
||||||
|
m_log.Warn("[REMOTE GRID USER CONNECTOR]: LoggedIn not implemented at the simulators");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool LoggedOut(string userID, UUID region, Vector3 position, Vector3 lookat)
|
||||||
|
{
|
||||||
|
return m_RemoteConnector.LoggedOut(userID, region, position, lookat);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public bool SetHome(string userID, UUID regionID, Vector3 position, Vector3 lookAt)
|
||||||
|
{
|
||||||
|
return m_RemoteConnector.SetHome(userID, regionID, position, lookAt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool SetLastPosition(string userID, UUID regionID, Vector3 position, Vector3 lookAt)
|
||||||
|
{
|
||||||
|
return m_RemoteConnector.SetLastPosition(userID, regionID, position, lookAt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GridUserInfo GetGridUserInfo(string userID)
|
||||||
|
{
|
||||||
|
return m_RemoteConnector.GetGridUserInfo(userID);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -167,9 +167,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
||||||
return false;
|
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);
|
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)
|
public PresenceInfo GetAgent(UUID sessionID)
|
||||||
|
@ -193,11 +193,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
||||||
return m_PresenceService.GetAgents(userIDs);
|
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
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
||||||
public void OnMakeRootAgent(ScenePresence sp)
|
public void OnMakeRootAgent(ScenePresence sp)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[PRESENCE DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName);
|
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)
|
public void OnNewClient(IClientAPI client)
|
||||||
|
@ -85,19 +85,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
||||||
if (client.IsLoggingOut)
|
if (client.IsLoggingOut)
|
||||||
{
|
{
|
||||||
object sp = null;
|
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 (client.Scene.TryGetScenePresence(client.AgentId, out sp))
|
||||||
{
|
{
|
||||||
if (sp is ScenePresence)
|
if (sp is ScenePresence)
|
||||||
{
|
{
|
||||||
position = ((ScenePresence)sp).AbsolutePosition;
|
if (((ScenePresence)sp).IsChildAgent)
|
||||||
lookat = ((ScenePresence)sp).Lookat;
|
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;
|
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);
|
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)
|
public PresenceInfo GetAgent(UUID sessionID)
|
||||||
|
@ -153,11 +153,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
||||||
return m_RemoteConnector.GetAgents(userIDs);
|
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
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,27 +90,25 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.Tests
|
||||||
PresenceInfo result = m_LocalConnector.GetAgent(session1);
|
PresenceInfo result = m_LocalConnector.GetAgent(session1);
|
||||||
Assert.IsNotNull(result, "Retrieved GetAgent is null");
|
Assert.IsNotNull(result, "Retrieved GetAgent is null");
|
||||||
Assert.That(result.UserID, Is.EqualTo(user1), "Retrieved userID does not match");
|
Assert.That(result.UserID, Is.EqualTo(user1), "Retrieved userID does not match");
|
||||||
Assert.IsTrue(result.Online, "Agent just logged in but is offline");
|
|
||||||
|
|
||||||
UUID region1 = UUID.Random();
|
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");
|
Assert.IsTrue(r, "First ReportAgent returned false");
|
||||||
result = m_LocalConnector.GetAgent(session1);
|
result = m_LocalConnector.GetAgent(session1);
|
||||||
Assert.That(result.RegionID, Is.EqualTo(region1), "Agent is not in the right region (region1)");
|
Assert.That(result.RegionID, Is.EqualTo(region1), "Agent is not in the right region (region1)");
|
||||||
|
|
||||||
UUID region2 = UUID.Random();
|
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");
|
Assert.IsTrue(r, "Second ReportAgent returned false");
|
||||||
result = m_LocalConnector.GetAgent(session1);
|
result = m_LocalConnector.GetAgent(session1);
|
||||||
Assert.That(result.RegionID, Is.EqualTo(region2), "Agent is not in the right region (region2)");
|
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");
|
Assert.IsTrue(r, "LogoutAgent returned false");
|
||||||
result = m_LocalConnector.GetAgent(session1);
|
result = m_LocalConnector.GetAgent(session1);
|
||||||
Assert.IsNotNull(result, "Agent session disappeared from storage after logout");
|
Assert.IsNull(result, "Agent session is still stored 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");
|
Assert.IsFalse(r, "ReportAgent of non-logged in user returned true");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -319,6 +319,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 IXMLRPC m_xmlrpcModule;
|
||||||
protected IWorldComm m_worldCommModule;
|
protected IWorldComm m_worldCommModule;
|
||||||
public IAttachmentsModule AttachmentsModule { get; set; }
|
public IAttachmentsModule AttachmentsModule { get; set; }
|
||||||
|
@ -1334,8 +1345,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (defaultRegions != null && defaultRegions.Count >= 1)
|
if (defaultRegions != null && defaultRegions.Count >= 1)
|
||||||
home = defaultRegions[0];
|
home = defaultRegions[0];
|
||||||
|
|
||||||
if (PresenceService != null && home != null)
|
if (GridUserService != null && home != null)
|
||||||
PresenceService.SetHomeLocation(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
|
GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
|
||||||
else
|
else
|
||||||
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set home for account {0} {1}.",
|
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set home for account {0} {1}.",
|
||||||
first, last);
|
first, last);
|
||||||
|
@ -3123,7 +3134,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="flags"></param>
|
/// <param name="flags"></param>
|
||||||
public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags)
|
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.
|
// FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot.
|
||||||
m_dialogModule.SendAlertToUser(remoteClient, "Home position set.");
|
m_dialogModule.SendAlertToUser(remoteClient, "Home position set.");
|
||||||
else
|
else
|
||||||
|
@ -3577,7 +3588,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
OpenSim.Services.Interfaces.PresenceInfo pinfo = presence.GetAgent(agent.SessionID);
|
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);
|
reason = String.Format("Failed to verify user {0} {1}, access denied to region {2}.", agent.firstname, agent.lastname, RegionInfo.RegionName);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -257,7 +257,6 @@ namespace PrimMesher
|
||||||
public int uv2;
|
public int uv2;
|
||||||
public int uv3;
|
public int uv3;
|
||||||
|
|
||||||
|
|
||||||
public Face(int v1, int v2, int v3)
|
public Face(int v1, int v2, int v3)
|
||||||
{
|
{
|
||||||
primFace = 0;
|
primFace = 0;
|
||||||
|
@ -630,6 +629,9 @@ namespace PrimMesher
|
||||||
internal int numOuterVerts = 0;
|
internal int numOuterVerts = 0;
|
||||||
internal int numHollowVerts = 0;
|
internal int numHollowVerts = 0;
|
||||||
|
|
||||||
|
internal int outerFaceNumber = -1;
|
||||||
|
internal int hollowFaceNumber = -1;
|
||||||
|
|
||||||
internal bool calcVertexNormals = false;
|
internal bool calcVertexNormals = false;
|
||||||
internal int bottomFaceNumber = 0;
|
internal int bottomFaceNumber = 0;
|
||||||
internal int numPrimFaces = 0;
|
internal int numPrimFaces = 0;
|
||||||
|
@ -935,11 +937,11 @@ namespace PrimMesher
|
||||||
}
|
}
|
||||||
|
|
||||||
if (calcVertexNormals && hasProfileCut)
|
if (calcVertexNormals && hasProfileCut)
|
||||||
{
|
|
||||||
if (hasHollow)
|
|
||||||
{
|
{
|
||||||
int lastOuterVertIndex = this.numOuterVerts - 1;
|
int lastOuterVertIndex = this.numOuterVerts - 1;
|
||||||
|
|
||||||
|
if (hasHollow)
|
||||||
|
{
|
||||||
this.cut1CoordIndices.Add(0);
|
this.cut1CoordIndices.Add(0);
|
||||||
this.cut1CoordIndices.Add(this.coords.Count - 1);
|
this.cut1CoordIndices.Add(this.coords.Count - 1);
|
||||||
|
|
||||||
|
@ -955,6 +957,12 @@ namespace PrimMesher
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
this.cut1CoordIndices.Add(0);
|
||||||
|
this.cut1CoordIndices.Add(1);
|
||||||
|
|
||||||
|
this.cut2CoordIndices.Add(lastOuterVertIndex);
|
||||||
|
this.cut2CoordIndices.Add(0);
|
||||||
|
|
||||||
this.cutNormal1.X = this.vertexNormals[1].Y;
|
this.cutNormal1.X = this.vertexNormals[1].Y;
|
||||||
this.cutNormal1.Y = -this.vertexNormals[1].X;
|
this.cutNormal1.Y = -this.vertexNormals[1].X;
|
||||||
|
|
||||||
|
@ -979,11 +987,14 @@ namespace PrimMesher
|
||||||
// I know it's ugly but so is the whole concept of prim face numbers
|
// I know it's ugly but so is the whole concept of prim face numbers
|
||||||
|
|
||||||
int faceNum = 1; // start with outer faces
|
int faceNum = 1; // start with outer faces
|
||||||
|
this.outerFaceNumber = faceNum;
|
||||||
|
|
||||||
int startVert = hasProfileCut && !hasHollow ? 1 : 0;
|
int startVert = hasProfileCut && !hasHollow ? 1 : 0;
|
||||||
if (startVert > 0)
|
if (startVert > 0)
|
||||||
this.faceNumbers.Add(-1);
|
this.faceNumbers.Add(-1);
|
||||||
for (int i = 0; i < this.numOuterVerts - 1; i++)
|
for (int i = 0; i < this.numOuterVerts - 1; i++)
|
||||||
this.faceNumbers.Add(sides < 5 ? faceNum++ : faceNum);
|
//this.faceNumbers.Add(sides < 5 ? faceNum++ : faceNum);
|
||||||
|
this.faceNumbers.Add(sides < 5 && i < sides ? faceNum++ : faceNum);
|
||||||
|
|
||||||
//if (!hasHollow && !hasProfileCut)
|
//if (!hasHollow && !hasProfileCut)
|
||||||
// this.bottomFaceNumber = faceNum++;
|
// this.bottomFaceNumber = faceNum++;
|
||||||
|
@ -993,12 +1004,15 @@ namespace PrimMesher
|
||||||
if (sides > 4 && (hasHollow || hasProfileCut))
|
if (sides > 4 && (hasHollow || hasProfileCut))
|
||||||
faceNum++;
|
faceNum++;
|
||||||
|
|
||||||
|
if (sides < 5 && (hasHollow || hasProfileCut) && this.numOuterVerts < sides)
|
||||||
|
faceNum++;
|
||||||
|
|
||||||
if (hasHollow)
|
if (hasHollow)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < this.numHollowVerts; i++)
|
for (int i = 0; i < this.numHollowVerts; i++)
|
||||||
this.faceNumbers.Add(faceNum);
|
this.faceNumbers.Add(faceNum);
|
||||||
|
|
||||||
faceNum++;
|
this.hollowFaceNumber = faceNum++;
|
||||||
}
|
}
|
||||||
//if (hasProfileCut || hasHollow)
|
//if (hasProfileCut || hasHollow)
|
||||||
// this.bottomFaceNumber = faceNum++;
|
// this.bottomFaceNumber = faceNum++;
|
||||||
|
@ -1006,11 +1020,11 @@ namespace PrimMesher
|
||||||
|
|
||||||
if (hasHollow && hasProfileCut)
|
if (hasHollow && hasProfileCut)
|
||||||
this.faceNumbers.Add(faceNum++);
|
this.faceNumbers.Add(faceNum++);
|
||||||
|
|
||||||
for (int i = 0; i < this.faceNumbers.Count; i++)
|
for (int i = 0; i < this.faceNumbers.Count; i++)
|
||||||
if (this.faceNumbers[i] == -1)
|
if (this.faceNumbers[i] == -1)
|
||||||
this.faceNumbers[i] = faceNum++;
|
this.faceNumbers[i] = faceNum++;
|
||||||
|
|
||||||
|
|
||||||
this.numPrimFaces = faceNum;
|
this.numPrimFaces = faceNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1455,11 +1469,15 @@ namespace PrimMesher
|
||||||
public float revolutions = 1.0f;
|
public float revolutions = 1.0f;
|
||||||
public int stepsPerRevolution = 24;
|
public int stepsPerRevolution = 24;
|
||||||
|
|
||||||
|
private int profileOuterFaceNumber = -1;
|
||||||
|
private int profileHollowFaceNumber = -1;
|
||||||
|
|
||||||
private bool hasProfileCut = false;
|
private bool hasProfileCut = false;
|
||||||
private bool hasHollow = false;
|
private bool hasHollow = false;
|
||||||
public bool calcVertexNormals = false;
|
public bool calcVertexNormals = false;
|
||||||
private bool normalsProcessed = false;
|
private bool normalsProcessed = false;
|
||||||
public bool viewerMode = false;
|
public bool viewerMode = false;
|
||||||
|
public bool sphereMode = false;
|
||||||
|
|
||||||
public int numPrimFaces = 0;
|
public int numPrimFaces = 0;
|
||||||
|
|
||||||
|
@ -1491,10 +1509,35 @@ namespace PrimMesher
|
||||||
s += "\nradius...............: " + this.radius.ToString();
|
s += "\nradius...............: " + this.radius.ToString();
|
||||||
s += "\nrevolutions..........: " + this.revolutions.ToString();
|
s += "\nrevolutions..........: " + this.revolutions.ToString();
|
||||||
s += "\nstepsPerRevolution...: " + this.stepsPerRevolution.ToString();
|
s += "\nstepsPerRevolution...: " + this.stepsPerRevolution.ToString();
|
||||||
|
s += "\nsphereMode...........: " + this.sphereMode.ToString();
|
||||||
|
s += "\nhasProfileCut........: " + this.hasProfileCut.ToString();
|
||||||
|
s += "\nhasHollow............: " + this.hasHollow.ToString();
|
||||||
|
s += "\nviewerMode...........: " + this.viewerMode.ToString();
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int ProfileOuterFaceNumber
|
||||||
|
{
|
||||||
|
get { return profileOuterFaceNumber; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int ProfileHollowFaceNumber
|
||||||
|
{
|
||||||
|
get { return profileHollowFaceNumber; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool HasProfileCut
|
||||||
|
{
|
||||||
|
get { return hasProfileCut; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool HasHollow
|
||||||
|
{
|
||||||
|
get { return hasHollow; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructs a PrimMesh object and creates the profile for extrusion.
|
/// Constructs a PrimMesh object and creates the profile for extrusion.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1531,8 +1574,12 @@ namespace PrimMesher
|
||||||
if (hollow < 0.0f)
|
if (hollow < 0.0f)
|
||||||
this.hollow = 0.0f;
|
this.hollow = 0.0f;
|
||||||
|
|
||||||
this.hasProfileCut = (this.profileStart > 0.0f || this.profileEnd < 1.0f);
|
//if (sphereMode)
|
||||||
this.hasHollow = (this.hollow > 0.001f);
|
// this.hasProfileCut = this.profileEnd - this.profileStart < 0.4999f;
|
||||||
|
//else
|
||||||
|
// //this.hasProfileCut = (this.profileStart > 0.0f || this.profileEnd < 1.0f);
|
||||||
|
// this.hasProfileCut = this.profileEnd - this.profileStart < 0.9999f;
|
||||||
|
//this.hasHollow = (this.hollow > 0.001f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1540,6 +1587,8 @@ namespace PrimMesher
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Extrude(PathType pathType)
|
public void Extrude(PathType pathType)
|
||||||
{
|
{
|
||||||
|
bool needEndFaces = false;
|
||||||
|
|
||||||
this.coords = new List<Coord>();
|
this.coords = new List<Coord>();
|
||||||
this.faces = new List<Face>();
|
this.faces = new List<Face>();
|
||||||
|
|
||||||
|
@ -1565,6 +1614,12 @@ namespace PrimMesher
|
||||||
steps = (int)(steps * 4.5 * length);
|
steps = (int)(steps * 4.5 * length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sphereMode)
|
||||||
|
this.hasProfileCut = this.profileEnd - this.profileStart < 0.4999f;
|
||||||
|
else
|
||||||
|
//this.hasProfileCut = (this.profileStart > 0.0f || this.profileEnd < 1.0f);
|
||||||
|
this.hasProfileCut = this.profileEnd - this.profileStart < 0.9999f;
|
||||||
|
this.hasHollow = (this.hollow > 0.001f);
|
||||||
|
|
||||||
float twistBegin = this.twistBegin / 360.0f * twoPi;
|
float twistBegin = this.twistBegin / 360.0f * twoPi;
|
||||||
float twistEnd = this.twistEnd / 360.0f * twoPi;
|
float twistEnd = this.twistEnd / 360.0f * twoPi;
|
||||||
|
@ -1634,6 +1689,32 @@ namespace PrimMesher
|
||||||
|
|
||||||
this.numPrimFaces = profile.numPrimFaces;
|
this.numPrimFaces = profile.numPrimFaces;
|
||||||
|
|
||||||
|
//profileOuterFaceNumber = profile.faceNumbers[0];
|
||||||
|
//if (!needEndFaces)
|
||||||
|
// profileOuterFaceNumber--;
|
||||||
|
//profileOuterFaceNumber = needEndFaces ? 1 : 0;
|
||||||
|
|
||||||
|
|
||||||
|
//if (hasHollow)
|
||||||
|
//{
|
||||||
|
// if (needEndFaces)
|
||||||
|
// profileHollowFaceNumber = profile.faceNumbers[profile.numOuterVerts + 1];
|
||||||
|
// else
|
||||||
|
// profileHollowFaceNumber = profile.faceNumbers[profile.numOuterVerts] - 1;
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
profileOuterFaceNumber = profile.outerFaceNumber;
|
||||||
|
if (!needEndFaces)
|
||||||
|
profileOuterFaceNumber--;
|
||||||
|
|
||||||
|
if (hasHollow)
|
||||||
|
{
|
||||||
|
profileHollowFaceNumber = profile.hollowFaceNumber;
|
||||||
|
if (!needEndFaces)
|
||||||
|
profileHollowFaceNumber--;
|
||||||
|
}
|
||||||
|
|
||||||
int cut1Vert = -1;
|
int cut1Vert = -1;
|
||||||
int cut2Vert = -1;
|
int cut2Vert = -1;
|
||||||
if (hasProfileCut)
|
if (hasProfileCut)
|
||||||
|
@ -1673,7 +1754,7 @@ namespace PrimMesher
|
||||||
|
|
||||||
path.Create(pathType, steps);
|
path.Create(pathType, steps);
|
||||||
|
|
||||||
bool needEndFaces = false;
|
|
||||||
if (pathType == PathType.Circular)
|
if (pathType == PathType.Circular)
|
||||||
{
|
{
|
||||||
needEndFaces = false;
|
needEndFaces = false;
|
||||||
|
@ -1761,7 +1842,7 @@ namespace PrimMesher
|
||||||
int startVert = coordsLen + 1;
|
int startVert = coordsLen + 1;
|
||||||
int endVert = this.coords.Count;
|
int endVert = this.coords.Count;
|
||||||
|
|
||||||
if (sides < 5 || this.hasProfileCut || hollow > 0.0f)
|
if (sides < 5 || this.hasProfileCut || this.hasHollow)
|
||||||
startVert--;
|
startVert--;
|
||||||
|
|
||||||
for (int i = startVert; i < endVert; i++)
|
for (int i = startVert; i < endVert; i++)
|
||||||
|
@ -1813,11 +1894,13 @@ namespace PrimMesher
|
||||||
u1 -= (int)u1;
|
u1 -= (int)u1;
|
||||||
if (u2 < 0.1f)
|
if (u2 < 0.1f)
|
||||||
u2 = 1.0f;
|
u2 = 1.0f;
|
||||||
|
//this.profileOuterFaceNumber = primFaceNum;
|
||||||
}
|
}
|
||||||
else if (whichVert > profile.coords.Count - profile.numHollowVerts - 1)
|
else if (whichVert > profile.coords.Count - profile.numHollowVerts - 1)
|
||||||
{
|
{
|
||||||
u1 *= 2.0f;
|
u1 *= 2.0f;
|
||||||
u2 *= 2.0f;
|
u2 *= 2.0f;
|
||||||
|
//this.profileHollowFaceNumber = primFaceNum;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,176 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// to build without references to System.Drawing, comment this out
|
||||||
|
#define SYSTEM_DRAWING
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
#if SYSTEM_DRAWING
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
|
|
||||||
|
namespace PrimMesher
|
||||||
|
{
|
||||||
|
public class SculptMap
|
||||||
|
{
|
||||||
|
public int width;
|
||||||
|
public int height;
|
||||||
|
public byte[] redBytes;
|
||||||
|
public byte[] greenBytes;
|
||||||
|
public byte[] blueBytes;
|
||||||
|
|
||||||
|
public SculptMap()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public SculptMap(Bitmap bm, int lod)
|
||||||
|
{
|
||||||
|
int bmW = bm.Width;
|
||||||
|
int bmH = bm.Height;
|
||||||
|
|
||||||
|
if (bmW == 0 || bmH == 0)
|
||||||
|
throw new Exception("SculptMap: bitmap has no data");
|
||||||
|
|
||||||
|
int numLodPixels = lod * 2 * lod * 2; // (32 * 2)^2 = 64^2 pixels for default sculpt map image
|
||||||
|
|
||||||
|
bool needsScaling = false;
|
||||||
|
|
||||||
|
width = bmW;
|
||||||
|
height = bmH;
|
||||||
|
while (width * height > numLodPixels)
|
||||||
|
{
|
||||||
|
width >>= 1;
|
||||||
|
height >>= 1;
|
||||||
|
needsScaling = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (needsScaling)
|
||||||
|
bm = ScaleImage(bm, width, height,
|
||||||
|
System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor);
|
||||||
|
}
|
||||||
|
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
throw new Exception("Exception in ScaleImage(): e: " + e.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (width * height > lod * lod)
|
||||||
|
{
|
||||||
|
width >>= 1;
|
||||||
|
height >>= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int numBytes = (width + 1) * (height + 1);
|
||||||
|
redBytes = new byte[numBytes];
|
||||||
|
greenBytes = new byte[numBytes];
|
||||||
|
blueBytes = new byte[numBytes];
|
||||||
|
|
||||||
|
int byteNdx = 0;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
for (int y = 0; y <= height; y++)
|
||||||
|
{
|
||||||
|
for (int x = 0; x <= width; x++)
|
||||||
|
{
|
||||||
|
int bmY = y < height ? y * 2 : y * 2 - 1;
|
||||||
|
int bmX = x < width ? x * 2 : x * 2 - 1;
|
||||||
|
Color c = bm.GetPixel(bmX, bmY);
|
||||||
|
|
||||||
|
redBytes[byteNdx] = c.R;
|
||||||
|
greenBytes[byteNdx] = c.G;
|
||||||
|
blueBytes[byteNdx] = c.B;
|
||||||
|
|
||||||
|
++byteNdx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
throw new Exception("Caught exception processing byte arrays in SculptMap(): e: " + e.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
width++;
|
||||||
|
height++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<List<Coord>> ToRows(bool mirror)
|
||||||
|
{
|
||||||
|
int numRows = height;
|
||||||
|
int numCols = width;
|
||||||
|
|
||||||
|
List<List<Coord>> rows = new List<List<Coord>>(numRows);
|
||||||
|
|
||||||
|
float pixScale = 1.0f / 255;
|
||||||
|
|
||||||
|
int rowNdx, colNdx;
|
||||||
|
int smNdx = 0;
|
||||||
|
|
||||||
|
for (rowNdx = 0; rowNdx < numRows; rowNdx++)
|
||||||
|
{
|
||||||
|
List<Coord> row = new List<Coord>(numCols);
|
||||||
|
for (colNdx = 0; colNdx < numCols; colNdx++)
|
||||||
|
{
|
||||||
|
if (mirror)
|
||||||
|
row.Add(new Coord(-(redBytes[smNdx] * pixScale - 0.5f), (greenBytes[smNdx] * pixScale - 0.5f), blueBytes[smNdx] * pixScale - 0.5f));
|
||||||
|
else
|
||||||
|
row.Add(new Coord(redBytes[smNdx] * pixScale - 0.5f, greenBytes[smNdx] * pixScale - 0.5f, blueBytes[smNdx] * pixScale - 0.5f));
|
||||||
|
|
||||||
|
++smNdx;
|
||||||
|
}
|
||||||
|
rows.Add(row);
|
||||||
|
}
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Bitmap ScaleImage(Bitmap srcImage, int destWidth, int destHeight,
|
||||||
|
System.Drawing.Drawing2D.InterpolationMode interpMode)
|
||||||
|
{
|
||||||
|
Bitmap scaledImage = new Bitmap(srcImage, destWidth, destHeight);
|
||||||
|
scaledImage.SetResolution(96.0f, 96.0f);
|
||||||
|
|
||||||
|
Graphics grPhoto = Graphics.FromImage(scaledImage);
|
||||||
|
grPhoto.InterpolationMode = interpMode;
|
||||||
|
|
||||||
|
grPhoto.DrawImage(srcImage,
|
||||||
|
new Rectangle(0, 0, destWidth, destHeight),
|
||||||
|
new Rectangle(0, 0, srcImage.Width, srcImage.Height),
|
||||||
|
GraphicsUnit.Pixel);
|
||||||
|
|
||||||
|
grPhoto.Dispose();
|
||||||
|
return scaledImage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -53,50 +53,6 @@ namespace PrimMesher
|
||||||
public enum SculptType { sphere = 1, torus = 2, plane = 3, cylinder = 4 };
|
public enum SculptType { sphere = 1, torus = 2, plane = 3, cylinder = 4 };
|
||||||
|
|
||||||
#if SYSTEM_DRAWING
|
#if SYSTEM_DRAWING
|
||||||
private Bitmap ScaleImage(Bitmap srcImage, float scale, bool removeAlpha)
|
|
||||||
{
|
|
||||||
int sourceWidth = srcImage.Width;
|
|
||||||
int sourceHeight = srcImage.Height;
|
|
||||||
int sourceX = 0;
|
|
||||||
int sourceY = 0;
|
|
||||||
|
|
||||||
int destX = 0;
|
|
||||||
int destY = 0;
|
|
||||||
int destWidth = (int)(srcImage.Width * scale);
|
|
||||||
int destHeight = (int)(srcImage.Height * scale);
|
|
||||||
|
|
||||||
Bitmap scaledImage;
|
|
||||||
|
|
||||||
if (removeAlpha)
|
|
||||||
{
|
|
||||||
if (srcImage.PixelFormat == PixelFormat.Format32bppArgb)
|
|
||||||
for (int y = 0; y < srcImage.Height; y++)
|
|
||||||
for (int x = 0; x < srcImage.Width; x++)
|
|
||||||
{
|
|
||||||
Color c = srcImage.GetPixel(x, y);
|
|
||||||
srcImage.SetPixel(x, y, Color.FromArgb(255, c.R, c.G, c.B));
|
|
||||||
}
|
|
||||||
|
|
||||||
scaledImage = new Bitmap(destWidth, destHeight,
|
|
||||||
PixelFormat.Format24bppRgb);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
scaledImage = new Bitmap(srcImage, destWidth, destHeight);
|
|
||||||
|
|
||||||
scaledImage.SetResolution(96.0f, 96.0f);
|
|
||||||
|
|
||||||
Graphics grPhoto = Graphics.FromImage(scaledImage);
|
|
||||||
grPhoto.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Low;
|
|
||||||
|
|
||||||
grPhoto.DrawImage(srcImage,
|
|
||||||
new Rectangle(destX, destY, destWidth, destHeight),
|
|
||||||
new Rectangle(sourceX, sourceY, sourceWidth, sourceHeight),
|
|
||||||
GraphicsUnit.Pixel);
|
|
||||||
|
|
||||||
grPhoto.Dispose();
|
|
||||||
return scaledImage;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public SculptMesh SculptMeshFromFile(string fileName, SculptType sculptType, int lod, bool viewerMode)
|
public SculptMesh SculptMeshFromFile(string fileName, SculptType sculptType, int lod, bool viewerMode)
|
||||||
{
|
{
|
||||||
|
@ -106,6 +62,7 @@ namespace PrimMesher
|
||||||
return sculptMesh;
|
return sculptMesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public SculptMesh(string fileName, int sculptType, int lod, int viewerMode, int mirror, int invert)
|
public SculptMesh(string fileName, int sculptType, int lod, int viewerMode, int mirror, int invert)
|
||||||
{
|
{
|
||||||
Bitmap bitmap = (Bitmap)Bitmap.FromFile(fileName);
|
Bitmap bitmap = (Bitmap)Bitmap.FromFile(fileName);
|
||||||
|
@ -296,36 +253,53 @@ namespace PrimMesher
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<List<Coord>> bitmap2CoordsSampled(Bitmap bitmap, int scale, bool mirror)
|
||||||
|
{
|
||||||
|
int numRows = bitmap.Height / scale;
|
||||||
|
int numCols = bitmap.Width / scale;
|
||||||
|
List<List<Coord>> rows = new List<List<Coord>>(numRows);
|
||||||
|
|
||||||
|
float pixScale = 1.0f / 256.0f;
|
||||||
|
|
||||||
|
int imageX, imageY = 0;
|
||||||
|
|
||||||
|
int rowNdx, colNdx;
|
||||||
|
|
||||||
|
for (rowNdx = 0; rowNdx <= numRows; rowNdx++)
|
||||||
|
{
|
||||||
|
List<Coord> row = new List<Coord>(numCols);
|
||||||
|
imageY = rowNdx * scale;
|
||||||
|
if (rowNdx == numRows) imageY--;
|
||||||
|
for (colNdx = 0; colNdx <= numCols; colNdx++)
|
||||||
|
{
|
||||||
|
imageX = colNdx * scale;
|
||||||
|
if (colNdx == numCols) imageX--;
|
||||||
|
|
||||||
|
Color c = bitmap.GetPixel(imageX, imageY);
|
||||||
|
if (c.A != 255)
|
||||||
|
{
|
||||||
|
bitmap.SetPixel(imageX, imageY, Color.FromArgb(255, c.R, c.G, c.B));
|
||||||
|
c = bitmap.GetPixel(imageX, imageY);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mirror)
|
||||||
|
row.Add(new Coord(-(c.R * pixScale - 0.5f), c.G * pixScale - 0.5f, c.B * pixScale - 0.5f));
|
||||||
|
else
|
||||||
|
row.Add(new Coord(c.R * pixScale - 0.5f, c.G * pixScale - 0.5f, c.B * pixScale - 0.5f));
|
||||||
|
|
||||||
|
}
|
||||||
|
rows.Add(row);
|
||||||
|
}
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void _SculptMesh(Bitmap sculptBitmap, SculptType sculptType, int lod, bool viewerMode, bool mirror, bool invert)
|
void _SculptMesh(Bitmap sculptBitmap, SculptType sculptType, int lod, bool viewerMode, bool mirror, bool invert)
|
||||||
{
|
{
|
||||||
coords = new List<Coord>();
|
_SculptMesh(new SculptMap(sculptBitmap, lod).ToRows(mirror), sculptType, viewerMode, mirror, invert);
|
||||||
faces = new List<Face>();
|
|
||||||
normals = new List<Coord>();
|
|
||||||
uvs = new List<UVCoord>();
|
|
||||||
|
|
||||||
sculptType = (SculptType)(((int)sculptType) & 0x07);
|
|
||||||
|
|
||||||
if (mirror)
|
|
||||||
if (sculptType == SculptType.plane)
|
|
||||||
invert = !invert;
|
|
||||||
|
|
||||||
float sculptBitmapLod = (float)Math.Sqrt(sculptBitmap.Width * sculptBitmap.Height);
|
|
||||||
|
|
||||||
float sourceScaleFactor = (float)(lod) / sculptBitmapLod;
|
|
||||||
|
|
||||||
float fScale = 1.0f / sourceScaleFactor;
|
|
||||||
|
|
||||||
int iScale = (int)fScale;
|
|
||||||
if (iScale < 1) iScale = 1;
|
|
||||||
if (iScale > 2 && iScale % 2 == 0)
|
|
||||||
_SculptMesh(bitmap2Coords(ScaleImage(sculptBitmap, 64.0f / sculptBitmapLod, true), 64 / lod, mirror), sculptType, viewerMode, mirror, invert);
|
|
||||||
else
|
|
||||||
_SculptMesh(bitmap2Coords(sculptBitmap, iScale, mirror), sculptType, viewerMode, mirror, invert);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void _SculptMesh(List<List<Coord>> rows, SculptType sculptType, bool viewerMode, bool mirror, bool invert)
|
void _SculptMesh(List<List<Coord>> rows, SculptType sculptType, bool viewerMode, bool mirror, bool invert)
|
||||||
{
|
{
|
||||||
coords = new List<Coord>();
|
coords = new List<Coord>();
|
||||||
|
@ -348,15 +322,27 @@ namespace PrimMesher
|
||||||
int imageX, imageY;
|
int imageX, imageY;
|
||||||
|
|
||||||
if (sculptType != SculptType.plane)
|
if (sculptType != SculptType.plane)
|
||||||
|
{
|
||||||
|
if (rows.Count % 2 == 0)
|
||||||
{
|
{
|
||||||
for (int rowNdx = 0; rowNdx < rows.Count; rowNdx++)
|
for (int rowNdx = 0; rowNdx < rows.Count; rowNdx++)
|
||||||
rows[rowNdx].Add(rows[rowNdx][0]);
|
rows[rowNdx].Add(rows[rowNdx][0]);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int lastIndex = rows[0].Count - 1;
|
||||||
|
|
||||||
|
for (int i = 0; i < rows.Count; i++)
|
||||||
|
rows[i][0] = rows[i][lastIndex];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Coord topPole = rows[0][width / 2];
|
Coord topPole = rows[0][width / 2];
|
||||||
Coord bottomPole = rows[rows.Count - 1][width / 2];
|
Coord bottomPole = rows[rows.Count - 1][width / 2];
|
||||||
|
|
||||||
if (sculptType == SculptType.sphere)
|
if (sculptType == SculptType.sphere)
|
||||||
|
{
|
||||||
|
if (rows.Count % 2 == 0)
|
||||||
{
|
{
|
||||||
int count = rows[0].Count;
|
int count = rows[0].Count;
|
||||||
List<Coord> topPoleRow = new List<Coord>(count);
|
List<Coord> topPoleRow = new List<Coord>(count);
|
||||||
|
@ -370,11 +356,27 @@ namespace PrimMesher
|
||||||
rows.Insert(0, topPoleRow);
|
rows.Insert(0, topPoleRow);
|
||||||
rows.Add(bottomPoleRow);
|
rows.Add(bottomPoleRow);
|
||||||
}
|
}
|
||||||
else if (sculptType == SculptType.torus)
|
else
|
||||||
|
{
|
||||||
|
int count = rows[0].Count;
|
||||||
|
|
||||||
|
List<Coord> topPoleRow = rows[0];
|
||||||
|
List<Coord> bottomPoleRow = rows[rows.Count - 1];
|
||||||
|
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
topPoleRow[i] = topPole;
|
||||||
|
bottomPoleRow[i] = bottomPole;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sculptType == SculptType.torus)
|
||||||
rows.Add(rows[0]);
|
rows.Add(rows[0]);
|
||||||
|
|
||||||
int coordsDown = rows.Count;
|
int coordsDown = rows.Count;
|
||||||
int coordsAcross = rows[0].Count;
|
int coordsAcross = rows[0].Count;
|
||||||
|
int lastColumn = coordsAcross - 1;
|
||||||
|
|
||||||
float widthUnit = 1.0f / (coordsAcross - 1);
|
float widthUnit = 1.0f / (coordsAcross - 1);
|
||||||
float heightUnit = 1.0f / (coordsDown - 1);
|
float heightUnit = 1.0f / (coordsDown - 1);
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using Nini.Config;
|
||||||
|
using OpenSim.Server.Base;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
using OpenSim.Framework.Servers.HttpServer;
|
||||||
|
using OpenSim.Server.Handlers.Base;
|
||||||
|
|
||||||
|
namespace OpenSim.Server.Handlers.GridUser
|
||||||
|
{
|
||||||
|
public class GridUserServiceConnector : ServiceConnector
|
||||||
|
{
|
||||||
|
private IGridUserService m_GridUserService;
|
||||||
|
private string m_ConfigName = "GridUserService";
|
||||||
|
|
||||||
|
public GridUserServiceConnector(IConfigSource config, IHttpServer server, string configName) :
|
||||||
|
base(config, server, configName)
|
||||||
|
{
|
||||||
|
IConfig serverConfig = config.Configs[m_ConfigName];
|
||||||
|
if (serverConfig == null)
|
||||||
|
throw new Exception(String.Format("No section {0} in config file", m_ConfigName));
|
||||||
|
|
||||||
|
string service = serverConfig.GetString("LocalServiceModule",
|
||||||
|
String.Empty);
|
||||||
|
|
||||||
|
if (service == String.Empty)
|
||||||
|
throw new Exception("No LocalServiceModule in config file");
|
||||||
|
|
||||||
|
Object[] args = new Object[] { config };
|
||||||
|
m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(service, args);
|
||||||
|
|
||||||
|
server.AddStreamHandler(new GridUserServerPostHandler(m_GridUserService));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,278 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using Nini.Config;
|
||||||
|
using log4net;
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.IO;
|
||||||
|
using System.Net;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Xml;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using OpenSim.Server.Base;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Framework.Servers.HttpServer;
|
||||||
|
using OpenMetaverse;
|
||||||
|
|
||||||
|
namespace OpenSim.Server.Handlers.GridUser
|
||||||
|
{
|
||||||
|
public class GridUserServerPostHandler : BaseStreamHandler
|
||||||
|
{
|
||||||
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
private IGridUserService m_GridUserService;
|
||||||
|
|
||||||
|
public GridUserServerPostHandler(IGridUserService service) :
|
||||||
|
base("POST", "/griduser")
|
||||||
|
{
|
||||||
|
m_GridUserService = service;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override byte[] Handle(string path, Stream requestData,
|
||||||
|
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||||
|
{
|
||||||
|
StreamReader sr = new StreamReader(requestData);
|
||||||
|
string body = sr.ReadToEnd();
|
||||||
|
sr.Close();
|
||||||
|
body = body.Trim();
|
||||||
|
|
||||||
|
//m_log.DebugFormat("[XXX]: query String: {0}", body);
|
||||||
|
string method = string.Empty;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Dictionary<string, object> request =
|
||||||
|
ServerUtils.ParseQueryString(body);
|
||||||
|
|
||||||
|
if (!request.ContainsKey("METHOD"))
|
||||||
|
return FailureResult();
|
||||||
|
|
||||||
|
method = request["METHOD"].ToString();
|
||||||
|
|
||||||
|
switch (method)
|
||||||
|
{
|
||||||
|
case "loggedin":
|
||||||
|
return LoggedIn(request);
|
||||||
|
case "loggedout":
|
||||||
|
return LoggedOut(request);
|
||||||
|
case "sethome":
|
||||||
|
return SetHome(request);
|
||||||
|
case "setposition":
|
||||||
|
return SetPosition(request);
|
||||||
|
case "getgriduserinfo":
|
||||||
|
return GetGridUserInfo(request);
|
||||||
|
}
|
||||||
|
m_log.DebugFormat("[GRID USER HANDLER]: unknown method request: {0}", method);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[GRID USER HANDLER]: Exception in method {0}: {1}", method, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return FailureResult();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] LoggedIn(Dictionary<string, object> request)
|
||||||
|
{
|
||||||
|
string user = String.Empty;
|
||||||
|
|
||||||
|
if (!request.ContainsKey("UserID"))
|
||||||
|
return FailureResult();
|
||||||
|
|
||||||
|
user = request["UserID"].ToString();
|
||||||
|
|
||||||
|
GridUserInfo guinfo = m_GridUserService.LoggedIn(user);
|
||||||
|
|
||||||
|
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||||
|
result["result"] = guinfo.ToKeyValuePairs();
|
||||||
|
|
||||||
|
string xmlString = ServerUtils.BuildXmlResponse(result);
|
||||||
|
//m_log.DebugFormat("[GRID USER HANDLER]: resp string: {0}", xmlString);
|
||||||
|
UTF8Encoding encoding = new UTF8Encoding();
|
||||||
|
return encoding.GetBytes(xmlString);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] LoggedOut(Dictionary<string, object> request)
|
||||||
|
{
|
||||||
|
string userID = string.Empty;
|
||||||
|
UUID regionID = UUID.Zero;
|
||||||
|
Vector3 position = Vector3.Zero;
|
||||||
|
Vector3 lookat = Vector3.Zero;
|
||||||
|
|
||||||
|
if (!UnpackArgs(request, out userID, out regionID, out position, out lookat))
|
||||||
|
return FailureResult();
|
||||||
|
|
||||||
|
if (m_GridUserService.LoggedOut(userID, regionID, position, lookat))
|
||||||
|
return SuccessResult();
|
||||||
|
|
||||||
|
return FailureResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] SetHome(Dictionary<string, object> request)
|
||||||
|
{
|
||||||
|
string user = string.Empty;
|
||||||
|
UUID region = UUID.Zero;
|
||||||
|
Vector3 position = new Vector3(128, 128, 70);
|
||||||
|
Vector3 look = Vector3.Zero;
|
||||||
|
|
||||||
|
if (!UnpackArgs(request, out user, out region, out position, out look))
|
||||||
|
return FailureResult();
|
||||||
|
|
||||||
|
if (m_GridUserService.SetHome(user, region, position, look))
|
||||||
|
return SuccessResult();
|
||||||
|
|
||||||
|
return FailureResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] SetPosition(Dictionary<string, object> request)
|
||||||
|
{
|
||||||
|
string user = string.Empty;
|
||||||
|
UUID region = UUID.Zero;
|
||||||
|
Vector3 position = new Vector3(128, 128, 70);
|
||||||
|
Vector3 look = Vector3.Zero;
|
||||||
|
|
||||||
|
if (!request.ContainsKey("UserID") || !request.ContainsKey("RegionID"))
|
||||||
|
return FailureResult();
|
||||||
|
|
||||||
|
if (!UnpackArgs(request, out user, out region, out position, out look))
|
||||||
|
return FailureResult();
|
||||||
|
|
||||||
|
if (m_GridUserService.SetLastPosition(user, region, position, look))
|
||||||
|
return SuccessResult();
|
||||||
|
|
||||||
|
return FailureResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] GetGridUserInfo(Dictionary<string, object> request)
|
||||||
|
{
|
||||||
|
string user = String.Empty;
|
||||||
|
|
||||||
|
if (!request.ContainsKey("UserID"))
|
||||||
|
return FailureResult();
|
||||||
|
|
||||||
|
user = request["UserID"].ToString();
|
||||||
|
|
||||||
|
GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(user);
|
||||||
|
|
||||||
|
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||||
|
result["result"] = guinfo.ToKeyValuePairs();
|
||||||
|
|
||||||
|
string xmlString = ServerUtils.BuildXmlResponse(result);
|
||||||
|
//m_log.DebugFormat("[GRID USER HANDLER]: resp string: {0}", xmlString);
|
||||||
|
UTF8Encoding encoding = new UTF8Encoding();
|
||||||
|
return encoding.GetBytes(xmlString);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool UnpackArgs(Dictionary<string, object> request, out string user, out UUID region, out Vector3 position, out Vector3 lookAt)
|
||||||
|
{
|
||||||
|
user = string.Empty;
|
||||||
|
region = UUID.Zero;
|
||||||
|
position = new Vector3(128, 128, 70);
|
||||||
|
lookAt = Vector3.Zero;
|
||||||
|
|
||||||
|
if (!request.ContainsKey("UserID") || !request.ContainsKey("RegionID"))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
user = request["UserID"].ToString();
|
||||||
|
|
||||||
|
if (!UUID.TryParse(request["RegionID"].ToString(), out region))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (request.ContainsKey("Position"))
|
||||||
|
Vector3.TryParse(request["Position"].ToString(), out position);
|
||||||
|
|
||||||
|
if (request.ContainsKey("LookAt"))
|
||||||
|
Vector3.TryParse(request["LookAt"].ToString(), out lookAt);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private byte[] SuccessResult()
|
||||||
|
{
|
||||||
|
XmlDocument doc = new XmlDocument();
|
||||||
|
|
||||||
|
XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration,
|
||||||
|
"", "");
|
||||||
|
|
||||||
|
doc.AppendChild(xmlnode);
|
||||||
|
|
||||||
|
XmlElement rootElement = doc.CreateElement("", "ServerResponse",
|
||||||
|
"");
|
||||||
|
|
||||||
|
doc.AppendChild(rootElement);
|
||||||
|
|
||||||
|
XmlElement result = doc.CreateElement("", "result", "");
|
||||||
|
result.AppendChild(doc.CreateTextNode("Success"));
|
||||||
|
|
||||||
|
rootElement.AppendChild(result);
|
||||||
|
|
||||||
|
return DocToBytes(doc);
|
||||||
|
}
|
||||||
|
|
||||||
|
private byte[] FailureResult()
|
||||||
|
{
|
||||||
|
XmlDocument doc = new XmlDocument();
|
||||||
|
|
||||||
|
XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration,
|
||||||
|
"", "");
|
||||||
|
|
||||||
|
doc.AppendChild(xmlnode);
|
||||||
|
|
||||||
|
XmlElement rootElement = doc.CreateElement("", "ServerResponse",
|
||||||
|
"");
|
||||||
|
|
||||||
|
doc.AppendChild(rootElement);
|
||||||
|
|
||||||
|
XmlElement result = doc.CreateElement("", "result", "");
|
||||||
|
result.AppendChild(doc.CreateTextNode("Failure"));
|
||||||
|
|
||||||
|
rootElement.AppendChild(result);
|
||||||
|
|
||||||
|
return DocToBytes(doc);
|
||||||
|
}
|
||||||
|
|
||||||
|
private byte[] DocToBytes(XmlDocument doc)
|
||||||
|
{
|
||||||
|
MemoryStream ms = new MemoryStream();
|
||||||
|
XmlTextWriter xw = new XmlTextWriter(ms, null);
|
||||||
|
xw.Formatting = Formatting.Indented;
|
||||||
|
doc.WriteTo(xw);
|
||||||
|
xw.Flush();
|
||||||
|
|
||||||
|
return ms.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -90,8 +90,6 @@ namespace OpenSim.Server.Handlers.Presence
|
||||||
return GetAgent(request);
|
return GetAgent(request);
|
||||||
case "getagents":
|
case "getagents":
|
||||||
return GetAgents(request);
|
return GetAgents(request);
|
||||||
case "sethome":
|
|
||||||
return SetHome(request);
|
|
||||||
}
|
}
|
||||||
m_log.DebugFormat("[PRESENCE HANDLER]: unknown method request: {0}", method);
|
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))
|
if (!UUID.TryParse(request["SessionID"].ToString(), out session))
|
||||||
return FailureResult();
|
return FailureResult();
|
||||||
|
|
||||||
if (request.ContainsKey("Position") && request["Position"] != null)
|
if (m_PresenceService.LogoutAgent(session))
|
||||||
Vector3.TryParse(request["Position"].ToString(), out position);
|
|
||||||
if (request.ContainsKey("LookAt") && request["Position"] != null)
|
|
||||||
Vector3.TryParse(request["LookAt"].ToString(), out lookat);
|
|
||||||
|
|
||||||
if (m_PresenceService.LogoutAgent(session, position, lookat))
|
|
||||||
return SuccessResult();
|
return SuccessResult();
|
||||||
|
|
||||||
return FailureResult();
|
return FailureResult();
|
||||||
|
@ -171,8 +164,6 @@ namespace OpenSim.Server.Handlers.Presence
|
||||||
{
|
{
|
||||||
UUID session = UUID.Zero;
|
UUID session = UUID.Zero;
|
||||||
UUID region = UUID.Zero;
|
UUID region = UUID.Zero;
|
||||||
Vector3 position = new Vector3(128, 128, 70);
|
|
||||||
Vector3 look = Vector3.Zero;
|
|
||||||
|
|
||||||
if (!request.ContainsKey("SessionID") || !request.ContainsKey("RegionID"))
|
if (!request.ContainsKey("SessionID") || !request.ContainsKey("RegionID"))
|
||||||
return FailureResult();
|
return FailureResult();
|
||||||
|
@ -183,13 +174,7 @@ namespace OpenSim.Server.Handlers.Presence
|
||||||
if (!UUID.TryParse(request["RegionID"].ToString(), out region))
|
if (!UUID.TryParse(request["RegionID"].ToString(), out region))
|
||||||
return FailureResult();
|
return FailureResult();
|
||||||
|
|
||||||
if (request.ContainsKey("position"))
|
if (m_PresenceService.ReportAgent(session, region))
|
||||||
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))
|
|
||||||
{
|
{
|
||||||
return SuccessResult();
|
return SuccessResult();
|
||||||
}
|
}
|
||||||
|
@ -318,31 +303,5 @@ namespace OpenSim.Server.Handlers.Presence
|
||||||
return ms.ToArray();
|
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.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using log4net;
|
||||||
using System;
|
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
|
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>();
|
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
||||||
//sendData["SCOPEID"] = scopeID.ToString();
|
//sendData["SCOPEID"] = scopeID.ToString();
|
||||||
|
@ -141,8 +141,6 @@ namespace OpenSim.Services.Connectors
|
||||||
sendData["METHOD"] = "logout";
|
sendData["METHOD"] = "logout";
|
||||||
|
|
||||||
sendData["SessionID"] = sessionID.ToString();
|
sendData["SessionID"] = sessionID.ToString();
|
||||||
sendData["Position"] = position.ToString();
|
|
||||||
sendData["LookAt"] = lookat.ToString();
|
|
||||||
|
|
||||||
string reqString = ServerUtils.BuildQueryString(sendData);
|
string reqString = ServerUtils.BuildQueryString(sendData);
|
||||||
// m_log.DebugFormat("[PRESENCE CONNECTOR]: queryString = {0}", reqString);
|
// m_log.DebugFormat("[PRESENCE CONNECTOR]: queryString = {0}", reqString);
|
||||||
|
@ -220,7 +218,7 @@ namespace OpenSim.Services.Connectors
|
||||||
return false;
|
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>();
|
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
||||||
//sendData["SCOPEID"] = scopeID.ToString();
|
//sendData["SCOPEID"] = scopeID.ToString();
|
||||||
|
@ -230,8 +228,6 @@ namespace OpenSim.Services.Connectors
|
||||||
|
|
||||||
sendData["SessionID"] = sessionID.ToString();
|
sendData["SessionID"] = sessionID.ToString();
|
||||||
sendData["RegionID"] = regionID.ToString();
|
sendData["RegionID"] = regionID.ToString();
|
||||||
sendData["position"] = position.ToString();
|
|
||||||
sendData["lookAt"] = lookAt.ToString();
|
|
||||||
|
|
||||||
string reqString = ServerUtils.BuildQueryString(sendData);
|
string reqString = ServerUtils.BuildQueryString(sendData);
|
||||||
// m_log.DebugFormat("[PRESENCE CONNECTOR]: queryString = {0}", reqString);
|
// 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
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
/// message routing) to the SimianGrid backend
|
/// message routing) to the SimianGrid backend
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||||
public class SimianPresenceServiceConnector : IPresenceService, ISharedRegionModule
|
public class SimianPresenceServiceConnector : IPresenceService, IGridUserService, ISharedRegionModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log =
|
private static readonly ILog m_log =
|
||||||
LogManager.GetLogger(
|
LogManager.GetLogger(
|
||||||
|
@ -73,6 +73,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
if (!String.IsNullOrEmpty(m_serverUrl))
|
if (!String.IsNullOrEmpty(m_serverUrl))
|
||||||
{
|
{
|
||||||
scene.RegisterModuleInterface<IPresenceService>(this);
|
scene.RegisterModuleInterface<IPresenceService>(this);
|
||||||
|
scene.RegisterModuleInterface<IGridUserService>(this);
|
||||||
|
|
||||||
scene.EventManager.OnMakeRootAgent += MakeRootAgentHandler;
|
scene.EventManager.OnMakeRootAgent += MakeRootAgentHandler;
|
||||||
scene.EventManager.OnNewClient += NewClientHandler;
|
scene.EventManager.OnNewClient += NewClientHandler;
|
||||||
|
@ -86,6 +87,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
if (!String.IsNullOrEmpty(m_serverUrl))
|
if (!String.IsNullOrEmpty(m_serverUrl))
|
||||||
{
|
{
|
||||||
scene.UnregisterModuleInterface<IPresenceService>(this);
|
scene.UnregisterModuleInterface<IPresenceService>(this);
|
||||||
|
scene.UnregisterModuleInterface<IGridUserService>(this);
|
||||||
|
|
||||||
scene.EventManager.OnMakeRootAgent -= MakeRootAgentHandler;
|
scene.EventManager.OnMakeRootAgent -= MakeRootAgentHandler;
|
||||||
scene.EventManager.OnNewClient -= NewClientHandler;
|
scene.EventManager.OnNewClient -= NewClientHandler;
|
||||||
|
@ -151,7 +153,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
return success;
|
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);
|
m_log.InfoFormat("[SIMIAN PRESENCE CONNECTOR]: Logout requested for agent with sessionID " + sessionID);
|
||||||
|
|
||||||
|
@ -189,7 +191,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
return success;
|
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);
|
//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();
|
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);
|
m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Setting home location for user " + userID);
|
||||||
|
|
||||||
|
@ -281,7 +304,35 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
return success;
|
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
|
#region Presence Detection
|
||||||
|
|
||||||
|
@ -325,7 +376,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
SetLastLocation(client.SessionId);
|
SetLastLocation(client.SessionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogoutAgent(client.SessionId, Vector3.Zero, Vector3.UnitX);
|
LogoutAgent(client.SessionId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -478,6 +529,31 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
return info;
|
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)
|
private string SerializeLocation(UUID regionID, Vector3 position, Vector3 lookAt)
|
||||||
{
|
{
|
||||||
return "{" + String.Format("\"SceneID\":\"{0}\",\"Position\":\"{1}\",\"LookAt\":\"{2}\"", regionID, position, 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;
|
static bool m_Initialized = false;
|
||||||
|
|
||||||
protected static IPresenceService m_PresenceService;
|
protected static IGridUserService m_GridUserService;
|
||||||
protected static IGridService m_GridService;
|
protected static IGridService m_GridService;
|
||||||
protected static GatekeeperServiceConnector m_GatekeeperConnector;
|
protected static GatekeeperServiceConnector m_GatekeeperConnector;
|
||||||
|
|
||||||
|
@ -74,14 +74,14 @@ namespace OpenSim.Services.HypergridService
|
||||||
throw new Exception(String.Format("No section UserAgentService in config file"));
|
throw new Exception(String.Format("No section UserAgentService in config file"));
|
||||||
|
|
||||||
string gridService = serverConfig.GetString("GridService", String.Empty);
|
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."));
|
throw new Exception(String.Format("Incomplete specifications, UserAgent Service cannot function."));
|
||||||
|
|
||||||
Object[] args = new Object[] { config };
|
Object[] args = new Object[] { config };
|
||||||
m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
|
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_GatekeeperConnector = new GatekeeperServiceConnector();
|
||||||
|
|
||||||
m_Initialized = true;
|
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);
|
m_log.DebugFormat("[USER AGENT SERVICE]: Request to get home region of user {0}", userID);
|
||||||
|
|
||||||
GridRegion home = null;
|
GridRegion home = null;
|
||||||
PresenceInfo[] presences = m_PresenceService.GetAgents(new string[] { userID.ToString() });
|
GridUserInfo uinfo = m_GridUserService.GetGridUserInfo(userID.ToString());
|
||||||
if (presences != null && presences.Length > 0)
|
if (uinfo != null)
|
||||||
{
|
{
|
||||||
UUID homeID = presences[0].HomeRegionID;
|
if (uinfo.HomeRegionID != UUID.Zero)
|
||||||
if (homeID != UUID.Zero)
|
|
||||||
{
|
{
|
||||||
home = m_GridService.GetRegionByUUID(UUID.Zero, homeID);
|
home = m_GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID);
|
||||||
position = presences[0].HomePosition;
|
position = uinfo.HomePosition;
|
||||||
lookAt = presences[0].HomeLookAt;
|
lookAt = uinfo.HomeLookAt;
|
||||||
}
|
}
|
||||||
if (home == null)
|
if (home == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,39 +37,79 @@ namespace OpenSim.Services.Interfaces
|
||||||
public class GridUserInfo
|
public class GridUserInfo
|
||||||
{
|
{
|
||||||
public string UserID;
|
public string UserID;
|
||||||
|
|
||||||
public UUID HomeRegionID;
|
public UUID HomeRegionID;
|
||||||
public Vector3 HomePosition;
|
public Vector3 HomePosition;
|
||||||
public Vector3 HomeLookAt;
|
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() {}
|
||||||
|
|
||||||
public GridUserInfo(Dictionary<string, object> kvp)
|
public GridUserInfo(Dictionary<string, object> kvp)
|
||||||
{
|
{
|
||||||
if (kvp.ContainsKey("UserID"))
|
if (kvp.ContainsKey("UserID"))
|
||||||
UserID = kvp["UserID"].ToString();
|
UserID = kvp["UserID"].ToString();
|
||||||
|
|
||||||
if (kvp.ContainsKey("HomeRegionID"))
|
if (kvp.ContainsKey("HomeRegionID"))
|
||||||
UUID.TryParse(kvp["HomeRegionID"].ToString(), out HomeRegionID);
|
UUID.TryParse(kvp["HomeRegionID"].ToString(), out HomeRegionID);
|
||||||
if (kvp.ContainsKey("HomePosition"))
|
if (kvp.ContainsKey("HomePosition"))
|
||||||
Vector3.TryParse(kvp["HomePosition"].ToString(), out HomePosition);
|
Vector3.TryParse(kvp["HomePosition"].ToString(), out HomePosition);
|
||||||
if (kvp.ContainsKey("HomeLookAt"))
|
if (kvp.ContainsKey("HomeLookAt"))
|
||||||
Vector3.TryParse(kvp["HomeLookAt"].ToString(), out 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()
|
public Dictionary<string, object> ToKeyValuePairs()
|
||||||
{
|
{
|
||||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||||
result["UserID"] = UserID;
|
result["UserID"] = UserID;
|
||||||
|
|
||||||
result["HomeRegionID"] = HomeRegionID.ToString();
|
result["HomeRegionID"] = HomeRegionID.ToString();
|
||||||
result["HomePosition"] = HomePosition.ToString();
|
result["HomePosition"] = HomePosition.ToString();
|
||||||
result["HomeLookAt"] = HomeLookAt.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;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IGridUserService
|
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);
|
GridUserInfo GetGridUserInfo(string userID);
|
||||||
bool StoreGridUserInfo(GridUserInfo info);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -55,23 +55,6 @@ namespace OpenSim.Services.Interfaces
|
||||||
UserID = kvp["UserID"].ToString();
|
UserID = kvp["UserID"].ToString();
|
||||||
if (kvp.ContainsKey("RegionID"))
|
if (kvp.ContainsKey("RegionID"))
|
||||||
UUID.TryParse(kvp["RegionID"].ToString(), out 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()
|
public Dictionary<string, object> ToKeyValuePairs()
|
||||||
|
@ -79,14 +62,6 @@ namespace OpenSim.Services.Interfaces
|
||||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||||
result["UserID"] = UserID;
|
result["UserID"] = UserID;
|
||||||
result["RegionID"] = RegionID.ToString();
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -115,11 +90,10 @@ namespace OpenSim.Services.Interfaces
|
||||||
public interface IPresenceService
|
public interface IPresenceService
|
||||||
{
|
{
|
||||||
bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID);
|
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 LogoutRegionAgents(UUID regionID);
|
||||||
|
|
||||||
bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt);
|
bool ReportAgent(UUID sessionID, UUID regionID);
|
||||||
bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt);
|
|
||||||
|
|
||||||
PresenceInfo GetAgent(UUID sessionID);
|
PresenceInfo GetAgent(UUID sessionID);
|
||||||
PresenceInfo[] GetAgents(string[] userIDs);
|
PresenceInfo[] GetAgents(string[] userIDs);
|
||||||
|
|
|
@ -220,7 +220,7 @@ namespace OpenSim.Services.LLLoginService
|
||||||
SetDefaultValues();
|
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,
|
GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService,
|
||||||
string where, string startlocation, Vector3 position, Vector3 lookAt, string message,
|
string where, string startlocation, Vector3 position, Vector3 lookAt, string message,
|
||||||
GridRegion home, IPEndPoint clientIP)
|
GridRegion home, IPEndPoint clientIP)
|
||||||
|
@ -288,7 +288,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;
|
int x = 1000 * (int)Constants.RegionSize, y = 1000 * (int)Constants.RegionSize;
|
||||||
if (home != null)
|
if (home != null)
|
||||||
|
|
|
@ -53,6 +53,7 @@ namespace OpenSim.Services.LLLoginService
|
||||||
private static bool Initialized = false;
|
private static bool Initialized = false;
|
||||||
|
|
||||||
protected IUserAccountService m_UserAccountService;
|
protected IUserAccountService m_UserAccountService;
|
||||||
|
protected IGridUserService m_GridUserService;
|
||||||
protected IAuthenticationService m_AuthenticationService;
|
protected IAuthenticationService m_AuthenticationService;
|
||||||
protected IInventoryService m_InventoryService;
|
protected IInventoryService m_InventoryService;
|
||||||
protected IGridService m_GridService;
|
protected IGridService m_GridService;
|
||||||
|
@ -82,6 +83,7 @@ namespace OpenSim.Services.LLLoginService
|
||||||
throw new Exception(String.Format("No section LoginService in config file"));
|
throw new Exception(String.Format("No section LoginService in config file"));
|
||||||
|
|
||||||
string accountService = m_LoginServerConfig.GetString("UserAccountService", String.Empty);
|
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 agentService = m_LoginServerConfig.GetString("UserAgentService", String.Empty);
|
||||||
string authService = m_LoginServerConfig.GetString("AuthenticationService", String.Empty);
|
string authService = m_LoginServerConfig.GetString("AuthenticationService", String.Empty);
|
||||||
string invService = m_LoginServerConfig.GetString("InventoryService", String.Empty);
|
string invService = m_LoginServerConfig.GetString("InventoryService", String.Empty);
|
||||||
|
@ -105,8 +107,10 @@ namespace OpenSim.Services.LLLoginService
|
||||||
|
|
||||||
Object[] args = new Object[] { config };
|
Object[] args = new Object[] { config };
|
||||||
m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
|
m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
|
||||||
|
m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args);
|
||||||
m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args);
|
m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args);
|
||||||
m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args);
|
m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args);
|
||||||
|
|
||||||
if (gridService != string.Empty)
|
if (gridService != string.Empty)
|
||||||
m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
|
m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
|
||||||
if (presenceService != string.Empty)
|
if (presenceService != string.Empty)
|
||||||
|
@ -277,8 +281,6 @@ namespace OpenSim.Services.LLLoginService
|
||||||
//
|
//
|
||||||
// Login the presence
|
// Login the presence
|
||||||
//
|
//
|
||||||
PresenceInfo presence = null;
|
|
||||||
GridRegion home = null;
|
|
||||||
if (m_PresenceService != null)
|
if (m_PresenceService != null)
|
||||||
{
|
{
|
||||||
success = m_PresenceService.LoginAgent(account.PrincipalID.ToString(), session, secureSession);
|
success = m_PresenceService.LoginAgent(account.PrincipalID.ToString(), session, secureSession);
|
||||||
|
@ -287,15 +289,22 @@ namespace OpenSim.Services.LLLoginService
|
||||||
m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: could not login presence");
|
m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: could not login presence");
|
||||||
return LLFailedLoginResponse.GridProblem;
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -305,10 +314,10 @@ namespace OpenSim.Services.LLLoginService
|
||||||
Vector3 position = Vector3.Zero;
|
Vector3 position = Vector3.Zero;
|
||||||
Vector3 lookAt = Vector3.Zero;
|
Vector3 lookAt = Vector3.Zero;
|
||||||
GridRegion gatekeeper = null;
|
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)
|
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");
|
m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: destination not found");
|
||||||
return LLFailedLoginResponse.GridProblem;
|
return LLFailedLoginResponse.GridProblem;
|
||||||
}
|
}
|
||||||
|
@ -330,7 +339,7 @@ namespace OpenSim.Services.LLLoginService
|
||||||
|
|
||||||
if (aCircuit == null)
|
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);
|
m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: {0}", reason);
|
||||||
return LLFailedLoginResponse.AuthorizationProblem;
|
return LLFailedLoginResponse.AuthorizationProblem;
|
||||||
|
|
||||||
|
@ -346,7 +355,7 @@ namespace OpenSim.Services.LLLoginService
|
||||||
//
|
//
|
||||||
// Finally, fill out the response and return it
|
// 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);
|
where, startLocation, position, lookAt, m_WelcomeMessage, home, clientIP);
|
||||||
|
|
||||||
m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client.");
|
m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client.");
|
||||||
|
@ -356,12 +365,12 @@ namespace OpenSim.Services.LLLoginService
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[LLOGIN SERVICE]: Exception processing login for {0} {1}: {2} {3}", firstName, lastName, e.ToString(), e.StackTrace);
|
m_log.WarnFormat("[LLOGIN SERVICE]: Exception processing login for {0} {1}: {2} {3}", firstName, lastName, e.ToString(), e.StackTrace);
|
||||||
if (m_PresenceService != null)
|
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;
|
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);
|
m_log.DebugFormat("[LLOGIN SERVICE]: FindDestination for start location {0}", startLocation);
|
||||||
|
|
||||||
|
@ -383,7 +392,7 @@ namespace OpenSim.Services.LLLoginService
|
||||||
|
|
||||||
bool tryDefaults = false;
|
bool tryDefaults = false;
|
||||||
|
|
||||||
if (pinfo.HomeRegionID.Equals(UUID.Zero))
|
if (home == null)
|
||||||
{
|
{
|
||||||
m_log.WarnFormat(
|
m_log.WarnFormat(
|
||||||
"[LLOGIN SERVICE]: User {0} {1} tried to login to a 'home' start location but they have none set",
|
"[LLOGIN SERVICE]: User {0} {1} tried to login to a 'home' start location but they have none set",
|
||||||
|
@ -393,16 +402,10 @@ namespace OpenSim.Services.LLLoginService
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
region = m_GridService.GetRegionByUUID(scopeID, pinfo.HomeRegionID);
|
region = home;
|
||||||
|
|
||||||
if (null == region)
|
position = pinfo.HomePosition;
|
||||||
{
|
lookAt = pinfo.HomeLookAt;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tryDefaults)
|
if (tryDefaults)
|
||||||
|
@ -438,7 +441,7 @@ namespace OpenSim.Services.LLLoginService
|
||||||
|
|
||||||
GridRegion region = null;
|
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);
|
List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID);
|
||||||
if (defaults != null && defaults.Count > 0)
|
if (defaults != null && defaults.Count > 0)
|
||||||
|
@ -460,8 +463,8 @@ namespace OpenSim.Services.LLLoginService
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
position = pinfo.Position;
|
position = pinfo.LastPosition;
|
||||||
lookAt = pinfo.LookAt;
|
lookAt = pinfo.LastLookAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
return region;
|
return region;
|
||||||
|
|
|
@ -54,8 +54,6 @@ namespace OpenSim.Services.PresenceService
|
||||||
public bool LoginAgent(string userID, UUID sessionID,
|
public bool LoginAgent(string userID, UUID sessionID,
|
||||||
UUID secureSessionID)
|
UUID secureSessionID)
|
||||||
{
|
{
|
||||||
m_Database.Prune(userID);
|
|
||||||
|
|
||||||
PresenceData[] d = m_Database.Get("UserID", userID);
|
PresenceData[] d = m_Database.Get("UserID", userID);
|
||||||
|
|
||||||
PresenceData data = new PresenceData();
|
PresenceData data = new PresenceData();
|
||||||
|
@ -65,24 +63,6 @@ namespace OpenSim.Services.PresenceService
|
||||||
data.SessionID = sessionID;
|
data.SessionID = sessionID;
|
||||||
data.Data = new Dictionary<string, string>();
|
data.Data = new Dictionary<string, string>();
|
||||||
data.Data["SecureSessionID"] = secureSessionID.ToString();
|
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);
|
m_Database.Store(data);
|
||||||
|
|
||||||
|
@ -91,28 +71,10 @@ namespace OpenSim.Services.PresenceService
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool LogoutAgent(UUID sessionID, Vector3 position, Vector3 lookat)
|
public bool LogoutAgent(UUID sessionID)
|
||||||
{
|
{
|
||||||
PresenceData data = m_Database.Get(sessionID);
|
m_log.DebugFormat("[PRESENCE SERVICE]: Session {0} logout", sessionID);
|
||||||
if (data == null)
|
return m_Database.Delete("SessionID", sessionID.ToString());
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool LogoutRegionAgents(UUID regionID)
|
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);
|
m_log.DebugFormat("[PRESENCE SERVICE]: ReportAgent with session {0} in region {1}", sessionID, regionID);
|
||||||
try
|
try
|
||||||
|
@ -134,14 +96,7 @@ namespace OpenSim.Services.PresenceService
|
||||||
if (pdata.Data == null)
|
if (pdata.Data == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!pdata.Data.ContainsKey("Online") || (pdata.Data.ContainsKey("Online") && pdata.Data["Online"] == "false"))
|
return m_Database.ReportAgent(sessionID, regionID);
|
||||||
{
|
|
||||||
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());
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -160,22 +115,10 @@ namespace OpenSim.Services.PresenceService
|
||||||
|
|
||||||
ret.UserID = data.UserID;
|
ret.UserID = data.UserID;
|
||||||
ret.RegionID = data.RegionID;
|
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"))
|
if (data.Data.ContainsKey("Position"))
|
||||||
ret.Position = Vector3.Parse(data.Data["Position"]);
|
ret.Position = Vector3.Parse(data.Data["Position"]);
|
||||||
if (data.Data.ContainsKey("LookAt"))
|
if (data.Data.ContainsKey("LookAt"))
|
||||||
ret.LookAt = Vector3.Parse(data.Data["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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -195,16 +138,8 @@ namespace OpenSim.Services.PresenceService
|
||||||
|
|
||||||
ret.UserID = d.UserID;
|
ret.UserID = d.UserID;
|
||||||
ret.RegionID = d.RegionID;
|
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.Position = Vector3.Parse(d.Data["Position"]);
|
||||||
ret.LookAt = Vector3.Parse(d.Data["LookAt"]);
|
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);
|
info.Add(ret);
|
||||||
}
|
}
|
||||||
|
@ -214,9 +149,5 @@ namespace OpenSim.Services.PresenceService
|
||||||
return info.ToArray();
|
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 Nini.Config;
|
||||||
using OpenSim.Data;
|
using OpenSim.Data;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||||
|
|
||||||
|
@ -50,7 +51,10 @@ namespace OpenSim.Services.UserAccountService
|
||||||
|
|
||||||
public GridUserInfo GetGridUserInfo(string userID)
|
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();
|
GridUserInfo info = new GridUserInfo();
|
||||||
info.UserID = d.UserID;
|
info.UserID = d.UserID;
|
||||||
|
@ -58,19 +62,98 @@ namespace OpenSim.Services.UserAccountService
|
||||||
info.HomePosition = Vector3.Parse(d.Data["HomePosition"]);
|
info.HomePosition = Vector3.Parse(d.Data["HomePosition"]);
|
||||||
info.HomeLookAt = Vector3.Parse(d.Data["HomeLookAt"]);
|
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;
|
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();
|
GridUserData d = new GridUserData();
|
||||||
|
|
||||||
d.Data["UserID"] = info.UserID;
|
|
||||||
d.Data["HomeRegionID"] = info.HomeRegionID.ToString();
|
d.Data["HomeRegionID"] = info.HomeRegionID.ToString();
|
||||||
d.Data["HomePosition"] = info.HomePosition.ToString();
|
d.Data["HomePosition"] = info.HomePosition.ToString();
|
||||||
d.Data["HomeLookAt"] = info.HomeLookAt.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 IGridService m_GridService;
|
||||||
protected IAuthenticationService m_AuthenticationService;
|
protected IAuthenticationService m_AuthenticationService;
|
||||||
protected IPresenceService m_PresenceService;
|
protected IGridUserService m_GridUserService;
|
||||||
protected IInventoryService m_InventoryService;
|
protected IInventoryService m_InventoryService;
|
||||||
|
|
||||||
public UserAccountService(IConfigSource config)
|
public UserAccountService(IConfigSource config)
|
||||||
|
@ -69,9 +69,9 @@ namespace OpenSim.Services.UserAccountService
|
||||||
if (authServiceDll != string.Empty)
|
if (authServiceDll != string.Empty)
|
||||||
m_AuthenticationService = LoadPlugin<IAuthenticationService>(authServiceDll, new Object[] { config });
|
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)
|
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);
|
string invServiceDll = userConfig.GetString("InventoryService", string.Empty);
|
||||||
if (invServiceDll != string.Empty)
|
if (invServiceDll != string.Empty)
|
||||||
|
@ -333,8 +333,8 @@ namespace OpenSim.Services.UserAccountService
|
||||||
if (defaultRegions != null && defaultRegions.Count >= 1)
|
if (defaultRegions != null && defaultRegions.Count >= 1)
|
||||||
home = defaultRegions[0];
|
home = defaultRegions[0];
|
||||||
|
|
||||||
if (m_PresenceService != null && home != null)
|
if (m_GridUserService != null && home != null)
|
||||||
m_PresenceService.SetHomeLocation(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
|
m_GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
|
||||||
else
|
else
|
||||||
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set home for account {0} {1}.",
|
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set home for account {0} {1}.",
|
||||||
firstName, lastName);
|
firstName, lastName);
|
||||||
|
|
|
@ -77,7 +77,7 @@ namespace OpenSim.Tests.Clients.PresenceClient
|
||||||
pinfo.UserID, pinfo.Online, pinfo.RegionID, pinfo.HomeRegionID);
|
pinfo.UserID, pinfo.Online, pinfo.RegionID, pinfo.HomeRegionID);
|
||||||
|
|
||||||
System.Console.WriteLine("\n");
|
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)
|
if (success)
|
||||||
m_log.InfoFormat("[PRESENCE CLIENT]: Successfully reported session {0} in region {1}", user1, region1);
|
m_log.InfoFormat("[PRESENCE CLIENT]: Successfully reported session {0} in region {1}", user1, region1);
|
||||||
else
|
else
|
||||||
|
@ -90,20 +90,7 @@ namespace OpenSim.Tests.Clients.PresenceClient
|
||||||
pinfo.UserID, pinfo.Online, pinfo.RegionID, pinfo.HomeRegionID);
|
pinfo.UserID, pinfo.Online, pinfo.RegionID, pinfo.HomeRegionID);
|
||||||
|
|
||||||
System.Console.WriteLine("\n");
|
System.Console.WriteLine("\n");
|
||||||
success = m_Connector.SetHomeLocation(user1.ToString(), region1, new Vector3(128, 128, 128), new Vector3(4, 5, 6));
|
success = m_Connector.LogoutAgent(session1);
|
||||||
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);
|
|
||||||
if (success)
|
if (success)
|
||||||
m_log.InfoFormat("[PRESENCE CLIENT]: Successfully logged out user {0}", user1);
|
m_log.InfoFormat("[PRESENCE CLIENT]: Successfully logged out user {0}", user1);
|
||||||
else
|
else
|
||||||
|
@ -116,7 +103,7 @@ namespace OpenSim.Tests.Clients.PresenceClient
|
||||||
pinfo.UserID, pinfo.Online, pinfo.RegionID, pinfo.HomeRegionID);
|
pinfo.UserID, pinfo.Online, pinfo.RegionID, pinfo.HomeRegionID);
|
||||||
|
|
||||||
System.Console.WriteLine("\n");
|
System.Console.WriteLine("\n");
|
||||||
success = m_Connector.ReportAgent(session1, UUID.Random(), Vector3.Zero, Vector3.Zero);
|
success = m_Connector.ReportAgent(session1, UUID.Random());
|
||||||
if (success)
|
if (success)
|
||||||
m_log.InfoFormat("[PRESENCE CLIENT]: Report agent succeeded, but this is wrong");
|
m_log.InfoFormat("[PRESENCE CLIENT]: Report agent succeeded, but this is wrong");
|
||||||
else
|
else
|
||||||
|
|
17
README.txt
17
README.txt
|
@ -1,6 +1,6 @@
|
||||||
Welcome to OpenSim!
|
Welcome to OpenSim!
|
||||||
|
|
||||||
== OVERVIEW ==
|
=== OVERVIEW ===
|
||||||
|
|
||||||
OpenSim is a BSD Licensed Open Source project to develop a functioning
|
OpenSim is a BSD Licensed Open Source project to develop a functioning
|
||||||
virtual worlds server platform capable of supporting multiple clients
|
virtual worlds server platform capable of supporting multiple clients
|
||||||
|
@ -10,12 +10,12 @@ C#, and can run under Mono or the Microsoft .NET runtimes.
|
||||||
This is considered an alpha release. Some stuff works, a lot doesn't.
|
This is considered an alpha release. Some stuff works, a lot doesn't.
|
||||||
If it breaks, you get to keep *both* pieces.
|
If it breaks, you get to keep *both* pieces.
|
||||||
|
|
||||||
== Compiling OpenSim ==
|
=== Compiling OpenSim ===
|
||||||
|
|
||||||
Please see BUILDING.txt if you downloaded a source distribution and
|
Please see BUILDING.txt if you downloaded a source distribution and
|
||||||
need to build OpenSim before running it.
|
need to build OpenSim before running it.
|
||||||
|
|
||||||
== Running OpenSim on Windows ==
|
=== Running OpenSim on Windows ===
|
||||||
|
|
||||||
We recommend that you run OpenSim from a command prompt on Windows in order
|
We recommend that you run OpenSim from a command prompt on Windows in order
|
||||||
to capture any errors, though you can also run it by double-clicking
|
to capture any errors, though you can also run it by double-clicking
|
||||||
|
@ -28,7 +28,7 @@ To run OpenSim from a command prompt
|
||||||
|
|
||||||
Now see the "Configuring OpenSim" section
|
Now see the "Configuring OpenSim" section
|
||||||
|
|
||||||
== Running OpenSim on Linux ==
|
=== Running OpenSim on Linux ===
|
||||||
|
|
||||||
You will need Mono >= 2.4.2 to run OpenSim. On some Linux distributions you
|
You will need Mono >= 2.4.2 to run OpenSim. On some Linux distributions you
|
||||||
may need to install additional packages. See http://opensimulator.org/wiki/Dependencies
|
may need to install additional packages. See http://opensimulator.org/wiki/Dependencies
|
||||||
|
@ -41,7 +41,7 @@ To run OpenSim, from the unpacked distribution type:
|
||||||
|
|
||||||
Now see the "Configuring OpenSim" section
|
Now see the "Configuring OpenSim" section
|
||||||
|
|
||||||
== Configuring OpenSim ==
|
=== Configuring OpenSim ===
|
||||||
|
|
||||||
When OpenSim starts for the first time, you will be prompted with a
|
When OpenSim starts for the first time, you will be prompted with a
|
||||||
series of questions that look something like:
|
series of questions that look something like:
|
||||||
|
@ -69,14 +69,14 @@ Helpful resources:
|
||||||
* http://opensimulator.org/wiki/Configuring_Regions
|
* http://opensimulator.org/wiki/Configuring_Regions
|
||||||
* http://opensimulator.org/wiki/Mysql-config
|
* http://opensimulator.org/wiki/Mysql-config
|
||||||
|
|
||||||
== Connecting to your OpenSim ==
|
=== Connecting to your OpenSim ===
|
||||||
|
|
||||||
By default your sim will be running on http://127.0.0.1:9000. To use
|
By default your sim will be running on http://127.0.0.1:9000. To use
|
||||||
your OpenSim add -loginuri http://127.0.0.1:9000 to your second life
|
your OpenSim add -loginuri http://127.0.0.1:9000 to your second life
|
||||||
client (running on the same machine as your OpenSim). To login, use the
|
client (running on the same machine as your OpenSim). To login, use the
|
||||||
same avatar details that you gave to the "create user" console command.
|
same avatar details that you gave to the "create user" console command.
|
||||||
|
|
||||||
== Bug reports ==
|
=== Bug reports ===
|
||||||
|
|
||||||
In the likely event of bugs biting you (err, your OpenSim) we
|
In the likely event of bugs biting you (err, your OpenSim) we
|
||||||
encourage you to see whether the problem has already been reported on
|
encourage you to see whether the problem has already been reported on
|
||||||
|
@ -97,10 +97,11 @@ mantis"). Useful information to include:
|
||||||
|
|
||||||
mono --debug OpenSim.exe
|
mono --debug OpenSim.exe
|
||||||
|
|
||||||
== More Information on OpenSim ==
|
=== More Information on OpenSim ===
|
||||||
|
|
||||||
More extensive information on building, running, and configuring
|
More extensive information on building, running, and configuring
|
||||||
OpenSim, as well as how to report bugs, and participate in the OpenSim
|
OpenSim, as well as how to report bugs, and participate in the OpenSim
|
||||||
project can always be found at http://opensimulator.org.
|
project can always be found at http://opensimulator.org.
|
||||||
|
|
||||||
Thanks for trying OpenSim, we hope it is a pleasant experience.
|
Thanks for trying OpenSim, we hope it is a pleasant experience.
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
;;
|
;;
|
||||||
|
|
||||||
[Startup]
|
[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
|
; * This is common for all services, it's the network setup for the entire
|
||||||
; * server instance, if none if specified above
|
; * 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"
|
GridService = "OpenSim.Services.GridService.dll:GridService"
|
||||||
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
|
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
|
||||||
|
|
||||||
|
[GridUserService]
|
||||||
|
; for the server connector
|
||||||
|
LocalServiceModule = "OpenSim.Services.UserAccountService.dll:GridUserService"
|
||||||
|
|
||||||
[PresenceService]
|
[PresenceService]
|
||||||
; for the server connector
|
; for the server connector
|
||||||
LocalServiceModule = "OpenSim.Services.PresenceService.dll:PresenceService"
|
LocalServiceModule = "OpenSim.Services.PresenceService.dll:PresenceService"
|
||||||
|
@ -114,6 +118,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
|
||||||
LocalServiceModule = "OpenSim.Services.LLLoginService.dll:LLLoginService"
|
LocalServiceModule = "OpenSim.Services.LLLoginService.dll:LLLoginService"
|
||||||
; for the service
|
; for the service
|
||||||
UserAccountService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
|
UserAccountService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
|
||||||
|
GridUserService = "OpenSim.Services.UserAccountService.dll:GridUserService"
|
||||||
AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
||||||
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
|
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
|
||||||
AvatarService = "OpenSim.Services.AvatarService.dll:AvatarService"
|
AvatarService = "OpenSim.Services.AvatarService.dll:AvatarService"
|
||||||
|
@ -196,7 +201,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
|
||||||
[UserAgentService]
|
[UserAgentService]
|
||||||
LocalServiceModule = "OpenSim.Services.HypergridService.dll:UserAgentService"
|
LocalServiceModule = "OpenSim.Services.HypergridService.dll:UserAgentService"
|
||||||
;; for the service
|
;; for the service
|
||||||
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
|
GridUserService = "OpenSim.Services.UserAccountService.dll:GridUserService"
|
||||||
GridService = "OpenSim.Services.GridService.dll:GridService"
|
GridService = "OpenSim.Services.GridService.dll:GridService"
|
||||||
|
|
||||||
;; The interface that local users get when they are in other grids.
|
;; The interface that local users get when they are in other grids.
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
; *
|
; *
|
||||||
[Startup]
|
[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
|
; * This is common for all services, it's the network setup for the entire
|
||||||
; * server instance, if none if specified above
|
; * 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"
|
GridService = "OpenSim.Services.GridService.dll:GridService"
|
||||||
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
|
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
|
||||||
|
|
||||||
|
[GridUserService]
|
||||||
|
; for the server connector
|
||||||
|
LocalServiceModule = "OpenSim.Services.UserAccountService.dll:GridUserService"
|
||||||
|
|
||||||
[PresenceService]
|
[PresenceService]
|
||||||
; for the server connector
|
; for the server connector
|
||||||
LocalServiceModule = "OpenSim.Services.PresenceService.dll:PresenceService"
|
LocalServiceModule = "OpenSim.Services.PresenceService.dll:PresenceService"
|
||||||
|
@ -116,6 +120,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
|
||||||
LocalServiceModule = "OpenSim.Services.LLLoginService.dll:LLLoginService"
|
LocalServiceModule = "OpenSim.Services.LLLoginService.dll:LLLoginService"
|
||||||
; for the service
|
; for the service
|
||||||
UserAccountService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
|
UserAccountService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
|
||||||
|
GridUserService = "OpenSim.Services.UserAccountService.dll:GridUserService"
|
||||||
AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
||||||
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
|
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
|
||||||
AvatarService = "OpenSim.Services.AvatarService.dll:AvatarService"
|
AvatarService = "OpenSim.Services.AvatarService.dll:AvatarService"
|
||||||
|
|
|
@ -14,11 +14,14 @@
|
||||||
AvatarServices = "RemoteAvatarServicesConnector"
|
AvatarServices = "RemoteAvatarServicesConnector"
|
||||||
NeighbourServices = "RemoteNeighbourServicesConnector"
|
NeighbourServices = "RemoteNeighbourServicesConnector"
|
||||||
AuthenticationServices = "RemoteAuthenticationServicesConnector"
|
AuthenticationServices = "RemoteAuthenticationServicesConnector"
|
||||||
|
AuthorizationServices = "RemoteAuthorizationServicesConnector"
|
||||||
PresenceServices = "RemotePresenceServicesConnector"
|
PresenceServices = "RemotePresenceServicesConnector"
|
||||||
UserAccountServices = "RemoteUserAccountServicesConnector"
|
UserAccountServices = "RemoteUserAccountServicesConnector"
|
||||||
|
GridUserServices = "RemoteGridUserServicesConnector"
|
||||||
SimulationServices = "RemoteSimulationConnectorModule"
|
SimulationServices = "RemoteSimulationConnectorModule"
|
||||||
EntityTransferModule = "BasicEntityTransferModule"
|
EntityTransferModule = "BasicEntityTransferModule"
|
||||||
InventoryAccessModule = "BasicInventoryAccessModule"
|
InventoryAccessModule = "BasicInventoryAccessModule"
|
||||||
|
|
||||||
LandServiceInConnector = true
|
LandServiceInConnector = true
|
||||||
NeighbourServiceInConnector = true
|
NeighbourServiceInConnector = true
|
||||||
SimulationServiceInConnector = true
|
SimulationServiceInConnector = true
|
||||||
|
|
|
@ -40,6 +40,12 @@
|
||||||
;
|
;
|
||||||
UserAccountServerURI = "http://mygridserver.com:8003"
|
UserAccountServerURI = "http://mygridserver.com:8003"
|
||||||
|
|
||||||
|
[GridUserService]
|
||||||
|
;
|
||||||
|
; change this to your grid-wide user accounts server
|
||||||
|
;
|
||||||
|
GridUserServerURI = "http://mygridserver.com:8003"
|
||||||
|
|
||||||
[AuthenticationService]
|
[AuthenticationService]
|
||||||
;
|
;
|
||||||
; change this to your grid-wide authentication server
|
; change this to your grid-wide authentication server
|
||||||
|
|
|
@ -14,12 +14,14 @@
|
||||||
AvatarServices = "RemoteAvatarServicesConnector"
|
AvatarServices = "RemoteAvatarServicesConnector"
|
||||||
NeighbourServices = "RemoteNeighbourServicesConnector"
|
NeighbourServices = "RemoteNeighbourServicesConnector"
|
||||||
AuthenticationServices = "RemoteAuthenticationServicesConnector"
|
AuthenticationServices = "RemoteAuthenticationServicesConnector"
|
||||||
AuthorizationServices = "LocalAuthorizationServicesConnector"
|
AuthorizationServices = "RemoteAuthorizationServicesConnector"
|
||||||
PresenceServices = "RemotePresenceServicesConnector"
|
PresenceServices = "RemotePresenceServicesConnector"
|
||||||
UserAccountServices = "RemoteUserAccountServicesConnector"
|
UserAccountServices = "RemoteUserAccountServicesConnector"
|
||||||
|
GridUserServices = "RemoteGridUserServicesConnector"
|
||||||
SimulationServices = "RemoteSimulationConnectorModule"
|
SimulationServices = "RemoteSimulationConnectorModule"
|
||||||
EntityTransferModule = "HGEntityTransferModule"
|
EntityTransferModule = "HGEntityTransferModule"
|
||||||
InventoryAccessModule = "HGInventoryAccessModule"
|
InventoryAccessModule = "HGInventoryAccessModule"
|
||||||
|
|
||||||
LandServiceInConnector = true
|
LandServiceInConnector = true
|
||||||
NeighbourServiceInConnector = true
|
NeighbourServiceInConnector = true
|
||||||
SimulationServiceInConnector = true
|
SimulationServiceInConnector = true
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
AvatarServices = "LocalAvatarServicesConnector"
|
AvatarServices = "LocalAvatarServicesConnector"
|
||||||
EntityTransferModule = "BasicEntityTransferModule"
|
EntityTransferModule = "BasicEntityTransferModule"
|
||||||
InventoryAccessModule = "BasicInventoryAccessModule"
|
InventoryAccessModule = "BasicInventoryAccessModule"
|
||||||
|
|
||||||
LibraryModule = true
|
LibraryModule = true
|
||||||
LLLoginServiceInConnector = true
|
LLLoginServiceInConnector = true
|
||||||
|
|
||||||
|
@ -54,7 +55,7 @@
|
||||||
|
|
||||||
;; These are for creating new accounts
|
;; These are for creating new accounts
|
||||||
AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
||||||
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
|
GridUserService = "OpenSim.Services.UserAccountService.dll:GridUserService"
|
||||||
GridService = "OpenSim.Services.GridService.dll:GridService"
|
GridService = "OpenSim.Services.GridService.dll:GridService"
|
||||||
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
|
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
|
||||||
|
|
||||||
|
@ -70,6 +71,7 @@
|
||||||
[LoginService]
|
[LoginService]
|
||||||
LocalServiceModule = "OpenSim.Services.LLLoginService.dll:LLLoginService"
|
LocalServiceModule = "OpenSim.Services.LLLoginService.dll:LLLoginService"
|
||||||
UserAccountService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
|
UserAccountService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
|
||||||
|
GridUserService = "OpenSim.Services.UserAccountService.dll:GridUserService"
|
||||||
AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
||||||
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
|
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
|
||||||
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
|
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
|
||||||
|
|
|
@ -12,10 +12,12 @@
|
||||||
GridServices = "LocalGridServicesConnector"
|
GridServices = "LocalGridServicesConnector"
|
||||||
PresenceServices = "LocalPresenceServicesConnector"
|
PresenceServices = "LocalPresenceServicesConnector"
|
||||||
UserAccountServices = "LocalUserAccountServicesConnector"
|
UserAccountServices = "LocalUserAccountServicesConnector"
|
||||||
|
GridUserServices = "LocalGridUserServicesConnector"
|
||||||
SimulationServices = "RemoteSimulationConnectorModule"
|
SimulationServices = "RemoteSimulationConnectorModule"
|
||||||
AvatarServices = "LocalAvatarServicesConnector"
|
AvatarServices = "LocalAvatarServicesConnector"
|
||||||
EntityTransferModule = "HGEntityTransferModule"
|
EntityTransferModule = "HGEntityTransferModule"
|
||||||
InventoryAccessModule = "HGInventoryAccessModule"
|
InventoryAccessModule = "HGInventoryAccessModule"
|
||||||
|
|
||||||
InventoryServiceInConnector = true
|
InventoryServiceInConnector = true
|
||||||
AssetServiceInConnector = true
|
AssetServiceInConnector = true
|
||||||
HypergridServiceInConnector = true
|
HypergridServiceInConnector = true
|
||||||
|
@ -68,10 +70,10 @@
|
||||||
|
|
||||||
[UserAccountService]
|
[UserAccountService]
|
||||||
LocalServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService"
|
LocalServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService"
|
||||||
ConnectionString = "URI=file:userprofiles.db,version=3"
|
|
||||||
;; These are for creating new accounts by the service
|
;; These are for creating new accounts by the service
|
||||||
AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
||||||
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
|
GridUserService = "OpenSim.Services.UserAccountService.dll:GridUserService"
|
||||||
GridService = "OpenSim.Services.GridService.dll:GridService"
|
GridService = "OpenSim.Services.GridService.dll:GridService"
|
||||||
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
|
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
|
||||||
|
|
||||||
|
@ -85,6 +87,7 @@
|
||||||
[LoginService]
|
[LoginService]
|
||||||
LocalServiceModule = "OpenSim.Services.LLLoginService.dll:LLLoginService"
|
LocalServiceModule = "OpenSim.Services.LLLoginService.dll:LLLoginService"
|
||||||
UserAccountService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
|
UserAccountService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
|
||||||
|
GridUserService = "OpenSim.Services.UserAccountService.dll:GridUserService"
|
||||||
UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService"
|
UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService"
|
||||||
AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
||||||
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
|
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
|
||||||
|
@ -106,7 +109,7 @@
|
||||||
[UserAgentService]
|
[UserAgentService]
|
||||||
LocalServiceModule = "OpenSim.Services.HypergridService.dll:UserAgentService"
|
LocalServiceModule = "OpenSim.Services.HypergridService.dll:UserAgentService"
|
||||||
;; for the service
|
;; for the service
|
||||||
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
|
GridUserService = "OpenSim.Services.UserAccountService.dll:GridUserService"
|
||||||
GridService = "OpenSim.Services.GridService.dll:GridService"
|
GridService = "OpenSim.Services.GridService.dll:GridService"
|
||||||
|
|
||||||
;; The interface that local users get when they are in other grids
|
;; The interface that local users get when they are in other grids
|
||||||
|
|
|
@ -17,6 +17,9 @@
|
||||||
[UserAccountService]
|
[UserAccountService]
|
||||||
ConnectionString = "URI=file:userprofiles.db,version=3"
|
ConnectionString = "URI=file:userprofiles.db,version=3"
|
||||||
|
|
||||||
|
[GridUserService]
|
||||||
|
ConnectionString = "URI=file:griduser.db,version=3"
|
||||||
|
|
||||||
[FriendsService]
|
[FriendsService]
|
||||||
ConnectionString = "URI=file:friends.db,version=3"
|
ConnectionString = "URI=file:friends.db,version=3"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue