Compare commits

...

207 Commits

Author SHA1 Message Date
Justin Clark-Casey (justincc)
74a5226af5 Fix a bug where linking a non-physical prim with a physical prim as root would make the non-physical prim phantom rather than part of the physics object.
On region restart, the whole object would become physical as expected.
Observed behaviour from elsewhere is that all prims in a new linkset should take on the status of the root prim.
Add regression test for this behaviour.
2012-05-09 23:51:25 +01:00
Justin Clark-Casey (justincc)
c7ddc7a633 Remove redundant prim_geom != IntPtr.Zero checks in ODEPrim.
prim_geom == IntPtr.Zero only before a new add prim taint is processed (which is the first taint) or in operations such as scale change which are done in taint or under lock.
Therefore, we can remove these checks which were not consistently applied anyway.
If there is a genuine problem, better to see it quickly in a NullReferenceException than hide the bug.
2012-05-09 23:39:47 +01:00
Justin Clark-Casey (justincc)
265707d21c If a physical prim is manually moved (e.g. by a user) then set the geometry position as well as the body position
This is necessary to stop the moved prim snapping back to the original position on deselection if moved only once
This resolves http://opensimulator.org/mantis/view.php?id=5966
2012-05-09 23:39:37 +01:00
Justin Clark-Casey (justincc)
eb39d1c4d4 Comment out debug [ASYNC DELETER] messages for now. 2012-04-30 19:29:17 +01:00
Justin Clark-Casey (justincc)
1197d48fc7 Remove mono compiler warning. Adjust message log to error from info 2012-04-30 19:29:08 +01:00
Justin Clark-Casey (justincc)
23e1a55ed5 Add text about using double quotes to surround console command arguments containing spaces to "help" text.
e.g. show object name "My long object name"
2012-04-30 19:29:01 +01:00
Justin Clark-Casey (justincc)
ba2a539603 Put scene object related console commands into new "Objects" help category rather than "Regions" 2012-04-30 19:28:54 +01:00
Justin Clark-Casey (justincc)
8a8093d8dd Add flags information (phantom, physics, etc.) to "show object" and "show part" console commands 2012-04-30 19:28:41 +01:00
Justin Clark-Casey (justincc)
3fb0103452 Add regression test for teleporting an agent between separated regions on the same simulator.
This involves a large amount of change in test scene setup code to allow test scenes to share shared modules
SetupScene is now an instance method that requires an instantiation of SceneHelpers, though other SceneHelpers methods are still static
May split these out into separate classes in the future.
2012-04-30 19:27:21 +01:00
Justin Clark-Casey (justincc)
aeefdaedc7 minor: make NPC tests run in a given order, comment out log lines in mock region data plugins, null out scene in script and npc torture tests, add other doc comments to torture tests 2012-04-30 19:18:54 +01:00
Justin Clark-Casey (justincc)
756d1f917f Stop individually deleting objects at the end of each ObjectTortureTest.
We can now do this since the entire scene and all objects within it are now successfully gc'd at the end of these tests.
This greatly improves the time taken to run each test (by reducing teardown time, not the time to actually do the test work that we're interested in).
Slightly simplifies config read in Scene constructor to help facilitate this.
2012-04-30 19:18:47 +01:00
Justin Clark-Casey (justincc)
6fa3dffad2 Use a fully stubbed out MockConsole for unit tests rather than inheriting from CommandConsole.
This is so that the static MainConsole.Instance doesn't retain references to methods registered by scene and other modules to service commands.
This prevents the scene from being garbage collected at the end of a test.
This is not the final thing preventing GC - next up is the timer started by SimStatsReporter that holds a reference to Scene that prevents end of test gc.
2012-04-30 19:17:06 +01:00
Justin Clark-Casey (justincc)
123e781cb3 Make TestSetPhysicsSinglePrim() actually add the object to the scene in order to test more code paths. 2012-04-30 19:15:07 +01:00
Justin Clark-Casey (justincc)
ed9bf5b0c6 Add regression test for prim status when root prim in a new linkset is non-physical 2012-04-30 19:14:35 +01:00
Justin Clark-Casey (justincc)
dd4e39ca1d refactor: extract common setup code in SceneObjectStatusTests 2012-04-30 19:13:33 +01:00
Justin Clark-Casey (justincc)
5a551b074b Add TestSetPhysics() to SOP status tests 2012-04-30 19:13:24 +01:00
Justin Clark-Casey (justincc)
c1a9355865 Tweak log messages on local region to region teleport path to help with problem resolution. 2012-04-30 19:05:27 +01:00
Diva Canto
3ea6c25fb6 Teleports: bounce off repeated requests of teleporting the same agent. Some scripts do that, and that fails the whole thing. 2012-04-30 19:05:24 +01:00
Justin Clark-Casey (justincc)
2d3135448c Comment out old Scene.HandleLogOffUserFromGrid() to reduce client closing analysis complexity 2012-04-30 19:01:30 +01:00
Justin Clark-Casey (justincc)
36a99af37c minor: Add more detail to unauthorized caps client message 2012-04-30 19:01:23 +01:00
Justin Clark-Casey (justincc)
2aefd15913 minor: Add region name to dropped inbound packet message 2012-04-30 19:01:13 +01:00
Justin Clark-Casey (justincc)
6bc55b1086 minor: Add avatar name to removing agent log message 2012-04-30 19:00:47 +01:00
Justin Clark-Casey (justincc)
7058ce2c70 Comment out avatar move to target message for now. 2012-04-30 19:00:39 +01:00
Justin Clark-Casey (justincc)
8e111e9018 Add regression test TestSameRegionTeleport() 2012-04-30 18:59:50 +01:00
Justin Clark-Casey (justincc)
d8bd7ca436 Comment out AvatarService.SetAvatar debug log line for now 2012-04-30 18:59:43 +01:00
Justin Clark-Casey (justincc)
392f73a000 Comment out some debug ATTACHMENTS log messages for now. 2012-04-30 18:59:35 +01:00
Justin Clark-Casey (justincc)
67efbaf33b Comment out the noisier AVFACTORY log messages for now.
Permanently comment out warnings about ScenePresence not being found - this is entirely expected if the avatar has alraedy logged out or left the scene.
2012-04-30 18:59:27 +01:00
Justin Clark-Casey (justincc)
0d06740148 Improve teleport log debug and error messages to tell us who is teleporting. 2012-04-30 18:58:37 +01:00
Diva Canto
eda6947a22 Changed the Map-related messages from Info to Debug. They're debug messages. 2012-04-30 18:49:07 +01:00
Justin Clark-Casey (justincc)
f331173145 Add online/offline indicator to "friends show" region console command.
Improve output table formatting.
2012-04-30 18:48:57 +01:00
Justin Clark-Casey (justincc)
a666cd9e1f Add osForceAttachToAvatar() and osForceDetachFromAvatar()
These behave identically to llAttachToAvatar() and llDetachFromAvatar() except that they do not enforce the PERMISSION_ATTACH check
Intended for use in completely controlled dedicated environments where these checks are more a UI hinderance than a help.
Threat level high.
2012-04-24 00:50:32 +01:00
Justin Clark-Casey (justincc)
2657aa6987 Replace common code to fetch self inventory item (as opposed to uuid) with GetSelfInventoryItem()
However, at some point it would be far more convenient to receive the TaskInventoryItem in the constructor rather than just the item UUID, so we don't have to constantly refetch our self item.
2012-04-24 00:45:09 +01:00
Justin Clark-Casey (justincc)
6610cd2332 refactor: Replace calls to InventorySelf() with existing m_itemID in LSL_Api
There's no point look up an item ID that we already have.
2012-04-24 00:44:57 +01:00
Justin Clark-Casey (justincc)
0c8b44d514 Add more exception detail to Exception and IOException throws in BaseHttpServer.HandleRequest() 2012-04-24 00:40:19 +01:00
Justin Clark-Casey (justincc)
ec46ff4445 Stop teleports from dropping tall avatars through or embedding them in the floor when lured by short avatars.
This involves giving the ceiling of the Z-component in a lure rather than the floor.
Ideally we would give the exact float compensating for relative avatar height but it looks like that isn't possible with the parcel id format used in lures
2012-04-24 00:37:37 +01:00
Melanie
db891880e6 Fix a logic error in app domain creation 2012-04-24 00:36:54 +01:00
Melanie
9c433e8c50 Don't re-add the assembly resolver for each script if not creating the appdomain 2012-04-24 00:36:46 +01:00
Justin Clark-Casey (justincc)
5141863ae3 On "show part" command, show link number.
This replaces the Parts count which was rather pointless for a prim (it was either 1 if a child or the number of parts if the root).
This information is still avaliable on the "show object" command.
2012-04-18 23:02:02 +01:00
Justin Clark-Casey (justincc)
d23550dea5 minor: Add some method doc. Add warnings since calling SOG link/delink methods directly rather than through Scene may allow race conditions. 2012-04-18 23:01:56 +01:00
Justin Clark-Casey (justincc)
c3b12510ae Add TestGetChildPartPositionAfterObjectRotation() 2012-04-18 23:01:42 +01:00
Justin Clark-Casey (justincc)
b2685e3671 Add test TestGetChildPartPosition() 2012-04-18 23:01:33 +01:00
Justin Clark-Casey (justincc)
601d2ddbf3 Move some public methods on WebStatsModule to private to reduce some static analysis complexity.
There's no obvious reason for these methods to be public.
2012-04-18 23:01:27 +01:00
Justin Clark-Casey (justincc)
a5e8fe70af Use INSERT OR REPLACE INTO sql in WebStatsModule for session update rather than separate insert and update statements 2012-04-18 23:01:12 +01:00
Justin Clark-Casey (justincc)
9b3a96aa81 correct bug where f_invalid was being inserted on a webstats update for an existing session rather than d_world_kb 2012-04-18 23:01:06 +01:00
Justin Clark-Casey (justincc)
d674e815bd Simplify WebStatsModule by removing the uncompleted migrations section.
Use "create table if not exists" instead.
Client stats data is transitory data that it is not worth migrating.
2012-04-18 23:01:00 +01:00
Justin Clark-Casey (justincc)
c2e696d686 Fix bug in WebStatsModule where an exception would always be output on update if the user teleported to another region on that simulator.
This was because update was looking for an existing stats record unique in session id, agent id and region id.
But if the user teleports to another region then region id changes.
WebStatsModule promptly doesn't find the existing record and tries to insert a new one, but only session id is the primary key and that's still the same, which makes things go bang.
This makes the update search only on the unique session id.
This is only an issue with simulators that have multiple regions where the webstats module is enabled.
2012-04-18 23:00:51 +01:00
Justin Clark-Casey (justincc)
411dbb8df4 Add GroupPosition and GetWorldPosition() checks to TestGetRootPartPosition() 2012-04-18 23:00:43 +01:00
Justin Clark-Casey (justincc)
b22dfbbf15 minor: make test names consistent 2012-04-18 23:00:36 +01:00
Justin Clark-Casey (justincc)
4c39a3fdbf refactor: move common init code into SetUp() in SceneObjectSpatialTests 2012-04-18 23:00:30 +01:00
Justin Clark-Casey (justincc)
f3eb366f24 refactor: put SOG position test in a separate TestSceneObjectGroupPosition() 2012-04-18 23:00:22 +01:00
Justin Clark-Casey (justincc)
a20d1b8f6b Add simple RelativePosition and OffsetPosition checks to TestGetRootPartPosition 2012-04-18 23:00:14 +01:00
Justin Clark-Casey (justincc)
0a51289332 Add very basic TestGetRootPartPosition() test 2012-04-18 23:00:02 +01:00
Justin Clark-Casey (justincc)
97ebfb00b4 Rather than having a FromFolderID property on every single prim and only ever using the root prim one, store on SOG instead.
This reduces pointless memory usage.
2012-04-18 22:59:24 +01:00
Justin Clark-Casey (justincc)
c7d664f9d0 Store FromItemID for attachments once on SOG instead of on every SOP and only ever using the root part entry.
This eliminates some pointless memory use.
2012-04-18 22:59:18 +01:00
Justin Clark-Casey (justincc)
c2fbaaa95d refactor: Eliminate unnecessary SOP.m_physActor 2012-04-18 22:59:08 +01:00
Justin Clark-Casey (justincc)
84d4b390f1 remove possible PhysActor unexpectedly null race conditions when changing prim collision status
factor out common SOP physics scene adding code into a common SOP.AddToPhysics() that is the counterpart to the existing RemoveFromPhysics()
2012-04-18 22:58:17 +01:00
Justin Clark-Casey (justincc)
54e59099b7 Fix more SOP.PhysActor race conditions in LSL_Api 2012-04-18 22:58:10 +01:00
Justin Clark-Casey (justincc)
d9585ba37e Eliminate race condition where many callers would check SOP.PhysicsActor != null then assume it was still not null in later code.
Another thread could come and turn off physics for a part (null PhysicsActor) at any point.
Had to turn off localCopy on warp3D CoreModules section in prebuild.xml since on current nant this copies all DLLs in bin/ which can be a very large number with compiled DLLs
No obvious reason for doing that copy - nothing else does it.
2012-04-18 22:58:03 +01:00
Justin Clark-Casey (justincc)
45c617b5c3 Allow llRegionSayTo() to work on the PUBLIC_CHANNEL, as per http://wiki.secondlife.com/wiki/LlRegionSayTo
Addresses http://opensimulator.org/mantis/view.php?id=5950
2012-04-18 22:55:30 +01:00
Justin Clark-Casey (justincc)
4b0c78c64f minor: remove some now unneeded code from FriendsCommandsModule 2012-04-18 22:55:12 +01:00
Justin Clark-Casey (justincc)
dd36e23a62 Make default "show friends" console command show friends fetched from the friends service.
There is no a --cache option which will show friends from the local cache if available.
2012-04-18 22:55:05 +01:00
Justin Clark-Casey (justincc)
e2dade05d9 Lock NullFriendsData.m_Data for consistency and against concurrent read/write 2012-04-18 22:54:57 +01:00
Justin Clark-Casey (justincc)
fbd61106cb refactor: Move "friends show cache" console command out into separate FriendsCommandsModule.
Expose required methods on IFriendsModule.  Rename GetFriends() -> GetFriendsFromCache() for self-documentation
2012-04-18 22:54:45 +01:00
Justin Clark-Casey (justincc)
67e66a2d34 Add simple login test with online friends. Add IFriendsModule.GrantRights() for granting rights via a module call.
Rename IFriendsModule.GetFriendPerms() -> GetRightsGrantedByFriend() to be more self-documenting and consistent with friends module terminology.
Add some method doc.
2012-04-18 22:46:10 +01:00
Justin Clark-Casey (justincc)
59911963ca refactor: Stop passing both IClientAPI and agentID to friend event listeners, these are redundant. Replace a few magic numbers with FriendRights enum already used elsewhere. 2012-04-18 22:45:31 +01:00
Justin Clark-Casey (justincc)
dc2a4a6ccd Add simple regression test for logging in with offline friends. Don't expect to receive any in this instance. 2012-04-18 22:41:19 +01:00
Justin Clark-Casey (justincc)
81fb0b4f07 Add back parts of reverted changes that were not concerned with child agent caching.
This adds ScenePresence to IClientAPI.SceneAgent earlier on in the add client process so that its information is available to EventManager.OnNewClient() and OnClientLogin()
Also add a code comment as to why we're caching friend information for child agents.
2012-04-18 22:41:12 +01:00
Melanie
a06c8fb7b2 Also add OSS header to interface 2012-04-18 22:41:05 +01:00
Melanie
05e70f76a9 Change namespace on CallingCardModule and correct interface file placemant. Also ass OpenSource header 2012-04-18 22:36:24 +01:00
Melanie
b9f4836d3e Committing the Avination calling card module 2012-04-18 22:36:03 +01:00
Melanie
ef77dc932b Adding the Avination calling card interface 2012-04-18 22:35:57 +01:00
Justin Clark-Casey (justincc)
bd5b1d4d48 Earlier fix to remove localCopy on prebuild 2012-04-18 22:35:27 +01:00
Melanie
5c2ffa260c Pushing the Avination Calling card hooks. Module to follow. 2012-04-18 22:35:11 +01:00
Justin Clark-Casey (justincc)
23d04fa25c Add "friends show cache <first-name> <last-name>" command for debugging purposes.
This adds a reverse lookup (name -> ID) to IUserManagement instead of hitting the UserAccountService directly.
2012-04-18 22:11:42 +01:00
Justin Clark-Casey (justincc)
67dbce4512 minor: Add some documentation to OnNewClient and OnClientClosed events 2012-04-18 22:11:31 +01:00
Justin Clark-Casey (justincc)
46170fd0d8 minor: clean up some code formatting in VivoxVoiceModule.cs 2012-04-18 22:11:18 +01:00
Justin Clark-Casey (justincc)
f85a453dc8 Allow the user to enter help topics in upper or lowercase.
Forcing uppercase (e.g. help Assets) is too annoying.
Thanks to WhiteStar for pointing this out.
2012-04-18 22:10:27 +01:00
nebadon
bcfe48e05b fix yield prolog so it compiles with mono 2.11 there has been a bugzilla
report files with mono project in regards to this change, this simply
lets us move forward with using mono 2.11 for now :
https://bugzilla.xamarin.com/show_bug.cgi?id=4052
2012-04-18 22:10:05 +01:00
Justin Clark-Casey (justincc)
722ca250ea Move "change region" command into general category 2012-04-18 22:05:45 +01:00
Justin Clark-Casey (justincc)
f4df128e52 Uses shorter AddCommand form for "show estates" 2012-04-18 22:05:38 +01:00
Justin Clark-Casey (justincc)
8cc5322b39 Display help commander topics in capitalized form - the commands themselves are still lowercase.
Also convert the estate commands to simply AddCommand() calls so that commands from two different modules can be placed in the same category
2012-04-18 22:05:24 +01:00
Justin Clark-Casey (justincc)
1480845597 Change "help" to display categories/module list then "help <category/module>" to display commands in a category.
This is to deal with the hundred lines of command splurge when one previously typed "help"
Modelled somewhat on the mysql console
One can still type help <command> to get per command help at any point.
Categories capitalized to avoid conflict with the all-lowercase commands (except for commander system, as of yet).
Does not affect command parsing or any other aspects of the console apart from the help system.
Backwards compatible with existing modules.
2012-04-18 22:05:03 +01:00
Justin Clark-Casey (justincc)
c877e73463 Comment out log message about sending periodic appearance updates. 2012-03-30 02:33:26 +01:00
Justin Clark-Casey (justincc)
3ce5e8eb6c Add information about SendPeriodicAppearanceUpdates to OpenSimDefaults.ini for now.
Default remains false.
2012-03-30 02:33:18 +01:00
Justin Clark-Casey (justincc)
e6b12e1f9d Add experimental SendPeriodicAppearanceUpdates = true/false setting to [Startup] in OpenSim.ini
On osgrid and other places, I have observed that manually sending appearance updates from the console often relieves grey avatar syndrome.
Despite hunting high and low, I haven't been able to find where this packet is sometimes being lost - it might be a persistent viewer bug for all I know.
Therefore, this experimental setting resends appearance data for everybody in the scene every 60 seconds.  These packets are small and the viewer only fetches texture
data if it doesn't already have it.
Default is false.
2012-03-30 02:33:10 +01:00
Justin Clark-Casey (justincc)
bfbbd4ccba Add a scene maintenance thread in parallel to the heartbeat thread. The maintenance thread will end up running regular jobs that don't need to be in the main scene loop.
The idea is to make the critical main scene loop as skinny as possible - it doesn't need to run things that aren't time critical and don't depend on update ordering.
This will be done gradually over time to try and uncover any issues.  Many non-criticial scene loop activities are being launched on separate threadpool threads anyway.
This may also allow modules to register their own maintenance jobs without having to maintain their own timers and threads.
Currently the maintenance loop runs once a second, as opposed to the 89ms scene loop.
2012-03-30 02:33:01 +01:00
Justin Clark-Casey (justincc)
fec7016665 Remove unnecessary shutting down check in Scene.Heartbeat(). Add some method doc. Rename HeartbeatThread, shuttingdown to conform to code standards. 2012-03-30 02:32:53 +01:00
Justin Clark-Casey (justincc)
47fe6170b2 Rename Scene.StartTimer() to Start() - this method no longer uses a timer. Comment out more effectively unused old heartbeat code. 2012-03-30 02:32:34 +01:00
Justin Clark-Casey (justincc)
24b5fb8523 Add commented out section on collisions switch in Scene.SetSceneCoreDebug().
This was not implemented before the recent changes but should be at some point.
2012-03-30 02:24:03 +01:00
Justin Clark-Casey (justincc)
e8cd9688ce If "debug scene updates true" then print out to log when a garbage collection occurs. 2012-03-30 02:23:27 +01:00
Justin Clark-Casey (justincc)
fa952f6d35 Add Scene.DebugUpdates switch which, if turned on, will print out a warning when a frame updates takes longer than twice the desired time
This is controlled via "debug scene updates true|false" on the region console.
Also fix an oversight with "debug scene teleport true|false"
2012-03-30 02:23:20 +01:00
Justin Clark-Casey (justincc)
df55fd69af Incorporate scene teleporting debugging into "debug scene teleport true|false" command 2012-03-30 02:23:13 +01:00
Justin Clark-Casey (justincc)
019fc4c1f2 Replace "scene debug true false true" console command with "scene debug scripting true" or other parameters as appropriate.
This is to allow individual switching of scene debug settings and to provide flexibiltiy for additional settings.
2012-03-30 02:22:59 +01:00
Justin Clark-Casey (justincc)
22ea441feb fix compile error from last commit 2012-03-30 02:22:57 +01:00
Justin Clark-Casey (justincc)
9f5b33e52e refactor: simplify EstateManagementModule.handleEstateDebugRegionRequest() 2012-03-30 02:21:42 +01:00
Justin Clark-Casey (justincc)
92837c4f89 Add ability to log warn if a frame takes longer than twice the expected time. Currently commented out. 2012-03-30 02:21:32 +01:00
Justin Clark-Casey (justincc)
68ce06f40f remove unnecessary tmpFrameMS, use maintc instead for frame time calculation 2012-03-30 02:21:04 +01:00
Justin Clark-Casey (justincc)
279b31c75b Move frame loop entirely within Scene.Update() for better future performance analysis and stat accuracy.
Update() now accepts a frames parameter which can control the number of frames updated.
-1 will update until shutdown.
The watchdog updating moves above the maintc recalculation for any required sleep since it should be accounted for within the frame.
2012-03-30 02:20:46 +01:00
Justin Clark-Casey (justincc)
3117b3cd88 refactor: precalculate the fixed movement factor for avatar tilting (sqrt(2)) rather than doing it multiple times on every move. 2012-03-30 02:20:35 +01:00
Justin Clark-Casey (justincc)
9b547f76e7 refactor: Eliminate unnecessary duplicate avCapsuleTilted 2012-03-30 02:20:29 +01:00
Justin Clark-Casey (justincc)
3d6675784a Remove pointless ThreadAbortException catching in a test that isn't run anyway. 2012-03-30 02:20:21 +01:00
Justin Clark-Casey (justincc)
26f50eadd1 Remove some pointless catching/throwing in the scene loop. 2012-03-30 02:20:14 +01:00
Justin Clark-Casey (justincc)
6e8496ffc5 Comment out unused scene loop restart code.
This has actually been unused since at least 0.7.2 due to earlier changes.
2012-03-30 02:18:13 +01:00
Justin Clark-Casey (justincc)
88d6c4ec0e Use m_lastFrameTick instead of m_lastUpdate in Scene.GetHealth(). m_lastUpdate is no longer properly updated and is redundant anyway. 2012-03-30 02:18:05 +01:00
Justin Clark-Casey (justincc)
135eeb45d6 Change flavour to extended 2012-03-30 02:16:11 +01:00
Justin Clark-Casey (justincc)
54ee59c0bb Add Extended flavour option to opensim version information.
This flavour is for changes in addition to the 0.7.3-post-fixes branch that are too large to be considered fixes but should be reasonably stable.
This flavour will almost certainly never see a formal release.
2012-03-30 02:13:37 +01:00
Justin Clark-Casey (justincc)
4a5c61a33d Enable voice by default on parcels to weaken effects of viewer 2/3 ParcelVoiceInfoRequest bug
Viewer 2/3 contains a bug where the viewer will constantly retry ParcelVoiceInfoRequest requests on voice-disabled parcels where voice is otherwise available.
Attempts to fix this server-side have not been successful - sending a non-OK http code (e.g. a 404) just makes the viewer request again immediately.
Dropping the request entirely is a bit better but the viewer still retries after a minute.
Estate settings already enabled voice by default so doing the same for parcels.  This only has an effect if you have any voice system active at all.
Ultimately, the re-request bug needs to be fixed viewer-side (LL suffers from the same issue!) but it might be worth implementing the drop request hack.
2012-03-30 02:03:52 +01:00
Diva Canto
179c0f5f56 Merge branch '0.7.3-post-fixes' of ssh://opensimulator.org/var/git/opensim into 0.7.3-post-fixes 2012-03-22 20:36:01 -07:00
Justin Clark-Casey (justincc)
4dbf937707 Comment out login parameters debug output accidentally included with c4b2d24 2012-03-22 23:33:08 +00:00
Justin Clark-Casey (justincc)
9edb57e5e9 Comment out a terrain save-tile debugging message that accidentally crept in with c4b2d24 2012-03-22 23:17:54 +00:00
Justin Clark-Casey (justincc)
4d15ad63bf refactor: simplify code for checks when part.OwnerID != destPart.OwnerID in MoveTaskInventoryItem() 2012-03-22 23:03:00 +00:00
Justin Clark-Casey (justincc)
4021709371 Fix llGiveInventory() so that it checks the destination part for AllowInventoryDrop, not the source.
This allows llAllowInventoryDrop() to work.
Regression test added for this case.
2012-03-22 23:02:49 +00:00
Justin Clark-Casey (justincc)
3c13f5c3aa Add llGiveInventory() test from object to object where both objects are owned by the same user. 2012-03-22 23:02:35 +00:00
Justin Clark-Casey (justincc)
381517b451 Add prim name to "[MESH]: No recognized physics mesh..." log message 2012-03-22 23:01:39 +00:00
Justin Clark-Casey (justincc)
6ecf36d49c Fix small typo 2012-03-22 22:47:03 +00:00
Justin Clark-Casey (justincc)
64eb4b8408 Fix crash where two scene loop threads could changes m_MeshToTriMeshMap at the same time.
Have to lock m_MeshToTriMeshMap as property is static and with more than one region two scene loops could try to manipulate at the same time.
2012-03-22 22:46:45 +00:00
Diva Canto
318da3fdcd Added new simple_build_permissions config to the .ini and .example files. 2012-03-22 14:34:46 -07:00
Melanie
50c99fcda6 Change a false false to be truly true - or is this statement false?
Fixes perms boo-boo
2012-03-22 14:34:33 -07:00
Melanie
321de1f263 Rework Diva's patch to simplify it 2012-03-22 14:34:19 -07:00
Diva Canto
fa30ace67d Fixed borkness with map search introduce by my last changes to it. 2012-03-20 17:49:05 -07:00
Justin Clark-Casey (justincc)
92baa79253 Add some doc about the EventManager.OnLoginsEnabled event. 2012-03-19 22:49:34 +00:00
Justin Clark-Casey (justincc)
e861b45313 Fix a bug where logins to standalones would fail if the RegionReady module was not active
Unfortunately, the OnLoginsEnabled event is currently only guaranteed to fire if the RegionReady module is active.
However, we can instantiate the AuthorizationService in the module RegionLoaded method since by this time all other modules will have been loaded
2012-03-19 22:49:14 +00:00
Justin Clark-Casey (justincc)
cf91ac68b6 Stop console command "xengine status" throwing an exception if there are no scripts in a region.
Addresses http://opensimulator.org/mantis/view.php?id=5940
2012-03-19 21:45:18 +00:00
Justin Clark-Casey (justincc)
d4aba13526 Clean up "save iar" help 2012-03-19 21:33:03 +00:00
Justin Clark-Casey (justincc)
d36c7c3782 minor: reuse threadpool count we just fetched instead of fetching it again 2012-03-19 21:32:50 +00:00
Justin Clark-Casey (justincc)
4385fcdeae Add total scripts count to "show threads"
However, this returns 0 on Mono (at least on 2.6.7)!  So not showing if it is zero.
2012-03-19 21:32:42 +00:00
Justin Clark-Casey (justincc)
04eb170624 refactor: separate out console and status report generation parts of XEngine 2012-03-19 21:32:34 +00:00
Justin Clark-Casey (justincc)
4803686078 Improve threadpool reporting to "show threads" console command (also gets printed out periodically) 2012-03-19 21:32:25 +00:00
Justin Clark-Casey (justincc)
20b0fda3bb Add process working memory to "show stats" memory statistics.
This shows the actual amount of RAM being taken up by OpenSimulator (objects + vm overhead)
2012-03-19 21:32:16 +00:00
Justin Clark-Casey (justincc)
4e5f823595 In Top Scripts report, don't show scripts with no or less than 1 microsecond of execution time.
This is to make the report clearer and less confusing.
2012-03-19 21:32:02 +00:00
Justin Clark-Casey (justincc)
a74408d1d2 Aggregate script execution times by linksets rather than individual prims.
This is for the top scripts report.
2012-03-19 21:31:53 +00:00
Justin Clark-Casey (justincc)
8206537efd Fix owner name display in "Top Colliders" and "Top Script" region reports. 2012-03-19 21:31:45 +00:00
Justin Clark-Casey (justincc)
a9a77bb3ab Replace script-lines-per-second with the script execution time scaled by its measurement period and an idealised frame time.
The previous lines-per-second measurement used for top scripts report was inaccurate, since lines executed does not reflect time taken to execute.
Also, every fetch of the report would reset all the numbers limiting its usefulness and we weren't even guaranteed to see the top 100.
The actual measurement value should be script execution time per frame but XEngine does not work this way.
Therefore, we use actual script execution time scaled by the measurement period and an idealised frame time.
This is still not ideal but gives reasonable results and allows scripts to be compared.
This commit moves script execution time calculations from SceneGraph into IScriptModule implementations.
2012-03-19 21:31:38 +00:00
Justin Clark-Casey (justincc)
6390de689d Remove property/field duplication in ScriptInstance where it's unnecessary. 2012-03-19 21:31:17 +00:00
Justin Clark-Casey (justincc)
41ce19836b Simplify some logic in the ScriptInstance constructor - running is set to false in both if/else branches 2012-03-19 21:31:07 +00:00
Melanie
883a4f6fff FireAndForget scripted rez - port from Avination 2012-03-19 21:30:31 +00:00
Justin Clark-Casey (justincc)
5f1da80fc1 minor: correct indentation levels 2012-03-19 21:30:16 +00:00
Justin Clark-Casey (justincc)
64217d67f6 Remove duplication of m_RunEvents and Running 2012-03-19 21:29:45 +00:00
Justin Clark-Casey (justincc)
b01c79354c Fix a problem where multiple near simultaneous calls to llDie() from multiple scripts in the same linkset can cause unnecessary thread aborts.
The first llDie() could lock Scene.m_deleting_scene_object.
The second llDie() would then wait at this lock.
The first llDie() would go on to remove the second script but always abort it since the second script's WorkItem would not go away.
Easiest solution here is to remove the m_deleting_scene_object since it's no longer justified - we no longer lock m_parts but take a copy instead.
This also requires an adjustment in XEngine.OnRemoveScript not to use instance.ObjectID instead when firing the OnObjectRemoved event.
2012-03-19 21:29:34 +00:00
Justin Clark-Casey (justincc)
9ecbcb787c Alleviate an issue where calling Thread.Abort() on script WorkItems can fail to release locks, resulting in a crippled simulator.
This seems to be a particular problem with ReaderWriterLockSlim, though other locks can be affected as well.
It has been seen to happen when llDie() is called in a linkset running more than one script.
Alleviation here means supplying a ScriptInstance.Stop() timeout of 1000ms rather than 0ms, to give events a chance to complete.
Also, we check the IsRunning status at the top of the ScriptInstance.EventProcessor() so that another event doesn't start in the mean time.
Ultimately, a better solution may have to be found since a long-running event would still exceed the timeout and be aborted.
2012-03-19 21:29:24 +00:00
Justin Clark-Casey (justincc)
e17e376b04 refactor: rename ScriptInstance.m_CurrentResult to m_CurrentWorkItem to make it more understandable as to what it is and what it does (hold a thread pool work item for a waiting of in-progress event)
Also add other various illustrative comments
2012-03-19 21:29:09 +00:00
Justin Clark-Casey (justincc)
1b4ea4f178 Add max thread and min thread information to "xengine status" region console command 2012-03-19 21:28:54 +00:00
Melanie
1de29fb362 Change OpenSim.ini.example to reflect how to actually enable prim limits,
as opposed to how it was first designed.
2012-03-19 21:28:37 +00:00
Justin Clark-Casey (justincc)
7e4bd492fd Add documentation to make more explicit the difference between OnRezScript and OnNewScript in the event manager
OnNewScript fires when a script is added to a scene
OnRezScript fires when the script actually runs (i.e. after permission checks, state retrieval, etc.)
2012-03-19 21:26:32 +00:00
Justin Clark-Casey (justincc)
588d56503d Remove unnecessary explicit ElapsedEventHandler in SimReporter 2012-03-19 21:26:12 +00:00
Justin Clark-Casey (justincc)
e9602656f8 Add sensor, dataserver requests, timer and listener counts to "xengine status" command.
This is for diagnostic purposes.
2012-03-19 21:26:04 +00:00
Justin Clark-Casey (justincc)
0116d418f0 Fix TestSyntaxError() and TestSyntaxErrorDeclaringVariableInForLoop()
They were all failing assertions but the exceptions these threw were caught as expected Exceptions.
I don't think we can easily distinguish these from the Exceptions that we're expecting.
So for now we'll do some messy manually checking with boolean setting instead.
This patch also corrects the assertions themselves.
2012-03-19 21:25:41 +00:00
Justin Clark-Casey (justincc)
9992974c66 Get all test methods in OpenSim.Region.ScriptEngine.Tests.dll to report that they're running 2012-03-19 21:25:30 +00:00
Justin Clark-Casey (justincc)
ba27d8a389 Fix off by one error in script error reporting. 2012-03-19 21:25:20 +00:00
Justin Clark-Casey (justincc)
f96e985763 Simplify NPCModuleTests code by putting the NPCModule in an instance variable rather than making each test fetch it seperately.
Also rename instance variables in the test to conform to naming standards and for understandability
2012-03-19 21:25:07 +00:00
Diva Canto
5b9eaae50d Region access control! Region operators can now specify things like DisallowForeigners (means what it says) and DisallowResidents (means that only admins and managers can get into the region). This puts the never-completed AuthorizationService to good use. Note that I didn't implement a grid-wide Authorization service; this service implementation is done entirely locally on the simulator. This can be changed as usual by pluging in a different AuthorizationServicesConnector. 2012-03-17 19:49:14 -07:00
Diva Canto
74a13f7e3b Fixes mantis #5923 2012-03-17 19:47:05 -07:00
Diva Canto
3e88fc8aad Datasnapshot: added "secret" to the registration/deregistration query so that data providers can verify authenticity if they want. 2012-03-16 17:27:45 -07:00
Diva Canto
881740d702 DataSnapshot: renamed gridserverURL to gatekeeperURL, and normalimzed the capitalization of 'name' to lower case, also in the same <grid> section. 2012-03-16 17:27:29 -07:00
Diva Canto
9a643a1bb9 Terrain: added [Terrain] section with an option to load an initial flat terrain. Default is still pinhead island. I much rather have a flat land in the beginning.
Conflicts:

	bin/OpenSim.ini.example
2012-03-16 13:14:26 -07:00
Diva Canto
a5488650ff More on map search: send extra messages to the user regarding the region being found or not, because the UI is horribly confusing -- places profile is always "loading..." whether the region exists or not. 2012-03-15 20:24:26 -07:00
Diva Canto
a275127a65 More on SLURLs and V3. This is hacky, but it works. Basically, we have to redefine the encoding of HG URLs because the viewer messes them up. Examples of what works and doesn't work:
- secondlife://ucigrid00.nacs.uci.edu|8002/128/128 <-- works throughout the viewer
- secondlife://http|!!ucigrid00.nacs.uci.edu|8002+Test+Zone+1/128/128 <-- works throughout the viewer
- secondlife://http|!!grid.sciencesim.com!grid!hypergrid.php+Yellowstone01+74/128/128 <-- works throughout
- secondlife://http%3A%2F%2Fucigrid00.nacs.uci.edu%3A8002%20UCI%20Central%201/128/128 <-- works in chat, but not as URLs in the webkit
2012-03-15 16:14:20 -07:00
Diva Canto
02db31db6a Revert "Revert "More hacking around viewer bug""
This reverts commit 0434758a0d.
2012-03-15 16:14:07 -07:00
Diva Canto
8bd813e6fc Revert "Revert "Hack around https://jira.secondlife.com/browse/VWR-28570""
This reverts commit 09ff121654.
2012-03-15 16:13:50 -07:00
Diva Canto
09ff121654 Revert "Hack around https://jira.secondlife.com/browse/VWR-28570"
This reverts commit d7651a389e.
2012-03-15 14:38:22 -07:00
Diva Canto
0434758a0d Revert "More hacking around viewer bug"
This reverts commit 8bb0a71083.
2012-03-15 14:38:03 -07:00
Diva Canto
8bb0a71083 More hacking around viewer bug 2012-03-15 11:04:56 -07:00
Diva Canto
d7651a389e Hack around https://jira.secondlife.com/browse/VWR-28570 2012-03-15 10:18:55 -07:00
Justin Clark-Casey (justincc)
824318a0c1 Go back to setting appearance directly in NPCModule.SetAppearance() to fix mantis 5914
The part reverted is from commit 2ebb421.
Unfortunately, IAvatarFactoryModule.SetAppearance() does not transfer attachments.
I'm not sure how to do this separately, unfortunately I'll need to leave it to Dan :)
Regression test added for this case.
Mantis ref: http://opensimulator.org/mantis/view.php?id=5914
2012-03-06 01:32:44 +00:00
Justin Clark-Casey (justincc)
5e9ed22e84 Merge branch '0.7.3-post-fixes' of ssh://opensimulator.org/var/git/opensim into 0.7.3-post-fixes 2012-03-06 00:48:24 +00:00
Chris Hart
a6c611e7c9 Updates to MSSQL store for 0.7.3 to include:
* Telehub support
* Bugfix to Friends lookups
* Updates to Creator fields to store up to 255 characters for HG item creator storage
2012-03-06 00:45:58 +00:00
Diva Canto
72b325f8b5 Send the right name and creation date on the BasicProfileModule. 2012-03-01 19:58:57 -08:00
Justin Clark-Casey (justincc)
54d0514b13 Move SenseRepeaters.Count check inside the SenseRepeatListLock.
No methods in the List class are thread safe in the MS specification/documentation
2012-03-02 00:37:48 +00:00
Justin Clark-Casey (justincc)
58b1c3cec0 lock SenseRepeatListLock when added a new sensor during script reconstitution.
This is already being done in the other place where a sensor is added.
Adding a sensor whilst another thread is iterating over the sensor list can cause a concurrency exception.
2012-03-02 00:37:42 +00:00
Justin Clark-Casey (justincc)
71641523a3 Flick 0.7.3-post-fixes to Flavour.Post_Fixes 2012-02-29 23:43:41 +00:00
Justin Clark-Casey (justincc)
94c5e25c3b Extend distsrc target to cleanup the files generated by running prebuild 2012-02-29 22:32:32 +00:00
Justin Clark-Casey (justincc)
20bad0aa6c Merge branch '0.7.3-post-fixes' of ssh://opensimulator.org/var/git/opensim into 0.7.3-post-fixes 2012-02-29 22:22:42 +00:00
Justin Clark-Casey (justincc)
e7f23a6218 Switch flavour to release 2012-02-29 22:10:33 +00:00
Justin Clark-Casey (justincc)
25c29db8b6 Don't start pCampbot if the user doesn't supply bot firstname, lastname stub and password 2012-02-29 22:04:17 +00:00
Justin Clark-Casey (justincc)
1750fba9ce Call Dispose() via using() on SqliteCommands in WebStatsModule after use. 2012-02-29 22:04:04 +00:00
PixelTomsen
b18e410586 PRIM_SCULPT_FLAG_INVERT, PRIM_SCULPT_FLAG_MIRROR implemented
http://opensimulator.org/mantis/view.php?id=5763
2012-02-29 22:03:28 +00:00
Justin Clark-Casey (justincc)
38d5e1fab3 Move libopenjpeg native libraries into lib32 and lib64 as appropriate. 2012-02-29 22:03:15 +00:00
Justin Clark-Casey (justincc)
4180c32eb1 Remove some more unused Bullet libraries. 2012-02-29 22:03:08 +00:00
Justin Clark-Casey (justincc)
5115229fdf Remove old libbulletnet native libraries. These are not used in the current generation bullet physics plugin. 2012-02-29 22:02:59 +00:00
Justin Clark-Casey (justincc)
e8f2d814e7 Move other sqlite and ode 32-bit and 64-bit libraries into lib32 or lib64 as appropriate. 2012-02-29 22:02:50 +00:00
Diva Canto
1fda8c5a86 HG: Remove async in posting assets to foreign grid. Mono hates concurrency there. 2012-02-26 14:30:58 -08:00
Justin Clark-Casey (justincc)
6b77b55d40 Merge branch 'master' into 0.7.3-post-fixes 2012-02-25 00:49:16 +00:00
Justin Clark-Casey (justincc)
82cdb08c1f Merge branch 'master' into 0.7.3-post-fixes 2012-02-25 00:49:05 +00:00
Justin Clark-Casey (justincc)
dafcb3bcd7 Merge branch 'master' into 0.7.3-post-fixes 2012-02-24 23:35:59 +00:00
Diva Canto
3259b1d1e0 Amend to last commit: synchronize access to queues. 2012-02-20 11:13:02 -08:00
Diva Canto
512910a51f More improvements on agent position updates: if the target sims fail, blacklist them for 2 min, so that we don't keep doing remote calls that fail. 2012-02-20 11:00:01 -08:00
Diva Canto
fdda57cf10 Merge branch '0.7.3-post-fixes' of ssh://opensimulator.org/var/git/opensim into 0.7.3-post-fixes 2012-02-19 16:48:09 -08:00
Diva Canto
ec8e34950d One more tweak related to the previous 2 commits. 2012-02-19 16:47:04 -08:00
Diva Canto
93964ef3a4 Amend to last commit. This should have been committed too. 2012-02-19 16:46:47 -08:00
Diva Canto
5c8af6a136 A few more tweaks on position updates and create child agents. Mono hates concurrent uses of the same TCP connection, and even of the connections to the same server. So let's stop doing it. This patch makes movement much smoother when there are lots of neighbours. 2012-02-19 16:46:32 -08:00
PixelTomsen
4d0c8aca05 Fix:OmegaX, OmegaY and OmegaZ not saved for child prims http://opensimulator.org/mantis/view.php?id=5893
Signed-off-by: nebadon <michael@osgrid.org>
2012-02-19 13:49:51 -05:00
PixelTomsen
8fc16ece96 Fix:Fly setting for Parcel dosen't work http://opensimulator.org/mantis/view.php?id=5887
Signed-off-by: nebadon <michael@osgrid.org>
2012-02-19 13:49:41 -05:00
BlueWall
fcbb375e8f Use localy defined name, TPFlags, for Constants.TeleportFlags 2012-02-19 12:42:05 -05:00
BlueWall
49c65279fa Route logins according to Estate, Telehub and TeleportFlags 2012-02-19 12:41:44 -05:00
BlueWall
86e8a56fe1 Propagate our teleport flags on logins 2012-02-19 12:41:30 -05:00
BlueWall
b199330682 Parcel sales support to SQLite 2012-02-19 12:41:11 -05:00
BlueWall
7a7ebaebd1 Fillin missing SQLite support for Telehubs 2012-02-19 12:40:46 -05:00
BlueWall
164ae0b24b Fix missing telehub handling on login 2012-02-19 12:40:26 -05:00
Diva Canto
7156545fca This should smooth movement in heteregeneous networks by a lot: cache the region by position instead of looking it up all the time -- this was being done during the main update loop! 2012-02-18 22:15:58 -08:00
Justin Clark-Casey (justincc)
73a5abf4d9 Merge branch 'master' into 0.7.3-post-fixes 2012-02-17 04:04:38 +00:00
Justin Clark-Casey (justincc)
630c8dc828 switch version flavour to rc2 2012-02-17 04:03:59 +00:00
Justin Clark-Casey (justincc)
6de89246c2 Merge branch 'master' into 0.7.3-post-fixes 2012-02-17 00:02:16 +00:00
Justin Clark-Casey (justincc)
96973a5778 Merge branch 'master' into 0.7.3-post-fixes 2012-02-16 03:39:25 +00:00
Justin Clark-Casey (justincc)
96843f2b17 Merge branch 'master' into 0.7.3-post-fixes 2012-02-15 02:41:50 +00:00
Justin Clark-Casey (justincc)
8a36f54cf4 Merge branch 'master' into 0.7.3-post-fixes 2012-02-06 20:54:21 +00:00
Justin Clark-Casey (justincc)
1a14e660d2 Merge branch 'master' into 0.7.3-post-fixes 2012-02-04 02:03:49 +00:00
Justin Clark-Casey (justincc)
2502aae5db Switch flavour to RC1. It will still be a while before RC1 is released. 2012-02-04 01:26:29 +00:00
215 changed files with 5312 additions and 2832 deletions

View File

@@ -8,6 +8,24 @@
<copy file="bin/OpenSim.ini.example" tofile="bin/OpenSim.ini"/>
<copy file="bin/config-include/StandaloneCommon.ini.example" tofile="bin/config-include/StandaloneCommon.ini"/>
<copy file="bin/config-include/FlotsamCache.ini.example" tofile="bin/config-include/FlotsamCache.ini"/>
<!-- delete files generated by runprebuild.sh which had to be run in order to generate the build file for this target-->
<delete>
<fileset basedir="OpenSim">
<include name="**/*.build"/>
<include name="**/*.csproj*"/>
<include name="**/*.dll.build"/>
<include name="**/*.pidb"/>
<exclude name="Tools/OpenSim.32BitLaunch/**"/>
<exclude name="Tools/Robust.32BitLaunch/**"/>
<exclude name="Tools/LaunchSLClient/**"/>
</fileset>
</delete>
<delete>
<fileset>
<include name="OpenSim.build"/>
<include name="OpenSim.sln"/>
</fileset>
</delete>
</target>
<property name="distbindir" value="distbin" />

View File

@@ -50,7 +50,7 @@ namespace OpenSim.Capabilities.Handlers.GetTexture.Tests
TestHelpers.InMethod();
// Overkill - we only really need the asset service, not a whole scene.
Scene scene = SceneHelpers.SetupScene();
Scene scene = new SceneHelpers().SetupScene();
GetTextureHandler handler = new GetTextureHandler(null, scene.AssetService);
TestOSHttpRequest req = new TestOSHttpRequest();

View File

@@ -89,5 +89,11 @@ namespace OpenSim.Data.MSSQL
return DoQuery(cmd);
}
}
public FriendsData[] GetFriends(Guid principalID)
{
return GetFriends(principalID.ToString());
}
}
}

View File

@@ -813,7 +813,7 @@ namespace OpenSim.Data.MSSQL
{
try
{
using (SqlCommand command = new SqlCommand("DELETE FROM inventoryfolders WHERE folderID=@folderID", connection))
using (SqlCommand command = new SqlCommand("DELETE FROM inventoryfolders WHERE folderID=@folderID and type=-1", connection))
{
command.Parameters.Add(database.CreateParameter("folderID", folderID));

View File

@@ -675,7 +675,7 @@ VALUES
cmd.ExecuteNonQuery();
}
sql = "INSERT INTO [landaccesslist] ([LandUUID],[AccessUUID],[Flags]) VALUES (@LandUUID,@AccessUUID,@Flags)";
sql = "INSERT INTO [landaccesslist] ([LandUUID],[AccessUUID],[Flags],[Expires]) VALUES (@LandUUID,@AccessUUID,@Flags,@Expires)";
using (SqlConnection conn = new SqlConnection(m_connectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn))
@@ -1215,6 +1215,8 @@ VALUES
//Store new values
StoreNewRegionSettings(regionSettings);
LoadSpawnPoints(regionSettings);
return regionSettings;
}
@@ -1252,7 +1254,7 @@ VALUES
,[elevation_1_ne] = @elevation_1_ne ,[elevation_2_ne] = @elevation_2_ne ,[elevation_1_se] = @elevation_1_se ,[elevation_2_se] = @elevation_2_se
,[elevation_1_sw] = @elevation_1_sw ,[elevation_2_sw] = @elevation_2_sw ,[water_height] = @water_height ,[terrain_raise_limit] = @terrain_raise_limit
,[terrain_lower_limit] = @terrain_lower_limit ,[use_estate_sun] = @use_estate_sun ,[fixed_sun] = @fixed_sun ,[sun_position] = @sun_position
,[covenant] = @covenant ,[covenant_datetime] = @covenant_datetime, [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id
,[covenant] = @covenant ,[covenant_datetime] = @covenant_datetime, [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id, [map_tile_id] = @TerrainImageID, [telehubobject] = @telehubobject, [parcel_tile_id] = @ParcelImageID
WHERE [regionUUID] = @regionUUID";
using (SqlConnection conn = new SqlConnection(m_connectionString))
@@ -1263,6 +1265,7 @@ VALUES
cmd.ExecuteNonQuery();
}
}
SaveSpawnPoints(regionSettings);
}
public void Shutdown()
@@ -1383,6 +1386,11 @@ VALUES
newSettings.LoadedCreationID = "";
else
newSettings.LoadedCreationID = (String)row["loaded_creation_id"];
newSettings.TerrainImageID = new UUID((string)row["map_tile_ID"]);
newSettings.ParcelImageID = new UUID((Guid)row["parcel_tile_ID"]);
newSettings.TelehubObject = new UUID((Guid)row["TelehubObject"]);
return newSettings;
}
@@ -1454,6 +1462,13 @@ VALUES
}
newData.ParcelAccessList = new List<LandAccessEntry>();
newData.MediaDescription = (string)row["MediaDescription"];
newData.MediaType = (string)row["MediaType"];
newData.MediaWidth = Convert.ToInt32((((string)row["MediaSize"]).Split(','))[0]);
newData.MediaHeight = Convert.ToInt32((((string)row["MediaSize"]).Split(','))[1]);
newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]);
newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
return newData;
}
@@ -1468,7 +1483,7 @@ VALUES
LandAccessEntry entry = new LandAccessEntry();
entry.AgentID = new UUID((Guid)row["AccessUUID"]);
entry.Flags = (AccessList)Convert.ToInt32(row["Flags"]);
entry.Expires = 0;
entry.Expires = Convert.ToInt32(row["Expires"]);
return entry;
}
@@ -1497,7 +1512,8 @@ VALUES
prim.TouchName = (string)primRow["TouchName"];
// permissions
prim.Flags = (PrimFlags)Convert.ToUInt32(primRow["ObjectFlags"]);
prim.CreatorID = new UUID((Guid)primRow["CreatorID"]);
//prim.CreatorID = new UUID((Guid)primRow["CreatorID"]);
prim.CreatorIdentification = (string)primRow["CreatorID"];
prim.OwnerID = new UUID((Guid)primRow["OwnerID"]);
prim.GroupID = new UUID((Guid)primRow["GroupID"]);
prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]);
@@ -1691,7 +1707,8 @@ VALUES
taskItem.Name = (string)inventoryRow["name"];
taskItem.Description = (string)inventoryRow["description"];
taskItem.CreationDate = Convert.ToUInt32(inventoryRow["creationDate"]);
taskItem.CreatorID = new UUID((Guid)inventoryRow["creatorID"]);
//taskItem.CreatorID = new UUID((Guid)inventoryRow["creatorID"]);
taskItem.CreatorIdentification = (string)inventoryRow["creatorID"];
taskItem.OwnerID = new UUID((Guid)inventoryRow["ownerID"]);
taskItem.LastOwnerID = new UUID((Guid)inventoryRow["lastOwnerID"]);
taskItem.GroupID = new UUID((Guid)inventoryRow["groupID"]);
@@ -1792,6 +1809,9 @@ VALUES
parameters.Add(_Database.CreateParameter("covenant_datetime", settings.CovenantChangedDateTime));
parameters.Add(_Database.CreateParameter("Loaded_Creation_DateTime", settings.LoadedCreationDateTime));
parameters.Add(_Database.CreateParameter("Loaded_Creation_ID", settings.LoadedCreationID));
parameters.Add(_Database.CreateParameter("TerrainImageID", settings.TerrainImageID));
parameters.Add(_Database.CreateParameter("ParcelImageID", settings.ParcelImageID));
parameters.Add(_Database.CreateParameter("TelehubObject", settings.TelehubObject));
return parameters.ToArray();
}
@@ -1859,6 +1879,7 @@ VALUES
parameters.Add(_Database.CreateParameter("LandUUID", parcelID));
parameters.Add(_Database.CreateParameter("AccessUUID", parcelAccessEntry.AgentID));
parameters.Add(_Database.CreateParameter("Flags", parcelAccessEntry.Flags));
parameters.Add(_Database.CreateParameter("Expires", parcelAccessEntry.Expires));
return parameters.ToArray();
}
@@ -2063,5 +2084,57 @@ VALUES
#endregion
#endregion
private void LoadSpawnPoints(RegionSettings rs)
{
rs.ClearSpawnPoints();
string sql = "SELECT Yaw, Pitch, Distance FROM spawn_points WHERE RegionUUID = @RegionUUID";
using (SqlConnection conn = new SqlConnection(m_connectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", rs.RegionUUID.ToString()));
conn.Open();
using (SqlDataReader reader = cmd.ExecuteReader())
{
if (reader.Read())
{
SpawnPoint sp = new SpawnPoint();
sp.Yaw = (float)reader["Yaw"];
sp.Pitch = (float)reader["Pitch"];
sp.Distance = (float)reader["Distance"];
rs.AddSpawnPoint(sp);
}
}
}
}
private void SaveSpawnPoints(RegionSettings rs)
{
string sql = "DELETE FROM spawn_points WHERE RegionUUID = @RegionUUID";
using (SqlConnection conn = new SqlConnection(m_connectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", rs.RegionUUID));
conn.Open();
cmd.ExecuteNonQuery();
}
foreach (SpawnPoint p in rs.SpawnPoints())
{
sql = "INSERT INTO spawn_points (RegionUUID, Yaw, Pitch, Distance) VALUES (@RegionUUID, @Yaw, @Pitch, @Distance)";
using (SqlConnection conn = new SqlConnection(m_connectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", rs.RegionUUID));
cmd.Parameters.Add(_Database.CreateParameter("@Yaw", p.Yaw));
cmd.Parameters.Add(_Database.CreateParameter("@Pitch", p.Pitch));
cmd.Parameters.Add(_Database.CreateParameter("@Distance", p.Distance));
conn.Open();
cmd.ExecuteNonQuery();
}
}
}
}
}

View File

@@ -1044,10 +1044,93 @@ ALTER TABLE primitems ALTER COLUMN CreatorID uniqueidentifier NOT NULL
COMMIT
:VERSION 29 #---------------------
:VERSION 29 #----------------- Region Covenant changed time
BEGIN TRANSACTION
ALTER TABLE regionsettings ADD covenant_datetime int NOT NULL default 0
COMMIT
:VERSION 30 #------------------Migrate creatorID storage to varchars instead of UUIDs for HG support
BEGIN TRANSACTION
EXECUTE sp_rename N'dbo.prims.creatorid', N'creatoridold', 'COLUMN'
EXECUTE sp_rename N'dbo.primitems.creatorid', N'creatoridold', 'COLUMN'
COMMIT
:VERSION 31 #---------------------
BEGIN TRANSACTION
ALTER TABLE prims ADD CreatorID varchar(255)
ALTER TABLE primitems ADD CreatorID varchar(255)
COMMIT
:VERSION 32 #---------------------
BEGIN TRANSACTION
UPDATE prims SET prims.CreatorID = CONVERT(varchar(255), creatoridold)
UPDATE primitems SET primitems.CreatorID = CONVERT(varchar(255), creatoridold)
COMMIT
:VERSION 33 #---------------------
BEGIN TRANSACTION
ALTER TABLE prims
ADD CONSTRAINT DF_prims_CreatorIDNew
DEFAULT '00000000-0000-0000-0000-000000000000'
FOR CreatorID
ALTER TABLE prims ALTER COLUMN CreatorID varchar(255) NOT NULL
ALTER TABLE primitems
ADD CONSTRAINT DF_primitems_CreatorIDNew
DEFAULT '00000000-0000-0000-0000-000000000000'
FOR CreatorID
ALTER TABLE primitems ALTER COLUMN CreatorID varchar(255) NOT NULL
COMMIT
:VERSION 34 #--------------- Telehub support
BEGIN TRANSACTION
CREATE TABLE [dbo].[Spawn_Points](
[RegionUUID] [uniqueidentifier] NOT NULL,
[Yaw] [float] NOT NULL,
[Pitch] [float] NOT NULL,
[Distance] [float] NOT NULL,
PRIMARY KEY CLUSTERED
(
[RegionUUID] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
ALTER TABLE regionsettings ADD TelehubObject uniqueidentifier NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
COMMIT
:VERSION 35 #---------------- Parcels for sale
BEGIN TRANSACTION
ALTER TABLE regionsettings ADD parcel_tile_ID uniqueidentifier NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
COMMIT
:VERSION 36 #---------------- Timed bans/access
BEGIN TRANSACTION
ALTER TABLE landaccesslist ADD Expires integer NOT NULL DEFAULT 0;
COMMIT

View File

@@ -28,6 +28,9 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Threading;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Data;
@@ -36,12 +39,26 @@ namespace OpenSim.Data.Null
{
public class NullFriendsData : IFriendsData
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static List<FriendsData> m_Data = new List<FriendsData>();
public NullFriendsData(string connectionString, string realm)
{
}
/// <summary>
/// Clear all friends data
/// </summary>
/// <remarks>
/// This is required by unit tests to clear the static data between test runs.
/// </remarks>
public static void Clear()
{
lock (m_Data)
m_Data.Clear();
}
public FriendsData[] GetFriends(UUID principalID)
{
return GetFriends(principalID.ToString());
@@ -56,20 +73,30 @@ namespace OpenSim.Data.Null
/// <returns></returns>
public FriendsData[] GetFriends(string userID)
{
List<FriendsData> lst = m_Data.FindAll(fdata =>
lock (m_Data)
{
return fdata.PrincipalID == userID.ToString();
});
if (lst != null)
{
lst.ForEach(f =>
List<FriendsData> lst = m_Data.FindAll(fdata =>
{
FriendsData f2 = m_Data.Find(candidateF2 => f.Friend == candidateF2.PrincipalID);
if (f2 != null) { f.Data["TheirFlags"] = f2.Data["Flags"]; }
return fdata.PrincipalID == userID.ToString();
});
return lst.ToArray();
if (lst != null)
{
lst.ForEach(f =>
{
FriendsData f2 = m_Data.Find(candidateF2 => f.Friend == candidateF2.PrincipalID);
if (f2 != null)
f.Data["TheirFlags"] = f2.Data["Flags"];
// m_log.DebugFormat(
// "[NULL FRIENDS DATA]: Got {0} {1} {2} for {3}",
// f.Friend, f.Data["Flags"], f2 != null ? f.Data["TheirFlags"] : "not found!", f.PrincipalID);
});
// m_log.DebugFormat("[NULL FRIENDS DATA]: Got {0} friends for {1}", lst.Count, userID);
return lst.ToArray();
}
}
return new FriendsData[0];
@@ -80,7 +107,11 @@ namespace OpenSim.Data.Null
if (data == null)
return false;
m_Data.Add(data);
// m_log.DebugFormat(
// "[NULL FRIENDS DATA]: Storing {0} {1} {2}", data.PrincipalID, data.Friend, data.Data["Flags"]);
lock (m_Data)
m_Data.Add(data);
return true;
}
@@ -92,14 +123,21 @@ namespace OpenSim.Data.Null
public bool Delete(string userID, string friendID)
{
List<FriendsData> lst = m_Data.FindAll(delegate(FriendsData fdata) { return fdata.PrincipalID == userID.ToString(); });
if (lst != null)
lock (m_Data)
{
FriendsData friend = lst.Find(delegate(FriendsData fdata) { return fdata.Friend == friendID; });
if (friendID != null)
List<FriendsData> lst = m_Data.FindAll(delegate(FriendsData fdata) { return fdata.PrincipalID == userID.ToString(); });
if (lst != null)
{
m_Data.Remove(friend);
return true;
FriendsData friend = lst.Find(delegate(FriendsData fdata) { return fdata.Friend == friendID; });
if (friendID != null)
{
// m_log.DebugFormat(
// "[NULL FRIENDS DATA]: Deleting friend {0} {1} for {2}",
// friend.Friend, friend.Data["Flags"], friend.PrincipalID);
m_Data.Remove(friend);
return true;
}
}
}

View File

@@ -110,7 +110,6 @@ namespace OpenSim.Data.Null
return false;
}
public PresenceData[] Get(string field, string data)
{
if (Instance != this)

View File

@@ -29,6 +29,7 @@ using System;
using System.Xml;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
@@ -40,6 +41,8 @@ namespace OpenSim.Framework.Console
{
public class Commands : ICommands
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// Encapsulates a command that can be invoked from the console
/// </summary>
@@ -76,12 +79,23 @@ namespace OpenSim.Framework.Console
public List<CommandDelegate> fn;
}
public const string GeneralHelpText
= "To enter an argument that contains spaces, surround the argument with double quotes.\nFor example, show object name \"My long object name\"\n";
public const string ItemHelpText
= "For more information, type 'help <item>' where <item> is one of the following:";
/// <value>
/// Commands organized by keyword in a tree
/// </value>
private Dictionary<string, object> tree =
new Dictionary<string, object>();
/// <summary>
/// Commands organized by module
/// </summary>
private Dictionary<string, List<CommandInfo>> m_modulesCommands = new Dictionary<string, List<CommandInfo>>();
/// <summary>
/// Get help for the given help string
/// </summary>
@@ -98,8 +112,10 @@ namespace OpenSim.Framework.Console
// General help
if (helpParts.Count == 0)
{
help.AddRange(CollectHelp(tree));
help.Sort();
help.Add(""); // Will become a newline.
help.Add(GeneralHelpText);
help.Add(ItemHelpText);
help.AddRange(CollectModulesHelp(tree));
}
else
{
@@ -118,6 +134,13 @@ namespace OpenSim.Framework.Console
{
string originalHelpRequest = string.Join(" ", helpParts.ToArray());
List<string> help = new List<string>();
// Check modules first to see if we just need to display a list of those commands
if (TryCollectModuleHelp(originalHelpRequest, help))
{
help.Insert(0, ItemHelpText);
return help;
}
Dictionary<string, object> dict = tree;
while (helpParts.Count > 0)
@@ -161,25 +184,63 @@ namespace OpenSim.Framework.Console
return help;
}
private List<string> CollectHelp(Dictionary<string, object> dict)
/// <summary>
/// Try to collect help for the given module if that module exists.
/// </summary>
/// <param name="moduleName"></param>
/// <param name="helpText">/param>
/// <returns>true if there was the module existed, false otherwise.</returns>
private bool TryCollectModuleHelp(string moduleName, List<string> helpText)
{
List<string> result = new List<string>();
foreach (KeyValuePair<string, object> kvp in dict)
lock (m_modulesCommands)
{
if (kvp.Value is Dictionary<string, Object>)
foreach (string key in m_modulesCommands.Keys)
{
result.AddRange(CollectHelp((Dictionary<string, Object>)kvp.Value));
}
else
{
if (((CommandInfo)kvp.Value).long_help != String.Empty)
result.Add(((CommandInfo)kvp.Value).help_text+" - "+
((CommandInfo)kvp.Value).long_help);
// Allow topic help requests to succeed whether they are upper or lowercase.
if (moduleName.ToLower() == key.ToLower())
{
List<CommandInfo> commands = m_modulesCommands[key];
var ourHelpText = commands.ConvertAll(c => string.Format("{0} - {1}", c.help_text, c.long_help));
ourHelpText.Sort();
helpText.AddRange(ourHelpText);
return true;
}
}
return false;
}
return result;
}
private List<string> CollectModulesHelp(Dictionary<string, object> dict)
{
lock (m_modulesCommands)
{
List<string> helpText = new List<string>(m_modulesCommands.Keys);
helpText.Sort();
return helpText;
}
}
// private List<string> CollectHelp(Dictionary<string, object> dict)
// {
// List<string> result = new List<string>();
//
// foreach (KeyValuePair<string, object> kvp in dict)
// {
// if (kvp.Value is Dictionary<string, Object>)
// {
// result.AddRange(CollectHelp((Dictionary<string, Object>)kvp.Value));
// }
// else
// {
// if (((CommandInfo)kvp.Value).long_help != String.Empty)
// result.Add(((CommandInfo)kvp.Value).help_text+" - "+
// ((CommandInfo)kvp.Value).long_help);
// }
// }
// return result;
// }
/// <summary>
/// Add a command to those which can be invoked from the console.
@@ -212,21 +273,19 @@ namespace OpenSim.Framework.Console
Dictionary<string, Object> current = tree;
foreach (string s in parts)
foreach (string part in parts)
{
if (current.ContainsKey(s))
if (current.ContainsKey(part))
{
if (current[s] is Dictionary<string, Object>)
{
current = (Dictionary<string, Object>)current[s];
}
if (current[part] is Dictionary<string, Object>)
current = (Dictionary<string, Object>)current[part];
else
return;
}
else
{
current[s] = new Dictionary<string, Object>();
current = (Dictionary<string, Object>)current[s];
current[part] = new Dictionary<string, Object>();
current = (Dictionary<string, Object>)current[part];
}
}
@@ -250,6 +309,24 @@ namespace OpenSim.Framework.Console
info.fn = new List<CommandDelegate>();
info.fn.Add(fn);
current[String.Empty] = info;
// Now add command to modules dictionary
lock (m_modulesCommands)
{
List<CommandInfo> commands;
if (m_modulesCommands.ContainsKey(module))
{
commands = m_modulesCommands[module];
}
else
{
commands = new List<CommandInfo>();
m_modulesCommands[module] = commands;
}
// m_log.DebugFormat("[COMMAND CONSOLE]: Adding to category {0} command {1}", module, command);
commands.Add(info);
}
}
public string[] FindNextOption(string[] cmd, bool term)
@@ -607,8 +684,9 @@ namespace OpenSim.Framework.Console
{
Commands = new Commands();
Commands.AddCommand("console", false, "help", "help [<command>]",
"Get general command list or more detailed help on a specific command", Help);
Commands.AddCommand(
"Help", false, "help", "help [<item>]",
"Display help on a particular command or on a list of commands in a category", Help);
}
private void Help(string module, string[] cmd)

View File

@@ -29,6 +29,7 @@ using System;
using System.Threading;
using System.Collections.Generic;
using System.Text;
using System.Xml;
namespace OpenSim.Framework.Console
{
@@ -37,28 +38,42 @@ namespace OpenSim.Framework.Console
/// Don't use this except for Unit Testing or you're in for a world of hurt when the
/// sim gets to ReadLine
/// </summary>
public class MockConsole : CommandConsole
public class MockConsole : ICommandConsole
{
public MockConsole(string defaultPrompt) : base(defaultPrompt)
{
}
public override void Output(string text)
{
}
public override void Output(string text, string level)
{
}
private MockCommands m_commands = new MockCommands();
public override string ReadLine(string p, bool isCommand, bool e)
{
//Thread.CurrentThread.Join(1000);
return string.Empty;
}
public override void UnlockOutput()
{
}
public override void LockOutput()
{
}
public ICommands Commands { get { return m_commands; } }
public void Prompt() {}
public void RunCommand(string cmd) {}
public string ReadLine(string p, bool isCommand, bool e) { return ""; }
public object ConsoleScene { get { return null; } }
public void Output(string text, string level) {}
public void Output(string text) {}
public void OutputFormat(string format, params object[] components) {}
public string CmdPrompt(string p) { return ""; }
public string CmdPrompt(string p, string def) { return ""; }
public string CmdPrompt(string p, List<char> excludedCharacters) { return ""; }
public string CmdPrompt(string p, string def, List<char> excludedCharacters) { return ""; }
public string CmdPrompt(string prompt, string defaultresponse, List<string> options) { return ""; }
public string PasswdPrompt(string p) { return ""; }
}
}
public class MockCommands : ICommands
{
public void FromXml(XmlElement root, CommandDelegate fn) {}
public List<string> GetHelp(string[] cmd) { return null; }
public void AddCommand(string module, bool shared, string command, string help, string longhelp, CommandDelegate fn) {}
public void AddCommand(string module, bool shared, string command, string help, string longhelp, string descriptivehelp, CommandDelegate fn) {}
public string[] FindNextOption(string[] cmd, bool term) { return null; }
public string[] Resolve(string[] cmd) { return null; }
public XmlElement GetXml(XmlDocument doc) { return null; }
}
}

View File

@@ -0,0 +1,62 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Reflection;
using log4net;
public class GcNotify
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static bool Enabled
{
get { return s_initialized; }
set
{
if (!s_initialized && value)
new GcNotify();
s_initialized = value;
}
}
private static bool s_initialized = false;
private GcNotify() {}
~GcNotify()
{
if (!Environment.HasShutdownStarted && !AppDomain.CurrentDomain.IsFinalizingForUnload())
{
m_log.DebugFormat("[GC NOTIFY]: Garbage collection triggered.");
if (Enabled)
new GcNotify();
}
}
}

View File

@@ -296,9 +296,9 @@ namespace OpenSim.Framework
public delegate void ConfirmXfer(IClientAPI remoteClient, ulong xferID, uint packetID);
public delegate void FriendActionDelegate(
IClientAPI remoteClient, UUID agentID, UUID transactionID, List<UUID> callingCardFolders);
IClientAPI remoteClient, UUID transactionID, List<UUID> callingCardFolders);
public delegate void FriendshipTermination(IClientAPI remoteClient, UUID agentID, UUID ExID);
public delegate void FriendshipTermination(IClientAPI remoteClient, UUID ExID);
public delegate void MoneyTransferRequest(
UUID sourceID, UUID destID, int amount, int transactionType, string description);
@@ -458,7 +458,7 @@ namespace OpenSim.Framework
public delegate void AvatarNotesUpdate(IClientAPI client, UUID targetID, string notes);
public delegate void MuteListRequest(IClientAPI client, uint muteCRC);
public delegate void AvatarInterestUpdate(IClientAPI client, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages);
public delegate void GrantUserFriendRights(IClientAPI client, UUID requester, UUID target, int rights);
public delegate void GrantUserFriendRights(IClientAPI client, UUID target, int rights);
public delegate void PlacesQuery(UUID QueryID, UUID TransactionID, string QueryText, uint QueryFlags, byte Category, string SimName, IClientAPI client);
public delegate void AgentFOV(IClientAPI client, float verticalAngle);
@@ -710,7 +710,7 @@ namespace OpenSim.Framework
/// The scene agent for this client. This will only be set if the client has an agent in a scene (i.e. if it
/// is connected).
/// </summary>
ISceneAgent SceneAgent { get; }
ISceneAgent SceneAgent { get; set; }
UUID SessionId { get; }

View File

@@ -40,7 +40,7 @@ namespace OpenSim.Framework
/// <summary>
/// Get help for the given help string
/// </summary>
/// <param name="helpParts">Parsed parts of the help string. If empty then general help is returned.</param>
/// <param name="cmd">Parsed parts of the help string. If empty then general help is returned.</param>
/// <returns></returns>
List<string> GetHelp(string[] cmd);

View File

@@ -71,6 +71,7 @@ namespace OpenSim.Framework
bool IsEitherBannedOrRestricted(UUID avatar);
bool IsBannedFromLand(UUID avatar);
bool IsRestrictedFromLand(UUID avatar);
bool IsInLandAccessList(UUID avatar);
void SendLandUpdateToClient(IClientAPI remote_client);
void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client);
List<LandAccessEntry> CreateAccessListArrayByFlag(AccessList flag);

View File

@@ -69,7 +69,7 @@ namespace OpenSim.Framework
(uint) ParcelFlags.AllowAPrimitiveEntry |
(uint) ParcelFlags.AllowDeedToGroup | (uint) ParcelFlags.AllowTerraform |
(uint) ParcelFlags.CreateObjects | (uint) ParcelFlags.AllowOtherScripts |
(uint) ParcelFlags.SoundLocal;
(uint) ParcelFlags.SoundLocal | (uint) ParcelFlags.AllowVoiceChat;
private byte _landingType = 0;
private string _name = "Your Parcel";

View File

@@ -161,43 +161,43 @@ namespace OpenSim.Framework.Servers
Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold));
}
m_console.Commands.AddCommand("base", false, "quit",
m_console.Commands.AddCommand("General", false, "quit",
"quit",
"Quit the application", HandleQuit);
m_console.Commands.AddCommand("base", false, "shutdown",
m_console.Commands.AddCommand("General", false, "shutdown",
"shutdown",
"Quit the application", HandleQuit);
m_console.Commands.AddCommand("base", false, "set log level",
m_console.Commands.AddCommand("General", false, "set log level",
"set log level <level>",
"Set the console logging level", HandleLogLevel);
m_console.Commands.AddCommand("base", false, "show info",
m_console.Commands.AddCommand("General", false, "show info",
"show info",
"Show general information about the server", HandleShow);
m_console.Commands.AddCommand("base", false, "show stats",
m_console.Commands.AddCommand("General", false, "show stats",
"show stats",
"Show statistics", HandleShow);
m_console.Commands.AddCommand("base", false, "show threads",
m_console.Commands.AddCommand("General", false, "show threads",
"show threads",
"Show thread status", HandleShow);
m_console.Commands.AddCommand("base", false, "show uptime",
m_console.Commands.AddCommand("General", false, "show uptime",
"show uptime",
"Show server uptime", HandleShow);
m_console.Commands.AddCommand("base", false, "show version",
m_console.Commands.AddCommand("General", false, "show version",
"show version",
"Show server version", HandleShow);
m_console.Commands.AddCommand("base", false, "threads abort",
m_console.Commands.AddCommand("General", false, "threads abort",
"threads abort <thread-id>",
"Abort a managed thread. Use \"show threads\" to find possible threads.", HandleThreadsAbort);
m_console.Commands.AddCommand("base", false, "threads show",
m_console.Commands.AddCommand("General", false, "threads show",
"threads show",
"Show thread status. Synonym for \"show threads\"",
(string module, string[] args) => Notice(GetThreadsReport()));
@@ -269,15 +269,19 @@ namespace OpenSim.Framework.Servers
t.Priority,
t.ThreadState);
sb.Append(Environment.NewLine);
sb.Append("\n");
}
int workers = 0, ports = 0, maxWorkers = 0, maxPorts = 0;
ThreadPool.GetAvailableThreads(out workers, out ports);
ThreadPool.GetMaxThreads(out maxWorkers, out maxPorts);
sb.Append("\n");
sb.Append(Environment.NewLine + "*** ThreadPool threads ***" + Environment.NewLine);
sb.Append("workers: " + (maxWorkers - workers) + " (" + maxWorkers + "); ports: " + (maxPorts - ports) + " (" + maxPorts + ")" + Environment.NewLine);
// For some reason mono 2.6.7 returns an empty threads set! Not going to confuse people by reporting
// zero active threads.
int totalThreads = Process.GetCurrentProcess().Threads.Count;
if (totalThreads > 0)
sb.AppendFormat("Total threads active: {0}\n\n", totalThreads);
sb.Append("Main threadpool (excluding script engine pools)\n");
sb.Append(Util.GetThreadPoolReport());
return sb.ToString();
}

View File

@@ -662,11 +662,11 @@ namespace OpenSim.Framework.Servers.HttpServer
}
catch (IOException e)
{
m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw ", e);
m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}{1}", e.Message, e.StackTrace);
}
catch (Exception e)
{
m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw " + e.ToString());
m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}{1}", e.Message, e.StackTrace);
SendHTML500(response);
}
finally

View File

@@ -30,7 +30,7 @@ namespace OpenSim
public class VersionInfo
{
private const string VERSION_NUMBER = "0.7.3";
private const Flavour VERSION_FLAVOUR = Flavour.Dev;
private const Flavour VERSION_FLAVOUR = Flavour.Extended;
public enum Flavour
{
@@ -39,7 +39,8 @@ namespace OpenSim
RC1,
RC2,
Release,
Post_Fixes
Post_Fixes,
Extended
}
public static string Version

View File

@@ -26,8 +26,8 @@
*/
using System;
using System.Diagnostics;
using System.Text;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
@@ -46,8 +46,12 @@ namespace OpenSim.Framework.Statistics
sb.Append(Environment.NewLine);
sb.Append(
string.Format(
"Allocated to OpenSim : {0} MB" + Environment.NewLine,
"Allocated to OpenSim objects: {0} MB\n",
Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0)));
sb.Append(
string.Format(
"Process memory : {0} MB\n",
Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0)));
return sb.ToString();
}

View File

@@ -81,12 +81,15 @@ namespace OpenSim.Framework
private static uint nextXferID = 5000;
private static Random randomClass = new Random();
// Get a list of invalid file characters (OS dependent)
private static string regexInvalidFileChars = "[" + new String(Path.GetInvalidFileNameChars()) + "]";
private static string regexInvalidPathChars = "[" + new String(Path.GetInvalidPathChars()) + "]";
private static object XferLock = new object();
/// <summary>Thread pool used for Util.FireAndForget if
/// FireAndForgetMethod.SmartThreadPool is used</summary>
/// <summary>
/// Thread pool used for Util.FireAndForget if FireAndForgetMethod.SmartThreadPool is used
/// </summary>
private static SmartThreadPool m_ThreadPool;
// Unix-epoch starts at January 1st 1970, 00:00:00 UTC. And all our times in the server are (or at least should be) in UTC.
@@ -144,7 +147,6 @@ namespace OpenSim.Framework
return lerp(y, lerp(x, a, b), lerp(x, c, d));
}
public static Encoding UTF8 = Encoding.UTF8;
/// <value>
@@ -1671,6 +1673,61 @@ namespace OpenSim.Framework
}
}
/// <summary>
/// Get a thread pool report.
/// </summary>
/// <returns></returns>
public static string GetThreadPoolReport()
{
string threadPoolUsed = null;
int maxThreads = 0;
int minThreads = 0;
int allocatedThreads = 0;
int inUseThreads = 0;
int waitingCallbacks = 0;
int completionPortThreads = 0;
StringBuilder sb = new StringBuilder();
if (FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool)
{
threadPoolUsed = "SmartThreadPool";
maxThreads = m_ThreadPool.MaxThreads;
minThreads = m_ThreadPool.MinThreads;
inUseThreads = m_ThreadPool.InUseThreads;
allocatedThreads = m_ThreadPool.ActiveThreads;
waitingCallbacks = m_ThreadPool.WaitingCallbacks;
}
else if (
FireAndForgetMethod == FireAndForgetMethod.UnsafeQueueUserWorkItem
|| FireAndForgetMethod == FireAndForgetMethod.UnsafeQueueUserWorkItem)
{
threadPoolUsed = "BuiltInThreadPool";
ThreadPool.GetMaxThreads(out maxThreads, out completionPortThreads);
ThreadPool.GetMinThreads(out minThreads, out completionPortThreads);
int availableThreads;
ThreadPool.GetAvailableThreads(out availableThreads, out completionPortThreads);
inUseThreads = maxThreads - availableThreads;
allocatedThreads = -1;
waitingCallbacks = -1;
}
if (threadPoolUsed != null)
{
sb.AppendFormat("Thread pool used : {0}\n", threadPoolUsed);
sb.AppendFormat("Max threads : {0}\n", maxThreads);
sb.AppendFormat("Min threads : {0}\n", minThreads);
sb.AppendFormat("Allocated threads : {0}\n", allocatedThreads < 0 ? "not applicable" : allocatedThreads.ToString());
sb.AppendFormat("In use threads : {0}\n", inUseThreads);
sb.AppendFormat("Work items waiting : {0}\n", waitingCallbacks < 0 ? "not available" : waitingCallbacks.ToString());
}
else
{
sb.AppendFormat("Thread pool not used\n");
}
return sb.ToString();
}
private static object SmartThreadPoolCallback(object o)
{
object[] array = (object[])o;
@@ -1696,6 +1753,20 @@ namespace OpenSim.Framework
}
const Int32 EnvironmentTickCountMask = 0x3fffffff;
/// <summary>
/// Environment.TickCount is an int but it counts all 32 bits so it goes positive
/// and negative every 24.9 days. Subtracts the passed value (previously fetched by
/// 'EnvironmentTickCount()') and accounts for any wrapping.
/// </summary>
/// <param name="newValue"></param>
/// <param name="prevValue"></param>
/// <returns>subtraction of passed prevValue from current Environment.TickCount</returns>
public static Int32 EnvironmentTickCountSubtract(Int32 newValue, Int32 prevValue)
{
Int32 diff = newValue - prevValue;
return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1);
}
/// <summary>
/// Environment.TickCount is an int but it counts all 32 bits so it goes positive
/// and negative every 24.9 days. Subtracts the passed value (previously fetched by
@@ -1704,8 +1775,7 @@ namespace OpenSim.Framework
/// <returns>subtraction of passed prevValue from current Environment.TickCount</returns>
public static Int32 EnvironmentTickCountSubtract(Int32 prevValue)
{
Int32 diff = EnvironmentTickCount() - prevValue;
return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1);
return EnvironmentTickCountSubtract(EnvironmentTickCount(), prevValue);
}
// Returns value of Tick Count A - TickCount B accounting for wrapping of TickCount

View File

@@ -225,12 +225,12 @@ namespace OpenSim
/// </summary>
private void RegisterConsoleCommands()
{
m_console.Commands.AddCommand("region", false, "force update",
m_console.Commands.AddCommand("Objects", false, "force update",
"force update",
"Force the update of all objects on clients",
HandleForceUpdate);
m_console.Commands.AddCommand("region", false, "debug packet",
m_console.Commands.AddCommand("Comms", false, "debug packet",
"debug packet <level> [<avatar-first-name> <avatar-last-name>]",
"Turn on packet debugging",
"If level > 255 then all incoming and outgoing packets are logged.\n"
@@ -242,7 +242,7 @@ namespace OpenSim
+ "If an avatar name is given then only packets from that avatar are logged",
Debug);
m_console.Commands.AddCommand("region", false, "debug http",
m_console.Commands.AddCommand("Comms", false, "debug http",
"debug http <level>",
"Turn on inbound http request debugging for everything except the event queue (see debug eq).",
"If level >= 2 then the handler used to service the request is logged.\n"
@@ -250,37 +250,37 @@ namespace OpenSim
+ "If level <= 0 then no extra http logging is done.\n",
Debug);
m_console.Commands.AddCommand("region", false, "debug teleport", "debug teleport", "Toggle teleport route debugging", Debug);
m_console.Commands.AddCommand("Comms", false, "debug teleport", "debug teleport", "Toggle teleport route debugging", Debug);
m_console.Commands.AddCommand("region", false, "debug scene",
m_console.Commands.AddCommand("Regions", false, "debug scene",
"debug scene <scripting> <collisions> <physics>",
"Turn on scene debugging", Debug);
m_console.Commands.AddCommand("region", false, "change region",
m_console.Commands.AddCommand("General", false, "change region",
"change region <region name>",
"Change current console region", ChangeSelectedRegion);
m_console.Commands.AddCommand("region", false, "save xml",
m_console.Commands.AddCommand("Archiving", false, "save xml",
"save xml",
"Save a region's data in XML format", SaveXml);
m_console.Commands.AddCommand("region", false, "save xml2",
m_console.Commands.AddCommand("Archiving", false, "save xml2",
"save xml2",
"Save a region's data in XML2 format", SaveXml2);
m_console.Commands.AddCommand("region", false, "load xml",
m_console.Commands.AddCommand("Archiving", false, "load xml",
"load xml [-newIDs [<x> <y> <z>]]",
"Load a region's data from XML format", LoadXml);
m_console.Commands.AddCommand("region", false, "load xml2",
m_console.Commands.AddCommand("Archiving", false, "load xml2",
"load xml2",
"Load a region's data from XML2 format", LoadXml2);
m_console.Commands.AddCommand("region", false, "save prims xml2",
m_console.Commands.AddCommand("Archiving", false, "save prims xml2",
"save prims xml2 [<prim name> <file name>]",
"Save named prim to XML2", SavePrimsXml2);
m_console.Commands.AddCommand("region", false, "load oar",
m_console.Commands.AddCommand("Archiving", false, "load oar",
"load oar [--merge] [--skip-assets] [<OAR path>]",
"Load a region's data from an OAR archive.",
"--merge will merge the OAR with the existing scene." + Environment.NewLine
@@ -289,7 +289,7 @@ namespace OpenSim
+ " If this is not given then the command looks for an OAR named region.oar in the current directory.",
LoadOar);
m_console.Commands.AddCommand("region", false, "save oar",
m_console.Commands.AddCommand("Archiving", false, "save oar",
//"save oar [-v|--version=<N>] [-p|--profile=<url>] [<OAR path>]",
"save oar [-h|--home=<url>] [--noassets] [--publish] [--perm=<permissions>] [<OAR path>]",
"Save a region's data to an OAR archive.",
@@ -306,54 +306,54 @@ namespace OpenSim
+ " If this is not given then the oar is saved to region.oar in the current directory.",
SaveOar);
m_console.Commands.AddCommand("region", false, "edit scale",
m_console.Commands.AddCommand("Objects", false, "edit scale",
"edit scale <name> <x> <y> <z>",
"Change the scale of a named prim", HandleEditScale);
m_console.Commands.AddCommand("region", false, "kick user",
m_console.Commands.AddCommand("Users", false, "kick user",
"kick user <first> <last> [message]",
"Kick a user off the simulator", KickUserCommand);
m_console.Commands.AddCommand("region", false, "show users",
m_console.Commands.AddCommand("Users", false, "show users",
"show users [full]",
"Show user data for users currently on the region",
"Without the 'full' option, only users actually on the region are shown."
+ " With the 'full' option child agents of users in neighbouring regions are also shown.",
HandleShow);
m_console.Commands.AddCommand("region", false, "show connections",
m_console.Commands.AddCommand("Comms", false, "show connections",
"show connections",
"Show connection data", HandleShow);
m_console.Commands.AddCommand("region", false, "show circuits",
m_console.Commands.AddCommand("Comms", false, "show circuits",
"show circuits",
"Show agent circuit data", HandleShow);
m_console.Commands.AddCommand("region", false, "show http-handlers",
m_console.Commands.AddCommand("Comms", false, "show http-handlers",
"show http-handlers",
"Show all registered http handlers", HandleShow);
m_console.Commands.AddCommand("region", false, "show pending-objects",
m_console.Commands.AddCommand("Comms", false, "show pending-objects",
"show pending-objects",
"Show # of objects on the pending queues of all scene viewers", HandleShow);
m_console.Commands.AddCommand("region", false, "show modules",
m_console.Commands.AddCommand("General", false, "show modules",
"show modules",
"Show module data", HandleShow);
m_console.Commands.AddCommand("region", false, "show regions",
m_console.Commands.AddCommand("Regions", false, "show regions",
"show regions",
"Show region data", HandleShow);
m_console.Commands.AddCommand("region", false, "show ratings",
m_console.Commands.AddCommand("Regions", false, "show ratings",
"show ratings",
"Show rating data", HandleShow);
m_console.Commands.AddCommand("region", false, "backup",
m_console.Commands.AddCommand("Objects", false, "backup",
"backup",
"Persist currently unsaved object changes immediately instead of waiting for the normal persistence call.", RunCommand);
m_console.Commands.AddCommand("region", false, "create region",
m_console.Commands.AddCommand("Regions", false, "create region",
"create region [\"region name\"] <region_file.ini>",
"Create a new region.",
"The settings for \"region name\" are read from <region_file.ini>. Paths specified with <region_file.ini> are relative to your Regions directory, unless an absolute path is given."
@@ -362,62 +362,57 @@ namespace OpenSim
+ "If <region_file.ini> does not exist, it will be created.",
HandleCreateRegion);
m_console.Commands.AddCommand("region", false, "restart",
m_console.Commands.AddCommand("Regions", false, "restart",
"restart",
"Restart all sims in this instance", RunCommand);
m_console.Commands.AddCommand("region", false, "config set",
m_console.Commands.AddCommand("General", false, "config set",
"config set <section> <key> <value>",
"Set a config option. In most cases this is not useful since changed parameters are not dynamically reloaded. Neither do changed parameters persist - you will have to change a config file manually and restart.", HandleConfig);
m_console.Commands.AddCommand("region", false, "config get",
m_console.Commands.AddCommand("General", false, "config get",
"config get [<section>] [<key>]",
"Synonym for config show",
HandleConfig);
m_console.Commands.AddCommand("region", false, "config show",
m_console.Commands.AddCommand("General", false, "config show",
"config show [<section>] [<key>]",
"Show config information",
"If neither section nor field are specified, then the whole current configuration is printed." + Environment.NewLine
+ "If a section is given but not a field, then all fields in that section are printed.",
HandleConfig);
m_console.Commands.AddCommand("region", false, "config save",
m_console.Commands.AddCommand("General", false, "config save",
"config save <path>",
"Save current configuration to a file at the given path", HandleConfig);
m_console.Commands.AddCommand("region", false, "command-script",
m_console.Commands.AddCommand("General", false, "command-script",
"command-script <script>",
"Run a command script from file", RunCommand);
m_console.Commands.AddCommand("region", false, "remove-region",
m_console.Commands.AddCommand("Regions", false, "remove-region",
"remove-region <name>",
"Remove a region from this simulator", RunCommand);
m_console.Commands.AddCommand("region", false, "delete-region",
m_console.Commands.AddCommand("Regions", false, "delete-region",
"delete-region <name>",
"Delete a region from disk", RunCommand);
m_console.Commands.AddCommand("region", false, "modules list",
m_console.Commands.AddCommand("General", false, "modules list",
"modules list",
"List modules", HandleModules);
m_console.Commands.AddCommand("region", false, "modules load",
m_console.Commands.AddCommand("General", false, "modules load",
"modules load <name>",
"Load a module", HandleModules);
m_console.Commands.AddCommand("region", false, "modules unload",
m_console.Commands.AddCommand("General", false, "modules unload",
"modules unload <name>",
"Unload a module", HandleModules);
m_console.Commands.AddCommand("region", false, "Add-InventoryHost",
"Add-InventoryHost <host>",
String.Empty, RunCommand);
m_console.Commands.AddCommand("region", false, "kill uuid",
m_console.Commands.AddCommand("Objects", false, "kill uuid",
"kill uuid <UUID>",
"Kill an object by UUID", KillUUID);
}
public override void ShutdownSpecific()
@@ -829,14 +824,6 @@ namespace OpenSim
case "restart":
m_sceneManager.RestartCurrentScene();
break;
case "Add-InventoryHost":
if (cmdparams.Length > 0)
{
MainConsole.Instance.Output("Not implemented.");
}
break;
}
}
@@ -928,7 +915,7 @@ namespace OpenSim
break;
case "scene":
if (args.Length == 5)
if (args.Length == 4)
{
if (m_sceneManager.CurrentScene == null)
{
@@ -936,39 +923,21 @@ namespace OpenSim
}
else
{
bool scriptingOn = !Convert.ToBoolean(args[2]);
bool collisionsOn = !Convert.ToBoolean(args[3]);
bool physicsOn = !Convert.ToBoolean(args[4]);
m_sceneManager.CurrentScene.SetSceneCoreDebug(scriptingOn, collisionsOn, physicsOn);
string key = args[2];
string value = args[3];
m_sceneManager.CurrentScene.SetSceneCoreDebug(
new Dictionary<string, string>() { { key, value } });
MainConsole.Instance.Output(
String.Format(
"Set debug scene scripting = {0}, collisions = {1}, physics = {2}",
!scriptingOn, !collisionsOn, !physicsOn));
MainConsole.Instance.OutputFormat("Set debug scene {0} = {1}", key, value);
}
}
else
{
MainConsole.Instance.Output("Usage: debug scene <scripting> <collisions> <physics> (where inside <> is true/false)");
MainConsole.Instance.Output("Usage: debug scene scripting|collisions|physics|teleport true|false");
}
break;
case "teleport":
foreach(Scene s in m_sceneManager.Scenes)
{
if (s.DEBUG)
{
s.DEBUG = false;
MainConsole.Instance.Output("Teleport debugging is disabled!");
}
else{
s.DEBUG = true;
MainConsole.Instance.Output("Teleport debugging is enabled!");
}
}
break;
default:
MainConsole.Instance.Output("Unknown debug command");
break;

View File

@@ -242,15 +242,18 @@ namespace OpenSim
foreach (string topic in topics)
{
m_console.Commands.AddCommand("plugin", false, "help " + topic,
"help " + topic,
string capitalizedTopic = char.ToUpper(topic[0]) + topic.Substring(1);
// This is a hack to allow the user to enter the help command in upper or lowercase. This will go
// away at some point.
m_console.Commands.AddCommand(capitalizedTopic, false, "help " + topic,
"help " + capitalizedTopic,
"Get help on plugin command '" + topic + "'",
HandleCommanderHelp);
m_console.Commands.AddCommand(capitalizedTopic, false, "help " + capitalizedTopic,
"help " + capitalizedTopic,
"Get help on plugin command '" + topic + "'",
HandleCommanderHelp);
m_console.Commands.AddCommand("plugin", false, topic,
topic,
"Execute subcommand for plugin '" + topic + "'",
null);
ICommander commander = null;
@@ -267,7 +270,7 @@ namespace OpenSim
foreach (string command in commander.Commands.Keys)
{
m_console.Commands.AddCommand(topic, false,
m_console.Commands.AddCommand(capitalizedTopic, false,
topic + " " + command,
topic + " " + commander.Commands[command].ShortHelp(),
String.Empty, HandleCommanderCommand);
@@ -286,7 +289,7 @@ namespace OpenSim
// Only safe for the interactive console, since it won't
// let us come here unless both scene and commander exist
//
ICommander moduleCommander = SceneManager.CurrentOrFirstScene.GetCommander(cmd[1]);
ICommander moduleCommander = SceneManager.CurrentOrFirstScene.GetCommander(cmd[1].ToLower());
if (moduleCommander != null)
m_console.Output(moduleCommander.Help);
}
@@ -424,7 +427,7 @@ namespace OpenSim
mscene = scene;
scene.StartTimer();
scene.Start();
scene.StartScripts();

View File

@@ -231,7 +231,10 @@ namespace OpenSim.Region.ClientStack.Linden
if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint))
{
m_log.DebugFormat("[CAPS]: Unauthorized CAPS client");
m_log.DebugFormat(
"[CAPS]: Unauthorized CAPS client {0} from {1}",
m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint);
return string.Empty;
}

View File

@@ -106,7 +106,7 @@ namespace OpenSim.Region.ClientStack.Linden
scene.EventManager.OnRegisterCaps += OnRegisterCaps;
MainConsole.Instance.Commands.AddCommand(
"event queue",
"Comms",
false,
"debug eq",
"debug eq [0|1]",

View File

@@ -60,7 +60,7 @@ namespace OpenSim.Region.ClientStack.Linden.Tests
CapabilitiesModule capsModule = new CapabilitiesModule();
EventQueueGetModule eqgModule = new EventQueueGetModule();
m_scene = SceneHelpers.SetupScene();
m_scene = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(m_scene, config, capsModule, eqgModule);
}

View File

@@ -385,7 +385,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
set { m_startpos = value; }
}
public UUID AgentId { get { return m_agentId; } }
public ISceneAgent SceneAgent { get; private set; }
public ISceneAgent SceneAgent { get; set; }
public UUID ActiveGroupId { get { return m_activeGroupID; } }
public string ActiveGroupName { get { return m_activeGroupName; } }
public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } }
@@ -698,7 +698,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public virtual void Start()
{
SceneAgent = m_scene.AddNewClient(this, PresenceType.User);
m_scene.AddNewClient(this, PresenceType.User);
RefreshGroupMembership();
}
@@ -4273,7 +4273,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
block.OwnerID = sop.OwnerID;
block.ItemID = sop.FromUserInventoryItemID;
block.FolderID = UUID.Zero; // sop.FromFolderID ??
block.FolderID = UUID.Zero; // sog.FromFolderID ??
block.FromTaskID = UUID.Zero; // ???
block.InventorySerial = (short)sop.InventorySerial;
@@ -4959,7 +4959,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim
if (data.ParentGroup.IsAttachment)
{
update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.FromItemID);
update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.ParentGroup.FromItemID);
update.State = (byte)((data.ParentGroup.AttachmentPoint % 16) * 16 + (data.ParentGroup.AttachmentPoint / 16));
}
else
@@ -5787,7 +5787,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// My guess is this is the folder to stick the calling card into
List<UUID> callingCardFolders = new List<UUID>();
UUID agentID = afriendpack.AgentData.AgentID;
UUID transactionID = afriendpack.TransactionBlock.TransactionID;
for (int fi = 0; fi < afriendpack.FolderData.Length; fi++)
@@ -5798,10 +5797,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
FriendActionDelegate handlerApproveFriendRequest = OnApproveFriendRequest;
if (handlerApproveFriendRequest != null)
{
handlerApproveFriendRequest(this, agentID, transactionID, callingCardFolders);
handlerApproveFriendRequest(this, transactionID, callingCardFolders);
}
return true;
return true;
}
private bool HandlerDeclineFriendship(IClientAPI sender, Packet Pack)
@@ -5820,7 +5819,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (OnDenyFriendRequest != null)
{
OnDenyFriendRequest(this,
dfriendpack.AgentData.AgentID,
dfriendpack.TransactionBlock.TransactionID,
null);
}
@@ -5840,14 +5838,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
#endregion
UUID listOwnerAgentID = tfriendpack.AgentData.AgentID;
UUID exFriendID = tfriendpack.ExBlock.OtherID;
FriendshipTermination TerminateFriendshipHandler = OnTerminateFriendship;
if (TerminateFriendshipHandler != null)
{
TerminateFriendshipHandler(this, listOwnerAgentID, exFriendID);
TerminateFriendshipHandler(this, exFriendID);
return true;
}
return false;
}
@@ -11165,12 +11163,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return true;
}
#endregion
GrantUserFriendRights GrantUserRightsHandler = OnGrantUserRights;
if (GrantUserRightsHandler != null)
GrantUserRightsHandler(this,
GrantUserRights.AgentData.AgentID,
GrantUserRights.Rights[0].AgentRelated,
GrantUserRights.Rights[0].RelatedRights);
return true;
}

View File

@@ -916,7 +916,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
UDPPacketBuffer buffer = (UDPPacketBuffer)array[0];
UseCircuitCodePacket uccp = (UseCircuitCodePacket)array[1];
m_log.DebugFormat("[LLUDPSERVER]: Handling UseCircuitCode request from {0}", buffer.RemoteEndPoint);
m_log.DebugFormat(
"[LLUDPSERVER]: Handling UseCircuitCode request for circuit {0} from {1}",
uccp.CircuitCode.Code, buffer.RemoteEndPoint);
remoteEndPoint = (IPEndPoint)buffer.RemoteEndPoint;
@@ -1350,7 +1352,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
else
{
m_log.DebugFormat("[LLUDPSERVER]: Dropping incoming {0} packet for dead client {1}", packet.Type, udpClient.AgentID);
m_log.DebugFormat(
"[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}",
packet.Type, udpClient.AgentID, m_scene.RegionInfo.RegionName);
}
}

View File

@@ -158,7 +158,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
TestHelpers.InMethod();
// XmlConfigurator.Configure();
TestScene scene = SceneHelpers.SetupScene();
TestScene scene = new SceneHelpers().SetupScene();
uint myCircuitCode = 123456;
UUID myAgentUuid = TestHelpers.ParseTail(0x1);
UUID mySessionUuid = TestHelpers.ParseTail(0x2);

View File

@@ -79,7 +79,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
J2KDecoderModule j2kdm = new J2KDecoderModule();
scene = SceneHelpers.SetupScene();
scene = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(scene, j2kdm);
tc = new TestClient(SceneHelpers.GenerateAgentData(userId), scene);

View File

@@ -50,7 +50,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
m_regStatus = RegionStatus.Up;
}
public override void Update() {}
public override void Update(int frames) {}
public override void LoadWorldMap() {}
public override ISceneAgent AddNewClient(IClientAPI client, PresenceType type)

View File

@@ -203,10 +203,10 @@ namespace Flotsam.RegionModules.AssetCache
m_CacheDirectoryTierLen = 4;
}
MainConsole.Instance.Commands.AddCommand(Name, true, "fcache status", "fcache status", "Display cache status", HandleConsoleCommand);
MainConsole.Instance.Commands.AddCommand(Name, true, "fcache clear", "fcache clear [file] [memory]", "Remove all assets in the cache. If file or memory is specified then only this cache is cleared.", HandleConsoleCommand);
MainConsole.Instance.Commands.AddCommand(Name, true, "fcache assets", "fcache assets", "Attempt a deep scan and cache of all assets in all scenes", HandleConsoleCommand);
MainConsole.Instance.Commands.AddCommand(Name, true, "fcache expire", "fcache expire <datetime>", "Purge cached assets older then the specified date/time", HandleConsoleCommand);
MainConsole.Instance.Commands.AddCommand("Assets", true, "fcache status", "fcache status", "Display cache status", HandleConsoleCommand);
MainConsole.Instance.Commands.AddCommand("Assets", true, "fcache clear", "fcache clear [file] [memory]", "Remove all assets in the cache. If file or memory is specified then only this cache is cleared.", HandleConsoleCommand);
MainConsole.Instance.Commands.AddCommand("Assets", true, "fcache assets", "fcache assets", "Attempt a deep scan and cache of all assets in all scenes", HandleConsoleCommand);
MainConsole.Instance.Commands.AddCommand("Assets", true, "fcache expire", "fcache expire <datetime>", "Purge cached assets older then the specified date/time", HandleConsoleCommand);
}
}
}

View File

@@ -65,7 +65,7 @@ namespace OpenSim.Region.CoreModules.Asset.Tests
config.Configs["AssetCache"].Set("MemoryCacheEnabled", "true");
m_cache = new FlotsamAssetCache();
m_scene = SceneHelpers.SetupScene();
m_scene = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(m_scene, config, m_cache);
}

View File

@@ -239,7 +239,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// At the moment we can only deal with a single attachment
if (attachments.Count != 0)
{
UUID oldAttachmentItemID = attachments[0].GetFromItemID();
UUID oldAttachmentItemID = attachments[0].FromItemID;
if (oldAttachmentItemID != UUID.Zero)
DetachSingleAttachmentToInvInternal(sp, oldAttachmentItemID);
@@ -250,7 +250,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
}
// Add the new attachment to inventory if we don't already have it.
UUID newAttachmentItemID = group.GetFromItemID();
UUID newAttachmentItemID = group.FromItemID;
if (newAttachmentItemID == UUID.Zero)
newAttachmentItemID = AddSceneObjectAsNewAttachmentInInv(sp, group).ID;
@@ -285,7 +285,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
List<SceneObjectGroup> existingAttachments = sp.GetAttachments();
foreach (SceneObjectGroup so in existingAttachments)
{
if (so.GetFromItemID() == itemID)
if (so.FromItemID == itemID)
{
alreadyOn = true;
break;
@@ -342,7 +342,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
if (so.AttachedAvatar != sp.UUID)
return;
UUID inventoryID = so.GetFromItemID();
UUID inventoryID = so.FromItemID;
// m_log.DebugFormat(
// "[ATTACHMENTS MODULE]: In DetachSingleAttachmentToGround(), object is {0} {1}, associated item is {2}",
@@ -359,9 +359,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID);
sp.RemoveAttachment(so);
so.FromItemID = UUID.Zero;
SceneObjectPart rootPart = so.RootPart;
rootPart.FromItemID = UUID.Zero;
so.AbsolutePosition = sp.AbsolutePosition;
so.AttachedAvatar = UUID.Zero;
rootPart.SetParentLocalId(0);
@@ -389,7 +389,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
lock (sp.AttachmentsSyncLock)
{
// Save avatar attachment information
m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + sp.UUID + ", ItemID: " + itemID);
// m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + sp.UUID + ", ItemID: " + itemID);
bool changed = sp.Appearance.DetachAttachment(itemID);
if (changed && m_scene.AvatarFactory != null)
@@ -469,13 +469,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
if (grp.HasGroupChanged || (saveAllScripted && grp.ContainsScripts()))
{
m_log.DebugFormat(
"[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
grp.UUID, grp.AttachmentPoint);
// m_log.DebugFormat(
// "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
// grp.UUID, grp.AttachmentPoint);
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp);
InventoryItemBase item = new InventoryItemBase(grp.GetFromItemID(), sp.UUID);
InventoryItemBase item = new InventoryItemBase(grp.FromItemID, sp.UUID);
item = m_scene.InventoryService.GetItem(item);
if (item != null)
@@ -502,12 +502,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
}
grp.HasGroupChanged = false; // Prevent it being saved over and over
}
else
{
m_log.DebugFormat(
"[ATTACHMENTS MODULE]: Don't need to update asset for unchanged attachment {0}, attachpoint {1}",
grp.UUID, grp.AttachmentPoint);
}
// else
// {
// m_log.DebugFormat(
// "[ATTACHMENTS MODULE]: Don't need to update asset for unchanged attachment {0}, attachpoint {1}",
// grp.UUID, grp.AttachmentPoint);
// }
}
/// <summary>
@@ -647,7 +647,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
item.CreationDate = Util.UnixTimeSinceEpoch();
// sets itemID so client can show item as 'attached' in inventory
grp.SetFromItemID(item.ID);
grp.FromItemID = item.ID;
if (m_scene.AddInventoryItem(item))
{
@@ -683,7 +683,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
if (entity is SceneObjectGroup)
{
group = (SceneObjectGroup)entity;
if (group.GetFromItemID() == itemID)
if (group.FromItemID == itemID)
{
m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero);
sp.RemoveAttachment(group);
@@ -889,13 +889,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// Calls attach with a Zero position
if (AttachObject(sp, part.ParentGroup, AttachmentPt, false))
{
m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
// m_log.Debug(
// "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
// + ", AttachmentPoint: " + AttachmentPt);
// Save avatar attachment information
m_log.Debug(
"[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
+ ", AttachmentPoint: " + AttachmentPt);
m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.FromItemID, remoteClient.AgentId);
}
}
catch (Exception e)
@@ -912,7 +911,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID);
if (sp != null && group != null)
DetachSingleAttachmentToInv(sp, group.GetFromItemID());
DetachSingleAttachmentToInv(sp, group.FromItemID);
}
private void Client_OnDetachAttachmentIntoInv(UUID itemID, IClientAPI remoteClient)

View File

@@ -72,7 +72,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
config.AddConfig("Modules");
config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
scene = SceneHelpers.SetupScene();
scene = new SceneHelpers().SetupScene();
m_attMod = new AttachmentsModule();
SceneHelpers.SetupSceneModules(scene, config, m_attMod, new BasicInventoryAccessModule());
}
@@ -120,8 +120,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
Assert.That(attSo.IsTemporary, Is.False);
// Check item status
Assert.That(m_presence.Appearance.GetAttachpoint(
attSo.GetFromItemID()), Is.EqualTo((int)AttachmentPoint.Chest));
Assert.That(
m_presence.Appearance.GetAttachpoint(attSo.FromItemID),
Is.EqualTo((int)AttachmentPoint.Chest));
}
[Test]

View File

@@ -158,7 +158,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
// Process the baked texture array
if (textureEntry != null)
{
m_log.InfoFormat("[AVFACTORY]: Received texture update for {0} {1}", sp.Name, sp.UUID);
// m_log.DebugFormat("[AVFACTORY]: Received texture update for {0} {1}", sp.Name, sp.UUID);
// WriteBakedTexturesReport(sp, m_log.DebugFormat);
@@ -208,7 +208,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
ScenePresence sp = m_scene.GetScenePresence(agentId);
if (sp == null)
{
m_log.WarnFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentId);
// This is expected if the user has gone away.
// m_log.DebugFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentId);
return false;
}
@@ -337,7 +338,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
return false;
}
m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1}", sp.Name, sp.UUID);
// m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1}", sp.Name, sp.UUID);
// If we only found default textures, then the appearance is not cached
return (defonly ? false : true);
@@ -482,7 +483,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
ScenePresence sp = m_scene.GetScenePresence(agentid);
if (sp == null)
{
m_log.WarnFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentid);
// This is expected if the user has gone away.
// m_log.DebugFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentid);
return;
}

View File

@@ -53,7 +53,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
UUID userId = TestHelpers.ParseTail(0x1);
AvatarFactoryModule afm = new AvatarFactoryModule();
TestScene scene = SceneHelpers.SetupScene();
TestScene scene = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(scene, afm);
ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId);
@@ -81,7 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
CoreAssetCache assetCache = new CoreAssetCache();
AvatarFactoryModule afm = new AvatarFactoryModule();
TestScene scene = SceneHelpers.SetupScene(assetCache);
TestScene scene = new SceneHelpers(assetCache).SetupScene();
SceneHelpers.SetupSceneModules(scene, afm);
ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId);

View File

@@ -51,12 +51,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
m_scene.RegisterModuleInterface<IDialogModule>(this);
m_scene.AddCommand(
this, "alert", "alert <message>",
"Users", this, "alert", "alert <message>",
"Send an alert to everyone",
HandleAlertConsoleCommand);
m_scene.AddCommand(
this, "alert-user", "alert-user <first> <last> <message>",
"Users", this, "alert-user", "alert-user <first> <last> <message>",
"Send an alert to a user",
HandleAlertConsoleCommand);
}

View File

@@ -0,0 +1,313 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Reflection;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
using Mono.Addins;
namespace OpenSim.Region.CoreModules.Avatar.Friends
{
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XCallingCard")]
public class CallingCardModule : ISharedRegionModule, ICallingCardModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected List<Scene> m_Scenes = new List<Scene>();
protected bool m_Enabled = true;
public void Initialise(IConfigSource source)
{
IConfig ccConfig = source.Configs["XCallingCard"];
if (ccConfig != null)
m_Enabled = ccConfig.GetBoolean("Enabled", true);
}
public void AddRegion(Scene scene)
{
if (!m_Enabled)
return;
m_Scenes.Add(scene);
scene.RegisterModuleInterface<ICallingCardModule>(this);
}
public void RemoveRegion(Scene scene)
{
if (!m_Enabled)
return;
m_Scenes.Remove(scene);
scene.EventManager.OnNewClient -= OnNewClient;
scene.EventManager.OnIncomingInstantMessage +=
OnIncomingInstantMessage;
scene.UnregisterModuleInterface<ICallingCardModule>(this);
}
public void RegionLoaded(Scene scene)
{
if (!m_Enabled)
return;
scene.EventManager.OnNewClient += OnNewClient;
}
public void PostInitialise()
{
}
public void Close()
{
}
public Type ReplaceableInterface
{
get { return null; }
}
public string Name
{
get { return "XCallingCardModule"; }
}
private void OnNewClient(IClientAPI client)
{
client.OnOfferCallingCard += OnOfferCallingCard;
client.OnAcceptCallingCard += OnAcceptCallingCard;
client.OnDeclineCallingCard += OnDeclineCallingCard;
}
private void OnOfferCallingCard(IClientAPI client, UUID destID, UUID transactionID)
{
ScenePresence sp = GetClientPresence(client.AgentId);
if (sp != null)
{
// If we're in god mode, we reverse the meaning. Offer
// calling card becomes "Take a calling card" for that
// person, no matter if they agree or not.
if (sp.GodLevel >= 200)
{
CreateCallingCard(client.AgentId, destID, UUID.Zero, true);
return;
}
}
IClientAPI dest = FindClientObject(destID);
if (dest != null)
{
DoCallingCardOffer(dest, client.AgentId);
return;
}
IMessageTransferModule transferModule =
m_Scenes[0].RequestModuleInterface<IMessageTransferModule>();
if (transferModule != null)
{
transferModule.SendInstantMessage(new GridInstantMessage(
client.Scene, client.AgentId,
client.FirstName+" "+client.LastName,
destID, (byte)211, false,
String.Empty,
transactionID, false, new Vector3(), new byte[0]),
delegate(bool success) {} );
}
}
private void DoCallingCardOffer(IClientAPI dest, UUID from)
{
UUID itemID = CreateCallingCard(dest.AgentId, from, UUID.Zero, false);
dest.SendOfferCallingCard(from, itemID);
}
// Create a calling card in the user's inventory. This is called
// from direct calling card creation, when the offer is forwarded,
// and from the friends module when the friend is confirmed.
// Because of the latter, it will send a bulk inventory update
// if the receiving user is in the same simulator.
public UUID CreateCallingCard(UUID userID, UUID creatorID, UUID folderID)
{
return CreateCallingCard(userID, creatorID, folderID, false);
}
private UUID CreateCallingCard(UUID userID, UUID creatorID, UUID folderID, bool isGod)
{
IUserAccountService userv = m_Scenes[0].UserAccountService;
if (userv == null)
return UUID.Zero;
UserAccount info = userv.GetUserAccount(UUID.Zero, creatorID);
if (info == null)
return UUID.Zero;
IInventoryService inv = m_Scenes[0].InventoryService;
if (inv == null)
return UUID.Zero;
if (folderID == UUID.Zero)
{
InventoryFolderBase folder = inv.GetFolderForType(userID,
AssetType.CallingCard);
if (folder == null) // Nowhere to put it
return UUID.Zero;
folderID = folder.ID;
}
m_log.DebugFormat("[XCALLINGCARD]: Creating calling card for {0} in inventory of {1}", info.Name, userID);
InventoryItemBase item = new InventoryItemBase();
item.AssetID = UUID.Zero;
item.AssetType = (int)AssetType.CallingCard;
item.BasePermissions = (uint)(PermissionMask.Copy | PermissionMask.Modify);
if (isGod)
item.BasePermissions = (uint)(PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Move);
item.EveryOnePermissions = (uint)PermissionMask.None;
item.CurrentPermissions = item.BasePermissions;
item.NextPermissions = (uint)(PermissionMask.Copy | PermissionMask.Modify);
item.ID = UUID.Random();
item.CreatorId = creatorID.ToString();
item.Owner = userID;
item.GroupID = UUID.Zero;
item.GroupOwned = false;
item.Folder = folderID;
item.CreationDate = Util.UnixTimeSinceEpoch();
item.InvType = (int)InventoryType.CallingCard;
item.Flags = 0;
item.Name = info.Name;
item.Description = "";
item.SalePrice = 10;
item.SaleType = (byte)SaleType.Not;
inv.AddItem(item);
IClientAPI client = FindClientObject(userID);
if (client != null)
client.SendBulkUpdateInventory(item);
return item.ID;
}
private void OnAcceptCallingCard(IClientAPI client, UUID transactionID, UUID folderID)
{
}
private void OnDeclineCallingCard(IClientAPI client, UUID transactionID)
{
IInventoryService invService = m_Scenes[0].InventoryService;
InventoryFolderBase trashFolder =
invService.GetFolderForType(client.AgentId, AssetType.TrashFolder);
InventoryItemBase item = new InventoryItemBase(transactionID, client.AgentId);
item = invService.GetItem(item);
if (item != null && trashFolder != null)
{
item.Folder = trashFolder.ID;
List<UUID> uuids = new List<UUID>();
uuids.Add(item.ID);
invService.DeleteItems(item.Owner, uuids);
m_Scenes[0].AddInventoryItem(client, item);
}
}
public IClientAPI FindClientObject(UUID agentID)
{
Scene scene = GetClientScene(agentID);
if (scene == null)
return null;
ScenePresence presence = scene.GetScenePresence(agentID);
if (presence == null)
return null;
return presence.ControllingClient;
}
private Scene GetClientScene(UUID agentId)
{
lock (m_Scenes)
{
foreach (Scene scene in m_Scenes)
{
ScenePresence presence = scene.GetScenePresence(agentId);
if (presence != null)
{
if (!presence.IsChildAgent)
return scene;
}
}
}
return null;
}
private ScenePresence GetClientPresence(UUID agentId)
{
lock (m_Scenes)
{
foreach (Scene scene in m_Scenes)
{
ScenePresence presence = scene.GetScenePresence(agentId);
if (presence != null)
{
if (!presence.IsChildAgent)
return presence;
}
}
}
return null;
}
private void OnIncomingInstantMessage(GridInstantMessage msg)
{
if (msg.dialog == (uint)211)
{
IClientAPI client = FindClientObject(new UUID(msg.toAgentID));
if (client == null)
return;
DoCallingCardOffer(client, new UUID(msg.fromAgentID));
}
}
}
}

View File

@@ -51,6 +51,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
{
public class FriendsModule : ISharedRegionModule, IFriendsModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected bool m_Enabled = false;
protected class UserFriendData
@@ -72,7 +74,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
}
protected static readonly FriendInfo[] EMPTY_FRIENDS = new FriendInfo[0];
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected List<Scene> m_Scenes = new List<Scene>();
@@ -109,7 +110,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
}
}
protected IFriendsService FriendsService
public IFriendsService FriendsService
{
get
{
@@ -156,7 +157,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
InitModule(config);
m_Enabled = true;
m_log.InfoFormat("[FRIENDS MODULE]: {0} enabled.", Name);
m_log.DebugFormat("[FRIENDS MODULE]: {0} enabled.", Name);
}
}
}
@@ -201,7 +202,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (!m_Enabled)
return;
m_log.DebugFormat("[FRIENDS MODULE]: AddRegion on {0}", Name);
// m_log.DebugFormat("[FRIENDS MODULE]: AddRegion on {0}", Name);
m_Scenes.Add(scene);
scene.RegisterModuleInterface<IFriendsModule>(this);
@@ -212,9 +213,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
scene.EventManager.OnClientLogin += OnClientLogin;
}
public void RegionLoaded(Scene scene)
{
}
public virtual void RegionLoaded(Scene scene) {}
public void RemoveRegion(Scene scene)
{
@@ -236,13 +235,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
#endregion
public virtual uint GetFriendPerms(UUID principalID, UUID friendID)
public virtual int GetRightsGrantedByFriend(UUID principalID, UUID friendID)
{
FriendInfo[] friends = GetFriends(principalID);
FriendInfo[] friends = GetFriendsFromCache(principalID);
FriendInfo finfo = GetFriend(friends, friendID);
if (finfo != null)
{
return (uint)finfo.TheirFlags;
return finfo.TheirFlags;
}
return 0;
@@ -253,9 +252,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
client.OnInstantMessage += OnInstantMessage;
client.OnApproveFriendRequest += OnApproveFriendRequest;
client.OnDenyFriendRequest += OnDenyFriendRequest;
client.OnTerminateFriendship += (thisClient, agentID, exfriendID) => RemoveFriendship(thisClient, exfriendID);
client.OnGrantUserRights += OnGrantUserRights;
client.OnTerminateFriendship += RemoveFriendship;
client.OnGrantUserRights += GrantRights;
// We need to cache information for child agents as well as root agents so that friend edit/move/delete
// permissions will work across borders where both regions are on different simulators.
//
// Do not do this asynchronously. If we do, then subsequent code can outrace CacheFriends() and
// return misleading results from the still empty friends cache.
// If we absolutely need to do this asynchronously, then a signalling mechanism is needed so that calls
@@ -328,7 +330,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
//m_log.DebugFormat("[XXX]: OnClientLogin!");
// Inform the friends that this user is online
StatusChange(agentID, true);
// Register that we need to send the list of online friends to this user
lock (m_NeedsListOfOnlineFriends)
m_NeedsListOfOnlineFriends.Add(agentID);
@@ -347,18 +349,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// Send the friends online
List<UUID> online = GetOnlineFriends(agentID);
if (online.Count > 0)
{
m_log.DebugFormat(
"[FRIENDS MODULE]: User {0} in region {1} has {2} friends online",
client.Name, client.Scene.RegionInfo.RegionName, online.Count);
if (online.Count > 0)
client.SendAgentOnline(online.ToArray());
}
// Send outstanding friendship offers
List<string> outstanding = new List<string>();
FriendInfo[] friends = GetFriends(agentID);
FriendInfo[] friends = GetFriendsFromCache(agentID);
foreach (FriendInfo fi in friends)
{
if (fi.TheirFlags == -1)
@@ -414,23 +411,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
List<UUID> GetOnlineFriends(UUID userID)
{
List<string> friendList = new List<string>();
List<UUID> online = new List<UUID>();
FriendInfo[] friends = GetFriends(userID);
FriendInfo[] friends = GetFriendsFromCache(userID);
foreach (FriendInfo fi in friends)
{
if (((fi.TheirFlags & 1) != 0) && (fi.TheirFlags != -1))
if (((fi.TheirFlags & (int)FriendRights.CanSeeOnline) != 0) && (fi.TheirFlags != -1))
friendList.Add(fi.Friend);
}
List<UUID> online = new List<UUID>();
if (friendList.Count > 0)
GetOnlineFriends(userID, friendList, online);
// m_log.DebugFormat(
// "[FRIENDS MODULE]: User {0} has {1} friends online", userID, online.Count);
return online;
}
protected virtual void GetOnlineFriends(UUID userID, List<string> friendList, /*collector*/ List<UUID> online)
{
// m_log.DebugFormat(
// "[FRIENDS MODULE]: Looking for online presence of {0} users for {1}", friendList.Count, userID);
PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray());
foreach (PresenceInfo pi in presence)
{
@@ -481,13 +485,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
/// <param name="online"></param>
private void StatusChange(UUID agentID, bool online)
{
FriendInfo[] friends = GetFriends(agentID);
FriendInfo[] friends = GetFriendsFromCache(agentID);
if (friends.Length > 0)
{
List<FriendInfo> friendList = new List<FriendInfo>();
foreach (FriendInfo fi in friends)
{
if (((fi.MyFlags & 1) != 0) && (fi.TheirFlags != -1))
if (((fi.MyFlags & (int)FriendRights.CanSeeOnline) != 0) && (fi.TheirFlags != -1))
friendList.Add(fi);
}
@@ -550,7 +554,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
UUID principalID = new UUID(im.fromAgentID);
UUID friendID = new UUID(im.toAgentID);
m_log.DebugFormat("[FRIENDS]: {0} ({1}) offered friendship to {2}", principalID, im.fromAgentName, friendID);
m_log.DebugFormat("[FRIENDS]: {0} ({1}) offered friendship to {2} ({3})", principalID, client.FirstName + client.LastName, friendID, im.fromAgentName);
// Check that the friendship doesn't exist yet
FriendInfo[] finfos = GetFriendsFromCache(principalID);
if (finfos != null)
{
FriendInfo f = GetFriend(finfos, friendID);
if (f != null)
{
client.SendAgentAlertMessage("This person is already your friend. Please delete it first if you want to reestablish the friendship.", false);
return;
}
}
// This user wants to be friends with the other user.
// Let's add the relation backwards, in case the other is not online
@@ -592,7 +608,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return (account == null) ? "Unknown" : account.FirstName + " " + account.LastName;
}
private void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders)
protected virtual void OnApproveFriendRequest(IClientAPI client, UUID friendID, List<UUID> callingCardFolders)
{
m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", client.AgentId, friendID);
@@ -603,8 +619,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
{
StoreFriendships(client.AgentId, friendID);
// Update the local cache
RecacheFriends(client);
ICallingCardModule ccm = client.Scene.RequestModuleInterface<ICallingCardModule>();
if (ccm != null)
{
ccm.CreateCallingCard(client.AgentId, friendID, UUID.Zero);
}
// Update the local cache.
CacheFriends(client);
//
// Notify the friend
@@ -631,18 +653,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
}
}
private void OnDenyFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders)
private void OnDenyFriendRequest(IClientAPI client, UUID friendID, List<UUID> callingCardFolders)
{
m_log.DebugFormat("[FRIENDS]: {0} denied friendship to {1}", agentID, friendID);
m_log.DebugFormat("[FRIENDS]: {0} denied friendship to {1}", client.AgentId, friendID);
DeleteFriendship(agentID, friendID);
DeleteFriendship(client.AgentId, friendID);
//
// Notify the friend
//
// Try local
if (LocalFriendshipDenied(agentID, client.Name, friendID))
if (LocalFriendshipDenied(client.AgentId, client.Name, friendID))
return;
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
@@ -653,7 +675,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
if (region != null)
m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
m_FriendsSimConnector.FriendshipDenied(region, client.AgentId, client.Name, friendID);
else
m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
}
@@ -690,23 +712,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
}
}
private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights)
public void GrantRights(IClientAPI remoteClient, UUID friendID, int rights)
{
m_log.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target);
UUID requester = remoteClient.AgentId;
FriendInfo[] friends = GetFriends(remoteClient.AgentId);
m_log.DebugFormat(
"[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}",
requester, rights, friendID);
FriendInfo[] friends = GetFriendsFromCache(requester);
if (friends.Length == 0)
{
return;
}
// Let's find the friend in this user's friend list
FriendInfo friend = GetFriend(friends, target);
FriendInfo friend = GetFriend(friends, friendID);
if (friend != null) // Found it
{
// Store it on the DB
if (!StoreRights(requester, target, rights))
if (!StoreRights(requester, friendID, rights))
{
remoteClient.SendAlertMessage("Unable to grant rights.");
return;
@@ -717,17 +743,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
friend.MyFlags = rights;
// Always send this back to the original client
remoteClient.SendChangeUserRights(requester, target, rights);
remoteClient.SendChangeUserRights(requester, friendID, rights);
//
// Notify the friend
//
// Try local
if (LocalGrantRights(requester, target, myFlags, rights))
if (LocalGrantRights(requester, friendID, myFlags, rights))
return;
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() });
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
if (friendSessions != null && friendSessions.Length > 0)
{
PresenceInfo friendSession = friendSessions[0];
@@ -736,12 +762,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
// TODO: You might want to send the delta to save the lookup
// on the other end!!
m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
m_FriendsSimConnector.GrantRights(region, requester, friendID, myFlags, rights);
}
}
}
else
m_log.DebugFormat("[FRIENDS MODULE]: friend {0} not found for {1}", target, requester);
{
m_log.DebugFormat("[FRIENDS MODULE]: friend {0} not found for {1}", friendID, requester);
}
}
protected virtual FriendInfo GetFriend(FriendInfo[] friends, UUID friendID)
@@ -779,6 +807,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
(byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero);
friendClient.SendInstantMessage(im);
ICallingCardModule ccm = friendClient.Scene.RequestModuleInterface<ICallingCardModule>();
if (ccm != null)
{
ccm.CreateCallingCard(friendID, userID, UUID.Zero);
}
// Update the local cache
RecacheFriends(friendClient);
@@ -801,7 +835,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// we're done
return true;
}
return false;
}
@@ -853,7 +887,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
public bool LocalStatusNotification(UUID userID, UUID friendID, bool online)
{
// m_log.DebugFormat("[FRIENDS]: Local Status Notify {0} that user {1} is {2}", friendID, userID, online);
//m_log.DebugFormat("[FRIENDS]: Local Status Notify {0} that user {1} is {2}", friendID, userID, online);
IClientAPI friendClient = LocateClientObject(friendID);
if (friendClient != null)
{
@@ -872,18 +906,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
#endregion
#region Get / Set friends in several flavours
/// <summary>
/// Get friends from local cache only
/// </summary>
/// <param name="agentID"></param>
/// <returns></returns>
protected FriendInfo[] GetFriends(UUID agentID)
public FriendInfo[] GetFriendsFromCache(UUID userID)
{
UserFriendData friendsData;
lock (m_Friends)
{
if (m_Friends.TryGetValue(agentID, out friendsData))
if (m_Friends.TryGetValue(userID, out friendsData))
return friendsData.Friends;
}
@@ -901,13 +931,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// Update local cache
lock (m_Friends)
{
FriendInfo[] friends = GetFriends(friendID);
FriendInfo[] friends = GetFriendsFromCache(friendID);
FriendInfo finfo = GetFriend(friends, userID);
finfo.TheirFlags = rights;
}
}
protected virtual FriendInfo[] GetFriendsFromService(IClientAPI client)
public virtual FriendInfo[] GetFriendsFromService(IClientAPI client)
{
return FriendsService.GetFriends(client.AgentId);
}
@@ -925,6 +955,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
}
}
public bool AreFriendsCached(UUID userID)
{
lock (m_Friends)
return m_Friends.ContainsKey(userID);
}
protected virtual bool StoreRights(UUID agentID, UUID friendID, int rights)
{
FriendsService.StoreFriend(agentID.ToString(), friendID.ToString(), rights);
@@ -938,8 +974,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
protected virtual void StoreFriendships(UUID agentID, UUID friendID)
{
FriendsService.StoreFriend(agentID.ToString(), friendID.ToString(), 1);
FriendsService.StoreFriend(friendID.ToString(), agentID.ToString(), 1);
FriendsService.StoreFriend(agentID.ToString(), friendID.ToString(), (int)FriendRights.CanSeeOnline);
FriendsService.StoreFriend(friendID.ToString(), agentID.ToString(), (int)FriendRights.CanSeeOnline);
}
protected virtual bool DeleteFriendship(UUID agentID, UUID exfriendID)

View File

@@ -94,6 +94,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
#endregion
protected override void OnApproveFriendRequest(IClientAPI client, UUID friendID, List<UUID> callingCardFolders)
{
// Update the local cache. Yes, we need to do it right here
// because the HGFriendsService placed something on the DB
// from under the sim
base.OnApproveFriendRequest(client, friendID, callingCardFolders);
}
protected override bool CacheFriends(IClientAPI client)
{
// m_log.DebugFormat("[HGFRIENDS MODULE]: Entered CacheFriends for {0}", client.Name);
@@ -144,7 +152,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, client.AgentId);
if (account == null) // foreign
{
FriendInfo[] friends = GetFriends(client.AgentId);
FriendInfo[] friends = GetFriendsFromCache(client.AgentId);
foreach (FriendInfo f in friends)
{
client.SendChangeUserRights(new UUID(f.Friend), client.AgentId, f.TheirFlags);
@@ -376,8 +384,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return null;
}
protected override FriendInfo[] GetFriendsFromService(IClientAPI client)
public override FriendInfo[] GetFriendsFromService(IClientAPI client)
{
// m_log.DebugFormat("[HGFRIENDS MODULE]: Entering GetFriendsFromService for {0}", client.Name);
Boolean agentIsLocal = true;
@@ -422,7 +429,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (agentIsLocal) // agent is local, friend is foreigner
{
FriendInfo[] finfos = GetFriends(agentID);
FriendInfo[] finfos = GetFriendsFromCache(agentID);
FriendInfo finfo = GetFriend(finfos, friendID);
if (finfo != null)
{
@@ -519,10 +526,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
{
// This may happen when the agent returned home, in which case the friend is not there
// We need to look for its information in the friends list itself
FriendInfo[] finfos = null;
bool confirming = false;
if (friendUUI == string.Empty)
{
FriendInfo[] finfos = GetFriends(agentID);
finfos = GetFriendsFromCache(agentID);
foreach (FriendInfo finfo in finfos)
{
if (finfo.TheirFlags == -1)
@@ -606,7 +615,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (agentIsLocal) // agent is local, 'friend' is foreigner
{
// We need to look for its information in the friends list itself
FriendInfo[] finfos = GetFriends(agentID);
FriendInfo[] finfos = GetFriendsFromCache(agentID);
FriendInfo finfo = GetFriend(finfos, exfriendID);
if (finfo != null)
{
@@ -650,7 +659,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
private string GetUUI(UUID localUser, UUID foreignUser)
{
// Let's see if the user is here by any chance
FriendInfo[] finfos = GetFriends(localUser);
FriendInfo[] finfos = GetFriendsFromCache(localUser);
if (finfos != EMPTY_FRIENDS) // friend is here, cool
{
FriendInfo finfo = GetFriend(finfos, foreignUser);

View File

@@ -30,6 +30,7 @@ using System.Collections.Generic;
using Nini.Config;
using NUnit.Framework;
using OpenMetaverse;
using OpenSim.Data.Null;
using OpenSim.Framework;
using OpenSim.Region.CoreModules.Avatar.Friends;
using OpenSim.Region.Framework.Scenes;
@@ -44,9 +45,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests
private FriendsModule m_fm;
private TestScene m_scene;
[TestFixtureSetUp]
public void FixtureInit()
{
// Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread.
Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest;
}
[TestFixtureTearDown]
public void TearDown()
{
// We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
// threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression
// tests really shouldn't).
Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
}
[SetUp]
public void Init()
{
// We must clear friends data between tests since Data.Null holds it in static properties. This is necessary
// so that different services and simulator can share the data in standalone mode. This is pretty horrible
// effectively the statics are global variables.
NullFriendsData.Clear();
IConfigSource config = new IniConfigSource();
config.AddConfig("Modules");
// Not strictly necessary since FriendsModule assumes it is the default (!)
@@ -56,13 +78,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests
config.AddConfig("FriendsService");
config.Configs["FriendsService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
m_scene = SceneHelpers.SetupScene();
m_scene = new SceneHelpers().SetupScene();
m_fm = new FriendsModule();
SceneHelpers.SetupSceneModules(m_scene, config, m_fm);
}
[Test]
public void TestNoFriends()
public void TestLoginWithNoFriends()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
@@ -75,6 +97,76 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests
Assert.That(((TestClient)sp.ControllingClient).ReceivedOnlineNotifications.Count, Is.EqualTo(0));
}
[Test]
public void TestLoginWithOfflineFriends()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
UUID user1Id = TestHelpers.ParseTail(0x1);
UUID user2Id = TestHelpers.ParseTail(0x2);
// UserAccountHelpers.CreateUserWithInventory(m_scene, user1Id);
// UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id);
//
// m_fm.AddFriendship(user1Id, user2Id);
ScenePresence sp1 = SceneHelpers.AddScenePresence(m_scene, user1Id);
ScenePresence sp2 = SceneHelpers.AddScenePresence(m_scene, user2Id);
m_fm.AddFriendship(sp1.ControllingClient, user2Id);
// Not necessary for this test. CanSeeOnline is automatically granted.
// m_fm.GrantRights(sp1.ControllingClient, user2Id, (int)FriendRights.CanSeeOnline);
// We must logout from the client end so that the presence service is correctly updated by the presence
// detector. This is listening to the OnConnectionClosed event on the client.
((TestClient)sp1.ControllingClient).Logout();
((TestClient)sp2.ControllingClient).Logout();
// m_scene.RemoveClient(sp1.UUID, true);
// m_scene.RemoveClient(sp2.UUID, true);
ScenePresence sp1Redux = SceneHelpers.AddScenePresence(m_scene, user1Id);
// We don't expect to receive notifications of offline friends on login, just online.
Assert.That(((TestClient)sp1Redux.ControllingClient).ReceivedOfflineNotifications.Count, Is.EqualTo(0));
Assert.That(((TestClient)sp1Redux.ControllingClient).ReceivedOnlineNotifications.Count, Is.EqualTo(0));
}
[Test]
public void TestLoginWithOnlineFriends()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
UUID user1Id = TestHelpers.ParseTail(0x1);
UUID user2Id = TestHelpers.ParseTail(0x2);
// UserAccountHelpers.CreateUserWithInventory(m_scene, user1Id);
// UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id);
//
// m_fm.AddFriendship(user1Id, user2Id);
ScenePresence sp1 = SceneHelpers.AddScenePresence(m_scene, user1Id);
ScenePresence sp2 = SceneHelpers.AddScenePresence(m_scene, user2Id);
m_fm.AddFriendship(sp1.ControllingClient, user2Id);
// Not necessary for this test. CanSeeOnline is automatically granted.
// m_fm.GrantRights(sp1.ControllingClient, user2Id, (int)FriendRights.CanSeeOnline);
// We must logout from the client end so that the presence service is correctly updated by the presence
// detector. This is listening to the OnConnectionClosed event on the client.
// ((TestClient)sp1.ControllingClient).Logout();
((TestClient)sp2.ControllingClient).Logout();
// m_scene.RemoveClient(user2Id, true);
ScenePresence sp2Redux = SceneHelpers.AddScenePresence(m_scene, user2Id);
Assert.That(((TestClient)sp2Redux.ControllingClient).ReceivedOfflineNotifications.Count, Is.EqualTo(0));
Assert.That(((TestClient)sp2Redux.ControllingClient).ReceivedOnlineNotifications.Count, Is.EqualTo(1));
}
[Test]
public void TestAddFriendshipWhileOnline()
{

View File

@@ -108,7 +108,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted;
scene.AddCommand(
this, "load iar",
"Archiving", this, "load iar",
"load iar [-m|--merge] <first> <last> <inventory path> <password> [<IAR path>]",
"Load user inventory archive (IAR).",
"-m|--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones"
@@ -121,18 +121,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
HandleLoadInvConsoleCommand);
scene.AddCommand(
this, "save iar",
"Archiving", this, "save iar",
"save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [-c|--creators] [-v|--verbose]",
"Save user inventory archive (IAR).",
"<first> is the user's first name." + Environment.NewLine
+ "<last> is the user's last name." + Environment.NewLine
+ "<inventory path> is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine
+ "-h|--home=<url> adds the url of the profile service to the saved user information." + Environment.NewLine
+ "-c|--creators preserves information about foreign creators." + Environment.NewLine
+ "-v|--verbose extra debug messages." + Environment.NewLine
+ "--noassets stops assets being saved to the IAR."
"<first> is the user's first name.\n"
+ "<last> is the user's last name.\n"
+ "<inventory path> is the path inside the user's inventory for the folder/item to be saved.\n"
+ "<IAR path> is the filesystem path at which to save the IAR."
+ string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME),
+ string.Format(" If this is not given then the filename {0} in the current directory is used.\n", DEFAULT_INV_BACKUP_FILENAME)
+ "-h|--home=<url> adds the url of the profile service to the saved user information.\n"
+ "-c|--creators preserves information about foreign creators.\n"
+ "-v|--verbose extra debug messages.\n"
+ "--noassets stops assets being saved to the IAR.",
HandleSaveInvConsoleCommand);
m_aScene = scene;

View File

@@ -100,7 +100,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
// log4net.Config.XmlConfigurator.Configure();
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
Scene scene = SceneHelpers.SetupScene();
Scene scene = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(scene, archiverModule);
UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire");

View File

@@ -61,7 +61,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
SerialiserModule serialiserModule = new SerialiserModule();
m_archiverModule = new InventoryArchiverModule();
m_scene = SceneHelpers.SetupScene();
m_scene = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule);
}

View File

@@ -62,7 +62,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
Scene scene = SceneHelpers.SetupScene();
Scene scene = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(scene, archiverModule);
// Create user
@@ -179,7 +179,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
// Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
Scene scene = SceneHelpers.SetupScene();
Scene scene = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
@@ -222,7 +222,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
SerialiserModule serialiserModule = new SerialiserModule();
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
Scene scene = SceneHelpers.SetupScene();
Scene scene = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "password");
@@ -247,7 +247,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
Scene scene = SceneHelpers.SetupScene();
Scene scene = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(scene, archiverModule);
// Create user
@@ -326,7 +326,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
Scene scene = SceneHelpers.SetupScene();
Scene scene = new SceneHelpers().SetupScene();
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene);
Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
@@ -393,7 +393,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
TestHelpers.InMethod();
//log4net.Config.XmlConfigurator.Configure();
Scene scene = SceneHelpers.SetupScene();
Scene scene = new SceneHelpers().SetupScene();
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene);
string folder1ExistingName = "a";
@@ -444,7 +444,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
Scene scene = SceneHelpers.SetupScene();
Scene scene = new SceneHelpers().SetupScene();
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene);
string folder1ExistingName = "a";

View File

@@ -151,11 +151,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
Scene scene = (Scene)(client.Scene);
ScenePresence presence = scene.GetScenePresence(client.AgentId);
// Round up Z co-ordinate rather than round-down by casting. This stops tall avatars from being given
// a teleport Z co-ordinate by short avatars that drops them through or embeds them in thin floors on
// arrival.
//
// Ideally we would give the exact float position adjusting for the relative height of the two avatars
// but it looks like a float component isn't possible with a parcel ID.
UUID dest = Util.BuildFakeParcelID(
scene.RegionInfo.RegionHandle,
(uint)presence.AbsolutePosition.X,
(uint)presence.AbsolutePosition.Y,
(uint)presence.AbsolutePosition.Z);
(uint)Math.Ceiling(presence.AbsolutePosition.Z));
m_log.DebugFormat("TP invite with message {0}", message);

View File

@@ -150,7 +150,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
string skillsText = String.Empty;
string languages = String.Empty;
Byte[] charterMember = Utils.StringToBytes("Avatar");
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, avatarID);
string name = "Avatar";
int created = 0;
if (account != null)
{
name = account.FirstName + " " + account.LastName;
created = account.Created;
}
Byte[] charterMember = Utils.StringToBytes(name);
profileUrl = "No profile data";
aboutText = string.Empty;
@@ -160,7 +169,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
partner = UUID.Zero;
remoteClient.SendAvatarProperties(avatarID, aboutText,
Util.ToDateTime(0).ToString(
Util.ToDateTime(created).ToString(
"M/d/yyyy", CultureInfo.InvariantCulture),
charterMember, firstLifeAboutText,
(uint)(0 & 0xff),

View File

@@ -69,9 +69,10 @@ namespace OpenSim.Region.CoreModules.Framework
{
m_scene = scene;
m_scene.RegisterModuleInterface<ICapabilitiesModule>(this);
MainConsole.Instance.Commands.AddCommand("Capabilities", false, "show caps",
MainConsole.Instance.Commands.AddCommand("Comms", false, "show caps",
"show caps",
"Shows all registered capabilities", HandleShowCapsCommand);
"Shows all registered capabilities for users", HandleShowCapsCommand);
}
public void RegionLoaded(Scene scene)

View File

@@ -36,6 +36,7 @@ using OpenSim.Framework.Capabilities;
using OpenSim.Framework.Client;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Physics.Manager;
using OpenSim.Services.Interfaces;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
@@ -166,13 +167,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Reset animations; the viewer does that in teleports.
sp.Animator.ResetAnimations();
string destinationRegionName = "(not found)";
try
{
if (regionHandle == sp.Scene.RegionInfo.RegionHandle)
{
destinationRegionName = sp.Scene.RegionInfo.RegionName;
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: RequestTeleportToLocation {0} within {1}",
position, sp.Scene.RegionInfo.RegionName);
"[ENTITY TRANSFER MODULE]: Teleport for {0} to {1} within {2}",
sp.Name, position, destinationRegionName);
// Teleport within the same region
if (IsOutsideRegion(sp.Scene, position) || position.Z < 0)
@@ -182,6 +187,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_log.WarnFormat(
"[ENTITY TRANSFER MODULE]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}",
position, sp.Name, sp.UUID, emergencyPos);
position = emergencyPos;
}
@@ -222,11 +228,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
GridRegion finalDestination = GetFinalDestination(reg);
if (finalDestination == null)
{
m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Final destination is having problems. Unable to teleport agent.");
m_log.WarnFormat(
"[ENTITY TRANSFER MODULE]: Final destination is having problems. Unable to teleport {0} {1}",
sp.Name, sp.UUID);
sp.ControllingClient.SendTeleportFailed("Problem at destination");
return;
}
uint curX = 0, curY = 0;
Utils.LongToUInts(sp.Scene.RegionInfo.RegionHandle, out curX, out curY);
int curCellX = (int)(curX / Constants.RegionSize);
@@ -291,7 +300,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
}
catch (Exception e)
{
m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Exception on teleport: {0} {1}", e.Message, e.StackTrace);
m_log.ErrorFormat(
"[ENTITY TRANSFER MODULE]: Exception on teleport of {0} from {1}@{2} to {3}@{4}: {5}{6}",
sp.Name, sp.AbsolutePosition, sp.Scene.RegionInfo.RegionName, position, destinationRegionName,
e.Message, e.StackTrace);
sp.ControllingClient.SendTeleportFailed("Internal error");
}
}
@@ -304,8 +317,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return;
}
if (IsInTransit(sp.UUID)) // Avie is already on the way. Caller shouldn't do this.
{
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2} ({3}) {4}/{5} - agent is already in transit.",
sp.Name, sp.UUID, reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position);
return;
}
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Request Teleport to {0} ({1}) {2}/{3}",
"[ENTITY TRANSFER MODULE]: Teleporting {0} {1} from {2} to {3} ({4}) {5}/{6}",
sp.Name, sp.UUID, sp.Scene.RegionInfo.RegionName,
reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position);
uint newRegionX = (uint)(reg.RegionHandle >> 40);
@@ -426,7 +449,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
}
SetInTransit(sp.UUID);
// Let's send a full update of the agent. This is a synchronous call.
@@ -564,7 +586,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout)
{
sp.Scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, true);
if (sp.Scene.AttachmentsModule != null)
sp.Scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, true);
}
protected void KillEntity(Scene scene, uint localID)
@@ -632,7 +655,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
public virtual void TeleportHome(UUID id, IClientAPI client)
{
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName);
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId);
//OpenSim.Services.Interfaces.PresenceInfo pinfo = m_aScene.PresenceService.GetAgent(client.SessionId);
GridUserInfo uinfo = m_aScene.GridUserService.GetGridUserInfo(client.AgentId.ToString());
@@ -647,14 +671,20 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return;
}
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})",
regionInfo.RegionName, regionInfo.RegionID, regionInfo.RegionLocX / Constants.RegionSize, regionInfo.RegionLocY / Constants.RegionSize);
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Home region of {0} is {1} ({2}-{3})",
client.Name, regionInfo.RegionName, regionInfo.RegionCoordX, regionInfo.RegionCoordY);
// a little eekie that this goes back to Scene and with a forced cast, will fix that at some point...
((Scene)(client.Scene)).RequestTeleportLocation(
client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt,
(uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome));
}
else
{
m_log.ErrorFormat(
"[ENTITY TRANSFER MODULE]: No grid user information found for {0} {1}. Cannot send home.",
client.Name, client.AgentId);
}
}
#endregion
@@ -1338,19 +1368,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// after a cross here
Thread.Sleep(500);
Scene m_scene = sp.Scene;
Scene scene = sp.Scene;
uint x, y;
Utils.LongToUInts(reg.RegionHandle, out x, out y);
x = x / Constants.RegionSize;
y = y / Constants.RegionSize;
m_log.Debug("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint + ")");
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})",
sp.Name, sp.UUID, reg.RegionName, endPoint, reg.RegionCoordX, reg.RegionCoordY);
string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath);
string reason = String.Empty;
bool regionAccepted = m_scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason);
bool regionAccepted = scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason);
if (regionAccepted && newAgent)
{
@@ -1367,7 +1395,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: {0} is sending {1} EnableSimulator for neighbour region {2} @ {3} " +
"and EstablishAgentCommunication with seed cap {4}",
m_scene.RegionInfo.RegionName, sp.Name, reg.RegionName, reg.RegionHandle, capsPath);
scene.RegionInfo.RegionName, sp.Name, reg.RegionName, reg.RegionHandle, capsPath);
eq.EnableSimulator(reg.RegionHandle, endPoint, sp.UUID);
eq.EstablishAgentCommunication(sp.UUID, endPoint, capsPath);
@@ -1378,10 +1406,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// TODO: make Event Queue disablable!
}
m_log.Debug("[ENTITY TRANSFER MODULE]: Completed inform client about neighbour " + endPoint.ToString());
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Completed inform {0} {1} about neighbour {2}", sp.Name, sp.UUID, endPoint);
}
if (!regionAccepted)
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Region {0} did not accept agent: {1}", reg.RegionName, reason);
m_log.WarnFormat(
"[ENTITY TRANSFER MODULE]: Region {0} did not accept {1} {2}: {3}",
reg.RegionName, sp.Name, sp.UUID, reason);
}
/// <summary>
@@ -1785,10 +1816,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{
if (!grp.IsDeleted)
{
if (grp.RootPart.PhysActor != null)
{
grp.RootPart.PhysActor.CrossingFailure();
}
PhysicsActor pa = grp.RootPart.PhysActor;
if (pa != null)
pa.CrossingFailure();
}
m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: Prim crossing failed for {0}", grp);
@@ -1861,6 +1891,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
}
}
protected bool IsInTransit(UUID id)
{
lock (m_agentsInTransit)
{
if (m_agentsInTransit.Contains(id))
return true;
}
return false;
}
protected bool ResetFromTransit(UUID id)
{
lock (m_agentsInTransit)

View File

@@ -184,7 +184,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
public override void TeleportHome(UUID id, IClientAPI client)
{
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName);
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId);
// Let's find out if this is a foreign user or a local user
IUserManagement uMan = m_aScene.RequestModuleInterface<IUserManagement>();

View File

@@ -117,7 +117,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
string userAssetServer = string.Empty;
if (IsForeignUser(avatarID, out userAssetServer) && userAssetServer != string.Empty && m_OutboundPermission)
{
Util.FireAndForget(delegate { m_assMapper.Post(assetID, avatarID, userAssetServer); });
m_assMapper.Post(assetID, avatarID, userAssetServer);
}
}

View File

@@ -654,9 +654,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
//
if (action == DeRezAction.Take || action == DeRezAction.TakeCopy)
{
if (so.RootPart.FromFolderID != UUID.Zero && userID == remoteClient.AgentId)
if (so.FromFolderID != UUID.Zero && userID == remoteClient.AgentId)
{
InventoryFolderBase f = new InventoryFolderBase(so.RootPart.FromFolderID, userID);
InventoryFolderBase f = new InventoryFolderBase(so.FromFolderID, userID);
folder = m_Scene.InventoryService.GetFolder(f);
}
}
@@ -957,7 +957,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
rootPart.SalePrice = item.SalePrice;
}
rootPart.FromFolderID = item.Folder;
so.FromFolderID = item.Folder;
// Console.WriteLine("rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}",
// rootPart.OwnerID, item.Owner, item.CurrentPermissions);
@@ -1003,7 +1003,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
rootPart.TrimPermissions();
if (isAttachment)
so.SetFromItemID(item.ID);
so.FromItemID = item.ID;
}
return true;

View File

@@ -65,7 +65,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
config.AddConfig("Modules");
config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
m_scene = SceneHelpers.SetupScene();
m_scene = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(m_scene, config, m_iam);
// Create user

View File

@@ -72,7 +72,7 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
m_scene = scene;
m_scene.AddCommand(this, "monitor report",
m_scene.AddCommand("General", this, "monitor report",
"monitor report",
"Returns a variety of statistics about the current region and/or simulator",
DebugMonitors);

View File

@@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
// }
// }
//}
MainConsole.Instance.Commands.AddCommand("grid", true,
MainConsole.Instance.Commands.AddCommand("Users", true,
"show names",
"show names",
"Show the bindings between user UUIDs and user names",
@@ -224,6 +224,35 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
#region IUserManagement
public UUID GetUserIdByName(string name)
{
string[] parts = name.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
if (parts.Length < 2)
throw new Exception("Name must have 2 components");
return GetUserIdByName(parts[0], parts[1]);
}
public UUID GetUserIdByName(string firstName, string lastName)
{
// TODO: Optimize for reverse lookup if this gets used by non-console commands.
lock (m_UserCache)
{
foreach (UserData user in m_UserCache.Values)
{
if (user.FirstName == firstName && user.LastName == lastName)
return user.Id;
}
}
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(UUID.Zero, firstName, lastName);
if (account != null)
return account.PrincipalID;
return UUID.Zero;
}
public string GetUserName(UUID uuid)
{
//m_log.DebugFormat("[XXX] GetUserName {0}", uuid);

View File

@@ -151,6 +151,14 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
#region IWorldComm Members
public int ListenerCount
{
get
{
return m_listenerManager.ListenerCount;
}
}
/// <summary>
/// Create a listen event callback with the specified filters.
/// The parameters localID,itemID are needed to uniquely identify
@@ -311,7 +319,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
// Send message to avatar
if (channel == 0)
{
m_scene.SimChatBroadcast(Utils.StringToBytes(msg), ChatTypeEnum.Owner, 0, pos, name, id, false);
m_scene.SimChatBroadcast(Utils.StringToBytes(msg), ChatTypeEnum.Broadcast, 0, pos, name, id, false);
}
List<SceneObjectGroup> attachments = sp.GetAttachments();
@@ -438,6 +446,18 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
private int m_maxhandles;
private int m_curlisteners;
/// <summary>
/// Total number of listeners
/// </summary>
public int ListenerCount
{
get
{
lock (m_listeners)
return m_listeners.Count;
}
}
public ListenerManager(int maxlisteners, int maxhandles)
{
m_maxlisteners = maxlisteners;

View File

@@ -0,0 +1,124 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Nini.Config;
using log4net;
using OpenSim.Framework;
using OpenSim.Services.Interfaces;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenMetaverse;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
{
public class AuthorizationService : IAuthorizationService
{
private enum AccessFlags
{
None = 0, /* No restrictions */
DisallowResidents = 1, /* Only gods and managers*/
DisallowForeigners = 2, /* Only local people */
}
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
private IUserManagement m_UserManagement;
private IGridService m_GridService;
private Scene m_Scene;
AccessFlags m_accessValue = AccessFlags.None;
public AuthorizationService(IConfig config, Scene scene)
{
m_Scene = scene;
m_UserManagement = scene.RequestModuleInterface<IUserManagement>();
m_GridService = scene.GridService;
if (config != null)
{
string accessStr = config.GetString("Region_" + scene.RegionInfo.RegionName.Replace(' ', '_'), String.Empty);
if (accessStr != string.Empty)
{
try
{
m_accessValue = (AccessFlags)Enum.Parse(typeof(AccessFlags), accessStr);
}
catch (ArgumentException)
{
m_log.WarnFormat("[AuthorizationService]: {0} is not a valid access flag", accessStr);
}
}
m_log.DebugFormat("[AuthorizationService]: Region {0} access restrictions: {1}", m_Scene.RegionInfo.RegionName, m_accessValue);
}
}
public bool IsAuthorizedForRegion(
string user, string firstName, string lastName, string regionID, out string message)
{
message = "authorized";
// This should not happen
if (m_Scene.RegionInfo.RegionID.ToString() != regionID)
{
m_log.WarnFormat("[AuthorizationService]: Service for region {0} received request to authorize for region {1}",
m_Scene.RegionInfo.RegionID, regionID);
return true;
}
if (m_accessValue == AccessFlags.None)
return true;
UUID userID = new UUID(user);
bool authorized = true;
if ((m_accessValue & AccessFlags.DisallowForeigners) == AccessFlags.DisallowForeigners)
{
authorized = m_UserManagement.IsLocalGridUser(userID);
if (!authorized)
message = "no foreigner users allowed in this region";
}
if (authorized && (m_accessValue & AccessFlags.DisallowResidents) == AccessFlags.DisallowResidents)
{
authorized = m_Scene.Permissions.IsGod(userID) | m_Scene.Permissions.IsAdministrator(userID);
if (!authorized)
message = "only Admins and Managers allowed in this region";
}
return authorized;
}
}
}

View File

@@ -39,13 +39,15 @@ using OpenMetaverse;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
{
public class LocalAuthorizationServicesConnector : ISharedRegionModule, IAuthorizationService
public class LocalAuthorizationServicesConnector : INonSharedRegionModule, IAuthorizationService
{
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
private IAuthorizationService m_AuthorizationService;
private Scene m_Scene;
private IConfig m_AuthorizationConfig;
private bool m_Enabled = false;
@@ -69,33 +71,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
string name = moduleConfig.GetString("AuthorizationServices", string.Empty);
if (name == Name)
{
IConfig authorizationConfig = source.Configs["AuthorizationService"];
if (authorizationConfig == null)
{
m_log.Error("[AUTHORIZATION CONNECTOR]: AuthorizationService missing from OpenSim.ini");
return;
}
string serviceDll = authorizationConfig.GetString("LocalServiceModule",
String.Empty);
if (serviceDll == String.Empty)
{
m_log.Error("[AUTHORIZATION CONNECTOR]: No LocalServiceModule named in section AuthorizationService");
return;
}
Object[] args = new Object[] { source };
m_AuthorizationService =
ServerUtils.LoadPlugin<IAuthorizationService>(serviceDll,
args);
if (m_AuthorizationService == null)
{
m_log.Error("[AUTHORIZATION CONNECTOR]: Can't load authorization service");
return;
}
m_Enabled = true;
m_AuthorizationConfig = source.Configs["AuthorizationService"];
m_log.Info("[AUTHORIZATION CONNECTOR]: Local authorization connector enabled");
}
}
@@ -115,6 +92,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
return;
scene.RegisterModuleInterface<IAuthorizationService>(this);
m_Scene = scene;
}
public void RemoveRegion(Scene scene)
@@ -126,6 +104,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
if (!m_Enabled)
return;
m_AuthorizationService = new AuthorizationService(m_AuthorizationConfig, m_Scene);
m_log.InfoFormat(
"[AUTHORIZATION CONNECTOR]: Enabled local authorization for region {0}",
scene.RegionInfo.RegionName);
@@ -134,6 +114,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
public bool IsAuthorizedForRegion(
string userID, string firstName, string lastName, string regionID, out string message)
{
message = "";
if (!m_Enabled)
return true;
return m_AuthorizationService.IsAuthorizedForRegion(userID, firstName, lastName, regionID, out message);
}
}

View File

@@ -126,12 +126,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
public void PostInitialise()
{
if (m_MainInstance == this)
{
MainConsole.Instance.Commands.AddCommand("LocalGridConnector", false, "show neighbours",
"show neighbours",
"Shows the local regions' neighbours", NeighboursCommand);
}
MainConsole.Instance.Commands.AddCommand("Regions", false, "show neighbours",
"show neighbours",
"Shows the local regions' neighbours", NeighboursCommand);
}
public void Close()

View File

@@ -27,14 +27,12 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
using OpenMetaverse;
using log4net;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
{
public class PresenceDetector
@@ -97,7 +95,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
// m_log.DebugFormat("[PRESENCE DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName);
m_PresenceService.LogoutAgent(client.SessionId);
}
}
}
}
}

View File

@@ -191,7 +191,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
{
if (s.RegionInfo.RegionHandle == destination.RegionHandle)
{
m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Found region {0} to send SendCreateChildAgent", destination.RegionName);
// m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Found region {0} to send SendCreateChildAgent", destination.RegionName);
return s.NewUserConnection(aCircuit, teleportFlags, out reason);
}
}
@@ -209,9 +209,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
{
if (s.RegionInfo.RegionHandle == destination.RegionHandle)
{
m_log.DebugFormat(
"[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
s.RegionInfo.RegionName, destination.RegionHandle);
// m_log.DebugFormat(
// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
// s.RegionInfo.RegionName, destination.RegionHandle);
s.IncomingChildAgentDataUpdate(cAgentData);
return true;
@@ -281,7 +281,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
{
if (s.RegionInfo.RegionID == origin)
{
m_log.Debug("[LOCAL COMMS]: Found region to SendReleaseAgent");
// m_log.Debug("[LOCAL COMMS]: Found region to SendReleaseAgent");
AgentTransferModule.AgentArrivedAtDestination(id);
return true;
// return s.IncomingReleaseAgent(id);

View File

@@ -47,21 +47,21 @@ namespace OpenSim.Region.CoreModules.World
public void Initialise(IConfigSource config)
{
MainConsole.Instance.Commands.AddCommand("access", true,
MainConsole.Instance.Commands.AddCommand("Users", true,
"login enable",
"login enable",
"Enable simulator logins",
String.Empty,
HandleLoginCommand);
MainConsole.Instance.Commands.AddCommand("access", true,
MainConsole.Instance.Commands.AddCommand("Users", true,
"login disable",
"login disable",
"Disable simulator logins",
String.Empty,
HandleLoginCommand);
MainConsole.Instance.Commands.AddCommand("access", true,
MainConsole.Instance.Commands.AddCommand("Users", true,
"login status",
"login status",
"Show login status",

View File

@@ -68,7 +68,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
SerialiserModule serialiserModule = new SerialiserModule();
TerrainModule terrainModule = new TerrainModule();
m_scene = SceneHelpers.SetupScene();
m_scene = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(m_scene, m_archiverModule, serialiserModule, terrainModule);
}
@@ -463,7 +463,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
SerialiserModule serialiserModule = new SerialiserModule();
TerrainModule terrainModule = new TerrainModule();
TestScene scene2 = SceneHelpers.SetupScene();
TestScene scene2 = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(scene2, archiverModule, serialiserModule, terrainModule);
// Make sure there's a valid owner for the owner we saved (this should have been wiped if the code is
@@ -607,7 +607,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
SerialiserModule serialiserModule = new SerialiserModule();
TerrainModule terrainModule = new TerrainModule();
Scene scene = SceneHelpers.SetupScene();
Scene scene = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule);
m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false);

View File

@@ -62,58 +62,25 @@ namespace OpenSim.Region.CoreModules.World.Estate
{
m_log.DebugFormat("[ESTATE MODULE]: Setting up estate commands for region {0}", m_module.Scene.RegionInfo.RegionName);
m_module.Scene.AddCommand(m_module, "set terrain texture",
m_module.Scene.AddCommand("Regions", m_module, "set terrain texture",
"set terrain texture <number> <uuid> [<x>] [<y>]",
"Sets the terrain <number> to <uuid>, if <x> or <y> are specified, it will only " +
"set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" +
" that coordinate.",
consoleSetTerrainTexture);
m_module.Scene.AddCommand(m_module, "set terrain heights",
m_module.Scene.AddCommand("Regions", m_module, "set terrain heights",
"set terrain heights <corner> <min> <max> [<x>] [<y>]",
"Sets the terrain texture heights on corner #<corner> to <min>/<max>, if <x> or <y> are specified, it will only " +
"set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" +
" that coordinate. Corner # SW = 0, NW = 1, SE = 2, NE = 3.",
consoleSetTerrainHeights);
Command showCommand
= new Command("show", CommandIntentions.COMMAND_STATISTICAL, ShowEstatesCommand, "Shows all estates on the simulator.");
consoleSetTerrainHeights);
m_commander.RegisterCommand("show", showCommand);
m_module.Scene.RegisterModuleCommander(m_commander);
m_module.Scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole;
m_module.Scene.AddCommand(
"Estates", m_module, "estate show", "estate show", "Shows all estates on the simulator.", ShowEstatesCommand);
}
public void Close()
{
m_module.Scene.EventManager.OnPluginConsole -= EventManagerOnPluginConsole;
m_module.Scene.UnregisterModuleCommander(m_commander.Name);
}
/// <summary>
/// Processes commandline input. Do not call directly.
/// </summary>
/// <param name="args">Commandline arguments</param>
protected void EventManagerOnPluginConsole(string[] args)
{
if (args[0] == "estate")
{
if (args.Length == 1)
{
m_commander.ProcessConsoleCommand("help", new string[0]);
return;
}
string[] tmpArgs = new string[args.Length - 2];
int i;
for (i = 2; i < args.Length; i++)
tmpArgs[i - 2] = args[i];
m_commander.ProcessConsoleCommand(args[1], tmpArgs);
}
}
public void Close() {}
protected void consoleSetTerrainTexture(string module, string[] args)
{
@@ -201,7 +168,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
}
}
protected void ShowEstatesCommand(Object[] args)
protected void ShowEstatesCommand(string module, string[] cmd)
{
StringBuilder report = new StringBuilder();
RegionInfo ri = m_module.Scene.RegionInfo;

View File

@@ -26,8 +26,10 @@
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Security;
using log4net;
@@ -45,8 +47,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private delegate void LookupUUIDS(List<UUID> uuidLst);
public Scene Scene { get; private set; }
public IUserManagement UserManager { get; private set; }
@@ -661,28 +661,23 @@ namespace OpenSim.Region.CoreModules.World.Estate
TriggerEstateMessage(senderID, senderName, message);
}
private void handleEstateDebugRegionRequest(IClientAPI remote_client, UUID invoice, UUID senderID, bool scripted, bool collisionEvents, bool physics)
private void handleEstateDebugRegionRequest(
IClientAPI remote_client, UUID invoice, UUID senderID,
bool disableScripts, bool disableCollisions, bool disablePhysics)
{
if (physics)
Scene.RegionInfo.RegionSettings.DisablePhysics = true;
else
Scene.RegionInfo.RegionSettings.DisablePhysics = false;
if (scripted)
Scene.RegionInfo.RegionSettings.DisableScripts = true;
else
Scene.RegionInfo.RegionSettings.DisableScripts = false;
if (collisionEvents)
Scene.RegionInfo.RegionSettings.DisableCollisions = true;
else
Scene.RegionInfo.RegionSettings.DisableCollisions = false;
Scene.RegionInfo.RegionSettings.DisablePhysics = disablePhysics;
Scene.RegionInfo.RegionSettings.DisableScripts = disableScripts;
Scene.RegionInfo.RegionSettings.DisableCollisions = disableCollisions;
Scene.RegionInfo.RegionSettings.Save();
TriggerRegionInfoChange();
Scene.SetSceneCoreDebug(scripted, collisionEvents, physics);
Scene.SetSceneCoreDebug(
new Dictionary<string, string>() {
{ "scripting", (!disableScripts).ToString() },
{ "collisions", (!disableCollisions).ToString() },
{ "physics", (!disablePhysics).ToString() }
}
);
}
private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey)
@@ -876,98 +871,77 @@ namespace OpenSim.Region.CoreModules.World.Estate
if (!Scene.Permissions.CanIssueEstateCommand(remoteClient.AgentId, false))
return;
Dictionary<uint, float> SceneData = new Dictionary<uint,float>();
Dictionary<uint, float> sceneData = null;
List<UUID> uuidNameLookupList = new List<UUID>();
if (reportType == 1)
{
SceneData = Scene.PhysicsScene.GetTopColliders();
sceneData = Scene.PhysicsScene.GetTopColliders();
}
else if (reportType == 0)
{
SceneData = Scene.SceneGraph.GetTopScripts();
IScriptModule scriptModule = Scene.RequestModuleInterface<IScriptModule>();
if (scriptModule != null)
sceneData = scriptModule.GetObjectScriptsExecutionTimes();
}
List<LandStatReportItem> SceneReport = new List<LandStatReportItem>();
lock (SceneData)
if (sceneData != null)
{
foreach (uint obj in SceneData.Keys)
var sortedSceneData
= sceneData.Select(
item => new { Measurement = item.Value, Part = Scene.GetSceneObjectPart(item.Key) });
sortedSceneData.OrderBy(item => item.Measurement);
int items = 0;
foreach (var entry in sortedSceneData)
{
SceneObjectPart prt = Scene.GetSceneObjectPart(obj);
if (prt != null)
// The object may have been deleted since we received the data.
if (entry.Part == null)
continue;
// Don't show scripts that haven't executed or where execution time is below one microsecond in
// order to produce a more readable report.
if (entry.Measurement < 0.001)
continue;
items++;
SceneObjectGroup so = entry.Part.ParentGroup;
LandStatReportItem lsri = new LandStatReportItem();
lsri.LocationX = so.AbsolutePosition.X;
lsri.LocationY = so.AbsolutePosition.Y;
lsri.LocationZ = so.AbsolutePosition.Z;
lsri.Score = entry.Measurement;
lsri.TaskID = so.UUID;
lsri.TaskLocalID = so.LocalId;
lsri.TaskName = entry.Part.Name;
lsri.OwnerName = UserManager.GetUserName(so.OwnerID);
if (filter.Length != 0)
{
SceneObjectGroup sog = prt.ParentGroup;
LandStatReportItem lsri = new LandStatReportItem();
lsri.LocationX = sog.AbsolutePosition.X;
lsri.LocationY = sog.AbsolutePosition.Y;
lsri.LocationZ = sog.AbsolutePosition.Z;
lsri.Score = SceneData[obj];
lsri.TaskID = sog.UUID;
lsri.TaskLocalID = sog.LocalId;
lsri.TaskName = sog.GetPartName(obj);
lsri.OwnerName = "waiting";
lock (uuidNameLookupList)
uuidNameLookupList.Add(sog.OwnerID);
if (filter.Length != 0)
if ((lsri.OwnerName.Contains(filter) || lsri.TaskName.Contains(filter)))
{
if ((lsri.OwnerName.Contains(filter) || lsri.TaskName.Contains(filter)))
{
}
else
{
continue;
}
}
SceneReport.Add(lsri);
else
{
continue;
}
}
SceneReport.Add(lsri);
if (items >= 100)
break;
}
}
remoteClient.SendLandStatReply(reportType, requestFlags, (uint)SceneReport.Count,SceneReport.ToArray());
if (uuidNameLookupList.Count > 0)
LookupUUID(uuidNameLookupList);
}
private static void LookupUUIDSCompleted(IAsyncResult iar)
{
LookupUUIDS icon = (LookupUUIDS)iar.AsyncState;
icon.EndInvoke(iar);
}
private void LookupUUID(List<UUID> uuidLst)
{
LookupUUIDS d = LookupUUIDsAsync;
d.BeginInvoke(uuidLst,
LookupUUIDSCompleted,
d);
}
private void LookupUUIDsAsync(List<UUID> uuidLst)
{
UUID[] uuidarr;
lock (uuidLst)
{
uuidarr = uuidLst.ToArray();
}
for (int i = 0; i < uuidarr.Length; i++)
{
// string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]);
IUserManagement userManager = Scene.RequestModuleInterface<IUserManagement>();
if (userManager != null)
userManager.GetUserName(uuidarr[i]);
// we drop it. It gets cached though... so we're ready for the next request.
// diva commnent 11/21/2010: uh?!? wft?
// justincc comment 21/01/2011: A side effect of userManager.GetUserName() I presume.
}
}
#endregion
#region Outgoing Packets

View File

@@ -448,8 +448,6 @@ namespace OpenSim.Region.CoreModules.World.Land
public bool IsRestrictedFromLand(UUID avatar)
{
ExpireAccessList();
if (m_scene.Permissions.IsAdministrator(avatar))
return false;
@@ -459,20 +457,27 @@ namespace OpenSim.Region.CoreModules.World.Land
if (avatar == LandData.OwnerID)
return false;
if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0)
if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) == 0)
return false;
return (!IsInLandAccessList(avatar));
}
public bool IsInLandAccessList(UUID avatar)
{
ExpireAccessList();
if (LandData.ParcelAccessList.FindIndex(
delegate(LandAccessEntry e)
{
if (e.AgentID == avatar && e.Flags == AccessList.Access)
return true;
return false;
}) == -1)
{
if (LandData.ParcelAccessList.FindIndex(
delegate(LandAccessEntry e)
{
if (e.AgentID == avatar && e.Flags == AccessList.Access)
return true;
return false;
}) == -1)
{
return true;
}
return false;
}
return false;
return true;
}
public void SendLandUpdateToClient(IClientAPI remote_client)

View File

@@ -64,7 +64,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
{
m_pcm = new PrimCountModule();
LandManagementModule lmm = new LandManagementModule();
m_scene = SceneHelpers.SetupScene();
m_scene = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(m_scene, lmm, m_pcm);
int xParcelDivider = (int)Constants.RegionSize - 1;

View File

@@ -225,7 +225,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
int tc = 0;
double[,] hm = whichScene.Heightmap.GetDoubles();
tc = Environment.TickCount;
m_log.Info("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile");
m_log.Debug("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile");
EntityBase[] objs = whichScene.GetEntities();
Dictionary<uint, DrawStruct> z_sort = new Dictionary<uint, DrawStruct>();
//SortedList<float, RectangleDrawStruct> z_sort = new SortedList<float, RectangleDrawStruct>();
@@ -541,7 +541,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
g.Dispose();
} // lock entities objs
m_log.Info("[MAPTILE]: Generating Maptile Step 2: Done in " + (Environment.TickCount - tc) + " ms");
m_log.Debug("[MAPTILE]: Generating Maptile Step 2: Done in " + (Environment.TickCount - tc) + " ms");
return mapbmp;
}

View File

@@ -54,7 +54,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
public void TerrainToBitmap(Bitmap mapbmp)
{
int tc = Environment.TickCount;
m_log.Info("[MAPTILE]: Generating Maptile Step 1: Terrain");
m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Terrain");
double[,] hm = m_scene.Heightmap.GetDoubles();
bool ShadowDebugContinue = true;
@@ -238,7 +238,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
}
}
}
m_log.Info("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms");
m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms");
}
}
}

View File

@@ -278,7 +278,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
public void TerrainToBitmap(Bitmap mapbmp)
{
int tc = Environment.TickCount;
m_log.Info("[MAPTILE]: Generating Maptile Step 1: Terrain");
m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Terrain");
// These textures should be in the AssetCache anyway, as every client conneting to this
// region needs them. Except on start, when the map is recreated (before anyone connected),
@@ -412,7 +412,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
}
}
}
m_log.Info("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms");
m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms");
}
}
}

View File

@@ -53,7 +53,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests
public void SetUp()
{
m_module = new MoapModule();
m_scene = SceneHelpers.SetupScene();
m_scene = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(m_scene, m_module);
}

View File

@@ -78,45 +78,49 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
m_scene = scene;
m_console = MainConsole.Instance;
m_console.Commands.AddCommand("region", false, "delete object owner",
m_console.Commands.AddCommand("Objects", false, "delete object owner",
"delete object owner <UUID>",
"Delete a scene object by owner", HandleDeleteObject);
m_console.Commands.AddCommand("region", false, "delete object creator",
m_console.Commands.AddCommand("Objects", false, "delete object creator",
"delete object creator <UUID>",
"Delete a scene object by creator", HandleDeleteObject);
m_console.Commands.AddCommand("region", false, "delete object uuid",
m_console.Commands.AddCommand("Objects", false, "delete object uuid",
"delete object uuid <UUID>",
"Delete a scene object by uuid", HandleDeleteObject);
m_console.Commands.AddCommand("region", false, "delete object name",
m_console.Commands.AddCommand("Objects", false, "delete object name",
"delete object name <name>",
"Delete a scene object by name", HandleDeleteObject);
m_console.Commands.AddCommand("region", false, "delete object outside",
m_console.Commands.AddCommand("Objects", false, "delete object outside",
"delete object outside",
"Delete all scene objects outside region boundaries", HandleDeleteObject);
m_console.Commands.AddCommand(
"region",
"Objects",
false,
"show object uuid",
"show object uuid <UUID>",
"Show details of a scene object with the given UUID", HandleShowObjectByUuid);
m_console.Commands.AddCommand(
"region",
"Objects",
false,
"show object name",
"show object name <name>",
"Show details of scene objects with the given name", HandleShowObjectByName);
m_console.Commands.AddCommand(
"region",
"Objects",
false,
"show part uuid",
"show part uuid <UUID>",
"Show details of a scene object parts with the given UUID", HandleShowPartByUuid);
m_console.Commands.AddCommand(
"region",
"Objects",
false,
"show part name",
"show part name <name>",
@@ -271,6 +275,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
sb.AppendFormat("Description: {0}\n", so.Description);
sb.AppendFormat("Location: {0} @ {1}\n", so.AbsolutePosition, so.Scene.RegionInfo.RegionName);
sb.AppendFormat("Parts: {0}\n", so.PrimCount);
sb.AppendFormat("Flags: {0}\n", so.RootPart.Flags);
return sb;
}
@@ -282,7 +287,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
sb.AppendFormat("Location: {0} @ {1}\n", sop.AbsolutePosition, sop.ParentGroup.Scene.RegionInfo.RegionName);
sb.AppendFormat("Parent: {0}",
sop.IsRoot ? "Is Root\n" : string.Format("{0} {1}\n", sop.ParentGroup.Name, sop.ParentGroup.UUID));
sb.AppendFormat("Parts: {0}\n", !sop.IsRoot ? "1" : sop.ParentGroup.PrimCount.ToString());;
sb.AppendFormat("Link number: {0}\n", sop.LinkNum);
sb.AppendFormat("Flags: {0}\n", sop.Flags);
return sb;
}

View File

@@ -94,7 +94,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
private bool m_RegionOwnerIsGod = false;
private bool m_RegionManagerIsGod = false;
private bool m_ParcelOwnerIsGod = false;
private bool m_SimpleBuildPermissions = false;
/// <value>
/// The set of users that are allowed to create scripts. This is only active if permissions are not being
/// bypassed. This overrides normal permissions.
@@ -139,7 +141,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
m_RegionOwnerIsGod = myConfig.GetBoolean("region_owner_is_god", true);
m_RegionManagerIsGod = myConfig.GetBoolean("region_manager_is_god", false);
m_ParcelOwnerIsGod = myConfig.GetBoolean("parcel_owner_is_god", true);
m_SimpleBuildPermissions = myConfig.GetBoolean("simple_build_permissions", false);
m_allowedScriptCreators
= ParseUserSetConfigSetting(myConfig, "allowed_script_creators", m_allowedScriptCreators);
m_allowedScriptEditors
@@ -206,17 +210,17 @@ namespace OpenSim.Region.CoreModules.World.Permissions
m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia;
m_scene.Permissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia;
m_scene.AddCommand(this, "bypass permissions",
m_scene.AddCommand("Users", this, "bypass permissions",
"bypass permissions <true / false>",
"Bypass permission checks",
HandleBypassPermissions);
m_scene.AddCommand(this, "force permissions",
m_scene.AddCommand("Users", this, "force permissions",
"force permissions <true / false>",
"Force permissions on or off",
HandleForcePermissions);
m_scene.AddCommand(this, "debug permissions",
m_scene.AddCommand("Users", this, "debug permissions",
"debug permissions <true / false>",
"Turn on permissions debugging",
HandleDebugPermissions);
@@ -483,7 +487,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return false;
}
protected bool IsFriendWithPerms(UUID user,UUID objectOwner)
protected bool IsFriendWithPerms(UUID user, UUID objectOwner)
{
if (user == UUID.Zero)
return false;
@@ -491,11 +495,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (m_friendsModule == null)
return false;
uint friendPerms = m_friendsModule.GetFriendPerms(user, objectOwner);
if ((friendPerms & (uint)FriendRights.CanModifyObjects) != 0)
return true;
return false;
int friendPerms = m_friendsModule.GetRightsGrantedByFriend(user, objectOwner);
return (friendPerms & (int)FriendRights.CanModifyObjects) != 0;
}
protected bool IsEstateManager(UUID user)
@@ -504,6 +505,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return m_scene.RegionInfo.EstateSettings.IsEstateManager(user);
}
#endregion
public bool PropagatePermissions()
@@ -824,6 +826,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
permission = true;
}
if (m_SimpleBuildPermissions &&
(parcel.LandData.Flags & (uint)ParcelFlags.UseAccessList) == 0 && parcel.IsInLandAccessList(user))
permission = true;
return permission;
}

View File

@@ -66,21 +66,21 @@ namespace OpenSim.Region.CoreModules.World.Region
m_Scene = scene;
scene.RegisterModuleInterface<IRestartModule>(this);
MainConsole.Instance.Commands.AddCommand("RestartModule",
MainConsole.Instance.Commands.AddCommand("Regions",
false, "region restart bluebox",
"region restart bluebox <message> <delta seconds>+",
"Schedule a region restart",
"Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a dismissable bluebox notice. If multiple deltas are given then a notice is sent when we reach each delta.",
HandleRegionRestart);
MainConsole.Instance.Commands.AddCommand("RestartModule",
MainConsole.Instance.Commands.AddCommand("Regions",
false, "region restart notice",
"region restart notice <message> <delta seconds>+",
"Schedule a region restart",
"Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a transient notice. If multiple deltas are given then a notice is sent when we reach each delta.",
HandleRegionRestart);
MainConsole.Instance.Commands.AddCommand("RestartModule",
MainConsole.Instance.Commands.AddCommand("Regions",
false, "region restart abort",
"region restart abort [<message>]",
"Abort a region restart", HandleRegionRestart);

View File

@@ -343,7 +343,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
public void Init()
{
m_serialiserModule = new SerialiserModule();
m_scene = SceneHelpers.SetupScene();
m_scene = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(m_scene, m_serialiserModule);
}

View File

@@ -277,18 +277,19 @@ namespace OpenSim.Region.CoreModules
m_frame = 0;
// This one puts an entry in the main help screen
m_scene.AddCommand(this, String.Empty, "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null);
// m_scene.AddCommand("Regions", this, "sun", "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null);
// This one enables the ability to type just "sun" without any parameters
m_scene.AddCommand(this, "sun", "", "", HandleSunConsoleCommand);
// m_scene.AddCommand("Regions", this, "sun", "", "", HandleSunConsoleCommand);
foreach (KeyValuePair<string, string> kvp in GetParamList())
{
m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), "", HandleSunConsoleCommand);
string sunCommand = string.Format("sun {0}", kvp.Key);
m_scene.AddCommand("Regions", this, sunCommand, string.Format("{0} [<value>]", sunCommand), kvp.Value, "", HandleSunConsoleCommand);
}
TimeZone local = TimeZone.CurrentTimeZone;
TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks;
m_log.Debug("[SUN]: localtime offset is " + TicksUTCOffset);
m_log.DebugFormat("[SUN]: localtime offset is {0}", TicksUTCOffset);
// Align ticks with Second Life

View File

@@ -86,6 +86,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain
private volatile bool m_tainted;
private readonly Stack<LandUndoState> m_undo = new Stack<LandUndoState>(5);
private String m_InitialTerrain = "pinhead-island";
/// <summary>
/// Human readable list of terrain file extensions that are supported.
/// </summary>
@@ -109,6 +111,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain
/// <param name="config">Config for the region</param>
public void Initialise(IConfigSource config)
{
IConfig terrainConfig = config.Configs["Terrain"];
if (terrainConfig != null)
m_InitialTerrain = terrainConfig.GetString("InitialTerrain", m_InitialTerrain);
}
public void AddRegion(Scene scene)
@@ -120,7 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
{
if (m_scene.Heightmap == null)
{
m_channel = new TerrainChannel();
m_channel = new TerrainChannel(m_InitialTerrain);
m_scene.Heightmap = m_channel;
m_revert = new TerrainChannel();
UpdateRevertMap();
@@ -593,6 +598,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain
"[TERRAIN]: Could not save terrain from {0} to {1}. Valid file extensions are {2}",
m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions);
}
// else
// {
// m_log.ErrorFormat(
// "[TERRAIN]: Could not save terrain from {0} to {1}. {2} {3} {4} {5} {6} {7}",
// m_scene.RegionInfo.RegionName, filename, fileWidth, fileHeight, fileStartX, fileStartY, offsetX, offsetY);
// }
}
/// <summary>

View File

@@ -88,11 +88,11 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
if (renderers.Count > 0)
{
m_primMesher = RenderingLoader.LoadRenderer(renderers[0]);
m_log.Info("[MAPTILE]: Loaded prim mesher " + m_primMesher.ToString());
m_log.Debug("[MAPTILE]: Loaded prim mesher " + m_primMesher.ToString());
}
else
{
m_log.Info("[MAPTILE]: No prim mesher loaded, prim rendering will be disabled");
m_log.Debug("[MAPTILE]: No prim mesher loaded, prim rendering will be disabled");
}
m_scene.RegisterModuleInterface<IMapImageGenerator>(this);

View File

@@ -117,24 +117,31 @@ namespace OpenSim.Region.CoreModules
}
// This one puts an entry in the main help screen
m_scene.AddCommand(this, String.Empty, "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null);
// m_scene.AddCommand("Regions", this, "wind", "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null);
// This one enables the ability to type just the base command without any parameters
m_scene.AddCommand(this, "wind", "", "", HandleConsoleCommand);
// m_scene.AddCommand("Regions", this, "wind", "", "", HandleConsoleCommand);
// Get a list of the parameters for each plugin
foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values)
{
m_scene.AddCommand(this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand);
m_scene.AddCommand(this, String.Format("wind base wind_update_rate"), "Change the wind update rate.", "", HandleConsoleBaseCommand);
// m_scene.AddCommand("Regions", this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand);
m_scene.AddCommand(
"Regions",
this,
"wind base wind_update_rate",
"wind base wind_update_rate [<value>]",
"Get or set the wind update rate.",
"",
HandleConsoleBaseCommand);
foreach (KeyValuePair<string, string> kvp in windPlugin.WindParams())
{
m_scene.AddCommand(this, String.Format("wind {0} {1}", windPlugin.Name, kvp.Key), String.Format("{0} : {1} - {2}", windPlugin.Name, kvp.Key, kvp.Value), "", HandleConsoleParamCommand);
string windCommand = String.Format("wind {0} {1}", windPlugin.Name, kvp.Key);
m_scene.AddCommand("Regions", this, windCommand, string.Format("{0} [<value>]", windCommand), kvp.Value, "", HandleConsoleParamCommand);
}
}
// Register event handlers for when Avatars enter the region, and frame ticks
m_scene.EventManager.OnFrame += WindUpdate;
m_scene.EventManager.OnMakeRootAgent += OnAgentEnteredRegion;

View File

@@ -92,7 +92,23 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
return;
}
//m_log.DebugFormat("MAP NAME=({0})", mapName);
//m_log.DebugFormat("MAP NAME=({0})", mapName);
// Hack to get around the fact that ll V3 now drops the port from the
// map name. See https://jira.secondlife.com/browse/VWR-28570
//
// Caller, use this magic form instead:
// secondlife://http|!!mygrid.com|8002|Region+Name/128/128
// or url encode if possible.
// the hacks we do with this viewer...
//
string mapNameOrig = mapName;
if (mapName.Contains("|"))
mapName = mapName.Replace('|', ':');
if (mapName.Contains("+"))
mapName = mapName.Replace('+', ' ');
if (mapName.Contains("!"))
mapName = mapName.Replace('!', '/');
// try to fetch from GridServer
List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
@@ -114,7 +130,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
data.MapImageId = UUID.Zero;
else
data.MapImageId = info.TerrainImage;
data.Name = info.RegionName;
// ugh! V2-3 is very sensitive about the result being
// exactly the same as the requested name
if (regionInfos.Count == 1 && mapNameOrig.Contains("|") || mapNameOrig.Contains("+"))
data.Name = mapNameOrig;
else
data.Name = info.RegionName;
data.RegionFlags = 0; // TODO not used?
data.WaterHeight = 0; // not used
data.X = (ushort)(info.RegionLocX / Constants.RegionSize);
@@ -138,6 +159,17 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
// flags are agent flags sent from the viewer.
// they have different values depending on different viewers, apparently
remoteClient.SendMapBlock(blocks, flags);
// send extra user messages for V3
// because the UI is very confusing
// while we don't fix the hard-coded urls
if (flags == 2)
{
if (regionInfos.Count == 0)
remoteClient.SendAgentAlertMessage("No regions found with that name.", true);
else if (regionInfos.Count == 1)
remoteClient.SendAgentAlertMessage("Region found!", false);
}
}
// private Scene GetClientScene(IClientAPI client)

View File

@@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
m_scene.RegisterModuleInterface<IWorldMapModule>(this);
m_scene.AddCommand(
this, "export-map",
"Regions", this, "export-map",
"export-map [<path>]",
"Save an image of the world map", HandleExportWorldMapConsoleCommand);

View File

@@ -46,8 +46,6 @@ namespace OpenSim.Region.DataSnapshot
private DataSnapshotManager m_externalData = null;
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly string m_discoveryPath = "DS0001/";
public DataRequestHandler(Scene scene, DataSnapshotManager externalData)
{
m_scene = scene;
@@ -58,37 +56,9 @@ namespace OpenSim.Region.DataSnapshot
{
m_log.Info("[DATASNAPSHOT]: Set up snapshot service");
}
// Register validation callback handler
MainServer.Instance.AddHTTPHandler("validate", OnValidate);
//Register CAPS handler event
m_scene.EventManager.OnRegisterCaps += OnRegisterCaps;
//harbl
}
public void OnRegisterCaps(UUID agentID, Caps caps)
{
// m_log.InfoFormat("[DATASNAPSHOT]: Registering service discovery capability for {0}", agentID);
string capsBase = "/CAPS/" + caps.CapsObjectPath;
caps.RegisterHandler("PublicSnapshotDataInfo",
new RestStreamHandler("POST", capsBase + m_discoveryPath, OnDiscoveryAttempt));
}
public string OnDiscoveryAttempt(string request, string path, string param,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
//Very static for now, flexible enough to add new formats
LLSDDiscoveryResponse llsd_response = new LLSDDiscoveryResponse();
llsd_response.snapshot_resources = new OSDArray();
LLSDDiscoveryDataURL llsd_dataurl = new LLSDDiscoveryDataURL();
llsd_dataurl.snapshot_format = "os-datasnapshot-v1";
llsd_dataurl.snapshot_url = "http://" + m_externalData.m_hostname + ":" + m_externalData.m_listener_port + "/?method=collector";
llsd_response.snapshot_resources.Array.Add(llsd_dataurl);
string response = LLSDHelpers.SerialiseLLSDReply(llsd_response);
return response;
}
public Hashtable OnGetSnapshot(Hashtable keysvals)
@@ -107,5 +77,23 @@ namespace OpenSim.Region.DataSnapshot
return reply;
}
public Hashtable OnValidate(Hashtable keysvals)
{
m_log.Info("[DATASNAPSHOT] Received validation request");
Hashtable reply = new Hashtable();
int statuscode = 200;
string secret = (string)keysvals["secret"];
if (secret == m_externalData.Secret.ToString())
statuscode = 403;
reply["str_response_string"] = string.Empty;
reply["int_response_code"] = statuscode;
reply["content_type"] = "text/plain";
return reply;
}
}
}

View File

@@ -66,6 +66,7 @@ namespace OpenSim.Region.DataSnapshot
private string m_dataServices = "noservices";
public string m_listener_port = ConfigSettings.DefaultRegionHttpPort.ToString();
public string m_hostname = "127.0.0.1";
private UUID m_Secret = UUID.Random();
//Update timers
private int m_period = 20; // in seconds
@@ -85,6 +86,11 @@ namespace OpenSim.Region.DataSnapshot
get { return m_exposure_level; }
}
public UUID Secret
{
get { return m_Secret; }
}
#endregion
#region IRegionModule
@@ -103,10 +109,10 @@ namespace OpenSim.Region.DataSnapshot
m_enabled = config.Configs["DataSnapshot"].GetBoolean("index_sims", m_enabled);
IConfig conf = config.Configs["GridService"];
if (conf != null)
m_gridinfo.Add("gridserverURL", conf.GetString("GridServerURI", "http://127.0.0.1:8003"));
m_gridinfo.Add("gatekeeperURL", conf.GetString("Gatekeeper", String.Empty));
m_gridinfo.Add(
"Name", config.Configs["DataSnapshot"].GetString("gridname", "the lost continent of hippo"));
"name", config.Configs["DataSnapshot"].GetString("gridname", "the lost continent of hippo"));
m_exposure_level = config.Configs["DataSnapshot"].GetString("data_exposure", m_exposure_level);
m_period = config.Configs["DataSnapshot"].GetInt("default_snapshot_period", m_period);
m_maxStales = config.Configs["DataSnapshot"].GetInt("max_changes_before_update", m_maxStales);
@@ -315,6 +321,7 @@ namespace OpenSim.Region.DataSnapshot
cli.AddQueryParameter("service", serviceName);
cli.AddQueryParameter("host", m_hostname);
cli.AddQueryParameter("port", m_listener_port);
cli.AddQueryParameter("secret", m_Secret.ToString());
cli.RequestMethod = "GET";
try
{
@@ -341,7 +348,7 @@ namespace OpenSim.Region.DataSnapshot
}
// This is not quite working, so...
// string responseStr = Util.UTF8.GetString(response);
m_log.Info("[DATASNAPSHOT]: data service notified: " + url);
m_log.Info("[DATASNAPSHOT]: data service " + url + " notified. Secret: " + m_Secret);
}
}

View File

@@ -0,0 +1,40 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Text;
using OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Framework
{
public interface ICallingCardModule
{
UUID CreateCallingCard(UUID userID, UUID creatorID, UUID folderID);
}
}

View File

@@ -154,6 +154,15 @@ namespace OpenSim.Region.Framework.Interfaces
/// <returns>null if the item does not exist</returns>
TaskInventoryItem GetInventoryItem(UUID itemId);
/// <summary>
/// Get all inventory items.
/// </summary>
/// <param name="name"></param>
/// <returns>
/// If there are no inventory items then an empty list is returned.
/// </returns>
List<TaskInventoryItem> GetInventoryItems();
/// <summary>
/// Get inventory items by name.
/// </summary>
@@ -162,7 +171,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// A list of inventory items with that name.
/// If no inventory item has that name then an empty list is returned.
/// </returns>
IList<TaskInventoryItem> GetInventoryItems(string name);
List<TaskInventoryItem> GetInventoryItems(string name);
/// <summary>
/// Get the scene object referenced by an inventory item.

View File

@@ -25,14 +25,31 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System.Collections.Generic;
using OpenMetaverse;
using OpenSim.Framework;
using System.Collections.Generic;
using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
namespace OpenSim.Region.Framework.Interfaces
{
public interface IFriendsModule
{
/// <summary>
/// Are friends cached on this simulator for a particular user?
/// </summary>
/// <param name="userID"></param>
/// <returns></returns>
bool AreFriendsCached(UUID userID);
/// <summary>
/// Get friends from local cache only
/// </summary>
/// <param name="userID"></param>
/// <returns>
/// An empty array if the user has no friends or friends have not been cached.
/// </returns>
FriendInfo[] GetFriendsFromCache(UUID userID);
/// <summary>
/// Add a friendship between two users.
/// </summary>
@@ -55,7 +72,27 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="exFriendID"></param>
void RemoveFriendship(IClientAPI client, UUID exFriendID);
uint GetFriendPerms(UUID PrincipalID, UUID FriendID);
/// <summary>
/// Get permissions granted by a friend.
/// </summary>
/// <param name="userID">The user.</param>
/// <param name="friendID">The friend that granted.</param>
/// <returns>The permissions. These come from the FriendRights enum.</returns>
int GetRightsGrantedByFriend(UUID userID, UUID friendID);
/// <summary>
/// Grant permissions for a friend.
/// </summary>
/// <remarks>
/// This includes giving them the ability to see when the user is online and permission to edit the user's
/// objects.
/// Granting lower permissions than the friend currently has will rescind the extra permissions.
/// </remarks>
/// <param name="remoteClient">The user granting the permissions.</param>
/// <param name="friendID">The friend.</param>
/// <param name="perms">These come from the FriendRights enum.</param>
void GrantRights(IClientAPI remoteClient, UUID friendID, int perms);
bool SendFriendsOnlineIfNeeded(IClientAPI client);
}
}
}

View File

@@ -27,6 +27,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using OpenMetaverse;
namespace OpenSim.Region.Framework.Interfaces
@@ -74,5 +75,14 @@ namespace OpenSim.Region.Framework.Interfaces
/// Starts the processing threads.
/// </summary>
void StartProcessing();
/// <summary>
/// Get the execution times of all scripts in each object.
/// </summary>
/// <returns>
/// A dictionary where the key is the root object ID of a linkset
/// and the value is a representative execution time in milliseconds of all scripts in that linkset.
/// </returns>
Dictionary<uint, float> GetObjectScriptsExecutionTimes();
}
}
}

View File

@@ -15,6 +15,21 @@ namespace OpenSim.Region.Framework.Interfaces
string GetUserUUI(UUID uuid);
string GetUserServerURL(UUID uuid, string serverType);
/// <summary>
/// Get user ID by the given name.
/// </summary>
/// <param name="name"></param>
/// <returns>UUID.Zero if no user with that name is found or if the name is "Unknown User"</returns>
UUID GetUserIdByName(string name);
/// <summary>
/// Get user ID by the given name.
/// </summary>
/// <param name="firstName"></param>
/// <param name="lastName"></param>
/// <returns>UUID.Zero if no user with that name is found or if the name is "Unknown User"</returns>
UUID GetUserIdByName(string firstName, string lastName);
/// <summary>
/// Add a user.
/// </summary>

View File

@@ -49,6 +49,11 @@ namespace OpenSim.Region.Framework.Interfaces
public interface IWorldComm
{
/// <summary>
/// Total number of listeners
/// </summary>
int ListenerCount { get; }
/// <summary>
/// Create a listen event callback with the specified filters.
/// The parameters localID,itemID are needed to uniquely identify

View File

@@ -117,7 +117,7 @@ namespace OpenSim.Region.Framework.Scenes
private void InventoryRunDeleteTimer(object sender, ElapsedEventArgs e)
{
m_log.Debug("[ASYNC DELETER]: Starting send to inventory loop");
// m_log.Debug("[ASYNC DELETER]: Starting send to inventory loop");
// We must set appearance parameters in the en_US culture in order to avoid issues where values are saved
// in a culture where decimal points are commas and then reloaded in a culture which just treats them as
@@ -147,9 +147,9 @@ namespace OpenSim.Region.Framework.Scenes
{
x = m_inventoryDeletes.Dequeue();
m_log.DebugFormat(
"[ASYNC DELETER]: Sending object to user's inventory, action {1}, count {2}, {0} item(s) remaining.",
left, x.action, x.objectGroups.Count);
// m_log.DebugFormat(
// "[ASYNC DELETER]: Sending object to user's inventory, action {1}, count {2}, {0} item(s) remaining.",
// left, x.action, x.objectGroups.Count);
try
{
@@ -185,7 +185,7 @@ namespace OpenSim.Region.Framework.Scenes
e.StackTrace);
}
m_log.Debug("[ASYNC DELETER]: No objects left in inventory send queue.");
// m_log.Debug("[ASYNC DELETER]: No objects left in inventory send queue.");
return false;
}

View File

@@ -68,9 +68,12 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void OnNewClientDelegate(IClientAPI client);
/// <summary>
/// Deprecated in favour of OnClientConnect.
/// Will be marked Obsolete after IClientCore has 100% of IClientAPI interfaces.
/// Triggered when a new client is added to the scene.
/// </summary>
/// <remarks>
/// This is triggered for both child and root agent client connections.
/// Triggered before OnClientLogin.
/// </remarks>
public event OnNewClientDelegate OnNewClient;
/// <summary>
@@ -138,8 +141,11 @@ namespace OpenSim.Region.Framework.Scenes
public event OnPermissionErrorDelegate OnPermissionError;
/// <summary>
/// Fired when a new script is created.
/// Fired when a script is run.
/// </summary>
/// <remarks>
/// Occurs after OnNewScript.
/// </remarks>
public event NewRezScript OnRezScript;
public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource);
@@ -185,12 +191,24 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void ClientClosed(UUID clientID, Scene scene);
/// <summary>
/// Fired when a client is removed from a scene whether it's a child or a root agent.
/// </summary>
/// <remarks>
/// At the point of firing, the scene still contains the client's scene presence.
/// </remarks>
public event ClientClosed OnClientClosed;
// Fired when a script is created
// The indication that a new script exists in this region.
public delegate void NewScript(UUID clientID, SceneObjectPart part, UUID itemID);
/// <summary>
/// Fired when a script is created.
/// </summary>
/// <remarks>
/// Occurs before OnRezScript
/// </remarks>
public event NewScript OnNewScript;
public virtual void TriggerNewScript(UUID clientID, SceneObjectPart part, UUID itemID)
{
NewScript handlerNewScript = OnNewScript;
@@ -212,10 +230,16 @@ namespace OpenSim.Region.Framework.Scenes
}
}
//TriggerUpdateScript: triggered after Scene receives client's upload of updated script and stores it as asset
// An indication that the script has changed.
public delegate void UpdateScript(UUID clientID, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID);
/// <summary>
/// An indication that the script has changed.
/// </summary>
/// <remarks>
/// Triggered after the scene receives a client's upload of an updated script and has stored it in an asset.
/// </remarks>
public event UpdateScript OnUpdateScript;
public virtual void TriggerUpdateScript(UUID clientId, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID)
{
UpdateScript handlerUpdateScript = OnUpdateScript;
@@ -466,6 +490,13 @@ namespace OpenSim.Region.Framework.Scenes
public event RegionHeartbeatEnd OnRegionHeartbeatEnd;
public delegate void LoginsEnabled(string regionName);
/// <summary>
/// This should only fire in all circumstances if the RegionReady module is active.
/// </summary>
/// <remarks>
/// TODO: Fire this even when the RegionReady module is not active.
/// </remarks>
public event LoginsEnabled OnLoginsEnabled;
public delegate void PrimsLoaded(Scene s);

View File

@@ -1210,9 +1210,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary>
/// Copy a task (prim) inventory item to another task (prim)
/// </summary>
/// <param name="destId"></param>
/// <param name="part"></param>
/// <param name="itemId"></param>
/// <param name="destId">ID of destination part</param>
/// <param name="part">Source part</param>
/// <param name="itemId">Source item id to transfer</param>
public void MoveTaskInventoryItem(UUID destId, SceneObjectPart part, UUID itemId)
{
TaskInventoryItem srcTaskItem = part.Inventory.GetInventoryItem(itemId);
@@ -1238,24 +1238,21 @@ namespace OpenSim.Region.Framework.Scenes
return;
}
// Can't transfer this
//
if ((part.OwnerID != destPart.OwnerID) && ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0))
return;
if (part.OwnerID != destPart.OwnerID && (part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0)
if (part.OwnerID != destPart.OwnerID)
{
// object cannot copy items to an object owned by a different owner
// unless llAllowInventoryDrop has been called
// Source must have transfer permissions
if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
return;
return;
// Object cannot copy items to an object owned by a different owner
// unless llAllowInventoryDrop has been called on the destination
if ((destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0)
return;
}
// must have both move and modify permission to put an item in an object
if ((part.OwnerMask & ((uint)PermissionMask.Move | (uint)PermissionMask.Modify)) == 0)
{
return;
}
TaskInventoryItem destTaskItem = new TaskInventoryItem();

File diff suppressed because it is too large Load Diff

View File

@@ -149,9 +149,13 @@ namespace OpenSim.Region.Framework.Scenes
#region Update Methods
/// <summary>
/// Normally called once every frame/tick to let the world preform anything required (like running the physics simulation)
/// Called to update the scene loop by a number of frames and until shutdown.
/// </summary>
public abstract void Update();
/// <param name="frames">
/// Number of frames to update. Exits on shutdown even if there are frames remaining.
/// If -1 then updates until shutdown.
/// </param>
public abstract void Update(int frames);
#endregion
@@ -472,6 +476,63 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary>
/// Call this from a region module to add a command to the OpenSim console.
/// </summary>
/// <param name="mod">
/// The use of IRegionModuleBase is a cheap trick to get a different method signature,
/// though all new modules should be using interfaces descended from IRegionModuleBase anyway.
/// </param>
/// <param name="category">
/// Category of the command. This is the section under which it will appear when the user asks for help
/// </param>
/// <param name="command"></param>
/// <param name="shorthelp"></param>
/// <param name="longhelp"></param>
/// <param name="callback"></param>
public void AddCommand(
string category, object mod, string command, string shorthelp, string longhelp, CommandDelegate callback)
{
AddCommand(category, mod, command, shorthelp, longhelp, string.Empty, callback);
}
/// <summary>
/// Call this from a region module to add a command to the OpenSim console.
/// </summary>
/// <param name="mod"></param>
/// <param name="command"></param>
/// <param name="shorthelp"></param>
/// <param name="longhelp"></param>
/// <param name="descriptivehelp"></param>
/// <param name="callback"></param>
public void AddCommand(object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback)
{
string moduleName = "";
if (mod != null)
{
if (mod is IRegionModule)
{
IRegionModule module = (IRegionModule)mod;
moduleName = module.Name;
}
else if (mod is IRegionModuleBase)
{
IRegionModuleBase module = (IRegionModuleBase)mod;
moduleName = module.Name;
}
else
{
throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase");
}
}
AddCommand(moduleName, mod, command, shorthelp, longhelp, descriptivehelp, callback);
}
/// <summary>
/// Call this from a region module to add a command to the OpenSim console.
/// </summary>
/// <param name="category">
/// Category of the command. This is the section under which it will appear when the user asks for help
/// </param>
/// <param name="mod"></param>
/// <param name="command"></param>
/// <param name="shorthelp"></param>
@@ -479,12 +540,12 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="descriptivehelp"></param>
/// <param name="callback"></param>
public void AddCommand(
object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback)
string category, object mod, string command,
string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback)
{
if (MainConsole.Instance == null)
return;
string modulename = String.Empty;
bool shared = false;
if (mod != null)
@@ -492,20 +553,20 @@ namespace OpenSim.Region.Framework.Scenes
if (mod is IRegionModule)
{
IRegionModule module = (IRegionModule)mod;
modulename = module.Name;
shared = module.IsSharedModule;
}
else if (mod is IRegionModuleBase)
{
IRegionModuleBase module = (IRegionModuleBase)mod;
modulename = module.Name;
shared = mod is ISharedRegionModule;
}
else throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase");
else
{
throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase");
}
}
MainConsole.Instance.Commands.AddCommand(
modulename, shared, command, shorthelp, longhelp, descriptivehelp, callback);
category, shared, command, shorthelp, longhelp, descriptivehelp, callback);
}
public virtual ISceneObject DeserializeObject(string representation)

View File

@@ -156,6 +156,7 @@ namespace OpenSim.Region.Framework.Scenes
// that the region position is cached or performance will degrade
Utils.LongToUInts(regionHandle, out x, out y);
GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
// bool v = true;
if (!simulatorList.Contains(dest.ServerURI))
{

View File

@@ -91,6 +91,9 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalPartID = new Dictionary<uint, SceneObjectGroup>();
/// <summary>
/// Lock to prevent object group update, linking and delinking operations from running concurrently.
/// </summary>
private Object m_updateLock = new Object();
#endregion
@@ -324,7 +327,8 @@ namespace OpenSim.Region.Framework.Scenes
if (rot != null)
sceneObject.UpdateGroupRotationR((Quaternion)rot);
if (sceneObject.RootPart.PhysActor != null && sceneObject.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero)
PhysicsActor pa = sceneObject.RootPart.PhysActor;
if (pa != null && pa.IsPhysical && vel != Vector3.Zero)
{
sceneObject.RootPart.ApplyImpulse((vel * sceneObject.GetMass()), false);
sceneObject.Velocity = vel;
@@ -751,6 +755,7 @@ namespace OpenSim.Region.Framework.Scenes
#endregion
#region Get Methods
/// <summary>
/// Get the controlling client for the given avatar, if there is one.
///
@@ -1092,36 +1097,6 @@ namespace OpenSim.Region.Framework.Scenes
return Entities.GetEntities();
}
public Dictionary<uint, float> GetTopScripts()
{
Dictionary<uint, float> topScripts = new Dictionary<uint, float>();
EntityBase[] EntityList = GetEntities();
int limit = 0;
foreach (EntityBase ent in EntityList)
{
if (ent is SceneObjectGroup)
{
SceneObjectGroup grp = (SceneObjectGroup)ent;
if ((grp.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0)
{
if (grp.scriptScore >= 0.01)
{
topScripts.Add(grp.LocalId, grp.scriptScore);
limit++;
if (limit >= 100)
{
break;
}
}
grp.scriptScore = 0;
}
}
}
return topScripts;
}
#endregion
#region Other Methods

View File

@@ -229,8 +229,6 @@ namespace OpenSim.Region.Framework.Scenes
get { return RootPart.VolumeDetectActive; }
}
public float scriptScore;
private Vector3 lastPhysGroupPos;
private Quaternion lastPhysGroupRot;
@@ -507,16 +505,21 @@ namespace OpenSim.Region.Framework.Scenes
{
m_isSelected = value;
// Tell physics engine that group is selected
if (m_rootPart.PhysActor != null)
PhysicsActor pa = m_rootPart.PhysActor;
if (pa != null)
{
m_rootPart.PhysActor.Selected = value;
pa.Selected = value;
// Pass it on to the children.
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
{
SceneObjectPart child = parts[i];
if (child.PhysActor != null)
child.PhysActor.Selected = value;
PhysicsActor childPa = child.PhysActor;
if (childPa != null)
childPa.Selected = value;
}
}
}
@@ -550,7 +553,9 @@ namespace OpenSim.Region.Framework.Scenes
set { m_LoopSoundSlavePrims = value; }
}
// The UUID for the Region this Object is in.
/// <summary>
/// The UUID for the region this object is in.
/// </summary>
public UUID RegionUUID
{
get
@@ -563,6 +568,22 @@ namespace OpenSim.Region.Framework.Scenes
}
}
/// <summary>
/// The item ID that this object was rezzed from, if applicable.
/// </summary>
/// <remarks>
/// If not applicable will be UUID.Zero
/// </remarks>
public UUID FromItemID { get; set; }
/// <summary>
/// The folder ID that this object was rezzed from, if applicable.
/// </summary>
/// <remarks>
/// If not applicable will be UUID.Zero
/// </remarks>
public UUID FromFolderID { get; set; }
#endregion
// ~SceneObjectGroup()
@@ -625,18 +646,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public void SetFromItemID(UUID AssetId)
{
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
parts[i].FromItemID = AssetId;
}
public UUID GetFromItemID()
{
return m_rootPart.FromItemID;
}
/// <summary>
/// Hooks this object up to the backup event so that it is persisted to the database when the update thread executes.
/// </summary>
@@ -1184,12 +1193,7 @@ namespace OpenSim.Region.Framework.Scenes
public void AddScriptLPS(int count)
{
if (scriptScore + count >= float.MaxValue - count)
scriptScore = 0;
scriptScore += (float)count;
SceneGraph d = m_scene.SceneGraph;
d.AddToScriptLPS(count);
m_scene.SceneGraph.AddToScriptLPS(count);
}
public void AddActiveScriptCount(int count)
@@ -1467,7 +1471,8 @@ namespace OpenSim.Region.Framework.Scenes
}
// Need to duplicate the physics actor as well
if (part.PhysActor != null && userExposed)
PhysicsActor originalPartPa = part.PhysActor;
if (originalPartPa != null && userExposed)
{
PrimitiveBaseShape pbs = newPart.Shape;
@@ -1478,10 +1483,10 @@ namespace OpenSim.Region.Framework.Scenes
newPart.AbsolutePosition,
newPart.Scale,
newPart.RotationOffset,
part.PhysActor.IsPhysical,
originalPartPa.IsPhysical,
newPart.LocalId);
newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true);
newPart.DoPhysicsPropertyUpdate(originalPartPa.IsPhysical, true);
}
}
@@ -1553,45 +1558,53 @@ namespace OpenSim.Region.Framework.Scenes
}
else
{
if (RootPart.PhysActor != null)
PhysicsActor pa = RootPart.PhysActor;
if (pa != null)
{
RootPart.PhysActor.AddForce(impulse, true);
m_scene.PhysicsScene.AddPhysicsActorTaint(RootPart.PhysActor);
pa.AddForce(impulse, true);
m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
}
}
}
public void applyAngularImpulse(Vector3 impulse)
{
if (RootPart.PhysActor != null)
PhysicsActor pa = RootPart.PhysActor;
if (pa != null)
{
if (!IsAttachment)
{
RootPart.PhysActor.AddAngularForce(impulse, true);
m_scene.PhysicsScene.AddPhysicsActorTaint(RootPart.PhysActor);
pa.AddAngularForce(impulse, true);
m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
}
}
}
public void setAngularImpulse(Vector3 impulse)
{
if (RootPart.PhysActor != null)
PhysicsActor pa = RootPart.PhysActor;
if (pa != null)
{
if (!IsAttachment)
{
RootPart.PhysActor.Torque = impulse;
m_scene.PhysicsScene.AddPhysicsActorTaint(RootPart.PhysActor);
pa.Torque = impulse;
m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
}
}
}
public Vector3 GetTorque()
{
if (RootPart.PhysActor != null)
PhysicsActor pa = RootPart.PhysActor;
if (pa != null)
{
if (!IsAttachment)
{
Vector3 torque = RootPart.PhysActor.Torque;
Vector3 torque = pa.Torque;
return torque;
}
}
@@ -1611,19 +1624,23 @@ namespace OpenSim.Region.Framework.Scenes
}
else
{
if (RootPart.PhysActor != null)
PhysicsActor pa = RootPart.PhysActor;
if (pa != null)
{
RootPart.PhysActor.PIDTarget = target;
RootPart.PhysActor.PIDTau = tau;
RootPart.PhysActor.PIDActive = true;
pa.PIDTarget = target;
pa.PIDTau = tau;
pa.PIDActive = true;
}
}
}
public void stopMoveToTarget()
{
if (RootPart.PhysActor != null)
RootPart.PhysActor.PIDActive = false;
PhysicsActor pa = RootPart.PhysActor;
if (pa != null)
pa.PIDActive = false;
}
/// <summary>
@@ -1634,18 +1651,20 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="tau">Number of seconds over which to reach target</param>
public void SetHoverHeight(float height, PIDHoverType hoverType, float tau)
{
if (RootPart.PhysActor != null)
PhysicsActor pa = RootPart.PhysActor;
if (pa != null)
{
if (height != 0f)
{
RootPart.PhysActor.PIDHoverHeight = height;
RootPart.PhysActor.PIDHoverType = hoverType;
RootPart.PhysActor.PIDTau = tau;
RootPart.PhysActor.PIDHoverActive = true;
pa.PIDHoverHeight = height;
pa.PIDHoverType = hoverType;
pa.PIDTau = tau;
pa.PIDHoverActive = true;
}
else
{
RootPart.PhysActor.PIDHoverActive = false;
pa.PIDHoverActive = false;
}
}
}
@@ -1954,6 +1973,10 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary>
/// Link the prims in a given group to this group
/// </summary>
/// <remarks>
/// Do not call this method directly - use Scene.LinkObjects() instead to avoid races between threads.
/// FIXME: There are places where scripts call these methods directly without locking. This is a potential race condition.
/// </remarks>
/// <param name="objectGroup">The group of prims which should be linked to this group</param>
public void LinkToGroup(SceneObjectGroup objectGroup)
{
@@ -1998,6 +2021,7 @@ namespace OpenSim.Region.Framework.Scenes
linkPart.CreateSelected = true;
linkPart.LinkNum = linkNum++;
linkPart.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect);
SceneObjectPart[] ogParts = objectGroup.Parts;
Array.Sort(ogParts, delegate(SceneObjectPart a, SceneObjectPart b)
@@ -2037,6 +2061,11 @@ namespace OpenSim.Region.Framework.Scenes
/// Delink the given prim from this group. The delinked prim is established as
/// an independent SceneObjectGroup.
/// </summary>
/// <remarks>
/// FIXME: This method should not be called directly since it bypasses update locking, allowing a potential race
/// condition. But currently there is no
/// alternative method that does take a lonk to delink a single prim.
/// </remarks>
/// <param name="partID"></param>
/// <returns>The object group of the newly delinked prim. Null if part could not be found</returns>
public SceneObjectGroup DelinkFromGroup(uint partID)
@@ -2048,6 +2077,11 @@ namespace OpenSim.Region.Framework.Scenes
/// Delink the given prim from this group. The delinked prim is established as
/// an independent SceneObjectGroup.
/// </summary>
/// <remarks>
/// FIXME: This method should not be called directly since it bypasses update locking, allowing a potential race
/// condition. But currently there is no
/// alternative method that does take a lonk to delink a single prim.
/// </remarks>
/// <param name="partID"></param>
/// <param name="sendEvents"></param>
/// <returns>The object group of the newly delinked prim. Null if part could not be found</returns>
@@ -2073,6 +2107,11 @@ namespace OpenSim.Region.Framework.Scenes
/// Delink the given prim from this group. The delinked prim is established as
/// an independent SceneObjectGroup.
/// </summary>
/// <remarks>
/// FIXME: This method should not be called directly since it bypasses update locking, allowing a potential race
/// condition. But currently there is no
/// alternative method that does take a lonk to delink a single prim.
/// </remarks>
/// <param name="partID"></param>
/// <param name="sendEvents"></param>
/// <returns>The object group of the newly delinked prim.</returns>
@@ -2112,10 +2151,10 @@ namespace OpenSim.Region.Framework.Scenes
linkPart.ParentID = 0;
linkPart.LinkNum = 0;
if (linkPart.PhysActor != null)
{
m_scene.PhysicsScene.RemovePrim(linkPart.PhysActor);
}
PhysicsActor linkPartPa = linkPart.PhysActor;
if (linkPartPa != null)
m_scene.PhysicsScene.RemovePrim(linkPartPa);
// We need to reset the child part's position
// ready for life as a separate object after being a part of another object
@@ -2193,6 +2232,8 @@ namespace OpenSim.Region.Framework.Scenes
oldRot = part.RotationOffset;
Quaternion newRot = Quaternion.Inverse(parentRot) * oldRot;
part.RotationOffset = newRot;
part.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect);
}
/// <summary>
@@ -2206,17 +2247,19 @@ namespace OpenSim.Region.Framework.Scenes
{
if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
{
if (m_rootPart.PhysActor != null)
PhysicsActor pa = m_rootPart.PhysActor;
if (pa != null)
{
if (m_rootPart.PhysActor.IsPhysical)
if (pa.IsPhysical)
{
if (!m_rootPart.BlockGrab)
{
Vector3 llmoveforce = pos - AbsolutePosition;
Vector3 grabforce = llmoveforce;
grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass;
m_rootPart.PhysActor.AddForce(grabforce, true);
m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
grabforce = (grabforce / 10) * pa.Mass;
pa.AddForce(grabforce, true);
m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
}
}
else
@@ -2246,9 +2289,11 @@ namespace OpenSim.Region.Framework.Scenes
{
if (m_scene.EventManager.TriggerGroupSpinStart(UUID))
{
if (m_rootPart.PhysActor != null)
PhysicsActor pa = m_rootPart.PhysActor;
if (pa != null)
{
if (m_rootPart.PhysActor.IsPhysical)
if (pa.IsPhysical)
{
m_rootPart.IsWaitingForFirstSpinUpdatePacket = true;
}
@@ -2289,12 +2334,13 @@ namespace OpenSim.Region.Framework.Scenes
// but it will result in over-shoot or under-shoot of the target orientation.
// For the end user, this means that ctrl+shift+drag can be used for relative,
// but not absolute, adjustments of orientation for physical prims.
if (m_scene.EventManager.TriggerGroupSpin(UUID, newOrientation))
{
if (m_rootPart.PhysActor != null)
PhysicsActor pa = m_rootPart.PhysActor;
if (pa != null)
{
if (m_rootPart.PhysActor.IsPhysical)
if (pa.IsPhysical)
{
if (m_rootPart.IsWaitingForFirstSpinUpdatePacket)
{
@@ -2320,9 +2366,9 @@ namespace OpenSim.Region.Framework.Scenes
//m_log.Error("SCENE OBJECT GROUP]: rotation axis is " + rotationAxis);
Vector3 spinforce = new Vector3(rotationAxis.X, rotationAxis.Y, rotationAxis.Z);
spinforce = (spinforce/8) * m_rootPart.PhysActor.Mass; // 8 is an arbitrary torque scaling factor
m_rootPart.PhysActor.AddAngularForce(spinforce,true);
m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
spinforce = (spinforce/8) * pa.Mass; // 8 is an arbitrary torque scaling factor
pa.AddAngularForce(spinforce,true);
m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
}
}
else
@@ -2496,8 +2542,10 @@ namespace OpenSim.Region.Framework.Scenes
{
part.UpdateShape(shapeBlock);
if (part.PhysActor != null)
m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
PhysicsActor pa = m_rootPart.PhysActor;
if (pa != null)
m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
}
}
@@ -2520,7 +2568,9 @@ namespace OpenSim.Region.Framework.Scenes
scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys);
scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys);
if (RootPart.PhysActor != null && RootPart.PhysActor.IsPhysical)
PhysicsActor pa = m_rootPart.PhysActor;
if (pa != null && pa.IsPhysical)
{
scale.X = Math.Min(scale.X, Scene.m_maxPhys);
scale.Y = Math.Min(scale.Y, Scene.m_maxPhys);
@@ -2546,7 +2596,7 @@ namespace OpenSim.Region.Framework.Scenes
float f = 1.0f;
float a = 1.0f;
if (RootPart.PhysActor != null && RootPart.PhysActor.IsPhysical)
if (pa != null && pa.IsPhysical)
{
if (oldSize.X * x > m_scene.m_maxPhys)
{
@@ -2676,6 +2726,7 @@ namespace OpenSim.Region.Framework.Scenes
{
m_rootPart.AttachedPos = pos;
}
if (RootPart.GetStatusSandbox())
{
if (Util.GetDistanceTo(RootPart.StatusSandboxPos, pos) > 10)
@@ -2686,8 +2737,8 @@ namespace OpenSim.Region.Framework.Scenes
ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false);
}
}
AbsolutePosition = pos;
AbsolutePosition = pos;
HasGroupChanged = true;
}
@@ -2911,10 +2962,13 @@ namespace OpenSim.Region.Framework.Scenes
m_rootPart.StoreUndoState();
m_rootPart.UpdateRotation(rot);
if (m_rootPart.PhysActor != null)
PhysicsActor pa = m_rootPart.PhysActor;
if (pa != null)
{
m_rootPart.PhysActor.Orientation = m_rootPart.RotationOffset;
m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
pa.Orientation = m_rootPart.RotationOffset;
m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
}
SceneObjectPart[] parts = m_parts.GetArray();
@@ -3256,7 +3310,7 @@ namespace OpenSim.Region.Framework.Scenes
public virtual string ExtraToXmlString()
{
return "<ExtraFromItemID>" + GetFromItemID().ToString() + "</ExtraFromItemID>";
return "<ExtraFromItemID>" + FromItemID.ToString() + "</ExtraFromItemID>";
}
public virtual void ExtraFromXmlString(string xmlstr)
@@ -3268,7 +3322,7 @@ namespace OpenSim.Region.Framework.Scenes
UUID uuid = UUID.Zero;
UUID.TryParse(id, out uuid);
SetFromItemID(uuid);
FromItemID = uuid;
}
#endregion

View File

@@ -151,15 +151,15 @@ namespace OpenSim.Region.Framework.Scenes
public int[] PayPrice = {-2,-2,-2,-2,-2};
[XmlIgnore]
public PhysicsActor PhysActor
{
get { return m_physActor; }
set
{
// m_log.DebugFormat("[SOP]: PhysActor set to {0} for {1} {2}", value, Name, UUID);
m_physActor = value;
}
}
/// <summary>
/// The representation of this part in the physics scene.
/// </summary>
/// <remarks>
/// If you use this property more than once in a section of code then you must take a reference and use that.
/// If another thread is simultaneously turning physics off on this part then this refernece could become
/// null at any time.
/// </remarks>
public PhysicsActor PhysActor { get; set; }
//Xantor 20080528 Sound stuff:
// Note: This isn't persisted in the database right now, as the fields for that aren't just there yet.
@@ -179,10 +179,6 @@ namespace OpenSim.Region.Framework.Scenes
public uint TimeStampLastActivity; // Will be used for AutoReturn
public uint TimeStampTerse;
public UUID FromItemID;
public UUID FromFolderID;
public int STATUS_ROTATE_X;
@@ -258,7 +254,6 @@ namespace OpenSim.Region.Framework.Scenes
private bool m_passTouches;
private PhysicsActor m_physActor;
protected Vector3 m_acceleration;
protected Vector3 m_angularVelocity;
@@ -522,10 +517,11 @@ namespace OpenSim.Region.Framework.Scenes
set
{
m_name = value;
if (PhysActor != null)
{
PhysActor.SOPName = value;
}
PhysicsActor pa = PhysActor;
if (pa != null)
pa.SOPName = value;
}
}
@@ -535,10 +531,11 @@ namespace OpenSim.Region.Framework.Scenes
set
{
m_material = (Material)value;
if (PhysActor != null)
{
PhysActor.SetMaterial((int)value);
}
PhysicsActor pa = PhysActor;
if (pa != null)
pa.SetMaterial((int)value);
}
}
@@ -669,9 +666,7 @@ namespace OpenSim.Region.Framework.Scenes
// If this is a linkset, we don't want the physics engine mucking up our group position here.
PhysicsActor actor = PhysActor;
if (actor != null && ParentID == 0)
{
m_groupPosition = actor.Position;
}
if (ParentGroup.IsAttachment)
{
@@ -979,7 +974,7 @@ namespace OpenSim.Region.Framework.Scenes
if (Shape.SculptEntry)
CheckSculptAndLoad();
else
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
}
}
}
@@ -1480,38 +1475,17 @@ namespace OpenSim.Region.Framework.Scenes
if (VolumeDetectActive)
isPhantom = false;
// Added clarification.. since A rigid body is an object that you can kick around, etc.
bool RigidBody = isPhysical && !isPhantom;
// The only time the physics scene shouldn't know about the prim is if it's phantom or an attachment, which is phantom by definition
// or flexible
if (!isPhantom && !ParentGroup.IsAttachment && !(Shape.PathCurve == (byte)Extrusion.Flexible))
{
try
{
PhysActor = ParentGroup.Scene.PhysicsScene.AddPrimShape(
string.Format("{0}/{1}", Name, UUID),
Shape,
AbsolutePosition,
Scale,
RotationOffset,
RigidBody,
m_localId);
}
catch
{
m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid);
PhysActor = null;
}
// Added clarification.. since A rigid body is an object that you can kick around, etc.
bool rigidBody = isPhysical && !isPhantom;
// Basic Physics can also return null as well as an exception catch.
if (PhysActor != null)
{
PhysActor.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info
PhysActor.SetMaterial(Material);
DoPhysicsPropertyUpdate(RigidBody, true);
PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
}
PhysicsActor pa = AddToPhysics(rigidBody);
if (pa != null)
pa.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
}
}
}
@@ -1725,6 +1699,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="isNew"></param>
public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew)
{
if (ParentGroup.Scene == null)
return;
if (!ParentGroup.Scene.PhysicalPrims && UsePhysics)
return;
@@ -1734,23 +1711,25 @@ namespace OpenSim.Region.Framework.Scenes
}
else
{
if (PhysActor != null)
PhysicsActor pa = PhysActor;
if (pa != null)
{
if (UsePhysics != PhysActor.IsPhysical || isNew)
if (UsePhysics != pa.IsPhysical || isNew)
{
if (PhysActor.IsPhysical) // implies UsePhysics==false for this block
if (pa.IsPhysical) // implies UsePhysics==false for this block
{
if (!isNew)
ParentGroup.Scene.RemovePhysicalPrim(1);
PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate;
PhysActor.OnOutOfBounds -= PhysicsOutOfBounds;
PhysActor.delink();
pa.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate;
pa.OnOutOfBounds -= PhysicsOutOfBounds;
pa.delink();
if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints && (!isNew))
{
// destroy all joints connected to this now deactivated body
ParentGroup.Scene.PhysicsScene.RemoveAllJointsConnectedToActorThreadLocked(PhysActor);
ParentGroup.Scene.PhysicsScene.RemoveAllJointsConnectedToActorThreadLocked(pa);
}
// stop client-side interpolation of all joint proxy objects that have just been deleted
@@ -1769,7 +1748,7 @@ namespace OpenSim.Region.Framework.Scenes
//RotationalVelocity = new Vector3(0, 0, 0);
}
PhysActor.IsPhysical = UsePhysics;
pa.IsPhysical = UsePhysics;
// If we're not what we're supposed to be in the physics scene, recreate ourselves.
//m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor);
@@ -1782,13 +1761,15 @@ namespace OpenSim.Region.Framework.Scenes
{
ParentGroup.Scene.AddPhysicalPrim(1);
PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate;
PhysActor.OnOutOfBounds += PhysicsOutOfBounds;
pa.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate;
pa.OnOutOfBounds += PhysicsOutOfBounds;
if (ParentID != 0 && ParentID != LocalId)
{
if (ParentGroup.RootPart.PhysActor != null)
PhysicsActor parentPa = ParentGroup.RootPart.PhysActor;
if (parentPa != null)
{
PhysActor.link(ParentGroup.RootPart.PhysActor);
pa.link(parentPa);
}
}
}
@@ -1800,7 +1781,7 @@ namespace OpenSim.Region.Framework.Scenes
if (Shape.SculptEntry)
CheckSculptAndLoad();
else
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa);
}
}
}
@@ -1911,24 +1892,30 @@ namespace OpenSim.Region.Framework.Scenes
public Vector3 GetGeometricCenter()
{
if (PhysActor != null)
return new Vector3(PhysActor.CenterOfMass.X, PhysActor.CenterOfMass.Y, PhysActor.CenterOfMass.Z);
PhysicsActor pa = PhysActor;
if (pa != null)
return new Vector3(pa.CenterOfMass.X, pa.CenterOfMass.Y, pa.CenterOfMass.Z);
else
return new Vector3(0, 0, 0);
}
public float GetMass()
{
if (PhysActor != null)
return PhysActor.Mass;
PhysicsActor pa = PhysActor;
if (pa != null)
return pa.Mass;
else
return 0;
}
public Vector3 GetForce()
{
if (PhysActor != null)
return PhysActor.Force;
PhysicsActor pa = PhysActor;
if (pa != null)
return pa.Force;
else
return Vector3.Zero;
}
@@ -2559,9 +2546,11 @@ namespace OpenSim.Region.Framework.Scenes
public void PhysicsRequestingTerseUpdate()
{
if (PhysActor != null)
PhysicsActor pa = PhysActor;
if (pa != null)
{
Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0);
Vector3 newpos = new Vector3(pa.Position.GetBytes(), 0);
if (ParentGroup.Scene.TestBorderCross(newpos, Cardinals.N)
| ParentGroup.Scene.TestBorderCross(newpos, Cardinals.S)
@@ -2573,6 +2562,7 @@ namespace OpenSim.Region.Framework.Scenes
}
//ParentGroup.RootPart.m_groupPosition = newpos;
}
ScheduleTerseUpdate();
}
@@ -2663,7 +2653,9 @@ namespace OpenSim.Region.Framework.Scenes
scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxNonphys);
scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxNonphys);
if (PhysActor != null && PhysActor.IsPhysical)
PhysicsActor pa = PhysActor;
if (pa != null && pa.IsPhysical)
{
scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxPhys);
scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxPhys);
@@ -2812,12 +2804,14 @@ namespace OpenSim.Region.Framework.Scenes
m_shape.SculptData = texture.Data;
}
if (PhysActor != null)
PhysicsActor pa = PhysActor;
if (pa != null)
{
// Update the physics actor with the new loaded sculpt data and set the taint signal.
PhysActor.Shape = m_shape;
pa.Shape = m_shape;
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa);
}
}
}
@@ -3075,10 +3069,10 @@ namespace OpenSim.Region.Framework.Scenes
public void SetBuoyancy(float fvalue)
{
if (PhysActor != null)
{
PhysActor.Buoyancy = fvalue;
}
PhysicsActor pa = PhysActor;
if (pa != null)
pa.Buoyancy = fvalue;
}
public void SetDieAtEdge(bool p)
@@ -3091,57 +3085,50 @@ namespace OpenSim.Region.Framework.Scenes
public void SetFloatOnWater(int floatYN)
{
if (PhysActor != null)
{
if (floatYN == 1)
{
PhysActor.FloatOnWater = true;
}
else
{
PhysActor.FloatOnWater = false;
}
}
PhysicsActor pa = PhysActor;
if (pa != null)
pa.FloatOnWater = floatYN == 1;
}
public void SetForce(Vector3 force)
{
if (PhysActor != null)
{
PhysActor.Force = force;
}
PhysicsActor pa = PhysActor;
if (pa != null)
pa.Force = force;
}
public void SetVehicleType(int type)
{
if (PhysActor != null)
{
PhysActor.VehicleType = type;
}
PhysicsActor pa = PhysActor;
if (pa != null)
pa.VehicleType = type;
}
public void SetVehicleFloatParam(int param, float value)
{
if (PhysActor != null)
{
PhysActor.VehicleFloatParam(param, value);
}
PhysicsActor pa = PhysActor;
if (pa != null)
pa.VehicleFloatParam(param, value);
}
public void SetVehicleVectorParam(int param, Vector3 value)
{
if (PhysActor != null)
{
PhysActor.VehicleVectorParam(param, value);
}
PhysicsActor pa = PhysActor;
if (pa != null)
pa.VehicleVectorParam(param, value);
}
public void SetVehicleRotationParam(int param, Quaternion rotation)
{
if (PhysActor != null)
{
PhysActor.VehicleRotationParam(param, rotation);
}
PhysicsActor pa = PhysActor;
if (pa != null)
pa.VehicleRotationParam(param, rotation);
}
/// <summary>
@@ -4170,7 +4157,7 @@ namespace OpenSim.Region.Framework.Scenes
// For now, we use the NINJA naming scheme for identifying joints.
// In the future, we can support other joint specification schemes such as a
// custom checkbox in the viewer GUI.
if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
{
string hingeString = "hingejoint";
return (Name.Length >= hingeString.Length && Name.Substring(0, hingeString.Length) == hingeString);
@@ -4186,7 +4173,7 @@ namespace OpenSim.Region.Framework.Scenes
// For now, we use the NINJA naming scheme for identifying joints.
// In the future, we can support other joint specification schemes such as a
// custom checkbox in the viewer GUI.
if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
{
string ballString = "balljoint";
return (Name.Length >= ballString.Length && Name.Substring(0, ballString.Length) == ballString);
@@ -4202,7 +4189,7 @@ namespace OpenSim.Region.Framework.Scenes
// For now, we use the NINJA naming scheme for identifying joints.
// In the future, we can support other joint specification schemes such as a
// custom checkbox in the viewer GUI.
if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
{
return IsHingeJoint() || IsBallJoint();
}
@@ -4229,6 +4216,8 @@ namespace OpenSim.Region.Framework.Scenes
if ((UsePhysics == wasUsingPhysics) && (wasTemporary == SetTemporary) && (wasPhantom == SetPhantom) && (SetVD == wasVD))
return;
PhysicsActor pa = PhysActor;
// Special cases for VD. VD can only be called from a script
// and can't be combined with changes to other states. So we can rely
// that...
@@ -4244,8 +4233,9 @@ namespace OpenSim.Region.Framework.Scenes
{
SetVD = false; // Switch it of for the course of this routine
VolumeDetectActive = false; // and also permanently
if (PhysActor != null)
PhysActor.SetVolumeDetect(0); // Let physics know about it too
if (pa != null)
pa.SetVolumeDetect(0); // Let physics know about it too
}
else
{
@@ -4302,41 +4292,36 @@ namespace OpenSim.Region.Framework.Scenes
if (ParentGroup.Scene == null)
return;
if (ParentGroup.Scene.CollidablePrims && PhysActor == null)
if (ParentGroup.Scene.CollidablePrims && pa == null)
{
// It's not phantom anymore. So make sure the physics engine get's knowledge of it
PhysActor = ParentGroup.Scene.PhysicsScene.AddPrimShape(
string.Format("{0}/{1}", Name, UUID),
Shape,
AbsolutePosition,
Scale,
RotationOffset,
UsePhysics,
m_localId);
pa = AddToPhysics(UsePhysics);
PhysActor.SetMaterial(Material);
DoPhysicsPropertyUpdate(UsePhysics, true);
if (!ParentGroup.IsDeleted)
if (pa != null)
{
if (LocalId == ParentGroup.RootPart.LocalId)
pa.SetMaterial(Material);
DoPhysicsPropertyUpdate(UsePhysics, true);
if (!ParentGroup.IsDeleted)
{
ParentGroup.CheckSculptAndLoad();
if (LocalId == ParentGroup.RootPart.LocalId)
{
ParentGroup.CheckSculptAndLoad();
}
}
if (
((AggregateScriptEvents & scriptEvents.collision) != 0) ||
((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
(CollisionSound != UUID.Zero)
)
{
pa.OnCollisionUpdate += PhysicsCollision;
pa.SubscribeEvents(1000);
}
}
if (
((AggregateScriptEvents & scriptEvents.collision) != 0) ||
((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
(CollisionSound != UUID.Zero)
)
{
PhysActor.OnCollisionUpdate += PhysicsCollision;
PhysActor.SubscribeEvents(1000);
}
}
else // it already has a physical representation
@@ -4360,9 +4345,9 @@ namespace OpenSim.Region.Framework.Scenes
// Defensive programming calls for a check here.
// Better would be throwing an exception that could be catched by a unit test as the internal
// logic should make sure, this Physactor is always here.
if (this.PhysActor != null)
if (pa != null)
{
PhysActor.SetVolumeDetect(1);
pa.SetVolumeDetect(1);
AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active
this.VolumeDetectActive = true;
}
@@ -4371,11 +4356,8 @@ namespace OpenSim.Region.Framework.Scenes
{
// Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like
// (mumbles, well, at least if you have infinte CPU powers :-))
PhysicsActor pa = this.PhysActor;
if (pa != null)
{
PhysActor.SetVolumeDetect(0);
}
this.VolumeDetectActive = false;
}
@@ -4388,6 +4370,7 @@ namespace OpenSim.Region.Framework.Scenes
{
RemFlag(PrimFlags.TemporaryOnRez);
}
// m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString());
if (ParentGroup != null)
@@ -4400,7 +4383,52 @@ namespace OpenSim.Region.Framework.Scenes
}
/// <summary>
/// This removes the part from physics
/// Adds this part to the physics scene.
/// </summary>
/// <remarks>This method also sets the PhysActor property.</remarks>
/// <param name="rigidBody">Add this prim with a rigid body.</param>
/// <returns>
/// The physics actor. null if there was a failure.
/// </returns>
private PhysicsActor AddToPhysics(bool rigidBody)
{
PhysicsActor pa;
try
{
pa = ParentGroup.Scene.PhysicsScene.AddPrimShape(
string.Format("{0}/{1}", Name, UUID),
Shape,
AbsolutePosition,
Scale,
RotationOffset,
rigidBody,
m_localId);
}
catch
{
m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid);
pa = null;
}
// FIXME: Ideally we wouldn't set the property here to reduce situations where threads changing physical
// properties can stop on each other. However, DoPhysicsPropertyUpdate() currently relies on PhysActor
// being set.
PhysActor = pa;
// Basic Physics can also return null as well as an exception catch.
if (pa != null)
{
pa.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info
pa.SetMaterial(Material);
DoPhysicsPropertyUpdate(rigidBody, true);
}
return pa;
}
/// <summary>
/// This removes the part from the physics scene.
/// </summary>
/// <remarks>
/// This isn't the same as turning off physical, since even without being physical the prim has a physics
@@ -4456,10 +4484,12 @@ namespace OpenSim.Region.Framework.Scenes
m_shape.PathTwist = shapeBlock.PathTwist;
m_shape.PathTwistBegin = shapeBlock.PathTwistBegin;
if (PhysActor != null)
PhysicsActor pa = PhysActor;
if (pa != null)
{
PhysActor.Shape = m_shape;
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
pa.Shape = m_shape;
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa);
}
// This is what makes vehicle trailers work
@@ -4601,6 +4631,8 @@ namespace OpenSim.Region.Framework.Scenes
objectflagupdate |= (uint) PrimFlags.AllowInventoryDrop;
}
PhysicsActor pa = PhysActor;
if (
((AggregateScriptEvents & scriptEvents.collision) != 0) ||
((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
@@ -4612,18 +4644,18 @@ namespace OpenSim.Region.Framework.Scenes
)
{
// subscribe to physics updates.
if (PhysActor != null)
if (pa != null)
{
PhysActor.OnCollisionUpdate += PhysicsCollision;
PhysActor.SubscribeEvents(1000);
pa.OnCollisionUpdate += PhysicsCollision;
pa.SubscribeEvents(1000);
}
}
else
{
if (PhysActor != null)
if (pa != null)
{
PhysActor.UnSubscribeEvents();
PhysActor.OnCollisionUpdate -= PhysicsCollision;
pa.UnSubscribeEvents();
pa.OnCollisionUpdate -= PhysicsCollision;
}
}

View File

@@ -590,9 +590,9 @@ namespace OpenSim.Region.Framework.Scenes
/// A list of inventory items with that name.
/// If no inventory item has that name then an empty list is returned.
/// </returns>
public IList<TaskInventoryItem> GetInventoryItems(string name)
public List<TaskInventoryItem> GetInventoryItems(string name)
{
IList<TaskInventoryItem> items = new List<TaskInventoryItem>();
List<TaskInventoryItem> items = new List<TaskInventoryItem>();
lock (m_items)
{
@@ -1100,7 +1100,7 @@ namespace OpenSim.Region.Framework.Scenes
public List<TaskInventoryItem> GetInventoryItems()
{
List<TaskInventoryItem> ret = new List<TaskInventoryItem>();
List<TaskInventoryItem> ret = new List<TaskInventoryItem>();
lock (m_items)
ret = new List<TaskInventoryItem>(m_items.Values);

View File

@@ -1053,6 +1053,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="pos"></param>
public void Teleport(Vector3 pos)
{
// m_log.DebugFormat("[SCENE PRESENCE]: Moving {0} to {1} in {2}", Name, pos, Scene.RegionInfo.RegionName);
bool isFlying = Flying;
RemoveFromPhysicalScene();
Velocity = Vector3.Zero;
@@ -1065,6 +1067,10 @@ namespace OpenSim.Region.Framework.Scenes
public void TeleportWithMomentum(Vector3 pos)
{
// m_log.DebugFormat(
// "[SCENE PRESENCE]: Moving {0} to {1} with existing momentum {2} in {3} ",
// Name, pos, Velocity, Scene.RegionInfo.RegionName);
bool isFlying = Flying;
RemoveFromPhysicalScene();
CheckLandingPoint(ref pos);
@@ -1204,7 +1210,10 @@ namespace OpenSim.Region.Framework.Scenes
if ((m_callbackURI != null) && !m_callbackURI.Equals(""))
{
m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI);
m_log.DebugFormat(
"[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}",
client.Name, client.AgentId, m_callbackURI);
Scene.SimulationService.ReleaseAgent(m_originRegionID, UUID, m_callbackURI);
m_callbackURI = null;
}
@@ -1751,9 +1760,9 @@ namespace OpenSim.Region.Framework.Scenes
if (pos.Z - terrainHeight < 0.2)
pos.Z = terrainHeight;
m_log.DebugFormat(
"[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}",
Name, pos, terrainHeight, m_scene.RegionInfo.RegionName);
// m_log.DebugFormat(
// "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}",
// Name, pos, terrainHeight, m_scene.RegionInfo.RegionName);
if (noFly)
Flying = false;
@@ -3895,7 +3904,7 @@ namespace OpenSim.Region.Framework.Scenes
ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y);
if (land != null)
{
if (Scene.DEBUG)
if (Scene.DebugTeleporting)
TeleportFlagsDebug();
// If we come in via login, landmark or map, we want to

Some files were not shown because too many files have changed in this diff Show More