aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
authorMelanie2012-03-22 20:38:49 +0000
committerMelanie2012-03-22 20:38:49 +0000
commit33818994810130117bae62ba2123bf8b55f181ea (patch)
treeeeb54ef00919abbd1a86b08a659570512856ac42 /OpenSim/Services
parentRevert "Stop messing order of updates, destroing the defined order of the sel... (diff)
parentRework Diva's patch to simplify it (diff)
downloadopensim-SC_OLD-33818994810130117bae62ba2123bf8b55f181ea.zip
opensim-SC_OLD-33818994810130117bae62ba2123bf8b55f181ea.tar.gz
opensim-SC_OLD-33818994810130117bae62ba2123bf8b55f181ea.tar.bz2
opensim-SC_OLD-33818994810130117bae62ba2123bf8b55f181ea.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/World/Land/LandObject.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs52
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs1
-rw-r--r--OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs9
-rw-r--r--OpenSim/Services/HypergridService/HGFriendsService.cs107
-rw-r--r--OpenSim/Services/HypergridService/UserAgentService.cs2
-rw-r--r--OpenSim/Services/Interfaces/IHypergridServices.cs4
6 files changed, 173 insertions, 2 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
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
index c07c6a6..c542c29 100644
--- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
@@ -415,6 +415,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
415 GetBoolResponse(request, out reason); 415 GetBoolResponse(request, out reason);
416 } 416 }
417 417
418 [Obsolete]
418 public List<UUID> StatusNotification(List<string> friends, UUID userID, bool online) 419 public List<UUID> StatusNotification(List<string> friends, UUID userID, bool online)
419 { 420 {
420 Hashtable hash = new Hashtable(); 421 Hashtable hash = new Hashtable();
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs
index 7815d7d..5731e2f 100644
--- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs
@@ -202,8 +202,15 @@ namespace OpenSim.Services.Connectors
202 202
203 Dictionary<string, object> structData = data.ToKeyValuePairs(); 203 Dictionary<string, object> structData = data.ToKeyValuePairs();
204 204
205 foreach (KeyValuePair<string,object> kvp in structData) 205 foreach (KeyValuePair<string, object> kvp in structData)
206 {
207 if (kvp.Value == null)
208 {
209 m_log.DebugFormat("[ACCOUNTS CONNECTOR]: Null value for {0}", kvp.Key);
210 continue;
211 }
206 sendData[kvp.Key] = kvp.Value.ToString(); 212 sendData[kvp.Key] = kvp.Value.ToString();
213 }
207 214
208 return SendAndGetBoolReply(sendData); 215 return SendAndGetBoolReply(sendData);
209 } 216 }
diff --git a/OpenSim/Services/HypergridService/HGFriendsService.cs b/OpenSim/Services/HypergridService/HGFriendsService.cs
index 19ee3e2..39524ab 100644
--- a/OpenSim/Services/HypergridService/HGFriendsService.cs
+++ b/OpenSim/Services/HypergridService/HGFriendsService.cs
@@ -214,6 +214,91 @@ namespace OpenSim.Services.HypergridService
214 return false; 214 return false;
215 } 215 }
216 216
217 public List<UUID> StatusNotification(List<string> friends, UUID foreignUserID, bool online)
218 {
219 if (m_FriendsService == null || m_PresenceService == null)
220 {
221 m_log.WarnFormat("[HGFRIENDS SERVICE]: Unable to perform status notifications because friends or presence services are missing");
222 return new List<UUID>();
223 }
224
225 // Let's unblock the caller right now, and take it from here async
226
227 List<UUID> localFriendsOnline = new List<UUID>();
228
229 m_log.DebugFormat("[HGFRIENDS SERVICE]: Status notification: foreign user {0} wants to notify {1} local friends of {2} status",
230 foreignUserID, friends.Count, (online ? "online" : "offline"));
231
232 // First, let's double check that the reported friends are, indeed, friends of that user
233 // And let's check that the secret matches
234 List<string> usersToBeNotified = new List<string>();
235 foreach (string uui in friends)
236 {
237 UUID localUserID;
238 string secret = string.Empty, tmp = string.Empty;
239 if (Util.ParseUniversalUserIdentifier(uui, out localUserID, out tmp, out tmp, out tmp, out secret))
240 {
241 FriendInfo[] friendInfos = m_FriendsService.GetFriends(localUserID);
242 foreach (FriendInfo finfo in friendInfos)
243 {
244 if (finfo.Friend.StartsWith(foreignUserID.ToString()) && finfo.Friend.EndsWith(secret))
245 {
246 // great!
247 usersToBeNotified.Add(localUserID.ToString());
248 }
249 }
250 }
251 }
252
253 // Now, let's send the notifications
254 //m_log.DebugFormat("[HGFRIENDS SERVICE]: Status notification: user has {0} local friends", usersToBeNotified.Count);
255
256 // First, let's send notifications to local users who are online in the home grid
257 PresenceInfo[] friendSessions = m_PresenceService.GetAgents(usersToBeNotified.ToArray());
258 if (friendSessions != null && friendSessions.Length > 0)
259 {
260 PresenceInfo friendSession = null;
261 foreach (PresenceInfo pinfo in friendSessions)
262 if (pinfo.RegionID != UUID.Zero) // let's guard against traveling agents
263 {
264 friendSession = pinfo;
265 break;
266 }
267
268 if (friendSession != null)
269 {
270 ForwardStatusNotificationToSim(friendSession.RegionID, foreignUserID, friendSession.UserID, online);
271 usersToBeNotified.Remove(friendSession.UserID.ToString());
272 UUID id;
273 if (UUID.TryParse(friendSession.UserID, out id))
274 localFriendsOnline.Add(id);
275
276 }
277 }
278
279 // Lastly, let's notify the rest who may be online somewhere else
280 foreach (string user in usersToBeNotified)
281 {
282 UUID id = new UUID(user);
283 //m_UserAgentService.LocateUser(id);
284 //etc...
285 //if (m_TravelingAgents.ContainsKey(id) && m_TravelingAgents[id].GridExternalName != m_GridName)
286 //{
287 // string url = m_TravelingAgents[id].GridExternalName;
288 // // forward
289 //}
290 //m_log.WarnFormat("[HGFRIENDS SERVICE]: User {0} is visiting another grid. HG Status notifications still not implemented.", user);
291 }
292
293 // and finally, let's send the online friends
294 if (online)
295 {
296 return localFriendsOnline;
297 }
298 else
299 return new List<UUID>();
300 }
301
217 #endregion IHGFriendsService 302 #endregion IHGFriendsService
218 303
219 #region Aux 304 #region Aux
@@ -296,6 +381,28 @@ namespace OpenSim.Services.HypergridService
296 return false; 381 return false;
297 } 382 }
298 383
384 protected void ForwardStatusNotificationToSim(UUID regionID, UUID foreignUserID, string user, bool online)
385 {
386 UUID userID;
387 if (UUID.TryParse(user, out userID))
388 {
389 if (m_FriendsLocalSimConnector != null)
390 {
391 m_log.DebugFormat("[HGFRIENDS SERVICE]: Local Notify, user {0} is {1}", foreignUserID, (online ? "online" : "offline"));
392 m_FriendsLocalSimConnector.StatusNotify(foreignUserID, userID, online);
393 }
394 else
395 {
396 GridRegion region = m_GridService.GetRegionByUUID(UUID.Zero /* !!! */, regionID);
397 if (region != null)
398 {
399 m_log.DebugFormat("[HGFRIENDS SERVICE]: Remote Notify to region {0}, user {1} is {2}", region.RegionName, foreignUserID, (online ? "online" : "offline"));
400 m_FriendsSimConnector.StatusNotify(region, foreignUserID, userID, online);
401 }
402 }
403 }
404 }
405
299 #endregion Aux 406 #endregion Aux
300 } 407 }
301} 408}
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs
index 65963d9..842ca58 100644
--- a/OpenSim/Services/HypergridService/UserAgentService.cs
+++ b/OpenSim/Services/HypergridService/UserAgentService.cs
@@ -332,6 +332,7 @@ namespace OpenSim.Services.HypergridService
332 return false; 332 return false;
333 } 333 }
334 334
335 [Obsolete]
335 public List<UUID> StatusNotification(List<string> friends, UUID foreignUserID, bool online) 336 public List<UUID> StatusNotification(List<string> friends, UUID foreignUserID, bool online)
336 { 337 {
337 if (m_FriendsService == null || m_PresenceService == null) 338 if (m_FriendsService == null || m_PresenceService == null)
@@ -412,6 +413,7 @@ namespace OpenSim.Services.HypergridService
412 return new List<UUID>(); 413 return new List<UUID>();
413 } 414 }
414 415
416 [Obsolete]
415 protected void ForwardStatusNotificationToSim(UUID regionID, UUID foreignUserID, string user, bool online) 417 protected void ForwardStatusNotificationToSim(UUID regionID, UUID foreignUserID, string user, bool online)
416 { 418 {
417 UUID userID; 419 UUID userID;
diff --git a/OpenSim/Services/Interfaces/IHypergridServices.cs b/OpenSim/Services/Interfaces/IHypergridServices.cs
index f48b8a9..3dc877a 100644
--- a/OpenSim/Services/Interfaces/IHypergridServices.cs
+++ b/OpenSim/Services/Interfaces/IHypergridServices.cs
@@ -65,8 +65,8 @@ namespace OpenSim.Services.Interfaces
65 UUID GetUUID(String first, String last); 65 UUID GetUUID(String first, String last);
66 66
67 // Returns the local friends online 67 // Returns the local friends online
68 [Obsolete]
68 List<UUID> StatusNotification(List<string> friends, UUID userID, bool online); 69 List<UUID> StatusNotification(List<string> friends, UUID userID, bool online);
69 //List<UUID> GetOnlineFriends(UUID userID, List<string> friends);
70 70
71 bool IsAgentComingHome(UUID sessionID, string thisGridExternalName); 71 bool IsAgentComingHome(UUID sessionID, string thisGridExternalName);
72 bool VerifyAgent(UUID sessionID, string token); 72 bool VerifyAgent(UUID sessionID, string token);
@@ -92,6 +92,8 @@ namespace OpenSim.Services.Interfaces
92 bool DeleteFriendship(FriendInfo finfo, string secret); 92 bool DeleteFriendship(FriendInfo finfo, string secret);
93 bool FriendshipOffered(UUID from, string fromName, UUID to, string message); 93 bool FriendshipOffered(UUID from, string fromName, UUID to, string message);
94 bool ValidateFriendshipOffered(UUID fromID, UUID toID); 94 bool ValidateFriendshipOffered(UUID fromID, UUID toID);
95 // Returns the local friends online
96 List<UUID> StatusNotification(List<string> friends, UUID userID, bool online);
95 } 97 }
96 98
97 public interface IInstantMessageSimConnector 99 public interface IInstantMessageSimConnector