aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorDiva Canto2010-02-28 12:07:38 -0800
committerDiva Canto2010-02-28 12:07:38 -0800
commit5c5966545d14de43500b95109e8ce81058ebe2c3 (patch)
tree732f9f47668141b177a8f6e9e6e6d64aa0ee722d /OpenSim/Region
parentFriends connectors finished. Status notification working across the board. On... (diff)
downloadopensim-SC-5c5966545d14de43500b95109e8ce81058ebe2c3.zip
opensim-SC-5c5966545d14de43500b95109e8ce81058ebe2c3.tar.gz
opensim-SC-5c5966545d14de43500b95109e8ce81058ebe2c3.tar.bz2
opensim-SC-5c5966545d14de43500b95109e8ce81058ebe2c3.tar.xz
Initial Online friends notification seems to be working reliably now. All this needs more testing, but everything is there.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs6
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs54
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs4
-rw-r--r--OpenSim/Region/Framework/Interfaces/IFriendsModule.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs27
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs6
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs4
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs4
9 files changed, 84 insertions, 28 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index afc5270..c185640 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -121,7 +121,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
121 public event ObjectAttach OnObjectAttach; 121 public event ObjectAttach OnObjectAttach;
122 public event ObjectDeselect OnObjectDetach; 122 public event ObjectDeselect OnObjectDetach;
123 public event ObjectDrop OnObjectDrop; 123 public event ObjectDrop OnObjectDrop;
124 public event GenericCall2 OnCompleteMovementToRegion; 124 public event GenericCall1 OnCompleteMovementToRegion;
125 public event UpdateAgent OnAgentUpdate; 125 public event UpdateAgent OnAgentUpdate;
126 public event AgentRequestSit OnAgentRequestSit; 126 public event AgentRequestSit OnAgentRequestSit;
127 public event AgentSit OnAgentSit; 127 public event AgentSit OnAgentSit;
@@ -5737,10 +5737,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5737 5737
5738 private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack) 5738 private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack)
5739 { 5739 {
5740 GenericCall2 handlerCompleteMovementToRegion = OnCompleteMovementToRegion; 5740 GenericCall1 handlerCompleteMovementToRegion = OnCompleteMovementToRegion;
5741 if (handlerCompleteMovementToRegion != null) 5741 if (handlerCompleteMovementToRegion != null)
5742 { 5742 {
5743 handlerCompleteMovementToRegion(); 5743 handlerCompleteMovementToRegion(sender);
5744 } 5744 }
5745 handlerCompleteMovementToRegion = null; 5745 handlerCompleteMovementToRegion = null;
5746 5746
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index cc3a3ee..8aa5b91 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -79,6 +79,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
79 protected Dictionary<UUID, UserFriendData> m_Friends = 79 protected Dictionary<UUID, UserFriendData> m_Friends =
80 new Dictionary<UUID, UserFriendData>(); 80 new Dictionary<UUID, UserFriendData>();
81 81
82 protected List<UUID> m_NeedsListOfFriends = new List<UUID>();
83
82 protected IPresenceService PresenceService 84 protected IPresenceService PresenceService
83 { 85 {
84 get 86 get
@@ -170,6 +172,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
170 scene.EventManager.OnClientClosed += OnClientClosed; 172 scene.EventManager.OnClientClosed += OnClientClosed;
171 scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; 173 scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
172 scene.EventManager.OnMakeChildAgent += OnMakeChildAgent; 174 scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;
175 scene.EventManager.OnClientLogin += OnClientLogin;
173 } 176 }
174 177
175 public void RegionLoaded(Scene scene) 178 public void RegionLoaded(Scene scene)
@@ -220,7 +223,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
220 client.OnGrantUserRights += OnGrantUserRights; 223 client.OnGrantUserRights += OnGrantUserRights;
221 224
222 client.OnLogout += OnLogout; 225 client.OnLogout += OnLogout;
223 client.OnEconomyDataRequest += SendPresence;
224 226
225 if (m_Friends.ContainsKey(client.AgentId)) 227 if (m_Friends.ContainsKey(client.AgentId))
226 { 228 {
@@ -285,30 +287,50 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
285 } 287 }
286 } 288 }
287 289
288 private void SendPresence(UUID agentID) 290 private void OnClientLogin(IClientAPI client)
289 { 291 {
292 UUID agentID = client.AgentId;
293
290 // Inform the friends that this user is online 294 // Inform the friends that this user is online
291 StatusChange(agentID, true); 295 StatusChange(agentID, true);
292 296
293 // Now send the list of online friends to this user 297 // Register that we need to send the list of online friends to this user
294 if (!m_Friends.ContainsKey(agentID)) 298 lock (m_NeedsListOfFriends)
295 { 299 if (!m_NeedsListOfFriends.Contains(agentID))
296 m_log.DebugFormat("[FRIENDS MODULE]: agent {0} not found in local cache", agentID); 300 {
297 return; 301 m_NeedsListOfFriends.Add(agentID);
298 } 302 }
303 }
299 304
300 IClientAPI client = LocateClientObject(agentID); 305 public void SendFriendsOnlineIfNeeded(IClientAPI client)
301 if (client == null) 306 {
307 UUID agentID = client.AgentId;
308 if (m_NeedsListOfFriends.Contains(agentID))
302 { 309 {
303 m_log.DebugFormat("[FRIENDS MODULE]: agent's client {0} not found in local scene", agentID); 310 if (!m_Friends.ContainsKey(agentID))
304 return; 311 {
305 } 312 m_log.DebugFormat("[FRIENDS MODULE]: agent {0} not found in local cache", agentID);
313 return;
314 }
315
316 client = LocateClientObject(agentID);
317 if (client == null)
318 {
319 m_log.DebugFormat("[FRIENDS MODULE]: agent's client {0} not found in local scene", agentID);
320 return;
321 }
306 322
307 List<UUID> online = GetOnlineFriends(agentID); 323 List<UUID> online = GetOnlineFriends(agentID);
308 324
309 m_log.DebugFormat("[FRIENDS]: User {0} in region {1} has {2} friends online", client.AgentId, client.Scene.RegionInfo.RegionName, online.Count); 325 if (online.Count > 0)
310 client.SendAgentOnline(online.ToArray()); 326 {
327 m_log.DebugFormat("[FRIENDS MODULE]: User {0} in region {1} has {2} friends online", client.AgentId, client.Scene.RegionInfo.RegionName, online.Count);
328 client.SendAgentOnline(online.ToArray());
329 }
311 330
331 lock (m_NeedsListOfFriends)
332 m_NeedsListOfFriends.Remove(agentID);
333 }
312 } 334 }
313 335
314 List<UUID> GetOnlineFriends(UUID userID) 336 List<UUID> GetOnlineFriends(UUID userID)
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 2c5c6e9..bb0d43b 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -83,7 +83,7 @@ namespace OpenSim.Region.Examples.SimpleModule
83 public event DeRezObject OnDeRezObject; 83 public event DeRezObject OnDeRezObject;
84 public event Action<IClientAPI> OnRegionHandShakeReply; 84 public event Action<IClientAPI> OnRegionHandShakeReply;
85 public event GenericCall2 OnRequestWearables; 85 public event GenericCall2 OnRequestWearables;
86 public event GenericCall2 OnCompleteMovementToRegion; 86 public event GenericCall1 OnCompleteMovementToRegion;
87 public event UpdateAgent OnAgentUpdate; 87 public event UpdateAgent OnAgentUpdate;
88 public event AgentRequestSit OnAgentRequestSit; 88 public event AgentRequestSit OnAgentRequestSit;
89 public event AgentSit OnAgentSit; 89 public event AgentSit OnAgentSit;
@@ -659,7 +659,7 @@ namespace OpenSim.Region.Examples.SimpleModule
659 659
660 if (OnCompleteMovementToRegion != null) 660 if (OnCompleteMovementToRegion != null)
661 { 661 {
662 OnCompleteMovementToRegion(); 662 OnCompleteMovementToRegion(this);
663 } 663 }
664 } 664 }
665 public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) 665 public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)
diff --git a/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs b/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs
index 239a2ba..a0a1e3a 100644
--- a/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs
@@ -47,5 +47,6 @@ namespace OpenSim.Region.Framework.Interfaces
47 /// <param name="offerMessage"></param> 47 /// <param name="offerMessage"></param>
48 void OfferFriendship(UUID fromUserId, IClientAPI toUserClient, string offerMessage); 48 void OfferFriendship(UUID fromUserId, IClientAPI toUserClient, string offerMessage);
49 uint GetFriendPerms(UUID PrincipalID, UUID FriendID); 49 uint GetFriendPerms(UUID PrincipalID, UUID FriendID);
50 void SendFriendsOnlineIfNeeded(IClientAPI client);
50 } 51 }
51} 52}
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 57e1c37..ac04462 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -66,13 +66,16 @@ namespace OpenSim.Region.Framework.Scenes
66 public event OnClientConnectCoreDelegate OnClientConnect; 66 public event OnClientConnectCoreDelegate OnClientConnect;
67 67
68 public delegate void OnNewClientDelegate(IClientAPI client); 68 public delegate void OnNewClientDelegate(IClientAPI client);
69 69
70 /// <summary> 70 /// <summary>
71 /// Deprecated in favour of OnClientConnect. 71 /// Deprecated in favour of OnClientConnect.
72 /// Will be marked Obsolete after IClientCore has 100% of IClientAPI interfaces. 72 /// Will be marked Obsolete after IClientCore has 100% of IClientAPI interfaces.
73 /// </summary> 73 /// </summary>
74 public event OnNewClientDelegate OnNewClient; 74 public event OnNewClientDelegate OnNewClient;
75 75
76 public delegate void OnClientLoginDelegate(IClientAPI client);
77 public event OnClientLoginDelegate OnClientLogin;
78
76 public delegate void OnNewPresenceDelegate(ScenePresence presence); 79 public delegate void OnNewPresenceDelegate(ScenePresence presence);
77 80
78 public event OnNewPresenceDelegate OnNewPresence; 81 public event OnNewPresenceDelegate OnNewPresence;
@@ -583,6 +586,28 @@ namespace OpenSim.Region.Framework.Scenes
583 } 586 }
584 } 587 }
585 588
589 public void TriggerOnClientLogin(IClientAPI client)
590 {
591 OnClientLoginDelegate handlerClientLogin = OnClientLogin;
592 if (handlerClientLogin != null)
593 {
594 foreach (OnClientLoginDelegate d in handlerClientLogin.GetInvocationList())
595 {
596 try
597 {
598 d(client);
599 }
600 catch (Exception e)
601 {
602 m_log.ErrorFormat(
603 "[EVENT MANAGER]: Delegate for TriggerOnClientLogin failed - continuing. {0} {1}",
604 e.Message, e.StackTrace);
605 }
606 }
607 }
608
609 }
610
586 public void TriggerOnNewPresence(ScenePresence presence) 611 public void TriggerOnNewPresence(ScenePresence presence)
587 { 612 {
588 OnNewPresenceDelegate handlerNewPresence = OnNewPresence; 613 OnNewPresenceDelegate handlerNewPresence = OnNewPresence;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index b9b16ad..d00c990 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2422,6 +2422,8 @@ namespace OpenSim.Region.Framework.Scenes
2422 /// <param name="client"></param> 2422 /// <param name="client"></param>
2423 public override void AddNewClient(IClientAPI client) 2423 public override void AddNewClient(IClientAPI client)
2424 { 2424 {
2425 bool vialogin = false;
2426
2425 m_clientManager.Add(client); 2427 m_clientManager.Add(client);
2426 2428
2427 CheckHeartbeat(); 2429 CheckHeartbeat();
@@ -2463,6 +2465,7 @@ namespace OpenSim.Region.Framework.Scenes
2463 if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0) 2465 if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0)
2464 { 2466 {
2465 m_log.DebugFormat("[Scene]: Incoming client {0} {1} in region {2} via Login", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); 2467 m_log.DebugFormat("[Scene]: Incoming client {0} {1} in region {2} via Login", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
2468 vialogin = true;
2466 IUserAgentVerificationModule userVerification = RequestModuleInterface<IUserAgentVerificationModule>(); 2469 IUserAgentVerificationModule userVerification = RequestModuleInterface<IUserAgentVerificationModule>();
2467 if (userVerification != null) 2470 if (userVerification != null)
2468 { 2471 {
@@ -2512,7 +2515,8 @@ namespace OpenSim.Region.Framework.Scenes
2512 2515
2513 m_LastLogin = Util.EnvironmentTickCount(); 2516 m_LastLogin = Util.EnvironmentTickCount();
2514 EventManager.TriggerOnNewClient(client); 2517 EventManager.TriggerOnNewClient(client);
2515 2518 if (vialogin)
2519 EventManager.TriggerOnClientLogin(client);
2516 } 2520 }
2517 2521
2518 2522
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index af9afa6..f83a4d2 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1114,7 +1114,7 @@ namespace OpenSim.Region.Framework.Scenes
1114 /// This is called upon a very important packet sent from the client, 1114 /// This is called upon a very important packet sent from the client,
1115 /// so it's client-controlled. Never call this method directly. 1115 /// so it's client-controlled. Never call this method directly.
1116 /// </summary> 1116 /// </summary>
1117 public void CompleteMovement() 1117 public void CompleteMovement(IClientAPI client)
1118 { 1118 {
1119 //m_log.Debug("[SCENE PRESENCE]: CompleteMovement"); 1119 //m_log.Debug("[SCENE PRESENCE]: CompleteMovement");
1120 1120
@@ -1159,6 +1159,10 @@ namespace OpenSim.Region.Framework.Scenes
1159 m_agentTransfer.EnableChildAgents(this); 1159 m_agentTransfer.EnableChildAgents(this);
1160 else 1160 else
1161 m_log.DebugFormat("[SCENE PRESENCE]: Unable to create child agents in neighbours, because AgentTransferModule is not active"); 1161 m_log.DebugFormat("[SCENE PRESENCE]: Unable to create child agents in neighbours, because AgentTransferModule is not active");
1162
1163 IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
1164 if (friendsModule != null)
1165 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
1162 } 1166 }
1163 1167
1164 } 1168 }
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index f54733d..92e5a13 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -679,7 +679,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
679 public event DeRezObject OnDeRezObject; 679 public event DeRezObject OnDeRezObject;
680 public event Action<IClientAPI> OnRegionHandShakeReply; 680 public event Action<IClientAPI> OnRegionHandShakeReply;
681 public event GenericCall2 OnRequestWearables; 681 public event GenericCall2 OnRequestWearables;
682 public event GenericCall2 OnCompleteMovementToRegion; 682 public event GenericCall1 OnCompleteMovementToRegion;
683 public event UpdateAgent OnAgentUpdate; 683 public event UpdateAgent OnAgentUpdate;
684 public event AgentRequestSit OnAgentRequestSit; 684 public event AgentRequestSit OnAgentRequestSit;
685 public event AgentSit OnAgentSit; 685 public event AgentSit OnAgentSit;
@@ -913,7 +913,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
913 913
914 if (OnCompleteMovementToRegion != null) 914 if (OnCompleteMovementToRegion != null)
915 { 915 {
916 OnCompleteMovementToRegion(); 916 OnCompleteMovementToRegion(this);
917 } 917 }
918 } 918 }
919 919
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index ea46945..17453f1 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -189,7 +189,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
189 public event DeRezObject OnDeRezObject; 189 public event DeRezObject OnDeRezObject;
190 public event Action<IClientAPI> OnRegionHandShakeReply; 190 public event Action<IClientAPI> OnRegionHandShakeReply;
191 public event GenericCall2 OnRequestWearables; 191 public event GenericCall2 OnRequestWearables;
192 public event GenericCall2 OnCompleteMovementToRegion; 192 public event GenericCall1 OnCompleteMovementToRegion;
193 public event UpdateAgent OnAgentUpdate; 193 public event UpdateAgent OnAgentUpdate;
194 public event AgentRequestSit OnAgentRequestSit; 194 public event AgentRequestSit OnAgentRequestSit;
195 public event AgentSit OnAgentSit; 195 public event AgentSit OnAgentSit;
@@ -744,7 +744,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
744 744
745 if (OnCompleteMovementToRegion != null) 745 if (OnCompleteMovementToRegion != null)
746 { 746 {
747 OnCompleteMovementToRegion(); 747 OnCompleteMovementToRegion(this);
748 } 748 }
749 } 749 }
750 public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) 750 public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)