* Switched over to RegionProfileData from using RegionInfo because RegionInfo was missing the httpURI on the MessageService.

* Fixed some code, added a method.
afrisby
Teravus Ovares 2008-01-08 04:53:12 +00:00
parent 0428701da7
commit 05fbed403c
2 changed files with 64 additions and 22 deletions

View File

@ -93,7 +93,7 @@ namespace OpenSim.Grid.MessagingServer
up.agentData = agentData; up.agentData = agentData;
List<FriendListItem> flData = GetUserFriendList(agentData.AgentID); List<FriendListItem> flData = GetUserFriendList(agentData.AgentID);
up.friendData = flData; up.friendData = flData;
RegionInfo riData = GetRegionInfo(regionHandle); RegionProfileData riData = GetRegionInfo(regionHandle);
up.regionData = riData; up.regionData = riData;
ProcessFriendListSubscriptions(up); ProcessFriendListSubscriptions(up);
@ -101,6 +101,19 @@ namespace OpenSim.Grid.MessagingServer
return new XmlRpcResponse(); return new XmlRpcResponse();
} }
#region RegionComms Methods
public void SendRegionPresenceUpdate(UserPresenceData AgentData)
{
RegionProfileData whichRegion = AgentData.regionData;
//whichRegion.httpServerURI
}
#endregion
#region FriendList Methods #region FriendList Methods
#region FriendListProcessing #region FriendListProcessing
@ -110,9 +123,14 @@ namespace OpenSim.Grid.MessagingServer
List<FriendListItem> uFriendList = userpresence.friendData; List<FriendListItem> uFriendList = userpresence.friendData;
for (int i = 0; i < uFriendList.Count; i++) for (int i = 0; i < uFriendList.Count; i++)
{ {
m_presence_BackReferences.Add(userpresence.agentData.AgentID, uFriendList[i].Friend);
m_presence_BackReferences.Add(uFriendList[i].Friend, userpresence.agentData.AgentID);
if (m_presences.Contains(uFriendList[i].Friend)) if (m_presences.Contains(uFriendList[i].Friend))
{ {
UserPresenceData friendup = (UserPresenceData)m_presences[uFriendList[i]]; UserPresenceData friendup = (UserPresenceData)m_presences[uFriendList[i]];
// Add backreference
SubscribeToPresenceUpdates(userpresence, friendup, uFriendList[i],i); SubscribeToPresenceUpdates(userpresence, friendup, uFriendList[i],i);
} }
} }
@ -127,15 +145,34 @@ namespace OpenSim.Grid.MessagingServer
if ((uFriendListItem.FriendListOwnerPerms & (uint)FriendRights.CanSeeOnline) != 0) if ((uFriendListItem.FriendListOwnerPerms & (uint)FriendRights.CanSeeOnline) != 0)
{ {
// Subscribe and Send Out updates // Subscribe and Send Out updates
// Add backreference if (!friendpresence.subscriptionData.Contains(friendpresence.agentData.AgentID))
m_presence_BackReferences.Add(userpresence.agentData.AgentID, friendpresence.agentData.AgentID); {
} userpresence.subscriptionData.Add(friendpresence.agentData.AgentID);
//Send Region Notice....
}
else
{
// we need to send out online status update, but the user is already subscribed
}
}
if ((uFriendListItem.FriendPerms & (uint)FriendRights.CanSeeOnline) != 0)
{
if (!friendpresence.subscriptionData.Contains(userpresence.agentData.AgentID))
{
friendpresence.subscriptionData.Add(userpresence.agentData.AgentID);
//Send Region Notice....
}
else
{
// we need to send out online status update, but the user is already subscribed
}
}
} }
/// <summary> /// <summary>
/// Adds a backreference so presence specific data doesn't have to be /// Adds a backreference so presence specific data doesn't have to be
/// enumerated for each logged in user every time someone logs on or off. /// enumerated for each logged in user every time someone logs on or off.
@ -256,12 +293,12 @@ namespace OpenSim.Grid.MessagingServer
/// </summary> /// </summary>
/// <param name="regionhandle">handle to the XY of the region we're looking for</param> /// <param name="regionhandle">handle to the XY of the region we're looking for</param>
/// <returns>A RegionInfo object to stick in the presence info</returns> /// <returns>A RegionInfo object to stick in the presence info</returns>
public RegionInfo GetRegionInfo(ulong regionhandle) public RegionProfileData GetRegionInfo(ulong regionhandle)
{ {
RegionInfo regionInfo = null; RegionProfileData regionInfo = null;
if (m_regionInfoCache.Contains(regionhandle)) if (m_regionInfoCache.Contains(regionhandle))
{ {
regionInfo = (RegionInfo)m_regionInfoCache[regionhandle]; regionInfo = (RegionProfileData)m_regionInfoCache[regionhandle];
} }
else else
{ {
@ -269,8 +306,8 @@ namespace OpenSim.Grid.MessagingServer
} }
return regionInfo; return regionInfo;
} }
public RegionInfo RequestRegionInfo(ulong regionHandle) public RegionProfileData RequestRegionInfo(ulong regionHandle)
{ RegionInfo regionInfo = null; { RegionProfileData regionProfile = null;
try try
{ {
@ -295,18 +332,20 @@ namespace OpenSim.Grid.MessagingServer
string internalIpStr = (string)responseData["sim_ip"]; string internalIpStr = (string)responseData["sim_ip"];
uint port = Convert.ToUInt32(responseData["sim_port"]); uint port = Convert.ToUInt32(responseData["sim_port"]);
string externalUri = (string)responseData["sim_uri"]; string externalUri = (string)responseData["sim_uri"];
IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int)port);
string neighbourExternalUri = externalUri; string neighbourExternalUri = externalUri;
regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr);
regionInfo.RemotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); regionProfile = new RegionProfileData();
regionInfo.RemotingAddress = internalIpStr; regionProfile.httpPort = (uint)Convert.ToInt32((string)responseData["http_port"]);
regionProfile.httpServerURI = "http://" + internalIpStr + ":" + regionProfile.httpPort + "/";
regionProfile.regionHandle = Helpers.UIntsToLong((regX * 256), (regY * 256));
regionProfile.regionLocX = regX;
regionProfile.regionLocY = regY;
regionProfile.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
regionProfile.UUID = new LLUUID((string)responseData["region_UUID"]);
regionProfile.regionName = (string)responseData["region_name"];
regionInfo.RegionID = new LLUUID((string)responseData["region_UUID"]); m_regionInfoCache.Add(regionHandle, regionProfile);
regionInfo.RegionName = (string)responseData["region_name"];
m_regionInfoCache.Add(regionHandle, regionInfo);
} }
catch (WebException) catch (WebException)
{ {
@ -317,7 +356,7 @@ namespace OpenSim.Grid.MessagingServer
} }
return regionInfo; return regionProfile;
} }
#endregion #endregion
} }

View File

@ -30,13 +30,16 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife; using libsecondlife;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Data;
namespace OpenSim.Grid.MessagingServer namespace OpenSim.Grid.MessagingServer
{ {
public class UserPresenceData public class UserPresenceData
{ {
public AgentCircuitData agentData = new AgentCircuitData(); public AgentCircuitData agentData = new AgentCircuitData();
public RegionInfo regionData = new RegionInfo(); public RegionProfileData regionData = new RegionProfileData();
public string httpURI = "";
public List<FriendListItem> friendData = new List<FriendListItem> (); public List<FriendListItem> friendData = new List<FriendListItem> ();
public List<LLUUID> subscriptionData = new List<LLUUID>(); public List<LLUUID> subscriptionData = new List<LLUUID>();