aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs
diff options
context:
space:
mode:
authorDiva Canto2012-03-21 10:35:06 -0700
committerDiva Canto2012-03-21 10:35:06 -0700
commit4a9ca3ca8ff18f4fcf05c3983db5e6b1d49c97ee (patch)
tree6db550ead95b0a8f044f504f33fc2bfc202b1f80 /OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs
parentHG Friends: pulled sim-bound notification code to HGStatusNotifier, so that w... (diff)
downloadopensim-SC-4a9ca3ca8ff18f4fcf05c3983db5e6b1d49c97ee.zip
opensim-SC-4a9ca3ca8ff18f4fcf05c3983db5e6b1d49c97ee.tar.gz
opensim-SC-4a9ca3ca8ff18f4fcf05c3983db5e6b1d49c97ee.tar.bz2
opensim-SC-4a9ca3ca8ff18f4fcf05c3983db5e6b1d49c97ee.tar.xz
HG Friends: reroute the status notifications to the HGFriends service, so that they can scale better. They were previously being handled by the UAS; that is still there, but it's now obsolete and will be removed in a future release.
Diffstat (limited to 'OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs')
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs52
1 files changed, 52 insertions, 0 deletions
diff --git a/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs
index e3f3260..e984a54 100644
--- a/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs
@@ -255,6 +255,58 @@ namespace OpenSim.Services.Connectors.Hypergrid
255 return false; 255 return false;
256 256
257 } 257 }
258
259 public List<UUID> StatusNotification(List<string> friends, UUID userID, bool online)
260 {
261 Dictionary<string, object> sendData = new Dictionary<string, object>();
262 List<UUID> friendsOnline = new List<UUID>();
263
264 sendData["METHOD"] = "statusnotification";
265 sendData["userID"] = userID.ToString();
266 sendData["online"] = online.ToString();
267 int i = 0;
268 foreach (string s in friends)
269 {
270 sendData["friend_" + i.ToString()] = s;
271 i++;
272 }
273
274 string reply = string.Empty;
275 string uri = m_ServerURI + "/hgfriends";
276 try
277 {
278 reply = SynchronousRestFormsRequester.MakeRequest("POST",
279 uri,
280 ServerUtils.BuildQueryString(sendData));
281 }
282 catch (Exception e)
283 {
284 m_log.DebugFormat("[HGFRIENDS CONNECTOR]: Exception when contacting friends server at {0}: {1}", uri, e.Message);
285 return friendsOnline;
286 }
287
288 if (reply != string.Empty)
289 {
290 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
291
292 // Here is the actual response
293 foreach (string key in replyData.Keys)
294 {
295 if (key.StartsWith("friend_") && replyData[key] != null)
296 {
297 UUID uuid;
298 if (UUID.TryParse(replyData[key].ToString(), out uuid))
299 friendsOnline.Add(uuid);
300 }
301 }
302 }
303 else
304 m_log.DebugFormat("[HGFRIENDS CONNECTOR]: Received empty reply from remote StatusNotify");
305
306 return friendsOnline;
307
308 }
309
258 #endregion 310 #endregion
259 } 311 }
260} \ No newline at end of file 312} \ No newline at end of file