Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor

avinationmerge
Tom Grimshaw 2010-05-10 05:44:24 -07:00
commit 2e94c75729
39 changed files with 297 additions and 212 deletions

View File

@ -1237,9 +1237,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
}
else
{
PresenceInfo[] pinfos = m_app.SceneManager.CurrentOrFirstScene.PresenceService.GetAgents(new string[] { account.PrincipalID.ToString() });
if (pinfos != null && pinfos.Length >= 1)
responseData["lastlogin"] = pinfos[0].Login;
GridUserInfo guinfo = m_app.SceneManager.CurrentOrFirstScene.GridUserService.GetGridUserInfo(account.PrincipalID.ToString());
if (guinfo != null)
responseData["lastlogin"] = guinfo.Login;
else
responseData["lastlogin"] = 0;

View File

@ -48,5 +48,6 @@ namespace OpenSim.Data
public abstract void Initialise(string connect);
public abstract void Initialise();
public abstract void Dispose();
public abstract bool Delete(string id);
}
}

View File

@ -38,6 +38,7 @@ namespace OpenSim.Data
bool ExistsAsset(UUID uuid);
List<AssetMetadata> FetchAssetMetadataSet(int start, int count);
void Initialise(string connect);
bool Delete(string id);
}
public class AssetDataInitialiser : PluginInitialiserBase

View File

@ -322,6 +322,10 @@ namespace OpenSim.Data.MSSQL
return retList;
}
public override bool Delete(string id)
{
return false;
}
#endregion
}
}

View File

@ -111,7 +111,7 @@ namespace OpenSim.Data.MySQL
dbcon.Open();
using (MySqlCommand cmd = new MySqlCommand(
"SELECT name, description, assetType, local, temporary, data FROM assets WHERE id=?id",
"SELECT name, description, assetType, local, temporary, asset_flags, data FROM assets WHERE id=?id",
dbcon))
{
cmd.Parameters.AddWithValue("?id", assetID.ToString());
@ -133,6 +133,7 @@ namespace OpenSim.Data.MySQL
asset.Local = false;
asset.Temporary = Convert.ToBoolean(dbReader["temporary"]);
asset.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]);
}
}
}
@ -161,8 +162,8 @@ namespace OpenSim.Data.MySQL
MySqlCommand cmd =
new MySqlCommand(
"replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, data)" +
"VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?data)",
"replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, data)" +
"VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?data)",
dbcon);
string assetName = asset.Name;
@ -194,6 +195,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?temporary", asset.Temporary);
cmd.Parameters.AddWithValue("?create_time", now);
cmd.Parameters.AddWithValue("?access_time", now);
cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
cmd.Parameters.AddWithValue("?data", asset.Data);
cmd.ExecuteNonQuery();
cmd.Dispose();
@ -302,7 +304,7 @@ namespace OpenSim.Data.MySQL
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
MySqlCommand cmd = new MySqlCommand("SELECT name,description,assetType,temporary,id FROM assets LIMIT ?start, ?count", dbcon);
MySqlCommand cmd = new MySqlCommand("SELECT name,description,assetType,temporary,id,asset_flags FROM assets LIMIT ?start, ?count", dbcon);
cmd.Parameters.AddWithValue("?start", start);
cmd.Parameters.AddWithValue("?count", count);
@ -317,6 +319,7 @@ namespace OpenSim.Data.MySQL
metadata.Description = (string)dbReader["description"];
metadata.Type = (sbyte)dbReader["assetType"];
metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct.
metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]);
metadata.FullID = new UUID((string)dbReader["id"]);
// Current SHA1s are not stored/computed.
@ -336,6 +339,24 @@ namespace OpenSim.Data.MySQL
return retList;
}
public override bool Delete(string id)
{
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
MySqlCommand cmd = new MySqlCommand("delete from assets where id=?id", dbcon);
cmd.Parameters.AddWithValue("?id", id);
cmd.ExecuteNonQuery();
cmd.Dispose();
}
}
return true;
}
#endregion
}
}

View File

@ -975,7 +975,7 @@ namespace OpenSim.Data.MySQL
"use_estate_sun, fixed_sun, sun_position, " +
"covenant, Sandbox, sunvectorx, sunvectory, " +
"sunvectorz, loaded_creation_datetime, " +
"loaded_creation_id) values (?RegionUUID, ?BlockTerraform, " +
"loaded_creation_id, map_tile_ID) values (?RegionUUID, ?BlockTerraform, " +
"?BlockFly, ?AllowDamage, ?RestrictPushing, " +
"?AllowLandResell, ?AllowLandJoinDivide, " +
"?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " +
@ -989,7 +989,8 @@ namespace OpenSim.Data.MySQL
"?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " +
"?SunPosition, ?Covenant, ?Sandbox, " +
"?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
"?LoadedCreationDateTime, ?LoadedCreationID)";
"?LoadedCreationDateTime, ?LoadedCreationID, " +
"?TerrainImageID)";
FillRegionSettingsCommand(cmd, rs);
@ -1276,6 +1277,8 @@ namespace OpenSim.Data.MySQL
else
newSettings.LoadedCreationID = (String) row["loaded_creation_id"];
newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]);
return newSettings;
}
@ -1596,6 +1599,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("Covenant", settings.Covenant.ToString());
cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime);
cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID);
cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID);
}

View File

@ -0,0 +1,5 @@
BEGIN;
ALTER TABLE assets ADD COLUMN asset_flags INTEGER NOT NULL DEFAULT 0;
COMMIT;

View File

@ -0,0 +1,3 @@
BEGIN;
ALTER TABLE regionsettings ADD map_tile_ID CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
COMMIT;

View File

@ -40,7 +40,7 @@ namespace OpenSim.Data.Null
{
private static NullRegionData Instance = null;
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
Dictionary<UUID, RegionData> m_regionData = new Dictionary<UUID, RegionData>();
@ -62,12 +62,14 @@ namespace OpenSim.Data.Null
{
if (regionName.Contains("%"))
{
if (r.RegionName.Contains(regionName.Replace("%", "")))
string cleanname = regionName.Replace("%", "");
m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanname.ToLower(), r.RegionName.ToLower());
if (r.RegionName.ToLower().Contains(cleanname.ToLower()))
ret.Add(r);
}
else
{
if (r.RegionName == regionName)
if (r.RegionName.ToLower() == regionName.ToLower())
ret.Add(r);
}
}

View File

@ -0,0 +1,5 @@
BEGIN;
ALTER TABLE assets ADD COLUMN asset_flags INTEGER NOT NULL DEFAULT 0;
COMMIT;

View File

@ -0,0 +1,5 @@
BEGIN;
ALTER TABLE regionsettings ADD COLUMN map_tile_ID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000';
COMMIT;

View File

@ -44,10 +44,10 @@ namespace OpenSim.Data.SQLite
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private const string SelectAssetSQL = "select * from assets where UUID=:UUID";
private const string SelectAssetMetadataSQL = "select Name, Description, Type, Temporary, UUID from assets limit :start, :count";
private const string SelectAssetMetadataSQL = "select Name, Description, Type, Temporary, asset_flags, UUID from assets limit :start, :count";
private const string DeleteAssetSQL = "delete from assets where UUID=:UUID";
private const string InsertAssetSQL = "insert into assets(UUID, Name, Description, Type, Local, Temporary, Data) values(:UUID, :Name, :Description, :Type, :Local, :Temporary, :Data)";
private const string UpdateAssetSQL = "update assets set Name=:Name, Description=:Description, Type=:Type, Local=:Local, Temporary=:Temporary, Data=:Data where UUID=:UUID";
private const string InsertAssetSQL = "insert into assets(UUID, Name, Description, Type, Local, Temporary, asset_flags, Data) values(:UUID, :Name, :Description, :Type, :Local, :Temporary, :Flags, :Data)";
private const string UpdateAssetSQL = "update assets set Name=:Name, Description=:Description, Type=:Type, Local=:Local, Temporary=:Temporary, asset_flags=:Flags, Data=:Data where UUID=:UUID";
private const string assetSelect = "select * from assets";
private SqliteConnection m_conn;
@ -136,6 +136,7 @@ namespace OpenSim.Data.SQLite
cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type));
cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
cmd.Parameters.Add(new SqliteParameter(":Flags", asset.Flags));
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
cmd.ExecuteNonQuery();
@ -154,6 +155,7 @@ namespace OpenSim.Data.SQLite
cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type));
cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
cmd.Parameters.Add(new SqliteParameter(":Flags", asset.Flags));
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
cmd.ExecuteNonQuery();
@ -207,20 +209,6 @@ namespace OpenSim.Data.SQLite
}
}
/// <summary>
/// Delete an asset from database
/// </summary>
/// <param name="uuid"></param>
public void DeleteAsset(UUID uuid)
{
using (SqliteCommand cmd = new SqliteCommand(DeleteAssetSQL, m_conn))
{
cmd.Parameters.Add(new SqliteParameter(":UUID", uuid.ToString()));
cmd.ExecuteNonQuery();
}
}
/// <summary>
///
/// </summary>
@ -241,7 +229,8 @@ namespace OpenSim.Data.SQLite
asset.Description = (String) row["Description"];
asset.Local = Convert.ToBoolean(row["Local"]);
asset.Temporary = Convert.ToBoolean(row["Temporary"]);
asset.Data = (byte[]) row["Data"];
asset.Flags = (AssetFlags)Convert.ToInt32(row["asset_flags"]);
asset.Data = (byte[])row["Data"];
return asset;
}
@ -254,6 +243,7 @@ namespace OpenSim.Data.SQLite
metadata.Description = (string) row["Description"];
metadata.Type = Convert.ToSByte(row["Type"]);
metadata.Temporary = Convert.ToBoolean(row["Temporary"]); // Not sure if this is correct.
metadata.Flags = (AssetFlags)Convert.ToInt32(row["asset_flags"]);
// Current SHA1s are not stored/computed.
metadata.SHA1 = new byte[] {};
@ -338,6 +328,26 @@ namespace OpenSim.Data.SQLite
get { return "SQLite Asset storage engine"; }
}
public override bool Delete(string id)
{
UUID assetID;
if (!UUID.TryParse(id, out assetID))
return false;
lock (this)
{
using (SqliteCommand cmd = new SqliteCommand(DeleteAssetSQL, m_conn))
{
cmd.Parameters.Add(new SqliteParameter(":UUID", assetID.ToString()));
cmd.ExecuteNonQuery();
}
}
return true;
}
#endregion
}
}

View File

@ -1156,6 +1156,7 @@ namespace OpenSim.Data.SQLite
createCol(regionsettings, "fixed_sun", typeof (Int32));
createCol(regionsettings, "sun_position", typeof (Double));
createCol(regionsettings, "covenant", typeof(String));
createCol(regionsettings, "map_tile_ID", typeof(String));
regionsettings.PrimaryKey = new DataColumn[] { regionsettings.Columns["regionUUID"] };
return regionsettings;
}
@ -1474,6 +1475,7 @@ namespace OpenSim.Data.SQLite
newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]);
newSettings.SunPosition = Convert.ToDouble(row["sun_position"]);
newSettings.Covenant = new UUID((String) row["covenant"]);
newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]);
return newSettings;
}
@ -1792,6 +1794,7 @@ namespace OpenSim.Data.SQLite
row["fixed_sun"] = settings.FixedSun;
row["sun_position"] = settings.SunPosition;
row["covenant"] = settings.Covenant.ToString();
row["map_tile_ID"] = settings.TerrainImageID.ToString();
}
/// <summary>

View File

@ -338,6 +338,10 @@ namespace OpenSim.Data.SQLiteLegacy
get { return "SQLite Asset storage engine"; }
}
public override bool Delete(string id)
{
return false;
}
#endregion
}
}
}

View File

@ -33,6 +33,15 @@ using OpenMetaverse;
namespace OpenSim.Framework
{
[Flags]
public enum AssetFlags : int
{
Normal = 0, // Immutable asset
Maptile = 1, // What it says
Rewritable = 2, // Content can be rewritten
Collectable = 4 // Can be GC'ed after some time
}
/// <summary>
/// Asset class. All Assets are reference by this class or a class derived from this class
/// </summary>
@ -206,6 +215,12 @@ namespace OpenSim.Framework
set { m_metadata.Temporary = value; }
}
public AssetFlags Flags
{
get { return m_metadata.Flags; }
set { m_metadata.Flags = value; }
}
[XmlIgnore]
public AssetMetadata Metadata
{
@ -233,6 +248,7 @@ namespace OpenSim.Framework
private bool m_local;
private bool m_temporary;
private string m_creatorid;
private AssetFlags m_flags;
public UUID FullID
{
@ -330,5 +346,11 @@ namespace OpenSim.Framework
get { return m_creatorid; }
set { m_creatorid = value; }
}
public AssetFlags Flags
{
get { return m_flags; }
set { m_flags = value; }
}
}
}

View File

@ -365,7 +365,7 @@ namespace OpenSim
// moved these here as the terrain texture has to be created after the modules are initialized
// and has to happen before the region is registered with the grid.
scene.CreateTerrainTexture(false);
scene.CreateTerrainTexture();
// TODO : Try setting resource for region xstats here on scene
MainServer.Instance.AddStreamHandler(new Region.Framework.Scenes.RegionStatsHandler(regionInfo));

View File

@ -121,6 +121,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
UUID textureID;
if (!String.IsNullOrEmpty(textureStr) && UUID.TryParse(textureStr, out textureID))
{
//m_log.DebugFormat("[GETTEXTURE]: {0}", textureID);
AssetBase texture;
if (!String.IsNullOrEmpty(REDIRECT_URL))
@ -167,6 +168,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
private void SendTexture(OSHttpRequest request, OSHttpResponse response, AssetBase texture)
{
string range = request.Headers.GetOne("Range");
//m_log.DebugFormat("[GETTEXTURE]: Range {0}", range);
if (!String.IsNullOrEmpty(range))
{
// Range request

View File

@ -345,8 +345,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, new UUID(im.fromAgentID));
im.fromAgentName = account.FirstName + " " + account.LastName;
PresenceInfo presence = null;
PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid });
PresenceInfo presence = PresenceInfo.GetOnlinePresence(presences);
if (presences != null && presences.Length > 0)
presence = presences[0];
if (presence != null)
im.offline = 0;
@ -380,13 +382,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray());
foreach (PresenceInfo pi in presence)
{
if (pi.Online)
{
online.Add(new UUID(pi.UserID));
//m_log.DebugFormat("[XXX] {0} friend online {1}", userID, pi.UserID);
}
}
online.Add(new UUID(pi.UserID));
//m_log.DebugFormat("[XXX] {0} friend online {1}", userID, pi.UserID);
return online;
}
@ -495,11 +492,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// The friend is not here [as root]. Let's forward.
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions);
if (friendSession != null)
if (friendSessions != null && friendSessions.Length > 0)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
}
}
// Friend is not online. Ignore.
@ -537,13 +537,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// The prospective friend is not here [as root]. Let's forward.
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions);
if (friendSession != null)
if (friendSessions != null && friendSessions.Length > 0)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message);
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message);
}
}
// If the prospective friend is not online, he'll get the message upon login.
}
@ -569,14 +571,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// The friend is not here
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions);
if (friendSession != null)
if (friendSessions != null && friendSessions.Length > 0)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID);
client.SendAgentOnline(new UUID[] { friendID });
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID);
client.SendAgentOnline(new UUID[] { friendID });
}
}
}
private void OnDenyFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders)
@ -595,11 +599,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return;
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions);
if (friendSession != null)
if (friendSessions != null && friendSessions.Length > 0)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
}
}
}
@ -622,11 +629,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return;
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() });
PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions);
if (friendSession != null)
if (friendSessions != null && friendSessions.Length > 0)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID);
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID);
}
}
}
@ -664,13 +674,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return;
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() });
PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions);
if (friendSession != null)
if (friendSessions != null && friendSessions.Length > 0)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
// TODO: You might want to send the delta to save the lookup
// on the other end!!
m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
// TODO: You might want to send the delta to save the lookup
// on the other end!!
m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
}
}
}
}

View File

@ -471,7 +471,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
if (m_UserRegionMap.ContainsKey(toAgentID))
{
upd = new PresenceInfo();
upd.Online = true;
upd.RegionID = m_UserRegionMap[toAgentID];
// We need to compare the current regionhandle with the previous region handle
@ -493,15 +492,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
{
// Non-cached user agent lookup.
PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() });
if (presences != null)
{
foreach (PresenceInfo p in presences)
if (p.Online)
{
upd = presences[0];
break;
}
}
if (presences != null && presences.Length > 0)
upd = presences[0];
if (upd != null)
{
@ -525,61 +517,53 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
if (upd != null)
{
if (upd.Online)
GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID,
upd.RegionID);
if (reginfo != null)
{
GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID,
upd.RegionID);
if (reginfo != null)
Hashtable msgdata = ConvertGridInstantMessageToXMLRPC(im);
// Not actually used anymore, left in for compatibility
// Remove at next interface change
//
msgdata["region_handle"] = 0;
bool imresult = doIMSending(reginfo, msgdata);
if (imresult)
{
Hashtable msgdata = ConvertGridInstantMessageToXMLRPC(im);
// Not actually used anymore, left in for compatibility
// Remove at next interface change
//
msgdata["region_handle"] = 0;
bool imresult = doIMSending(reginfo, msgdata);
if (imresult)
// IM delivery successful, so store the Agent's location in our local cache.
lock (m_UserRegionMap)
{
// IM delivery successful, so store the Agent's location in our local cache.
lock (m_UserRegionMap)
if (m_UserRegionMap.ContainsKey(toAgentID))
{
if (m_UserRegionMap.ContainsKey(toAgentID))
{
m_UserRegionMap[toAgentID] = upd.RegionID;
}
else
{
m_UserRegionMap.Add(toAgentID, upd.RegionID);
}
m_UserRegionMap[toAgentID] = upd.RegionID;
}
else
{
m_UserRegionMap.Add(toAgentID, upd.RegionID);
}
result(true);
}
else
{
// try again, but lookup user this time.
// Warning, this must call the Async version
// of this method or we'll be making thousands of threads
// The version within the spawned thread is SendGridInstantMessageViaXMLRPCAsync
// The version that spawns the thread is SendGridInstantMessageViaXMLRPC
// This is recursive!!!!!
SendGridInstantMessageViaXMLRPCAsync(im, result,
upd.RegionID);
}
result(true);
}
else
{
m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", upd.RegionID);
HandleUndeliveredMessage(im, result);
// try again, but lookup user this time.
// Warning, this must call the Async version
// of this method or we'll be making thousands of threads
// The version within the spawned thread is SendGridInstantMessageViaXMLRPCAsync
// The version that spawns the thread is SendGridInstantMessageViaXMLRPC
// This is recursive!!!!!
SendGridInstantMessageViaXMLRPCAsync(im, result,
upd.RegionID);
}
}
else
{
m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", upd.RegionID);
HandleUndeliveredMessage(im, result);
}
}
else
{
m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find user {0}", toAgentID);
HandleUndeliveredMessage(im, result);
}
}

View File

@ -133,20 +133,14 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
foreach (PresenceInfo pi in status)
{
UUID uuid = new UUID(pi.UserID);
if (pi.Online)
{
if (!online.Contains(uuid))
{
online.Add(uuid);
if (offline.Contains(uuid))
offline.Remove(uuid);
}
}
else
{
if (!online.Contains(uuid) && !offline.Contains(uuid))
offline.Add(uuid);
}
if (!online.Contains(uuid))
online.Add(uuid);
}
foreach (string s in args)
{
UUID uuid = new UUID(s);
if (!online.Contains(uuid) && !offline.Contains(uuid))
offline.Add(uuid);
}
if (online.Count > 0)

View File

@ -245,6 +245,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return;
}
// Let's find out if this is a foreign user or a local user
UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, obj.AgentId);
if (account != null)
{
// local grid user
return;
}
AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode);
if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))

View File

@ -197,7 +197,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
if (grinfo != null)
{
//m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetRegionsByName {0} found {1} regions", name, grinfo.Count);
rinfo.AddRange(grinfo);
foreach (GridRegion r in grinfo)
if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null)
rinfo.Add(r);
}
return rinfo;

View File

@ -1000,7 +1000,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
return responsemap;
}
public void LazySaveGeneratedMaptile(byte[] data, bool temporary)
public void RegenerateMaptile(byte[] data)
{
// Overwrites the local Asset cache with new maptile data
// Assets are single write, this causes the asset server to ignore this update,
@ -1010,7 +1010,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
// map tile while protecting the (grid) asset database from bloat caused by a new asset each
// time a mapimage is generated!
UUID lastMapRegionUUID = m_scene.RegionInfo.lastMapUUID;
UUID lastMapRegionUUID = m_scene.RegionInfo.RegionSettings.TerrainImageID;
int lastMapRefresh = 0;
int twoDays = 172800;
@ -1030,21 +1030,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
{
}
UUID TerrainImageUUID = UUID.Random();
m_log.Debug("[MAPTILE]: STORING MAPTILE IMAGE");
if (lastMapRegionUUID == UUID.Zero || (lastMapRefresh + RefreshSeconds) < Util.UnixTimeSinceEpoch())
{
m_scene.RegionInfo.SaveLastMapUUID(TerrainImageUUID);
m_log.Debug("[MAPTILE]: STORING MAPTILE IMAGE");
}
else
{
TerrainImageUUID = lastMapRegionUUID;
m_log.Debug("[MAPTILE]: REUSING OLD MAPTILE IMAGE ID");
}
m_scene.RegionInfo.RegionSettings.TerrainImageID = TerrainImageUUID;
m_scene.RegionInfo.RegionSettings.TerrainImageID = UUID.Random();
AssetBase asset = new AssetBase(
m_scene.RegionInfo.RegionSettings.TerrainImageID,
@ -1053,8 +1041,17 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
m_scene.RegionInfo.RegionID.ToString());
asset.Data = data;
asset.Description = m_scene.RegionInfo.RegionName;
asset.Temporary = temporary;
asset.Temporary = false;
asset.Flags = AssetFlags.Maptile;
// Store the new one
m_log.DebugFormat("[WORLDMAP]: Storing map tile {0}", asset.ID);
m_scene.AssetService.Store(asset);
m_scene.RegionInfo.RegionSettings.Save();
// Delete the old one
m_log.DebugFormat("[WORLDMAP]: Deleting old map tile {0}", lastMapRegionUUID);
m_scene.AssetService.Delete(lastMapRegionUUID.ToString());
}
private void MakeRootAgent(ScenePresence avatar)

View File

@ -29,6 +29,6 @@ namespace OpenSim.Region.Framework.Interfaces
{
public interface IWorldMapModule
{
void LazySaveGeneratedMaptile(byte[] data, bool temporary);
void RegenerateMaptile(byte[] data);
}
}

View File

@ -1851,7 +1851,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary>
/// Create a terrain texture for this scene
/// </summary>
public void CreateTerrainTexture(bool temporary)
public void CreateTerrainTexture()
{
//create a texture asset of the terrain
IMapImageGenerator terrain = RequestModuleInterface<IMapImageGenerator>();
@ -1869,7 +1869,9 @@ namespace OpenSim.Region.Framework.Scenes
IWorldMapModule mapModule = RequestModuleInterface<IWorldMapModule>();
if (mapModule != null)
mapModule.LazySaveGeneratedMaptile(data, temporary);
mapModule.RegenerateMaptile(data);
else
m_log.DebugFormat("[SCENE]: MapModule is null, can't save maptile");
}
}

View File

@ -4108,8 +4108,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid);
PresenceInfo pinfo = null;
PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
PresenceInfo pinfo = PresenceInfo.GetOnlinePresence(pinfos);
if (pinfos != null && pinfos.Length > 0)
pinfo = pinfos[0];
if (pinfo == null)
return UUID.Zero.ToString();
@ -5822,7 +5824,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llGetLandOwnerAt(LSL_Vector pos)
{
m_host.AddScriptLPS(1);
return World.LandChannel.GetLandObject((float)pos.x, (float)pos.y).LandData.OwnerID.ToString();
ILandObject land = World.LandChannel.GetLandObject((float)pos.x, (float)pos.y);
if (land == null)
return UUID.Zero.ToString();
return land.LandData.OwnerID.ToString();
}
/// <summary>

View File

@ -485,7 +485,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
}
else
{
// If full circle is asked for, just add it
sensedEntities.Add(new SensedEntity(dis, presence.UUID));
}
}

View File

@ -59,9 +59,11 @@ namespace OpenSim.Server.Handlers.Asset
m_AssetService =
ServerUtils.LoadPlugin<IAssetService>(assetService, args);
bool allowDelete = serverConfig.GetBoolean("AllowRemoteDelete", false);
server.AddStreamHandler(new AssetServerGetHandler(m_AssetService));
server.AddStreamHandler(new AssetServerPostHandler(m_AssetService));
server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService));
server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowDelete));
}
}
}

View File

@ -47,11 +47,13 @@ namespace OpenSim.Server.Handlers.Asset
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IAssetService m_AssetService;
protected bool m_allowDelete;
public AssetServerDeleteHandler(IAssetService service) :
public AssetServerDeleteHandler(IAssetService service, bool allowDelete) :
base("DELETE", "/assets")
{
m_AssetService = service;
m_allowDelete = allowDelete;
}
public override byte[] Handle(string path, Stream request,
@ -61,9 +63,9 @@ namespace OpenSim.Server.Handlers.Asset
string[] p = SplitParams(path);
if (p.Length > 0)
if (p.Length > 0 && m_allowDelete)
{
// result = m_AssetService.Delete(p[0]);
result = m_AssetService.Delete(p[0]);
}
XmlSerializer xs = new XmlSerializer(typeof(bool));

View File

@ -156,6 +156,22 @@ namespace OpenSim.Services.AssetService
public bool Delete(string id)
{
m_log.DebugFormat("[ASSET SERVICE]: Deleting asset {0}", id);
UUID assetID;
if (!UUID.TryParse(id, out assetID))
return false;
AssetBase asset = m_Database.GetAsset(assetID);
if (asset == null)
return false;
if ((int)(asset.Flags & AssetFlags.Maptile) != 0)
{
return m_Database.Delete(id);
}
else
m_log.DebugFormat("[ASSET SERVICE]: Request to delete asset {0}, but flags are not Maptile", id);
return false;
}
@ -181,6 +197,7 @@ namespace OpenSim.Services.AssetService
MainConsole.Instance.Output(String.Format("Description: {0}", asset.Description));
MainConsole.Instance.Output(String.Format("Type: {0}", asset.Type));
MainConsole.Instance.Output(String.Format("Content-type: {0}", asset.Metadata.ContentType));
MainConsole.Instance.Output(String.Format("Flags: {0}", asset.Metadata.Flags.ToString()));
for (i = 0 ; i < 5 ; i++)
{

View File

@ -511,20 +511,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
PresenceInfo info = new PresenceInfo();
info.Online = true;
info.UserID = sessionResponse["UserID"].AsUUID().ToString();
info.RegionID = sessionResponse["SceneID"].AsUUID();
info.Position = sessionResponse["ScenePosition"].AsVector3();
info.LookAt = sessionResponse["SceneLookAt"].AsVector3();
if (userResponse != null && userResponse["User"] is OSDMap)
{
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;
}

View File

@ -324,6 +324,7 @@ namespace OpenSim.Services.GridService
if (rdatas != null)
{
m_log.DebugFormat("[GRID SERVICE]: Found {0} regions", rdatas.Count);
foreach (RegionData rdata in rdatas)
{
if (count++ < maxNumber)
@ -331,7 +332,7 @@ namespace OpenSim.Services.GridService
}
}
if (m_AllowHypergridMapSearch && (rdatas == null || (rdatas != null && rdatas.Count == 0) && name.Contains(".")))
if (m_AllowHypergridMapSearch && (rdatas == null || (rdatas != null && rdatas.Count == 0)) && name.Contains("."))
{
GridRegion r = m_HypergridLinker.LinkRegion(scopeID, name);
if (r != null)

View File

@ -185,6 +185,10 @@ namespace OpenSim.Services.HypergridService
foreach (UUID session in travels)
m_TravelingAgents.Remove(session);
}
GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(userID.ToString());
if (guinfo != null)
m_GridUserService.LoggedOut(userID.ToString(), guinfo.LastRegionID, guinfo.LastPosition, guinfo.LastLookAt);
}
// We need to prevent foreign users with the same UUID as a local user

View File

@ -36,14 +36,6 @@ namespace OpenSim.Services.Interfaces
{
public string UserID;
public UUID RegionID;
public bool Online;
public DateTime Login;
public DateTime Logout;
public Vector3 Position;
public Vector3 LookAt;
public UUID HomeRegionID;
public Vector3 HomePosition;
public Vector3 HomeLookAt;
public PresenceInfo()
{
@ -65,26 +57,6 @@ namespace OpenSim.Services.Interfaces
return result;
}
public static PresenceInfo[] GetOnlinePresences(PresenceInfo[] pinfos)
{
if (pinfos == null)
return null;
List<PresenceInfo> lst = new List<PresenceInfo>(pinfos);
lst = lst.FindAll(delegate(PresenceInfo each) { return each.Online; });
return lst.ToArray();
}
public static PresenceInfo GetOnlinePresence(PresenceInfo[] pinfos)
{
pinfos = GetOnlinePresences(pinfos);
if (pinfos != null && pinfos.Length >= 1)
return pinfos[0];
return null;
}
}
public interface IPresenceService

View File

@ -115,10 +115,6 @@ namespace OpenSim.Services.PresenceService
ret.UserID = data.UserID;
ret.RegionID = data.RegionID;
if (data.Data.ContainsKey("Position"))
ret.Position = Vector3.Parse(data.Data["Position"]);
if (data.Data.ContainsKey("LookAt"))
ret.LookAt = Vector3.Parse(data.Data["LookAt"]);
return ret;
}
@ -138,8 +134,6 @@ namespace OpenSim.Services.PresenceService
ret.UserID = d.UserID;
ret.RegionID = d.RegionID;
ret.Position = Vector3.Parse(d.Data["Position"]);
ret.LookAt = Vector3.Parse(d.Data["LookAt"]);
info.Add(ret);
}

View File

@ -73,8 +73,8 @@ namespace OpenSim.Tests.Clients.PresenceClient
if (pinfo == null)
m_log.InfoFormat("[PRESENCE CLIENT]: Unable to retrieve presence for {0}", 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);
m_log.InfoFormat("[PRESENCE CLIENT]: Presence retrieved correctly: userID={0}; regionID={1}",
pinfo.UserID, pinfo.RegionID);
System.Console.WriteLine("\n");
success = m_Connector.ReportAgent(session1, region1);
@ -86,8 +86,8 @@ namespace OpenSim.Tests.Clients.PresenceClient
if (pinfo == null)
m_log.InfoFormat("[PRESENCE CLIENT]: Unable to retrieve presence for {0} for second 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);
m_log.InfoFormat("[PRESENCE CLIENT]: Presence retrieved correctly: userID={0}; regionID={2}",
pinfo.UserID, pinfo.RegionID);
System.Console.WriteLine("\n");
success = m_Connector.LogoutAgent(session1);
@ -99,8 +99,8 @@ namespace OpenSim.Tests.Clients.PresenceClient
if (pinfo == null)
m_log.InfoFormat("[PRESENCE CLIENT]: Unable to retrieve presence for {0} for fourth 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);
m_log.InfoFormat("[PRESENCE CLIENT]: Presence retrieved correctly: userID={0}; regionID={1}",
pinfo.UserID, pinfo.RegionID);
System.Console.WriteLine("\n");
success = m_Connector.ReportAgent(session1, UUID.Random());

View File

@ -60,5 +60,10 @@ namespace OpenSim.Tests.Common.Mock
}
public List<AssetMetadata> FetchAssetMetadataSet(int start, int count) { return new List<AssetMetadata>(count); }
public bool Delete(string id)
{
return false;
}
}
}
}

View File

@ -40,6 +40,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
LocalServiceModule = "OpenSim.Services.AssetService.dll:AssetService"
DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll"
AssetLoaderArgs = "assets/AssetSets.xml"
AllowRemoteDelete = "false"
; * This configuration loads the inventory server modules. It duplicates
; * the function of the legacy inventory server

View File

@ -77,6 +77,9 @@
GridService = "OpenSim.Services.GridService.dll:GridService"
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
[GridUserService]
LocalServiceModule = "OpenSim.Services.UserAccountService.dll:GridUserService"
[FriendsService]
LocalServiceModule = "OpenSim.Services.FriendsService.dll"
ConnectionString = "URI=file:friends.db,version=3"