aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs5
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs70
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs66
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs57
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs1
-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
-rw-r--r--OpenSim/Tests/Clients/UserAccounts/UserAccountsClient.cs66
-rw-r--r--bin/Robust.HG.ini.example8
13 files changed, 382 insertions, 66 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index f6a31b5..be767c4 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -212,7 +212,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
212 scene.EventManager.OnClientLogin += OnClientLogin; 212 scene.EventManager.OnClientLogin += OnClientLogin;
213 } 213 }
214 214
215 public void RegionLoaded(Scene scene) 215 public virtual void RegionLoaded(Scene scene)
216 { 216 {
217 } 217 }
218 218
@@ -582,10 +582,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
582 582
583 // Try the local sim 583 // Try the local sim
584 if (LocalFriendshipOffered(friendID, im)) 584 if (LocalFriendshipOffered(friendID, im))
585 {
586 m_log.DebugFormat("[XXX]: LocalFriendshipOffered successes");
587 return true; 585 return true;
588 }
589 586
590 // The prospective friend is not here [as root]. Let's forward. 587 // The prospective friend is not here [as root]. Let's forward.
591 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 588 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
index 0fe1134..e50a84a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 52
53 IUserManagement m_uMan; 53 IUserManagement m_uMan;
54 IUserManagement UserManagementModule 54 public IUserManagement UserManagementModule
55 { 55 {
56 get 56 get
57 { 57 {
@@ -62,6 +62,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
62 } 62 }
63 63
64 protected HGFriendsServicesConnector m_HGFriendsConnector = new HGFriendsServicesConnector(); 64 protected HGFriendsServicesConnector m_HGFriendsConnector = new HGFriendsServicesConnector();
65 protected HGStatusNotifier m_StatusNotifier;
65 66
66 #region ISharedRegionModule 67 #region ISharedRegionModule
67 public override string Name 68 public override string Name
@@ -78,6 +79,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
78 scene.RegisterModuleInterface<IFriendsSimConnector>(this); 79 scene.RegisterModuleInterface<IFriendsSimConnector>(this);
79 } 80 }
80 81
82 public override void RegionLoaded(Scene scene)
83 {
84 if (!m_Enabled)
85 return;
86 if (m_StatusNotifier == null)
87 m_StatusNotifier = new HGStatusNotifier(this);
88 }
89
81 #endregion 90 #endregion
82 91
83 #region IFriendsSimConnector 92 #region IFriendsSimConnector
@@ -230,25 +239,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
230 if (friendsPerDomain.ContainsKey("local")) 239 if (friendsPerDomain.ContainsKey("local"))
231 base.StatusNotify(friendsPerDomain["local"], userID, online); 240 base.StatusNotify(friendsPerDomain["local"], userID, online);
232 241
233 foreach (KeyValuePair<string, List<FriendInfo>> kvp in friendsPerDomain) 242 m_StatusNotifier.Notify(userID, friendsPerDomain, online);
234 {
235 if (kvp.Key != "local")
236 {
237 // For the others, call the user agent service
238 List<string> ids = new List<string>();
239 foreach (FriendInfo f in kvp.Value)
240 ids.Add(f.Friend);
241 UserAgentServiceConnector uConn = new UserAgentServiceConnector(kvp.Key);
242 List<UUID> friendsOnline = uConn.StatusNotification(ids, userID, online);
243
244 if (online && friendsOnline.Count > 0)
245 {
246 IClientAPI client = LocateClientObject(userID);
247 if (client != null)
248 client.SendAgentOnline(friendsOnline.ToArray());
249 }
250 }
251 }
252 243
253// m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting StatusNotify for {0}", userID); 244// m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting StatusNotify for {0}", userID);
254 } 245 }
@@ -261,25 +252,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
261 252
262 // fid is not a UUID... 253 // fid is not a UUID...
263 string url = string.Empty, tmp = string.Empty, f = string.Empty, l = string.Empty; 254 string url = string.Empty, tmp = string.Empty, f = string.Empty, l = string.Empty;
264 m_log.DebugFormat("[YYY]: FID {0}", fid);
265 if (Util.ParseUniversalUserIdentifier(fid, out agentID, out url, out f, out l, out tmp)) 255 if (Util.ParseUniversalUserIdentifier(fid, out agentID, out url, out f, out l, out tmp))
266 { 256 {
267 m_log.DebugFormat("[YYY]: Adding user {0} {1} {2}", f, l, url); 257 if (!agentID.Equals(UUID.Zero))
268 m_uMan.AddUser(agentID, f, l, url);
269
270 string name = m_uMan.GetUserName(agentID);
271 string[] parts = name.Trim().Split(new char[] {' '});
272 if (parts.Length == 2)
273 { 258 {
274 first = parts[0]; 259 m_uMan.AddUser(agentID, f, l, url);
275 last = parts[1]; 260
276 } 261 string name = m_uMan.GetUserName(agentID);
277 else 262 string[] parts = name.Trim().Split(new char[] { ' ' });
278 { 263 if (parts.Length == 2)
279 first = f; 264 {
280 last = l; 265 first = parts[0];
266 last = parts[1];
267 }
268 else
269 {
270 first = f;
271 last = l;
272 }
273 return true;
281 } 274 }
282 return true;
283 } 275 }
284 return false; 276 return false;
285 } 277 }
@@ -744,7 +736,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
744 { 736 {
745 string[] parts = im.fromAgentName.Split(new char[] { '@' }); 737 string[] parts = im.fromAgentName.Split(new char[] { '@' });
746 if (parts.Length == 2) 738 if (parts.Length == 2)
747 m_uMan.AddUser(new UUID(im.fromAgentID), parts[0], "http://" + parts[1]); 739 {
740 string[] fl = parts[0].Trim().Split(new char[] { '.' });
741 if (fl.Length == 2)
742 m_uMan.AddUser(new UUID(im.fromAgentID), fl[0], fl[1], "http://" + parts[1]);
743 else
744 m_uMan.AddUser(new UUID(im.fromAgentID), fl[0], "", "http://" + parts[1]);
745 }
748 } 746 }
749 return true; 747 return true;
750 } 748 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs
new file mode 100644
index 0000000..61c6a30
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs
@@ -0,0 +1,66 @@
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Reflection;
5using System.Text;
6using OpenSim.Framework;
7using OpenSim.Region.Framework.Interfaces;
8using OpenSim.Services.Interfaces;
9using OpenSim.Services.Connectors.Hypergrid;
10using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
11
12using OpenMetaverse;
13
14using log4net;
15
16namespace OpenSim.Region.CoreModules.Avatar.Friends
17{
18 public class HGStatusNotifier
19 {
20 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
21
22 private HGFriendsModule m_FriendsModule;
23
24 public HGStatusNotifier(HGFriendsModule friendsModule)
25 {
26 m_FriendsModule = friendsModule;
27 }
28
29 public void Notify(UUID userID, Dictionary<string, List<FriendInfo>> friendsPerDomain, bool online)
30 {
31 foreach (KeyValuePair<string, List<FriendInfo>> kvp in friendsPerDomain)
32 {
33 if (kvp.Key != "local")
34 {
35 // For the others, call the user agent service
36 List<string> ids = new List<string>();
37 foreach (FriendInfo f in kvp.Value)
38 ids.Add(f.Friend);
39
40 if (ids.Count == 0)
41 continue; // no one to notify. caller don't do this
42
43 m_log.DebugFormat("[HG STATUS NOTIFIER]: Notifying {0} friends in {1}", ids.Count, kvp.Key);
44 // ASSUMPTION: we assume that all users for one home domain
45 // have exactly the same set of service URLs.
46 // If this is ever not true, we need to change this.
47 UUID friendID = UUID.Zero; String tmp = String.Empty;
48 if (Util.ParseUniversalUserIdentifier(ids[0], out friendID, out tmp, out tmp, out tmp, out tmp))
49 {
50 string friendsServerURI = m_FriendsModule.UserManagementModule.GetUserServerURL(friendID, "FriendsServerURI");
51 HGFriendsServicesConnector fConn = new HGFriendsServicesConnector(friendsServerURI);
52
53 List<UUID> friendsOnline = fConn.StatusNotification(ids, userID, online);
54
55 if (online && friendsOnline.Count > 0)
56 {
57 IClientAPI client = m_FriendsModule.LocateClientObject(userID);
58 if (client != null)
59 client.SendAgentOnline(friendsOnline.ToArray());
60 }
61 }
62 }
63 }
64 }
65 }
66}
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
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();
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 bf86035..2f263ae 100644
--- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
@@ -417,6 +417,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
417 GetBoolResponse(request, out reason); 417 GetBoolResponse(request, out reason);
418 } 418 }
419 419
420 [Obsolete]
420 public List<UUID> StatusNotification(List<string> friends, UUID userID, bool online) 421 public List<UUID> StatusNotification(List<string> friends, UUID userID, bool online)
421 { 422 {
422 Hashtable hash = new Hashtable(); 423 Hashtable hash = new Hashtable();
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs
index 609dafe..6d5ce28 100644
--- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs
@@ -197,8 +197,15 @@ namespace OpenSim.Services.Connectors
197 197
198 Dictionary<string, object> structData = data.ToKeyValuePairs(); 198 Dictionary<string, object> structData = data.ToKeyValuePairs();
199 199
200 foreach (KeyValuePair<string,object> kvp in structData) 200 foreach (KeyValuePair<string, object> kvp in structData)
201 {
202 if (kvp.Value == null)
203 {
204 m_log.DebugFormat("[ACCOUNTS CONNECTOR]: Null value for {0}", kvp.Key);
205 continue;
206 }
201 sendData[kvp.Key] = kvp.Value.ToString(); 207 sendData[kvp.Key] = kvp.Value.ToString();
208 }
202 209
203 return SendAndGetBoolReply(sendData); 210 return SendAndGetBoolReply(sendData);
204 } 211 }
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 5eca801..6a5007f 100644
--- a/OpenSim/Services/HypergridService/UserAgentService.cs
+++ b/OpenSim/Services/HypergridService/UserAgentService.cs
@@ -334,6 +334,7 @@ namespace OpenSim.Services.HypergridService
334 return false; 334 return false;
335 } 335 }
336 336
337 [Obsolete]
337 public List<UUID> StatusNotification(List<string> friends, UUID foreignUserID, bool online) 338 public List<UUID> StatusNotification(List<string> friends, UUID foreignUserID, bool online)
338 { 339 {
339 if (m_FriendsService == null || m_PresenceService == null) 340 if (m_FriendsService == null || m_PresenceService == null)
@@ -414,6 +415,7 @@ namespace OpenSim.Services.HypergridService
414 return new List<UUID>(); 415 return new List<UUID>();
415 } 416 }
416 417
418 [Obsolete]
417 protected void ForwardStatusNotificationToSim(UUID regionID, UUID foreignUserID, string user, bool online) 419 protected void ForwardStatusNotificationToSim(UUID regionID, UUID foreignUserID, string user, bool online)
418 { 420 {
419 UUID userID; 421 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
diff --git a/OpenSim/Tests/Clients/UserAccounts/UserAccountsClient.cs b/OpenSim/Tests/Clients/UserAccounts/UserAccountsClient.cs
index 56195b1..1e0a35b 100644
--- a/OpenSim/Tests/Clients/UserAccounts/UserAccountsClient.cs
+++ b/OpenSim/Tests/Clients/UserAccounts/UserAccountsClient.cs
@@ -62,25 +62,39 @@ namespace OpenSim.Tests.Clients.PresenceClient
62 string last = "Clueless"; 62 string last = "Clueless";
63 string email = "foo@bar.com"; 63 string email = "foo@bar.com";
64 64
65 UserAccount account = new UserAccount(user1); 65 //UserAccount account = new UserAccount(user1);
66 account.FirstName = first; 66 //account.ScopeID = UUID.Zero;
67 account.LastName = last; 67 //account.FirstName = first;
68 account.Email = email; 68 //account.LastName = last;
69 account.ServiceURLs = new Dictionary<string, object>(); 69 //account.Email = email;
70 account.ServiceURLs.Add("InventoryServerURI", "http://cnn.com"); 70 //account.ServiceURLs = new Dictionary<string, object>();
71 account.ServiceURLs.Add("AssetServerURI", "http://cnn.com"); 71 //account.ServiceURLs.Add("InventoryServerURI", "http://cnn.com");
72 72 //account.ServiceURLs.Add("AssetServerURI", "http://cnn.com");
73 bool success = m_Connector.StoreUserAccount(account);
74 if (success)
75 m_log.InfoFormat("[USER CLIENT]: Successfully created account for user {0} {1}", account.FirstName, account.LastName);
76 else
77 m_log.InfoFormat("[USER CLIENT]: failed to create user {0} {1}", account.FirstName, account.LastName);
78 73
79 System.Console.WriteLine("\n"); 74 //bool success = m_Connector.StoreUserAccount(account);
75 //if (success)
76 // m_log.InfoFormat("[USER CLIENT]: Successfully created account for user {0} {1}", account.FirstName, account.LastName);
77 //else
78 // m_log.InfoFormat("[USER CLIENT]: failed to create user {0} {1}", account.FirstName, account.LastName);
80 79
81 account = m_Connector.GetUserAccount(UUID.Zero, user1); 80 //System.Console.WriteLine("\n");
81
82 //account = m_Connector.GetUserAccount(UUID.Zero, user1);
83 //if (account == null)
84 // m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by UUID for {0}", user1);
85 //else
86 //{
87 // m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}",
88 // account.PrincipalID, account.FirstName, account.LastName, account.Email);
89 // foreach (KeyValuePair<string, object> kvp in account.ServiceURLs)
90 // m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value);
91 //}
92
93 //System.Console.WriteLine("\n");
94
95 UserAccount account = m_Connector.GetUserAccount(UUID.Zero, first, last);
82 if (account == null) 96 if (account == null)
83 m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by UUID for {0}", user1); 97 m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by name ");
84 else 98 else
85 { 99 {
86 m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}", 100 m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}",
@@ -90,10 +104,9 @@ namespace OpenSim.Tests.Clients.PresenceClient
90 } 104 }
91 105
92 System.Console.WriteLine("\n"); 106 System.Console.WriteLine("\n");
93 107 account = m_Connector.GetUserAccount(UUID.Zero, email);
94 account = m_Connector.GetUserAccount(UUID.Zero, first, last);
95 if (account == null) 108 if (account == null)
96 m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by name for {0}", user1); 109 m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by email");
97 else 110 else
98 { 111 {
99 m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}", 112 m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}",
@@ -103,9 +116,9 @@ namespace OpenSim.Tests.Clients.PresenceClient
103 } 116 }
104 117
105 System.Console.WriteLine("\n"); 118 System.Console.WriteLine("\n");
106 account = m_Connector.GetUserAccount(UUID.Zero, email); 119 account = m_Connector.GetUserAccount(UUID.Zero, user1);
107 if (account == null) 120 if (account == null)
108 m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by email for {0}", user1); 121 m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by UUID for {0}", user1);
109 else 122 else
110 { 123 {
111 m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}", 124 m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}",
@@ -114,6 +127,17 @@ namespace OpenSim.Tests.Clients.PresenceClient
114 m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value); 127 m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value);
115 } 128 }
116 129
130 System.Console.WriteLine("\n");
131 account = m_Connector.GetUserAccount(UUID.Zero, "DoesNot", "Exist");
132 if (account == null)
133 m_log.InfoFormat("[USER CLIENT]: Unable to retrieve account 'DoesNot Exist'");
134 else
135 {
136 m_log.InfoFormat("[USER CLIENT]: Account 'DoesNot Exist' retrieved correctly. REALLY??? userID={0}; FirstName={1}; LastName={2}; Email={3}",
137 account.PrincipalID, account.FirstName, account.LastName, account.Email);
138 foreach (KeyValuePair<string, object> kvp in account.ServiceURLs)
139 m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value);
140 }
117 } 141 }
118 142
119 } 143 }
diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example
index db9f08b..e0242ab 100644
--- a/bin/Robust.HG.ini.example
+++ b/bin/Robust.HG.ini.example
@@ -395,8 +395,12 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
395 HomeURI = "http://127.0.0.1:8002" 395 HomeURI = "http://127.0.0.1:8002"
396 396
397[HGFriendsService] 397[HGFriendsService]
398 LocalServiceModule = "OpenSim.Services.FriendsService.dll:FriendsService" 398 LocalServiceModule = "OpenSim.Services.HypergridService.dll:HGFriendsService"
399 UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService" 399 UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService"
400 FriendsService = "OpenSim.Services.FriendsService.dll:FriendsService"
401 UserAccountService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
402 GridService = "OpenSim.Services.GridService.dll:GridService"
403 PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
400 404
401[HGInstantMessageService] 405[HGInstantMessageService]
402 LocalServiceModule = "OpenSim.Services.HypergridService.dll:HGInstantMessageService" 406 LocalServiceModule = "OpenSim.Services.HypergridService.dll:HGInstantMessageService"