diff options
author | BlueWall | 2011-05-24 16:03:01 -0400 |
---|---|---|
committer | BlueWall | 2011-05-24 16:07:48 -0400 |
commit | a8913141c081202eb1f988901a4ac0988bbd72a2 (patch) | |
tree | 032b24a6b10a7fcd610e01001b2c43d0d5102460 /OpenSim/Region/OptionalModules | |
parent | Allow disabling the legacy backup mechanism to avoid the object clone if (diff) | |
download | opensim-SC_OLD-a8913141c081202eb1f988901a4ac0988bbd72a2.zip opensim-SC_OLD-a8913141c081202eb1f988901a4ac0988bbd72a2.tar.gz opensim-SC_OLD-a8913141c081202eb1f988901a4ac0988bbd72a2.tar.bz2 opensim-SC_OLD-a8913141c081202eb1f988901a4ac0988bbd72a2.tar.xz |
Make client event handlers for money only work on root agents
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs index b84a34d..952e797 100644 --- a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs +++ b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs | |||
@@ -177,9 +177,37 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule | |||
177 | scene.EventManager.OnClientClosed += ClientLoggedOut; | 177 | scene.EventManager.OnClientClosed += ClientLoggedOut; |
178 | scene.EventManager.OnValidateLandBuy += ValidateLandBuy; | 178 | scene.EventManager.OnValidateLandBuy += ValidateLandBuy; |
179 | scene.EventManager.OnLandBuy += processLandBuy; | 179 | scene.EventManager.OnLandBuy += processLandBuy; |
180 | scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; | ||
180 | } | 181 | } |
181 | } | 182 | } |
182 | 183 | ||
184 | void OnMakeRootAgent(ScenePresence presence) | ||
185 | { | ||
186 | // Do this only for root agents | ||
187 | // Some implementations register $$ for | ||
188 | // child agents, then that never goes away | ||
189 | // We will send a zero balance when they are | ||
190 | // made root. | ||
191 | // | ||
192 | // Modules overriding this should only deal with | ||
193 | // root agents as well. | ||
194 | // | ||
195 | IClientAPI client = presence.ControllingClient; | ||
196 | |||
197 | client.OnEconomyDataRequest += EconomyDataRequestHandler; | ||
198 | client.OnMoneyBalanceRequest += SendMoneyBalance; | ||
199 | client.OnRequestPayPrice += requestPayPrice; | ||
200 | client.OnObjectBuy += ObjectBuy; | ||
201 | client.OnLogout += ClientClosed; | ||
202 | |||
203 | client.SendMoneyBalance (UUID.Random(), true, new byte[0], 0); | ||
204 | } | ||
205 | |||
206 | void HandleSceneEventManagerOnMakeRootAgent (ScenePresence presence) | ||
207 | { | ||
208 | |||
209 | } | ||
210 | |||
183 | public void RemoveRegion(Scene scene) | 211 | public void RemoveRegion(Scene scene) |
184 | { | 212 | { |
185 | } | 213 | } |
@@ -277,13 +305,9 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule | |||
277 | private void OnNewClient(IClientAPI client) | 305 | private void OnNewClient(IClientAPI client) |
278 | { | 306 | { |
279 | GetClientFunds(client); | 307 | GetClientFunds(client); |
308 | // Moved the event registrations to fire them when | ||
309 | // the agent becomes root | ||
280 | 310 | ||
281 | // Subscribe to Money messages | ||
282 | client.OnEconomyDataRequest += EconomyDataRequestHandler; | ||
283 | client.OnMoneyBalanceRequest += SendMoneyBalance; | ||
284 | client.OnRequestPayPrice += requestPayPrice; | ||
285 | client.OnObjectBuy += ObjectBuy; | ||
286 | client.OnLogout += ClientClosed; | ||
287 | } | 311 | } |
288 | 312 | ||
289 | /// <summary> | 313 | /// <summary> |