diff options
Diffstat (limited to 'OpenSim/Grid')
-rw-r--r-- | OpenSim/Grid/MessagingServer/MessageService.cs | 53 | ||||
-rw-r--r-- | OpenSim/Grid/MessagingServer/PresenceInformer.cs | 59 |
2 files changed, 86 insertions, 26 deletions
diff --git a/OpenSim/Grid/MessagingServer/MessageService.cs b/OpenSim/Grid/MessagingServer/MessageService.cs index d0b939b..fc16a88 100644 --- a/OpenSim/Grid/MessagingServer/MessageService.cs +++ b/OpenSim/Grid/MessagingServer/MessageService.cs | |||
@@ -30,6 +30,7 @@ using System.Net; | |||
30 | using System.Net.Sockets; | 30 | using System.Net.Sockets; |
31 | using System.Collections; | 31 | using System.Collections; |
32 | using System.Collections.Generic; | 32 | using System.Collections.Generic; |
33 | using System.Threading; | ||
33 | //using System.Xml; | 34 | //using System.Xml; |
34 | using libsecondlife; | 35 | using libsecondlife; |
35 | using Nwc.XmlRpc; | 36 | using Nwc.XmlRpc; |
@@ -59,6 +60,8 @@ namespace OpenSim.Grid.MessagingServer | |||
59 | // Hashtable containing work units that need to be processed | 60 | // Hashtable containing work units that need to be processed |
60 | private Hashtable m_unProcessedWorkUnits = new Hashtable(); | 61 | private Hashtable m_unProcessedWorkUnits = new Hashtable(); |
61 | 62 | ||
63 | |||
64 | |||
62 | public MessageService(MessageServerConfig cfg) | 65 | public MessageService(MessageServerConfig cfg) |
63 | { | 66 | { |
64 | m_cfg = cfg; | 67 | m_cfg = cfg; |
@@ -66,29 +69,7 @@ namespace OpenSim.Grid.MessagingServer | |||
66 | 69 | ||
67 | #region RegionComms Methods | 70 | #region RegionComms Methods |
68 | 71 | ||
69 | /// <summary> | 72 | |
70 | /// Informs a region about an Agent | ||
71 | /// </summary> | ||
72 | /// <param name="TalkingAbout">User to talk about</param> | ||
73 | /// <param name="UserToUpdate">User we're sending this too (contains the region)</param> | ||
74 | public void SendRegionPresenceUpdate(UserPresenceData TalkingAbout, UserPresenceData UserToUpdate) | ||
75 | { | ||
76 | // TODO: Fill in pertenant Presence Data from 'TalkingAbout' | ||
77 | |||
78 | RegionProfileData whichRegion = UserToUpdate.regionData; | ||
79 | //whichRegion.httpServerURI | ||
80 | |||
81 | Hashtable PresenceParams = new Hashtable(); | ||
82 | ArrayList SendParams = new ArrayList(); | ||
83 | SendParams.Add(PresenceParams); | ||
84 | |||
85 | m_log.Info("[PRESENCE]: Informing " + whichRegion.regionName + " at " + whichRegion.httpServerURI); | ||
86 | // Send | ||
87 | XmlRpcRequest RegionReq = new XmlRpcRequest("presence_update", SendParams); | ||
88 | XmlRpcResponse RegionResp = RegionReq.Send(whichRegion.httpServerURI, 6000); | ||
89 | } | ||
90 | |||
91 | |||
92 | #endregion | 73 | #endregion |
93 | 74 | ||
94 | #region FriendList Methods | 75 | #region FriendList Methods |
@@ -152,7 +133,13 @@ namespace OpenSim.Grid.MessagingServer | |||
152 | // we need to send out online status update, but the user is already subscribed | 133 | // we need to send out online status update, but the user is already subscribed |
153 | 134 | ||
154 | } | 135 | } |
155 | SendRegionPresenceUpdate(friendpresence, userpresence); | 136 | PresenceInformer friendlistupdater = new PresenceInformer(); |
137 | friendlistupdater.presence1 = friendpresence; | ||
138 | friendlistupdater.presence2 = userpresence; | ||
139 | WaitCallback cb = new WaitCallback(friendlistupdater.go); | ||
140 | ThreadPool.QueueUserWorkItem(cb); | ||
141 | |||
142 | //SendRegionPresenceUpdate(friendpresence, userpresence); | ||
156 | } | 143 | } |
157 | if ((uFriendListItem.FriendPerms & (uint)FriendRights.CanSeeOnline) != 0) | 144 | if ((uFriendListItem.FriendPerms & (uint)FriendRights.CanSeeOnline) != 0) |
158 | { | 145 | { |
@@ -166,7 +153,14 @@ namespace OpenSim.Grid.MessagingServer | |||
166 | // we need to send out online status update, but the user is already subscribed | 153 | // we need to send out online status update, but the user is already subscribed |
167 | 154 | ||
168 | } | 155 | } |
169 | SendRegionPresenceUpdate(userpresence, friendpresence); | 156 | PresenceInformer friendlistupdater = new PresenceInformer(); |
157 | friendlistupdater.presence1 = userpresence; | ||
158 | friendlistupdater.presence2 = friendpresence; | ||
159 | |||
160 | WaitCallback cb2 = new WaitCallback(friendlistupdater.go); | ||
161 | ThreadPool.QueueUserWorkItem(cb2); | ||
162 | |||
163 | //SendRegionPresenceUpdate(userpresence, friendpresence); | ||
170 | } | 164 | } |
171 | 165 | ||
172 | } | 166 | } |
@@ -280,7 +274,14 @@ namespace OpenSim.Grid.MessagingServer | |||
280 | m_presences[AgentsNeedingNotification[i]] = friendd; | 274 | m_presences[AgentsNeedingNotification[i]] = friendd; |
281 | 275 | ||
282 | } | 276 | } |
283 | SendRegionPresenceUpdate(AgentData, friendd); | 277 | PresenceInformer friendlistupdater = new PresenceInformer(); |
278 | friendlistupdater.presence1 = AgentData; | ||
279 | friendlistupdater.presence2 = friendd; | ||
280 | |||
281 | WaitCallback cb3 = new WaitCallback(friendlistupdater.go); | ||
282 | ThreadPool.QueueUserWorkItem(cb3); | ||
283 | |||
284 | //SendRegionPresenceUpdate(AgentData, friendd); | ||
284 | 285 | ||
285 | 286 | ||
286 | //removeBackReference(AgentID, AgentsNeedingNotification[i]); | 287 | //removeBackReference(AgentID, AgentsNeedingNotification[i]); |
diff --git a/OpenSim/Grid/MessagingServer/PresenceInformer.cs b/OpenSim/Grid/MessagingServer/PresenceInformer.cs new file mode 100644 index 0000000..877d104 --- /dev/null +++ b/OpenSim/Grid/MessagingServer/PresenceInformer.cs | |||
@@ -0,0 +1,59 @@ | |||
1 | using System; | ||
2 | using System.Collections; | ||
3 | using System.Collections.Generic; | ||
4 | using System.Net; | ||
5 | using System.Net.Sockets; | ||
6 | using System.Text; | ||
7 | using libsecondlife; | ||
8 | using Nwc.XmlRpc; | ||
9 | using OpenSim.Framework; | ||
10 | using OpenSim.Framework.Console; | ||
11 | using OpenSim.Framework.Data; | ||
12 | using OpenSim.Framework.Servers; | ||
13 | |||
14 | namespace OpenSim.Grid.MessagingServer | ||
15 | { | ||
16 | public class PresenceInformer | ||
17 | { | ||
18 | public UserPresenceData presence1 = null; | ||
19 | public UserPresenceData presence2 = null; | ||
20 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
21 | |||
22 | public PresenceInformer() | ||
23 | { | ||
24 | |||
25 | } | ||
26 | public void go(object o) | ||
27 | { | ||
28 | if (presence1 != null && presence2 != null) | ||
29 | { | ||
30 | SendRegionPresenceUpdate(presence1, presence2); | ||
31 | } | ||
32 | |||
33 | } | ||
34 | |||
35 | /// <summary> | ||
36 | /// Informs a region about an Agent | ||
37 | /// </summary> | ||
38 | /// <param name="TalkingAbout">User to talk about</param> | ||
39 | /// <param name="UserToUpdate">User we're sending this too (contains the region)</param> | ||
40 | public void SendRegionPresenceUpdate(UserPresenceData TalkingAbout, UserPresenceData UserToUpdate) | ||
41 | { | ||
42 | // TODO: Fill in pertenant Presence Data from 'TalkingAbout' | ||
43 | |||
44 | RegionProfileData whichRegion = UserToUpdate.regionData; | ||
45 | //whichRegion.httpServerURI | ||
46 | |||
47 | Hashtable PresenceParams = new Hashtable(); | ||
48 | ArrayList SendParams = new ArrayList(); | ||
49 | SendParams.Add(PresenceParams); | ||
50 | |||
51 | m_log.Info("[PRESENCE]: Informing " + whichRegion.regionName + " at " + whichRegion.httpServerURI); | ||
52 | // Send | ||
53 | XmlRpcRequest RegionReq = new XmlRpcRequest("presence_update", SendParams); | ||
54 | XmlRpcResponse RegionResp = RegionReq.Send(whichRegion.httpServerURI, 6000); | ||
55 | } | ||
56 | |||
57 | |||
58 | } | ||
59 | } | ||