mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 03:45:35 +08:00
Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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"))
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user