aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Handlers/Hypergrid
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/Server/Handlers/Hypergrid
parentHG Friends: pulled sim-bound notification code to HGStatusNotifier, so that w... (diff)
downloadopensim-SC_OLD-4a9ca3ca8ff18f4fcf05c3983db5e6b1d49c97ee.zip
opensim-SC_OLD-4a9ca3ca8ff18f4fcf05c3983db5e6b1d49c97ee.tar.gz
opensim-SC_OLD-4a9ca3ca8ff18f4fcf05c3983db5e6b1d49c97ee.tar.bz2
opensim-SC_OLD-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/Server/Handlers/Hypergrid')
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs56
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs1
2 files changed, 57 insertions, 0 deletions
diff --git a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs
index e0876cd..8ef03e7 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs
@@ -105,6 +105,9 @@ namespace OpenSim.Server.Handlers.Hypergrid
105 105
106 case "validate_friendship_offered": 106 case "validate_friendship_offered":
107 return ValidateFriendshipOffered(request); 107 return ValidateFriendshipOffered(request);
108
109 case "statusnotification":
110 return StatusNotification(request);
108 /* 111 /*
109 case "friendship_approved": 112 case "friendship_approved":
110 return FriendshipApproved(request); 113 return FriendshipApproved(request);
@@ -228,6 +231,59 @@ namespace OpenSim.Server.Handlers.Hypergrid
228 return BoolResult(success); 231 return BoolResult(success);
229 } 232 }
230 233
234 byte[] StatusNotification(Dictionary<string, object> request)
235 {
236 UUID principalID = UUID.Zero;
237 if (request.ContainsKey("userID"))
238 UUID.TryParse(request["userID"].ToString(), out principalID);
239 else
240 {
241 m_log.WarnFormat("[HGFRIENDS HANDLER]: no userID in request to notify");
242 return FailureResult();
243 }
244
245 bool online = true;
246 if (request.ContainsKey("online"))
247 Boolean.TryParse(request["online"].ToString(), out online);
248 else
249 {
250 m_log.WarnFormat("[HGFRIENDS HANDLER]: no online in request to notify");
251 return FailureResult();
252 }
253
254 List<string> friends = new List<string>();
255 int i = 0;
256 foreach (KeyValuePair<string, object> kvp in request)
257 {
258 if (kvp.Key.Equals("friend_" + i.ToString()))
259 {
260 friends.Add(kvp.Value.ToString());
261 i++;
262 }
263 }
264
265 List<UUID> onlineFriends = m_TheService.StatusNotification(friends, principalID, online);
266
267 Dictionary<string, object> result = new Dictionary<string, object>();
268 if ((onlineFriends == null) || ((onlineFriends != null) && (onlineFriends.Count == 0)))
269 result["RESULT"] = "NULL";
270 else
271 {
272 i = 0;
273 foreach (UUID f in onlineFriends)
274 {
275 result["friend_" + i] = f.ToString();
276 i++;
277 }
278 }
279
280 string xmlString = ServerUtils.BuildXmlResponse(result);
281 //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
282 UTF8Encoding encoding = new UTF8Encoding();
283 return encoding.GetBytes(xmlString);
284
285 }
286
231 287
232 #endregion 288 #endregion
233 289
diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
index 9a0e27e..db62aaa 100644
--- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
@@ -222,6 +222,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
222 222
223 } 223 }
224 224
225 [Obsolete]
225 public XmlRpcResponse StatusNotification(XmlRpcRequest request, IPEndPoint remoteClient) 226 public XmlRpcResponse StatusNotification(XmlRpcRequest request, IPEndPoint remoteClient)
226 { 227 {
227 Hashtable hash = new Hashtable(); 228 Hashtable hash = new Hashtable();