diff options
author | UbitUmarov | 2012-03-23 03:41:48 +0000 |
---|---|---|
committer | UbitUmarov | 2012-03-23 03:41:48 +0000 |
commit | 4db05a98c2c1678b612e0a3d2f95c24e34ac5f13 (patch) | |
tree | 3929bd993c504a3de7697f449e36535aeeddf737 /OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs | |
parent | Merge branch 'master' of ssh://3dhosting.de/var/git/careminster into ubitwork (diff) | |
parent | Merge branch 'master' into careminster (diff) | |
download | opensim-SC-4db05a98c2c1678b612e0a3d2f95c24e34ac5f13.zip opensim-SC-4db05a98c2c1678b612e0a3d2f95c24e34ac5f13.tar.gz opensim-SC-4db05a98c2c1678b612e0a3d2f95c24e34ac5f13.tar.bz2 opensim-SC-4db05a98c2c1678b612e0a3d2f95c24e34ac5f13.tar.xz |
Merge branch 'master' of ssh://3dhosting.de/var/git/careminster into ubitwork
Diffstat (limited to 'OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs')
-rw-r--r-- | OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs index ca566f2..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); |
@@ -197,7 +200,6 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
197 | string message = string.Empty; | 200 | string message = string.Empty; |
198 | string name = string.Empty; | 201 | string name = string.Empty; |
199 | 202 | ||
200 | m_log.DebugFormat("[HGFRIENDS HANDLER]: Friendship offered"); | ||
201 | if (!request.ContainsKey("FromID") || !request.ContainsKey("ToID")) | 203 | if (!request.ContainsKey("FromID") || !request.ContainsKey("ToID")) |
202 | return BoolResult(false); | 204 | return BoolResult(false); |
203 | 205 | ||
@@ -229,6 +231,59 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
229 | return BoolResult(success); | 231 | return BoolResult(success); |
230 | } | 232 | } |
231 | 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 | |||
232 | 287 | ||
233 | #endregion | 288 | #endregion |
234 | 289 | ||