diff options
Diffstat (limited to 'OpenSim/Grid/UserServer/UserServerEventDispatchModule.cs')
-rw-r--r-- | OpenSim/Grid/UserServer/UserServerEventDispatchModule.cs | 142 |
1 files changed, 0 insertions, 142 deletions
diff --git a/OpenSim/Grid/UserServer/UserServerEventDispatchModule.cs b/OpenSim/Grid/UserServer/UserServerEventDispatchModule.cs deleted file mode 100644 index 0ad2f02..0000000 --- a/OpenSim/Grid/UserServer/UserServerEventDispatchModule.cs +++ /dev/null | |||
@@ -1,142 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.IO; | ||
31 | using System.Reflection; | ||
32 | using log4net; | ||
33 | using log4net.Config; | ||
34 | using OpenMetaverse; | ||
35 | using OpenSim.Data; | ||
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Framework.Communications; | ||
38 | using OpenSim.Framework.Communications.Cache; | ||
39 | using OpenSim.Framework.Console; | ||
40 | using OpenSim.Framework.Servers; | ||
41 | using OpenSim.Framework.Servers.HttpServer; | ||
42 | using OpenSim.Framework.Statistics; | ||
43 | using OpenSim.Grid.Communications.OGS1; | ||
44 | using OpenSim.Grid.Framework; | ||
45 | using OpenSim.Grid.UserServer.Modules; | ||
46 | |||
47 | namespace OpenSim.Grid.UserServer | ||
48 | { | ||
49 | //Do we actually need these event dispatchers? | ||
50 | //shouldn't the other modules just directly register event handlers to each other? | ||
51 | public class UserServerEventDispatchModule | ||
52 | { | ||
53 | protected UserManager m_userManager; | ||
54 | protected MessageServersConnector m_messagesService; | ||
55 | protected UserLoginService m_loginService; | ||
56 | |||
57 | public UserServerEventDispatchModule(UserManager userManager, MessageServersConnector messagesService, UserLoginService loginService) | ||
58 | { | ||
59 | m_userManager = userManager; | ||
60 | m_messagesService = messagesService; | ||
61 | m_loginService = loginService; | ||
62 | } | ||
63 | |||
64 | public void Initialise(IGridServiceCore core) | ||
65 | { | ||
66 | } | ||
67 | |||
68 | public void PostInitialise() | ||
69 | { | ||
70 | m_loginService.OnUserLoggedInAtLocation += NotifyMessageServersUserLoggedInToLocation; | ||
71 | m_userManager.OnLogOffUser += NotifyMessageServersUserLoggOff; | ||
72 | |||
73 | m_messagesService.OnAgentLocation += HandleAgentLocation; | ||
74 | m_messagesService.OnAgentLeaving += HandleAgentLeaving; | ||
75 | m_messagesService.OnRegionStartup += HandleRegionStartup; | ||
76 | m_messagesService.OnRegionShutdown += HandleRegionShutdown; | ||
77 | } | ||
78 | |||
79 | public void RegisterHandlers(BaseHttpServer httpServer) | ||
80 | { | ||
81 | |||
82 | } | ||
83 | |||
84 | public void Close() | ||
85 | { | ||
86 | m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation; | ||
87 | } | ||
88 | |||
89 | #region Event Handlers | ||
90 | public void NotifyMessageServersUserLoggOff(UUID agentID) | ||
91 | { | ||
92 | m_messagesService.TellMessageServersAboutUserLogoff(agentID); | ||
93 | } | ||
94 | |||
95 | public void NotifyMessageServersUserLoggedInToLocation(UUID agentID, UUID sessionID, UUID RegionID, | ||
96 | ulong regionhandle, float positionX, float positionY, | ||
97 | float positionZ, string firstname, string lastname) | ||
98 | { | ||
99 | m_messagesService.TellMessageServersAboutUser(agentID, sessionID, RegionID, regionhandle, positionX, | ||
100 | positionY, positionZ, firstname, lastname); | ||
101 | } | ||
102 | |||
103 | public void HandleAgentLocation(UUID agentID, UUID regionID, ulong regionHandle) | ||
104 | { | ||
105 | m_userManager.HandleAgentLocation(agentID, regionID, regionHandle); | ||
106 | } | ||
107 | |||
108 | public void HandleAgentLeaving(UUID agentID, UUID regionID, ulong regionHandle) | ||
109 | { | ||
110 | m_userManager.HandleAgentLeaving(agentID, regionID, regionHandle); | ||
111 | } | ||
112 | |||
113 | public void HandleRegionStartup(UUID regionID) | ||
114 | { | ||
115 | // This might seem strange, that we send this back to the | ||
116 | // server it came from. But there is method to the madness. | ||
117 | // There can be multiple user servers on the same database, | ||
118 | // and each can have multiple messaging servers. So, we send | ||
119 | // it to all known user servers, who send it to all known | ||
120 | // message servers. That way, we should be able to finally | ||
121 | // update presence to all regions and thereby all friends | ||
122 | // | ||
123 | m_userManager.HandleRegionStartup(regionID); | ||
124 | m_messagesService.TellMessageServersAboutRegionShutdown(regionID); | ||
125 | } | ||
126 | |||
127 | public void HandleRegionShutdown(UUID regionID) | ||
128 | { | ||
129 | // This might seem strange, that we send this back to the | ||
130 | // server it came from. But there is method to the madness. | ||
131 | // There can be multiple user servers on the same database, | ||
132 | // and each can have multiple messaging servers. So, we send | ||
133 | // it to all known user servers, who send it to all known | ||
134 | // message servers. That way, we should be able to finally | ||
135 | // update presence to all regions and thereby all friends | ||
136 | // | ||
137 | m_userManager.HandleRegionShutdown(regionID); | ||
138 | m_messagesService.TellMessageServersAboutRegionShutdown(regionID); | ||
139 | } | ||
140 | #endregion | ||
141 | } | ||
142 | } | ||