diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs | 31 |
2 files changed, 26 insertions, 7 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index f50e52b..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 | { |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs index 62d54e4..61c6a30 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs | |||
@@ -1,6 +1,7 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Linq; | 3 | using System.Linq; |
4 | using System.Reflection; | ||
4 | using System.Text; | 5 | using System.Text; |
5 | using OpenSim.Framework; | 6 | using OpenSim.Framework; |
6 | using OpenSim.Region.Framework.Interfaces; | 7 | using OpenSim.Region.Framework.Interfaces; |
@@ -10,10 +11,14 @@ using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; | |||
10 | 11 | ||
11 | using OpenMetaverse; | 12 | using OpenMetaverse; |
12 | 13 | ||
14 | using log4net; | ||
15 | |||
13 | namespace OpenSim.Region.CoreModules.Avatar.Friends | 16 | namespace OpenSim.Region.CoreModules.Avatar.Friends |
14 | { | 17 | { |
15 | public class HGStatusNotifier | 18 | public class HGStatusNotifier |
16 | { | 19 | { |
20 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
21 | |||
17 | private HGFriendsModule m_FriendsModule; | 22 | private HGFriendsModule m_FriendsModule; |
18 | 23 | ||
19 | public HGStatusNotifier(HGFriendsModule friendsModule) | 24 | public HGStatusNotifier(HGFriendsModule friendsModule) |
@@ -31,14 +36,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
31 | List<string> ids = new List<string>(); | 36 | List<string> ids = new List<string>(); |
32 | foreach (FriendInfo f in kvp.Value) | 37 | foreach (FriendInfo f in kvp.Value) |
33 | ids.Add(f.Friend); | 38 | ids.Add(f.Friend); |
34 | UserAgentServiceConnector uConn = new UserAgentServiceConnector(kvp.Key); | ||
35 | List<UUID> friendsOnline = uConn.StatusNotification(ids, userID, online); | ||
36 | 39 | ||
37 | if (online && friendsOnline.Count > 0) | 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)) | ||
38 | { | 49 | { |
39 | IClientAPI client = m_FriendsModule.LocateClientObject(userID); | 50 | string friendsServerURI = m_FriendsModule.UserManagementModule.GetUserServerURL(friendID, "FriendsServerURI"); |
40 | if (client != null) | 51 | HGFriendsServicesConnector fConn = new HGFriendsServicesConnector(friendsServerURI); |
41 | client.SendAgentOnline(friendsOnline.ToArray()); | 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 | } | ||
42 | } | 61 | } |
43 | } | 62 | } |
44 | } | 63 | } |