aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs70
1 files changed, 34 insertions, 36 deletions
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 }