diff options
author | Diva Canto | 2012-03-21 09:14:17 -0700 |
---|---|---|
committer | Diva Canto | 2012-03-21 09:14:17 -0700 |
commit | d8bcb78b10faf1e4b213a7caa7ee8fcb8d10cf52 (patch) | |
tree | 8df932312784721f6ef24b0e57ec2185e85e6e71 /OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs | |
parent | Removed extraneous debug message (diff) | |
download | opensim-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.cs | 47 |
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 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Linq; | ||
4 | using System.Text; | ||
5 | using OpenSim.Framework; | ||
6 | using OpenSim.Region.Framework.Interfaces; | ||
7 | using OpenSim.Services.Interfaces; | ||
8 | using OpenSim.Services.Connectors.Hypergrid; | ||
9 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; | ||
10 | |||
11 | using OpenMetaverse; | ||
12 | |||
13 | namespace 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 | } | ||