From 05fbed403ca0d22949956f017b484f356f3ad4f7 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Tue, 8 Jan 2008 04:53:12 +0000 Subject: * Switched over to RegionProfileData from using RegionInfo because RegionInfo was missing the httpURI on the MessageService. * Fixed some code, added a method. --- OpenSim/Grid/MessagingServer/MessageService.cs | 81 ++++++++++++++++++------ OpenSim/Grid/MessagingServer/UserPresenceData.cs | 5 +- 2 files changed, 64 insertions(+), 22 deletions(-) diff --git a/OpenSim/Grid/MessagingServer/MessageService.cs b/OpenSim/Grid/MessagingServer/MessageService.cs index 22d149f..31d33b8 100644 --- a/OpenSim/Grid/MessagingServer/MessageService.cs +++ b/OpenSim/Grid/MessagingServer/MessageService.cs @@ -93,7 +93,7 @@ namespace OpenSim.Grid.MessagingServer up.agentData = agentData; List flData = GetUserFriendList(agentData.AgentID); up.friendData = flData; - RegionInfo riData = GetRegionInfo(regionHandle); + RegionProfileData riData = GetRegionInfo(regionHandle); up.regionData = riData; ProcessFriendListSubscriptions(up); @@ -101,6 +101,19 @@ namespace OpenSim.Grid.MessagingServer return new XmlRpcResponse(); } + + #region RegionComms Methods + + public void SendRegionPresenceUpdate(UserPresenceData AgentData) + { + RegionProfileData whichRegion = AgentData.regionData; + //whichRegion.httpServerURI + + } + + + #endregion + #region FriendList Methods #region FriendListProcessing @@ -110,9 +123,14 @@ namespace OpenSim.Grid.MessagingServer List uFriendList = userpresence.friendData; 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)) { UserPresenceData friendup = (UserPresenceData)m_presences[uFriendList[i]]; + // Add backreference + SubscribeToPresenceUpdates(userpresence, friendup, uFriendList[i],i); } } @@ -127,15 +145,34 @@ namespace OpenSim.Grid.MessagingServer if ((uFriendListItem.FriendListOwnerPerms & (uint)FriendRights.CanSeeOnline) != 0) { // Subscribe and Send Out updates - // Add backreference - m_presence_BackReferences.Add(userpresence.agentData.AgentID, friendpresence.agentData.AgentID); + if (!friendpresence.subscriptionData.Contains(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 + } + } } + /// /// 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. @@ -256,12 +293,12 @@ namespace OpenSim.Grid.MessagingServer /// /// handle to the XY of the region we're looking for /// A RegionInfo object to stick in the presence info - public RegionInfo GetRegionInfo(ulong regionhandle) + public RegionProfileData GetRegionInfo(ulong regionhandle) { - RegionInfo regionInfo = null; + RegionProfileData regionInfo = null; if (m_regionInfoCache.Contains(regionhandle)) { - regionInfo = (RegionInfo)m_regionInfoCache[regionhandle]; + regionInfo = (RegionProfileData)m_regionInfoCache[regionhandle]; } else { @@ -269,8 +306,8 @@ namespace OpenSim.Grid.MessagingServer } return regionInfo; } - public RegionInfo RequestRegionInfo(ulong regionHandle) - { RegionInfo regionInfo = null; + public RegionProfileData RequestRegionInfo(ulong regionHandle) + { RegionProfileData regionProfile = null; try { @@ -295,18 +332,20 @@ namespace OpenSim.Grid.MessagingServer string internalIpStr = (string)responseData["sim_ip"]; uint port = Convert.ToUInt32(responseData["sim_port"]); string externalUri = (string)responseData["sim_uri"]; - - IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int)port); string neighbourExternalUri = externalUri; - regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr); - regionInfo.RemotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); - regionInfo.RemotingAddress = internalIpStr; - - regionInfo.RegionID = new LLUUID((string)responseData["region_UUID"]); - regionInfo.RegionName = (string)responseData["region_name"]; - - m_regionInfoCache.Add(regionHandle, regionInfo); + regionProfile = new RegionProfileData(); + 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"]; + + m_regionInfoCache.Add(regionHandle, regionProfile); } catch (WebException) { @@ -317,7 +356,7 @@ namespace OpenSim.Grid.MessagingServer } - return regionInfo; + return regionProfile; } #endregion } diff --git a/OpenSim/Grid/MessagingServer/UserPresenceData.cs b/OpenSim/Grid/MessagingServer/UserPresenceData.cs index 1391460..fdc5d10 100644 --- a/OpenSim/Grid/MessagingServer/UserPresenceData.cs +++ b/OpenSim/Grid/MessagingServer/UserPresenceData.cs @@ -30,13 +30,16 @@ using System.Collections; using System.Collections.Generic; using libsecondlife; using OpenSim.Framework; +using OpenSim.Framework.Data; + namespace OpenSim.Grid.MessagingServer { public class UserPresenceData { public AgentCircuitData agentData = new AgentCircuitData(); - public RegionInfo regionData = new RegionInfo(); + public RegionProfileData regionData = new RegionProfileData(); + public string httpURI = ""; public List friendData = new List (); public List subscriptionData = new List(); -- cgit v1.1