aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs
diff options
context:
space:
mode:
authorDiva Canto2012-03-21 09:14:17 -0700
committerDiva Canto2012-03-21 09:14:17 -0700
commitd8bcb78b10faf1e4b213a7caa7ee8fcb8d10cf52 (patch)
tree8df932312784721f6ef24b0e57ec2185e85e6e71 /OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs
parentRemoved extraneous debug message (diff)
downloadopensim-SC_OLD-d8bcb78b10faf1e4b213a7caa7ee8fcb8d10cf52.zip
opensim-SC_OLD-d8bcb78b10faf1e4b213a7caa7ee8fcb8d10cf52.tar.gz
opensim-SC_OLD-d8bcb78b10faf1e4b213a7caa7ee8fcb8d10cf52.tar.bz2
opensim-SC_OLD-d8bcb78b10faf1e4b213a7caa7ee8fcb8d10cf52.tar.xz
HG Friends: pulled sim-bound notification code to HGStatusNotifier, so that we can better manage this traffic.
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs47
1 files changed, 47 insertions, 0 deletions
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}