aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-03-21 23:59:59 +0000
committerJustin Clark-Casey (justincc)2012-03-22 00:00:05 +0000
commit71ec84d77f440c9801462e1bda95a67f3386a19b (patch)
tree5819185495a439ca2c5f7455bd377b32332e1254 /OpenSim/Region
parentInstead of loading default avatar animations in both SLUtil and AvatarAnimati... (diff)
parentUpdated the UserAccountsClient a little bit, plus some more sanity checks on ... (diff)
downloadopensim-SC_OLD-71ec84d77f440c9801462e1bda95a67f3386a19b.zip
opensim-SC_OLD-71ec84d77f440c9801462e1bda95a67f3386a19b.tar.gz
opensim-SC_OLD-71ec84d77f440c9801462e1bda95a67f3386a19b.tar.bz2
opensim-SC_OLD-71ec84d77f440c9801462e1bda95a67f3386a19b.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region')
-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
3 files changed, 101 insertions, 40 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}