aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs29
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs47
3 files changed, 58 insertions, 20 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 753c0a3..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
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
index 46b0b84..f50e52b 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
@@ -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 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs
new file mode 100644
index 0000000..62d54e4
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs
@@ -0,0 +1,47 @@
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using OpenSim.Framework;
6using OpenSim.Region.Framework.Interfaces;
7using OpenSim.Services.Interfaces;
8using OpenSim.Services.Connectors.Hypergrid;
9using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
10
11using OpenMetaverse;
12
13namespace OpenSim.Region.CoreModules.Avatar.Friends
14{
15 public class HGStatusNotifier
16 {
17 private HGFriendsModule m_FriendsModule;
18
19 public HGStatusNotifier(HGFriendsModule friendsModule)
20 {
21 m_FriendsModule = friendsModule;
22 }
23
24 public void Notify(UUID userID, Dictionary<string, List<FriendInfo>> friendsPerDomain, bool online)
25 {
26 foreach (KeyValuePair<string, List<FriendInfo>> kvp in friendsPerDomain)
27 {
28 if (kvp.Key != "local")
29 {
30 // For the others, call the user agent service
31 List<string> ids = new List<string>();
32 foreach (FriendInfo f in kvp.Value)
33 ids.Add(f.Friend);
34 UserAgentServiceConnector uConn = new UserAgentServiceConnector(kvp.Key);
35 List<UUID> friendsOnline = uConn.StatusNotification(ids, userID, online);
36
37 if (online && friendsOnline.Count > 0)
38 {
39 IClientAPI client = m_FriendsModule.LocateClientObject(userID);
40 if (client != null)
41 client.SendAgentOnline(friendsOnline.ToArray());
42 }
43 }
44 }
45 }
46 }
47}