Compare commits
396 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e321306517 | ||
|
|
acfe7e555e | ||
|
|
5023cc86f0 | ||
|
|
4455140f30 | ||
|
|
71e484516a | ||
|
|
38f878952c | ||
|
|
d80422eba7 | ||
|
|
ee078f717a | ||
|
|
73f34de1f9 | ||
|
|
b3d152f3ba | ||
|
|
a7dc7e636e | ||
|
|
44d84bc277 | ||
|
|
215acbcc96 | ||
|
|
7273e05995 | ||
|
|
ddca5347c3 | ||
|
|
e8cc1bd329 | ||
|
|
9c84a8162f | ||
|
|
16c4636048 | ||
|
|
7c888f6af1 | ||
|
|
dbe32a1f6d | ||
|
|
3fa61c4a39 | ||
|
|
dfa19e23f0 | ||
|
|
9c6ba8d18f | ||
|
|
d5c08c44bf | ||
|
|
bef2a368f4 | ||
|
|
236e1c45f2 | ||
|
|
a4367e75d3 | ||
|
|
c87751a822 | ||
|
|
1f402fdf5e | ||
|
|
bd928218dd | ||
|
|
773994723a | ||
|
|
7583768b9e | ||
|
|
de255321f1 | ||
|
|
37049180f6 | ||
|
|
c22970448f | ||
|
|
038d1bf742 | ||
|
|
a829f20828 | ||
|
|
54fc78013d | ||
|
|
130b1c0665 | ||
|
|
a5fcdde179 | ||
|
|
0904772a6f | ||
|
|
4e11983c7c | ||
|
|
8923ad755d | ||
|
|
35f14a262d | ||
|
|
13999dfc1d | ||
|
|
36ed0dcdaa | ||
|
|
44badf452e | ||
|
|
df07b97abd | ||
|
|
43b4e4cfc3 | ||
|
|
ce5e900721 | ||
|
|
6034e5d112 | ||
|
|
8779ff3c8f | ||
|
|
edc11a1d39 | ||
|
|
09d6521361 | ||
|
|
6c252a0fa1 | ||
|
|
9b762a5a84 | ||
|
|
2b6c5fcb31 | ||
|
|
312e1457dd | ||
|
|
bd9d7484f0 | ||
|
|
4f8f44d9c3 | ||
|
|
ea19e50919 | ||
|
|
0742630d81 | ||
|
|
107cef2b0e | ||
|
|
ce34b359ad | ||
|
|
5c545d1d2e | ||
|
|
83ef13a79a | ||
|
|
6234264211 | ||
|
|
f17066b7bf | ||
|
|
1a18948935 | ||
|
|
0dbfa70443 | ||
|
|
61adf36339 | ||
|
|
ed846f11f1 | ||
|
|
3257dbe76d | ||
|
|
146d78edfa | ||
|
|
ee2b2aadc3 | ||
|
|
bce5dfe711 | ||
|
|
76a658324c | ||
|
|
573a64ad24 | ||
|
|
574c240202 | ||
|
|
bdc31bddfc | ||
|
|
447a66d660 | ||
|
|
54d473e200 | ||
|
|
264c83aec4 | ||
|
|
8f8b5f9a4d | ||
|
|
07c487a28f | ||
|
|
17df4185ce | ||
|
|
dbf6381e34 | ||
|
|
fd7e82ee72 | ||
|
|
857d4e60cc | ||
|
|
567f4c51f8 | ||
|
|
6fe4b6fbe8 | ||
|
|
dbc3f1ff92 | ||
|
|
0ce9ad4a56 | ||
|
|
c10193c72b | ||
|
|
45ad9e39a6 | ||
|
|
e5ae84b42b | ||
|
|
16aa00e944 | ||
|
|
003bd9f1b3 | ||
|
|
cc1476fc36 | ||
|
|
241ddd031f | ||
|
|
c08d6df7e1 | ||
|
|
fcc1fa2c32 | ||
|
|
3d7b5e5e93 | ||
|
|
99e71222f0 | ||
|
|
e3680f216e | ||
|
|
8b3da1bff4 | ||
|
|
437de6743c | ||
|
|
f028dca711 | ||
|
|
996cc6097e | ||
|
|
ac7cded080 | ||
|
|
ab89adfaef | ||
|
|
647b326edc | ||
|
|
77b032549e | ||
|
|
e3e38e34c5 | ||
|
|
9bd02b5da1 | ||
|
|
727ddffb71 | ||
|
|
2f84d5397b | ||
|
|
1505c22995 | ||
|
|
d76ca9cd93 | ||
|
|
1b63b21a4d | ||
|
|
10b9348071 | ||
|
|
f3780b9eae | ||
|
|
a98a146c50 | ||
|
|
c305b55012 | ||
|
|
d2dfa4cfe7 | ||
|
|
71012ef883 | ||
|
|
fe0975dc24 | ||
|
|
2b84b6d8b1 | ||
|
|
dbc039783b | ||
|
|
a0206e5a17 | ||
|
|
0f181fe5d0 | ||
|
|
cfe924e4a8 | ||
|
|
e1cad4c34f | ||
|
|
9dbb58ee8b | ||
|
|
53c3faac5d | ||
|
|
c4cc626dff | ||
|
|
bde2ff5e78 | ||
|
|
ea16c9f858 | ||
|
|
df9c35bc0f | ||
|
|
9d93c4808e | ||
|
|
54e6b2402c | ||
|
|
00d1c88c59 | ||
|
|
ad02e01e77 | ||
|
|
1b600e7803 | ||
|
|
3de534896e | ||
|
|
9a86a713d3 | ||
|
|
5e60afe5ed | ||
|
|
e8b688b61f | ||
|
|
7c824f02b4 | ||
|
|
498fe1afe7 | ||
|
|
dac826da4e | ||
|
|
f7c237c0e1 | ||
|
|
ae057a7589 | ||
|
|
1a20b60d82 | ||
|
|
2e31f12cf4 | ||
|
|
2ef9fd05fa | ||
|
|
6fbc48ee9c | ||
|
|
6db9109b3f | ||
|
|
abffda269f | ||
|
|
154ba0124a | ||
|
|
fbe324cc5e | ||
|
|
090164ff7a | ||
|
|
428407c5e4 | ||
|
|
088f1213b4 | ||
|
|
e391d6390c | ||
|
|
deeb7287a2 | ||
|
|
7352aea9ac | ||
|
|
7837c611fb | ||
|
|
26a4e8a161 | ||
|
|
31b87ff07b | ||
|
|
7c1d075a5a | ||
|
|
abf0dd4250 | ||
|
|
9939f94f08 | ||
|
|
86b9e6fbed | ||
|
|
91ac21b9ec | ||
|
|
9d60b84f78 | ||
|
|
6da82d9805 | ||
|
|
616373db16 | ||
|
|
7229f6e64b | ||
|
|
da720ce9be | ||
|
|
a537f7e1a3 | ||
|
|
a6abecf5fa | ||
|
|
093469c33c | ||
|
|
36e6edfc65 | ||
|
|
13d9b64b1d | ||
|
|
4ce42762ee | ||
|
|
55c6cbabfd | ||
|
|
8e5502fdc2 | ||
|
|
2de3a1b9da | ||
|
|
d053625663 | ||
|
|
e9de7e7107 | ||
|
|
2e7c1bcfd9 | ||
|
|
8f53c768f5 | ||
|
|
82c3d0cf89 | ||
|
|
e20cf3789b | ||
|
|
7444f3bfad | ||
|
|
f84b69cad1 | ||
|
|
b996517c94 | ||
|
|
24862eaf15 | ||
|
|
2ca80add14 | ||
|
|
959bcfa7f8 | ||
|
|
7c514fe155 | ||
|
|
3d1f43046d | ||
|
|
427ab55058 | ||
|
|
2d0412d366 | ||
|
|
8e0eaa980f | ||
|
|
09baa3e679 | ||
|
|
3ae6345f1b | ||
|
|
dc329202ef | ||
|
|
5e445aaf7b | ||
|
|
ab8956d58f | ||
|
|
e8f1e7e96e | ||
|
|
488fe0ae9c | ||
|
|
7e76397a26 | ||
|
|
a704d444f2 | ||
|
|
8b035dc3c7 | ||
|
|
18fd36cba4 | ||
|
|
855d3a3ba5 | ||
|
|
a4977bbe19 | ||
|
|
6581849d24 | ||
|
|
ef6d6d20b9 | ||
|
|
f10288ceae | ||
|
|
0369d21917 | ||
|
|
0d2e02efb1 | ||
|
|
c0e1784e86 | ||
|
|
cc02f78d4e | ||
|
|
d51ae0ecac | ||
|
|
696fbdfa24 | ||
|
|
69e4debc42 | ||
|
|
090bf7acca | ||
|
|
8fcb9bf418 | ||
|
|
7a87be5015 | ||
|
|
616f2b5861 | ||
|
|
7bb01a17ee | ||
|
|
07ad821157 | ||
|
|
87799c1f3d | ||
|
|
c36c916342 | ||
|
|
48379e6442 | ||
|
|
8db64dc77f | ||
|
|
6a85abbd14 | ||
|
|
c1f6478a37 | ||
|
|
0037577814 | ||
|
|
9cfc43005d | ||
|
|
39c9b656c8 | ||
|
|
22ae9331bb | ||
|
|
4e0bb49394 | ||
|
|
cd2bf64b87 | ||
|
|
f7bd7c5901 | ||
|
|
7c404375c7 | ||
|
|
d1ef7ee5ca | ||
|
|
74c1ed77a4 | ||
|
|
1cd26ba85e | ||
|
|
02572ab1d3 | ||
|
|
24b20f6e4b | ||
|
|
68365c20c0 | ||
|
|
32d58d6e3e | ||
|
|
ba3b0c69f1 | ||
|
|
590f707c42 | ||
|
|
b6f3de5028 | ||
|
|
a0fb1e1788 | ||
|
|
ea72428c9d | ||
|
|
d38e2c0c91 | ||
|
|
503faaea62 | ||
|
|
381f74276b | ||
|
|
c92a9a6640 | ||
|
|
d75899f2d1 | ||
|
|
8f871cca10 | ||
|
|
9356963bd3 | ||
|
|
edb2e4c5b3 | ||
|
|
bf9ce4709f | ||
|
|
e41f23dead | ||
|
|
5ced49aaa8 | ||
|
|
2c6272d11a | ||
|
|
f8079bcd72 | ||
|
|
eea726d74e | ||
|
|
e7619f7518 | ||
|
|
ba7d8cedec | ||
|
|
717656c453 | ||
|
|
9ed9720861 | ||
|
|
939d60da59 | ||
|
|
ef5575be1b | ||
|
|
4eef6725f4 | ||
|
|
08b6b3bb48 | ||
|
|
5afb70b9fe | ||
|
|
747c25e920 | ||
|
|
7549836986 | ||
|
|
e13a17cc0c | ||
|
|
b14a6acd2f | ||
|
|
59a0c50d48 | ||
|
|
82ad9d4e04 | ||
|
|
d6b9504c84 | ||
|
|
35911d2362 | ||
|
|
9447b6d15f | ||
|
|
068b8e1f9b | ||
|
|
2e4fbe6b17 | ||
|
|
43173f1b0d | ||
|
|
ec299bfa87 | ||
|
|
4cbf8d728e | ||
|
|
43128c9016 | ||
|
|
72247bdaef | ||
|
|
82f0e19349 | ||
|
|
b5bb559cc0 | ||
|
|
a30a02e7ae | ||
|
|
e1a2c44ebe | ||
|
|
cde80125ad | ||
|
|
02d6b033d0 | ||
|
|
adea92f8b7 | ||
|
|
57ba9ef5ad | ||
|
|
982f3d58a9 | ||
|
|
9dc7fef4f6 | ||
|
|
c5594e839e | ||
|
|
acbff305f5 | ||
|
|
d40ec1c346 | ||
|
|
3b59af2225 | ||
|
|
6e7154d55c | ||
|
|
47377f17c6 | ||
|
|
beab155434 | ||
|
|
c7757d1038 | ||
|
|
aa2cde2493 | ||
|
|
cf166d3f1e | ||
|
|
caa207f59f | ||
|
|
1ac5aa6808 | ||
|
|
c4972e7734 | ||
|
|
d27dd3714f | ||
|
|
ba3491c76e | ||
|
|
0a1d61950b | ||
|
|
cadd645076 | ||
|
|
b47c0d7e51 | ||
|
|
8bdd80abfa | ||
|
|
4492bc1bcd | ||
|
|
6214e6a217 | ||
|
|
34137ed4ea | ||
|
|
5d9e135b5c | ||
|
|
1a3a1e6665 | ||
|
|
38db874755 | ||
|
|
5f7e392c7c | ||
|
|
53fb20880c | ||
|
|
5002f06d24 | ||
|
|
ef074deb52 | ||
|
|
8fa1108b72 | ||
|
|
a4c2e7f599 | ||
|
|
a2fe3e2081 | ||
|
|
ce44f56af9 | ||
|
|
7b84942f86 | ||
|
|
18497cef73 | ||
|
|
a3bb1a81de | ||
|
|
66783398d0 | ||
|
|
d67e9916b8 | ||
|
|
3deb52d399 | ||
|
|
d67e8291c8 | ||
|
|
1cc685e820 | ||
|
|
a22d0dcab9 | ||
|
|
707c8c6f2b | ||
|
|
b3a12167d6 | ||
|
|
95345521f0 | ||
|
|
3640afdd95 | ||
|
|
bc08cc201b | ||
|
|
43145c7f67 | ||
|
|
520b8b342e | ||
|
|
34c42cdab0 | ||
|
|
0e855fea7c | ||
|
|
1ebd79e413 | ||
|
|
0cf59534ff | ||
|
|
d5c5bbe0a1 | ||
|
|
44cde8d5c6 | ||
|
|
37fc19fae0 | ||
|
|
fb16d49511 | ||
|
|
266167f5a3 | ||
|
|
4bf2e19898 | ||
|
|
32eb7ddc37 | ||
|
|
6f19e231b6 | ||
|
|
94fa6cb071 | ||
|
|
efe51fd5cb | ||
|
|
69c0f252a4 | ||
|
|
58cb7cd084 | ||
|
|
38ae479249 | ||
|
|
f4231f0628 | ||
|
|
ba163ab05b | ||
|
|
c5c079f6aa | ||
|
|
679d155a39 | ||
|
|
9668992493 | ||
|
|
1cffd8fa03 | ||
|
|
7518b075b7 | ||
|
|
3073370d0e | ||
|
|
9bab43b4d1 | ||
|
|
70157a4ec5 | ||
|
|
a47aa46962 | ||
|
|
a34278cfc3 | ||
|
|
5f682b51ec | ||
|
|
ff5a83d192 | ||
|
|
8c445dac67 | ||
|
|
eb9bf71726 | ||
|
|
7661a0b2a9 | ||
|
|
de9d6096a5 | ||
|
|
11c48ac807 | ||
|
|
e9b9eb6a4c |
@@ -38,52 +38,8 @@
|
||||
<include name=".hgignore"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
|
||||
</target>
|
||||
|
||||
<!-- I don't think these targets are being actively used. But just in case, we'll just comment them out for now - justincc -->
|
||||
<!--
|
||||
<property name="projectdir" value="opensim-0.6.9" />
|
||||
<target name="dist" depends="distdir">
|
||||
<zip zipfile="${projectdir}.zip">
|
||||
<fileset basedir=".">
|
||||
<include name="${projectdir}/**" />
|
||||
</fileset>
|
||||
</zip>
|
||||
<tar destfile="${projectdir}.tar.gz" compression="GZip">
|
||||
<fileset basedir=".">
|
||||
<include name="${projectdir}/**" />
|
||||
</fileset>
|
||||
</tar>
|
||||
</target>
|
||||
|
||||
<target name="distdir">
|
||||
<delete dir="${projectdir}" />
|
||||
<copy todir="${projectdir}">
|
||||
<fileset basedir=".">
|
||||
<include name="ThirdPartyLicenses/**" />
|
||||
<include name="CONTRIBUTORS.txt" />
|
||||
<include name="README" />
|
||||
<include name="OpenSim/**/*.cs" />
|
||||
<include name="**/*.build" />
|
||||
<include name="**/*.csproj" />
|
||||
<include name="**/*.csproj.user" />
|
||||
<include name="**/*.sln" />
|
||||
<include name="bin/*.dll" />
|
||||
<include name="bin/*.so" />
|
||||
<include name="bin/*.config" />
|
||||
<include name="bin/assets/**" />
|
||||
<include name="bin/data/**" />
|
||||
<include name="bin/OpenSim*xml" />
|
||||
<include name="bin/OpenSim.ini" />
|
||||
<include name="bin/defaultstripe.png" />
|
||||
<exclude name="bin/OpenSim.*dll" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<touch file="${projectdir}/bin/startup_commands.txt" />
|
||||
</target>
|
||||
-->
|
||||
|
||||
<target name="test" depends="build, find-nunit">
|
||||
<setenv name="MONO_THREADS_PER_CPU" value="100" />
|
||||
|
||||
@@ -153,116 +109,17 @@
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.capabilities.handlers.tests)==0}" />
|
||||
|
||||
<delete dir="%temp%"/>
|
||||
|
||||
</target>
|
||||
|
||||
<target name="test-cov" depends="build">
|
||||
<!-- Code Coverage Test. Prototype, only works with mono 1.2. Instructions in http://opensimulator.org/wiki/Automated_Testing -->
|
||||
<mkdir dir="cov" failonerror="false" />
|
||||
<exec program="mono">
|
||||
<arg value="--debug" />
|
||||
<arg value="--profile=monocov:outfile=./cov/OpenSim.Framework.Servers.cov,+[OpenSim.Framework.Servers]" />
|
||||
<arg value="/usr/lib/nunit/nunit-console.exe" />
|
||||
<arg value="./bin/OpenSim.Framework.Servers.Tests.dll" />
|
||||
</exec>
|
||||
<delete dir="./cov/OpenSim.Framework.Servers" />
|
||||
<exec program="monocov">
|
||||
<arg value="--export-html=./cov/OpenSim.Framework.Servers ./cov/OpenSim.Framework.Servers.cov" />
|
||||
</exec>
|
||||
<target name="torture" depends="build, find-nunit">
|
||||
<setenv name="MONO_THREADS_PER_CPU" value="100" />
|
||||
|
||||
<!--
|
||||
<exec program="mono">
|
||||
<arg value="--debug" />
|
||||
<arg value="--profile=monocov:outfile=./cov/OpenSim.Region.ClientStack.LindenUDP.cov,+[OpenSim.Region.ClientStack.LindenUDP]" />
|
||||
<arg value="/usr/lib/nunit/nunit-console.exe" />
|
||||
<arg value="./bin/OpenSim.Region.ClientStack.LindenUDP.Tests.dll" />
|
||||
</exec>
|
||||
<delete dir="./cov/OpenSim.Region.ClientStack.LindenUDP" />
|
||||
<exec program="monocov">
|
||||
<arg value="--export-html=./cov/OpenSim.Region.ClientStack.LindenUDP ./cov/OpenSim.Region.ClientStack.LindenUDP.cov" />
|
||||
</exec>
|
||||
-->
|
||||
|
||||
<exec program="mono">
|
||||
<arg value="--debug" />
|
||||
<arg value="--profile=monocov:outfile=./cov/OpenSim.Region.ScriptEngine.Shared.cov,+[OpenSim.Region.ScriptEngine.Shared]" />
|
||||
<arg value="/usr/lib/nunit/nunit-console.exe" />
|
||||
<arg value="./bin/OpenSim.Region.ScriptEngine.Shared.Tests.dll" />
|
||||
</exec>
|
||||
<delete dir="./cov/OpenSim.Region.ScriptEngine.Shared" />
|
||||
<exec program="monocov">
|
||||
<arg value="--export-html=./cov/OpenSim.Region.ScriptEngine.Shared ./cov/OpenSim.Region.ScriptEngine.Shared.cov" />
|
||||
</exec>
|
||||
|
||||
<exec program="mono">
|
||||
<arg value="--debug" />
|
||||
<arg value="--profile=monocov:outfile=./cov/OpenSim.Region.ScriptEngine.Shared.CodeTools.cov,+[OpenSim.Region.ScriptEngine.Shared.CodeTools]" />
|
||||
<arg value="/usr/lib/nunit/nunit-console.exe" />
|
||||
<arg value="./bin/OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests.dll" />
|
||||
</exec>
|
||||
<delete dir="./cov/OpenSim.Region.ScriptEngine.Shared.CodeTools" />
|
||||
<exec program="monocov">
|
||||
<arg value="--export-html=./cov/OpenSim.Region.ScriptEngine.Shared.CodeTools ./cov/OpenSim.Region.ScriptEngine.Shared.CodeTools.cov" />
|
||||
</exec>
|
||||
|
||||
<exec program="mono">
|
||||
<arg value="--debug" />
|
||||
<arg value="--profile=monocov:outfile=./cov/OpenSim.Region.CoreModules.cov,+[OpenSim.Region.CoreModules]" />
|
||||
<arg value="/usr/lib/nunit/nunit-console.exe" />
|
||||
<arg value="./bin/OpenSim.Region.CoreModules.Tests.dll" />
|
||||
</exec>
|
||||
<delete dir="./cov/OpenSim.Region.CoreModules" />
|
||||
<exec program="monocov">
|
||||
<arg value="--export-html=./cov/OpenSim.Region.CoreModules ./cov/OpenSim.Region.CoreModules.cov" />
|
||||
</exec>
|
||||
|
||||
<exec program="mono">
|
||||
<arg value="--debug" />
|
||||
<arg value="--profile=monocov:outfile=./cov/OpenSim.Region.OptionalModules.cov,+[OpenSim.Region.OptionalModules]" />
|
||||
<arg value="/usr/lib/nunit/nunit-console.exe" />
|
||||
<arg value="./bin/OpenSim.Region.OptionalModules.Tests.dll" />
|
||||
</exec>
|
||||
<delete dir="./cov/OpenSim.Region.OptionalModules" />
|
||||
<exec program="monocov">
|
||||
<arg value="--export-html=./cov/OpenSim.Region.OptionalModules ./cov/OpenSim.Region.OptionalModules.cov" />
|
||||
</exec>
|
||||
|
||||
<exec program="mono">
|
||||
<arg value="--debug" />
|
||||
<arg value="--profile=monocov:outfile=./cov/OpenSim.Region.Framework.cov,+[OpenSim.Region.Framework]" />
|
||||
<arg value="/usr/lib/nunit/nunit-console.exe" />
|
||||
<arg value="./bin/OpenSim.Region.Framework.Tests.dll" />
|
||||
</exec>
|
||||
<delete dir="./cov/OpenSim.Region.Framework" />
|
||||
<exec program="monocov">
|
||||
<arg value="--export-html=./cov/OpenSim.Region.Framework ./cov/OpenSim.Region.Framework.cov" />
|
||||
</exec>
|
||||
|
||||
<exec program="mono">
|
||||
<arg value="--debug" />
|
||||
<arg value="--profile=monocov:outfile=./cov/OpenSim.Data.SQLite.cov,+[OpenSim.Data.SQLite]" />
|
||||
<arg value="/usr/lib/nunit/nunit-console.exe" />
|
||||
<arg value="./bin/OpenSim.Data.SQLite.Tests.dll" />
|
||||
</exec>
|
||||
<delete dir="./cov/OpenSim.Data.SQLite" />
|
||||
<exec program="monocov">
|
||||
<arg value="--export-html=./cov/OpenSim.Data.SQLite ./cov/OpenSim.Data.SQLite.cov" />
|
||||
</exec>
|
||||
|
||||
<exec program="mono">
|
||||
<arg value="--debug" />
|
||||
<arg value="--profile=monocov:outfile=./cov/OpenSim.Data.MySQL.cov,+[OpenSim.Data.MySQL.Tests]" />
|
||||
<arg value="/usr/lib/nunit/nunit-console.exe" />
|
||||
<arg value="./bin/OpenSim.Data.MySQL.Tests.dll" />
|
||||
</exec>
|
||||
<delete dir="./cov/OpenSim.Data.MySQL" />
|
||||
<exec program="monocov">
|
||||
<arg value="--export-html=./cov/OpenSim.Data.MySQL ./cov/OpenSim.Data.MySQL.cov" />
|
||||
</exec>
|
||||
|
||||
<delete file="C:\NUnitPrimaryTrace.txt" failonerror="false" />
|
||||
<delete file="TestResult.xml" failonerror="false" />
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.tests.torture">
|
||||
<arg value="./bin/OpenSim.Tests.Torture.dll" />
|
||||
</exec>
|
||||
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.tests.torture)==0}" />
|
||||
<delete dir="%temp%"/>
|
||||
</target>
|
||||
|
||||
<target name="find-nunit">
|
||||
@@ -275,15 +132,12 @@
|
||||
if="${int::parse(hasnunit2)==0}" />
|
||||
<property name="nunitcmd" value="nunit-console"
|
||||
if="${int::parse(hasnunit2)==1}" />
|
||||
|
||||
</target>
|
||||
|
||||
<!-- this is used for panda test execution -->
|
||||
<!-- work in progress -->
|
||||
|
||||
<target name="test-xml" depends="build, find-nunit">
|
||||
|
||||
|
||||
<mkdir dir="test-results" failonerror="false" />
|
||||
<!-- Unit Test Assembly -->
|
||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.tests">
|
||||
@@ -356,36 +210,7 @@
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.framework.tests)==0}" />
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.tests)==0}" />
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.capabilities.handlers.tests)==0}" />
|
||||
|
||||
</target>
|
||||
<!-- <exec program="nunit-console.exe" failonerror="false" resultproperty="testresult.acceptancetestassembly"> -->
|
||||
<!-- <arg value="AcceptanceTestAssembly.dll" /> -->
|
||||
<!-- <arg value="/xml=AcceptanceTestAssembly-Results.xml" /> -->
|
||||
<!-- </exec> -->
|
||||
|
||||
<!-- <fail message="Failures reported in unit tests." unless="${int::parse(testresult.unittestassembly)==0}" /> -->
|
||||
<!-- <fail message="Failures reported in acceptance tests." unless="${int::parse(testresult.acceptancetestassembly)==0}" /> -->
|
||||
<!-- </target> -->
|
||||
|
||||
|
||||
|
||||
<!-- <nunit2 failonerror="true" verbose="true"> -->
|
||||
<!-- <formatter type="Xml" usefile="true" extension=".xml" outputdir="./test-results" /> -->
|
||||
<!-- <test> -->
|
||||
<!-- <assemblies> -->
|
||||
<!-- <include name="./bin/OpenSim.Framework.Tests.dll" /> -->
|
||||
<!-- <include name="./bin/OpenSim.Framework.Servers.Tests.dll" /> -->
|
||||
<!-- <include name="./bin/OpenSim.Region.ClientStack.LindenUDP.Tests.dll" /> -->
|
||||
<!-- <include name="./bin/OpenSim.Region.ScriptEngine.Tests.dll" /> -->
|
||||
<!-- <include name="./bin/OpenSim.Region.CoreModules.Tests.dll" /> -->
|
||||
<!-- <include name="./bin/OpenSim.Region.OptionalModules.Tests.dll" /> -->
|
||||
<!-- <include name="./bin/OpenSim.Region.Framework.Tests.dll" /> -->
|
||||
<!-- <include name="./bin/OpenSim.Data.SQLite.Tests.dll" /> -->
|
||||
<!-- <include name="./bin/OpenSim.Data.MySQL.Tests.dll" /> -->
|
||||
<!-- </assemblies> -->
|
||||
<!-- </test> -->
|
||||
<!-- </nunit2> -->
|
||||
<!-- </target> -->
|
||||
|
||||
<target name="doxygen">
|
||||
<exec program="doxygen" workingdir="doc" commandline="doxygen.conf" />
|
||||
|
||||
11
BUILDING.txt
11
BUILDING.txt
@@ -17,13 +17,22 @@ Prereqs:
|
||||
* On some Linux distributions you may need to install additional packages.
|
||||
See http://opensimulator.org/wiki/Dependencies for more information.
|
||||
|
||||
* May also use xbuild (included in mono distributions)
|
||||
* May use Monodevelop, a cross-platform IDE
|
||||
|
||||
From the distribution type:
|
||||
* ./runprebuild.sh
|
||||
* nant
|
||||
* nant (or xbuild)
|
||||
* cd bin
|
||||
* copy OpenSim.ini.example to OpenSim.ini and other appropriate files in bin/config-include
|
||||
* run mono OpenSim.exe
|
||||
|
||||
=== Using Monodevelop ===
|
||||
|
||||
From the distribution type:
|
||||
* ./runprebuild.sh
|
||||
* type monodevelop OpenSim.sln
|
||||
|
||||
=== References ===
|
||||
|
||||
Helpful resources:
|
||||
|
||||
@@ -258,17 +258,15 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
{
|
||||
m_log.Info("[RADMIN]: Request to restart Region.");
|
||||
|
||||
CheckStringParameters(requestData, responseData, new string[] {"regionID"});
|
||||
CheckRegionParams(requestData, responseData);
|
||||
|
||||
UUID regionID = new UUID((string) requestData["regionID"]);
|
||||
Scene rebootedScene = null;
|
||||
GetSceneFromRegionParams(requestData, responseData, out rebootedScene);
|
||||
|
||||
Scene rebootedScene;
|
||||
IRestartModule restartModule = rebootedScene.RequestModuleInterface<IRestartModule>();
|
||||
|
||||
responseData["success"] = false;
|
||||
responseData["accepted"] = true;
|
||||
if (!m_application.SceneManager.TryGetScene(regionID, out rebootedScene))
|
||||
throw new Exception("region not found");
|
||||
|
||||
responseData["rebooting"] = true;
|
||||
|
||||
string message;
|
||||
@@ -277,6 +275,23 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
if (requestData.ContainsKey("alerts"))
|
||||
{
|
||||
string[] alertTimes = requestData["alerts"].ToString().Split( new char[] {','});
|
||||
if (alertTimes.Length == 1 && Convert.ToInt32(alertTimes[0]) == -1)
|
||||
{
|
||||
if (restartModule != null)
|
||||
{
|
||||
message = "Restart has been cancelled";
|
||||
|
||||
if (requestData.ContainsKey("message"))
|
||||
message = requestData["message"].ToString();
|
||||
|
||||
restartModule.AbortRestart(message);
|
||||
|
||||
responseData["success"] = true;
|
||||
responseData["rebooting"] = false;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
foreach (string a in alertTimes)
|
||||
times.Add(Convert.ToInt32(a));
|
||||
}
|
||||
@@ -309,7 +324,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
notice = false;
|
||||
}
|
||||
|
||||
IRestartModule restartModule = rebootedScene.RequestModuleInterface<IRestartModule>();
|
||||
if (restartModule != null)
|
||||
{
|
||||
restartModule.ScheduleRestart(UUID.Zero, message, times.ToArray(), notice);
|
||||
@@ -392,14 +406,15 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
// }
|
||||
|
||||
CheckStringParameters(requestData, responseData, new string[] {"filename", "regionid"});
|
||||
CheckRegionParams(requestData, responseData);
|
||||
|
||||
string file = (string) requestData["filename"];
|
||||
UUID regionID = (UUID) (string) requestData["regionid"];
|
||||
m_log.InfoFormat("[RADMIN]: Terrain Loading: {0}", file);
|
||||
Scene scene = null;
|
||||
GetSceneFromRegionParams(requestData, responseData, out scene);
|
||||
string file = (string)requestData["filename"];
|
||||
|
||||
responseData["accepted"] = true;
|
||||
|
||||
LoadHeightmap(file, regionID);
|
||||
LoadHeightmap(file, scene.RegionInfo.RegionID);
|
||||
|
||||
responseData["success"] = true;
|
||||
|
||||
@@ -416,18 +431,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
// m_log.DebugFormat("[RADMIN]: Save Terrain: XmlRpc {0}", request.ToString());
|
||||
|
||||
CheckStringParameters(requestData, responseData, new string[] { "filename", "regionid" });
|
||||
CheckRegionParams(requestData, responseData);
|
||||
|
||||
Scene region = null;
|
||||
GetSceneFromRegionParams(requestData, responseData, out region);
|
||||
|
||||
string file = (string)requestData["filename"];
|
||||
UUID regionID = (UUID)(string)requestData["regionid"];
|
||||
m_log.InfoFormat("[RADMIN]: Terrain Saving: {0}", file);
|
||||
|
||||
responseData["accepted"] = true;
|
||||
|
||||
Scene region = null;
|
||||
|
||||
if (!m_application.SceneManager.TryGetScene(regionID, out region))
|
||||
throw new Exception("1: unable to get a scene with that name");
|
||||
|
||||
ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>();
|
||||
if (null == terrainModule) throw new Exception("terrain module not available");
|
||||
|
||||
@@ -814,7 +827,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
|
||||
responseData["success"] = true;
|
||||
responseData["region_name"] = region.RegionName;
|
||||
responseData["region_uuid"] = region.RegionID.ToString();
|
||||
responseData["region_id"] = region.RegionID.ToString();
|
||||
responseData["region_uuid"] = region.RegionID.ToString(); //Deprecate July 2012
|
||||
|
||||
m_log.Info("[RADMIN]: CreateRegion: request complete");
|
||||
}
|
||||
@@ -856,16 +870,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
lock (m_requestLock)
|
||||
{
|
||||
CheckStringParameters(requestData, responseData, new string[] {"region_name"});
|
||||
CheckRegionParams(requestData, responseData);
|
||||
|
||||
Scene scene = null;
|
||||
string regionName = (string) requestData["region_name"];
|
||||
if (!m_application.SceneManager.TryGetScene(regionName, out scene))
|
||||
throw new Exception(String.Format("region \"{0}\" does not exist", regionName));
|
||||
GetSceneFromRegionParams(requestData, responseData, out scene);
|
||||
|
||||
m_application.RemoveRegion(scene, true);
|
||||
|
||||
responseData["success"] = true;
|
||||
responseData["region_name"] = regionName;
|
||||
responseData["region_name"] = scene.RegionInfo.RegionName;
|
||||
responseData["region_id"] = scene.RegionInfo.RegionID;
|
||||
|
||||
m_log.Info("[RADMIN]: DeleteRegion: request complete");
|
||||
}
|
||||
@@ -905,44 +919,21 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
|
||||
Hashtable responseData = (Hashtable)response.Value;
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
Scene scene = null;
|
||||
|
||||
lock (m_requestLock)
|
||||
{
|
||||
if (requestData.ContainsKey("region_id") &&
|
||||
!String.IsNullOrEmpty((string) requestData["region_id"]))
|
||||
{
|
||||
// Region specified by UUID
|
||||
UUID regionID = (UUID) (string) requestData["region_id"];
|
||||
if (!m_application.SceneManager.TryGetScene(regionID, out scene))
|
||||
throw new Exception(String.Format("region \"{0}\" does not exist", regionID));
|
||||
CheckRegionParams(requestData, responseData);
|
||||
|
||||
m_application.CloseRegion(scene);
|
||||
Scene scene = null;
|
||||
GetSceneFromRegionParams(requestData, responseData, out scene);
|
||||
|
||||
responseData["success"] = true;
|
||||
responseData["region_id"] = regionID;
|
||||
m_application.CloseRegion(scene);
|
||||
|
||||
response.Value = responseData;
|
||||
}
|
||||
else if (
|
||||
requestData.ContainsKey("region_name")
|
||||
&& !String.IsNullOrEmpty((string) requestData["region_name"]))
|
||||
{
|
||||
// Region specified by name
|
||||
responseData["success"] = true;
|
||||
responseData["region_name"] = scene.RegionInfo.RegionName;
|
||||
responseData["region_id"] = scene.RegionInfo.RegionID;
|
||||
|
||||
string regionName = (string) requestData["region_name"];
|
||||
if (!m_application.SceneManager.TryGetScene(regionName, out scene))
|
||||
throw new Exception(String.Format("region \"{0}\" does not exist", regionName));
|
||||
|
||||
m_application.CloseRegion(scene);
|
||||
|
||||
responseData["success"] = true;
|
||||
responseData["region_name"] = regionName;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("no region specified");
|
||||
}
|
||||
response.Value = responseData;
|
||||
|
||||
m_log.Info("[RADMIN]: CloseRegion: request complete");
|
||||
}
|
||||
@@ -989,12 +980,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
|
||||
lock (m_requestLock)
|
||||
{
|
||||
CheckStringParameters(requestData, responseData, new string[] {"region_name"});
|
||||
CheckRegionParams(requestData, responseData);
|
||||
|
||||
Scene scene = null;
|
||||
string regionName = (string) requestData["region_name"];
|
||||
if (!m_application.SceneManager.TryGetScene(regionName, out scene))
|
||||
throw new Exception(String.Format("region \"{0}\" does not exist", regionName));
|
||||
GetSceneFromRegionParams(requestData, responseData, out scene);
|
||||
|
||||
// Modify access
|
||||
scene.RegionInfo.EstateSettings.PublicAccess =
|
||||
@@ -1024,7 +1013,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
}
|
||||
|
||||
responseData["success"] = true;
|
||||
responseData["region_name"] = regionName;
|
||||
responseData["region_name"] = scene.RegionInfo.RegionName;
|
||||
responseData["region_id"] = scene.RegionInfo.RegionID;
|
||||
|
||||
m_log.Info("[RADMIN]: ModifyRegion: request complete");
|
||||
}
|
||||
@@ -1420,22 +1410,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
try
|
||||
{
|
||||
CheckStringParameters(requestData, responseData, new string[] {"filename"});
|
||||
CheckRegionParams(requestData, responseData);
|
||||
|
||||
Scene scene = null;
|
||||
GetSceneFromRegionParams(requestData, responseData, out scene);
|
||||
|
||||
string filename = (string) requestData["filename"];
|
||||
Scene scene = null;
|
||||
if (requestData.Contains("region_uuid"))
|
||||
{
|
||||
UUID region_uuid = (UUID) (string) requestData["region_uuid"];
|
||||
if (!m_application.SceneManager.TryGetScene(region_uuid, out scene))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
|
||||
}
|
||||
else if (requestData.Contains("region_name"))
|
||||
{
|
||||
string region_name = (string) requestData["region_name"];
|
||||
if (!m_application.SceneManager.TryGetScene(region_name, out scene))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_name));
|
||||
}
|
||||
else throw new Exception("neither region_name nor region_uuid given");
|
||||
|
||||
bool mergeOar = false;
|
||||
bool skipAssets = false;
|
||||
@@ -1516,22 +1496,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
try
|
||||
{
|
||||
CheckStringParameters(requestData, responseData, new string[] {"filename"});
|
||||
CheckRegionParams(requestData, responseData);
|
||||
|
||||
Scene scene = null;
|
||||
GetSceneFromRegionParams(requestData, responseData, out scene);
|
||||
|
||||
string filename = (string)requestData["filename"];
|
||||
Scene scene = null;
|
||||
if (requestData.Contains("region_uuid"))
|
||||
{
|
||||
UUID region_uuid = (UUID) (string) requestData["region_uuid"];
|
||||
if (!m_application.SceneManager.TryGetScene(region_uuid, out scene))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
|
||||
}
|
||||
else if (requestData.Contains("region_name"))
|
||||
{
|
||||
string region_name = (string) requestData["region_name"];
|
||||
if (!m_application.SceneManager.TryGetScene(region_name, out scene))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_name));
|
||||
}
|
||||
else throw new Exception("neither region_name nor region_uuid given");
|
||||
|
||||
Dictionary<string, object> options = new Dictionary<string, object>();
|
||||
|
||||
@@ -1540,9 +1510,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
// options["version"] = (string)requestData["version"];
|
||||
//}
|
||||
|
||||
if (requestData.Contains("profile"))
|
||||
if (requestData.Contains("home"))
|
||||
{
|
||||
options["profile"] = (string)requestData["profile"];
|
||||
options["home"] = (string)requestData["home"];
|
||||
}
|
||||
|
||||
if ((string)requestData["noassets"] == "true")
|
||||
@@ -1603,25 +1573,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
try
|
||||
{
|
||||
CheckStringParameters(requestData, responseData, new string[] {"filename"});
|
||||
CheckRegionParams(requestData, responseData);
|
||||
|
||||
Scene scene = null;
|
||||
GetSceneFromRegionParams(requestData, responseData, out scene);
|
||||
|
||||
string filename = (string) requestData["filename"];
|
||||
if (requestData.Contains("region_uuid"))
|
||||
{
|
||||
UUID region_uuid = (UUID) (string) requestData["region_uuid"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
|
||||
|
||||
m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString());
|
||||
}
|
||||
else if (requestData.Contains("region_name"))
|
||||
{
|
||||
string region_name = (string) requestData["region_name"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_name))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_name));
|
||||
|
||||
m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name);
|
||||
}
|
||||
else throw new Exception("neither region_name nor region_uuid given");
|
||||
|
||||
responseData["switched"] = true;
|
||||
|
||||
@@ -1669,23 +1626,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
try
|
||||
{
|
||||
CheckStringParameters(requestData, responseData, new string[] {"filename"});
|
||||
CheckRegionParams(requestData, responseData);
|
||||
|
||||
Scene scene = null;
|
||||
GetSceneFromRegionParams(requestData, responseData, out scene);
|
||||
|
||||
string filename = (string) requestData["filename"];
|
||||
if (requestData.Contains("region_uuid"))
|
||||
{
|
||||
UUID region_uuid = (UUID) (string) requestData["region_uuid"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
|
||||
m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString());
|
||||
}
|
||||
else if (requestData.Contains("region_name"))
|
||||
{
|
||||
string region_name = (string) requestData["region_name"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_name))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_name));
|
||||
m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name);
|
||||
}
|
||||
else throw new Exception("neither region_name nor region_uuid given");
|
||||
|
||||
responseData["switched"] = true;
|
||||
|
||||
@@ -1729,24 +1675,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
|
||||
responseData["success"] = true;
|
||||
|
||||
if (requestData.Contains("region_uuid"))
|
||||
{
|
||||
UUID region_uuid = (UUID) (string) requestData["region_uuid"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
|
||||
}
|
||||
else if (requestData.Contains("region_name"))
|
||||
{
|
||||
string region_name = (string) requestData["region_name"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_name))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_name));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("neither region_name nor region_uuid given");
|
||||
}
|
||||
CheckRegionParams(requestData, responseData);
|
||||
|
||||
Scene scene = m_application.SceneManager.CurrentScene;
|
||||
Scene scene = null;
|
||||
GetSceneFromRegionParams(requestData, responseData, out scene);
|
||||
|
||||
int flags;
|
||||
string text;
|
||||
@@ -1779,24 +1711,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
|
||||
responseData["success"] = true;
|
||||
|
||||
if (requestData.Contains("region_uuid"))
|
||||
{
|
||||
UUID region_uuid = (UUID) (string) requestData["region_uuid"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
|
||||
m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString());
|
||||
}
|
||||
else if (requestData.Contains("region_name"))
|
||||
{
|
||||
string region_name = (string) requestData["region_name"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_name))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_name));
|
||||
CheckRegionParams(requestData, responseData);
|
||||
|
||||
m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name);
|
||||
}
|
||||
else throw new Exception("neither region_name nor region_uuid given");
|
||||
Scene scene = null;
|
||||
GetSceneFromRegionParams(requestData, responseData, out scene);
|
||||
|
||||
Scene scene = m_application.SceneManager.CurrentScene;
|
||||
scene.RegionInfo.EstateSettings.EstateAccess = new UUID[]{};
|
||||
|
||||
if (scene.RegionInfo.Persistent)
|
||||
@@ -1812,32 +1731,17 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
Hashtable responseData = (Hashtable)response.Value;
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
|
||||
if (requestData.Contains("region_uuid"))
|
||||
{
|
||||
UUID region_uuid = (UUID) (string) requestData["region_uuid"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
|
||||
m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString());
|
||||
}
|
||||
else if (requestData.Contains("region_name"))
|
||||
{
|
||||
string region_name = (string) requestData["region_name"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_name))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_name));
|
||||
m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("neither region_name nor region_uuid given");
|
||||
}
|
||||
CheckRegionParams(requestData, responseData);
|
||||
|
||||
Scene scene = null;
|
||||
GetSceneFromRegionParams(requestData, responseData, out scene);
|
||||
|
||||
int addedUsers = 0;
|
||||
|
||||
if (requestData.Contains("users"))
|
||||
{
|
||||
UUID scopeID = m_application.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
|
||||
IUserAccountService userService = m_application.SceneManager.CurrentOrFirstScene.UserAccountService;
|
||||
Scene scene = m_application.SceneManager.CurrentScene;
|
||||
UUID scopeID = scene.RegionInfo.ScopeID;
|
||||
IUserAccountService userService = scene.UserAccountService;
|
||||
Hashtable users = (Hashtable) requestData["users"];
|
||||
List<UUID> uuids = new List<UUID>();
|
||||
foreach (string name in users.Values)
|
||||
@@ -1876,32 +1780,18 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
Hashtable responseData = (Hashtable)response.Value;
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
|
||||
responseData["success"] = true;
|
||||
CheckRegionParams(requestData, responseData);
|
||||
|
||||
if (requestData.Contains("region_uuid"))
|
||||
{
|
||||
UUID region_uuid = (UUID) (string) requestData["region_uuid"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
|
||||
m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString());
|
||||
}
|
||||
else if (requestData.Contains("region_name"))
|
||||
{
|
||||
string region_name = (string) requestData["region_name"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_name))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_name));
|
||||
m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name);
|
||||
}
|
||||
else throw new Exception("neither region_name nor region_uuid given");
|
||||
Scene scene = null;
|
||||
GetSceneFromRegionParams(requestData, responseData, out scene);
|
||||
|
||||
int removedUsers = 0;
|
||||
|
||||
if (requestData.Contains("users"))
|
||||
{
|
||||
UUID scopeID = m_application.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
|
||||
IUserAccountService userService = m_application.SceneManager.CurrentOrFirstScene.UserAccountService;
|
||||
UUID scopeID = scene.RegionInfo.ScopeID;
|
||||
IUserAccountService userService = scene.UserAccountService;
|
||||
//UserProfileCacheService ups = m_application.CommunicationsManager.UserProfileCacheService;
|
||||
Scene scene = m_application.SceneManager.CurrentScene;
|
||||
Hashtable users = (Hashtable) requestData["users"];
|
||||
List<UUID> uuids = new List<UUID>();
|
||||
foreach (string name in users.Values)
|
||||
@@ -1928,6 +1818,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
}
|
||||
|
||||
responseData["removed"] = removedUsers;
|
||||
responseData["success"] = true;
|
||||
|
||||
m_log.Info("[RADMIN]: Access List Remove Request complete");
|
||||
}
|
||||
@@ -1939,32 +1830,18 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
Hashtable responseData = (Hashtable)response.Value;
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
|
||||
responseData["success"] = true;
|
||||
CheckRegionParams(requestData, responseData);
|
||||
|
||||
if (requestData.Contains("region_uuid"))
|
||||
{
|
||||
UUID region_uuid = (UUID) (string) requestData["region_uuid"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
|
||||
m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString());
|
||||
}
|
||||
else if (requestData.Contains("region_name"))
|
||||
{
|
||||
string region_name = (string) requestData["region_name"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_name))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_name));
|
||||
m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name);
|
||||
}
|
||||
else throw new Exception("neither region_name nor region_uuid given");
|
||||
Scene scene = null;
|
||||
GetSceneFromRegionParams(requestData, responseData, out scene);
|
||||
|
||||
Scene scene = m_application.SceneManager.CurrentScene;
|
||||
UUID[] accessControlList = scene.RegionInfo.EstateSettings.EstateAccess;
|
||||
Hashtable users = new Hashtable();
|
||||
|
||||
foreach (UUID user in accessControlList)
|
||||
{
|
||||
UUID scopeID = m_application.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
|
||||
UserAccount account = m_application.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, user);
|
||||
UUID scopeID = scene.RegionInfo.ScopeID;
|
||||
UserAccount account = scene.UserAccountService.GetUserAccount(scopeID, user);
|
||||
if (account != null)
|
||||
{
|
||||
users[user.ToString()] = account.FirstName + " " + account.LastName;
|
||||
@@ -1972,6 +1849,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
}
|
||||
|
||||
responseData["users"] = users;
|
||||
responseData["success"] = true;
|
||||
|
||||
m_log.Info("[RADMIN]: Access List List Request complete");
|
||||
}
|
||||
@@ -2089,6 +1967,126 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckRegionParams(Hashtable requestData, Hashtable responseData)
|
||||
{
|
||||
//Checks if region parameters exist and gives exeption if no parameters are given
|
||||
if ((requestData.ContainsKey("region_id") && !String.IsNullOrEmpty((string)requestData["region_id"])) ||
|
||||
(requestData.ContainsKey("region_name") && !String.IsNullOrEmpty((string)requestData["region_name"])))
|
||||
{
|
||||
return;
|
||||
}
|
||||
#region Deprecate July 2012
|
||||
//region_ID, regionid, region_uuid will be deprecated in July 2012!!!!!!
|
||||
else if (requestData.ContainsKey("regionid") &&
|
||||
!String.IsNullOrEmpty((string)requestData["regionid"]))
|
||||
{
|
||||
m_log.WarnFormat("[RADMIN]: Use of parameter regionid will be deprecated as of July 2012. Use region_id instead");
|
||||
}
|
||||
else if (requestData.ContainsKey("region_ID") &&
|
||||
!String.IsNullOrEmpty((string)requestData["region_ID"]))
|
||||
{
|
||||
m_log.WarnFormat("[RADMIN]: Use of parameter region_ID will be deprecated as of July 2012. Use region_id instead");
|
||||
}
|
||||
else if (requestData.ContainsKey("regionID") &&
|
||||
!String.IsNullOrEmpty((string)requestData["regionID"]))
|
||||
{
|
||||
m_log.WarnFormat("[RADMIN]: Use of parameter regionID will be deprecated as of July 2012. Use region_id instead");
|
||||
}
|
||||
else if (requestData.ContainsKey("region_uuid") &&
|
||||
!String.IsNullOrEmpty((string)requestData["region_uuid"]))
|
||||
{
|
||||
m_log.WarnFormat("[RADMIN]: Use of parameter region_uuid will be deprecated as of July 2012. Use region_id instead");
|
||||
}
|
||||
#endregion
|
||||
else
|
||||
{
|
||||
responseData["accepted"] = false;
|
||||
throw new Exception("no region_name or region_id given");
|
||||
}
|
||||
}
|
||||
|
||||
private void GetSceneFromRegionParams(Hashtable requestData, Hashtable responseData, out Scene scene)
|
||||
{
|
||||
scene = null;
|
||||
|
||||
if (requestData.ContainsKey("region_id") &&
|
||||
!String.IsNullOrEmpty((string)requestData["region_id"]))
|
||||
{
|
||||
UUID regionID = (UUID)(string)requestData["region_id"];
|
||||
if (!m_application.SceneManager.TryGetScene(regionID, out scene))
|
||||
{
|
||||
responseData["error"] = String.Format("Region ID {0} not found", regionID);
|
||||
throw new Exception(String.Format("Region ID {0} not found", regionID));
|
||||
}
|
||||
}
|
||||
#region Deprecate July 2012
|
||||
else if (requestData.ContainsKey("regionid") &&
|
||||
!String.IsNullOrEmpty((string)requestData["regionid"]))
|
||||
{
|
||||
m_log.WarnFormat("[RADMIN]: Use of parameter regionid will be deprecated as of July 2012. Use region_id instead");
|
||||
|
||||
UUID regionID = (UUID)(string)requestData["regionid"];
|
||||
if (!m_application.SceneManager.TryGetScene(regionID, out scene))
|
||||
{
|
||||
responseData["error"] = String.Format("Region ID {0} not found", regionID);
|
||||
throw new Exception(String.Format("Region ID {0} not found", regionID));
|
||||
}
|
||||
}
|
||||
else if (requestData.ContainsKey("region_ID") &&
|
||||
!String.IsNullOrEmpty((string)requestData["region_ID"]))
|
||||
{
|
||||
m_log.WarnFormat("[RADMIN]: Use of parameter region_ID will be deprecated as of July 2012. Use region_id instead");
|
||||
|
||||
UUID regionID = (UUID)(string)requestData["region_ID"];
|
||||
if (!m_application.SceneManager.TryGetScene(regionID, out scene))
|
||||
{
|
||||
responseData["error"] = String.Format("Region ID {0} not found", regionID);
|
||||
throw new Exception(String.Format("Region ID {0} not found", regionID));
|
||||
}
|
||||
}
|
||||
else if (requestData.ContainsKey("regionID") &&
|
||||
!String.IsNullOrEmpty((string)requestData["regionID"]))
|
||||
{
|
||||
m_log.WarnFormat("[RADMIN]: Use of parameter regionID will be deprecated as of July 2012. Use region_id instead");
|
||||
|
||||
UUID regionID = (UUID)(string)requestData["regionID"];
|
||||
if (!m_application.SceneManager.TryGetScene(regionID, out scene))
|
||||
{
|
||||
responseData["error"] = String.Format("Region ID {0} not found", regionID);
|
||||
throw new Exception(String.Format("Region ID {0} not found", regionID));
|
||||
}
|
||||
}
|
||||
else if (requestData.ContainsKey("region_uuid") &&
|
||||
!String.IsNullOrEmpty((string)requestData["region_uuid"]))
|
||||
{
|
||||
m_log.WarnFormat("[RADMIN]: Use of parameter region_uuid will be deprecated as of July 2012. Use region_id instead");
|
||||
|
||||
UUID regionID = (UUID)(string)requestData["region_uuid"];
|
||||
if (!m_application.SceneManager.TryGetScene(regionID, out scene))
|
||||
{
|
||||
responseData["error"] = String.Format("Region ID {0} not found", regionID);
|
||||
throw new Exception(String.Format("Region ID {0} not found", regionID));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
else if (requestData.ContainsKey("region_name") &&
|
||||
!String.IsNullOrEmpty((string)requestData["region_name"]))
|
||||
{
|
||||
string regionName = (string)requestData["region_name"];
|
||||
if (!m_application.SceneManager.TryGetScene(regionName, out scene))
|
||||
{
|
||||
responseData["error"] = String.Format("Region {0} not found", regionName);
|
||||
throw new Exception(String.Format("Region {0} not found", regionName));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
responseData["error"] = "no region_name or region_id given";
|
||||
throw new Exception("no region_name or region_id given");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
private bool GetBoolean(Hashtable requestData, string tag, bool defaultValue)
|
||||
{
|
||||
// If an access value has been provided, apply it.
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
* 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
using OSDArray = OpenMetaverse.StructuredData.OSDArray;
|
||||
using OSDMap = OpenMetaverse.StructuredData.OSDMap;
|
||||
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
public class FetchInventory2Handler
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IInventoryService m_inventoryService;
|
||||
|
||||
public FetchInventory2Handler(IInventoryService invService)
|
||||
{
|
||||
m_inventoryService = invService;
|
||||
}
|
||||
|
||||
public string FetchInventoryRequest(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
// m_log.DebugFormat("[FETCH INVENTORY HANDLER]: Received FetchInventory capabilty request");
|
||||
|
||||
OSDMap requestmap = (OSDMap)OSDParser.DeserializeLLSDXml(Utils.StringToBytes(request));
|
||||
OSDArray itemsRequested = (OSDArray)requestmap["items"];
|
||||
|
||||
string reply;
|
||||
LLSDFetchInventory llsdReply = new LLSDFetchInventory();
|
||||
|
||||
foreach (OSDMap osdItemId in itemsRequested)
|
||||
{
|
||||
UUID itemId = osdItemId["item_id"].AsUUID();
|
||||
|
||||
InventoryItemBase item = m_inventoryService.GetItem(new InventoryItemBase(itemId));
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
// We don't know the agent that this request belongs to so we'll use the agent id of the item
|
||||
// which will be the same for all items.
|
||||
llsdReply.agent_id = item.Owner;
|
||||
|
||||
llsdReply.items.Array.Add(ConvertInventoryItem(item));
|
||||
}
|
||||
}
|
||||
|
||||
reply = LLSDHelpers.SerialiseLLSDReply(llsdReply);
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert an internal inventory item object into an LLSD object.
|
||||
/// </summary>
|
||||
/// <param name="invItem"></param>
|
||||
/// <returns></returns>
|
||||
private LLSDInventoryItem ConvertInventoryItem(InventoryItemBase invItem)
|
||||
{
|
||||
LLSDInventoryItem llsdItem = new LLSDInventoryItem();
|
||||
llsdItem.asset_id = invItem.AssetID;
|
||||
llsdItem.created_at = invItem.CreationDate;
|
||||
llsdItem.desc = invItem.Description;
|
||||
llsdItem.flags = (int)invItem.Flags;
|
||||
llsdItem.item_id = invItem.ID;
|
||||
llsdItem.name = invItem.Name;
|
||||
llsdItem.parent_id = invItem.Folder;
|
||||
|
||||
try
|
||||
{
|
||||
llsdItem.type = Utils.AssetTypeToString((AssetType)invItem.AssetType);
|
||||
llsdItem.inv_type = Utils.InventoryTypeToString((InventoryType)invItem.InvType);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[WEB FETCH INV DESC HANDLER]: Problem setting asset {0} inventory {1} types while converting inventory item {2}: {3}",
|
||||
invItem.AssetType, invItem.InvType, invItem.Name, e.Message);
|
||||
}
|
||||
|
||||
llsdItem.permissions = new LLSDPermissions();
|
||||
llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid;
|
||||
llsdItem.permissions.base_mask = (int)invItem.CurrentPermissions;
|
||||
llsdItem.permissions.everyone_mask = (int)invItem.EveryOnePermissions;
|
||||
llsdItem.permissions.group_id = invItem.GroupID;
|
||||
llsdItem.permissions.group_mask = (int)invItem.GroupPermissions;
|
||||
llsdItem.permissions.is_owner_group = invItem.GroupOwned;
|
||||
llsdItem.permissions.next_owner_mask = (int)invItem.NextPermissions;
|
||||
llsdItem.permissions.owner_id = invItem.Owner;
|
||||
llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions;
|
||||
llsdItem.sale_info = new LLSDSaleInfo();
|
||||
llsdItem.sale_info.sale_price = invItem.SalePrice;
|
||||
switch (invItem.SaleType)
|
||||
{
|
||||
default:
|
||||
llsdItem.sale_info.sale_type = "not";
|
||||
break;
|
||||
case 1:
|
||||
llsdItem.sale_info.sale_type = "original";
|
||||
break;
|
||||
case 2:
|
||||
llsdItem.sale_info.sale_type = "copy";
|
||||
break;
|
||||
case 3:
|
||||
llsdItem.sale_info.sale_type = "contents";
|
||||
break;
|
||||
}
|
||||
|
||||
return llsdItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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 Nini.Config;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
public class FetchInventory2ServerConnector : ServiceConnector
|
||||
{
|
||||
private IInventoryService m_InventoryService;
|
||||
private string m_ConfigName = "CapsService";
|
||||
|
||||
public FetchInventory2ServerConnector(IConfigSource config, IHttpServer server, string configName)
|
||||
: base(config, server, configName)
|
||||
{
|
||||
if (configName != String.Empty)
|
||||
m_ConfigName = configName;
|
||||
|
||||
IConfig serverConfig = config.Configs[m_ConfigName];
|
||||
if (serverConfig == null)
|
||||
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
|
||||
|
||||
string invService = serverConfig.GetString("InventoryService", String.Empty);
|
||||
|
||||
if (invService == String.Empty)
|
||||
throw new Exception("No InventoryService in config file");
|
||||
|
||||
Object[] args = new Object[] { config };
|
||||
m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args);
|
||||
|
||||
if (m_InventoryService == null)
|
||||
throw new Exception(String.Format("Failed to load InventoryService from {0}; config is {1}", invService, m_ConfigName));
|
||||
|
||||
FetchInventory2Handler fiHandler = new FetchInventory2Handler(m_InventoryService);
|
||||
IRequestHandler reqHandler
|
||||
= new RestStreamHandler("POST", "/CAPS/FetchInventory/", fiHandler.FetchInventoryRequest);
|
||||
server.AddStreamHandler(reqHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -245,7 +245,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
// containingFolder.Name, containingFolder.ID, agentID);
|
||||
|
||||
version = containingFolder.Version;
|
||||
//
|
||||
|
||||
// if (fetchItems)
|
||||
// {
|
||||
// List<InventoryItemBase> linkedItemsToAdd = new List<InventoryItemBase>();
|
||||
|
||||
@@ -95,4 +95,11 @@ namespace OpenSim.Framework.Capabilities
|
||||
public UUID owner_id;
|
||||
public int version;
|
||||
}
|
||||
}
|
||||
|
||||
[OSDMap]
|
||||
public class LLSDFetchInventory
|
||||
{
|
||||
public UUID agent_id;
|
||||
public OSDArray items = new OSDArray();
|
||||
}
|
||||
}
|
||||
@@ -681,7 +681,7 @@ VALUES
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
conn.Open();
|
||||
foreach (ParcelManager.ParcelAccessEntry parcelAccessEntry in parcel.LandData.ParcelAccessList)
|
||||
foreach (LandAccessEntry parcelAccessEntry in parcel.LandData.ParcelAccessList)
|
||||
{
|
||||
cmd.Parameters.AddRange(CreateLandAccessParameters(parcelAccessEntry, parcel.RegionUUID));
|
||||
|
||||
@@ -1252,7 +1252,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 , [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
|
||||
WHERE [regionUUID] = @regionUUID";
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
@@ -1307,14 +1307,14 @@ VALUES
|
||||
[block_show_in_search],[agent_limit],[object_bonus],[maturity],[disable_scripts],[disable_collisions],[disable_physics],
|
||||
[terrain_texture_1],[terrain_texture_2],[terrain_texture_3],[terrain_texture_4],[elevation_1_nw],[elevation_2_nw],[elevation_1_ne],
|
||||
[elevation_2_ne],[elevation_1_se],[elevation_2_se],[elevation_1_sw],[elevation_2_sw],[water_height],[terrain_raise_limit],
|
||||
[terrain_lower_limit],[use_estate_sun],[fixed_sun],[sun_position],[covenant],[sunvectorx], [sunvectory], [sunvectorz],[Sandbox], [loaded_creation_datetime], [loaded_creation_id]
|
||||
[terrain_lower_limit],[use_estate_sun],[fixed_sun],[sun_position],[covenant],[covenant_datetime],[sunvectorx], [sunvectory], [sunvectorz],[Sandbox], [loaded_creation_datetime], [loaded_creation_id]
|
||||
)
|
||||
VALUES
|
||||
(@regionUUID,@block_terraform,@block_fly,@allow_damage,@restrict_pushing,@allow_land_resell,@allow_land_join_divide,
|
||||
@block_show_in_search,@agent_limit,@object_bonus,@maturity,@disable_scripts,@disable_collisions,@disable_physics,
|
||||
@terrain_texture_1,@terrain_texture_2,@terrain_texture_3,@terrain_texture_4,@elevation_1_nw,@elevation_2_nw,@elevation_1_ne,
|
||||
@elevation_2_ne,@elevation_1_se,@elevation_2_se,@elevation_1_sw,@elevation_2_sw,@water_height,@terrain_raise_limit,
|
||||
@terrain_lower_limit,@use_estate_sun,@fixed_sun,@sun_position,@covenant,@sunvectorx,@sunvectory, @sunvectorz, @Sandbox, @loaded_creation_datetime, @loaded_creation_id)";
|
||||
@terrain_lower_limit,@use_estate_sun,@fixed_sun,@sun_position,@covenant, @covenant_datetime, @sunvectorx,@sunvectory, @sunvectorz, @Sandbox, @loaded_creation_datetime, @loaded_creation_id)";
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
@@ -1376,7 +1376,7 @@ VALUES
|
||||
Convert.ToSingle(row["sunvectorz"])
|
||||
);
|
||||
newSettings.Covenant = new UUID((Guid)row["covenant"]);
|
||||
|
||||
newSettings.CovenantChangedDateTime = Convert.ToInt32(row["covenant_datetime"]);
|
||||
newSettings.LoadedCreationDateTime = Convert.ToInt32(row["loaded_creation_datetime"]);
|
||||
|
||||
if (row["loaded_creation_id"] is DBNull)
|
||||
@@ -1453,7 +1453,7 @@ VALUES
|
||||
_Log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name);
|
||||
}
|
||||
|
||||
newData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>();
|
||||
newData.ParcelAccessList = new List<LandAccessEntry>();
|
||||
|
||||
return newData;
|
||||
}
|
||||
@@ -1463,12 +1463,12 @@ VALUES
|
||||
/// </summary>
|
||||
/// <param name="row">datarecord with landaccess data</param>
|
||||
/// <returns></returns>
|
||||
private static ParcelManager.ParcelAccessEntry BuildLandAccessData(IDataRecord row)
|
||||
private static LandAccessEntry BuildLandAccessData(IDataRecord row)
|
||||
{
|
||||
ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
|
||||
LandAccessEntry entry = new LandAccessEntry();
|
||||
entry.AgentID = new UUID((Guid)row["AccessUUID"]);
|
||||
entry.Flags = (AccessList)Convert.ToInt32(row["Flags"]);
|
||||
entry.Time = new DateTime();
|
||||
entry.Expires = 0;
|
||||
return entry;
|
||||
}
|
||||
|
||||
@@ -1789,6 +1789,7 @@ VALUES
|
||||
parameters.Add(_Database.CreateParameter("sunvectory", settings.SunVector.Y));
|
||||
parameters.Add(_Database.CreateParameter("sunvectorz", settings.SunVector.Z));
|
||||
parameters.Add(_Database.CreateParameter("covenant", settings.Covenant));
|
||||
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));
|
||||
|
||||
@@ -1851,7 +1852,7 @@ VALUES
|
||||
/// <param name="parcelAccessEntry">parcel access entry.</param>
|
||||
/// <param name="parcelID">parcel ID.</param>
|
||||
/// <returns></returns>
|
||||
private SqlParameter[] CreateLandAccessParameters(ParcelManager.ParcelAccessEntry parcelAccessEntry, UUID parcelID)
|
||||
private SqlParameter[] CreateLandAccessParameters(LandAccessEntry parcelAccessEntry, UUID parcelID)
|
||||
{
|
||||
List<SqlParameter> parameters = new List<SqlParameter>();
|
||||
|
||||
|
||||
@@ -1043,3 +1043,11 @@ FOR CreatorID
|
||||
ALTER TABLE primitems ALTER COLUMN CreatorID uniqueidentifier NOT NULL
|
||||
|
||||
COMMIT
|
||||
|
||||
:VERSION 29 #---------------------
|
||||
|
||||
BEGIN TRANSACTION
|
||||
|
||||
ALTER TABLE regionsettings ADD covenant_datetime int NOT NULL default 0
|
||||
|
||||
COMMIT
|
||||
|
||||
@@ -210,7 +210,6 @@ namespace OpenSim.Data.MySQL
|
||||
}
|
||||
|
||||
LoadBanList(es);
|
||||
|
||||
es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers");
|
||||
es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users");
|
||||
es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups");
|
||||
|
||||
@@ -173,6 +173,11 @@ namespace OpenSim.Data.MySQL
|
||||
int v = Convert.ToInt32(reader[name]);
|
||||
m_Fields[name].SetValue(row, v);
|
||||
}
|
||||
else if (m_Fields[name].FieldType == typeof(uint))
|
||||
{
|
||||
uint v = Convert.ToUInt32(reader[name]);
|
||||
m_Fields[name].SetValue(row, v);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Fields[name].SetValue(row, reader[name]);
|
||||
@@ -294,4 +299,4 @@ namespace OpenSim.Data.MySQL
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -715,10 +715,10 @@ namespace OpenSim.Data.MySQL
|
||||
|
||||
cmd.Parameters.Clear();
|
||||
cmd.CommandText = "insert into landaccesslist (LandUUID, " +
|
||||
"AccessUUID, Flags) values (?LandUUID, ?AccessUUID, " +
|
||||
"?Flags)";
|
||||
"AccessUUID, Flags, Expires) values (?LandUUID, ?AccessUUID, " +
|
||||
"?Flags, ?Expires)";
|
||||
|
||||
foreach (ParcelManager.ParcelAccessEntry entry in parcel.LandData.ParcelAccessList)
|
||||
foreach (LandAccessEntry entry in parcel.LandData.ParcelAccessList)
|
||||
{
|
||||
FillLandAccessCommand(cmd, entry, parcel.LandData.GlobalID);
|
||||
ExecuteNonQuery(cmd);
|
||||
@@ -861,6 +861,8 @@ namespace OpenSim.Data.MySQL
|
||||
}
|
||||
}
|
||||
|
||||
LoadSpawnPoints(rs);
|
||||
|
||||
return rs;
|
||||
}
|
||||
|
||||
@@ -1007,9 +1009,11 @@ namespace OpenSim.Data.MySQL
|
||||
"elevation_2_sw, water_height, " +
|
||||
"terrain_raise_limit, terrain_lower_limit, " +
|
||||
"use_estate_sun, fixed_sun, sun_position, " +
|
||||
"covenant, Sandbox, sunvectorx, sunvectory, " +
|
||||
"covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " +
|
||||
"sunvectorz, loaded_creation_datetime, " +
|
||||
"loaded_creation_id, map_tile_ID, block_search, casino) values (?RegionUUID, ?BlockTerraform, " +
|
||||
"loaded_creation_id, map_tile_ID, block_search, casino, " +
|
||||
"TelehubObject, parcel_tile_ID) " +
|
||||
"values (?RegionUUID, ?BlockTerraform, " +
|
||||
"?BlockFly, ?AllowDamage, ?RestrictPushing, " +
|
||||
"?AllowLandResell, ?AllowLandJoinDivide, " +
|
||||
"?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " +
|
||||
@@ -1021,10 +1025,11 @@ namespace OpenSim.Data.MySQL
|
||||
"?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " +
|
||||
"?WaterHeight, ?TerrainRaiseLimit, " +
|
||||
"?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " +
|
||||
"?SunPosition, ?Covenant, ?Sandbox, " +
|
||||
"?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " +
|
||||
"?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
|
||||
"?LoadedCreationDateTime, ?LoadedCreationID, " +
|
||||
"?TerrainImageID, ?block_search, ?casino)";
|
||||
"?TerrainImageID, ?block_search, ?casino, " +
|
||||
"?TelehubObject, ?ParcelImageID)";
|
||||
|
||||
FillRegionSettingsCommand(cmd, rs);
|
||||
|
||||
@@ -1032,6 +1037,7 @@ namespace OpenSim.Data.MySQL
|
||||
}
|
||||
}
|
||||
}
|
||||
SaveSpawnPoints(rs);
|
||||
}
|
||||
|
||||
public virtual List<LandData> LoadLandObjects(UUID regionUUID)
|
||||
@@ -1302,7 +1308,7 @@ namespace OpenSim.Data.MySQL
|
||||
newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]);
|
||||
newSettings.SunPosition = Convert.ToDouble(row["sun_position"]);
|
||||
newSettings.Covenant = DBGuid.FromDB(row["covenant"]);
|
||||
|
||||
newSettings.CovenantChangedDateTime = Convert.ToInt32(row["covenant_datetime"]);
|
||||
newSettings.LoadedCreationDateTime = Convert.ToInt32(row["loaded_creation_datetime"]);
|
||||
|
||||
if (row["loaded_creation_id"] is DBNull)
|
||||
@@ -1311,6 +1317,8 @@ namespace OpenSim.Data.MySQL
|
||||
newSettings.LoadedCreationID = (String) row["loaded_creation_id"];
|
||||
|
||||
newSettings.TerrainImageID = DBGuid.FromDB(row["map_tile_ID"]);
|
||||
newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]);
|
||||
newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]);
|
||||
|
||||
newSettings.GodBlockSearch = Convert.ToBoolean(row["block_search"]);
|
||||
newSettings.Casino = Convert.ToBoolean(row["casino"]);
|
||||
@@ -1388,7 +1396,7 @@ namespace OpenSim.Data.MySQL
|
||||
newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
|
||||
newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
|
||||
|
||||
newData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>();
|
||||
newData.ParcelAccessList = new List<LandAccessEntry>();
|
||||
|
||||
return newData;
|
||||
}
|
||||
@@ -1398,12 +1406,12 @@ namespace OpenSim.Data.MySQL
|
||||
/// </summary>
|
||||
/// <param name="row"></param>
|
||||
/// <returns></returns>
|
||||
private static ParcelManager.ParcelAccessEntry BuildLandAccessData(IDataReader row)
|
||||
private static LandAccessEntry BuildLandAccessData(IDataReader row)
|
||||
{
|
||||
ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
|
||||
LandAccessEntry entry = new LandAccessEntry();
|
||||
entry.AgentID = DBGuid.FromDB(row["AccessUUID"]);
|
||||
entry.Flags = (AccessList) Convert.ToInt32(row["Flags"]);
|
||||
entry.Time = new DateTime();
|
||||
entry.Expires = Convert.ToInt32(row["Expires"]);
|
||||
return entry;
|
||||
}
|
||||
|
||||
@@ -1645,12 +1653,15 @@ namespace OpenSim.Data.MySQL
|
||||
cmd.Parameters.AddWithValue("FixedSun", settings.FixedSun);
|
||||
cmd.Parameters.AddWithValue("SunPosition", settings.SunPosition);
|
||||
cmd.Parameters.AddWithValue("Covenant", settings.Covenant.ToString());
|
||||
cmd.Parameters.AddWithValue("CovenantChangedDateTime", settings.CovenantChangedDateTime);
|
||||
cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime);
|
||||
cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID);
|
||||
cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID);
|
||||
cmd.Parameters.AddWithValue("block_search", settings.GodBlockSearch);
|
||||
cmd.Parameters.AddWithValue("casino", settings.Casino);
|
||||
|
||||
cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID);
|
||||
cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1713,11 +1724,12 @@ namespace OpenSim.Data.MySQL
|
||||
/// <param name="row"></param>
|
||||
/// <param name="entry"></param>
|
||||
/// <param name="parcelID"></param>
|
||||
private static void FillLandAccessCommand(MySqlCommand cmd, ParcelManager.ParcelAccessEntry entry, UUID parcelID)
|
||||
private static void FillLandAccessCommand(MySqlCommand cmd, LandAccessEntry entry, UUID parcelID)
|
||||
{
|
||||
cmd.Parameters.AddWithValue("LandUUID", parcelID.ToString());
|
||||
cmd.Parameters.AddWithValue("AccessUUID", entry.AgentID.ToString());
|
||||
cmd.Parameters.AddWithValue("Flags", entry.Flags);
|
||||
cmd.Parameters.AddWithValue("Expires", entry.Expires.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1852,5 +1864,72 @@ namespace OpenSim.Data.MySQL
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadSpawnPoints(RegionSettings rs)
|
||||
{
|
||||
rs.ClearSpawnPoints();
|
||||
|
||||
lock (m_dbLock)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "select Yaw, Pitch, Distance from spawn_points where RegionID = ?RegionID";
|
||||
cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString());
|
||||
|
||||
using (IDataReader r = cmd.ExecuteReader())
|
||||
{
|
||||
while (r.Read())
|
||||
{
|
||||
SpawnPoint sp = new SpawnPoint();
|
||||
|
||||
sp.Yaw = (float)r["Yaw"];
|
||||
sp.Pitch = (float)r["Pitch"];
|
||||
sp.Distance = (float)r["Distance"];
|
||||
|
||||
rs.AddSpawnPoint(sp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveSpawnPoints(RegionSettings rs)
|
||||
{
|
||||
lock (m_dbLock)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "delete from spawn_points where RegionID = ?RegionID";
|
||||
cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString());
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
cmd.Parameters.Clear();
|
||||
|
||||
cmd.CommandText = "insert into spawn_points (RegionID, Yaw, Pitch, Distance) values ( ?RegionID, ?Yaw, ?Pitch, ?Distance)";
|
||||
|
||||
foreach (SpawnPoint p in rs.SpawnPoints())
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString());
|
||||
cmd.Parameters.AddWithValue("?Yaw", p.Yaw);
|
||||
cmd.Parameters.AddWithValue("?Pitch", p.Pitch);
|
||||
cmd.Parameters.AddWithValue("?Distance", p.Distance);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
cmd.Parameters.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,3 +94,12 @@ BEGIN;
|
||||
alter table regions modify column regionName varchar(128) default NULL;
|
||||
|
||||
COMMIT;
|
||||
|
||||
:VERSION 9 # ------------
|
||||
|
||||
BEGIN;
|
||||
|
||||
alter table regions add column `parcelMapTexture` varchar(36) default NULL;
|
||||
|
||||
COMMIT;
|
||||
|
||||
|
||||
@@ -841,4 +841,45 @@ alter table regionban ENGINE = MyISAM;
|
||||
alter table regionsettings ENGINE = MyISAM;
|
||||
alter table terrain ENGINE = MyISAM;
|
||||
|
||||
COMMIT;
|
||||
COMMIT;
|
||||
|
||||
:VERSION 39 #--------------- Telehub support
|
||||
|
||||
BEGIN;
|
||||
CREATE TABLE IF NOT EXISTS `spawn_points` (
|
||||
`RegionID` varchar(36) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`Yaw` float NOT NULL,
|
||||
`Pitch` float NOT NULL,
|
||||
`Distance` float NOT NULL,
|
||||
KEY `RegionID` (`RegionID`)
|
||||
) ENGINE=Innodb;
|
||||
|
||||
ALTER TABLE `regionsettings` ADD COLUMN `TelehubObject` varchar(36) NOT NULL;
|
||||
COMMIT;
|
||||
|
||||
:VERSION 40 #---------------- Parcels for sale
|
||||
|
||||
BEGIN;
|
||||
ALTER TABLE `regionsettings` ADD COLUMN `parcel_tile_ID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
|
||||
COMMIT;
|
||||
|
||||
:VERSION 41 #---------------- Timed bans/access
|
||||
|
||||
BEGIN;
|
||||
ALTER TABLE `landaccesslist` ADD COLUMN `Expires` INTEGER NOT NULL DEFAULT 0;
|
||||
COMMIT;
|
||||
|
||||
:VERSION 42 #--------------------- Region Covenant changed time
|
||||
|
||||
BEGIN;
|
||||
ALTER TABLE regionsettings ADD COLUMN covenant_datetime int unsigned NOT NULL DEFAULT '0';
|
||||
COMMIT;
|
||||
|
||||
:VERSION 43 #---------------------
|
||||
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE `regionsettings` MODIFY COLUMN `TelehubObject` VARCHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
|
||||
|
||||
COMMIT;
|
||||
|
||||
|
||||
@@ -466,4 +466,9 @@ ALTER TABLE `land` ADD COLUMN `MediaSize` VARCHAR(16) NOT NULL DEFAULT '0,0';
|
||||
ALTER TABLE `land` ADD COLUMN `MediaLoop` BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
ALTER TABLE `land` ADD COLUMN `ObscureMusic` BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
ALTER TABLE `land` ADD COLUMN `ObscureMedia` BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
COMMIT;
|
||||
COMMIT;
|
||||
|
||||
:VERSION 22
|
||||
BEGIN;
|
||||
ALTER TABLE regionsettings ADD COLUMN covenant_datetime INTEGER NOT NULL default 0;
|
||||
COMMIT;
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace OpenSim.Data.SQLite
|
||||
cmd.Parameters.AddWithValue(":PrincipalID", principalID.ToString());
|
||||
cmd.Parameters.AddWithValue(":Friend", friend);
|
||||
|
||||
ExecuteNonQuery(cmd, cmd.Connection);
|
||||
ExecuteNonQuery(cmd, m_Connection);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -759,7 +759,7 @@ namespace OpenSim.Data.SQLite
|
||||
landaccesslist.Rows.Remove(rowsToDelete[iter]);
|
||||
}
|
||||
rowsToDelete.Clear();
|
||||
foreach (ParcelManager.ParcelAccessEntry entry in parcel.LandData.ParcelAccessList)
|
||||
foreach (LandAccessEntry entry in parcel.LandData.ParcelAccessList)
|
||||
{
|
||||
DataRow newAccessRow = landaccesslist.NewRow();
|
||||
fillLandAccessRow(newAccessRow, entry, parcel.LandData.GlobalID);
|
||||
@@ -1185,6 +1185,7 @@ namespace OpenSim.Data.SQLite
|
||||
createCol(regionsettings, "fixed_sun", typeof (Int32));
|
||||
createCol(regionsettings, "sun_position", typeof (Double));
|
||||
createCol(regionsettings, "covenant", typeof(String));
|
||||
createCol(regionsettings, "covenant_datetime", typeof(Int32));
|
||||
createCol(regionsettings, "map_tile_ID", typeof(String));
|
||||
regionsettings.PrimaryKey = new DataColumn[] { regionsettings.Columns["regionUUID"] };
|
||||
return regionsettings;
|
||||
@@ -1456,7 +1457,7 @@ namespace OpenSim.Data.SQLite
|
||||
newData.UserLocation = Vector3.Zero;
|
||||
newData.UserLookAt = Vector3.Zero;
|
||||
}
|
||||
newData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>();
|
||||
newData.ParcelAccessList = new List<LandAccessEntry>();
|
||||
UUID authBuyerID = UUID.Zero;
|
||||
|
||||
UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID);
|
||||
@@ -1509,6 +1510,7 @@ namespace OpenSim.Data.SQLite
|
||||
newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]);
|
||||
newSettings.SunPosition = Convert.ToDouble(row["sun_position"]);
|
||||
newSettings.Covenant = new UUID((String) row["covenant"]);
|
||||
newSettings.CovenantChangedDateTime = Convert.ToInt32(row["covenant_datetime"]);
|
||||
newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]);
|
||||
|
||||
return newSettings;
|
||||
@@ -1519,12 +1521,12 @@ namespace OpenSim.Data.SQLite
|
||||
/// </summary>
|
||||
/// <param name="row"></param>
|
||||
/// <returns></returns>
|
||||
private static ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row)
|
||||
private static LandAccessEntry buildLandAccessData(DataRow row)
|
||||
{
|
||||
ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
|
||||
LandAccessEntry entry = new LandAccessEntry();
|
||||
entry.AgentID = new UUID((string) row["AccessUUID"]);
|
||||
entry.Flags = (AccessList) row["Flags"];
|
||||
entry.Time = new DateTime();
|
||||
entry.Expires = 0;
|
||||
return entry;
|
||||
}
|
||||
|
||||
@@ -1787,7 +1789,7 @@ namespace OpenSim.Data.SQLite
|
||||
/// <param name="row"></param>
|
||||
/// <param name="entry"></param>
|
||||
/// <param name="parcelID"></param>
|
||||
private static void fillLandAccessRow(DataRow row, ParcelManager.ParcelAccessEntry entry, UUID parcelID)
|
||||
private static void fillLandAccessRow(DataRow row, LandAccessEntry entry, UUID parcelID)
|
||||
{
|
||||
row["LandUUID"] = parcelID.ToString();
|
||||
row["AccessUUID"] = entry.AgentID.ToString();
|
||||
@@ -1833,6 +1835,7 @@ namespace OpenSim.Data.SQLite
|
||||
row["fixed_sun"] = settings.FixedSun;
|
||||
row["sun_position"] = settings.SunPosition;
|
||||
row["covenant"] = settings.Covenant.ToString();
|
||||
row["covenant_datetime"] = settings.CovenantChangedDateTime;
|
||||
row["map_tile_ID"] = settings.TerrainImageID.ToString();
|
||||
}
|
||||
|
||||
|
||||
@@ -685,7 +685,7 @@ namespace OpenSim.Data.Tests
|
||||
SceneObjectGroup sog = GetMySOG("object1");
|
||||
InventoryItemBase i = NewItem(item1, zero, zero, itemname1, zero);
|
||||
|
||||
Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, i, zero), Is.True);
|
||||
Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, i, zero), Is.True);
|
||||
TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1);
|
||||
Assert.That(t.Name, Is.EqualTo(itemname1), "Assert.That(t.Name, Is.EqualTo(itemname1))");
|
||||
|
||||
@@ -762,7 +762,7 @@ namespace OpenSim.Data.Tests
|
||||
i.CreationDate = creationd;
|
||||
|
||||
SceneObjectGroup sog = GetMySOG("object1");
|
||||
Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, i, zero), Is.True);
|
||||
Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, i, zero), Is.True);
|
||||
TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, id);
|
||||
|
||||
Assert.That(t.Name, Is.EqualTo(name), "Assert.That(t.Name, Is.EqualTo(name))");
|
||||
@@ -807,10 +807,10 @@ namespace OpenSim.Data.Tests
|
||||
|
||||
SceneObjectGroup sog = FindSOG("object1", region1);
|
||||
|
||||
Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, ib1, zero), Is.True);
|
||||
Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, ib2, zero), Is.True);
|
||||
Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, ib3, zero), Is.True);
|
||||
Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, ib4, zero), Is.True);
|
||||
Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib1, zero), Is.True);
|
||||
Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib2, zero), Is.True);
|
||||
Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib3, zero), Is.True);
|
||||
Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib4, zero), Is.True);
|
||||
|
||||
TaskInventoryItem t1 = sog.GetInventoryItem(sog.RootPart.LocalId, i1);
|
||||
Assert.That(t1.Name, Is.EqualTo(ib1.Name), "Assert.That(t1.Name, Is.EqualTo(ib1.Name))");
|
||||
|
||||
@@ -31,6 +31,7 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
using OpenSim.Framework;
|
||||
@@ -531,6 +532,11 @@ namespace OpenSim.Framework.Console
|
||||
|
||||
public class Parser
|
||||
{
|
||||
// If an unquoted portion ends with an element matching this regex
|
||||
// and the next element contains a space, then we have stripped
|
||||
// embedded quotes that should not have been stripped
|
||||
private static Regex optionRegex = new Regex("^--[a-zA-Z0-9-]+=$");
|
||||
|
||||
public static string[] Parse(string text)
|
||||
{
|
||||
List<string> result = new List<string>();
|
||||
@@ -544,10 +550,38 @@ namespace OpenSim.Framework.Console
|
||||
if (index % 2 == 0)
|
||||
{
|
||||
string[] words = unquoted[index].Split(new char[] {' '});
|
||||
|
||||
bool option = false;
|
||||
foreach (string w in words)
|
||||
{
|
||||
if (w != String.Empty)
|
||||
{
|
||||
if (optionRegex.Match(w) == Match.Empty)
|
||||
option = false;
|
||||
else
|
||||
option = true;
|
||||
result.Add(w);
|
||||
}
|
||||
}
|
||||
// The last item matched the regex, put the quotes back
|
||||
if (option)
|
||||
{
|
||||
// If the line ended with it, don't do anything
|
||||
if (index < (unquoted.Length - 1))
|
||||
{
|
||||
// Get and remove the option name
|
||||
string optionText = result[result.Count - 1];
|
||||
result.RemoveAt(result.Count - 1);
|
||||
|
||||
// Add the quoted value back
|
||||
optionText += "\"" + unquoted[index + 1] + "\"";
|
||||
|
||||
// Push the result into our return array
|
||||
result.Add(optionText);
|
||||
|
||||
// Skip the already used value
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -425,5 +425,11 @@ namespace OpenSim.Framework
|
||||
AllowParcelChanges = ((regionFlags & (ulong)RegionFlags.AllowParcelChanges) == (ulong)RegionFlags.AllowParcelChanges);
|
||||
AllowSetHome = ((regionFlags & (ulong)RegionFlags.AllowSetHome) == (ulong)RegionFlags.AllowSetHome);
|
||||
}
|
||||
|
||||
public bool GroupAccess(UUID groupID)
|
||||
{
|
||||
return l_EstateGroups.Contains(groupID);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ namespace OpenSim.Framework
|
||||
|
||||
public delegate void ParcelAccessListUpdateRequest(UUID agentID, uint flags,
|
||||
int landLocalID, UUID transactionID, int sequenceID,
|
||||
int sections, List<ParcelManager.ParcelAccessEntry> entries,
|
||||
int sections, List<LandAccessEntry> entries,
|
||||
IClientAPI remote_client);
|
||||
|
||||
public delegate void ParcelPropertiesRequest(
|
||||
@@ -361,6 +361,8 @@ namespace OpenSim.Framework
|
||||
|
||||
public delegate void EstateChangeInfo(IClientAPI client, UUID invoice, UUID senderID, UInt32 param1, UInt32 param2);
|
||||
|
||||
public delegate void EstateManageTelehub(IClientAPI client, UUID invoice, UUID senderID, string cmd, UInt32 param1);
|
||||
|
||||
public delegate void RequestTerrain(IClientAPI remoteClient, string clientFileName);
|
||||
|
||||
public delegate void BakeTerrain(IClientAPI remoteClient);
|
||||
@@ -774,6 +776,7 @@ namespace OpenSim.Framework
|
||||
event ModifyTerrain OnModifyTerrain;
|
||||
event BakeTerrain OnBakeTerrain;
|
||||
event EstateChangeInfo OnEstateChangeInfo;
|
||||
event EstateManageTelehub OnEstateManageTelehub;
|
||||
// [Obsolete("LLClientView Specific.")]
|
||||
event SetAppearance OnSetAppearance;
|
||||
// [Obsolete("LLClientView Specific - Replace and rename OnAvatarUpdate. Difference from SetAppearance?")]
|
||||
@@ -1082,7 +1085,15 @@ namespace OpenSim.Framework
|
||||
void SendWindData(Vector2[] windSpeeds);
|
||||
void SendCloudData(float[] cloudCover);
|
||||
|
||||
/// <summary>
|
||||
/// Sent when an agent completes its movement into a region.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This packet marks completion of the arrival of a root avatar in a region, whether through login, region
|
||||
/// crossing or direct teleport.
|
||||
/// </remarks>
|
||||
void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look);
|
||||
|
||||
void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint);
|
||||
|
||||
/// <summary>
|
||||
@@ -1141,6 +1152,8 @@ namespace OpenSim.Framework
|
||||
|
||||
void SendTaskInventory(UUID taskID, short serial, byte[] fileName);
|
||||
|
||||
void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List<Vector3> SpawnPoint);
|
||||
|
||||
/// <summary>
|
||||
/// Used by the server to inform the client of new inventory items and folders.
|
||||
/// </summary>
|
||||
@@ -1230,7 +1243,7 @@ namespace OpenSim.Framework
|
||||
void SendEstateCovenantInformation(UUID covenant);
|
||||
|
||||
void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags,
|
||||
uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner);
|
||||
uint sunPosition, UUID covenant, uint covenantChanged, string abuseEmail, UUID estateOwner);
|
||||
|
||||
/// <summary>
|
||||
/// Send land properties to the client.
|
||||
@@ -1246,7 +1259,7 @@ namespace OpenSim.Framework
|
||||
float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity,
|
||||
uint regionFlags);
|
||||
|
||||
void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID);
|
||||
void SendLandAccessListData(List<LandAccessEntry> accessList, uint accessFlag, int localLandID);
|
||||
void SendForceClientSelectObjects(List<uint> objectIDs);
|
||||
void SendCameraConstraint(Vector4 ConstraintPlane);
|
||||
void SendLandObjectOwners(LandData land, List<UUID> groups, Dictionary<UUID, int> ownersAndCount);
|
||||
|
||||
@@ -73,9 +73,9 @@ namespace OpenSim.Framework
|
||||
bool IsRestrictedFromLand(UUID avatar);
|
||||
void SendLandUpdateToClient(IClientAPI remote_client);
|
||||
void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client);
|
||||
List<UUID> CreateAccessListArrayByFlag(AccessList flag);
|
||||
List<LandAccessEntry> CreateAccessListArrayByFlag(AccessList flag);
|
||||
void SendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID, IClientAPI remote_client);
|
||||
void UpdateAccessList(uint flags, UUID transactionID, int sequenceID, int sections, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client);
|
||||
void UpdateAccessList(uint flags, UUID transactionID, int sequenceID, int sections, List<LandAccessEntry> entries, IClientAPI remote_client);
|
||||
void UpdateLandBitmapByteArray();
|
||||
void SetLandBitmapFromByteArray();
|
||||
bool[,] GetLandBitmap();
|
||||
@@ -130,5 +130,11 @@ namespace OpenSim.Framework
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
void SetMusicUrl(string url);
|
||||
|
||||
/// <summary>
|
||||
/// Get the music url for this land parcel
|
||||
/// </summary>
|
||||
/// <returns>The music url.</returns>
|
||||
string GetMusicUrl();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ namespace OpenSim.Framework
|
||||
int amount);
|
||||
|
||||
int GetBalance(UUID agentID);
|
||||
bool UploadCovered(IClientAPI client, int amount);
|
||||
bool AmountCovered(IClientAPI client, int amount);
|
||||
bool UploadCovered(UUID agentID, int amount);
|
||||
bool AmountCovered(UUID agentID, int amount);
|
||||
void ApplyCharge(UUID agentID, int amount, string text);
|
||||
void ApplyUploadCharge(UUID agentID, int amount, string text);
|
||||
void MoveMoney(UUID fromUser, UUID toUser, int amount, string text);
|
||||
|
||||
@@ -34,6 +34,13 @@ using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
public class LandAccessEntry
|
||||
{
|
||||
public UUID AgentID;
|
||||
public int Expires;
|
||||
public AccessList Flags;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Details of a Parcel of land
|
||||
/// </summary>
|
||||
@@ -73,7 +80,7 @@ namespace OpenSim.Framework
|
||||
private string _mediaURL = String.Empty;
|
||||
private string _musicURL = String.Empty;
|
||||
private UUID _ownerID = UUID.Zero;
|
||||
private List<ParcelManager.ParcelAccessEntry> _parcelAccessList = new List<ParcelManager.ParcelAccessEntry>();
|
||||
private List<LandAccessEntry> _parcelAccessList = new List<LandAccessEntry>();
|
||||
private float _passHours = 0;
|
||||
private int _passPrice = 0;
|
||||
private int _salePrice = 0; //Unemeplemented. Parcels price.
|
||||
@@ -450,7 +457,7 @@ namespace OpenSim.Framework
|
||||
/// <summary>
|
||||
/// List of access data for the parcel. User data, some bitflags, and a time
|
||||
/// </summary>
|
||||
public List<ParcelManager.ParcelAccessEntry> ParcelAccessList {
|
||||
public List<LandAccessEntry> ParcelAccessList {
|
||||
get {
|
||||
return _parcelAccessList;
|
||||
}
|
||||
@@ -638,12 +645,12 @@ namespace OpenSim.Framework
|
||||
landData._simwidePrims = _simwidePrims;
|
||||
|
||||
landData._parcelAccessList.Clear();
|
||||
foreach (ParcelManager.ParcelAccessEntry entry in _parcelAccessList)
|
||||
foreach (LandAccessEntry entry in _parcelAccessList)
|
||||
{
|
||||
ParcelManager.ParcelAccessEntry newEntry = new ParcelManager.ParcelAccessEntry();
|
||||
LandAccessEntry newEntry = new LandAccessEntry();
|
||||
newEntry.AgentID = entry.AgentID;
|
||||
newEntry.Flags = entry.Flags;
|
||||
newEntry.Time = entry.Time;
|
||||
newEntry.Expires = entry.Expires;
|
||||
|
||||
landData._parcelAccessList.Add(newEntry);
|
||||
}
|
||||
@@ -668,4 +675,4 @@ namespace OpenSim.Framework
|
||||
return land;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,13 +450,17 @@ namespace OpenSim.Framework
|
||||
public string GetOtherSetting(string key)
|
||||
{
|
||||
string val;
|
||||
m_otherSettings.TryGetValue(key, out val);
|
||||
return val;
|
||||
string keylower = key.ToLower();
|
||||
if (m_otherSettings.TryGetValue(keylower, out val))
|
||||
return val;
|
||||
m_log.DebugFormat("[RegionInfo] Could not locate value for parameter {0}", key);
|
||||
return null;
|
||||
}
|
||||
|
||||
public void SetOtherSetting(string key, string value)
|
||||
{
|
||||
m_otherSettings[key] = value;
|
||||
string keylower = key.ToLower();
|
||||
m_otherSettings[keylower] = value;
|
||||
}
|
||||
|
||||
private void ReadNiniConfig(IConfigSource source, string name)
|
||||
@@ -498,12 +502,12 @@ namespace OpenSim.Framework
|
||||
HashSet<String> allKeys = new HashSet<String>();
|
||||
foreach (string s in config.GetKeys())
|
||||
{
|
||||
allKeys.Add(s.ToLower());
|
||||
allKeys.Add(s);
|
||||
}
|
||||
|
||||
// RegionUUID
|
||||
//
|
||||
allKeys.Remove(("RegionUUID").ToLower());
|
||||
allKeys.Remove("RegionUUID");
|
||||
string regionUUID = config.GetString("RegionUUID", string.Empty);
|
||||
if (regionUUID == String.Empty)
|
||||
{
|
||||
@@ -518,7 +522,7 @@ namespace OpenSim.Framework
|
||||
|
||||
// Location
|
||||
//
|
||||
allKeys.Remove(("Location").ToLower());
|
||||
allKeys.Remove("Location");
|
||||
string location = config.GetString("Location", String.Empty);
|
||||
if (location == String.Empty)
|
||||
{
|
||||
@@ -534,7 +538,7 @@ namespace OpenSim.Framework
|
||||
// InternalAddress
|
||||
//
|
||||
IPAddress address;
|
||||
allKeys.Remove(("InternalAddress").ToLower());
|
||||
allKeys.Remove("InternalAddress");
|
||||
if (config.Contains("InternalAddress"))
|
||||
{
|
||||
address = IPAddress.Parse(config.GetString("InternalAddress", String.Empty));
|
||||
@@ -548,7 +552,7 @@ namespace OpenSim.Framework
|
||||
// InternalPort
|
||||
//
|
||||
int port;
|
||||
allKeys.Remove(("InternalPort").ToLower());
|
||||
allKeys.Remove("InternalPort");
|
||||
if (config.Contains("InternalPort"))
|
||||
{
|
||||
port = config.GetInt("InternalPort", 9000);
|
||||
@@ -562,7 +566,7 @@ namespace OpenSim.Framework
|
||||
|
||||
// AllowAlternatePorts
|
||||
//
|
||||
allKeys.Remove(("AllowAlternatePorts").ToLower());
|
||||
allKeys.Remove("AllowAlternatePorts");
|
||||
if (config.Contains("AllowAlternatePorts"))
|
||||
{
|
||||
m_allow_alternate_ports = config.GetBoolean("AllowAlternatePorts", true);
|
||||
@@ -576,7 +580,7 @@ namespace OpenSim.Framework
|
||||
|
||||
// ExternalHostName
|
||||
//
|
||||
allKeys.Remove(("ExternalHostName").ToLower());
|
||||
allKeys.Remove("ExternalHostName");
|
||||
string externalName;
|
||||
if (config.Contains("ExternalHostName"))
|
||||
{
|
||||
@@ -601,29 +605,29 @@ namespace OpenSim.Framework
|
||||
|
||||
// RegionType
|
||||
m_regionType = config.GetString("RegionType", String.Empty);
|
||||
allKeys.Remove(("RegionType").ToLower());
|
||||
allKeys.Remove("RegionType");
|
||||
|
||||
// Prim stuff
|
||||
//
|
||||
m_nonphysPrimMax = config.GetInt("NonphysicalPrimMax", 256);
|
||||
allKeys.Remove(("NonphysicalPrimMax").ToLower());
|
||||
m_physPrimMax = config.GetInt("PhysicalPrimMax", 10);
|
||||
allKeys.Remove(("PhysicalPrimMax").ToLower());
|
||||
m_nonphysPrimMax = config.GetInt("NonphysicalPrimMax", 0);
|
||||
allKeys.Remove("NonphysicalPrimMax");
|
||||
m_physPrimMax = config.GetInt("PhysicalPrimMax", 0);
|
||||
allKeys.Remove("PhysicalPrimMax");
|
||||
m_clampPrimSize = config.GetBoolean("ClampPrimSize", false);
|
||||
allKeys.Remove(("ClampPrimSize").ToLower());
|
||||
allKeys.Remove("ClampPrimSize");
|
||||
m_objectCapacity = config.GetInt("MaxPrims", 15000);
|
||||
allKeys.Remove(("MaxPrims").ToLower());
|
||||
allKeys.Remove("MaxPrims");
|
||||
m_agentCapacity = config.GetInt("MaxAgents", 100);
|
||||
allKeys.Remove(("MaxAgents").ToLower());
|
||||
allKeys.Remove("MaxAgents");
|
||||
|
||||
// Multi-tenancy
|
||||
//
|
||||
ScopeID = new UUID(config.GetString("ScopeID", UUID.Zero.ToString()));
|
||||
allKeys.Remove(("ScopeID").ToLower());
|
||||
allKeys.Remove("ScopeID");
|
||||
|
||||
foreach (String s in allKeys)
|
||||
{
|
||||
m_otherSettings.Add(s, config.GetString(s));
|
||||
SetOtherSetting(s, config.GetString(s));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,11 +26,53 @@
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
public struct SpawnPoint
|
||||
{
|
||||
public float Yaw;
|
||||
public float Pitch;
|
||||
public float Distance;
|
||||
|
||||
public void SetLocation(Vector3 pos, Quaternion rot, Vector3 point)
|
||||
{
|
||||
// The point is an absolute position, so we need the relative
|
||||
// location to the spawn point
|
||||
Vector3 offset = point - pos;
|
||||
Distance = Vector3.Mag(offset);
|
||||
|
||||
// Next we need to rotate this vector into the spawn point's
|
||||
// coordinate system
|
||||
rot.W = -rot.W;
|
||||
offset = offset * rot;
|
||||
|
||||
Vector3 dir = Vector3.Normalize(offset);
|
||||
|
||||
// Get the bearing (yaw)
|
||||
Yaw = (float)Math.Atan2(dir.Y, dir.X);
|
||||
|
||||
// Get the elevation (pitch)
|
||||
Pitch = (float)-Math.Atan2(dir.Z, Math.Sqrt(dir.X * dir.X + dir.Y * dir.Y));
|
||||
}
|
||||
|
||||
public Vector3 GetLocation(Vector3 pos, Quaternion rot)
|
||||
{
|
||||
Quaternion y = Quaternion.CreateFromEulers(0, 0, Yaw);
|
||||
Quaternion p = Quaternion.CreateFromEulers(0, Pitch, 0);
|
||||
|
||||
Vector3 dir = new Vector3(1, 0, 0) * p * y;
|
||||
Vector3 offset = dir * (float)Distance;
|
||||
|
||||
offset *= rot;
|
||||
|
||||
return pos + offset;
|
||||
}
|
||||
}
|
||||
|
||||
public class RegionSettings
|
||||
{
|
||||
public delegate void SaveDelegate(RegionSettings rs);
|
||||
@@ -331,6 +373,14 @@ namespace OpenSim.Framework
|
||||
set { m_SunVector = value; }
|
||||
}
|
||||
|
||||
private UUID m_ParcelImageID;
|
||||
|
||||
public UUID ParcelImageID
|
||||
{
|
||||
get { return m_ParcelImageID; }
|
||||
set { m_ParcelImageID = value; }
|
||||
}
|
||||
|
||||
private UUID m_TerrainImageID;
|
||||
|
||||
public UUID TerrainImageID
|
||||
@@ -363,6 +413,14 @@ namespace OpenSim.Framework
|
||||
set { m_Covenant = value; }
|
||||
}
|
||||
|
||||
private int m_CovenantChanged = 0;
|
||||
|
||||
public int CovenantChangedDateTime
|
||||
{
|
||||
get { return m_CovenantChanged; }
|
||||
set { m_CovenantChanged = value; }
|
||||
}
|
||||
|
||||
private int m_LoadedCreationDateTime;
|
||||
public int LoadedCreationDateTime
|
||||
{
|
||||
@@ -410,5 +468,58 @@ namespace OpenSim.Framework
|
||||
get { return m_Casino; }
|
||||
set { m_Casino = value; }
|
||||
}
|
||||
|
||||
// Telehub support
|
||||
private bool m_TelehubEnabled = false;
|
||||
public bool HasTelehub
|
||||
{
|
||||
get { return m_TelehubEnabled; }
|
||||
set { m_TelehubEnabled = value; }
|
||||
}
|
||||
|
||||
// Connected Telehub object
|
||||
private UUID m_TelehubObject;
|
||||
public UUID TelehubObject
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_TelehubObject;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_TelehubObject = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Our Connected Telehub's SpawnPoints
|
||||
public List<SpawnPoint> l_SpawnPoints = new List<SpawnPoint>();
|
||||
|
||||
// Add a SpawnPoint
|
||||
// ** These are not region coordinates **
|
||||
// They are relative to the Telehub coordinates
|
||||
//
|
||||
public void AddSpawnPoint(SpawnPoint point)
|
||||
{
|
||||
l_SpawnPoints.Add(point);
|
||||
}
|
||||
|
||||
// Remove a SpawnPoint
|
||||
public void RemoveSpawnPoint(int point_index)
|
||||
{
|
||||
l_SpawnPoints.RemoveAt(point_index);
|
||||
}
|
||||
|
||||
// Return the List of SpawnPoints
|
||||
public List<SpawnPoint> SpawnPoints()
|
||||
{
|
||||
return l_SpawnPoints;
|
||||
|
||||
}
|
||||
|
||||
// Clear the SpawnPoints List of all entries
|
||||
public void ClearSpawnPoints()
|
||||
{
|
||||
l_SpawnPoints.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,11 +24,13 @@
|
||||
* (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.IO;
|
||||
using System.Reflection;
|
||||
using System.Xml;
|
||||
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
@@ -39,18 +41,86 @@ namespace OpenSim.Framework.Serialization.External
|
||||
/// </summary>
|
||||
public class ExternalRepresentationUtils
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Populate a node with data read from xml using a dictinoary of processors
|
||||
/// </summary>
|
||||
/// <param name="nodeToFill"></param>
|
||||
/// <param name="processors">/param>
|
||||
/// <param name="xtr"></param>
|
||||
public static void ExecuteReadProcessors<NodeType>(
|
||||
NodeType nodeToFill, Dictionary<string, Action<NodeType, XmlTextReader>> processors, XmlTextReader xtr)
|
||||
{
|
||||
ExecuteReadProcessors(
|
||||
nodeToFill,
|
||||
processors,
|
||||
xtr,
|
||||
(o, name, e)
|
||||
=> m_log.ErrorFormat(
|
||||
"[ExternalRepresentationUtils]: Exception while parsing element {0}, continuing. Exception {1}{2}",
|
||||
name, e.Message, e.StackTrace));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Populate a node with data read from xml using a dictinoary of processors
|
||||
/// </summary>
|
||||
/// <param name="nodeToFill"></param>
|
||||
/// <param name="processors"></param>
|
||||
/// <param name="xtr"></param>
|
||||
/// <param name="parseExceptionAction">
|
||||
/// Action to take if there is a parsing problem. This will usually just be to log the exception
|
||||
/// </param>
|
||||
public static void ExecuteReadProcessors<NodeType>(
|
||||
NodeType nodeToFill,
|
||||
Dictionary<string, Action<NodeType, XmlTextReader>> processors,
|
||||
XmlTextReader xtr,
|
||||
Action<NodeType, string, Exception> parseExceptionAction)
|
||||
{
|
||||
string nodeName = string.Empty;
|
||||
while (xtr.NodeType != XmlNodeType.EndElement)
|
||||
{
|
||||
nodeName = xtr.Name;
|
||||
|
||||
// m_log.DebugFormat("[ExternalRepresentationUtils]: Processing: {0}", nodeName);
|
||||
|
||||
Action<NodeType, XmlTextReader> p = null;
|
||||
if (processors.TryGetValue(xtr.Name, out p))
|
||||
{
|
||||
// m_log.DebugFormat("[ExternalRepresentationUtils]: Found {0} processor, nodeName);
|
||||
|
||||
try
|
||||
{
|
||||
p(nodeToFill, xtr);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
parseExceptionAction(nodeToFill, nodeName, e);
|
||||
|
||||
if (xtr.NodeType == XmlNodeType.EndElement)
|
||||
xtr.Read();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_log.DebugFormat("[LandDataSerializer]: caught unknown element {0}", nodeName);
|
||||
xtr.ReadOuterXml(); // ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes a XML representation of a SceneObjectPart and returns another XML representation
|
||||
/// with creator data added to it.
|
||||
/// </summary>
|
||||
/// <param name="xml">The SceneObjectPart represented in XML2</param>
|
||||
/// <param name="profileURL">The URL of the profile service for the creator</param>
|
||||
/// <param name="homeURL">The URL of the user agents service (home) for the creator</param>
|
||||
/// <param name="userService">The service for retrieving user account information</param>
|
||||
/// <param name="scopeID">The scope of the user account information (Grid ID)</param>
|
||||
/// <returns>The SceneObjectPart represented in XML2</returns>
|
||||
public static string RewriteSOP(string xml, string profileURL, IUserAccountService userService, UUID scopeID)
|
||||
public static string RewriteSOP(string xml, string homeURL, IUserAccountService userService, UUID scopeID)
|
||||
{
|
||||
if (xml == string.Empty || profileURL == string.Empty || userService == null)
|
||||
if (xml == string.Empty || homeURL == string.Empty || userService == null)
|
||||
return xml;
|
||||
|
||||
XmlDocument doc = new XmlDocument();
|
||||
@@ -83,7 +153,7 @@ namespace OpenSim.Framework.Serialization.External
|
||||
if (!hasCreatorData && creator != null)
|
||||
{
|
||||
XmlElement creatorData = doc.CreateElement("CreatorData");
|
||||
creatorData.InnerText = profileURL + "/" + creator.PrincipalID + ";" + creator.FirstName + " " + creator.LastName;
|
||||
creatorData.InnerText = homeURL + ";" + creator.FirstName + " " + creator.LastName;
|
||||
sop.AppendChild(creatorData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,8 +28,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
@@ -40,8 +42,119 @@ namespace OpenSim.Framework.Serialization.External
|
||||
/// </summary>
|
||||
public class LandDataSerializer
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected static UTF8Encoding m_utf8Encoding = new UTF8Encoding();
|
||||
|
||||
private static Dictionary<string, Action<LandData, XmlTextReader>> m_ldProcessors
|
||||
= new Dictionary<string, Action<LandData, XmlTextReader>>();
|
||||
|
||||
private static Dictionary<string, Action<LandAccessEntry, XmlTextReader>> m_laeProcessors
|
||||
= new Dictionary<string, Action<LandAccessEntry, XmlTextReader>>();
|
||||
|
||||
static LandDataSerializer()
|
||||
{
|
||||
// LandData processors
|
||||
m_ldProcessors.Add(
|
||||
"Area", (ld, xtr) => ld.Area = Convert.ToInt32(xtr.ReadElementString("Area")));
|
||||
m_ldProcessors.Add(
|
||||
"AuctionID", (ld, xtr) => ld.AuctionID = Convert.ToUInt32(xtr.ReadElementString("AuctionID")));
|
||||
m_ldProcessors.Add(
|
||||
"AuthBuyerID", (ld, xtr) => ld.AuthBuyerID = UUID.Parse(xtr.ReadElementString("AuthBuyerID")));
|
||||
m_ldProcessors.Add(
|
||||
"Category", (ld, xtr) => ld.Category = (ParcelCategory)Convert.ToSByte(xtr.ReadElementString("Category")));
|
||||
m_ldProcessors.Add(
|
||||
"ClaimDate", (ld, xtr) => ld.ClaimDate = Convert.ToInt32(xtr.ReadElementString("ClaimDate")));
|
||||
m_ldProcessors.Add(
|
||||
"ClaimPrice", (ld, xtr) => ld.ClaimPrice = Convert.ToInt32(xtr.ReadElementString("ClaimPrice")));
|
||||
m_ldProcessors.Add(
|
||||
"GlobalID", (ld, xtr) => ld.GlobalID = UUID.Parse(xtr.ReadElementString("GlobalID")));
|
||||
m_ldProcessors.Add(
|
||||
"GroupID", (ld, xtr) => ld.GroupID = UUID.Parse(xtr.ReadElementString("GroupID")));
|
||||
m_ldProcessors.Add(
|
||||
"IsGroupOwned", (ld, xtr) => ld.IsGroupOwned = Convert.ToBoolean(xtr.ReadElementString("IsGroupOwned")));
|
||||
m_ldProcessors.Add(
|
||||
"Bitmap", (ld, xtr) => ld.Bitmap = Convert.FromBase64String(xtr.ReadElementString("Bitmap")));
|
||||
m_ldProcessors.Add(
|
||||
"Description", (ld, xtr) => ld.Description = xtr.ReadElementString("Description"));
|
||||
m_ldProcessors.Add(
|
||||
"Flags", (ld, xtr) => ld.Flags = Convert.ToUInt32(xtr.ReadElementString("Flags")));
|
||||
m_ldProcessors.Add(
|
||||
"LandingType", (ld, xtr) => ld.LandingType = Convert.ToByte(xtr.ReadElementString("LandingType")));
|
||||
m_ldProcessors.Add(
|
||||
"Name", (ld, xtr) => ld.Name = xtr.ReadElementString("Name"));
|
||||
m_ldProcessors.Add(
|
||||
"Status", (ld, xtr) => ld.Status = (ParcelStatus)Convert.ToSByte(xtr.ReadElementString("Status")));
|
||||
m_ldProcessors.Add(
|
||||
"LocalID", (ld, xtr) => ld.LocalID = Convert.ToInt32(xtr.ReadElementString("LocalID")));
|
||||
m_ldProcessors.Add(
|
||||
"MediaAutoScale", (ld, xtr) => ld.MediaAutoScale = Convert.ToByte(xtr.ReadElementString("MediaAutoScale")));
|
||||
m_ldProcessors.Add(
|
||||
"MediaID", (ld, xtr) => ld.MediaID = UUID.Parse(xtr.ReadElementString("MediaID")));
|
||||
m_ldProcessors.Add(
|
||||
"MediaURL", (ld, xtr) => ld.MediaURL = xtr.ReadElementString("MediaURL"));
|
||||
m_ldProcessors.Add(
|
||||
"MusicURL", (ld, xtr) => ld.MusicURL = xtr.ReadElementString("MusicURL"));
|
||||
|
||||
m_ldProcessors.Add(
|
||||
"ParcelAccessList", ProcessParcelAccessList);
|
||||
|
||||
m_ldProcessors.Add(
|
||||
"PassHours", (ld, xtr) => ld.PassHours = Convert.ToSingle(xtr.ReadElementString("PassHours")));
|
||||
m_ldProcessors.Add(
|
||||
"PassPrice", (ld, xtr) => ld.PassPrice = Convert.ToInt32(xtr.ReadElementString("PassPrice")));
|
||||
m_ldProcessors.Add(
|
||||
"SalePrice", (ld, xtr) => ld.SalePrice = Convert.ToInt32(xtr.ReadElementString("SalePrice")));
|
||||
m_ldProcessors.Add(
|
||||
"SnapshotID", (ld, xtr) => ld.SnapshotID = UUID.Parse(xtr.ReadElementString("SnapshotID")));
|
||||
m_ldProcessors.Add(
|
||||
"UserLocation", (ld, xtr) => ld.UserLocation = Vector3.Parse(xtr.ReadElementString("UserLocation")));
|
||||
m_ldProcessors.Add(
|
||||
"UserLookAt", (ld, xtr) => ld.UserLookAt = Vector3.Parse(xtr.ReadElementString("UserLookAt")));
|
||||
|
||||
// No longer used here //
|
||||
// m_ldProcessors.Add("Dwell", (landData, xtr) => return);
|
||||
|
||||
m_ldProcessors.Add(
|
||||
"OtherCleanTime", (ld, xtr) => ld.OtherCleanTime = Convert.ToInt32(xtr.ReadElementString("OtherCleanTime")));
|
||||
|
||||
// LandAccessEntryProcessors
|
||||
m_laeProcessors.Add(
|
||||
"AgentID", (lae, xtr) => lae.AgentID = UUID.Parse(xtr.ReadElementString("AgentID")));
|
||||
m_laeProcessors.Add(
|
||||
"Time", (lae, xtr) =>
|
||||
{
|
||||
// We really don't care about temp vs perm here and this
|
||||
// would break on old oars. Assume all bans are perm
|
||||
xtr.ReadElementString("Time");
|
||||
lae.Expires = 0; // Convert.ToUint( xtr.ReadElementString("Time"));
|
||||
}
|
||||
);
|
||||
m_laeProcessors.Add(
|
||||
"AccessList", (lae, xtr) => lae.Flags = (AccessList)Convert.ToUInt32(xtr.ReadElementString("AccessList")));
|
||||
}
|
||||
|
||||
public static void ProcessParcelAccessList(LandData ld, XmlTextReader xtr)
|
||||
{
|
||||
if (!xtr.IsEmptyElement)
|
||||
{
|
||||
while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
|
||||
{
|
||||
LandAccessEntry lae = new LandAccessEntry();
|
||||
|
||||
xtr.ReadStartElement("ParcelAccessEntry");
|
||||
|
||||
ExternalRepresentationUtils.ExecuteReadProcessors<LandAccessEntry>(lae, m_laeProcessors, xtr);
|
||||
|
||||
xtr.ReadEndElement();
|
||||
|
||||
ld.ParcelAccessList.Add(lae);
|
||||
}
|
||||
}
|
||||
|
||||
xtr.Read();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reify/deserialize landData
|
||||
/// </summary>
|
||||
@@ -63,69 +176,14 @@ namespace OpenSim.Framework.Serialization.External
|
||||
{
|
||||
LandData landData = new LandData();
|
||||
|
||||
StringReader sr = new StringReader(serializedLandData);
|
||||
XmlTextReader xtr = new XmlTextReader(sr);
|
||||
|
||||
xtr.ReadStartElement("LandData");
|
||||
|
||||
landData.Area = Convert.ToInt32( xtr.ReadElementString("Area"));
|
||||
landData.AuctionID = Convert.ToUInt32( xtr.ReadElementString("AuctionID"));
|
||||
landData.AuthBuyerID = UUID.Parse( xtr.ReadElementString("AuthBuyerID"));
|
||||
landData.Category = (ParcelCategory)Convert.ToSByte( xtr.ReadElementString("Category"));
|
||||
landData.ClaimDate = Convert.ToInt32( xtr.ReadElementString("ClaimDate"));
|
||||
landData.ClaimPrice = Convert.ToInt32( xtr.ReadElementString("ClaimPrice"));
|
||||
landData.GlobalID = UUID.Parse( xtr.ReadElementString("GlobalID"));
|
||||
landData.GroupID = UUID.Parse( xtr.ReadElementString("GroupID"));
|
||||
landData.IsGroupOwned = Convert.ToBoolean( xtr.ReadElementString("IsGroupOwned"));
|
||||
landData.Bitmap = Convert.FromBase64String( xtr.ReadElementString("Bitmap"));
|
||||
landData.Description = xtr.ReadElementString("Description");
|
||||
landData.Flags = Convert.ToUInt32( xtr.ReadElementString("Flags"));
|
||||
landData.LandingType = Convert.ToByte( xtr.ReadElementString("LandingType"));
|
||||
landData.Name = xtr.ReadElementString("Name");
|
||||
landData.Status = (ParcelStatus)Convert.ToSByte( xtr.ReadElementString("Status"));
|
||||
landData.LocalID = Convert.ToInt32( xtr.ReadElementString("LocalID"));
|
||||
landData.MediaAutoScale = Convert.ToByte( xtr.ReadElementString("MediaAutoScale"));
|
||||
landData.MediaID = UUID.Parse( xtr.ReadElementString("MediaID"));
|
||||
landData.MediaURL = xtr.ReadElementString("MediaURL");
|
||||
landData.MusicURL = xtr.ReadElementString("MusicURL");
|
||||
landData.OwnerID = UUID.Parse( xtr.ReadElementString("OwnerID"));
|
||||
|
||||
landData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>();
|
||||
xtr.Read();
|
||||
if (xtr.Name != "ParcelAccessList")
|
||||
throw new XmlException(String.Format("Expected \"ParcelAccessList\" element but got \"{0}\"", xtr.Name));
|
||||
|
||||
if (!xtr.IsEmptyElement)
|
||||
using (XmlTextReader reader = new XmlTextReader(new StringReader(serializedLandData)))
|
||||
{
|
||||
while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
|
||||
{
|
||||
ParcelManager.ParcelAccessEntry pae = new ParcelManager.ParcelAccessEntry();
|
||||
reader.ReadStartElement("LandData");
|
||||
|
||||
xtr.ReadStartElement("ParcelAccessEntry");
|
||||
pae.AgentID = UUID.Parse( xtr.ReadElementString("AgentID"));
|
||||
pae.Time = Convert.ToDateTime( xtr.ReadElementString("Time"));
|
||||
pae.Flags = (AccessList)Convert.ToUInt32( xtr.ReadElementString("AccessList"));
|
||||
xtr.ReadEndElement();
|
||||
ExternalRepresentationUtils.ExecuteReadProcessors<LandData>(landData, m_ldProcessors, reader);
|
||||
|
||||
landData.ParcelAccessList.Add(pae);
|
||||
}
|
||||
reader.ReadEndElement();
|
||||
}
|
||||
xtr.Read();
|
||||
|
||||
landData.PassHours = Convert.ToSingle( xtr.ReadElementString("PassHours"));
|
||||
landData.PassPrice = Convert.ToInt32( xtr.ReadElementString("PassPrice"));
|
||||
landData.SalePrice = Convert.ToInt32( xtr.ReadElementString("SalePrice"));
|
||||
landData.SnapshotID = UUID.Parse( xtr.ReadElementString("SnapshotID"));
|
||||
landData.UserLocation = Vector3.Parse( xtr.ReadElementString("UserLocation"));
|
||||
landData.UserLookAt = Vector3.Parse( xtr.ReadElementString("UserLookAt"));
|
||||
// No longer used here
|
||||
xtr.ReadElementString("Dwell");
|
||||
landData.OtherCleanTime = Convert.ToInt32( xtr.ReadElementString("OtherCleanTime"));
|
||||
|
||||
xtr.ReadEndElement();
|
||||
|
||||
xtr.Close();
|
||||
sr.Close();
|
||||
|
||||
return landData;
|
||||
}
|
||||
@@ -162,11 +220,11 @@ namespace OpenSim.Framework.Serialization.External
|
||||
xtw.WriteElementString("OwnerID", landData.OwnerID.ToString());
|
||||
|
||||
xtw.WriteStartElement("ParcelAccessList");
|
||||
foreach (ParcelManager.ParcelAccessEntry pal in landData.ParcelAccessList)
|
||||
foreach (LandAccessEntry pal in landData.ParcelAccessList)
|
||||
{
|
||||
xtw.WriteStartElement("ParcelAccessEntry");
|
||||
xtw.WriteElementString("AgentID", pal.AgentID.ToString());
|
||||
xtw.WriteElementString("Time", pal.Time.ToString("s"));
|
||||
xtw.WriteElementString("Time", pal.Expires.ToString());
|
||||
xtw.WriteElementString("AccessList", Convert.ToString((uint)pal.Flags));
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
|
||||
@@ -41,14 +41,13 @@ namespace OpenSim.Framework.Serialization.External
|
||||
{
|
||||
/// <summary>
|
||||
/// Serialize and deserialize user inventory items as an external format.
|
||||
/// </summary>
|
||||
/// XXX: Please do not use yet.
|
||||
/// </summary>
|
||||
public class UserInventoryItemSerializer
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private delegate void InventoryItemXmlProcessor(InventoryItemBase item, XmlTextReader reader);
|
||||
private static Dictionary<string, InventoryItemXmlProcessor> m_InventoryItemXmlProcessors = new Dictionary<string, InventoryItemXmlProcessor>();
|
||||
private static Dictionary<string, Action<InventoryItemBase, XmlTextReader>> m_InventoryItemXmlProcessors
|
||||
= new Dictionary<string, Action<InventoryItemBase, XmlTextReader>>();
|
||||
|
||||
#region InventoryItemBase Processor initialization
|
||||
static UserInventoryItemSerializer()
|
||||
@@ -205,39 +204,14 @@ namespace OpenSim.Framework.Serialization.External
|
||||
{
|
||||
reader.ReadStartElement("InventoryItem");
|
||||
|
||||
string nodeName = string.Empty;
|
||||
while (reader.NodeType != XmlNodeType.EndElement)
|
||||
{
|
||||
nodeName = reader.Name;
|
||||
InventoryItemXmlProcessor p = null;
|
||||
if (m_InventoryItemXmlProcessors.TryGetValue(reader.Name, out p))
|
||||
{
|
||||
//m_log.DebugFormat("[XXX] Processing: {0}", reader.Name);
|
||||
try
|
||||
{
|
||||
p(item, reader);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[InventoryItemSerializer]: exception while parsing {0}: {1}", nodeName, e);
|
||||
if (reader.NodeType == XmlNodeType.EndElement)
|
||||
reader.Read();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_log.DebugFormat("[InventoryItemSerializer]: caught unknown element {0}", nodeName);
|
||||
reader.ReadOuterXml(); // ignore
|
||||
}
|
||||
|
||||
}
|
||||
ExternalRepresentationUtils.ExecuteReadProcessors<InventoryItemBase>(
|
||||
item, m_InventoryItemXmlProcessors, reader);
|
||||
|
||||
reader.ReadEndElement(); // InventoryItem
|
||||
}
|
||||
|
||||
//m_log.DebugFormat("[XXX]: parsed InventoryItemBase {0} - {1}", obj.Name, obj.UUID);
|
||||
return item;
|
||||
|
||||
}
|
||||
|
||||
public static string Serialize(InventoryItemBase inventoryItem, Dictionary<string, object> options, IUserAccountService userAccountService)
|
||||
@@ -305,14 +279,14 @@ namespace OpenSim.Framework.Serialization.External
|
||||
writer.WriteEndElement();
|
||||
if (options.ContainsKey("creators") && inventoryItem.CreatorData != null && inventoryItem.CreatorData != string.Empty)
|
||||
writer.WriteElementString("CreatorData", inventoryItem.CreatorData);
|
||||
else if (options.ContainsKey("profile"))
|
||||
else if (options.ContainsKey("home"))
|
||||
{
|
||||
if (userAccountService != null)
|
||||
{
|
||||
UserAccount account = userAccountService.GetUserAccount(UUID.Zero, inventoryItem.CreatorIdAsUuid);
|
||||
if (account != null)
|
||||
{
|
||||
writer.WriteElementString("CreatorData", (string)options["profile"] + "/" + inventoryItem.CreatorIdAsUuid + ";" + account.FirstName + " " + account.LastName);
|
||||
writer.WriteElementString("CreatorData", (string)options["home"] + "/" + inventoryItem.CreatorIdAsUuid + ";" + account.FirstName + " " + account.LastName);
|
||||
}
|
||||
writer.WriteElementString("CreatorID", inventoryItem.CreatorId);
|
||||
}
|
||||
|
||||
@@ -33,8 +33,11 @@ using OpenSim.Framework;
|
||||
namespace OpenSim.Framework.Serialization.External
|
||||
{
|
||||
/// <summary>
|
||||
/// Serialize and deserialize region settings as an external format.
|
||||
/// Serialize and deserialize user profiles as an external format.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Currently UNUSED.
|
||||
/// </remarks>
|
||||
public class UserProfileSerializer
|
||||
{
|
||||
public const int MAJOR_VERSION = 0;
|
||||
|
||||
@@ -27,11 +27,12 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Serialization.External;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using NUnit.Framework;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Serialization.External;
|
||||
using OpenSim.Tests.Common;
|
||||
|
||||
namespace OpenSim.Framework.Serialization.Tests
|
||||
{
|
||||
@@ -42,7 +43,7 @@ namespace OpenSim.Framework.Serialization.Tests
|
||||
private LandData landWithParcelAccessList;
|
||||
|
||||
private static string preSerialized = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n <Area>128</Area>\n <AuctionID>0</AuctionID>\n <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n <Category>10</Category>\n <ClaimDate>0</ClaimDate>\n <ClaimPrice>0</ClaimPrice>\n <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n <IsGroupOwned>False</IsGroupOwned>\n <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n <Description>land data to test LandDataSerializer</Description>\n <Flags>536870944</Flags>\n <LandingType>2</LandingType>\n <Name>LandDataSerializerTest Land</Name>\n <Status>0</Status>\n <LocalID>0</LocalID>\n <MediaAutoScale>1</MediaAutoScale>\n <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n <MusicURL />\n <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n <ParcelAccessList />\n <PassHours>0</PassHours>\n <PassPrice>0</PassPrice>\n <SalePrice>0</SalePrice>\n <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n <UserLocation><0, 0, 0></UserLocation>\n <UserLookAt><0, 0, 0></UserLookAt>\n <Dwell>0</Dwell>\n <OtherCleanTime>0</OtherCleanTime>\n</LandData>";
|
||||
private static string preSerializedWithParcelAccessList = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n <Area>128</Area>\n <AuctionID>0</AuctionID>\n <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n <Category>10</Category>\n <ClaimDate>0</ClaimDate>\n <ClaimPrice>0</ClaimPrice>\n <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n <IsGroupOwned>False</IsGroupOwned>\n <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n <Description>land data to test LandDataSerializer</Description>\n <Flags>536870944</Flags>\n <LandingType>2</LandingType>\n <Name>LandDataSerializerTest Land</Name>\n <Status>0</Status>\n <LocalID>0</LocalID>\n <MediaAutoScale>1</MediaAutoScale>\n <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n <MusicURL />\n <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n <ParcelAccessList>\n <ParcelAccessEntry>\n <AgentID>62d65d45-c91a-4f77-862c-46557d978b6c</AgentID>\n <Time>2009-10-01T00:00:00</Time>\n <AccessList>2</AccessList>\n </ParcelAccessEntry>\n <ParcelAccessEntry>\n <AgentID>ec2a8d18-2378-4fe0-8b68-2a31b57c481e</AgentID>\n <Time>2010-10-20T00:00:00</Time>\n <AccessList>1</AccessList>\n </ParcelAccessEntry>\n </ParcelAccessList>\n <PassHours>0</PassHours>\n <PassPrice>0</PassPrice>\n <SalePrice>0</SalePrice>\n <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n <UserLocation><0, 0, 0></UserLocation>\n <UserLookAt><0, 0, 0></UserLookAt>\n <Dwell>0</Dwell>\n <OtherCleanTime>0</OtherCleanTime>\n</LandData>";
|
||||
private static string preSerializedWithParcelAccessList = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n <Area>128</Area>\n <AuctionID>0</AuctionID>\n <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n <Category>10</Category>\n <ClaimDate>0</ClaimDate>\n <ClaimPrice>0</ClaimPrice>\n <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n <IsGroupOwned>False</IsGroupOwned>\n <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n <Description>land data to test LandDataSerializer</Description>\n <Flags>536870944</Flags>\n <LandingType>2</LandingType>\n <Name>LandDataSerializerTest Land</Name>\n <Status>0</Status>\n <LocalID>0</LocalID>\n <MediaAutoScale>1</MediaAutoScale>\n <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n <MusicURL />\n <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n <ParcelAccessList>\n <ParcelAccessEntry>\n <AgentID>62d65d45-c91a-4f77-862c-46557d978b6c</AgentID>\n <Time>0</Time>\n <AccessList>2</AccessList>\n </ParcelAccessEntry>\n <ParcelAccessEntry>\n <AgentID>ec2a8d18-2378-4fe0-8b68-2a31b57c481e</AgentID>\n <Time>0</Time>\n <AccessList>1</AccessList>\n </ParcelAccessEntry>\n </ParcelAccessList>\n <PassHours>0</PassHours>\n <PassPrice>0</PassPrice>\n <SalePrice>0</SalePrice>\n <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n <UserLocation><0, 0, 0></UserLocation>\n <UserLookAt><0, 0, 0></UserLookAt>\n <Dwell>0</Dwell>\n <OtherCleanTime>0</OtherCleanTime>\n</LandData>";
|
||||
|
||||
[SetUp]
|
||||
public void setup()
|
||||
@@ -73,16 +74,16 @@ namespace OpenSim.Framework.Serialization.Tests
|
||||
this.landWithParcelAccessList = this.land.Copy();
|
||||
this.landWithParcelAccessList.ParcelAccessList.Clear();
|
||||
|
||||
ParcelManager.ParcelAccessEntry pae0 = new ParcelManager.ParcelAccessEntry();
|
||||
LandAccessEntry pae0 = new LandAccessEntry();
|
||||
pae0.AgentID = new UUID("62d65d45-c91a-4f77-862c-46557d978b6c");
|
||||
pae0.Flags = AccessList.Ban;
|
||||
pae0.Time = new DateTime(2009, 10, 01);
|
||||
pae0.Expires = 0;
|
||||
this.landWithParcelAccessList.ParcelAccessList.Add(pae0);
|
||||
|
||||
ParcelManager.ParcelAccessEntry pae1 = new ParcelManager.ParcelAccessEntry();
|
||||
LandAccessEntry pae1 = new LandAccessEntry();
|
||||
pae1.AgentID = new UUID("ec2a8d18-2378-4fe0-8b68-2a31b57c481e");
|
||||
pae1.Flags = AccessList.Access;
|
||||
pae1.Time = new DateTime(2010, 10, 20);
|
||||
pae1.Expires = 0;
|
||||
this.landWithParcelAccessList.ParcelAccessList.Add(pae1);
|
||||
}
|
||||
|
||||
@@ -92,6 +93,8 @@ namespace OpenSim.Framework.Serialization.Tests
|
||||
[Test]
|
||||
public void LandDataSerializerSerializeTest()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string serialized = LandDataSerializer.Serialize(this.land).Replace("\r\n", "\n");
|
||||
Assert.That(serialized.Length > 0, "Serialize(LandData) returned empty string");
|
||||
|
||||
@@ -112,20 +115,32 @@ namespace OpenSim.Framework.Serialization.Tests
|
||||
/// Test the LandDataSerializer.Deserialize() method
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestLandDataSerializerDeserializeFromStringTest()
|
||||
public void TestLandDataDeserializeNoAccessLists()
|
||||
{
|
||||
LandData reifiedLandData = LandDataSerializer.Deserialize(LandDataSerializerTest.preSerialized);
|
||||
Assert.That(reifiedLandData != null, "Deserialize(string) returned null");
|
||||
Assert.That(reifiedLandData.GlobalID == this.land.GlobalID, "Reified LandData.GlobalID != original LandData.GlobalID");
|
||||
Assert.That(reifiedLandData.Name == this.land.Name, "Reified LandData.Name != original LandData.Name");
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
LandData reifiedLandDataWithParcelAccessList = LandDataSerializer.Deserialize(LandDataSerializerTest.preSerializedWithParcelAccessList);
|
||||
Assert.That(reifiedLandDataWithParcelAccessList != null,
|
||||
LandData ld = LandDataSerializer.Deserialize(LandDataSerializerTest.preSerialized);
|
||||
Assert.That(ld != null, "Deserialize(string) returned null");
|
||||
Assert.That(ld.GlobalID == this.land.GlobalID, "Reified LandData.GlobalID != original LandData.GlobalID");
|
||||
Assert.That(ld.Name == this.land.Name, "Reified LandData.Name != original LandData.Name");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLandDataDeserializeWithAccessLists()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
LandData ld = LandDataSerializer.Deserialize(LandDataSerializerTest.preSerializedWithParcelAccessList);
|
||||
Assert.That(ld != null,
|
||||
"Deserialize(string) returned null (pre-serialized with parcel access list)");
|
||||
Assert.That(reifiedLandDataWithParcelAccessList.GlobalID == this.landWithParcelAccessList.GlobalID,
|
||||
Assert.That(ld.GlobalID == this.landWithParcelAccessList.GlobalID,
|
||||
"Reified LandData.GlobalID != original LandData.GlobalID (pre-serialized with parcel access list)");
|
||||
Assert.That(reifiedLandDataWithParcelAccessList.Name == this.landWithParcelAccessList.Name,
|
||||
Assert.That(ld.Name == this.landWithParcelAccessList.Name,
|
||||
"Reified LandData.Name != original LandData.Name (pre-serialized with parcel access list)");
|
||||
Assert.That(ld.ParcelAccessList.Count, Is.EqualTo(2));
|
||||
Assert.That(ld.ParcelAccessList[0].AgentID, Is.EqualTo(UUID.Parse("62d65d45-c91a-4f77-862c-46557d978b6c")));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* 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 OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using NUnit.Framework;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Serialization.External;
|
||||
using OpenSim.Tests.Common;
|
||||
|
||||
namespace OpenSim.Framework.Serialization.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class RegionSettingsSerializerTests
|
||||
{
|
||||
private string m_serializedRs = @"<?xml version=""1.0"" encoding=""utf-16""?>
|
||||
<RegionSettings>
|
||||
<General>
|
||||
<AllowDamage>True</AllowDamage>
|
||||
<AllowLandResell>True</AllowLandResell>
|
||||
<AllowLandJoinDivide>True</AllowLandJoinDivide>
|
||||
<BlockFly>True</BlockFly>
|
||||
<BlockLandShowInSearch>True</BlockLandShowInSearch>
|
||||
<BlockTerraform>True</BlockTerraform>
|
||||
<DisableCollisions>True</DisableCollisions>
|
||||
<DisablePhysics>True</DisablePhysics>
|
||||
<DisableScripts>True</DisableScripts>
|
||||
<MaturityRating>1</MaturityRating>
|
||||
<RestrictPushing>True</RestrictPushing>
|
||||
<AgentLimit>40</AgentLimit>
|
||||
<ObjectBonus>1.4</ObjectBonus>
|
||||
</General>
|
||||
<GroundTextures>
|
||||
<Texture1>00000000-0000-0000-0000-000000000020</Texture1>
|
||||
<Texture2>00000000-0000-0000-0000-000000000040</Texture2>
|
||||
<Texture3>00000000-0000-0000-0000-000000000060</Texture3>
|
||||
<Texture4>00000000-0000-0000-0000-000000000080</Texture4>
|
||||
<ElevationLowSW>1.9</ElevationLowSW>
|
||||
<ElevationLowNW>15.9</ElevationLowNW>
|
||||
<ElevationLowSE>49</ElevationLowSE>
|
||||
<ElevationLowNE>45.3</ElevationLowNE>
|
||||
<ElevationHighSW>2.1</ElevationHighSW>
|
||||
<ElevationHighNW>4.5</ElevationHighNW>
|
||||
<ElevationHighSE>9.2</ElevationHighSE>
|
||||
<ElevationHighNE>19.2</ElevationHighNE>
|
||||
</GroundTextures>
|
||||
<Terrain>
|
||||
<WaterHeight>23</WaterHeight>
|
||||
<TerrainRaiseLimit>17.9</TerrainRaiseLimit>
|
||||
<TerrainLowerLimit>0.4</TerrainLowerLimit>
|
||||
<UseEstateSun>True</UseEstateSun>
|
||||
<FixedSun>true</FixedSun>
|
||||
<SunPosition>12</SunPosition>
|
||||
</Terrain>
|
||||
</RegionSettings>";
|
||||
|
||||
private RegionSettings m_rs;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
m_rs = new RegionSettings();
|
||||
m_rs.AgentLimit = 17;
|
||||
m_rs.AllowDamage = true;
|
||||
m_rs.AllowLandJoinDivide = true;
|
||||
m_rs.AllowLandResell = true;
|
||||
m_rs.BlockFly = true;
|
||||
m_rs.BlockShowInSearch = true;
|
||||
m_rs.BlockTerraform = true;
|
||||
m_rs.DisableCollisions = true;
|
||||
m_rs.DisablePhysics = true;
|
||||
m_rs.DisableScripts = true;
|
||||
m_rs.Elevation1NW = 15.9;
|
||||
m_rs.Elevation1NE = 45.3;
|
||||
m_rs.Elevation1SE = 49;
|
||||
m_rs.Elevation1SW = 1.9;
|
||||
m_rs.Elevation2NW = 4.5;
|
||||
m_rs.Elevation2NE = 19.2;
|
||||
m_rs.Elevation2SE = 9.2;
|
||||
m_rs.Elevation2SW = 2.1;
|
||||
m_rs.FixedSun = true;
|
||||
m_rs.SunPosition = 12.0;
|
||||
m_rs.ObjectBonus = 1.4;
|
||||
m_rs.RestrictPushing = true;
|
||||
m_rs.TerrainLowerLimit = 0.4;
|
||||
m_rs.TerrainRaiseLimit = 17.9;
|
||||
m_rs.TerrainTexture1 = UUID.Parse("00000000-0000-0000-0000-000000000020");
|
||||
m_rs.TerrainTexture2 = UUID.Parse("00000000-0000-0000-0000-000000000040");
|
||||
m_rs.TerrainTexture3 = UUID.Parse("00000000-0000-0000-0000-000000000060");
|
||||
m_rs.TerrainTexture4 = UUID.Parse("00000000-0000-0000-0000-000000000080");
|
||||
m_rs.UseEstateSun = true;
|
||||
m_rs.WaterHeight = 23;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRegionSettingsDeserialize()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
RegionSettings deserRs = RegionSettingsSerializer.Deserialize(m_serializedRs);
|
||||
Assert.That(deserRs, Is.Not.Null);
|
||||
Assert.That(deserRs.TerrainTexture2, Is.EqualTo(m_rs.TerrainTexture2));
|
||||
Assert.That(deserRs.DisablePhysics, Is.EqualTo(m_rs.DisablePhysics));
|
||||
Assert.That(deserRs.TerrainLowerLimit, Is.EqualTo(m_rs.TerrainLowerLimit));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -251,7 +251,7 @@ namespace OpenSim.Framework.Servers
|
||||
|
||||
sb.Append(threads.Length + " threads are being tracked:" + Environment.NewLine);
|
||||
|
||||
int timeNow = Util.EnvironmentTickCount();
|
||||
int timeNow = Environment.TickCount & Int32.MaxValue;
|
||||
|
||||
sb.AppendFormat(reportFormat, "ID", "NAME", "LAST UPDATE (MS)", "LIFETIME (MS)", "PRIORITY", "STATE");
|
||||
sb.Append(Environment.NewLine);
|
||||
|
||||
@@ -42,15 +42,15 @@ namespace OpenSim.Framework.Statistics
|
||||
{
|
||||
private long abnormalClientThreadTerminations;
|
||||
|
||||
private long assetsInCache;
|
||||
private long texturesInCache;
|
||||
private long assetCacheMemoryUsage;
|
||||
private long textureCacheMemoryUsage;
|
||||
private TimeSpan assetRequestTimeAfterCacheMiss;
|
||||
private long blockedMissingTextureRequests;
|
||||
// private long assetsInCache;
|
||||
// private long texturesInCache;
|
||||
// private long assetCacheMemoryUsage;
|
||||
// private long textureCacheMemoryUsage;
|
||||
// private TimeSpan assetRequestTimeAfterCacheMiss;
|
||||
// private long blockedMissingTextureRequests;
|
||||
|
||||
private long assetServiceRequestFailures;
|
||||
private long inventoryServiceRetrievalFailures;
|
||||
// private long assetServiceRequestFailures;
|
||||
// private long inventoryServiceRetrievalFailures;
|
||||
|
||||
private volatile float timeDilation;
|
||||
private volatile float simFps;
|
||||
@@ -79,27 +79,27 @@ namespace OpenSim.Framework.Statistics
|
||||
/// </summary>
|
||||
public long AbnormalClientThreadTerminations { get { return abnormalClientThreadTerminations; } }
|
||||
|
||||
/// <summary>
|
||||
/// These statistics are being collected by push rather than pull. Pull would be simpler, but I had the
|
||||
/// notion of providing some flow statistics (which pull wouldn't give us). Though admittedly these
|
||||
/// haven't yet been implemented...
|
||||
/// </summary>
|
||||
public long AssetsInCache { get { return assetsInCache; } }
|
||||
|
||||
/// <value>
|
||||
/// Currently unused
|
||||
/// </value>
|
||||
public long TexturesInCache { get { return texturesInCache; } }
|
||||
|
||||
/// <value>
|
||||
/// Currently misleading since we can't currently subtract removed asset memory usage without a performance hit
|
||||
/// </value>
|
||||
public long AssetCacheMemoryUsage { get { return assetCacheMemoryUsage; } }
|
||||
|
||||
/// <value>
|
||||
/// Currently unused
|
||||
/// </value>
|
||||
public long TextureCacheMemoryUsage { get { return textureCacheMemoryUsage; } }
|
||||
// /// <summary>
|
||||
// /// These statistics are being collected by push rather than pull. Pull would be simpler, but I had the
|
||||
// /// notion of providing some flow statistics (which pull wouldn't give us). Though admittedly these
|
||||
// /// haven't yet been implemented...
|
||||
// /// </summary>
|
||||
// public long AssetsInCache { get { return assetsInCache; } }
|
||||
//
|
||||
// /// <value>
|
||||
// /// Currently unused
|
||||
// /// </value>
|
||||
// public long TexturesInCache { get { return texturesInCache; } }
|
||||
//
|
||||
// /// <value>
|
||||
// /// Currently misleading since we can't currently subtract removed asset memory usage without a performance hit
|
||||
// /// </value>
|
||||
// public long AssetCacheMemoryUsage { get { return assetCacheMemoryUsage; } }
|
||||
//
|
||||
// /// <value>
|
||||
// /// Currently unused
|
||||
// /// </value>
|
||||
// public long TextureCacheMemoryUsage { get { return textureCacheMemoryUsage; } }
|
||||
|
||||
public float TimeDilation { get { return timeDilation; } }
|
||||
public float SimFps { get { return simFps; } }
|
||||
@@ -123,32 +123,33 @@ namespace OpenSim.Framework.Statistics
|
||||
public float ActiveScripts { get { return activeScripts; } }
|
||||
public float ScriptLinesPerSecond { get { return scriptLinesPerSecond; } }
|
||||
|
||||
/// <summary>
|
||||
/// This is the time it took for the last asset request made in response to a cache miss.
|
||||
/// </summary>
|
||||
public TimeSpan AssetRequestTimeAfterCacheMiss { get { return assetRequestTimeAfterCacheMiss; } }
|
||||
|
||||
/// <summary>
|
||||
/// Number of persistent requests for missing textures we have started blocking from clients. To some extent
|
||||
/// this is just a temporary statistic to keep this problem in view - the root cause of this lies either
|
||||
/// in a mishandling of the reply protocol, related to avatar appearance or may even originate in graphics
|
||||
/// driver bugs on clients (though this seems less likely).
|
||||
/// </summary>
|
||||
public long BlockedMissingTextureRequests { get { return blockedMissingTextureRequests; } }
|
||||
|
||||
/// <summary>
|
||||
/// Record the number of times that an asset request has failed. Failures are effectively exceptions, such as
|
||||
/// request timeouts. If an asset service replies that a particular asset cannot be found, this is not counted
|
||||
/// as a failure
|
||||
/// </summary>
|
||||
public long AssetServiceRequestFailures { get { return assetServiceRequestFailures; } }
|
||||
// /// <summary>
|
||||
// /// This is the time it took for the last asset request made in response to a cache miss.
|
||||
// /// </summary>
|
||||
// public TimeSpan AssetRequestTimeAfterCacheMiss { get { return assetRequestTimeAfterCacheMiss; } }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Number of persistent requests for missing textures we have started blocking from clients. To some extent
|
||||
// /// this is just a temporary statistic to keep this problem in view - the root cause of this lies either
|
||||
// /// in a mishandling of the reply protocol, related to avatar appearance or may even originate in graphics
|
||||
// /// driver bugs on clients (though this seems less likely).
|
||||
// /// </summary>
|
||||
// public long BlockedMissingTextureRequests { get { return blockedMissingTextureRequests; } }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Record the number of times that an asset request has failed. Failures are effectively exceptions, such as
|
||||
// /// request timeouts. If an asset service replies that a particular asset cannot be found, this is not counted
|
||||
// /// as a failure
|
||||
// /// </summary>
|
||||
// public long AssetServiceRequestFailures { get { return assetServiceRequestFailures; } }
|
||||
|
||||
/// <summary>
|
||||
/// Number of known failures to retrieve avatar inventory from the inventory service. This does not
|
||||
/// cover situations where the inventory service accepts the request but never returns any data, since
|
||||
/// we do not yet timeout this situation.
|
||||
/// </summary>
|
||||
public long InventoryServiceRetrievalFailures { get { return inventoryServiceRetrievalFailures; } }
|
||||
/// <remarks>Commented out because we do not cache inventory at this point</remarks>
|
||||
// public long InventoryServiceRetrievalFailures { get { return inventoryServiceRetrievalFailures; } }
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the total frame time (in ms) of the last frame
|
||||
@@ -171,58 +172,58 @@ namespace OpenSim.Framework.Statistics
|
||||
abnormalClientThreadTerminations++;
|
||||
}
|
||||
|
||||
public void AddAsset(AssetBase asset)
|
||||
{
|
||||
assetsInCache++;
|
||||
//assetCacheMemoryUsage += asset.Data.Length;
|
||||
}
|
||||
|
||||
public void RemoveAsset(UUID uuid)
|
||||
{
|
||||
assetsInCache--;
|
||||
}
|
||||
// public void AddAsset(AssetBase asset)
|
||||
// {
|
||||
// assetsInCache++;
|
||||
// //assetCacheMemoryUsage += asset.Data.Length;
|
||||
// }
|
||||
//
|
||||
// public void RemoveAsset(UUID uuid)
|
||||
// {
|
||||
// assetsInCache--;
|
||||
// }
|
||||
//
|
||||
// public void AddTexture(AssetBase image)
|
||||
// {
|
||||
// if (image.Data != null)
|
||||
// {
|
||||
// texturesInCache++;
|
||||
//
|
||||
// // This could have been a pull stat, though there was originally a nebulous idea to measure flow rates
|
||||
// textureCacheMemoryUsage += image.Data.Length;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Signal that the asset cache has been cleared.
|
||||
// /// </summary>
|
||||
// public void ClearAssetCacheStatistics()
|
||||
// {
|
||||
// assetsInCache = 0;
|
||||
// assetCacheMemoryUsage = 0;
|
||||
// texturesInCache = 0;
|
||||
// textureCacheMemoryUsage = 0;
|
||||
// }
|
||||
//
|
||||
// public void AddAssetRequestTimeAfterCacheMiss(TimeSpan ts)
|
||||
// {
|
||||
// assetRequestTimeAfterCacheMiss = ts;
|
||||
// }
|
||||
//
|
||||
// public void AddBlockedMissingTextureRequest()
|
||||
// {
|
||||
// blockedMissingTextureRequests++;
|
||||
// }
|
||||
//
|
||||
// public void AddAssetServiceRequestFailure()
|
||||
// {
|
||||
// assetServiceRequestFailures++;
|
||||
// }
|
||||
|
||||
public void AddTexture(AssetBase image)
|
||||
{
|
||||
if (image.Data != null)
|
||||
{
|
||||
texturesInCache++;
|
||||
|
||||
// This could have been a pull stat, though there was originally a nebulous idea to measure flow rates
|
||||
textureCacheMemoryUsage += image.Data.Length;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Signal that the asset cache has been cleared.
|
||||
/// </summary>
|
||||
public void ClearAssetCacheStatistics()
|
||||
{
|
||||
assetsInCache = 0;
|
||||
assetCacheMemoryUsage = 0;
|
||||
texturesInCache = 0;
|
||||
textureCacheMemoryUsage = 0;
|
||||
}
|
||||
|
||||
public void AddAssetRequestTimeAfterCacheMiss(TimeSpan ts)
|
||||
{
|
||||
assetRequestTimeAfterCacheMiss = ts;
|
||||
}
|
||||
|
||||
public void AddBlockedMissingTextureRequest()
|
||||
{
|
||||
blockedMissingTextureRequests++;
|
||||
}
|
||||
|
||||
public void AddAssetServiceRequestFailure()
|
||||
{
|
||||
assetServiceRequestFailures++;
|
||||
}
|
||||
|
||||
public void AddInventoryServiceRetrievalFailure()
|
||||
{
|
||||
inventoryServiceRetrievalFailures++;
|
||||
}
|
||||
// public void AddInventoryServiceRetrievalFailure()
|
||||
// {
|
||||
// inventoryServiceRetrievalFailures++;
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// Register as a packet queue stats provider
|
||||
@@ -290,8 +291,8 @@ namespace OpenSim.Framework.Statistics
|
||||
public override string Report()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(Environment.NewLine);
|
||||
sb.Append("ASSET STATISTICS");
|
||||
sb.Append(Environment.NewLine);
|
||||
// sb.Append("ASSET STATISTICS");
|
||||
// sb.Append(Environment.NewLine);
|
||||
|
||||
/*
|
||||
sb.Append(
|
||||
@@ -307,7 +308,8 @@ Asset service request failures: {6}"+ Environment.NewLine,
|
||||
BlockedMissingTextureRequests,
|
||||
AssetServiceRequestFailures));
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
sb.Append(
|
||||
string.Format(
|
||||
@"Asset cache contains {0,6} assets
|
||||
@@ -318,7 +320,7 @@ Asset service request failures: {3}" + Environment.NewLine,
|
||||
assetRequestTimeAfterCacheMiss.Milliseconds / 1000.0,
|
||||
BlockedMissingTextureRequests,
|
||||
AssetServiceRequestFailures));
|
||||
|
||||
*/
|
||||
|
||||
sb.Append(Environment.NewLine);
|
||||
sb.Append("CONNECTION STATISTICS");
|
||||
@@ -328,13 +330,13 @@ Asset service request failures: {3}" + Environment.NewLine,
|
||||
"Abnormal client thread terminations: {0}" + Environment.NewLine,
|
||||
abnormalClientThreadTerminations));
|
||||
|
||||
sb.Append(Environment.NewLine);
|
||||
sb.Append("INVENTORY STATISTICS");
|
||||
sb.Append(Environment.NewLine);
|
||||
sb.Append(
|
||||
string.Format(
|
||||
"Initial inventory caching failures: {0}" + Environment.NewLine,
|
||||
InventoryServiceRetrievalFailures));
|
||||
// sb.Append(Environment.NewLine);
|
||||
// sb.Append("INVENTORY STATISTICS");
|
||||
// sb.Append(Environment.NewLine);
|
||||
// sb.Append(
|
||||
// string.Format(
|
||||
// "Initial inventory caching failures: {0}" + Environment.NewLine,
|
||||
// InventoryServiceRetrievalFailures));
|
||||
|
||||
sb.Append(Environment.NewLine);
|
||||
sb.Append("FRAME STATISTICS");
|
||||
@@ -390,17 +392,17 @@ Asset service request failures: {3}" + Environment.NewLine,
|
||||
public override string XReport(string uptime, string version)
|
||||
{
|
||||
OSDMap args = new OSDMap(30);
|
||||
args["AssetsInCache"] = OSD.FromString (String.Format ("{0:0.##}", AssetsInCache));
|
||||
args["TimeAfterCacheMiss"] = OSD.FromString (String.Format ("{0:0.##}",
|
||||
assetRequestTimeAfterCacheMiss.Milliseconds / 1000.0));
|
||||
args["BlockedMissingTextureRequests"] = OSD.FromString (String.Format ("{0:0.##}",
|
||||
BlockedMissingTextureRequests));
|
||||
args["AssetServiceRequestFailures"] = OSD.FromString (String.Format ("{0:0.##}",
|
||||
AssetServiceRequestFailures));
|
||||
args["abnormalClientThreadTerminations"] = OSD.FromString (String.Format ("{0:0.##}",
|
||||
abnormalClientThreadTerminations));
|
||||
args["InventoryServiceRetrievalFailures"] = OSD.FromString (String.Format ("{0:0.##}",
|
||||
InventoryServiceRetrievalFailures));
|
||||
// args["AssetsInCache"] = OSD.FromString (String.Format ("{0:0.##}", AssetsInCache));
|
||||
// args["TimeAfterCacheMiss"] = OSD.FromString (String.Format ("{0:0.##}",
|
||||
// assetRequestTimeAfterCacheMiss.Milliseconds / 1000.0));
|
||||
// args["BlockedMissingTextureRequests"] = OSD.FromString (String.Format ("{0:0.##}",
|
||||
// BlockedMissingTextureRequests));
|
||||
// args["AssetServiceRequestFailures"] = OSD.FromString (String.Format ("{0:0.##}",
|
||||
// AssetServiceRequestFailures));
|
||||
// args["abnormalClientThreadTerminations"] = OSD.FromString (String.Format ("{0:0.##}",
|
||||
// abnormalClientThreadTerminations));
|
||||
// args["InventoryServiceRetrievalFailures"] = OSD.FromString (String.Format ("{0:0.##}",
|
||||
// InventoryServiceRetrievalFailures));
|
||||
args["Dilatn"] = OSD.FromString (String.Format ("{0:0.##}", timeDilation));
|
||||
args["SimFPS"] = OSD.FromString (String.Format ("{0:0.##}", simFps));
|
||||
args["PhyFPS"] = OSD.FromString (String.Format ("{0:0.##}", physicsFps));
|
||||
|
||||
@@ -64,7 +64,8 @@ namespace OpenSim.Framework
|
||||
private UUID _permsGranter;
|
||||
private int _permsMask;
|
||||
private int _type = 0;
|
||||
private UUID _oldID = UUID.Zero;
|
||||
private UUID _oldID;
|
||||
private UUID _loadedID = UUID.Zero;
|
||||
|
||||
private bool _ownerChanged = false;
|
||||
|
||||
@@ -234,6 +235,15 @@ namespace OpenSim.Framework
|
||||
}
|
||||
}
|
||||
|
||||
public UUID LoadedItemID {
|
||||
get {
|
||||
return _loadedID;
|
||||
}
|
||||
set {
|
||||
_loadedID = value;
|
||||
}
|
||||
}
|
||||
|
||||
public UUID LastOwnerID {
|
||||
get {
|
||||
return _lastOwnerID;
|
||||
@@ -359,8 +369,8 @@ namespace OpenSim.Framework
|
||||
/// <param name="partID">The new part ID to which this item belongs</param>
|
||||
public void ResetIDs(UUID partID)
|
||||
{
|
||||
if (_oldID == UUID.Zero)
|
||||
_oldID = ItemID;
|
||||
LoadedItemID = OldItemID;
|
||||
OldItemID = ItemID;
|
||||
ItemID = UUID.Random();
|
||||
ParentPartID = partID;
|
||||
ParentID = partID;
|
||||
|
||||
@@ -1676,13 +1676,14 @@ namespace OpenSim.Framework
|
||||
/// </summary>
|
||||
public static void PrintCallStack()
|
||||
{
|
||||
StackTrace stackTrace = new StackTrace(); // get call stack
|
||||
StackTrace stackTrace = new StackTrace(true); // get call stack
|
||||
StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames)
|
||||
|
||||
// write call stack method names
|
||||
foreach (StackFrame stackFrame in stackFrames)
|
||||
{
|
||||
m_log.Debug(stackFrame.GetMethod().DeclaringType + "." + stackFrame.GetMethod().Name); // write method name
|
||||
MethodBase mb = stackFrame.GetMethod();
|
||||
m_log.DebugFormat("{0}.{1}:{2}", mb.DeclaringType, mb.Name, stackFrame.GetFileLineNumber()); // write method name
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -107,15 +107,13 @@ namespace OpenSim
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat("Master ini file {0} not found", masterFilePath);
|
||||
m_log.ErrorFormat("Master ini file {0} not found", Path.GetFullPath(masterFilePath));
|
||||
Environment.Exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
string iniFileName =
|
||||
startupConfig.GetString("inifile", "OpenSim.ini");
|
||||
string iniFileName = startupConfig.GetString("inifile", "OpenSim.ini");
|
||||
|
||||
if (IsUri(iniFileName))
|
||||
{
|
||||
@@ -131,8 +129,7 @@ namespace OpenSim
|
||||
if (!File.Exists(Application.iniFilePath))
|
||||
{
|
||||
iniFileName = "OpenSim.xml";
|
||||
Application.iniFilePath = Path.GetFullPath(
|
||||
Path.Combine(Util.configDir(), iniFileName));
|
||||
Application.iniFilePath = Path.GetFullPath(Path.Combine(Util.configDir(), iniFileName));
|
||||
}
|
||||
|
||||
if (File.Exists(Application.iniFilePath))
|
||||
@@ -142,15 +139,12 @@ namespace OpenSim
|
||||
}
|
||||
}
|
||||
|
||||
string iniDirName =
|
||||
startupConfig.GetString("inidirectory", "config");
|
||||
string iniDirPath =
|
||||
Path.Combine(Util.configDir(), iniDirName);
|
||||
string iniDirName = startupConfig.GetString("inidirectory", "config");
|
||||
string iniDirPath = Path.Combine(Util.configDir(), iniDirName);
|
||||
|
||||
if (Directory.Exists(iniDirPath))
|
||||
{
|
||||
m_log.InfoFormat("Searching folder {0} for config ini files",
|
||||
iniDirPath);
|
||||
m_log.InfoFormat("Searching folder {0} for config ini files", iniDirPath);
|
||||
|
||||
string[] fileEntries = Directory.GetFiles(iniDirName);
|
||||
foreach (string filePath in fileEntries)
|
||||
@@ -172,7 +166,6 @@ namespace OpenSim
|
||||
if (sources.Count == 0)
|
||||
{
|
||||
m_log.FatalFormat("[CONFIG]: Could not load any configuration");
|
||||
m_log.FatalFormat("[CONFIG]: Did you copy the OpenSimDefaults.ini.example file to OpenSimDefaults.ini?");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -250,8 +250,10 @@ 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("region", false, "debug scene",
|
||||
"debug scene <cripting> <collisions> <physics>",
|
||||
"debug scene <scripting> <collisions> <physics>",
|
||||
"Turn on scene debugging", Debug);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "change region",
|
||||
@@ -289,12 +291,16 @@ namespace OpenSim
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "save oar",
|
||||
//"save oar [-v|--version=<N>] [-p|--profile=<url>] [<OAR path>]",
|
||||
"save oar [-p|--profile=<url>] [--noassets] [--perm=<permissions>] [<OAR path>]",
|
||||
"save oar [-h|--home=<url>] [--noassets] [--publish] [--perm=<permissions>] [<OAR path>]",
|
||||
"Save a region's data to an OAR archive.",
|
||||
// "-v|--version=<N> generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine
|
||||
"-p|--profile=<url> adds the url of the profile service to the saved user information." + Environment.NewLine
|
||||
"-h|--home=<url> adds the url of the profile service to the saved user information." + Environment.NewLine
|
||||
+ "--noassets stops assets being saved to the OAR." + Environment.NewLine
|
||||
+ "--perm stops objects with insufficient permissions from being saved to the OAR." + Environment.NewLine
|
||||
+ "--publish saves an OAR stripped of owner and last owner information." + Environment.NewLine
|
||||
+ " on reload, the estate owner will be the owner of all objects" + Environment.NewLine
|
||||
+ " this is useful if you're making oars generally available that might be reloaded to the same grid from which you published" + Environment.NewLine
|
||||
+ " this option is EXPERIMENTAL" + Environment.NewLine
|
||||
+ "--perm=<permissions> stops objects with insufficient permissions from being saved to the OAR." + Environment.NewLine
|
||||
+ " <permissions> can contain one or more of these characters: \"C\" = Copy, \"T\" = Transfer" + Environment.NewLine
|
||||
+ "The OAR path must be a filesystem path."
|
||||
+ " If this is not given then the oar is saved to region.oar in the current directory.",
|
||||
@@ -948,6 +954,21 @@ namespace OpenSim
|
||||
|
||||
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;
|
||||
|
||||
@@ -211,16 +211,16 @@ namespace OpenSim
|
||||
// Load the simulation data service
|
||||
IConfig simDataConfig = m_config.Source.Configs["SimulationDataStore"];
|
||||
if (simDataConfig == null)
|
||||
throw new Exception("Configuration file is missing the [SimulationDataStore] section");
|
||||
throw new Exception("Configuration file is missing the [SimulationDataStore] section. Have you copied OpenSim.ini.example to OpenSim.ini to reference config-include/ files?");
|
||||
string module = simDataConfig.GetString("LocalServiceModule", String.Empty);
|
||||
if (String.IsNullOrEmpty(module))
|
||||
throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [SimulationDataStore] section");
|
||||
throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [SimulationDataStore] section.");
|
||||
m_simulationDataService = ServerUtils.LoadPlugin<ISimulationDataService>(module, new object[] { m_config.Source });
|
||||
|
||||
// Load the estate data service
|
||||
IConfig estateDataConfig = m_config.Source.Configs["EstateDataStore"];
|
||||
if (estateDataConfig == null)
|
||||
throw new Exception("Configuration file is missing the [EstateDataStore] section");
|
||||
throw new Exception("Configuration file is missing the [EstateDataStore] section. Have you copied OpenSim.ini.example to OpenSim.ini to reference config-include/ files?");
|
||||
module = estateDataConfig.GetString("LocalServiceModule", String.Empty);
|
||||
if (String.IsNullOrEmpty(module))
|
||||
throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [EstateDataStore] section");
|
||||
@@ -432,10 +432,14 @@ namespace OpenSim
|
||||
// TODO : Try setting resource for region xstats here on scene
|
||||
MainServer.Instance.AddStreamHandler(new Region.Framework.Scenes.RegionStatsHandler(regionInfo));
|
||||
|
||||
scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID);
|
||||
scene.EventManager.TriggerParcelPrimCountUpdate();
|
||||
|
||||
if (scene.SnmpService != null)
|
||||
{
|
||||
scene.SnmpService.BootInfo("Grid Registration in progress", scene);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
scene.RegisterRegionWithGrid();
|
||||
@@ -460,9 +464,6 @@ namespace OpenSim
|
||||
scene.SnmpService.BootInfo("Grid Registration done", scene);
|
||||
}
|
||||
|
||||
scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID);
|
||||
scene.EventManager.TriggerParcelPrimCountUpdate();
|
||||
|
||||
// We need to do this after we've initialized the
|
||||
// scripting engines.
|
||||
scene.CreateScriptInstances();
|
||||
|
||||
@@ -94,6 +94,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
private static readonly string m_notecardUpdatePath = "0004/";
|
||||
private static readonly string m_notecardTaskUpdatePath = "0005/";
|
||||
// private static readonly string m_fetchInventoryPath = "0006/";
|
||||
private static readonly string m_copyFromNotecardPath = "0007/";
|
||||
// private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule.
|
||||
|
||||
|
||||
@@ -180,6 +181,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req);
|
||||
m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req);
|
||||
m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req);
|
||||
m_HostCapsObj.RegisterHandler("CopyInventoryFromNotecard", new RestStreamHandler("POST", capsBase + m_copyFromNotecardPath, CopyInventoryFromNotecard));
|
||||
|
||||
// As of RC 1.22.9 of the Linden client this is
|
||||
// supported
|
||||
@@ -366,7 +368,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
if (mm != null)
|
||||
{
|
||||
if (!mm.UploadCovered(client, mm.UploadCharge))
|
||||
if (!mm.UploadCovered(client.AgentId, mm.UploadCharge))
|
||||
{
|
||||
if (client != null)
|
||||
client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
|
||||
@@ -420,7 +422,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
string assetType)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"Uploaded asset {0} for inventory item {1}, inv type {2}, asset type {3}",
|
||||
"[BUNCH OF CAPS]: Uploaded asset {0} for inventory item {1}, inv type {2}, asset type {3}",
|
||||
assetID, inventoryItem, inventoryType, assetType);
|
||||
|
||||
sbyte assType = 0;
|
||||
@@ -623,7 +625,12 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
item.AssetType = assType;
|
||||
item.InvType = inType;
|
||||
item.Folder = parentFolder;
|
||||
item.CurrentPermissions = (uint)PermissionMask.All;
|
||||
|
||||
// If we set PermissionMask.All then when we rez the item the next permissions will replace the current
|
||||
// (owner) permissions. This becomes a problem if next permissions are changed.
|
||||
item.CurrentPermissions
|
||||
= (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer);
|
||||
|
||||
item.BasePermissions = (uint)PermissionMask.All;
|
||||
item.EveryOnePermissions = 0;
|
||||
item.NextPermissions = (uint)PermissionMask.All;
|
||||
@@ -723,6 +730,75 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
return LLSDHelpers.SerialiseLLSDReply(uploadResponse);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called by the CopyInventoryFromNotecard caps handler.
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="param"></param>
|
||||
public string CopyInventoryFromNotecard(string request, string path, string param,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
Hashtable response = new Hashtable();
|
||||
response["int_response_code"] = 404;
|
||||
response["content_type"] = "text/plain";
|
||||
response["keepalive"] = false;
|
||||
response["str_response_string"] = "";
|
||||
|
||||
try
|
||||
{
|
||||
OSDMap content = (OSDMap)OSDParser.DeserializeLLSDXml(request);
|
||||
UUID objectID = content["object-id"].AsUUID();
|
||||
UUID notecardID = content["notecard-id"].AsUUID();
|
||||
UUID folderID = content["folder-id"].AsUUID();
|
||||
UUID itemID = content["item-id"].AsUUID();
|
||||
|
||||
// m_log.InfoFormat("[CAPS]: CopyInventoryFromNotecard, FolderID:{0}, ItemID:{1}, NotecardID:{2}, ObjectID:{3}", folderID, itemID, notecardID, objectID);
|
||||
|
||||
if (objectID != UUID.Zero)
|
||||
{
|
||||
SceneObjectPart part = m_Scene.GetSceneObjectPart(objectID);
|
||||
if (part != null)
|
||||
{
|
||||
TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(notecardID);
|
||||
if (!m_Scene.Permissions.CanCopyObjectInventory(notecardID, objectID, m_HostCapsObj.AgentID))
|
||||
{
|
||||
return LLSDHelpers.SerialiseLLSDReply(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
InventoryItemBase item = null;
|
||||
InventoryItemBase copyItem = null;
|
||||
IClientAPI client = null;
|
||||
|
||||
m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client);
|
||||
item = m_Scene.InventoryService.GetItem(new InventoryItemBase(itemID));
|
||||
if (item != null)
|
||||
{
|
||||
copyItem = m_Scene.GiveInventoryItem(m_HostCapsObj.AgentID, item.Owner, itemID, folderID);
|
||||
if (copyItem != null && client != null)
|
||||
{
|
||||
m_log.InfoFormat("[CAPS]: CopyInventoryFromNotecard, ItemID:{0}, FolderID:{1}", copyItem.ID, copyItem.Folder);
|
||||
client.SendBulkUpdateInventory(copyItem);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat("[CAPS]: CopyInventoryFromNotecard - Failed to retrieve item {0} from notecard {1}", itemID, notecardID);
|
||||
if (client != null)
|
||||
client.SendAlertMessage("Failed to retrieve item");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[CAPS]: CopyInventoryFromNotecard : {0}", e.ToString());
|
||||
}
|
||||
|
||||
response["int_response_code"] = 200;
|
||||
return LLSDHelpers.SerialiseLLSDReply(response);
|
||||
}
|
||||
}
|
||||
|
||||
public class AssetUploader
|
||||
@@ -1018,4 +1094,4 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
fs.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
151
OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs
Normal file
151
OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs
Normal file
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
* 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;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using Mono.Addins;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
using OpenSim.Capabilities.Handlers;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
/// <summary>
|
||||
/// This module implements both WebFetchInventoryDescendents and FetchInventoryDescendents2 capabilities.
|
||||
/// </summary>
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class FetchInventory2Module : INonSharedRegionModule
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public bool Enabled { get; private set; }
|
||||
|
||||
private Scene m_scene;
|
||||
|
||||
private IInventoryService m_inventoryService;
|
||||
|
||||
private string m_fetchInventory2Url;
|
||||
|
||||
private FetchInventory2Handler m_fetchHandler;
|
||||
|
||||
#region ISharedRegionModule Members
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
IConfig config = source.Configs["ClientStack.LindenCaps"];
|
||||
if (config == null)
|
||||
return;
|
||||
|
||||
m_fetchInventory2Url = config.GetString("Cap_FetchInventory2", string.Empty);
|
||||
|
||||
if (m_fetchInventory2Url != string.Empty)
|
||||
Enabled = true;
|
||||
}
|
||||
|
||||
public void AddRegion(Scene s)
|
||||
{
|
||||
if (!Enabled)
|
||||
return;
|
||||
|
||||
m_scene = s;
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene s)
|
||||
{
|
||||
if (!Enabled)
|
||||
return;
|
||||
|
||||
m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
|
||||
m_scene = null;
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene s)
|
||||
{
|
||||
if (!Enabled)
|
||||
return;
|
||||
|
||||
m_inventoryService = m_scene.InventoryService;
|
||||
|
||||
// We'll reuse the same handler for all requests.
|
||||
if (m_fetchInventory2Url == "localhost")
|
||||
m_fetchHandler = new FetchInventory2Handler(m_inventoryService);
|
||||
|
||||
m_scene.EventManager.OnRegisterCaps += RegisterCaps;
|
||||
}
|
||||
|
||||
public void PostInitialise() {}
|
||||
|
||||
public void Close() {}
|
||||
|
||||
public string Name { get { return "FetchInventory2Module"; } }
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void RegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
RegisterFetchCap(agentID, caps, "FetchInventory2", m_fetchInventory2Url);
|
||||
}
|
||||
|
||||
private void RegisterFetchCap(UUID agentID, Caps caps, string capName, string url)
|
||||
{
|
||||
string capUrl;
|
||||
|
||||
if (url == "localhost")
|
||||
{
|
||||
capUrl = "/CAPS/" + UUID.Random();
|
||||
|
||||
IRequestHandler reqHandler
|
||||
= new RestStreamHandler("POST", capUrl, m_fetchHandler.FetchInventoryRequest);
|
||||
|
||||
caps.RegisterHandler(capName, reqHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
capUrl = url;
|
||||
|
||||
caps.RegisterHandler(capName, capUrl);
|
||||
}
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[FETCH INVENTORY2 MODULE]: Registered capability {0} at {1} in region {2} for {3}",
|
||||
// capName, capUrl, m_scene.RegionInfo.RegionName, agentID);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,8 +50,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class NewFileAgentInventoryVariablePriceModule : INonSharedRegionModule
|
||||
{
|
||||
// private static readonly ILog m_log =
|
||||
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_scene;
|
||||
// private IAssetService m_assetService;
|
||||
@@ -147,7 +146,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
if (m_scene.TryGetClient(agentID, out client))
|
||||
{
|
||||
if (!mm.UploadCovered(client, mm.UploadCharge))
|
||||
if (!mm.UploadCovered(client.AgentId, mm.UploadCharge))
|
||||
{
|
||||
if (client != null)
|
||||
client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
|
||||
@@ -210,6 +209,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType,
|
||||
string assetType,UUID AgentID)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[NEW FILE AGENT INVENTORY VARIABLE PRICE MODULE]: Upload complete for {0}", inventoryItem);
|
||||
|
||||
sbyte assType = 0;
|
||||
sbyte inType = 0;
|
||||
|
||||
@@ -259,13 +261,13 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
item.AssetType = assType;
|
||||
item.InvType = inType;
|
||||
item.Folder = parentFolder;
|
||||
item.CurrentPermissions = (uint)PermissionMask.All;
|
||||
item.CurrentPermissions
|
||||
= (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer);
|
||||
item.BasePermissions = (uint)PermissionMask.All;
|
||||
item.EveryOnePermissions = 0;
|
||||
item.NextPermissions = (uint)PermissionMask.All;
|
||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
m_scene.AddInventoryItem(item);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,7 +339,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
m_scene.AddSceneObject(grp);
|
||||
grp.AbsolutePosition = obj.Position;
|
||||
}
|
||||
|
||||
|
||||
allparts[i] = grp;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
private const int IMAGE_PACKET_SIZE = 1000;
|
||||
private const int FIRST_PACKET_SIZE = 600;
|
||||
|
||||
/// <summary>
|
||||
/// If we've requested an asset but not received it in this ticks timeframe, then allow a duplicate
|
||||
/// request from the client to trigger a fresh asset request.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// There are 10,000 ticks in a millisecond
|
||||
/// </remarks>
|
||||
private const int ASSET_REQUEST_TIMEOUT = 100000000;
|
||||
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public uint LastSequence;
|
||||
@@ -57,8 +66,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
public UUID AgentID;
|
||||
public IInventoryAccessModule InventoryAccessModule;
|
||||
private OpenJPEG.J2KLayerInfo[] m_layers;
|
||||
|
||||
/// <summary>
|
||||
/// Has this request decoded the asset data?
|
||||
/// </summary>
|
||||
public bool IsDecoded { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Has this request received the required asset data?
|
||||
/// </summary>
|
||||
public bool HasAsset { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Time in milliseconds at which the asset was requested.
|
||||
/// </summary>
|
||||
public long AssetRequestTime { get; private set; }
|
||||
|
||||
public C5.IPriorityQueueHandle<J2KImage> PriorityQueueHandle;
|
||||
|
||||
private uint m_currentPacket;
|
||||
@@ -82,7 +105,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
/// <param name="packetsToSend">Maximum number of packets to send during this call</param>
|
||||
/// <param name="packetsSent">Number of packets sent during this call</param>
|
||||
/// <returns>True if the transfer completes at the current discard level, otherwise false</returns>
|
||||
public bool SendPackets(LLClientView client, int packetsToSend, out int packetsSent)
|
||||
public bool SendPackets(IClientAPI client, int packetsToSend, out int packetsSent)
|
||||
{
|
||||
packetsSent = 0;
|
||||
|
||||
@@ -123,10 +146,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
if (!HasAsset)
|
||||
{
|
||||
if (!m_assetRequested)
|
||||
if (!m_assetRequested || DateTime.UtcNow.Ticks > AssetRequestTime + ASSET_REQUEST_TIMEOUT)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[J2KIMAGE]: Requesting asset {0} from request in packet {1}, already requested? {2}, due to timeout? {3}",
|
||||
// TextureID, LastSequence, m_assetRequested, DateTime.UtcNow.Ticks > AssetRequestTime + ASSET_REQUEST_TIMEOUT);
|
||||
|
||||
m_assetRequested = true;
|
||||
// m_log.DebugFormat("[J2KIMAGE]: Requesting asset {0}", TextureID);
|
||||
AssetRequestTime = DateTime.UtcNow.Ticks;
|
||||
|
||||
AssetService.Get(TextureID.ToString(), this, AssetReceived);
|
||||
}
|
||||
}
|
||||
@@ -215,7 +243,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
}
|
||||
|
||||
private bool SendFirstPacket(LLClientView client)
|
||||
private bool SendFirstPacket(IClientAPI client)
|
||||
{
|
||||
if (client == null)
|
||||
return false;
|
||||
@@ -250,7 +278,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool SendPacket(LLClientView client)
|
||||
private bool SendPacket(IClientAPI client)
|
||||
{
|
||||
if (client == null)
|
||||
return false;
|
||||
@@ -380,6 +408,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
private void AssetReceived(string id, Object sender, AssetBase asset)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[J2KIMAGE]: Received asset {0} ({1} bytes)", id, asset != null ? asset.Data.Length.ToString() : "n/a");
|
||||
|
||||
UUID assetID = UUID.Zero;
|
||||
if (asset != null)
|
||||
{
|
||||
|
||||
@@ -220,6 +220,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
public event BakeTerrain OnBakeTerrain;
|
||||
public event RequestTerrain OnUploadTerrain;
|
||||
public event EstateChangeInfo OnEstateChangeInfo;
|
||||
public event EstateManageTelehub OnEstateManageTelehub;
|
||||
public event EstateRestartSimRequest OnEstateRestartSimRequest;
|
||||
public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest;
|
||||
public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest;
|
||||
@@ -306,6 +307,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
protected static Dictionary<PacketType, PacketMethod> PacketHandlers = new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients
|
||||
|
||||
/// <summary>
|
||||
/// Handles UDP texture download.
|
||||
/// </summary>
|
||||
public LLImageManager ImageManager { get; private set; }
|
||||
|
||||
private readonly LLUDPServer m_udpServer;
|
||||
private readonly LLUDPClient m_udpClient;
|
||||
private readonly UUID m_sessionId;
|
||||
@@ -351,7 +357,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>();
|
||||
protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers
|
||||
protected Scene m_scene;
|
||||
private LLImageManager m_imageManager;
|
||||
protected string m_firstName;
|
||||
protected string m_lastName;
|
||||
protected Thread m_clientThread;
|
||||
@@ -470,7 +475,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
m_assetService = m_scene.RequestModuleInterface<IAssetService>();
|
||||
m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>();
|
||||
m_imageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface<IJ2KDecoder>());
|
||||
ImageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface<IJ2KDecoder>());
|
||||
m_channelVersion = Util.StringToBytes256(scene.GetSimulatorVersion());
|
||||
m_agentId = agentId;
|
||||
m_sessionId = sessionId;
|
||||
@@ -522,7 +527,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
IsActive = false;
|
||||
|
||||
// Shutdown the image manager
|
||||
m_imageManager.Close();
|
||||
ImageManager.Close();
|
||||
|
||||
// Fire the callback for this connection closing
|
||||
if (OnConnectionClosed != null)
|
||||
@@ -781,9 +786,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
OutPacket(handshake, ThrottleOutPacketType.Task);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look)
|
||||
{
|
||||
AgentMovementCompletePacket mov = (AgentMovementCompletePacket)PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete);
|
||||
@@ -2764,7 +2766,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
reply.Data.ParcelID = parcelID;
|
||||
reply.Data.OwnerID = land.OwnerID;
|
||||
reply.Data.Name = Utils.StringToBytes(land.Name);
|
||||
reply.Data.Desc = Utils.StringToBytes(land.Description);
|
||||
if (land != null && land.Description != null && land.Description != String.Empty)
|
||||
reply.Data.Desc = Utils.StringToBytes(land.Description.Substring(0, land.Description.Length > 254 ? 254: land.Description.Length));
|
||||
else
|
||||
reply.Data.Desc = new Byte[0];
|
||||
reply.Data.ActualArea = land.Area;
|
||||
reply.Data.BillableArea = land.Area; // TODO: what is this?
|
||||
|
||||
@@ -3493,6 +3498,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[LLCLIENTVIEW]: Sending avatar appearance for {0} with {1} bytes to {2} {3}",
|
||||
// agentID, textureEntry.Length, Name, AgentId);
|
||||
|
||||
AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance);
|
||||
// TODO: don't create new blocks if recycling an old packet
|
||||
avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218];
|
||||
@@ -3514,7 +3523,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs)
|
||||
{
|
||||
//m_log.DebugFormat("[CLIENT]: Sending animations to {0}", Name);
|
||||
// m_log.DebugFormat("[LLCLIENTVIEW]: Sending animations for {0} to {1}", sourceAgentId, Name);
|
||||
|
||||
AvatarAnimationPacket ani = (AvatarAnimationPacket)PacketPool.Instance.GetPacket(PacketType.AvatarAnimation);
|
||||
// TODO: don't create new blocks if recycling an old packet
|
||||
@@ -3549,6 +3558,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
/// </summary>
|
||||
public void SendAvatarDataImmediate(ISceneEntity avatar)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[LLCLIENTVIEW]: Sending immediate object update for avatar {0} {1} to {2} {3}",
|
||||
// avatar.Name, avatar.UUID, Name, AgentId);
|
||||
|
||||
ScenePresence presence = avatar as ScenePresence;
|
||||
if (presence == null)
|
||||
return;
|
||||
@@ -3558,7 +3571,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
objupdate.RegionData.RegionHandle = presence.RegionHandle;
|
||||
objupdate.RegionData.TimeDilation = ushort.MaxValue;
|
||||
|
||||
|
||||
objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
|
||||
objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence);
|
||||
|
||||
@@ -3983,7 +3996,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
|
||||
if ((categories & ThrottleOutPacketTypeFlags.Texture) != 0)
|
||||
m_imageManager.ProcessImageQueue(m_udpServer.TextureSendLimit);
|
||||
ImageManager.ProcessImageQueue(m_udpServer.TextureSendLimit);
|
||||
}
|
||||
|
||||
public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)
|
||||
@@ -4484,7 +4497,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
EstateCovenantReplyPacket einfopack = new EstateCovenantReplyPacket();
|
||||
EstateCovenantReplyPacket.DataBlock edata = new EstateCovenantReplyPacket.DataBlock();
|
||||
edata.CovenantID = covenant;
|
||||
edata.CovenantTimestamp = 0;
|
||||
edata.CovenantTimestamp = (uint) m_scene.RegionInfo.RegionSettings.CovenantChangedDateTime;
|
||||
edata.EstateOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
|
||||
edata.EstateName = Utils.StringToBytes(m_scene.RegionInfo.EstateSettings.EstateName);
|
||||
einfopack.Data = edata;
|
||||
@@ -4492,8 +4505,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
|
||||
public void SendDetailedEstateData(
|
||||
UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition,
|
||||
UUID covenant, string abuseEmail, UUID estateOwner)
|
||||
UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition,
|
||||
UUID covenant, uint covenantChanged, string abuseEmail, UUID estateOwner)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[LLCLIENTVIEW]: Sending detailed estate data to {0} with covenant asset id {1}", Name, covenant);
|
||||
@@ -4518,7 +4531,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
returnblock[4].Parameter = Utils.StringToBytes(sunPosition.ToString());
|
||||
returnblock[5].Parameter = Utils.StringToBytes(parentEstate.ToString());
|
||||
returnblock[6].Parameter = Utils.StringToBytes(covenant.ToString());
|
||||
returnblock[7].Parameter = Utils.StringToBytes("1160895077"); // what is this?
|
||||
returnblock[7].Parameter = Utils.StringToBytes(covenantChanged.ToString());
|
||||
returnblock[8].Parameter = Utils.StringToBytes("1"); // what is this?
|
||||
returnblock[9].Parameter = Utils.StringToBytes(abuseEmail);
|
||||
|
||||
@@ -4528,6 +4541,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
OutPacket(packet, ThrottleOutPacketType.Task);
|
||||
}
|
||||
|
||||
public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List<Vector3> SpawnPoint)
|
||||
{
|
||||
TelehubInfoPacket packet = (TelehubInfoPacket)PacketPool.Instance.GetPacket(PacketType.TelehubInfo);
|
||||
packet.TelehubBlock.ObjectID = ObjectID;
|
||||
packet.TelehubBlock.ObjectName = Utils.StringToBytes(ObjectName);
|
||||
packet.TelehubBlock.TelehubPos = ObjectPos;
|
||||
packet.TelehubBlock.TelehubRot = ObjectRot;
|
||||
|
||||
packet.SpawnPointBlock = new TelehubInfoPacket.SpawnPointBlockBlock[SpawnPoint.Count];
|
||||
for (int n = 0; n < SpawnPoint.Count; n++)
|
||||
{
|
||||
packet.SpawnPointBlock[n] = new TelehubInfoPacket.SpawnPointBlockBlock{SpawnPointPos = SpawnPoint[n]};
|
||||
}
|
||||
|
||||
OutPacket(packet, ThrottleOutPacketType.Task);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Land Data Sending Methods
|
||||
@@ -4603,7 +4633,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
if (landData.SimwideArea > 0)
|
||||
{
|
||||
int simulatorCapacity = (int)((double)(landData.SimwideArea * m_scene.RegionInfo.ObjectCapacity) * m_scene.RegionInfo.RegionSettings.ObjectBonus) / 65536;
|
||||
int simulatorCapacity = (int)((long)landData.SimwideArea * (long)m_scene.RegionInfo.ObjectCapacity * (long)m_scene.RegionInfo.RegionSettings.ObjectBonus / 65536L);
|
||||
// Never report more than sim total capacity
|
||||
if (simulatorCapacity > m_scene.RegionInfo.ObjectCapacity)
|
||||
simulatorCapacity = m_scene.RegionInfo.ObjectCapacity;
|
||||
@@ -4654,7 +4684,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
}
|
||||
|
||||
public void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID)
|
||||
public void SendLandAccessListData(List<LandAccessEntry> accessList, uint accessFlag, int localLandID)
|
||||
{
|
||||
ParcelAccessListReplyPacket replyPacket = (ParcelAccessListReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply);
|
||||
replyPacket.Data.AgentID = AgentId;
|
||||
@@ -4663,12 +4693,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
replyPacket.Data.SequenceID = 0;
|
||||
|
||||
List<ParcelAccessListReplyPacket.ListBlock> list = new List<ParcelAccessListReplyPacket.ListBlock>();
|
||||
foreach (UUID avatar in avatars)
|
||||
foreach (LandAccessEntry entry in accessList)
|
||||
{
|
||||
ParcelAccessListReplyPacket.ListBlock block = new ParcelAccessListReplyPacket.ListBlock();
|
||||
block.Flags = accessFlag;
|
||||
block.ID = avatar;
|
||||
block.Time = 0;
|
||||
block.ID = entry.AgentID;
|
||||
block.Time = entry.Expires;
|
||||
list.Add(block);
|
||||
}
|
||||
|
||||
@@ -5138,7 +5168,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
AddLocalPacketHandler(PacketType.ImprovedInstantMessage, HandlerImprovedInstantMessage, false);
|
||||
AddLocalPacketHandler(PacketType.AcceptFriendship, HandlerAcceptFriendship);
|
||||
AddLocalPacketHandler(PacketType.DeclineFriendship, HandlerDeclineFriendship);
|
||||
AddLocalPacketHandler(PacketType.TerminateFriendship, HandlerTerminateFrendship);
|
||||
AddLocalPacketHandler(PacketType.TerminateFriendship, HandlerTerminateFriendship);
|
||||
AddLocalPacketHandler(PacketType.RezObject, HandlerRezObject);
|
||||
AddLocalPacketHandler(PacketType.DeRezObject, HandlerDeRezObject);
|
||||
AddLocalPacketHandler(PacketType.ModifyLand, HandlerModifyLand);
|
||||
@@ -5861,7 +5891,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool HandlerTerminateFrendship(IClientAPI sender, Packet Pack)
|
||||
private bool HandlerTerminateFriendship(IClientAPI sender, Packet Pack)
|
||||
{
|
||||
TerminateFriendshipPacket tfriendpack = (TerminateFriendshipPacket)Pack;
|
||||
|
||||
@@ -5876,13 +5906,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
UUID listOwnerAgentID = tfriendpack.AgentData.AgentID;
|
||||
UUID exFriendID = tfriendpack.ExBlock.OtherID;
|
||||
|
||||
FriendshipTermination handlerTerminateFriendship = OnTerminateFriendship;
|
||||
if (handlerTerminateFriendship != null)
|
||||
FriendshipTermination TerminateFriendshipHandler = OnTerminateFriendship;
|
||||
if (TerminateFriendshipHandler != null)
|
||||
{
|
||||
handlerTerminateFriendship(this, listOwnerAgentID, exFriendID);
|
||||
TerminateFriendshipHandler(this, listOwnerAgentID, exFriendID);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool HandleFindAgent(IClientAPI client, Packet Packet)
|
||||
@@ -7531,7 +7561,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
if ((ImageType)block.Type == ImageType.Baked)
|
||||
args.Priority *= 2.0f;
|
||||
|
||||
m_imageManager.EnqueueReq(args);
|
||||
ImageManager.EnqueueReq(args);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -7659,6 +7689,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (transfer.TransferInfo.SourceType == (int)SourceType.SimEstate)
|
||||
{
|
||||
//TransferRequestPacket does not include covenant uuid?
|
||||
//get scene covenant uuid
|
||||
taskID = m_scene.RegionInfo.RegionSettings.Covenant;
|
||||
}
|
||||
|
||||
MakeAssetRequest(transfer, taskID);
|
||||
|
||||
@@ -8611,13 +8648,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
#endregion
|
||||
|
||||
List<ParcelManager.ParcelAccessEntry> entries = new List<ParcelManager.ParcelAccessEntry>();
|
||||
List<LandAccessEntry> entries = new List<LandAccessEntry>();
|
||||
foreach (ParcelAccessListUpdatePacket.ListBlock block in updatePacket.List)
|
||||
{
|
||||
ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
|
||||
LandAccessEntry entry = new LandAccessEntry();
|
||||
entry.AgentID = block.ID;
|
||||
entry.Flags = (AccessList)block.Flags;
|
||||
entry.Time = Util.ToDateTime(block.Time);
|
||||
entry.Expires = block.Time;
|
||||
entries.Add(entry);
|
||||
}
|
||||
|
||||
@@ -8972,7 +9009,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
private bool HandleEstateOwnerMessage(IClientAPI sender, Packet Pack)
|
||||
{
|
||||
EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack;
|
||||
//m_log.Debug(messagePacket.ToString());
|
||||
// m_log.InfoFormat("[LLCLIENTVIEW]: Packet: {0}", Utils.BytesToString(messagePacket.MethodData.Method));
|
||||
GodLandStatRequest handlerLandStatRequest;
|
||||
|
||||
#region Packet Session and User Check
|
||||
@@ -9271,6 +9308,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
return true;
|
||||
|
||||
case "telehub":
|
||||
if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
|
||||
{
|
||||
UUID invoice = messagePacket.MethodData.Invoice;
|
||||
UUID SenderID = messagePacket.AgentData.AgentID;
|
||||
UInt32 param1 = 0u;
|
||||
|
||||
string command = (string)Utils.BytesToString(messagePacket.ParamList[0].Parameter);
|
||||
|
||||
if (command != "info ui")
|
||||
{
|
||||
try
|
||||
{
|
||||
param1 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[1].Parameter));
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
EstateManageTelehub handlerEstateManageTelehub = OnEstateManageTelehub;
|
||||
if (handlerEstateManageTelehub != null)
|
||||
{
|
||||
handlerEstateManageTelehub(this, invoice, SenderID, command, param1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
default:
|
||||
m_log.Error("EstateOwnerMessage: Unknown method requested\n" + messagePacket);
|
||||
return true;
|
||||
@@ -9282,8 +9347,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
//lsrp.RequestData.ReportType; // 1 = colliders, 0 = scripts
|
||||
//lsrp.RequestData.RequestFlags;
|
||||
//lsrp.RequestData.Filter;
|
||||
|
||||
// return true;
|
||||
}
|
||||
|
||||
private bool HandleRequestRegionInfo(IClientAPI sender, Packet Pack)
|
||||
@@ -12057,6 +12120,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
requestID = new UUID(transferRequest.TransferInfo.Params, 80);
|
||||
}
|
||||
else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimEstate)
|
||||
{
|
||||
requestID = taskID;
|
||||
}
|
||||
|
||||
|
||||
// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID);
|
||||
|
||||
|
||||
@@ -55,18 +55,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private bool m_shuttingdown;
|
||||
private AssetBase m_missingImage;
|
||||
private LLClientView m_client; //Client we're assigned to
|
||||
private IAssetService m_assetCache; //Asset Cache
|
||||
private IJ2KDecoder m_j2kDecodeModule; //Our J2K module
|
||||
private IAssetService m_assetCache;
|
||||
private IJ2KDecoder m_j2kDecodeModule;
|
||||
|
||||
/// <summary>
|
||||
/// Priority queue for determining which image to send first.
|
||||
/// </summary>
|
||||
private C5.IntervalHeap<J2KImage> m_priorityQueue = new C5.IntervalHeap<J2KImage>(10, new J2KImageComparer());
|
||||
|
||||
/// <summary>
|
||||
/// Used to control thread access to the priority queue.
|
||||
/// </summary>
|
||||
private object m_syncRoot = new object();
|
||||
|
||||
public LLClientView Client { get { return m_client; } }
|
||||
/// <summary>
|
||||
/// Client served by this image manager
|
||||
/// </summary>
|
||||
public IClientAPI Client { get; private set; }
|
||||
|
||||
public AssetBase MissingImage { get { return m_missingImage; } }
|
||||
|
||||
public LLImageManager(LLClientView client, IAssetService pAssetCache, IJ2KDecoder pJ2kDecodeModule)
|
||||
public LLImageManager(IClientAPI client, IAssetService pAssetCache, IJ2KDecoder pJ2kDecodeModule)
|
||||
{
|
||||
m_client = client;
|
||||
Client = client;
|
||||
m_assetCache = pAssetCache;
|
||||
|
||||
if (pAssetCache != null)
|
||||
@@ -111,8 +122,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
// "[LL IMAGE MANAGER]: Received duplicate of existing request for {0}, start packet {1} from {2}",
|
||||
// newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name);
|
||||
|
||||
//m_log.DebugFormat("[TEX]: (UPD) ID={0}: D={1}, S={2}, P={3}",
|
||||
// newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority);
|
||||
// m_log.DebugFormat("[TEX]: (UPD) ID={0}: D={1}, S={2}, P={3}",
|
||||
// newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority);
|
||||
|
||||
//Check the packet sequence to make sure this isn't older than
|
||||
//one we've already received
|
||||
@@ -178,8 +189,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
imgrequest = new J2KImage(this);
|
||||
imgrequest.J2KDecoder = m_j2kDecodeModule;
|
||||
imgrequest.AssetService = m_assetCache;
|
||||
imgrequest.AgentID = m_client.AgentId;
|
||||
imgrequest.InventoryAccessModule = m_client.Scene.RequestModuleInterface<IInventoryAccessModule>();
|
||||
imgrequest.AgentID = Client.AgentId;
|
||||
imgrequest.InventoryAccessModule = Client.Scene.RequestModuleInterface<IInventoryAccessModule>();
|
||||
imgrequest.DiscardLevel = newRequest.DiscardLevel;
|
||||
imgrequest.StartPacket = Math.Max(1, newRequest.PacketNumber);
|
||||
imgrequest.Priority = newRequest.Priority;
|
||||
@@ -210,7 +221,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
if (image.IsDecoded)
|
||||
{
|
||||
int sent;
|
||||
bool imageDone = image.SendPackets(m_client, packetsToSend - packetsSent, out sent);
|
||||
bool imageDone = image.SendPackets(Client, packetsToSend - packetsSent, out sent);
|
||||
packetsSent += sent;
|
||||
|
||||
// If the send is complete, destroy any knowledge of this transfer
|
||||
@@ -245,6 +256,36 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
m_shuttingdown = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clear the image queue.
|
||||
/// </summary>
|
||||
/// <returns>The number of requests cleared.</returns>
|
||||
public int ClearImageQueue()
|
||||
{
|
||||
int requestsDeleted;
|
||||
|
||||
lock (m_priorityQueue)
|
||||
{
|
||||
requestsDeleted = m_priorityQueue.Count;
|
||||
|
||||
// Surprisingly, there doesn't seem to be a clear method at this time.
|
||||
while (!m_priorityQueue.IsEmpty)
|
||||
m_priorityQueue.DeleteMax();
|
||||
}
|
||||
|
||||
return requestsDeleted;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an array containing all the images in the queue.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public J2KImage[] GetImages()
|
||||
{
|
||||
lock (m_priorityQueue)
|
||||
return m_priorityQueue.ToArray();
|
||||
}
|
||||
|
||||
#region Priority Queue Helpers
|
||||
|
||||
private J2KImage GetHighestPriorityImage()
|
||||
|
||||
@@ -492,6 +492,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
if ((Environment.TickCount & Int32.MaxValue) - udpClient.TickLastPacketReceived > 1000 * 60)
|
||||
{
|
||||
m_log.Warn("[LLUDPSERVER]: Ack timeout, disconnecting " + udpClient.AgentID);
|
||||
StatsManager.SimExtraStats.AddAbnormalClientThreadTermination();
|
||||
|
||||
RemoveClient(udpClient);
|
||||
return;
|
||||
|
||||
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
* 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.IO;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using log4net.Config;
|
||||
using Nini.Config;
|
||||
using NUnit.Framework;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Packets;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.CoreModules.Agent.TextureSender;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Tests.Common;
|
||||
using OpenSim.Tests.Common.Mock;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.LindenUDP.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class LLImageManagerTests
|
||||
{
|
||||
private AssetBase m_testImageAsset;
|
||||
private Scene scene;
|
||||
private LLImageManager llim;
|
||||
private TestClient tc;
|
||||
|
||||
[TestFixtureSetUp]
|
||||
public void FixtureInit()
|
||||
{
|
||||
using (
|
||||
Stream resource
|
||||
= GetType().Assembly.GetManifestResourceStream(
|
||||
"OpenSim.Region.ClientStack.LindenUDP.Tests.Resources.4-tile2.jp2"))
|
||||
{
|
||||
using (BinaryReader br = new BinaryReader(resource))
|
||||
{
|
||||
m_testImageAsset
|
||||
= new AssetBase(
|
||||
TestHelpers.ParseTail(0x1),
|
||||
"Test Image",
|
||||
(sbyte)AssetType.Texture,
|
||||
TestHelpers.ParseTail(0x2).ToString());
|
||||
|
||||
m_testImageAsset.Data = br.ReadBytes(99999999);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
UUID userId = TestHelpers.ParseTail(0x3);
|
||||
|
||||
J2KDecoderModule j2kdm = new J2KDecoderModule();
|
||||
|
||||
scene = SceneHelpers.SetupScene();
|
||||
SceneHelpers.SetupSceneModules(scene, j2kdm);
|
||||
|
||||
tc = new TestClient(SceneHelpers.GenerateAgentData(userId), scene);
|
||||
llim = new LLImageManager(tc, scene.AssetService, j2kdm);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSendImage()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// XmlConfigurator.Configure();
|
||||
|
||||
scene.AssetService.Store(m_testImageAsset);
|
||||
|
||||
TextureRequestArgs args = new TextureRequestArgs();
|
||||
args.RequestedAssetID = m_testImageAsset.FullID;
|
||||
args.DiscardLevel = 0;
|
||||
args.PacketNumber = 1;
|
||||
args.Priority = 5;
|
||||
args.requestSequence = 1;
|
||||
|
||||
llim.EnqueueReq(args);
|
||||
llim.ProcessImageQueue(20);
|
||||
|
||||
Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDiscardImage()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// XmlConfigurator.Configure();
|
||||
|
||||
scene.AssetService.Store(m_testImageAsset);
|
||||
|
||||
TextureRequestArgs args = new TextureRequestArgs();
|
||||
args.RequestedAssetID = m_testImageAsset.FullID;
|
||||
args.DiscardLevel = 0;
|
||||
args.PacketNumber = 1;
|
||||
args.Priority = 5;
|
||||
args.requestSequence = 1;
|
||||
llim.EnqueueReq(args);
|
||||
|
||||
// Now create a discard request
|
||||
TextureRequestArgs discardArgs = new TextureRequestArgs();
|
||||
discardArgs.RequestedAssetID = m_testImageAsset.FullID;
|
||||
discardArgs.DiscardLevel = -1;
|
||||
discardArgs.PacketNumber = 1;
|
||||
discardArgs.Priority = 0;
|
||||
discardArgs.requestSequence = 2;
|
||||
llim.EnqueueReq(discardArgs);
|
||||
|
||||
llim.ProcessImageQueue(20);
|
||||
|
||||
Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestMissingImage()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// XmlConfigurator.Configure();
|
||||
|
||||
TextureRequestArgs args = new TextureRequestArgs();
|
||||
args.RequestedAssetID = m_testImageAsset.FullID;
|
||||
args.DiscardLevel = 0;
|
||||
args.PacketNumber = 1;
|
||||
args.Priority = 5;
|
||||
args.requestSequence = 1;
|
||||
|
||||
llim.EnqueueReq(args);
|
||||
llim.ProcessImageQueue(20);
|
||||
|
||||
Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(0));
|
||||
Assert.That(tc.SentImageNotInDatabasePackets.Count, Is.EqualTo(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -246,7 +246,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
|
||||
if (mm != null)
|
||||
{
|
||||
if (!mm.UploadCovered(remoteClient, mm.UploadCharge))
|
||||
if (!mm.UploadCovered(remoteClient.AgentId, mm.UploadCharge))
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
|
||||
return;
|
||||
|
||||
@@ -39,6 +39,7 @@ using OpenSim.Region.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Scenes.Serialization;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
{
|
||||
@@ -116,6 +117,40 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
|
||||
// m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing any attachments for {0}", sp.Name);
|
||||
|
||||
XmlDocument doc = new XmlDocument();
|
||||
string stateData = String.Empty;
|
||||
|
||||
IAttachmentsService attServ = m_scene.RequestModuleInterface<IAttachmentsService>();
|
||||
if (attServ != null)
|
||||
{
|
||||
m_log.DebugFormat("[ATTACHMENT]: Loading attachment data from attachment service");
|
||||
stateData = attServ.Get(sp.UUID.ToString());
|
||||
if (stateData != String.Empty)
|
||||
{
|
||||
try
|
||||
{
|
||||
doc.LoadXml(stateData);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
||||
Dictionary<UUID, string> itemData = new Dictionary<UUID, string>();
|
||||
|
||||
XmlNodeList nodes = doc.GetElementsByTagName("Attachment");
|
||||
if (nodes.Count > 0)
|
||||
{
|
||||
foreach (XmlNode n in nodes)
|
||||
{
|
||||
XmlElement elem = (XmlElement)n;
|
||||
string itemID = elem.GetAttribute("ItemID");
|
||||
string xml = elem.InnerXml;
|
||||
|
||||
itemData[new UUID(itemID)] = xml;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
List<AvatarAttachment> attachments = sp.Appearance.GetAttachments();
|
||||
foreach (AvatarAttachment attach in attachments)
|
||||
{
|
||||
@@ -135,12 +170,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
|
||||
try
|
||||
{
|
||||
string xmlData;
|
||||
XmlDocument d = null;
|
||||
UUID asset;
|
||||
if (itemData.TryGetValue(attach.ItemID, out xmlData))
|
||||
{
|
||||
d = new XmlDocument();
|
||||
d.LoadXml(xmlData);
|
||||
m_log.InfoFormat("[ATTACHMENT]: Found saved state for item {0}, loading it", attach.ItemID);
|
||||
}
|
||||
|
||||
// If we're an NPC then skip all the item checks and manipulations since we don't have an
|
||||
// inventory right now.
|
||||
if (sp.PresenceType == PresenceType.Npc)
|
||||
RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p, null);
|
||||
else
|
||||
RezSingleAttachmentFromInventory(sp, attach.ItemID, p);
|
||||
RezSingleAttachmentFromInventory(sp, attach.ItemID, p, true, d);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -149,7 +194,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
}
|
||||
}
|
||||
|
||||
public void SaveChangedAttachments(IScenePresence sp)
|
||||
public void SaveChangedAttachments(IScenePresence sp, bool saveAllScripted)
|
||||
{
|
||||
// m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name);
|
||||
|
||||
@@ -158,13 +203,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
|
||||
foreach (SceneObjectGroup grp in sp.GetAttachments())
|
||||
{
|
||||
// if (grp.HasGroupChanged) // Resizer scripts?
|
||||
// {
|
||||
grp.IsAttachment = false;
|
||||
grp.AbsolutePosition = grp.RootPart.AttachedPos;
|
||||
UpdateKnownItem(sp, grp);
|
||||
grp.IsAttachment = true;
|
||||
// }
|
||||
grp.IsAttachment = false;
|
||||
grp.AbsolutePosition = grp.RootPart.AttachedPos;
|
||||
UpdateKnownItem(sp, grp, saveAllScripted);
|
||||
grp.IsAttachment = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -466,9 +508,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
/// </remarks>
|
||||
/// <param name="sp"></param>
|
||||
/// <param name="grp"></param>
|
||||
private void UpdateKnownItem(IScenePresence sp, SceneObjectGroup grp)
|
||||
private void UpdateKnownItem(IScenePresence sp, SceneObjectGroup grp, bool saveAllScripted)
|
||||
{
|
||||
if (grp.HasGroupChanged || grp.ContainsScripts())
|
||||
// Saving attachments for NPCs messes them up for the real owner!
|
||||
INPCModule module = m_scene.RequestModuleInterface<INPCModule>();
|
||||
if (module != null)
|
||||
{
|
||||
if (module.IsNPC(sp.UUID, m_scene))
|
||||
return;
|
||||
}
|
||||
|
||||
if (grp.HasGroupChanged || (saveAllScripted && grp.ContainsScripts()))
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
|
||||
@@ -501,6 +551,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
if (sp.ControllingClient != null)
|
||||
sp.ControllingClient.SendInventoryItemCreateUpdate(item, 0);
|
||||
}
|
||||
grp.HasGroupChanged = false; // Prevent it being saved over and over
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -694,7 +745,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
group.IsAttachment = false;
|
||||
group.AbsolutePosition = group.RootPart.AttachedPos;
|
||||
|
||||
UpdateKnownItem(sp, group);
|
||||
UpdateKnownItem(sp, group, true);
|
||||
m_scene.DeleteSceneObject(group, false);
|
||||
|
||||
return;
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
// Process the baked texture array
|
||||
if (textureEntry != null)
|
||||
{
|
||||
m_log.InfoFormat("[AVFACTORY]: received texture update for {0}", sp.UUID);
|
||||
m_log.InfoFormat("[AVFACTORY]: Received texture update for {0} {1}", sp.Name, sp.UUID);
|
||||
|
||||
// WriteBakedTexturesReport(sp, m_log.DebugFormat);
|
||||
|
||||
@@ -315,7 +315,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
return false;
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0}", 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);
|
||||
@@ -626,4 +626,4 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
outputAction("{0} baked appearance texture is {1}", sp.Name, bakedTextureValid ? "OK" : "corrupt");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -496,13 +496,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
string agentFriendService = string.Empty;
|
||||
string friendFriendService = string.Empty;
|
||||
|
||||
if (agentIsLocal)
|
||||
if (agentClient != null)
|
||||
{
|
||||
agentClientCircuit = ((Scene)(agentClient.Scene)).AuthenticateHandler.GetAgentCircuitData(agentClient.CircuitCode);
|
||||
agentUUI = Util.ProduceUserUniversalIdentifier(agentClientCircuit);
|
||||
agentFriendService = agentClientCircuit.ServiceURLs["FriendsServerURI"].ToString();
|
||||
}
|
||||
if (friendIsLocal)
|
||||
if (friendClient != null)
|
||||
{
|
||||
friendClientCircuit = ((Scene)(friendClient.Scene)).AuthenticateHandler.GetAgentCircuitData(friendClient.CircuitCode);
|
||||
friendUUI = Util.ProduceUserUniversalIdentifier(friendClientCircuit);
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Timers;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
@@ -42,6 +43,10 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
private static readonly ILog m_log = LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Timer m_logTimer = new Timer(10000);
|
||||
private List<GridInstantMessage> m_logData = new List<GridInstantMessage>();
|
||||
private string m_restUrl;
|
||||
|
||||
/// <value>
|
||||
/// Is this module enabled?
|
||||
/// </value>
|
||||
@@ -61,9 +66,12 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
"InstantMessageModule", "InstantMessageModule") !=
|
||||
"InstantMessageModule")
|
||||
return;
|
||||
m_restUrl = config.Configs["Messaging"].GetString("LogURL", String.Empty);
|
||||
}
|
||||
|
||||
m_enabled = true;
|
||||
m_logTimer.AutoReset = false;
|
||||
m_logTimer.Elapsed += LogTimerElapsed;
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
@@ -148,6 +156,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
{
|
||||
byte dialog = im.dialog;
|
||||
|
||||
if (client != null && dialog == (byte)InstantMessageDialog.MessageFromAgent)
|
||||
LogInstantMesssage(im);
|
||||
|
||||
if (dialog != (byte)InstantMessageDialog.MessageFromAgent
|
||||
&& dialog != (byte)InstantMessageDialog.StartTyping
|
||||
&& dialog != (byte)InstantMessageDialog.StopTyping
|
||||
@@ -226,5 +237,35 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
//
|
||||
OnInstantMessage(null, msg);
|
||||
}
|
||||
|
||||
private void LogInstantMesssage(GridInstantMessage im)
|
||||
{
|
||||
if (m_logData.Count < 20)
|
||||
{
|
||||
// Restart the log write timer
|
||||
m_logTimer.Stop();
|
||||
}
|
||||
if (!m_logTimer.Enabled)
|
||||
m_logTimer.Start();
|
||||
|
||||
lock (m_logData)
|
||||
{
|
||||
m_logData.Add(im);
|
||||
}
|
||||
}
|
||||
|
||||
private void LogTimerElapsed(object source, ElapsedEventArgs e)
|
||||
{
|
||||
lock (m_logData)
|
||||
{
|
||||
if (m_restUrl != String.Empty && m_logData.Count > 0)
|
||||
{
|
||||
bool success = SynchronousRestObjectRequester.MakeRequest<List<GridInstantMessage>, bool>("POST", m_restUrl + "/LogMessages/", m_logData);
|
||||
if (!success)
|
||||
m_log.ErrorFormat("[INSTANT MESSAGE]: Failed to save log data");
|
||||
}
|
||||
m_logData.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -493,7 +493,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
}
|
||||
else
|
||||
{
|
||||
sceneObjects.Add(SceneObjectSerializer.FromOriginalXmlFormat(xmlData));
|
||||
SceneObjectGroup deserializedObject = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
|
||||
|
||||
if (deserializedObject != null)
|
||||
sceneObjects.Add(deserializedObject);
|
||||
}
|
||||
|
||||
foreach (SceneObjectGroup sog in sceneObjects)
|
||||
|
||||
@@ -412,7 +412,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
{
|
||||
int majorVersion, minorVersion;
|
||||
|
||||
if (options.ContainsKey("profile"))
|
||||
if (options.ContainsKey("home"))
|
||||
{
|
||||
majorVersion = 1;
|
||||
minorVersion = 2;
|
||||
|
||||
@@ -122,12 +122,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
|
||||
scene.AddCommand(
|
||||
this, "save iar",
|
||||
"save iar [--p|-profile=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [--v|-verbose]",
|
||||
"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
|
||||
+ "-p|--profile=<url> adds the url of the profile service to the saved user information." + 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."
|
||||
@@ -396,7 +396,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
|
||||
OptionSet ops = new OptionSet();
|
||||
//ops.Add("v|version=", delegate(string v) { options["version"] = v; });
|
||||
ops.Add("p|profile=", delegate(string v) { options["profile"] = v; });
|
||||
ops.Add("h|home=", delegate(string v) { options["home"] = v; });
|
||||
ops.Add("v|verbose", delegate(string v) { options["verbose"] = v; });
|
||||
ops.Add("c|creators", delegate(string v) { options["creators"] = v; });
|
||||
ops.Add("noassets", delegate(string v) { options["noassets"] = v != null; });
|
||||
@@ -408,13 +408,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
if (mainParams.Count < 6)
|
||||
{
|
||||
m_log.Error(
|
||||
"[INVENTORY ARCHIVER]: usage is save iar [--p|-profile=<url>] [--noassets] <first name> <last name> <inventory path> <user password> [<save file path>]");
|
||||
"[INVENTORY ARCHIVER]: usage is save iar [-h|--home=<url>] [--noassets] <first name> <last name> <inventory path> <user password> [<save file path>] [-c|--creators] [-v|--verbose]");
|
||||
return;
|
||||
}
|
||||
|
||||
m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
|
||||
if (options.ContainsKey("profile"))
|
||||
m_log.WarnFormat("[INVENTORY ARCHIVER]: Please be aware that inventory archives with creator information are not compatible with OpenSim 0.7.0.2 and earlier. Do not use the -profile option if you want to produce a compatible IAR");
|
||||
if (options.ContainsKey("home"))
|
||||
m_log.WarnFormat("[INVENTORY ARCHIVER]: Please be aware that inventory archives with creator information are not compatible with OpenSim 0.7.0.2 and earlier. Do not use the -home option if you want to produce a compatible IAR");
|
||||
|
||||
string firstName = mainParams[2];
|
||||
string lastName = mainParams[3];
|
||||
|
||||
@@ -204,13 +204,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
sp.ControllingClient.SendTeleportStart(teleportFlags);
|
||||
|
||||
sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags);
|
||||
sp.TeleportFlags = (TeleportFlags)teleportFlags;
|
||||
sp.TeleportFlags = (Constants.TeleportFlags)teleportFlags;
|
||||
sp.Teleport(position);
|
||||
|
||||
foreach (SceneObjectGroup grp in sp.GetAttachments())
|
||||
{
|
||||
if (grp.IsDeleted)
|
||||
sp.Scene.EventManager.TriggerOnScriptChangedEvent(grp.LocalId, (uint)Changed.TELEPORT);
|
||||
sp.Scene.EventManager.TriggerOnScriptChangedEvent(grp.LocalId, (uint)Changed.TELEPORT);
|
||||
}
|
||||
}
|
||||
else // Another region possibly in another simulator
|
||||
@@ -1732,17 +1731,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
{
|
||||
m_log.InfoFormat("[ENTITY TRANSFER MODULE] cross region transfer failed for object {0}",grp.UUID);
|
||||
|
||||
// Need to turn off the physics flags, otherwise the object will continue to attempt to
|
||||
// move out of the region creating an infinite loop of failed attempts to cross
|
||||
grp.UpdatePrimFlags(grp.RootPart.LocalId,false,grp.IsTemporary,grp.IsPhantom,false);
|
||||
|
||||
// We are going to move the object back to the old position so long as the old position
|
||||
// is in the region
|
||||
oldGroupPosition.X = Util.Clamp<float>(oldGroupPosition.X,1.0f,(float)Constants.RegionSize-1);
|
||||
oldGroupPosition.Y = Util.Clamp<float>(oldGroupPosition.Y,1.0f,(float)Constants.RegionSize-1);
|
||||
oldGroupPosition.Z = Util.Clamp<float>(oldGroupPosition.Z,1.0f,4096.0f);
|
||||
|
||||
grp.RootPart.GroupPosition = oldGroupPosition;
|
||||
|
||||
// Need to turn off the physics flags, otherwise the object will continue to attempt to
|
||||
// move out of the region creating an infinite loop of failed attempts to cross
|
||||
grp.UpdatePrimFlags(grp.RootPart.LocalId,false,grp.IsTemporary,grp.IsPhantom,false);
|
||||
grp.AbsolutePosition = oldGroupPosition;
|
||||
|
||||
grp.ScheduleGroupForFullUpdate();
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
region.ExternalHostName = uri.Host;
|
||||
region.HttpPort = (uint)uri.Port;
|
||||
region.ServerURI = uri.ToString();
|
||||
region.ServerURI = aCircuit.ServiceURLs["HomeURI"].ToString();
|
||||
region.RegionName = string.Empty;
|
||||
region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0);
|
||||
return region;
|
||||
|
||||
@@ -55,16 +55,16 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
// private Dictionary<string, InventoryClient> m_inventoryServers = new Dictionary<string, InventoryClient>();
|
||||
|
||||
private Scene m_scene;
|
||||
private string m_ProfileServerURI;
|
||||
private string m_HomeURI;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public HGAssetMapper(Scene scene, string profileURL)
|
||||
public HGAssetMapper(Scene scene, string homeURL)
|
||||
{
|
||||
m_scene = scene;
|
||||
m_ProfileServerURI = profileURL;
|
||||
m_HomeURI = homeURL;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -150,7 +150,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
UUID.TryParse(meta.CreatorID, out uuid);
|
||||
UserAccount creator = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, uuid);
|
||||
if (creator != null)
|
||||
meta.CreatorID = m_ProfileServerURI + "/" + meta.CreatorID + ";" + creator.FirstName + " " + creator.LastName;
|
||||
meta.CreatorID = m_HomeURI + ";" + creator.FirstName + " " + creator.LastName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
if (!hasCreatorData && creator != null)
|
||||
{
|
||||
XmlElement creatorData = doc.CreateElement("CreatorData");
|
||||
creatorData.InnerText = m_ProfileServerURI + "/" + creator.PrincipalID + ";" + creator.FirstName + " " + creator.LastName;
|
||||
creatorData.InnerText = m_HomeURI + ";" + creator.FirstName + " " + creator.LastName;
|
||||
sop.AppendChild(creatorData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
get { return m_assMapper; }
|
||||
}
|
||||
|
||||
private string m_ProfileServerURI;
|
||||
private string m_HomeURI;
|
||||
private bool m_OutboundPermission;
|
||||
private string m_ThisGatekeeper;
|
||||
|
||||
@@ -84,7 +84,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
IConfig thisModuleConfig = source.Configs["HGInventoryAccessModule"];
|
||||
if (thisModuleConfig != null)
|
||||
{
|
||||
m_ProfileServerURI = thisModuleConfig.GetString("ProfileServerURI", string.Empty);
|
||||
// legacy configuration [obsolete]
|
||||
m_HomeURI = thisModuleConfig.GetString("ProfileServerURI", string.Empty);
|
||||
// preferred
|
||||
m_HomeURI = thisModuleConfig.GetString("HomeURI", m_HomeURI);
|
||||
m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true);
|
||||
m_ThisGatekeeper = thisModuleConfig.GetString("Gatekeeper", string.Empty);
|
||||
}
|
||||
@@ -100,7 +103,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
return;
|
||||
|
||||
base.AddRegion(scene);
|
||||
m_assMapper = new HGAssetMapper(scene, m_ProfileServerURI);
|
||||
m_assMapper = new HGAssetMapper(scene, m_HomeURI);
|
||||
scene.EventManager.OnNewInventoryItemUploadComplete += UploadInventoryItem;
|
||||
|
||||
}
|
||||
|
||||
@@ -367,6 +367,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
|
||||
originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition;
|
||||
|
||||
// Restore attachment data after trip through the sim
|
||||
if (objectGroup.RootPart.AttachPoint > 0)
|
||||
inventoryStoredPosition = objectGroup.RootPart.AttachOffset;
|
||||
objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint;
|
||||
|
||||
objectGroup.AbsolutePosition = inventoryStoredPosition;
|
||||
|
||||
// Make sure all bits but the ones we want are clear
|
||||
@@ -555,12 +560,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
return null;
|
||||
|
||||
userID = remoteClient.AgentId;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[INVENTORY ACCESS MODULE]: Target of {0} in CreateItemForObject() is {1} {2}",
|
||||
// action, remoteClient.Name, userID);
|
||||
}
|
||||
else
|
||||
{
|
||||
// All returns / deletes go to the object owner
|
||||
//
|
||||
userID = so.RootPart.OwnerID;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[INVENTORY ACCESS MODULE]: Target of {0} in CreateItemForObject() is object owner {1}",
|
||||
// action, userID);
|
||||
}
|
||||
|
||||
if (userID == UUID.Zero) // Can't proceed
|
||||
@@ -646,11 +659,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
}
|
||||
|
||||
// Override and put into where it came from, if it came
|
||||
// from anywhere in inventory
|
||||
// from anywhere in inventory and the owner is taking it back.
|
||||
//
|
||||
if (action == DeRezAction.Take || action == DeRezAction.TakeCopy)
|
||||
{
|
||||
if (so.RootPart.FromFolderID != UUID.Zero)
|
||||
if (so.RootPart.FromFolderID != UUID.Zero && userID == remoteClient.AgentId)
|
||||
{
|
||||
InventoryFolderBase f = new InventoryFolderBase(so.RootPart.FromFolderID, userID);
|
||||
if (f != null)
|
||||
@@ -740,6 +753,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
if (e == null || attachment) // Single
|
||||
{
|
||||
SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
|
||||
if (!attachment)
|
||||
{
|
||||
g.RootPart.AttachPoint = g.RootPart.Shape.State;
|
||||
g.RootPart.AttachOffset = g.AbsolutePosition;
|
||||
}
|
||||
|
||||
objlist.Add(g);
|
||||
veclist.Add(new Vector3(0, 0, 0));
|
||||
@@ -769,6 +787,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
foreach (XmlNode n in groups)
|
||||
{
|
||||
SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml);
|
||||
g.RootPart.AttachPoint = g.RootPart.Shape.State;
|
||||
g.RootPart.AttachOffset = g.AbsolutePosition;
|
||||
|
||||
objlist.Add(g);
|
||||
XmlElement el = (XmlElement)n;
|
||||
@@ -818,6 +838,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
group = objlist[i];
|
||||
SceneObjectPart rootPart = group.RootPart;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[InventoryAccessModule]: Preparing to rez {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}",
|
||||
// group.Name, group.LocalId, group.UUID,
|
||||
// group.RootPart.OwnerMask, group.RootPart.NextOwnerMask, group.RootPart.GroupMask, group.RootPart.EveryoneMask,
|
||||
// remoteClient.Name);
|
||||
|
||||
// Vector3 storedPosition = group.AbsolutePosition;
|
||||
if (group.UUID == UUID.Zero)
|
||||
{
|
||||
@@ -880,6 +906,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
|
||||
rootPart.ScheduleFullUpdate();
|
||||
}
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[InventoryAccessModule]: Rezzed {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}",
|
||||
// group.Name, group.LocalId, group.UUID,
|
||||
// group.RootPart.OwnerMask, group.RootPart.NextOwnerMask, group.RootPart.GroupMask, group.RootPart.EveryoneMask,
|
||||
// remoteClient.Name);
|
||||
}
|
||||
|
||||
group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
|
||||
@@ -946,7 +978,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
}
|
||||
|
||||
rootPart.FromFolderID = item.Folder;
|
||||
|
||||
|
||||
// Console.WriteLine("rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}",
|
||||
// rootPart.OwnerID, item.Owner, item.CurrentPermissions);
|
||||
|
||||
if ((rootPart.OwnerID != item.Owner) ||
|
||||
(item.CurrentPermissions & 16) != 0 ||
|
||||
(item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)
|
||||
|
||||
@@ -50,9 +50,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
||||
public string LastName { get; set; }
|
||||
public string HomeURL { get; set; }
|
||||
public Dictionary<string, object> ServerURLs { get; set; }
|
||||
public string Title { get; set; }
|
||||
public int Flags { get; set; }
|
||||
public int Created { get; set; }
|
||||
}
|
||||
|
||||
public class UserManagementModule : ISharedRegionModule, IUserManagement
|
||||
@@ -284,94 +281,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public int GetUserFlags(UUID userID)
|
||||
{
|
||||
UserData userdata;
|
||||
lock (m_UserCache)
|
||||
m_UserCache.TryGetValue(userID, out userdata);
|
||||
|
||||
if (userdata.Flags == -1)
|
||||
GetUserInfo(userID);
|
||||
|
||||
if (userdata.Flags != -1)
|
||||
return userdata.Flags;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int GetUserCreated(UUID userID)
|
||||
{
|
||||
UserData userdata;
|
||||
lock (m_UserCache)
|
||||
m_UserCache.TryGetValue(userID, out userdata);
|
||||
|
||||
if (userdata.Flags == -1)
|
||||
GetUserInfo(userID);
|
||||
|
||||
if (userdata.Created != -1)
|
||||
return userdata.Created;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public string GetUserTitle(UUID userID)
|
||||
{
|
||||
UserData userdata;
|
||||
lock (m_UserCache)
|
||||
m_UserCache.TryGetValue(userID, out userdata);
|
||||
|
||||
if (userdata.Flags == -1)
|
||||
GetUserInfo(userID);
|
||||
|
||||
if (userdata.Created != -1)
|
||||
return userdata.Title;
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
// This will cache the user data
|
||||
// Change this to return bool
|
||||
private bool GetUserInfo(UUID userID)
|
||||
{
|
||||
UserData userdata;
|
||||
lock (m_UserCache)
|
||||
m_UserCache.TryGetValue(userID, out userdata);
|
||||
|
||||
if (userdata != null)
|
||||
{
|
||||
// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Requested url type {0} for {1}", serverType, userID);
|
||||
|
||||
if (userdata.Flags >= 0)
|
||||
{
|
||||
// This is already populated
|
||||
return true;
|
||||
}
|
||||
|
||||
if (userdata.HomeURL != null && userdata.HomeURL != string.Empty)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[USER MANAGEMENT MODULE]: Requesting user flags from '{0}' for {1}",
|
||||
userdata.HomeURL, userID);
|
||||
|
||||
UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL);
|
||||
Dictionary<string, object> info = uConn.GetUserInfo(userID);
|
||||
|
||||
// Pull our data now
|
||||
if (info["result"].ToString() == "success")
|
||||
{
|
||||
userdata.Flags = (int)info["user_flags"];
|
||||
userdata.Created = (int)info["user_created"];
|
||||
userdata.Title = (string)info["user_title"];
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public string GetUserUUI(UUID userID)
|
||||
{
|
||||
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, userID);
|
||||
@@ -413,68 +322,85 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
||||
user.Id = uuid;
|
||||
user.FirstName = first;
|
||||
user.LastName = last;
|
||||
// user.ProfileURL = we should initialize this to the default
|
||||
|
||||
AddUserInternal(user);
|
||||
}
|
||||
|
||||
public void AddUser(UUID uuid, string first, string last, string profileURL)
|
||||
public void AddUser(UUID uuid, string first, string last, string homeURL)
|
||||
{
|
||||
AddUser(uuid, profileURL + ";" + first + " " + last);
|
||||
AddUser(uuid, homeURL + ";" + first + " " + last);
|
||||
}
|
||||
|
||||
public void AddUser(UUID id, string creatorData)
|
||||
public void AddUser (UUID id, string creatorData)
|
||||
{
|
||||
UserData oldUser;
|
||||
//lock the whole block - prevent concurrent update
|
||||
lock (m_UserCache)
|
||||
{
|
||||
if (m_UserCache.ContainsKey(id))
|
||||
return;
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, craetorData {1}", id, creatorData);
|
||||
|
||||
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id);
|
||||
|
||||
if (account != null)
|
||||
{
|
||||
AddUser(id, account.FirstName, account.LastName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UserData user = new UserData();
|
||||
user.Id = id;
|
||||
user.Flags = -1;
|
||||
user.Created = -1;
|
||||
|
||||
if (creatorData != null && creatorData != string.Empty)
|
||||
m_UserCache.TryGetValue (id, out oldUser);
|
||||
if (oldUser != null)
|
||||
{
|
||||
//creatorData = <endpoint>;<name>
|
||||
|
||||
string[] parts = creatorData.Split(';');
|
||||
if (parts.Length >= 1)
|
||||
if (creatorData == null || creatorData == String.Empty)
|
||||
{
|
||||
user.HomeURL = parts[0];
|
||||
try
|
||||
{
|
||||
Uri uri = new Uri(parts[0]);
|
||||
user.LastName = "@" + uri.Authority;
|
||||
}
|
||||
catch (UriFormatException)
|
||||
{
|
||||
m_log.DebugFormat("[SCENE]: Unable to parse Uri {0}", parts[0]);
|
||||
user.LastName = "@unknown";
|
||||
}
|
||||
//ignore updates without creator data
|
||||
return;
|
||||
}
|
||||
if (parts.Length >= 2)
|
||||
user.FirstName = parts[1].Replace(' ', '.');
|
||||
//try update unknown users
|
||||
//and creator's home URL's
|
||||
if ((oldUser.FirstName == "Unknown" && !creatorData.Contains ("Unknown")) || (oldUser.HomeURL != null && !creatorData.StartsWith (oldUser.HomeURL)))
|
||||
{
|
||||
m_UserCache.Remove (id);
|
||||
// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Re-adding user with id {0}, creatorData [{1}] and old HomeURL {2}", id, creatorData,oldUser.HomeURL);
|
||||
}
|
||||
else
|
||||
{
|
||||
//we have already a valid user within the cache
|
||||
return;
|
||||
}
|
||||
}
|
||||
// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData);
|
||||
|
||||
UserAccount account = m_Scenes [0].UserAccountService.GetUserAccount (m_Scenes [0].RegionInfo.ScopeID, id);
|
||||
|
||||
if (account != null)
|
||||
{
|
||||
AddUser (id, account.FirstName, account.LastName);
|
||||
}
|
||||
else
|
||||
{
|
||||
user.FirstName = "Unknown";
|
||||
user.LastName = "User";
|
||||
}
|
||||
UserData user = new UserData ();
|
||||
user.Id = id;
|
||||
|
||||
AddUserInternal(user);
|
||||
if (creatorData != null && creatorData != string.Empty)
|
||||
{
|
||||
//creatorData = <endpoint>;<name>
|
||||
|
||||
string[] parts = creatorData.Split (';');
|
||||
if (parts.Length >= 1)
|
||||
{
|
||||
user.HomeURL = parts [0];
|
||||
try
|
||||
{
|
||||
Uri uri = new Uri (parts [0]);
|
||||
user.LastName = "@" + uri.Authority;
|
||||
}
|
||||
catch (UriFormatException)
|
||||
{
|
||||
m_log.DebugFormat ("[SCENE]: Unable to parse Uri {0}", parts [0]);
|
||||
user.LastName = "@unknown";
|
||||
}
|
||||
}
|
||||
if (parts.Length >= 2)
|
||||
user.FirstName = parts [1].Replace (' ', '.');
|
||||
}
|
||||
else
|
||||
{
|
||||
user.FirstName = "Unknown";
|
||||
user.LastName = "User";
|
||||
}
|
||||
|
||||
AddUserInternal (user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -488,36 +414,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
||||
// user.Id, user.FirstName, user.LastName, user.HomeURL);
|
||||
}
|
||||
|
||||
//public void AddUser(UUID uuid, string userData)
|
||||
//{
|
||||
// if (m_UserCache.ContainsKey(uuid))
|
||||
// return;
|
||||
|
||||
// UserData user = new UserData();
|
||||
// user.Id = uuid;
|
||||
|
||||
// // userData = <profile url>;<name>
|
||||
// string[] parts = userData.Split(';');
|
||||
// if (parts.Length >= 1)
|
||||
// user.ProfileURL = parts[0].Trim();
|
||||
// if (parts.Length >= 2)
|
||||
// {
|
||||
// string[] name = parts[1].Trim().Split(' ');
|
||||
// if (name.Length >= 1)
|
||||
// user.FirstName = name[0];
|
||||
// if (name.Length >= 2)
|
||||
// user.LastName = name[1];
|
||||
// else
|
||||
// user.LastName = "?";
|
||||
// }
|
||||
|
||||
// lock (m_UserCache)
|
||||
// m_UserCache.Add(uuid, user);
|
||||
|
||||
// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", user.Id, user.FirstName, user.LastName, user.ProfileURL);
|
||||
|
||||
//}
|
||||
|
||||
public bool IsLocalGridUser(UUID uuid)
|
||||
{
|
||||
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, uuid);
|
||||
|
||||
@@ -29,6 +29,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Mail;
|
||||
using System.Net.Security;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
@@ -111,21 +112,36 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
||||
X509Chain chain,
|
||||
SslPolicyErrors sslPolicyErrors)
|
||||
{
|
||||
HttpWebRequest Request = (HttpWebRequest)sender;
|
||||
|
||||
if (Request.Headers.Get("NoVerifyCert") != null)
|
||||
// If this is a web request we need to check the headers first
|
||||
// We may want to ignore SSL
|
||||
if (sender is HttpWebRequest)
|
||||
{
|
||||
HttpWebRequest Request = (HttpWebRequest)sender;
|
||||
ServicePoint sp = Request.ServicePoint;
|
||||
|
||||
// We don't case about encryption, get out of here
|
||||
if (Request.Headers.Get("NoVerifyCert") != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// If there was an upstream cert verification error, bail
|
||||
if ((((int)sslPolicyErrors) & ~4) != 0)
|
||||
return false;
|
||||
|
||||
// Check for policy and execute it if defined
|
||||
if (ServicePointManager.CertificatePolicy != null)
|
||||
{
|
||||
return ServicePointManager.CertificatePolicy.CheckValidationResult (sp, certificate, Request, 0);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// If it's not HTTP, trust .NET to check it
|
||||
if ((((int)sslPolicyErrors) & ~4) != 0)
|
||||
return false;
|
||||
|
||||
if (ServicePointManager.CertificatePolicy != null)
|
||||
{
|
||||
ServicePoint sp = Request.ServicePoint;
|
||||
return ServicePointManager.CertificatePolicy.CheckValidationResult (sp, certificate, Request, 0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#region IHttpRequestModule Members
|
||||
|
||||
@@ -132,6 +132,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
IScriptModule[] scriptModules = scene.RequestModuleInterfaces<IScriptModule>();
|
||||
foreach (IScriptModule scriptModule in scriptModules)
|
||||
{
|
||||
scriptModule.OnScriptRemoved += ScriptRemoved;
|
||||
scriptModule.OnObjectRemoved += ObjectRemoved;
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
@@ -289,6 +295,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||
|
||||
public void ScriptRemoved(UUID itemID)
|
||||
{
|
||||
// m_log.DebugFormat("[URL MODULE]: Removing script {0}", itemID);
|
||||
|
||||
lock (m_UrlMap)
|
||||
{
|
||||
List<string> removeURLs = new List<string>();
|
||||
|
||||
@@ -171,6 +171,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
|
||||
{
|
||||
return m_GridUserService.GetGridUserInfo(userID);
|
||||
}
|
||||
public GridUserInfo[] GetGridUserInfo(string[] userID)
|
||||
{
|
||||
return m_GridUserService.GetGridUserInfo(userID);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -147,6 +147,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
|
||||
return m_RemoteConnector.GetGridUserInfo(userID);
|
||||
}
|
||||
|
||||
public GridUserInfo[] GetGridUserInfo(string[] userID)
|
||||
{
|
||||
return m_RemoteConnector.GetGridUserInfo(userID);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
@@ -116,6 +116,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
m_merge = merge;
|
||||
m_skipAssets = skipAssets;
|
||||
m_requestId = requestId;
|
||||
|
||||
// Zero can never be a valid user id
|
||||
m_validUserUuids[UUID.Zero] = false;
|
||||
}
|
||||
|
||||
public ArchiveReadRequest(Scene scene, Stream loadStream, bool merge, bool skipAssets, Guid requestId)
|
||||
@@ -125,6 +128,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
m_merge = merge;
|
||||
m_skipAssets = skipAssets;
|
||||
m_requestId = requestId;
|
||||
|
||||
// Zero can never be a valid user id
|
||||
m_validUserUuids[UUID.Zero] = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -386,16 +392,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
if (!m_validUserUuids.ContainsKey(uuid))
|
||||
{
|
||||
UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, uuid);
|
||||
if (account != null)
|
||||
m_validUserUuids.Add(uuid, true);
|
||||
else
|
||||
m_validUserUuids.Add(uuid, false);
|
||||
m_validUserUuids.Add(uuid, account != null);
|
||||
}
|
||||
|
||||
if (m_validUserUuids[uuid])
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
return m_validUserUuids[uuid];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -422,6 +422,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
string extension = filename.Substring(i);
|
||||
string uuid = filename.Remove(filename.Length - extension.Length);
|
||||
|
||||
if (m_scene.AssetService.GetMetadata(uuid) != null)
|
||||
{
|
||||
// m_log.DebugFormat("[ARCHIVER]: found existing asset {0}",uuid);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ArchiveConstants.EXTENSION_TO_ASSET_TYPE.ContainsKey(extension))
|
||||
{
|
||||
sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension];
|
||||
|
||||
@@ -282,10 +282,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
// always (incorrectly) includes the Copy bit set in this case. But that's a mistake: the viewer
|
||||
// does NOT show that the object has Everyone-Copy permissions, and doesn't allow it to be copied.
|
||||
if (permissionClass != PermissionClass.Owner)
|
||||
{
|
||||
canTransfer |= (obj.EveryoneMask & (uint)PermissionMask.Copy) != 0;
|
||||
}
|
||||
|
||||
|
||||
bool partPermitted = true;
|
||||
if (checkPermissions.Contains("C") && !canCopy)
|
||||
|
||||
@@ -98,6 +98,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
|
||||
OptionSet options = new OptionSet().Add("m|merge", delegate (string v) { mergeOar = v != null; });
|
||||
options.Add("s|skip-assets", delegate (string v) { skipAssets = v != null; });
|
||||
|
||||
// Send a message to the region ready module
|
||||
/* bluewall* Disable this for the time being
|
||||
IRegionReadyModule rready = m_scene.RequestModuleInterface<IRegionReadyModule>();
|
||||
|
||||
if (rready != null)
|
||||
{
|
||||
rready.OarLoadingAlert("load");
|
||||
}
|
||||
*/
|
||||
|
||||
List<string> mainParams = options.Parse(cmdparams);
|
||||
|
||||
@@ -125,9 +135,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
Dictionary<string, object> options = new Dictionary<string, object>();
|
||||
|
||||
OptionSet ops = new OptionSet();
|
||||
// ops.Add("v|version=", delegate(string v) { options["version"] = v; });
|
||||
ops.Add("p|profile=", delegate(string v) { options["profile"] = v; });
|
||||
|
||||
// legacy argument [obsolete]
|
||||
ops.Add("p|profile=", delegate(string v) { Console.WriteLine("\n WARNING: -profile option is obsolete and it will not work. Use -home instead.\n"); });
|
||||
// preferred
|
||||
ops.Add("h|home=", delegate(string v) { options["home"] = v; });
|
||||
|
||||
ops.Add("noassets", delegate(string v) { options["noassets"] = v != null; });
|
||||
ops.Add("publish", v => options["wipe-owners"] = v != null);
|
||||
ops.Add("perm=", delegate(string v) { options["checkPermissions"] = v; });
|
||||
|
||||
List<string> mainParams = ops.Parse(cmdparams);
|
||||
|
||||
@@ -306,10 +306,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
|
||||
protected AssetBase PostProcess(AssetBase asset)
|
||||
{
|
||||
if (asset.Type == (sbyte)AssetType.Object && asset.Data != null && m_options.ContainsKey("profile"))
|
||||
if (asset.Type == (sbyte)AssetType.Object && asset.Data != null && m_options.ContainsKey("home"))
|
||||
{
|
||||
//m_log.DebugFormat("[ARCHIVER]: Rewriting object data for {0}", asset.ID);
|
||||
string xml = ExternalRepresentationUtils.RewriteSOP(Utils.BytesToString(asset.Data), m_options["profile"].ToString(), m_userAccountService, m_scopeID);
|
||||
string xml = ExternalRepresentationUtils.RewriteSOP(Utils.BytesToString(asset.Data), m_options["home"].ToString(), m_userAccountService, m_scopeID);
|
||||
asset.Data = Utils.StringToBytes(xml);
|
||||
}
|
||||
return asset;
|
||||
|
||||
@@ -248,9 +248,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||
Dictionary<string, Object> options = new Dictionary<string, Object>();
|
||||
options.Add("noassets", true);
|
||||
m_archiverModule.ArchiveRegion(archiveWriteStream, requestId, options);
|
||||
//AssetServerBase assetServer = (AssetServerBase)scene.CommsManager.AssetCache.AssetServer;
|
||||
//while (assetServer.HasWaitingRequests())
|
||||
// assetServer.ProcessNextRequest();
|
||||
|
||||
// Don't wait for completion - with --noassets save oar happens synchronously
|
||||
// Monitor.Wait(this, 60000);
|
||||
@@ -344,7 +341,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||
{
|
||||
using (BinaryReader br = new BinaryReader(resource))
|
||||
{
|
||||
// FIXME: Use the inspector insteadthere are so many forums and lists already, though admittedly none of them are suitable for cross virtual-enivornemnt discussion
|
||||
// FIXME: Use the inspector instead
|
||||
soundData = br.ReadBytes(99999999);
|
||||
UUID soundUuid = UUID.Parse("00000000-0000-0000-0000-000000000001");
|
||||
string soundAssetFileName
|
||||
@@ -409,6 +406,86 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||
Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test loading an OpenSim Region Archive saved with the --publish option.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestLoadPublishedOar()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
SceneObjectPart part1 = CreateSceneObjectPart1();
|
||||
SceneObjectGroup sog1 = new SceneObjectGroup(part1);
|
||||
m_scene.AddNewSceneObject(sog1, false);
|
||||
|
||||
SceneObjectPart part2 = CreateSceneObjectPart2();
|
||||
|
||||
AssetNotecard nc = new AssetNotecard();
|
||||
nc.BodyText = "Hello World!";
|
||||
nc.Encode();
|
||||
UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
|
||||
UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
|
||||
AssetBase ncAsset
|
||||
= AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero);
|
||||
m_scene.AssetService.Store(ncAsset);
|
||||
SceneObjectGroup sog2 = new SceneObjectGroup(part2);
|
||||
TaskInventoryItem ncItem
|
||||
= new TaskInventoryItem { Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid };
|
||||
part2.Inventory.AddInventoryItem(ncItem, true);
|
||||
|
||||
m_scene.AddNewSceneObject(sog2, false);
|
||||
|
||||
MemoryStream archiveWriteStream = new MemoryStream();
|
||||
m_scene.EventManager.OnOarFileSaved += SaveCompleted;
|
||||
|
||||
Guid requestId = new Guid("00000000-0000-0000-0000-808080808080");
|
||||
|
||||
lock (this)
|
||||
{
|
||||
m_archiverModule.ArchiveRegion(
|
||||
archiveWriteStream, requestId, new Dictionary<string, Object>() { { "wipe-owners", Boolean.TrueString } });
|
||||
|
||||
Monitor.Wait(this, 60000);
|
||||
}
|
||||
|
||||
Assert.That(m_lastRequestId, Is.EqualTo(requestId));
|
||||
|
||||
byte[] archive = archiveWriteStream.ToArray();
|
||||
MemoryStream archiveReadStream = new MemoryStream(archive);
|
||||
|
||||
{
|
||||
UUID estateOwner = TestHelpers.ParseTail(0x4747);
|
||||
UUID objectOwner = TestHelpers.ParseTail(0x15);
|
||||
|
||||
// Reload to new scene
|
||||
ArchiverModule archiverModule = new ArchiverModule();
|
||||
SerialiserModule serialiserModule = new SerialiserModule();
|
||||
TerrainModule terrainModule = new TerrainModule();
|
||||
|
||||
TestScene scene2 = 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
|
||||
// behaving correctly
|
||||
UserAccountHelpers.CreateUserWithInventory(scene2, objectOwner);
|
||||
|
||||
scene2.RegionInfo.EstateSettings.EstateOwner = estateOwner;
|
||||
|
||||
lock (this)
|
||||
{
|
||||
scene2.EventManager.OnOarFileLoaded += LoadCompleted;
|
||||
archiverModule.DearchiveRegion(archiveReadStream);
|
||||
}
|
||||
|
||||
Assert.That(m_lastErrorMessage, Is.Null);
|
||||
|
||||
SceneObjectGroup loadedSog = scene2.GetSceneObjectGroup(part1.Name);
|
||||
Assert.That(loadedSog.OwnerID, Is.EqualTo(estateOwner));
|
||||
Assert.That(loadedSog.LastOwnerID, Is.EqualTo(estateOwner));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test loading the region settings of an OpenSim Region Archive.
|
||||
/// </summary>
|
||||
|
||||
@@ -55,6 +55,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
protected EstateManagementCommands m_commands;
|
||||
|
||||
private EstateTerrainXferHandler TerrainUploader;
|
||||
public TelehubManager m_Telehub;
|
||||
|
||||
public event ChangeDelegate OnRegionInfoChange;
|
||||
public event ChangeDelegate OnEstateInfoChange;
|
||||
@@ -87,6 +88,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
GetEstateFlags(),
|
||||
sun,
|
||||
Scene.RegionInfo.RegionSettings.Covenant,
|
||||
(uint) Scene.RegionInfo.RegionSettings.CovenantChangedDateTime,
|
||||
Scene.RegionInfo.EstateSettings.AbuseEmail,
|
||||
estateOwner);
|
||||
}
|
||||
@@ -255,6 +257,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
IRestartModule restartModule = Scene.RequestModuleInterface<IRestartModule>();
|
||||
if (restartModule != null)
|
||||
{
|
||||
if (timeInSeconds == -1)
|
||||
{
|
||||
restartModule.AbortRestart("Restart aborted by region manager");
|
||||
return;
|
||||
}
|
||||
|
||||
List<int> times = new List<int>();
|
||||
while (timeInSeconds > 0)
|
||||
{
|
||||
@@ -278,6 +286,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
// remoteClient.Name, estateCovenantID);
|
||||
|
||||
Scene.RegionInfo.RegionSettings.Covenant = estateCovenantID;
|
||||
Scene.RegionInfo.RegionSettings.CovenantChangedDateTime = Util.UnixTimeSinceEpoch();
|
||||
Scene.RegionInfo.RegionSettings.Save();
|
||||
TriggerRegionInfoChange();
|
||||
}
|
||||
@@ -614,6 +623,50 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
}
|
||||
}
|
||||
|
||||
public void handleOnEstateManageTelehub (IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1)
|
||||
{
|
||||
uint ObjectLocalID;
|
||||
SceneObjectPart part;
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
case "info ui":
|
||||
break;
|
||||
|
||||
case "connect":
|
||||
// Add the Telehub
|
||||
part = Scene.GetSceneObjectPart((uint)param1);
|
||||
if (part == null)
|
||||
return;
|
||||
SceneObjectGroup grp = part.ParentGroup;
|
||||
|
||||
m_Telehub.Connect(grp);
|
||||
break;
|
||||
|
||||
case "delete":
|
||||
// Disconnect Telehub
|
||||
m_Telehub.Disconnect();
|
||||
break;
|
||||
|
||||
case "spawnpoint add":
|
||||
// Add SpawnPoint to the Telehub
|
||||
part = Scene.GetSceneObjectPart((uint)param1);
|
||||
if (part == null)
|
||||
return;
|
||||
m_Telehub.AddSpawnPoint(part.AbsolutePosition);
|
||||
break;
|
||||
|
||||
case "spawnpoint remove":
|
||||
// Remove SpawnPoint from Telehub
|
||||
m_Telehub.RemoveSpawnPoint((int)param1);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
SendTelehubInfo(client);
|
||||
}
|
||||
|
||||
private void SendSimulatorBlueBoxMessage(
|
||||
IClientAPI remote_client, UUID invoice, UUID senderID, UUID sessionID, string senderName, string message)
|
||||
{
|
||||
@@ -1084,7 +1137,9 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
Scene.RegisterModuleInterface<IEstateModule>(this);
|
||||
Scene.EventManager.OnNewClient += EventManager_OnNewClient;
|
||||
Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight;
|
||||
|
||||
|
||||
m_Telehub = new TelehubManager(scene);
|
||||
|
||||
m_commands = new EstateManagementCommands(this);
|
||||
m_commands.Initialise();
|
||||
}
|
||||
@@ -1138,6 +1193,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
client.OnEstateRestartSimRequest += handleEstateRestartSimRequest;
|
||||
client.OnEstateChangeCovenantRequest += handleChangeEstateCovenantRequest;
|
||||
client.OnEstateChangeInfo += handleEstateChangeInfo;
|
||||
client.OnEstateManageTelehub += handleOnEstateManageTelehub;
|
||||
client.OnUpdateEstateAccessDeltaRequest += handleEstateAccessDeltaRequest;
|
||||
client.OnSimulatorBlueBoxMessageRequest += SendSimulatorBlueBoxMessage;
|
||||
client.OnEstateBlueBoxMessageRequest += SendEstateBlueBoxMessage;
|
||||
@@ -1292,5 +1348,39 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
if (onmessage != null)
|
||||
onmessage(Scene.RegionInfo.RegionID, fromID, fromName, message);
|
||||
}
|
||||
|
||||
|
||||
private void SendTelehubInfo(IClientAPI client)
|
||||
{
|
||||
RegionSettings settings =
|
||||
this.Scene.RegionInfo.RegionSettings;
|
||||
|
||||
SceneObjectGroup telehub = null;
|
||||
if (settings.TelehubObject != UUID.Zero &&
|
||||
(telehub = Scene.GetSceneObjectGroup(settings.TelehubObject)) != null)
|
||||
{
|
||||
List<Vector3> spawnPoints = new List<Vector3>();
|
||||
|
||||
foreach (SpawnPoint sp in settings.SpawnPoints())
|
||||
{
|
||||
spawnPoints.Add(sp.GetLocation(Vector3.Zero, Quaternion.Identity));
|
||||
}
|
||||
|
||||
client.SendTelehubInfo(settings.TelehubObject,
|
||||
telehub.Name,
|
||||
telehub.AbsolutePosition,
|
||||
telehub.GroupRotation,
|
||||
spawnPoints);
|
||||
}
|
||||
else
|
||||
{
|
||||
client.SendTelehubInfo(UUID.Zero,
|
||||
String.Empty,
|
||||
Vector3.Zero,
|
||||
Quaternion.Identity,
|
||||
new List<Vector3>());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
95
OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs
Normal file
95
OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* 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 OpenMetaverse;
|
||||
using System.Collections.Generic;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using log4net;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.World.Estate
|
||||
{
|
||||
public class TelehubManager
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
Scene m_Scene;
|
||||
|
||||
public TelehubManager(Scene scene)
|
||||
{
|
||||
m_Scene = scene;
|
||||
}
|
||||
|
||||
// Connect the Telehub
|
||||
public void Connect(SceneObjectGroup grp)
|
||||
{
|
||||
m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints();
|
||||
|
||||
m_Scene.RegionInfo.RegionSettings.TelehubObject = grp.UUID;
|
||||
m_Scene.RegionInfo.RegionSettings.Save();
|
||||
}
|
||||
|
||||
// Disconnect the Telehub:
|
||||
public void Disconnect()
|
||||
{
|
||||
if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero)
|
||||
return;
|
||||
|
||||
m_Scene.RegionInfo.RegionSettings.TelehubObject = UUID.Zero;
|
||||
m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints();
|
||||
m_Scene.RegionInfo.RegionSettings.Save();
|
||||
}
|
||||
|
||||
// Add a SpawnPoint to the Telehub
|
||||
public void AddSpawnPoint(Vector3 point)
|
||||
{
|
||||
if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero)
|
||||
return;
|
||||
|
||||
SceneObjectGroup grp = m_Scene.GetSceneObjectGroup(m_Scene.RegionInfo.RegionSettings.TelehubObject);
|
||||
if (grp == null)
|
||||
return;
|
||||
|
||||
SpawnPoint sp = new SpawnPoint();
|
||||
sp.SetLocation(grp.AbsolutePosition, grp.GroupRotation, point);
|
||||
m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(sp);
|
||||
m_Scene.RegionInfo.RegionSettings.Save();
|
||||
}
|
||||
|
||||
// Remove a SpawnPoint from the Telehub
|
||||
public void RemoveSpawnPoint(int spawnpoint)
|
||||
{
|
||||
if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero)
|
||||
return;
|
||||
|
||||
m_Scene.RegionInfo.RegionSettings.RemoveSpawnPoint(spawnpoint);
|
||||
m_Scene.RegionInfo.RegionSettings.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -205,6 +205,8 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
client.OnParcelInfoRequest += ClientOnParcelInfoRequest;
|
||||
client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup;
|
||||
client.OnPreAgentUpdate += ClientOnPreAgentUpdate;
|
||||
client.OnParcelEjectUser += ClientOnParcelEjectUser;
|
||||
client.OnParcelFreezeUser += ClientOnParcelFreezeUser;
|
||||
|
||||
EntityBase presenceEntity;
|
||||
if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence)
|
||||
@@ -506,7 +508,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
|
||||
public void ClientOnParcelAccessListUpdateRequest(UUID agentID,
|
||||
uint flags, int landLocalID, UUID transactionID, int sequenceID,
|
||||
int sections, List<ParcelManager.ParcelAccessEntry> entries,
|
||||
int sections, List<LandAccessEntry> entries,
|
||||
IClientAPI remote_client)
|
||||
{
|
||||
// Flags is the list to update, it can mean either the ban or
|
||||
@@ -1750,191 +1752,37 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
|
||||
{
|
||||
ScenePresence targetAvatar = null;
|
||||
((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar);
|
||||
ScenePresence parcelManager = null;
|
||||
((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager);
|
||||
//Just eject
|
||||
if (flags == 0)
|
||||
{
|
||||
if (targetAvatar.UserLevel == 0)
|
||||
{
|
||||
ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
|
||||
if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze))
|
||||
return;
|
||||
|
||||
Vector3 position = new Vector3(0, 0, 0);
|
||||
List<ILandObject> allParcels = new List<ILandObject>();
|
||||
allParcels = AllParcels();
|
||||
if (allParcels.Count != 1)
|
||||
{
|
||||
foreach (ILandObject parcel in allParcels)
|
||||
{
|
||||
if (parcel.LandData.GlobalID != land.LandData.GlobalID)
|
||||
{
|
||||
if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true)
|
||||
{
|
||||
for (int x = 1; x <= Constants.RegionSize; x += 2)
|
||||
{
|
||||
for (int y = 1; y <= Constants.RegionSize; y += 2)
|
||||
{
|
||||
if (parcel.ContainsPoint(x, y))
|
||||
{
|
||||
position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z);
|
||||
targetAvatar.TeleportWithMomentum(position);
|
||||
targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
|
||||
parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vector3 targetVector;
|
||||
if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y)
|
||||
{
|
||||
if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize)
|
||||
{
|
||||
targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ;
|
||||
targetAvatar.TeleportWithMomentum(targetVector);
|
||||
targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
|
||||
parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ;
|
||||
targetAvatar.TeleportWithMomentum(targetVector);
|
||||
targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
|
||||
parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize)
|
||||
{
|
||||
targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ;
|
||||
targetAvatar.TeleportWithMomentum(targetVector);
|
||||
targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
|
||||
parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ;
|
||||
targetAvatar.TeleportWithMomentum(targetVector);
|
||||
targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
|
||||
parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//Eject and ban
|
||||
if (flags == 1)
|
||||
{
|
||||
if (targetAvatar.UserLevel == 0)
|
||||
{
|
||||
ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
|
||||
if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze))
|
||||
return;
|
||||
// Must have presences
|
||||
if (!m_scene.TryGetScenePresence(target, out targetAvatar) ||
|
||||
!m_scene.TryGetScenePresence(client.AgentId, out parcelManager))
|
||||
return;
|
||||
|
||||
Vector3 position = new Vector3(0, 0, 0);
|
||||
List<ILandObject> allParcels = new List<ILandObject>();
|
||||
allParcels = AllParcels();
|
||||
if (allParcels.Count != 1)
|
||||
{
|
||||
foreach (ILandObject parcel in allParcels)
|
||||
{
|
||||
if (parcel.LandData.GlobalID != land.LandData.GlobalID)
|
||||
{
|
||||
if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true)
|
||||
{
|
||||
for (int x = 1; x <= Constants.RegionSize; x += 2)
|
||||
{
|
||||
for (int y = 1; y <= Constants.RegionSize; y += 2)
|
||||
{
|
||||
if (parcel.ContainsPoint(x, y))
|
||||
{
|
||||
position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z);
|
||||
targetAvatar.TeleportWithMomentum(position);
|
||||
targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
|
||||
parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
|
||||
ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
|
||||
entry.AgentID = targetAvatar.UUID;
|
||||
entry.Flags = AccessList.Ban;
|
||||
entry.Time = new DateTime();
|
||||
land.LandData.ParcelAccessList.Add(entry);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vector3 targetVector;
|
||||
if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y)
|
||||
{
|
||||
if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize)
|
||||
{
|
||||
targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ;
|
||||
targetAvatar.TeleportWithMomentum(targetVector);
|
||||
targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
|
||||
parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
|
||||
ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
|
||||
entry.AgentID = targetAvatar.UUID;
|
||||
entry.Flags = AccessList.Ban;
|
||||
entry.Time = new DateTime();
|
||||
land.LandData.ParcelAccessList.Add(entry);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ;
|
||||
targetAvatar.TeleportWithMomentum(targetVector);
|
||||
targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
|
||||
parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
|
||||
ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
|
||||
entry.AgentID = targetAvatar.UUID;
|
||||
entry.Flags = AccessList.Ban;
|
||||
entry.Time = new DateTime();
|
||||
land.LandData.ParcelAccessList.Add(entry);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize)
|
||||
{
|
||||
targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ;
|
||||
targetAvatar.TeleportWithMomentum(targetVector);
|
||||
targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
|
||||
parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
|
||||
ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
|
||||
entry.AgentID = targetAvatar.UUID;
|
||||
entry.Flags = AccessList.Ban;
|
||||
entry.Time = new DateTime();
|
||||
land.LandData.ParcelAccessList.Add(entry);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ;
|
||||
targetAvatar.TeleportWithMomentum(targetVector);
|
||||
targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
|
||||
parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
|
||||
ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
|
||||
entry.AgentID = targetAvatar.UUID;
|
||||
entry.Flags = AccessList.Ban;
|
||||
entry.Time = new DateTime();
|
||||
land.LandData.ParcelAccessList.Add(entry);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Cannot eject estate managers or gods
|
||||
if (m_scene.Permissions.IsAdministrator(target))
|
||||
return;
|
||||
|
||||
// Check if you even have permission to do this
|
||||
ILandObject land = m_scene.LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
|
||||
if (!m_scene.Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze) &&
|
||||
!m_scene.Permissions.IsAdministrator(client.AgentId))
|
||||
return;
|
||||
|
||||
Vector3 pos = m_scene.GetNearestAllowedPosition(targetAvatar, land);
|
||||
|
||||
targetAvatar.TeleportWithMomentum(pos);
|
||||
targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
|
||||
parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
|
||||
|
||||
if ((flags & 1) != 0) // Ban TODO: Remove magic number
|
||||
{
|
||||
LandAccessEntry entry = new LandAccessEntry();
|
||||
entry.AgentID = targetAvatar.UUID;
|
||||
entry.Flags = AccessList.Ban;
|
||||
entry.Expires = 0; // Perm
|
||||
|
||||
land.LandData.ParcelAccessList.Add(entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -190,10 +190,11 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
else
|
||||
{
|
||||
// Normal Calculations
|
||||
int parcelMax = (int)((double)(LandData.Area
|
||||
* m_scene.RegionInfo.ObjectCapacity)
|
||||
* m_scene.RegionInfo.RegionSettings.ObjectBonus)
|
||||
/ 65536;
|
||||
int parcelMax = (int)((long)LandData.Area
|
||||
* (long)m_scene.RegionInfo.ObjectCapacity
|
||||
* (long)m_scene.RegionInfo.RegionSettings.ObjectBonus
|
||||
/ 65536L);
|
||||
m_log.DebugFormat("Area: {0}, Capacity {1}, Bonus {2}, Parcel {3}", LandData.Area, m_scene.RegionInfo.ObjectCapacity, m_scene.RegionInfo.RegionSettings.ObjectBonus, parcelMax);
|
||||
return parcelMax;
|
||||
}
|
||||
}
|
||||
@@ -207,9 +208,9 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
else
|
||||
{
|
||||
// Normal Calculations
|
||||
int parcelMax = LandData.Area
|
||||
* m_scene.RegionInfo.ObjectCapacity
|
||||
/ 65536;
|
||||
int parcelMax = (int)((long)LandData.Area
|
||||
* (long)m_scene.RegionInfo.ObjectCapacity
|
||||
/ 65536L);
|
||||
return parcelMax;
|
||||
}
|
||||
}
|
||||
@@ -223,8 +224,9 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
else
|
||||
{
|
||||
//Normal Calculations
|
||||
int simMax = (int)(((float)LandData.SimwideArea / 65536.0f)
|
||||
* (float)m_scene.RegionInfo.ObjectCapacity);
|
||||
int simMax = (int)((long)LandData.SimwideArea
|
||||
* (long)m_scene.RegionInfo.ObjectCapacity / 65536L);
|
||||
// m_log.DebugFormat("Simwide Area: {0}, Capacity {1}, SimMax {2}", LandData.SimwideArea, m_scene.RegionInfo.ObjectCapacity, simMax);
|
||||
return simMax;
|
||||
}
|
||||
}
|
||||
@@ -465,21 +467,26 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
|
||||
public bool IsBannedFromLand(UUID avatar)
|
||||
{
|
||||
ExpireAccessList();
|
||||
|
||||
if (m_scene.Permissions.IsAdministrator(avatar))
|
||||
return false;
|
||||
|
||||
if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar))
|
||||
return false;
|
||||
|
||||
if (avatar == LandData.OwnerID)
|
||||
return false;
|
||||
|
||||
if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0)
|
||||
{
|
||||
if (LandData.ParcelAccessList.FindIndex(
|
||||
delegate(ParcelManager.ParcelAccessEntry e)
|
||||
delegate(LandAccessEntry e)
|
||||
{
|
||||
if (e.AgentID == avatar && e.Flags == AccessList.Ban)
|
||||
return true;
|
||||
return false;
|
||||
}) != -1 && LandData.OwnerID != avatar)
|
||||
}) != -1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -489,21 +496,26 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
|
||||
public bool IsRestrictedFromLand(UUID avatar)
|
||||
{
|
||||
ExpireAccessList();
|
||||
|
||||
if (m_scene.Permissions.IsAdministrator(avatar))
|
||||
return false;
|
||||
|
||||
if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar))
|
||||
return false;
|
||||
|
||||
if (avatar == LandData.OwnerID)
|
||||
return false;
|
||||
|
||||
if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0)
|
||||
{
|
||||
if (LandData.ParcelAccessList.FindIndex(
|
||||
delegate(ParcelManager.ParcelAccessEntry e)
|
||||
delegate(LandAccessEntry e)
|
||||
{
|
||||
if (e.AgentID == avatar && e.Flags == AccessList.Access)
|
||||
return true;
|
||||
return false;
|
||||
}) == -1 && LandData.OwnerID != avatar)
|
||||
}) == -1)
|
||||
{
|
||||
if (!HasGroupAccess(avatar))
|
||||
{
|
||||
@@ -568,19 +580,24 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
|
||||
#region AccessList Functions
|
||||
|
||||
public List<UUID> CreateAccessListArrayByFlag(AccessList flag)
|
||||
public List<LandAccessEntry> CreateAccessListArrayByFlag(AccessList flag)
|
||||
{
|
||||
List<UUID> list = new List<UUID>();
|
||||
foreach (ParcelManager.ParcelAccessEntry entry in LandData.ParcelAccessList)
|
||||
ExpireAccessList();
|
||||
|
||||
List<LandAccessEntry> list = new List<LandAccessEntry>();
|
||||
foreach (LandAccessEntry entry in LandData.ParcelAccessList)
|
||||
{
|
||||
if (entry.Flags == flag)
|
||||
{
|
||||
list.Add(entry.AgentID);
|
||||
}
|
||||
list.Add(entry);
|
||||
}
|
||||
if (list.Count == 0)
|
||||
{
|
||||
list.Add(UUID.Zero);
|
||||
LandAccessEntry e = new LandAccessEntry();
|
||||
e.AgentID = UUID.Zero;
|
||||
e.Flags = 0;
|
||||
e.Expires = 0;
|
||||
|
||||
list.Add(e);
|
||||
}
|
||||
|
||||
return list;
|
||||
@@ -592,20 +609,20 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
|
||||
if (flags == (uint) AccessList.Access || flags == (uint) AccessList.Both)
|
||||
{
|
||||
List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Access);
|
||||
remote_client.SendLandAccessListData(avatars,(uint) AccessList.Access,LandData.LocalID);
|
||||
List<LandAccessEntry> accessEntries = CreateAccessListArrayByFlag(AccessList.Access);
|
||||
remote_client.SendLandAccessListData(accessEntries,(uint) AccessList.Access,LandData.LocalID);
|
||||
}
|
||||
|
||||
if (flags == (uint) AccessList.Ban || flags == (uint) AccessList.Both)
|
||||
{
|
||||
List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Ban);
|
||||
remote_client.SendLandAccessListData(avatars, (uint)AccessList.Ban, LandData.LocalID);
|
||||
List<LandAccessEntry> accessEntries = CreateAccessListArrayByFlag(AccessList.Ban);
|
||||
remote_client.SendLandAccessListData(accessEntries, (uint)AccessList.Ban, LandData.LocalID);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateAccessList(uint flags, UUID transactionID,
|
||||
int sequenceID, int sections,
|
||||
List<ParcelManager.ParcelAccessEntry> entries,
|
||||
List<LandAccessEntry> entries,
|
||||
IClientAPI remote_client)
|
||||
{
|
||||
LandData newData = LandData.Copy();
|
||||
@@ -615,16 +632,16 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
{
|
||||
m_listTransactions[flags] = transactionID;
|
||||
|
||||
List<ParcelManager.ParcelAccessEntry> toRemove =
|
||||
new List<ParcelManager.ParcelAccessEntry>();
|
||||
List<LandAccessEntry> toRemove =
|
||||
new List<LandAccessEntry>();
|
||||
|
||||
foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList)
|
||||
foreach (LandAccessEntry entry in newData.ParcelAccessList)
|
||||
{
|
||||
if (entry.Flags == (AccessList)flags)
|
||||
toRemove.Add(entry);
|
||||
}
|
||||
|
||||
foreach (ParcelManager.ParcelAccessEntry entry in toRemove)
|
||||
foreach (LandAccessEntry entry in toRemove)
|
||||
{
|
||||
newData.ParcelAccessList.Remove(entry);
|
||||
}
|
||||
@@ -639,13 +656,13 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
}
|
||||
}
|
||||
|
||||
foreach (ParcelManager.ParcelAccessEntry entry in entries)
|
||||
foreach (LandAccessEntry entry in entries)
|
||||
{
|
||||
ParcelManager.ParcelAccessEntry temp =
|
||||
new ParcelManager.ParcelAccessEntry();
|
||||
LandAccessEntry temp =
|
||||
new LandAccessEntry();
|
||||
|
||||
temp.AgentID = entry.AgentID;
|
||||
temp.Time = entry.Time;
|
||||
temp.Expires = entry.Expires;
|
||||
temp.Flags = (AccessList)flags;
|
||||
|
||||
newData.ParcelAccessList.Add(temp);
|
||||
@@ -1151,7 +1168,32 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
LandData.MusicURL = url;
|
||||
SendLandUpdateToAvatarsOverMe();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get the music url for this land parcel
|
||||
/// </summary>
|
||||
/// <returns>The music url.</returns>
|
||||
public string GetMusicUrl()
|
||||
{
|
||||
return LandData.MusicURL;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void ExpireAccessList()
|
||||
{
|
||||
List<LandAccessEntry> delete = new List<LandAccessEntry>();
|
||||
|
||||
foreach (LandAccessEntry entry in LandData.ParcelAccessList)
|
||||
{
|
||||
if (entry.Expires != 0 && entry.Expires < Util.UnixTimeSinceEpoch())
|
||||
delete.Add(entry);
|
||||
}
|
||||
foreach (LandAccessEntry entry in delete)
|
||||
LandData.ParcelAccessList.Remove(entry);
|
||||
|
||||
if (delete.Count > 0)
|
||||
m_scene.EventManager.TriggerLandObjectUpdated((uint)LandData.LocalID, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,410 @@
|
||||
/*
|
||||
* 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 System.Text;
|
||||
using log4net;
|
||||
using Mono.Addins;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Statistics;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.World.Objects.Commands
|
||||
{
|
||||
/// <summary>
|
||||
/// A module that holds commands for manipulating objects in the scene.
|
||||
/// </summary>
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ObjectCommandsModule")]
|
||||
public class ObjectCommandsModule : INonSharedRegionModule
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_scene;
|
||||
private ICommandConsole m_console;
|
||||
|
||||
public string Name { get { return "Object Commands Module"; } }
|
||||
|
||||
public Type ReplaceableInterface { get { return null; } }
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
// m_log.DebugFormat("[OBJECT COMMANDS MODULE]: INITIALIZED MODULE");
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
// m_log.DebugFormat("[OBJECT COMMANDS MODULE]: POST INITIALIZED MODULE");
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
// m_log.DebugFormat("[OBJECT COMMANDS MODULE]: CLOSED MODULE");
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
// m_log.DebugFormat("[OBJECT COMMANDS MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName);
|
||||
|
||||
m_scene = scene;
|
||||
m_console = MainConsole.Instance;
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "delete object owner",
|
||||
"delete object owner <UUID>",
|
||||
"Delete a scene object by owner", HandleDeleteObject);
|
||||
m_console.Commands.AddCommand("region", false, "delete object creator",
|
||||
"delete object creator <UUID>",
|
||||
"Delete a scene object by creator", HandleDeleteObject);
|
||||
m_console.Commands.AddCommand("region", false, "delete object uuid",
|
||||
"delete object uuid <UUID>",
|
||||
"Delete a scene object by uuid", HandleDeleteObject);
|
||||
m_console.Commands.AddCommand("region", false, "delete object name",
|
||||
"delete object name <name>",
|
||||
"Delete a scene object by name", HandleDeleteObject);
|
||||
m_console.Commands.AddCommand("region", false, "delete object outside",
|
||||
"delete object outside",
|
||||
"Delete all scene objects outside region boundaries", HandleDeleteObject);
|
||||
|
||||
m_console.Commands.AddCommand(
|
||||
"region",
|
||||
false,
|
||||
"show object uuid",
|
||||
"show object uuid <UUID>",
|
||||
"Show details of a scene object with the given UUID", HandleShowObjectByUuid);
|
||||
|
||||
m_console.Commands.AddCommand(
|
||||
"region",
|
||||
false,
|
||||
"show object name",
|
||||
"show object name <name>",
|
||||
"Show details of scene objects with the given name", HandleShowObjectByName);
|
||||
|
||||
m_console.Commands.AddCommand(
|
||||
"region",
|
||||
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",
|
||||
false,
|
||||
"show part name",
|
||||
"show part name <name>",
|
||||
"Show details of scene object parts with the given name", HandleShowPartByName);
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
// m_log.DebugFormat("[OBJECTS COMMANDS MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName);
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
// m_log.DebugFormat("[OBJECTS COMMANDS MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName);
|
||||
}
|
||||
|
||||
private void HandleShowObjectByUuid(string module, string[] cmd)
|
||||
{
|
||||
if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
|
||||
return;
|
||||
|
||||
if (cmd.Length < 4)
|
||||
{
|
||||
m_console.OutputFormat("Usage: show object uuid <uuid>");
|
||||
return;
|
||||
}
|
||||
|
||||
UUID objectUuid;
|
||||
if (!UUID.TryParse(cmd[3], out objectUuid))
|
||||
{
|
||||
m_console.OutputFormat("{0} is not a valid uuid", cmd[3]);
|
||||
return;
|
||||
}
|
||||
|
||||
SceneObjectGroup so = m_scene.GetSceneObjectGroup(objectUuid);
|
||||
|
||||
if (so == null)
|
||||
{
|
||||
// m_console.OutputFormat("No part found with uuid {0}", objectUuid);
|
||||
return;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
AddSceneObjectReport(sb, so);
|
||||
|
||||
m_console.OutputFormat(sb.ToString());
|
||||
}
|
||||
|
||||
private void HandleShowObjectByName(string module, string[] cmd)
|
||||
{
|
||||
if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
|
||||
return;
|
||||
|
||||
if (cmd.Length < 4)
|
||||
{
|
||||
m_console.OutputFormat("Usage: show object name <name>");
|
||||
return;
|
||||
}
|
||||
|
||||
string name = cmd[3];
|
||||
|
||||
List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
|
||||
|
||||
m_scene.ForEachSOG(so => { if (so.Name == name) { sceneObjects.Add(so); }});
|
||||
|
||||
if (sceneObjects.Count == 0)
|
||||
{
|
||||
m_console.OutputFormat("No objects with name {0} found in {1}", name, m_scene.RegionInfo.RegionName);
|
||||
return;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
foreach (SceneObjectGroup so in sceneObjects)
|
||||
{
|
||||
AddSceneObjectReport(sb, so);
|
||||
sb.Append("\n");
|
||||
}
|
||||
|
||||
m_console.OutputFormat(sb.ToString());
|
||||
}
|
||||
|
||||
private void HandleShowPartByUuid(string module, string[] cmd)
|
||||
{
|
||||
if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
|
||||
return;
|
||||
|
||||
if (cmd.Length < 4)
|
||||
{
|
||||
m_console.OutputFormat("Usage: show part uuid <uuid>");
|
||||
return;
|
||||
}
|
||||
|
||||
UUID objectUuid;
|
||||
if (!UUID.TryParse(cmd[3], out objectUuid))
|
||||
{
|
||||
m_console.OutputFormat("{0} is not a valid uuid", cmd[3]);
|
||||
return;
|
||||
}
|
||||
|
||||
SceneObjectPart sop = m_scene.GetSceneObjectPart(objectUuid);
|
||||
|
||||
if (sop == null)
|
||||
{
|
||||
// m_console.OutputFormat("No part found with uuid {0}", objectUuid);
|
||||
return;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
AddScenePartReport(sb, sop);
|
||||
|
||||
m_console.OutputFormat(sb.ToString());
|
||||
}
|
||||
|
||||
private void HandleShowPartByName(string module, string[] cmd)
|
||||
{
|
||||
if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
|
||||
return;
|
||||
|
||||
if (cmd.Length < 4)
|
||||
{
|
||||
m_console.OutputFormat("Usage: show part name <name>");
|
||||
return;
|
||||
}
|
||||
|
||||
string name = cmd[3];
|
||||
|
||||
List<SceneObjectPart> parts = new List<SceneObjectPart>();
|
||||
|
||||
m_scene.ForEachSOG(so => so.ForEachPart(sop => { if (sop.Name == name) { parts.Add(sop); } }));
|
||||
|
||||
if (parts.Count == 0)
|
||||
{
|
||||
m_console.OutputFormat("No parts with name {0} found in {1}", name, m_scene.RegionInfo.RegionName);
|
||||
return;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
foreach (SceneObjectPart part in parts)
|
||||
{
|
||||
AddScenePartReport(sb, part);
|
||||
sb.Append("\n");
|
||||
}
|
||||
|
||||
m_console.OutputFormat(sb.ToString());
|
||||
}
|
||||
|
||||
private StringBuilder AddSceneObjectReport(StringBuilder sb, SceneObjectGroup so)
|
||||
{
|
||||
sb.AppendFormat("Name: {0}\n", so.Name);
|
||||
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);
|
||||
|
||||
return sb;
|
||||
}
|
||||
|
||||
private StringBuilder AddScenePartReport(StringBuilder sb, SceneObjectPart sop)
|
||||
{
|
||||
sb.AppendFormat("Name: {0}\n", sop.Name);
|
||||
sb.AppendFormat("Description: {0}\n", sop.Description);
|
||||
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());;
|
||||
|
||||
return sb;
|
||||
}
|
||||
|
||||
private void HandleDeleteObject(string module, string[] cmd)
|
||||
{
|
||||
if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
|
||||
return;
|
||||
|
||||
if (cmd.Length < 3)
|
||||
return;
|
||||
|
||||
string mode = cmd[2];
|
||||
string o = "";
|
||||
|
||||
if (mode != "outside")
|
||||
{
|
||||
if (cmd.Length < 4)
|
||||
return;
|
||||
|
||||
o = cmd[3];
|
||||
}
|
||||
|
||||
List<SceneObjectGroup> deletes = new List<SceneObjectGroup>();
|
||||
|
||||
UUID match;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case "owner":
|
||||
if (!UUID.TryParse(o, out match))
|
||||
return;
|
||||
|
||||
m_scene.ForEachSOG(delegate (SceneObjectGroup g)
|
||||
{
|
||||
if (g.OwnerID == match && !g.IsAttachment)
|
||||
deletes.Add(g);
|
||||
});
|
||||
|
||||
// if (deletes.Count == 0)
|
||||
// m_console.OutputFormat("No objects were found with owner {0}", match);
|
||||
|
||||
break;
|
||||
|
||||
case "creator":
|
||||
if (!UUID.TryParse(o, out match))
|
||||
return;
|
||||
|
||||
m_scene.ForEachSOG(delegate (SceneObjectGroup g)
|
||||
{
|
||||
if (g.RootPart.CreatorID == match && !g.IsAttachment)
|
||||
deletes.Add(g);
|
||||
});
|
||||
|
||||
// if (deletes.Count == 0)
|
||||
// m_console.OutputFormat("No objects were found with creator {0}", match);
|
||||
|
||||
break;
|
||||
|
||||
case "uuid":
|
||||
if (!UUID.TryParse(o, out match))
|
||||
return;
|
||||
|
||||
m_scene.ForEachSOG(delegate (SceneObjectGroup g)
|
||||
{
|
||||
if (g.UUID == match && !g.IsAttachment)
|
||||
deletes.Add(g);
|
||||
});
|
||||
|
||||
// if (deletes.Count == 0)
|
||||
// m_console.OutputFormat("No objects were found with uuid {0}", match);
|
||||
|
||||
break;
|
||||
|
||||
case "name":
|
||||
m_scene.ForEachSOG(delegate (SceneObjectGroup g)
|
||||
{
|
||||
if (g.RootPart.Name == o && !g.IsAttachment)
|
||||
deletes.Add(g);
|
||||
});
|
||||
|
||||
// if (deletes.Count == 0)
|
||||
// m_console.OutputFormat("No objects were found with name {0}", o);
|
||||
|
||||
break;
|
||||
|
||||
case "outside":
|
||||
m_scene.ForEachSOG(delegate (SceneObjectGroup g)
|
||||
{
|
||||
SceneObjectPart rootPart = g.RootPart;
|
||||
bool delete = false;
|
||||
|
||||
if (rootPart.GroupPosition.Z < 0.0 || rootPart.GroupPosition.Z > 10000.0)
|
||||
{
|
||||
delete = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ILandObject parcel
|
||||
= m_scene.LandChannel.GetLandObject(rootPart.GroupPosition.X, rootPart.GroupPosition.Y);
|
||||
|
||||
if (parcel == null || parcel.LandData.Name == "NO LAND")
|
||||
delete = true;
|
||||
}
|
||||
|
||||
if (delete && !g.IsAttachment && !deletes.Contains(g))
|
||||
deletes.Add(g);
|
||||
});
|
||||
|
||||
// if (deletes.Count == 0)
|
||||
// m_console.OutputFormat("No objects were found outside region bounds");
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
m_console.OutputFormat("Deleting {0} objects in {1}", deletes.Count, m_scene.RegionInfo.RegionName);
|
||||
|
||||
foreach (SceneObjectGroup g in deletes)
|
||||
{
|
||||
m_console.OutputFormat("Deleting object {0} {1}", g.UUID, g.Name);
|
||||
m_scene.DeleteSceneObject(g, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -240,6 +240,9 @@ namespace OpenSim.Region.CoreModules.World.Region
|
||||
if (m_DialogModule != null && message != String.Empty)
|
||||
m_DialogModule.SendGeneralAlert(message);
|
||||
}
|
||||
if (m_MarkerPath != String.Empty)
|
||||
File.Delete(Path.Combine(m_MarkerPath,
|
||||
m_Scene.RegionInfo.RegionID.ToString()));
|
||||
}
|
||||
|
||||
private void HandleRegionRestart(string module, string[] args)
|
||||
|
||||
@@ -213,7 +213,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
UUID agentID, Caps caps)
|
||||
{
|
||||
//try
|
||||
//{
|
||||
//
|
||||
//m_log.DebugFormat("[MAPLAYER]: path: {0}, param: {1}, agent:{2}",
|
||||
// path, param, agentID.ToString());
|
||||
|
||||
@@ -263,7 +263,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
foreach (GridRegion r in regions)
|
||||
{
|
||||
MapBlockData block = new MapBlockData();
|
||||
MapBlockFromGridRegion(block, r);
|
||||
MapBlockFromGridRegion(block, r, 0);
|
||||
mapBlocks.Add(block);
|
||||
}
|
||||
avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0);
|
||||
@@ -288,7 +288,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
/// <returns></returns>
|
||||
public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq)
|
||||
{
|
||||
m_log.DebugFormat("[WORLD MAP]: MapLayer Request in region: {0}", m_scene.RegionInfo.RegionName);
|
||||
// m_log.DebugFormat("[WORLD MAP]: MapLayer Request in region: {0}", m_scene.RegionInfo.RegionName);
|
||||
LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse();
|
||||
mapResponse.LayerData.Array.Add(GetOSDMapLayerResponse());
|
||||
return mapResponse;
|
||||
@@ -373,7 +373,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
public virtual void HandleMapItemRequest(IClientAPI remoteClient, uint flags,
|
||||
uint EstateID, bool godlike, uint itemtype, ulong regionhandle)
|
||||
{
|
||||
// m_log.DebugFormat("[WORLD MAP]: Handle MapItem request {0} {1}", regionhandle, itemtype);
|
||||
// m_log.DebugFormat("[WORLD MAP]: Handle MapItem request {0} {1}", regionhandle, itemtype);
|
||||
|
||||
lock (m_rootAgents)
|
||||
{
|
||||
@@ -429,7 +429,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
// ensures that the blockingqueue doesn't get borked if the GetAgents() timing changes.
|
||||
RequestMapItems("",remoteClient.AgentId,flags,EstateID,godlike,itemtype,regionhandle);
|
||||
}
|
||||
} else if (itemtype == 7) // Service 7 (MAP_ITEM_LAND_FOR_SALE)
|
||||
}
|
||||
else if (itemtype == 7) // Service 7 (MAP_ITEM_LAND_FOR_SALE)
|
||||
{
|
||||
if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle)
|
||||
{
|
||||
@@ -463,7 +464,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
mapitem.x = (uint)(xstart + x);
|
||||
mapitem.y = (uint)(ystart + y);
|
||||
// mapitem.z = (uint)m_scene.GetGroundHeight(x,y);
|
||||
mapitem.id = UUID.Zero;
|
||||
mapitem.id = parcel.GlobalID;
|
||||
mapitem.name = parcel.Name;
|
||||
mapitem.Extra = parcel.Area;
|
||||
mapitem.Extra2 = parcel.SalePrice;
|
||||
@@ -481,6 +482,34 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
RequestMapItems("",remoteClient.AgentId,flags,EstateID,godlike,itemtype,regionhandle);
|
||||
}
|
||||
}
|
||||
else if (itemtype == 1) // Service 1 (MAP_ITEM_TELEHUB)
|
||||
{
|
||||
if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle)
|
||||
{
|
||||
List<mapItemReply> mapitems = new List<mapItemReply>();
|
||||
mapItemReply mapitem = new mapItemReply();
|
||||
|
||||
SceneObjectGroup sog = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject);
|
||||
if (sog != null)
|
||||
{
|
||||
mapitem = new mapItemReply();
|
||||
mapitem.x = (uint)(xstart + sog.AbsolutePosition.X);
|
||||
mapitem.y = (uint)(ystart + sog.AbsolutePosition.Y);
|
||||
mapitem.id = UUID.Zero;
|
||||
mapitem.name = sog.Name;
|
||||
mapitem.Extra = 0; // color (not used)
|
||||
mapitem.Extra2 = 0; // 0 = telehub / 1 = infohub
|
||||
mapitems.Add(mapitem);
|
||||
|
||||
remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remote Map Item Request
|
||||
RequestMapItems("",remoteClient.AgentId,flags,EstateID,godlike,itemtype,regionhandle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int nAsyncRequests = 0;
|
||||
@@ -620,6 +649,28 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
}
|
||||
av.ControllingClient.SendMapItemReply(returnitems.ToArray(), itemtype, mrs.flags);
|
||||
}
|
||||
|
||||
// Service 1 (MAP_ITEM_TELEHUB)
|
||||
itemtype = 1;
|
||||
|
||||
if (response.ContainsKey(itemtype.ToString()))
|
||||
{
|
||||
List<mapItemReply> returnitems = new List<mapItemReply>();
|
||||
OSDArray itemarray = (OSDArray)response[itemtype.ToString()];
|
||||
for (int i = 0; i < itemarray.Count; i++)
|
||||
{
|
||||
OSDMap mapitem = (OSDMap)itemarray[i];
|
||||
mapItemReply mi = new mapItemReply();
|
||||
mi.x = (uint)mapitem["X"].AsInteger();
|
||||
mi.y = (uint)mapitem["Y"].AsInteger();
|
||||
mi.id = mapitem["ID"].AsUUID();
|
||||
mi.Extra = mapitem["Extra"].AsInteger();
|
||||
mi.Extra2 = mapitem["Extra2"].AsInteger();
|
||||
mi.name = mapitem["Name"].AsString();
|
||||
returnitems.Add(mi);
|
||||
}
|
||||
av.ControllingClient.SendMapItemReply(returnitems.ToArray(), itemtype, mrs.flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -904,8 +955,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
{
|
||||
List<MapBlockData> response = new List<MapBlockData>();
|
||||
|
||||
// this should return one mapblock at most.
|
||||
// (diva note: why?? in that case we should GetRegionByPosition)
|
||||
// this should return one mapblock at most. It is triggered by a click
|
||||
// on an unloaded square.
|
||||
// But make sure: Look whether the one we requested is in there
|
||||
List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
|
||||
minX * (int)Constants.RegionSize,
|
||||
@@ -922,7 +973,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
{
|
||||
// found it => add it to response
|
||||
MapBlockData block = new MapBlockData();
|
||||
MapBlockFromGridRegion(block, r);
|
||||
MapBlockFromGridRegion(block, r, flag);
|
||||
response.Add(block);
|
||||
break;
|
||||
}
|
||||
@@ -938,10 +989,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
block.Access = 254; // means 'simulator is offline'
|
||||
response.Add(block);
|
||||
}
|
||||
if ((flag & 2) == 2) // V2 !!!
|
||||
remoteClient.SendMapBlock(response, 2);
|
||||
else
|
||||
remoteClient.SendMapBlock(response, 0);
|
||||
// The lower 16 bits are an unsigned int16
|
||||
remoteClient.SendMapBlock(response, flag & 0xffff);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -961,21 +1010,29 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
foreach (GridRegion r in regions)
|
||||
{
|
||||
MapBlockData block = new MapBlockData();
|
||||
MapBlockFromGridRegion(block, r);
|
||||
MapBlockFromGridRegion(block, r, flag);
|
||||
mapBlocks.Add(block);
|
||||
}
|
||||
if ((flag & 2) == 2) // V2 !!!
|
||||
remoteClient.SendMapBlock(mapBlocks, 2);
|
||||
else
|
||||
remoteClient.SendMapBlock(mapBlocks, 0);
|
||||
remoteClient.SendMapBlock(mapBlocks, flag & 0xffff);
|
||||
|
||||
return mapBlocks;
|
||||
}
|
||||
|
||||
protected void MapBlockFromGridRegion(MapBlockData block, GridRegion r)
|
||||
protected void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag)
|
||||
{
|
||||
block.Access = r.Access;
|
||||
block.MapImageId = r.TerrainImage;
|
||||
switch (flag & 0xffff)
|
||||
{
|
||||
case 0:
|
||||
block.MapImageId = r.TerrainImage;
|
||||
break;
|
||||
case 2:
|
||||
block.MapImageId = r.ParcelImage;
|
||||
break;
|
||||
default:
|
||||
block.MapImageId = UUID.Zero;
|
||||
break;
|
||||
}
|
||||
block.Name = r.RegionName;
|
||||
block.X = (ushort)(r.RegionLocX / Constants.RegionSize);
|
||||
block.Y = (ushort)(r.RegionLocY / Constants.RegionSize);
|
||||
@@ -1109,7 +1166,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
foreach (GridRegion r in regions)
|
||||
{
|
||||
MapBlockData mapBlock = new MapBlockData();
|
||||
MapBlockFromGridRegion(mapBlock, r);
|
||||
MapBlockFromGridRegion(mapBlock, r, 0);
|
||||
AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString());
|
||||
|
||||
if (texAsset != null)
|
||||
@@ -1240,7 +1297,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
responsemapdata["X"] = OSD.FromInteger((int)(xstart + x));
|
||||
responsemapdata["Y"] = OSD.FromInteger((int)(ystart + y));
|
||||
// responsemapdata["Z"] = OSD.FromInteger((int)m_scene.GetGroundHeight(x,y));
|
||||
responsemapdata["ID"] = OSD.FromUUID(UUID.Zero);
|
||||
responsemapdata["ID"] = OSD.FromUUID(parcel.GlobalID);
|
||||
responsemapdata["Name"] = OSD.FromString(parcel.Name);
|
||||
responsemapdata["Extra"] = OSD.FromInteger(parcel.Area);
|
||||
responsemapdata["Extra2"] = OSD.FromInteger(parcel.SalePrice);
|
||||
@@ -1250,6 +1307,26 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
responsemap["7"] = responsearr;
|
||||
}
|
||||
|
||||
if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero)
|
||||
{
|
||||
SceneObjectGroup sog = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject);
|
||||
if (sog != null)
|
||||
{
|
||||
OSDArray responsearr = new OSDArray();
|
||||
OSDMap responsemapdata = new OSDMap();
|
||||
responsemapdata["X"] = OSD.FromInteger((int)(xstart + sog.AbsolutePosition.X));
|
||||
responsemapdata["Y"] = OSD.FromInteger((int)(ystart + sog.AbsolutePosition.Y));
|
||||
// responsemapdata["Z"] = OSD.FromInteger((int)m_scene.GetGroundHeight(x,y));
|
||||
responsemapdata["ID"] = OSD.FromUUID(sog.UUID);
|
||||
responsemapdata["Name"] = OSD.FromString(sog.Name);
|
||||
responsemapdata["Extra"] = OSD.FromInteger(0); // color (unused)
|
||||
responsemapdata["Extra2"] = OSD.FromInteger(0); // 0 = telehub / 1 = infohub
|
||||
responsearr.Add(responsemapdata);
|
||||
|
||||
responsemap["1"] = responsearr;
|
||||
}
|
||||
}
|
||||
|
||||
return responsemap;
|
||||
}
|
||||
|
||||
@@ -1268,9 +1345,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
if (data == null)
|
||||
return;
|
||||
|
||||
byte[] overlay = GenerateOverlay();
|
||||
|
||||
m_log.Debug("[WORLDMAP]: STORING MAPTILE IMAGE");
|
||||
|
||||
UUID terrainImageID = UUID.Random();
|
||||
UUID parcelImageID = UUID.Zero;
|
||||
|
||||
AssetBase asset = new AssetBase(
|
||||
terrainImageID,
|
||||
@@ -1286,14 +1366,35 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
m_log.DebugFormat("[WORLDMAP]: Storing map tile {0}", asset.ID);
|
||||
m_scene.AssetService.Store(asset);
|
||||
|
||||
if (overlay != null)
|
||||
{
|
||||
parcelImageID = UUID.Random();
|
||||
|
||||
AssetBase parcels = new AssetBase(
|
||||
parcelImageID,
|
||||
"parcelImage_" + m_scene.RegionInfo.RegionID.ToString(),
|
||||
(sbyte)AssetType.Texture,
|
||||
m_scene.RegionInfo.RegionID.ToString());
|
||||
parcels.Data = overlay;
|
||||
parcels.Description = m_scene.RegionInfo.RegionName;
|
||||
parcels.Temporary = false;
|
||||
parcels.Flags = AssetFlags.Maptile;
|
||||
|
||||
m_scene.AssetService.Store(parcels);
|
||||
}
|
||||
|
||||
// Switch to the new one
|
||||
UUID lastMapRegionUUID = m_scene.RegionInfo.RegionSettings.TerrainImageID;
|
||||
UUID lastTerrainImageID = m_scene.RegionInfo.RegionSettings.TerrainImageID;
|
||||
UUID lastParcelImageID = m_scene.RegionInfo.RegionSettings.ParcelImageID;
|
||||
m_scene.RegionInfo.RegionSettings.TerrainImageID = terrainImageID;
|
||||
m_scene.RegionInfo.RegionSettings.ParcelImageID = parcelImageID;
|
||||
m_scene.RegionInfo.RegionSettings.Save();
|
||||
|
||||
// Delete the old one
|
||||
m_log.DebugFormat("[WORLDMAP]: Deleting old map tile {0}", lastMapRegionUUID);
|
||||
m_scene.AssetService.Delete(lastMapRegionUUID.ToString());
|
||||
// m_log.DebugFormat("[WORLDMAP]: Deleting old map tile {0}", lastTerrainImageID);
|
||||
m_scene.AssetService.Delete(lastTerrainImageID.ToString());
|
||||
if (lastParcelImageID != UUID.Zero)
|
||||
m_scene.AssetService.Delete(lastParcelImageID.ToString());
|
||||
}
|
||||
|
||||
private void MakeRootAgent(ScenePresence avatar)
|
||||
@@ -1339,6 +1440,92 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
}
|
||||
}
|
||||
|
||||
private Byte[] GenerateOverlay()
|
||||
{
|
||||
Bitmap overlay = new Bitmap(256, 256);
|
||||
|
||||
bool[,] saleBitmap = new bool[64, 64];
|
||||
for (int x = 0 ; x < 64 ; x++)
|
||||
{
|
||||
for (int y = 0 ; y < 64 ; y++)
|
||||
saleBitmap[x, y] = false;
|
||||
}
|
||||
|
||||
bool landForSale = false;
|
||||
|
||||
List<ILandObject> parcels = m_scene.LandChannel.AllParcels();
|
||||
|
||||
Color background = Color.FromArgb(0, 0, 0, 0);
|
||||
SolidBrush transparent = new SolidBrush(background);
|
||||
Graphics g = Graphics.FromImage(overlay);
|
||||
g.FillRectangle(transparent, 0, 0, 255, 255);
|
||||
|
||||
SolidBrush yellow = new SolidBrush(Color.FromArgb(255, 249, 223, 9));
|
||||
Pen grey = new Pen(Color.FromArgb(255, 92, 92, 92));
|
||||
|
||||
foreach (ILandObject land in parcels)
|
||||
{
|
||||
// m_log.DebugFormat("[WORLD MAP]: Parcel {0} flags {1}", land.LandData.Name, land.LandData.Flags);
|
||||
if ((land.LandData.Flags & (uint)ParcelFlags.ForSale) != 0)
|
||||
{
|
||||
landForSale = true;
|
||||
|
||||
bool[,] landBitmap = land.GetLandBitmap();
|
||||
|
||||
for (int x = 0 ; x < 64 ; x++)
|
||||
{
|
||||
for (int y = 0 ; y < 64 ; y++)
|
||||
{
|
||||
if (landBitmap[x, y])
|
||||
{
|
||||
g.FillRectangle(yellow, x * 4, 252 - (y * 4), 4, 4);
|
||||
|
||||
if (x > 0)
|
||||
{
|
||||
if ((saleBitmap[x - 1, y] || landBitmap[x - 1, y]) == false)
|
||||
g.DrawLine(grey, x * 4, 252 - (y * 4), x * 4, 255 - (y * 4));
|
||||
}
|
||||
if (y > 0)
|
||||
{
|
||||
if ((saleBitmap[x, y-1] || landBitmap[x, y-1]) == false)
|
||||
g.DrawLine(grey, x * 4, 255 - (y * 4), x * 4 + 3, 255 - (y * 4));
|
||||
}
|
||||
if (x < 63)
|
||||
{
|
||||
if ((saleBitmap[x + 1, y] || landBitmap[x + 1, y]) == false)
|
||||
g.DrawLine(grey, x * 4 + 3, 252 - (y * 4), x * 4 + 3, 255 - (y * 4));
|
||||
}
|
||||
if (y < 63)
|
||||
{
|
||||
if ((saleBitmap[x, y + 1] || landBitmap[x, y + 1]) == false)
|
||||
g.DrawLine(grey, x * 4, 252 - (y * 4), x * 4 + 3, 252 - (y * 4));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
saleBitmap = land.MergeLandBitmaps(saleBitmap, landBitmap);
|
||||
}
|
||||
}
|
||||
|
||||
if (!landForSale)
|
||||
{
|
||||
m_log.DebugFormat("[WORLD MAP]: Region {0} has no parcels for sale, not geenrating overlay", m_scene.RegionInfo.RegionName);
|
||||
return null;
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[WORLD MAP]: Region {0} has parcels for sale, genrating overlay", m_scene.RegionInfo.RegionName);
|
||||
|
||||
try
|
||||
{
|
||||
return OpenJPEG.EncodeFromImage(overlay, true);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[WORLD MAP]: Error creating parcel overlay: " + e.ToString());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public struct MapRequestState
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
/// Save the attachments that have change on this presence.
|
||||
/// </summary>
|
||||
/// <param name="sp"></param>
|
||||
void SaveChangedAttachments(IScenePresence sp);
|
||||
void SaveChangedAttachments(IScenePresence sp, bool saveAllScripted);
|
||||
|
||||
/// <summary>
|
||||
/// Delete all the presence's attachments from the scene
|
||||
|
||||
@@ -31,6 +31,19 @@ using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Region.Framework.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Temporary interface. More methods to come at some point to make NPCs more object oriented rather than
|
||||
/// controlling purely through module level interface calls (e.g. sit/stand).
|
||||
/// </summary>
|
||||
public interface INPC
|
||||
{
|
||||
/// <summary>
|
||||
/// Should this NPC be sensed by LSL sensors as an 'agent' (interpreted here to mean a normal user)
|
||||
/// rather than an OpenSim specific NPC extension?
|
||||
/// </summary>
|
||||
bool SenseAsAgent { get; }
|
||||
}
|
||||
|
||||
public interface INPCModule
|
||||
{
|
||||
/// <summary>
|
||||
@@ -39,10 +52,21 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
/// <param name="firstname"></param>
|
||||
/// <param name="lastname"></param>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="senseAsAgent">
|
||||
/// Make the NPC show up as an agent on LSL sensors. The default is that they
|
||||
/// show up as the NPC type instead, but this is currently an OpenSim-only extension.
|
||||
/// </param>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="appearance">The avatar appearance to use for the new NPC.</param>
|
||||
/// <returns>The UUID of the ScenePresence created.</returns>
|
||||
UUID CreateNPC(string firstname, string lastname, Vector3 position, UUID owner, Scene scene, AvatarAppearance appearance);
|
||||
/// <returns>The UUID of the ScenePresence created. UUID.Zero if there was a failure.</returns>
|
||||
UUID CreateNPC(
|
||||
string firstname,
|
||||
string lastname,
|
||||
Vector3 position,
|
||||
UUID owner,
|
||||
bool senseAsAgent,
|
||||
Scene scene,
|
||||
AvatarAppearance appearance);
|
||||
|
||||
/// <summary>
|
||||
/// Check if the agent is an NPC.
|
||||
@@ -52,6 +76,22 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
/// <returns>True if the agent is an NPC in the given scene. False otherwise.</returns>
|
||||
bool IsNPC(UUID agentID, Scene scene);
|
||||
|
||||
/// <summary>
|
||||
/// Get the NPC. This is not currently complete - manipulation of NPCs still occurs through the region interface
|
||||
/// </summary>
|
||||
/// <param name="agentID"></param>
|
||||
/// <param name="scene"></param>
|
||||
/// <returns>The NPC. null if it does not exist.</returns>
|
||||
INPC GetNPC(UUID agentID, Scene scene);
|
||||
|
||||
/// <summary>
|
||||
/// Check if the caller has permission to manipulate the given NPC.
|
||||
/// </summary>
|
||||
/// <param name="npcID"></param>
|
||||
/// <param name="callerID"></param>
|
||||
/// <returns>true if they do, false if they don't or if there's no NPC with the given ID.</returns>
|
||||
bool CheckPermissions(UUID npcID, UUID callerID);
|
||||
|
||||
/// <summary>
|
||||
/// Set the appearance for an NPC.
|
||||
/// </summary>
|
||||
@@ -117,7 +157,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
/// <param name="agentID">The UUID of the NPC</param>
|
||||
/// <param name="scene"></param>
|
||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
||||
bool DeleteNPC(UUID agentID, UUID CallerID, Scene scene);
|
||||
bool DeleteNPC(UUID agentID, Scene scene);
|
||||
|
||||
/// <summary>
|
||||
/// Get the owner of a NPC
|
||||
@@ -126,4 +166,4 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
/// <returns>UUID of owner if the NPC exists, UUID.Zero if there was no such agent, the agent is unowned or the agent was not an NPC</returns>
|
||||
UUID GetOwner(UUID agentID);
|
||||
}
|
||||
}
|
||||
}
|
||||
38
OpenSim/Region/Framework/Interfaces/IRegionReadyModule.cs
Normal file
38
OpenSim/Region/Framework/Interfaces/IRegionReadyModule.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
namespace OpenSim.Region.Framework.Interfaces
|
||||
{
|
||||
public interface IRegionReadyModule
|
||||
{
|
||||
void OarLoadingAlert(string msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,21 @@ using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Region.Framework.Interfaces
|
||||
{
|
||||
public delegate void ScriptRemoved(UUID script);
|
||||
public delegate void ObjectRemoved(UUID prim);
|
||||
|
||||
public interface IScriptModule: INonSharedRegionModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Triggered when a script is removed from the script module.
|
||||
/// </summary>
|
||||
event ScriptRemoved OnScriptRemoved;
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when an object is removed via the script module.
|
||||
/// </summary>
|
||||
event ObjectRemoved OnObjectRemoved;
|
||||
|
||||
string ScriptEngineName { get; }
|
||||
|
||||
string GetXMLState(UUID itemID);
|
||||
|
||||
@@ -14,9 +14,6 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
string GetUserHomeURL(UUID uuid);
|
||||
string GetUserUUI(UUID uuid);
|
||||
string GetUserServerURL(UUID uuid, string serverType);
|
||||
int GetUserFlags(UUID userID);
|
||||
int GetUserCreated(UUID userID);
|
||||
string GetUserTitle(UUID userID);
|
||||
|
||||
/// <summary>
|
||||
/// Add a user.
|
||||
@@ -50,7 +47,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
/// <param name="uuid"></param>
|
||||
/// <param name="firstName"></param>
|
||||
/// <param name="profileURL"></param>
|
||||
void AddUser(UUID uuid, string firstName, string lastName, string profileURL);
|
||||
void AddUser(UUID uuid, string firstName, string lastName, string homeURL);
|
||||
|
||||
bool IsLocalGridUser(UUID uuid);
|
||||
}
|
||||
|
||||
@@ -61,11 +61,12 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
public bool m_jumping = false;
|
||||
public float m_jumpVelocity = 0f;
|
||||
// private int m_landing = 0;
|
||||
public bool Falling
|
||||
{
|
||||
get { return m_falling; }
|
||||
}
|
||||
private bool m_falling = false;
|
||||
|
||||
/// <summary>
|
||||
/// Is the avatar falling?
|
||||
/// </summary>
|
||||
public bool Falling { get; private set; }
|
||||
|
||||
private float m_fallHeight;
|
||||
|
||||
/// <value>
|
||||
@@ -223,7 +224,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
m_animTickFall = 0;
|
||||
m_animTickJump = 0;
|
||||
m_jumping = false;
|
||||
m_falling = true;
|
||||
Falling = false;
|
||||
m_jumpVelocity = 0f;
|
||||
actor.Selected = false;
|
||||
m_fallHeight = actor.Position.Z; // save latest flying height
|
||||
@@ -238,10 +239,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
}
|
||||
else if (move.Z < 0f)
|
||||
{
|
||||
if (actor != null && actor.IsColliding)
|
||||
{
|
||||
if (actor != null && actor.IsColliding)
|
||||
return "LAND";
|
||||
}
|
||||
else
|
||||
return "HOVER_DOWN";
|
||||
}
|
||||
@@ -260,7 +259,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
float fallElapsed = (float)(Environment.TickCount - m_animTickFall);
|
||||
float fallVelocity = (actor != null) ? actor.Velocity.Z : 0.0f;
|
||||
|
||||
if (!m_jumping && (fallVelocity < -3.0f) ) m_falling = true;
|
||||
if (!m_jumping && (fallVelocity < -3.0f))
|
||||
Falling = true;
|
||||
|
||||
if (m_animTickFall == 0 || (fallVelocity >= 0.0f))
|
||||
{
|
||||
@@ -290,20 +290,20 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
// Start jumping, prejump
|
||||
m_animTickFall = 0;
|
||||
m_jumping = true;
|
||||
m_falling = false;
|
||||
Falling = false;
|
||||
actor.Selected = true; // borrowed for jumping flag
|
||||
m_animTickJump = Environment.TickCount;
|
||||
m_jumpVelocity = 0.35f;
|
||||
return "PREJUMP";
|
||||
}
|
||||
|
||||
if(m_jumping)
|
||||
if (m_jumping)
|
||||
{
|
||||
if ( (jumptime > (JUMP_PERIOD * 1.5f)) && actor.IsColliding)
|
||||
if ((jumptime > (JUMP_PERIOD * 1.5f)) && actor.IsColliding)
|
||||
{
|
||||
// end jumping
|
||||
m_jumping = false;
|
||||
m_falling = false;
|
||||
Falling = false;
|
||||
actor.Selected = false; // borrowed for jumping flag
|
||||
m_jumpVelocity = 0f;
|
||||
m_animTickFall = Environment.TickCount;
|
||||
@@ -330,7 +330,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
|
||||
if (CurrentMovementAnimation == "FALLDOWN")
|
||||
{
|
||||
m_falling = false;
|
||||
Falling = false;
|
||||
m_animTickFall = Environment.TickCount;
|
||||
// TODO: SOFT_LAND support
|
||||
float fallHeight = m_fallHeight - actor.Position.Z;
|
||||
@@ -364,7 +364,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
if (move.X != 0f || move.Y != 0f)
|
||||
{
|
||||
m_fallHeight = actor.Position.Z; // save latest flying height
|
||||
m_falling = false;
|
||||
Falling = false;
|
||||
// Walking / crouchwalking / running
|
||||
if (move.Z < 0f)
|
||||
return "CROUCHWALK";
|
||||
@@ -375,7 +375,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
}
|
||||
else if (!m_jumping)
|
||||
{
|
||||
m_falling = false;
|
||||
Falling = false;
|
||||
// Not walking
|
||||
if (move.Z < 0)
|
||||
return "CROUCH";
|
||||
@@ -388,7 +388,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
}
|
||||
#endregion Ground Movement
|
||||
|
||||
m_falling = false;
|
||||
Falling = false;
|
||||
|
||||
return CurrentMovementAnimation;
|
||||
}
|
||||
|
||||
@@ -148,7 +148,8 @@ 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);
|
||||
"[ASYNC DELETER]: Sending object to user's inventory, action {1}, count {2}, {0} item(s) remaining.",
|
||||
left, x.action, x.objectGroups.Count);
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -402,12 +402,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy;
|
||||
public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed);
|
||||
|
||||
public delegate void SceneObjectPartUpdated(SceneObjectPart sop);
|
||||
public event SceneObjectPartUpdated OnSceneObjectPartUpdated;
|
||||
|
||||
public delegate void RegionUp(GridRegion region);
|
||||
public event RegionUp OnRegionUp;
|
||||
|
||||
public delegate void RegionStarted(Scene scene);
|
||||
public event RegionStarted OnRegionStarted;
|
||||
|
||||
public delegate void RegionHeartbeatEnd(Scene scene);
|
||||
public event RegionHeartbeatEnd OnRegionHeartbeatEnd;
|
||||
|
||||
public delegate void LoginsEnabled(string regionName);
|
||||
public event LoginsEnabled OnLoginsEnabled;
|
||||
|
||||
@@ -2227,6 +2233,27 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerSceneObjectPartUpdated(SceneObjectPart sop)
|
||||
{
|
||||
SceneObjectPartUpdated handler = OnSceneObjectPartUpdated;
|
||||
if (handler != null)
|
||||
{
|
||||
foreach (SceneObjectPartUpdated d in handler.GetInvocationList())
|
||||
{
|
||||
try
|
||||
{
|
||||
d(sop);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[EVENT MANAGER]: Delegate for TriggerSceneObjectPartUpdated failed - continuing. {0} {1}",
|
||||
e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args,
|
||||
int local_id, IClientAPI remote_client)
|
||||
{
|
||||
@@ -2291,6 +2318,27 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerRegionHeartbeatEnd(Scene scene)
|
||||
{
|
||||
RegionHeartbeatEnd handler = OnRegionHeartbeatEnd;
|
||||
|
||||
if (handler != null)
|
||||
{
|
||||
foreach (RegionHeartbeatEnd d in handler.GetInvocationList())
|
||||
{
|
||||
try
|
||||
{
|
||||
d(scene);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionHeartbeatEnd failed - continuing {0} - {1}",
|
||||
e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerLoginsEnabled (string regionName)
|
||||
{
|
||||
LoginsEnabled handler = OnLoginsEnabled;
|
||||
|
||||
@@ -330,6 +330,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
item.Flags = (item.Flags & ~(uint)255) | (itemUpd.Flags & (uint)255);
|
||||
item.Name = itemUpd.Name;
|
||||
item.Description = itemUpd.Description;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[USER INVENTORY]: itemUpd {0} {1} {2} {3}, item {4} {5} {6} {7}",
|
||||
// itemUpd.NextPermissions, itemUpd.GroupPermissions, itemUpd.EveryOnePermissions, item.Flags,
|
||||
// item.NextPermissions, item.GroupPermissions, item.EveryOnePermissions, item.CurrentPermissions);
|
||||
|
||||
if (item.NextPermissions != (itemUpd.NextPermissions & item.BasePermissions))
|
||||
item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
|
||||
item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions;
|
||||
@@ -338,6 +344,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions;
|
||||
if (item.GroupPermissions != (itemUpd.GroupPermissions & item.BasePermissions))
|
||||
item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup;
|
||||
|
||||
// m_log.DebugFormat("[USER INVENTORY]: item.Flags {0}", item.Flags);
|
||||
|
||||
item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions;
|
||||
item.GroupID = itemUpd.GroupID;
|
||||
item.GroupOwned = itemUpd.GroupOwned;
|
||||
@@ -1463,7 +1472,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// If we've found the item in the user's inventory or in the library
|
||||
if (item != null)
|
||||
{
|
||||
part.ParentGroup.AddInventoryItem(remoteClient, primLocalID, item, copyID);
|
||||
part.ParentGroup.AddInventoryItem(remoteClient.AgentId, primLocalID, item, copyID);
|
||||
m_log.InfoFormat(
|
||||
"[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}",
|
||||
item.Name, primLocalID, remoteClient.Name);
|
||||
@@ -1491,12 +1500,25 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// m_log.DebugFormat(
|
||||
// "[PRIM INVENTORY]: Updating item {0} in {1} for UpdateTaskInventory()",
|
||||
// currentItem.Name, part.Name);
|
||||
|
||||
IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>();
|
||||
if (agentTransactions != null)
|
||||
|
||||
// Only look for an uploaded updated asset if we are passed a transaction ID. This is only the
|
||||
// case for updates uploded through UDP. Updates uploaded via a capability (e.g. a script update)
|
||||
// will not pass in a transaction ID in the update message.
|
||||
if (transactionID != UUID.Zero)
|
||||
{
|
||||
agentTransactions.HandleTaskItemUpdateFromTransaction(
|
||||
remoteClient, part, transactionID, currentItem);
|
||||
IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>();
|
||||
if (agentTransactions != null)
|
||||
{
|
||||
agentTransactions.HandleTaskItemUpdateFromTransaction(
|
||||
remoteClient, part, transactionID, currentItem);
|
||||
|
||||
// if ((InventoryType)itemInfo.InvType == InventoryType.Notecard)
|
||||
// remoteClient.SendAgentAlertMessage("Notecard saved", false);
|
||||
// else if ((InventoryType)itemInfo.InvType == InventoryType.LSL)
|
||||
// remoteClient.SendAgentAlertMessage("Script saved", false);
|
||||
// else
|
||||
// remoteClient.SendAgentAlertMessage("Item saved", false);
|
||||
}
|
||||
}
|
||||
|
||||
// Base ALWAYS has move
|
||||
@@ -1572,104 +1594,141 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// Rez a script into a prim's inventory, either ex nihilo or from an existing avatar inventory
|
||||
/// </summary>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="itemID"> </param>
|
||||
/// <param name="itemBase"> </param>
|
||||
/// <param name="transactionID"></param>
|
||||
/// <param name="localID"></param>
|
||||
public void RezScript(IClientAPI remoteClient, InventoryItemBase itemBase, UUID transactionID, uint localID)
|
||||
{
|
||||
UUID itemID = itemBase.ID;
|
||||
SceneObjectPart partWhereRezzed;
|
||||
|
||||
if (itemBase.ID != UUID.Zero)
|
||||
partWhereRezzed = RezScriptFromAgentInventory(remoteClient.AgentId, itemBase.ID, localID);
|
||||
else
|
||||
partWhereRezzed = RezNewScript(remoteClient.AgentId, itemBase);
|
||||
|
||||
if (partWhereRezzed != null)
|
||||
partWhereRezzed.SendPropertiesToClient(remoteClient);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rez a script into a prim from an agent inventory.
|
||||
/// </summary>
|
||||
/// <param name="agentID"></param>
|
||||
/// <param name="fromItemID"></param>
|
||||
/// <param name="localID"></param>
|
||||
/// <returns>The part where the script was rezzed if successful. False otherwise.</returns>
|
||||
public SceneObjectPart RezScriptFromAgentInventory(UUID agentID, UUID fromItemID, uint localID)
|
||||
{
|
||||
UUID copyID = UUID.Random();
|
||||
InventoryItemBase item = new InventoryItemBase(fromItemID, agentID);
|
||||
item = InventoryService.GetItem(item);
|
||||
|
||||
if (itemID != UUID.Zero) // transferred from an avatar inventory to the prim's inventory
|
||||
// Try library
|
||||
// XXX clumsy, possibly should be one call
|
||||
if (null == item && LibraryService != null && LibraryService.LibraryRootFolder != null)
|
||||
{
|
||||
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
|
||||
item = InventoryService.GetItem(item);
|
||||
item = LibraryService.LibraryRootFolder.FindItem(fromItemID);
|
||||
}
|
||||
|
||||
// Try library
|
||||
// XXX clumsy, possibly should be one call
|
||||
if (null == item && LibraryService != null && LibraryService.LibraryRootFolder != null)
|
||||
if (item != null)
|
||||
{
|
||||
SceneObjectPart part = GetSceneObjectPart(localID);
|
||||
if (part != null)
|
||||
{
|
||||
item = LibraryService.LibraryRootFolder.FindItem(itemID);
|
||||
}
|
||||
if (!Permissions.CanEditObjectInventory(part.UUID, agentID))
|
||||
return null;
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
SceneObjectPart part = GetSceneObjectPart(localID);
|
||||
if (part != null)
|
||||
{
|
||||
if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId))
|
||||
return;
|
||||
part.ParentGroup.AddInventoryItem(agentID, localID, item, copyID);
|
||||
// TODO: switch to posting on_rez here when scripts
|
||||
// have state in inventory
|
||||
part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0);
|
||||
|
||||
part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID);
|
||||
// TODO: switch to posting on_rez here when scripts
|
||||
// have state in inventory
|
||||
part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0);
|
||||
// m_log.InfoFormat("[PRIMINVENTORY]: " +
|
||||
// "Rezzed script {0} into prim local ID {1} for user {2}",
|
||||
// item.inventoryName, localID, remoteClient.Name);
|
||||
part.ParentGroup.ResumeScripts();
|
||||
|
||||
// m_log.InfoFormat("[PRIMINVENTORY]: " +
|
||||
// "Rezzed script {0} into prim local ID {1} for user {2}",
|
||||
// item.inventoryName, localID, remoteClient.Name);
|
||||
part.SendPropertiesToClient(remoteClient);
|
||||
part.ParentGroup.ResumeScripts();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[PRIM INVENTORY]: " +
|
||||
"Could not rez script {0} into prim local ID {1} for user {2}"
|
||||
+ " because the prim could not be found in the region!",
|
||||
item.Name, localID, remoteClient.Name);
|
||||
}
|
||||
return part;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[PRIM INVENTORY]: Could not find script inventory item {0} to rez for {1}!",
|
||||
itemID, remoteClient.Name);
|
||||
"[PRIM INVENTORY]: " +
|
||||
"Could not rez script {0} into prim local ID {1} for user {2}"
|
||||
+ " because the prim could not be found in the region!",
|
||||
item.Name, localID, agentID);
|
||||
}
|
||||
}
|
||||
else // script has been rezzed directly into a prim's inventory
|
||||
else
|
||||
{
|
||||
SceneObjectPart part = GetSceneObjectPart(itemBase.Folder);
|
||||
if (part == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.CanCreateObjectInventory(
|
||||
itemBase.InvType, part.UUID, remoteClient.AgentId))
|
||||
return;
|
||||
|
||||
AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType,
|
||||
Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n\n touch_start(integer num)\n {\n }\n}"),
|
||||
remoteClient.AgentId);
|
||||
AssetService.Store(asset);
|
||||
|
||||
TaskInventoryItem taskItem = new TaskInventoryItem();
|
||||
|
||||
taskItem.ResetIDs(itemBase.Folder);
|
||||
taskItem.ParentID = itemBase.Folder;
|
||||
taskItem.CreationDate = (uint)itemBase.CreationDate;
|
||||
taskItem.Name = itemBase.Name;
|
||||
taskItem.Description = itemBase.Description;
|
||||
taskItem.Type = itemBase.AssetType;
|
||||
taskItem.InvType = itemBase.InvType;
|
||||
taskItem.OwnerID = itemBase.Owner;
|
||||
taskItem.CreatorID = itemBase.CreatorIdAsUuid;
|
||||
taskItem.BasePermissions = itemBase.BasePermissions;
|
||||
taskItem.CurrentPermissions = itemBase.CurrentPermissions;
|
||||
taskItem.EveryonePermissions = itemBase.EveryOnePermissions;
|
||||
taskItem.GroupPermissions = itemBase.GroupPermissions;
|
||||
taskItem.NextPermissions = itemBase.NextPermissions;
|
||||
taskItem.GroupID = itemBase.GroupID;
|
||||
taskItem.GroupPermissions = 0;
|
||||
taskItem.Flags = itemBase.Flags;
|
||||
taskItem.PermsGranter = UUID.Zero;
|
||||
taskItem.PermsMask = 0;
|
||||
taskItem.AssetID = asset.FullID;
|
||||
|
||||
part.Inventory.AddInventoryItem(taskItem, false);
|
||||
part.SendPropertiesToClient(remoteClient);
|
||||
|
||||
part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0);
|
||||
part.ParentGroup.ResumeScripts();
|
||||
m_log.ErrorFormat(
|
||||
"[PRIM INVENTORY]: Could not find script inventory item {0} to rez for {1}!",
|
||||
fromItemID, agentID);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rez a new script from nothing.
|
||||
/// </summary>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="itemBase"></param>
|
||||
/// <returns>The part where the script was rezzed if successful. False otherwise.</returns>
|
||||
public SceneObjectPart RezNewScript(UUID agentID, InventoryItemBase itemBase)
|
||||
{
|
||||
// The part ID is the folder ID!
|
||||
SceneObjectPart part = GetSceneObjectPart(itemBase.Folder);
|
||||
if (part == null)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE INVENTORY]: Could not find part with id {0} for {1} to rez new script",
|
||||
// itemBase.Folder, agentID);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!Permissions.CanCreateObjectInventory(itemBase.InvType, part.UUID, agentID))
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE INVENTORY]: No permission to create new script in {0} for {1}", part.Name, agentID);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType,
|
||||
Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n\n touch_start(integer num)\n {\n }\n}"),
|
||||
agentID);
|
||||
AssetService.Store(asset);
|
||||
|
||||
TaskInventoryItem taskItem = new TaskInventoryItem();
|
||||
|
||||
taskItem.ResetIDs(itemBase.Folder);
|
||||
taskItem.ParentID = itemBase.Folder;
|
||||
taskItem.CreationDate = (uint)itemBase.CreationDate;
|
||||
taskItem.Name = itemBase.Name;
|
||||
taskItem.Description = itemBase.Description;
|
||||
taskItem.Type = itemBase.AssetType;
|
||||
taskItem.InvType = itemBase.InvType;
|
||||
taskItem.OwnerID = itemBase.Owner;
|
||||
taskItem.CreatorID = itemBase.CreatorIdAsUuid;
|
||||
taskItem.BasePermissions = itemBase.BasePermissions;
|
||||
taskItem.CurrentPermissions = itemBase.CurrentPermissions;
|
||||
taskItem.EveryonePermissions = itemBase.EveryOnePermissions;
|
||||
taskItem.GroupPermissions = itemBase.GroupPermissions;
|
||||
taskItem.NextPermissions = itemBase.NextPermissions;
|
||||
taskItem.GroupID = itemBase.GroupID;
|
||||
taskItem.GroupPermissions = 0;
|
||||
taskItem.Flags = itemBase.Flags;
|
||||
taskItem.PermsGranter = UUID.Zero;
|
||||
taskItem.PermsMask = 0;
|
||||
taskItem.AssetID = asset.FullID;
|
||||
|
||||
part.Inventory.AddInventoryItem(taskItem, false);
|
||||
part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0);
|
||||
part.ParentGroup.ResumeScripts();
|
||||
|
||||
return part;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1678,7 +1737,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="itemID"> </param>
|
||||
/// <param name="localID"></param>
|
||||
public void RezScript(UUID srcId, SceneObjectPart srcPart, UUID destId, int pin, int running, int start_param)
|
||||
public void RezScriptFromPrim(UUID srcId, SceneObjectPart srcPart, UUID destId, int pin, int running, int start_param)
|
||||
{
|
||||
TaskInventoryItem srcTaskItem = srcPart.Inventory.GetInventoryItem(srcId);
|
||||
|
||||
@@ -2260,7 +2319,24 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_sceneGraph.DelinkObjects(parts);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Link the scene objects containing the indicated parts to a root object.
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="parentPrimId">A root prim id of the object which will be the root prim of the resulting linkset.</param>
|
||||
/// <param name="childPrimIds">A list of child prims for the objects that should be linked in.</param>
|
||||
public void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds)
|
||||
{
|
||||
LinkObjects(client.AgentId, parentPrimId, childPrimIds);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Link the scene objects containing the indicated parts to a root object.
|
||||
/// </summary>
|
||||
/// <param name="agentId">The ID of the user linking.</param>
|
||||
/// <param name="parentPrimId">A root prim id of the object which will be the root prim of the resulting linkset.</param>
|
||||
/// <param name="childPrimIds">A list of child prims for the objects that should be linked in.</param>
|
||||
public void LinkObjects(UUID agentId, uint parentPrimId, List<uint> childPrimIds)
|
||||
{
|
||||
List<UUID> owners = new List<UUID>();
|
||||
|
||||
@@ -2273,7 +2349,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Permissions.CanLinkObject(client.AgentId, root.ParentGroup.RootPart.UUID))
|
||||
if (!Permissions.CanLinkObject(agentId, root.ParentGroup.RootPart.UUID))
|
||||
{
|
||||
m_log.DebugFormat("[LINK]: Refusing link. No permissions on root prim");
|
||||
return;
|
||||
@@ -2289,7 +2365,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (!owners.Contains(part.OwnerID))
|
||||
owners.Add(part.OwnerID);
|
||||
|
||||
if (Permissions.CanLinkObject(client.AgentId, part.ParentGroup.RootPart.UUID))
|
||||
if (Permissions.CanLinkObject(agentId, part.ParentGroup.RootPart.UUID))
|
||||
children.Add(part);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public delegate bool DuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition);
|
||||
public delegate bool EditObjectHandler(UUID objectID, UUID editorID, Scene scene);
|
||||
public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene);
|
||||
public delegate bool ViewObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene);
|
||||
public delegate bool MoveObjectHandler(UUID objectID, UUID moverID, Scene scene);
|
||||
public delegate bool ObjectEntryHandler(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene);
|
||||
public delegate bool ReturnObjectsHandler(ILandObject land, UUID user, List<SceneObjectGroup> objects, Scene scene);
|
||||
@@ -117,7 +116,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public event DuplicateObjectHandler OnDuplicateObject;
|
||||
public event EditObjectHandler OnEditObject;
|
||||
public event EditObjectInventoryHandler OnEditObjectInventory;
|
||||
public event ViewObjectInventoryHandler OnViewObjectInventory;
|
||||
public event MoveObjectHandler OnMoveObject;
|
||||
public event ObjectEntryHandler OnObjectEntry;
|
||||
public event ReturnObjectsHandler OnReturnObjects;
|
||||
@@ -403,21 +401,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CanViewObjectInventory(UUID objectID, UUID editorID)
|
||||
{
|
||||
ViewObjectInventoryHandler handler = OnViewObjectInventory;
|
||||
if (handler != null)
|
||||
{
|
||||
Delegate[] list = handler.GetInvocationList();
|
||||
foreach (ViewObjectInventoryHandler h in list)
|
||||
{
|
||||
if (h(objectID, editorID, m_scene) == false)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MOVE OBJECT
|
||||
|
||||
@@ -65,6 +65,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
#region Fields
|
||||
|
||||
public bool EmergencyMonitoring = false;
|
||||
public bool DEBUG = false;
|
||||
|
||||
public SynchronizeSceneHandler SynchronizeScene;
|
||||
public SimStatsReporter StatsReporter;
|
||||
@@ -622,23 +623,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
"reload estate",
|
||||
"Reload the estate data", HandleReloadEstate);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("region", false, "delete object owner",
|
||||
"delete object owner <UUID>",
|
||||
"Delete object by owner", HandleDeleteObject);
|
||||
MainConsole.Instance.Commands.AddCommand("region", false, "delete object creator",
|
||||
"delete object creator <UUID>",
|
||||
"Delete object by creator", HandleDeleteObject);
|
||||
MainConsole.Instance.Commands.AddCommand("region", false, "delete object uuid",
|
||||
"delete object uuid <UUID>",
|
||||
"Delete object by uuid", HandleDeleteObject);
|
||||
MainConsole.Instance.Commands.AddCommand("region", false, "delete object name",
|
||||
"delete object name <name>",
|
||||
"Delete object by name", HandleDeleteObject);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("region", false, "delete object outside",
|
||||
"delete object outside",
|
||||
"Delete all objects outside boundaries", HandleDeleteObject);
|
||||
|
||||
//Bind Storage Manager functions to some land manager functions for this scene
|
||||
EventManager.OnLandObjectAdded +=
|
||||
new EventManager.LandObjectAdded(simDataService.StoreLandObject);
|
||||
@@ -684,8 +668,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
PhysicalPrims = startupConfig.GetBoolean("physical_prim", true);
|
||||
CollidablePrims = startupConfig.GetBoolean("collidable_prim", true);
|
||||
|
||||
m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys);
|
||||
|
||||
m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys);
|
||||
if (RegionInfo.NonphysPrimMax > 0)
|
||||
{
|
||||
m_maxNonphys = RegionInfo.NonphysPrimMax;
|
||||
@@ -1447,6 +1430,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
RegionInfo.RegionName, e.Message, e.StackTrace);
|
||||
}
|
||||
|
||||
EventManager.TriggerRegionHeartbeatEnd(this);
|
||||
|
||||
maintc = Util.EnvironmentTickCountSubtract(maintc);
|
||||
maintc = (int)(MinFrameTime * 1000) - maintc;
|
||||
|
||||
@@ -2005,6 +1990,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// If true, the object is made persistent into the scene.
|
||||
/// If false, the object will not persist over server restarts
|
||||
/// </param>
|
||||
/// <returns>true if the object was added. false if not</returns>
|
||||
public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup)
|
||||
{
|
||||
return AddNewSceneObject(sceneObject, attachToBackup, true);
|
||||
@@ -2022,6 +2008,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// If true, updates for the new scene object are sent to all viewers in range.
|
||||
/// If false, it is left to the caller to schedule the update
|
||||
/// </param>
|
||||
/// <returns>true if the object was added. false if not</returns>
|
||||
public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
|
||||
{
|
||||
if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates))
|
||||
@@ -2652,7 +2639,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type);
|
||||
m_eventManager.TriggerOnNewPresence(sp);
|
||||
|
||||
sp.TeleportFlags = (TeleportFlags)aCircuit.teleportFlags;
|
||||
sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags;
|
||||
|
||||
// The first agent upon login is a root agent by design.
|
||||
// For this agent we will have to rez the attachments.
|
||||
@@ -2851,7 +2838,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
client.OnObjectMaterial += m_sceneGraph.PrimMaterial;
|
||||
client.OnLinkObjects += LinkObjects;
|
||||
client.OnDelinkObjects += DelinkObjects;
|
||||
client.OnObjectDuplicate += m_sceneGraph.DuplicateObject;
|
||||
client.OnObjectDuplicate += DuplicateObject;
|
||||
client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay;
|
||||
client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags;
|
||||
client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily;
|
||||
@@ -2979,7 +2966,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
client.OnObjectMaterial -= m_sceneGraph.PrimMaterial;
|
||||
client.OnLinkObjects -= LinkObjects;
|
||||
client.OnDelinkObjects -= DelinkObjects;
|
||||
client.OnObjectDuplicate -= m_sceneGraph.DuplicateObject;
|
||||
client.OnObjectDuplicate -= DuplicateObject;
|
||||
client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay;
|
||||
client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags;
|
||||
client.OnRequestObjectPropertiesFamily -= m_sceneGraph.RequestObjectPropertiesFamily;
|
||||
@@ -3072,6 +3059,21 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Duplicates object specified by localID. This is the event handler for IClientAPI.
|
||||
/// </summary>
|
||||
/// <param name="originalPrim">ID of object to duplicate</param>
|
||||
/// <param name="offset"></param>
|
||||
/// <param name="flags"></param>
|
||||
/// <param name="AgentID">Agent doing the duplication</param>
|
||||
/// <param name="GroupID">Group of new object</param>
|
||||
public void DuplicateObject(uint originalPrim, Vector3 offset, uint flags, UUID AgentID, UUID GroupID)
|
||||
{
|
||||
SceneObjectGroup copy = SceneGraph.DuplicateObject(originalPrim, offset, flags, AgentID, GroupID, Quaternion.Identity);
|
||||
if (copy != null)
|
||||
EventManager.TriggerObjectAddedToScene(copy);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Duplicates object specified by localID at position raycasted against RayTargetObject using
|
||||
/// RayEnd and RayStart to determine what the angle of the ray is
|
||||
@@ -3134,19 +3136,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
// stick in offset format from the original prim
|
||||
pos = pos - target.ParentGroup.AbsolutePosition;
|
||||
SceneObjectGroup copy;
|
||||
if (CopyRotates)
|
||||
{
|
||||
Quaternion worldRot = target2.GetWorldRotation();
|
||||
|
||||
// SceneObjectGroup obj = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot);
|
||||
m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot);
|
||||
copy = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot);
|
||||
//obj.Rotation = worldRot;
|
||||
//obj.UpdateGroupRotationR(worldRot);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID);
|
||||
copy = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, Quaternion.Identity);
|
||||
}
|
||||
if (copy != null)
|
||||
EventManager.TriggerObjectAddedToScene(copy);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3205,11 +3210,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public override void RemoveClient(UUID agentID, bool closeChildAgents)
|
||||
{
|
||||
CheckHeartbeat();
|
||||
bool childagentYN = false;
|
||||
bool isChildAgent = false;
|
||||
ScenePresence avatar = GetScenePresence(agentID);
|
||||
if (avatar != null)
|
||||
{
|
||||
childagentYN = avatar.IsChildAgent;
|
||||
isChildAgent = avatar.IsChildAgent;
|
||||
|
||||
if (avatar.ParentID != 0)
|
||||
{
|
||||
@@ -3220,9 +3225,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[SCENE]: Removing {0} agent {1} from region {2}",
|
||||
(childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName);
|
||||
(isChildAgent ? "child" : "root"), agentID, RegionInfo.RegionName);
|
||||
|
||||
m_sceneGraph.removeUserCount(!childagentYN);
|
||||
m_sceneGraph.removeUserCount(!isChildAgent);
|
||||
|
||||
// TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop
|
||||
// unnecessary operations. This should go away once NPCs have no accompanying IClientAPI
|
||||
@@ -3253,8 +3258,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
m_eventManager.TriggerOnRemovePresence(agentID);
|
||||
|
||||
if (AttachmentsModule != null && !avatar.IsChildAgent && avatar.PresenceType != PresenceType.Npc)
|
||||
AttachmentsModule.SaveChangedAttachments(avatar);
|
||||
if (AttachmentsModule != null && !isChildAgent && avatar.PresenceType != PresenceType.Npc)
|
||||
{
|
||||
IUserManagement uMan = RequestModuleInterface<IUserManagement>();
|
||||
// Don't save attachments for HG visitors, it
|
||||
// messes up their inventory. When a HG visitor logs
|
||||
// out on a foreign grid, their attachments will be
|
||||
// reloaded in the state they were in when they left
|
||||
// the home grid. This is best anyway as the visited
|
||||
// grid may use an incompatible script engine.
|
||||
if (uMan == null || uMan.IsLocalGridUser(avatar.UUID))
|
||||
AttachmentsModule.SaveChangedAttachments(avatar, false);
|
||||
}
|
||||
|
||||
ForEachClient(
|
||||
delegate(IClientAPI client)
|
||||
@@ -3478,7 +3493,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
// Let the SP know how we got here. This has a lot of interesting
|
||||
// uses down the line.
|
||||
sp.TeleportFlags = (TeleportFlags)teleportFlags;
|
||||
sp.TeleportFlags = (TPFlags)teleportFlags;
|
||||
|
||||
if (sp.IsChildAgent)
|
||||
{
|
||||
@@ -3572,7 +3587,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY)
|
||||
public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY)
|
||||
{
|
||||
reason = String.Empty;
|
||||
if (Permissions.IsGod(agentID))
|
||||
@@ -4471,6 +4486,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return m_sceneGraph.GetGroupByPrim(localID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a scene object group that contains the prim with the given uuid
|
||||
/// </summary>
|
||||
/// <param name="fullID"></param>
|
||||
/// <returns>null if no scene object group containing that prim is found</returns>
|
||||
public SceneObjectGroup GetGroupByPrim(UUID fullID)
|
||||
{
|
||||
return m_sceneGraph.GetGroupByPrim(fullID);
|
||||
}
|
||||
|
||||
public override bool TryGetScenePresence(UUID agentID, out ScenePresence sp)
|
||||
{
|
||||
return m_sceneGraph.TryGetScenePresence(agentID, out sp);
|
||||
@@ -4859,9 +4884,14 @@ Environment.Exit(1);
|
||||
get { return m_allowScriptCrossings; }
|
||||
}
|
||||
|
||||
public Vector3? GetNearestAllowedPosition(ScenePresence avatar)
|
||||
public Vector3 GetNearestAllowedPosition(ScenePresence avatar)
|
||||
{
|
||||
ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
|
||||
return GetNearestAllowedPosition(avatar, null);
|
||||
}
|
||||
|
||||
public Vector3 GetNearestAllowedPosition(ScenePresence avatar, ILandObject excludeParcel)
|
||||
{
|
||||
ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, excludeParcel);
|
||||
|
||||
if (nearestParcel != null)
|
||||
{
|
||||
@@ -4919,6 +4949,11 @@ Environment.Exit(1);
|
||||
}
|
||||
|
||||
public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y)
|
||||
{
|
||||
return GetNearestAllowedParcel(avatarId, x, y, null);
|
||||
}
|
||||
|
||||
public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y, ILandObject excludeParcel)
|
||||
{
|
||||
List<ILandObject> all = AllParcels();
|
||||
float minParcelDistance = float.MaxValue;
|
||||
@@ -4926,7 +4961,7 @@ Environment.Exit(1);
|
||||
|
||||
foreach (var parcel in all)
|
||||
{
|
||||
if (!parcel.IsEitherBannedOrRestricted(avatarId))
|
||||
if (!parcel.IsEitherBannedOrRestricted(avatarId) && parcel != excludeParcel)
|
||||
{
|
||||
float parcelDistance = GetParcelDistancefromPoint(parcel, x, y);
|
||||
if (parcelDistance < minParcelDistance)
|
||||
@@ -5076,93 +5111,6 @@ Environment.Exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleDeleteObject(string module, string[] cmd)
|
||||
{
|
||||
if (cmd.Length < 3)
|
||||
return;
|
||||
|
||||
string mode = cmd[2];
|
||||
string o = "";
|
||||
|
||||
if (mode != "outside")
|
||||
{
|
||||
if (cmd.Length < 4)
|
||||
return;
|
||||
|
||||
o = cmd[3];
|
||||
}
|
||||
|
||||
List<SceneObjectGroup> deletes = new List<SceneObjectGroup>();
|
||||
|
||||
UUID match;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case "owner":
|
||||
if (!UUID.TryParse(o, out match))
|
||||
return;
|
||||
ForEachSOG(delegate (SceneObjectGroup g)
|
||||
{
|
||||
if (g.OwnerID == match && !g.IsAttachment)
|
||||
deletes.Add(g);
|
||||
});
|
||||
break;
|
||||
case "creator":
|
||||
if (!UUID.TryParse(o, out match))
|
||||
return;
|
||||
ForEachSOG(delegate (SceneObjectGroup g)
|
||||
{
|
||||
if (g.RootPart.CreatorID == match && !g.IsAttachment)
|
||||
deletes.Add(g);
|
||||
});
|
||||
break;
|
||||
case "uuid":
|
||||
if (!UUID.TryParse(o, out match))
|
||||
return;
|
||||
ForEachSOG(delegate (SceneObjectGroup g)
|
||||
{
|
||||
if (g.UUID == match && !g.IsAttachment)
|
||||
deletes.Add(g);
|
||||
});
|
||||
break;
|
||||
case "name":
|
||||
ForEachSOG(delegate (SceneObjectGroup g)
|
||||
{
|
||||
if (g.RootPart.Name == o && !g.IsAttachment)
|
||||
deletes.Add(g);
|
||||
});
|
||||
break;
|
||||
case "outside":
|
||||
ForEachSOG(delegate (SceneObjectGroup g)
|
||||
{
|
||||
SceneObjectPart rootPart = g.RootPart;
|
||||
bool delete = false;
|
||||
|
||||
if (rootPart.GroupPosition.Z < 0.0 || rootPart.GroupPosition.Z > 10000.0)
|
||||
{
|
||||
delete = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ILandObject parcel = LandChannel.GetLandObject(rootPart.GroupPosition.X, rootPart.GroupPosition.Y);
|
||||
|
||||
if (parcel == null || parcel.LandData.Name == "NO LAND")
|
||||
delete = true;
|
||||
}
|
||||
|
||||
if (delete && !g.IsAttachment && !deletes.Contains(g))
|
||||
deletes.Add(g);
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
foreach (SceneObjectGroup g in deletes)
|
||||
{
|
||||
m_log.InfoFormat("[SCENE]: Deleting object {0}", g.UUID);
|
||||
DeleteSceneObject(g, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleReloadEstate(string module, string[] cmd)
|
||||
{
|
||||
if (MainConsole.Instance.ConsoleScene == null ||
|
||||
@@ -5378,6 +5326,33 @@ Environment.Exit(1);
|
||||
|
||||
if (position == Vector3.Zero) // Teleport
|
||||
{
|
||||
if (!RegionInfo.EstateSettings.AllowDirectTeleport)
|
||||
{
|
||||
SceneObjectGroup telehub;
|
||||
if (RegionInfo.RegionSettings.TelehubObject != UUID.Zero && (telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject)) != null)
|
||||
{
|
||||
List<SpawnPoint> spawnPoints = RegionInfo.RegionSettings.SpawnPoints();
|
||||
bool banned = true;
|
||||
foreach (SpawnPoint sp in spawnPoints)
|
||||
{
|
||||
Vector3 spawnPoint = sp.GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
|
||||
ILandObject land = LandChannel.GetLandObject(spawnPoint.X, spawnPoint.Y);
|
||||
if (land == null)
|
||||
continue;
|
||||
if (land.IsEitherBannedOrRestricted(agentID))
|
||||
continue;
|
||||
banned = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (banned)
|
||||
{
|
||||
reason = "No suitable landing point found";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float posX = 128.0f;
|
||||
float posY = 128.0f;
|
||||
|
||||
|
||||
@@ -41,18 +41,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
public delegate void PhysicsCrash();
|
||||
|
||||
public delegate void ObjectDuplicateDelegate(EntityBase original, EntityBase clone);
|
||||
|
||||
public delegate void AttachToBackupDelegate(SceneObjectGroup sog);
|
||||
|
||||
public delegate void DetachFromBackupDelegate(SceneObjectGroup sog);
|
||||
|
||||
public delegate void ChangedBackupDelegate(SceneObjectGroup sog);
|
||||
|
||||
public delegate void ObjectCreateDelegate(EntityBase obj);
|
||||
|
||||
public delegate void ObjectDeleteDelegate(EntityBase obj);
|
||||
|
||||
/// <summary>
|
||||
/// This class used to be called InnerScene and may not yet truly be a SceneGraph. The non scene graph components
|
||||
/// should be migrated out over time.
|
||||
@@ -66,12 +60,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
protected internal event PhysicsCrash UnRecoverableError;
|
||||
private PhysicsCrash handlerPhysicsCrash = null;
|
||||
|
||||
public event ObjectDuplicateDelegate OnObjectDuplicate;
|
||||
public event AttachToBackupDelegate OnAttachToBackup;
|
||||
public event DetachFromBackupDelegate OnDetachFromBackup;
|
||||
public event ChangedBackupDelegate OnChangeBackup;
|
||||
public event ObjectCreateDelegate OnObjectCreate;
|
||||
public event ObjectDeleteDelegate OnObjectRemove;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -352,6 +343,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </summary>
|
||||
///
|
||||
/// This method does not send updates to the client - callers need to handle this themselves.
|
||||
/// Caller should also trigger EventManager.TriggerObjectAddedToScene
|
||||
/// <param name="sceneObject"></param>
|
||||
/// <param name="attachToBackup"></param>
|
||||
/// <param name="pos">Position of the object. If null then the position stored in the object is used.</param>
|
||||
@@ -404,11 +396,28 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </returns>
|
||||
protected bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
|
||||
{
|
||||
if (sceneObject == null || sceneObject.RootPart.UUID == UUID.Zero)
|
||||
if (sceneObject == null)
|
||||
{
|
||||
m_log.ErrorFormat("[SCENEGRAPH]: Tried to add null scene object");
|
||||
return false;
|
||||
}
|
||||
if (sceneObject.UUID == UUID.Zero)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[SCENEGRAPH]: Tried to add scene object {0} to {1} with illegal UUID of {2}",
|
||||
sceneObject.Name, m_parentScene.RegionInfo.RegionName, UUID.Zero);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Entities.ContainsKey(sceneObject.UUID))
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENEGRAPH]: Scene graph for {0} already contains object {1} in AddSceneObject()",
|
||||
// m_parentScene.RegionInfo.RegionName, sceneObject.UUID);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}",
|
||||
@@ -445,9 +454,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (attachToBackup)
|
||||
sceneObject.AttachToBackup();
|
||||
|
||||
if (OnObjectCreate != null)
|
||||
OnObjectCreate(sceneObject);
|
||||
|
||||
lock (SceneObjectGroupsByFullID)
|
||||
SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
|
||||
|
||||
@@ -496,9 +502,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
|
||||
RemovePhysicalPrim(grp.PrimCount);
|
||||
}
|
||||
|
||||
if (OnObjectRemove != null)
|
||||
OnObjectRemove(Entities[uuid]);
|
||||
|
||||
lock (SceneObjectGroupsByFullID)
|
||||
SceneObjectGroupsByFullID.Remove(grp.UUID);
|
||||
@@ -1000,7 +1003,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </summary>
|
||||
/// <param name="fullID"></param>
|
||||
/// <returns>null if no scene object group containing that prim is found</returns>
|
||||
private SceneObjectGroup GetGroupByPrim(UUID fullID)
|
||||
public SceneObjectGroup GetGroupByPrim(UUID fullID)
|
||||
{
|
||||
SceneObjectGroup sog;
|
||||
lock (SceneObjectGroupsByFullPartID)
|
||||
@@ -1228,8 +1231,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <param name="action"></param>
|
||||
protected internal void ForEachSOG(Action<SceneObjectGroup> action)
|
||||
{
|
||||
// FIXME: Need to lock here, really.
|
||||
List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values);
|
||||
List<SceneObjectGroup> objlist;
|
||||
lock (SceneObjectGroupsByFullID)
|
||||
objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values);
|
||||
|
||||
foreach (SceneObjectGroup obj in objlist)
|
||||
{
|
||||
try
|
||||
@@ -1238,7 +1243,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Catch it and move on. This includes situations where splist has inconsistent info
|
||||
// Catch it and move on. This includes situations where objlist has inconsistent info
|
||||
m_log.WarnFormat(
|
||||
"[SCENEGRAPH]: Problem processing action in ForEachSOG: {0} {1}", e.Message, e.StackTrace);
|
||||
}
|
||||
@@ -1478,10 +1483,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <summary>
|
||||
/// Update the texture entry of the given prim.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// A texture entry is an object that contains details of all the textures of the prim's face. In this case,
|
||||
/// the texture is given in its byte serialized form.
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="localID"></param>
|
||||
/// <param name="texture"></param>
|
||||
/// <param name="remoteClient"></param>
|
||||
@@ -1746,6 +1751,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
SceneObjectGroup child = children[i].ParentGroup;
|
||||
|
||||
// Don't try and add a group to itself - this will only cause severe problems later on.
|
||||
if (child == parentGroup)
|
||||
continue;
|
||||
|
||||
// Make sure no child prim is set for sale
|
||||
// So that, on delink, no prims are unwittingly
|
||||
// left for sale and sold off
|
||||
@@ -1772,8 +1781,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
// We need to explicitly resend the newly link prim's object properties since no other actions
|
||||
// occur on link to invoke this elsewhere (such as object selection)
|
||||
parentGroup.RootPart.CreateSelected = true;
|
||||
parentGroup.TriggerScriptChangedEvent(Changed.LINK);
|
||||
if (childGroups.Count > 0)
|
||||
{
|
||||
parentGroup.RootPart.CreateSelected = true;
|
||||
parentGroup.TriggerScriptChangedEvent(Changed.LINK);
|
||||
parentGroup.HasGroupChanged = true;
|
||||
parentGroup.ScheduleGroupForFullUpdate();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -1988,22 +2002,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
#pragma warning restore 0612
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Duplicate the given object, Fire and Forget, No rotation, no return wrapper
|
||||
/// </summary>
|
||||
/// <param name="originalPrim"></param>
|
||||
/// <param name="offset"></param>
|
||||
/// <param name="flags"></param>
|
||||
/// <param name="AgentID"></param>
|
||||
/// <param name="GroupID"></param>
|
||||
protected internal void DuplicateObject(uint originalPrim, Vector3 offset, uint flags, UUID AgentID, UUID GroupID)
|
||||
{
|
||||
//m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID);
|
||||
|
||||
// SceneObjectGroup dupe = DuplicateObject(originalPrim, offset, flags, AgentID, GroupID, Quaternion.Zero);
|
||||
DuplicateObject(originalPrim, offset, flags, AgentID, GroupID, Quaternion.Identity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Duplicate the given object.
|
||||
/// </summary>
|
||||
@@ -2091,9 +2089,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// required for physics to update it's position
|
||||
copy.AbsolutePosition = copy.AbsolutePosition;
|
||||
|
||||
if (OnObjectDuplicate != null)
|
||||
OnObjectDuplicate(original, copy);
|
||||
|
||||
return copy;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,13 +79,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <summary>
|
||||
/// Add an inventory item from a user's inventory to a prim in this scene object.
|
||||
/// </summary>
|
||||
/// <param name="remoteClient">The client adding the item.</param>
|
||||
/// <param name="agentID">The agent adding the item.</param>
|
||||
/// <param name="localID">The local ID of the part receiving the add.</param>
|
||||
/// <param name="item">The user inventory item being added.</param>
|
||||
/// <param name="copyItemID">The item UUID that should be used by the new item.</param>
|
||||
/// <returns></returns>
|
||||
public bool AddInventoryItem(IClientAPI remoteClient, uint localID,
|
||||
InventoryItemBase item, UUID copyItemID)
|
||||
public bool AddInventoryItem(UUID agentID, uint localID, InventoryItemBase item, UUID copyItemID)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[PRIM INVENTORY]: Adding inventory item {0} from {1} to part with local ID {2}",
|
||||
@@ -107,9 +106,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
taskItem.Type = item.AssetType;
|
||||
taskItem.InvType = item.InvType;
|
||||
|
||||
if (remoteClient != null &&
|
||||
remoteClient.AgentId != part.OwnerID &&
|
||||
m_scene.Permissions.PropagatePermissions())
|
||||
if (agentID != part.OwnerID && m_scene.Permissions.PropagatePermissions())
|
||||
{
|
||||
taskItem.BasePermissions = item.BasePermissions &
|
||||
item.NextPermissions;
|
||||
@@ -144,11 +141,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// taskItem.SaleType = item.SaleType;
|
||||
taskItem.CreationDate = (uint)item.CreationDate;
|
||||
|
||||
bool addFromAllowedDrop = false;
|
||||
if (remoteClient != null)
|
||||
{
|
||||
addFromAllowedDrop = remoteClient.AgentId != part.OwnerID;
|
||||
}
|
||||
bool addFromAllowedDrop = agentID != part.OwnerID;
|
||||
|
||||
part.Inventory.AddInventoryItem(taskItem, addFromAllowedDrop);
|
||||
|
||||
@@ -276,6 +269,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public void ApplyNextOwnerPermissions()
|
||||
{
|
||||
// m_log.DebugFormat("[PRIM INVENTORY]: Applying next owner permissions to {0} {1}", Name, UUID);
|
||||
|
||||
SceneObjectPart[] parts = m_parts.GetArray();
|
||||
for (int i = 0; i < parts.Length; i++)
|
||||
parts[i].ApplyNextOwnerPermissions();
|
||||
|
||||
@@ -327,6 +327,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
set { RootPart.Name = value; }
|
||||
}
|
||||
|
||||
public string Description
|
||||
{
|
||||
get { return RootPart.Description; }
|
||||
set { RootPart.Description = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Added because the Parcel code seems to use it
|
||||
/// but not sure a object should have this
|
||||
@@ -460,6 +466,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
&& !IsAttachmentCheckFull() && (!Scene.LoadingPrims))
|
||||
{
|
||||
m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
|
||||
|
||||
if (IsDeleted)
|
||||
return;
|
||||
val = AbsolutePosition;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -538,6 +548,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
public UUID LastOwnerID
|
||||
{
|
||||
get { return m_rootPart.LastOwnerID; }
|
||||
set { m_rootPart.LastOwnerID = value; }
|
||||
}
|
||||
|
||||
public UUID OwnerID
|
||||
{
|
||||
get { return m_rootPart.OwnerID; }
|
||||
@@ -652,7 +668,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
// ~SceneObjectGroup()
|
||||
// {
|
||||
// m_log.DebugFormat("[SCENE OBJECT GROUP]: Destructor called for {0}, local id {1}", Name, LocalId);
|
||||
// //m_log.DebugFormat("[SCENE OBJECT GROUP]: Destructor called for {0}, local id {1}", Name, LocalId);
|
||||
// Console.WriteLine("Destructor called for {0}, local id {1}", Name, LocalId);
|
||||
// }
|
||||
|
||||
#region Constructors
|
||||
@@ -2339,10 +2356,19 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <param name="objectGroup">The group of prims which should be linked to this group</param>
|
||||
public void LinkToGroup(SceneObjectGroup objectGroup)
|
||||
{
|
||||
LinkToGroup(objectGroup, false);
|
||||
}
|
||||
|
||||
public void LinkToGroup(SceneObjectGroup objectGroup, bool insert)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE OBJECT GROUP]: Linking group with root part {0}, {1} to group with root part {2}, {3}",
|
||||
// objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID);
|
||||
|
||||
// Linking to ourselves is not a valid operation.
|
||||
if (objectGroup == this)
|
||||
return;
|
||||
|
||||
SceneObjectPart linkPart = objectGroup.m_rootPart;
|
||||
|
||||
Vector3 oldGroupPosition = linkPart.GroupPosition;
|
||||
@@ -2368,7 +2394,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
lock (m_parts.SyncRoot)
|
||||
{
|
||||
int linkNum = PrimCount + 1;
|
||||
int linkNum;
|
||||
if (insert)
|
||||
{
|
||||
linkNum = 2;
|
||||
foreach (SceneObjectPart part in Parts)
|
||||
{
|
||||
if (part.LinkNum > 1)
|
||||
part.LinkNum++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
linkNum = PrimCount + 1;
|
||||
}
|
||||
|
||||
m_parts.Add(linkPart.UUID, linkPart);
|
||||
|
||||
@@ -2808,9 +2847,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
for (int i = 0; i < parts.Length; i++)
|
||||
{
|
||||
SceneObjectPart part = parts[i];
|
||||
if (part.Scale.X > m_scene.RegionInfo.PhysPrimMax ||
|
||||
part.Scale.Y > m_scene.RegionInfo.PhysPrimMax ||
|
||||
part.Scale.Z > m_scene.RegionInfo.PhysPrimMax)
|
||||
if (part.Scale.X > m_scene.m_maxPhys ||
|
||||
part.Scale.Y > m_scene.m_maxPhys ||
|
||||
part.Scale.Z > m_scene.m_maxPhys )
|
||||
{
|
||||
UsePhysics = false; // Reset physics
|
||||
break;
|
||||
|
||||
@@ -226,11 +226,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public Quaternion SpinOldOrientation = Quaternion.Identity;
|
||||
|
||||
public Quaternion m_APIDTarget = Quaternion.Identity;
|
||||
|
||||
public float m_APIDDamp = 0;
|
||||
|
||||
public float m_APIDStrength = 0;
|
||||
protected int m_APIDIterations = 0;
|
||||
protected Quaternion m_APIDTarget = Quaternion.Identity;
|
||||
protected float m_APIDDamp = 0;
|
||||
protected float m_APIDStrength = 0;
|
||||
|
||||
/// <summary>
|
||||
/// This part's inventory
|
||||
@@ -245,7 +244,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public bool IgnoreUndoUpdate = false;
|
||||
|
||||
private PrimFlags LocalFlags;
|
||||
public PrimFlags LocalFlags;
|
||||
|
||||
private float m_damage = -1.0f;
|
||||
private byte[] m_TextureAnimation;
|
||||
@@ -405,7 +404,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
private string m_creatorData = string.Empty;
|
||||
/// <summary>
|
||||
/// Data about the creator in the form profile_url;name
|
||||
/// Data about the creator in the form home_url;name
|
||||
/// </summary>
|
||||
public string CreatorData
|
||||
{
|
||||
@@ -416,7 +415,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <summary>
|
||||
/// Used by the DB layer to retrieve / store the entire user identification.
|
||||
/// The identification can either be a simple UUID or a string of the form
|
||||
/// uuid[;profile_url[;name]]
|
||||
/// uuid[;home_url[;name]]
|
||||
/// </summary>
|
||||
public string CreatorIdentification
|
||||
{
|
||||
@@ -578,22 +577,21 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Quaternion APIDTarget
|
||||
protected Quaternion APIDTarget
|
||||
{
|
||||
get { return m_APIDTarget; }
|
||||
set { m_APIDTarget = value; }
|
||||
}
|
||||
|
||||
|
||||
public float APIDDamp
|
||||
protected float APIDDamp
|
||||
{
|
||||
get { return m_APIDDamp; }
|
||||
set { m_APIDDamp = value; }
|
||||
}
|
||||
|
||||
|
||||
public float APIDStrength
|
||||
protected float APIDStrength
|
||||
{
|
||||
get { return m_APIDStrength; }
|
||||
set { m_APIDStrength = value; }
|
||||
@@ -935,32 +933,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public Color Color
|
||||
{
|
||||
get { return m_color; }
|
||||
set
|
||||
{
|
||||
m_color = value;
|
||||
|
||||
/* ScheduleFullUpdate() need not be called b/c after
|
||||
* setting the color, the text will be set, so then
|
||||
* ScheduleFullUpdate() will be called. */
|
||||
//ScheduleFullUpdate();
|
||||
}
|
||||
set { m_color = value; }
|
||||
}
|
||||
|
||||
public string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
string returnstr = m_text;
|
||||
if (returnstr.Length > 255)
|
||||
{
|
||||
returnstr = returnstr.Substring(0, 254);
|
||||
}
|
||||
return returnstr;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_text = value;
|
||||
if (m_text.Length > 255)
|
||||
return m_text.Substring(0, 254);
|
||||
return m_text;
|
||||
}
|
||||
set { m_text = value; }
|
||||
}
|
||||
|
||||
|
||||
@@ -1565,7 +1549,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
PhysActor = null;
|
||||
}
|
||||
|
||||
// Basic Physics returns null.. joy joy joy.
|
||||
// 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
|
||||
@@ -1573,10 +1557,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
DoPhysicsPropertyUpdate(RigidBody, true);
|
||||
PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat("[SOP]: physics actor is null for {0} with parent {1}", UUID, this.ParentGroup.UUID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2748,11 +2728,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
|
||||
public void RotLookAt(Quaternion target, float strength, float damping)
|
||||
{
|
||||
m_parentGroup.rotLookAt(target, strength, damping); // This calls method in SceneObjectGroup.
|
||||
}
|
||||
|
||||
public void rotLookAt(Quaternion target, float strength, float damping)
|
||||
{
|
||||
if (ParentGroup.IsAttachment)
|
||||
{
|
||||
@@ -2768,17 +2743,26 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
APIDDamp = damping;
|
||||
APIDStrength = strength;
|
||||
APIDTarget = target;
|
||||
|
||||
if (APIDStrength <= 0)
|
||||
{
|
||||
m_log.WarnFormat("[SceneObjectPart] Invalid rotation strength {0}",APIDStrength);
|
||||
return;
|
||||
}
|
||||
|
||||
m_APIDIterations = 1 + (int)(Math.PI * APIDStrength);
|
||||
}
|
||||
|
||||
// Necessary to get the lookat deltas applied
|
||||
ParentGroup.QueueForUpdateCheck();
|
||||
}
|
||||
|
||||
public void startLookAt(Quaternion rot, float damp, float strength)
|
||||
public void StartLookAt(Quaternion target, float strength, float damping)
|
||||
{
|
||||
APIDDamp = damp;
|
||||
APIDStrength = strength;
|
||||
APIDTarget = rot;
|
||||
RotLookAt(target,strength,damping);
|
||||
}
|
||||
|
||||
public void stopLookAt()
|
||||
public void StopLookAt()
|
||||
{
|
||||
APIDTarget = Quaternion.Identity;
|
||||
}
|
||||
@@ -2814,6 +2798,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE OBJECT PART]: Scheduling full update for {0}, {1} at {2}",
|
||||
// UUID, Name, TimeStampFull);
|
||||
|
||||
if (ParentGroup.Scene != null)
|
||||
ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -2830,6 +2817,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (ParentGroup.IsAttachment)
|
||||
{
|
||||
ScheduleFullUpdate();
|
||||
return;
|
||||
}
|
||||
|
||||
if (UpdateFlag == UpdateRequired.NONE)
|
||||
@@ -2844,6 +2832,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// "[SCENE OBJECT PART]: Scheduling terse update for {0}, {1} at {2}",
|
||||
// UUID, Name, TimeStampTerse);
|
||||
}
|
||||
|
||||
if (ParentGroup.Scene != null)
|
||||
ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this);
|
||||
}
|
||||
|
||||
public void ScriptSetPhysicsStatus(bool UsePhysics)
|
||||
@@ -3468,13 +3459,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
public void StopLookAt()
|
||||
{
|
||||
ParentGroup.stopLookAt();
|
||||
|
||||
ParentGroup.ScheduleGroupForTerseUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the text displayed for this part.
|
||||
/// </summary>
|
||||
@@ -4584,10 +4568,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <summary>
|
||||
/// Update the texture entry for this part.
|
||||
/// </summary>
|
||||
/// <param name="textureEntry"></param>
|
||||
public void UpdateTextureEntry(byte[] textureEntry)
|
||||
/// <param name="serializedTextureEntry"></param>
|
||||
public void UpdateTextureEntry(byte[] serializedTextureEntry)
|
||||
{
|
||||
UpdateTextureEntry(new Primitive.TextureEntry(serializedTextureEntry, 0, serializedTextureEntry.Length));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the texture entry for this part.
|
||||
/// </summary>
|
||||
/// <param name="newTex"></param>
|
||||
public void UpdateTextureEntry(Primitive.TextureEntry newTex)
|
||||
{
|
||||
Primitive.TextureEntry newTex = new Primitive.TextureEntry(textureEntry, 0, textureEntry.Length);
|
||||
Primitive.TextureEntry oldTex = Shape.Textures;
|
||||
|
||||
Changed changeFlags = 0;
|
||||
@@ -4619,7 +4611,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
break;
|
||||
}
|
||||
|
||||
m_shape.TextureEntry = textureEntry;
|
||||
m_shape.TextureEntry = newTex.GetBytes();
|
||||
if (changeFlags != 0)
|
||||
TriggerScriptChangedEvent(changeFlags);
|
||||
UpdateFlag = UpdateRequired.FULL;
|
||||
@@ -4790,24 +4782,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
if (APIDTarget != Quaternion.Identity)
|
||||
{
|
||||
if (Single.IsNaN(APIDTarget.W) == true)
|
||||
if (m_APIDIterations <= 1)
|
||||
{
|
||||
UpdateRotation(APIDTarget);
|
||||
APIDTarget = Quaternion.Identity;
|
||||
return;
|
||||
}
|
||||
Quaternion rot = RotationOffset;
|
||||
Quaternion dir = (rot - APIDTarget);
|
||||
float speed = ((APIDStrength / APIDDamp) * (float)(Math.PI / 180.0f));
|
||||
if (dir.Z > speed)
|
||||
{
|
||||
rot.Z -= speed;
|
||||
}
|
||||
if (dir.Z < -speed)
|
||||
{
|
||||
rot.Z += speed;
|
||||
}
|
||||
rot.Normalize();
|
||||
|
||||
Quaternion rot = Quaternion.Slerp(RotationOffset,APIDTarget,1.0f/(float)m_APIDIterations);
|
||||
UpdateRotation(rot);
|
||||
|
||||
m_APIDIterations--;
|
||||
|
||||
// This ensures that we'll check this object on the next iteration
|
||||
ParentGroup.QueueForUpdateCheck();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -326,10 +326,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <returns></returns>
|
||||
public void CreateScriptInstance(TaskInventoryItem item, int startParam, bool postOnRez, string engine, int stateSource)
|
||||
{
|
||||
// m_log.InfoFormat(
|
||||
// "[PRIM INVENTORY]: " +
|
||||
// "Starting script {0}, {1} in prim {2}, {3}",
|
||||
// item.Name, item.ItemID, Name, UUID);
|
||||
// m_log.DebugFormat("[PRIM INVENTORY]: Starting script {0} {1} in prim {2} {3} in {4}",
|
||||
// item.Name, item.ItemID, m_part.Name, m_part.UUID, m_part.ParentGroup.Scene.RegionInfo.RegionName);
|
||||
|
||||
if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID))
|
||||
{
|
||||
@@ -362,18 +360,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
string msg = String.Format("asset ID {0} could not be found", item.AssetID);
|
||||
StoreScriptError(item.ItemID, msg);
|
||||
m_log.ErrorFormat(
|
||||
"[PRIM INVENTORY]: " +
|
||||
"Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found",
|
||||
"[PRIM INVENTORY]: Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found",
|
||||
item.Name, item.ItemID, m_part.AbsolutePosition,
|
||||
m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_part.ParentGroup.m_savedScriptState != null)
|
||||
RestoreSavedScriptState(item.OldItemID, item.ItemID);
|
||||
item.OldItemID = RestoreSavedScriptState(item.LoadedItemID, item.OldItemID, item.ItemID);
|
||||
|
||||
m_items.LockItemsForWrite(true);
|
||||
|
||||
m_items[item.ItemID].OldItemID = item.OldItemID;
|
||||
m_items[item.ItemID].PermsMask = 0;
|
||||
m_items[item.ItemID].PermsGranter = UUID.Zero;
|
||||
|
||||
@@ -392,17 +390,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
private void RestoreSavedScriptState(UUID oldID, UUID newID)
|
||||
private UUID RestoreSavedScriptState(UUID loadedID, UUID oldID, UUID newID)
|
||||
{
|
||||
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
|
||||
if (engines.Length == 0) // No engine at all
|
||||
return;
|
||||
return oldID;
|
||||
|
||||
if (m_part.ParentGroup.m_savedScriptState.ContainsKey(oldID))
|
||||
UUID stateID = oldID;
|
||||
if (!m_part.ParentGroup.m_savedScriptState.ContainsKey(oldID))
|
||||
stateID = loadedID;
|
||||
if (m_part.ParentGroup.m_savedScriptState.ContainsKey(stateID))
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
|
||||
doc.LoadXml(m_part.ParentGroup.m_savedScriptState[oldID]);
|
||||
doc.LoadXml(m_part.ParentGroup.m_savedScriptState[stateID]);
|
||||
|
||||
////////// CRUFT WARNING ///////////////////////////////////
|
||||
//
|
||||
@@ -419,7 +420,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
XmlElement rootN = newDoc.CreateElement("", "State", "");
|
||||
XmlAttribute uuidA = newDoc.CreateAttribute("", "UUID", "");
|
||||
uuidA.Value = oldID.ToString();
|
||||
uuidA.Value = stateID.ToString();
|
||||
rootN.Attributes.Append(uuidA);
|
||||
XmlAttribute engineA = newDoc.CreateAttribute("", "Engine", "");
|
||||
engineA.Value = "XEngine";
|
||||
@@ -433,20 +434,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// This created document has only the minimun data
|
||||
// necessary for XEngine to parse it successfully
|
||||
|
||||
m_part.ParentGroup.m_savedScriptState[oldID] = newDoc.OuterXml;
|
||||
m_part.ParentGroup.m_savedScriptState[stateID] = newDoc.OuterXml;
|
||||
}
|
||||
|
||||
foreach (IScriptModule e in engines)
|
||||
{
|
||||
if (e != null)
|
||||
{
|
||||
if (e.SetXMLState(newID, m_part.ParentGroup.m_savedScriptState[oldID]))
|
||||
if (e.SetXMLState(newID, m_part.ParentGroup.m_savedScriptState[stateID]))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_part.ParentGroup.m_savedScriptState.Remove(oldID);
|
||||
m_part.ParentGroup.m_savedScriptState.Remove(stateID);
|
||||
}
|
||||
|
||||
return stateID;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -493,8 +496,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
string msg = String.Format("couldn't be found for prim {0}, {1}", m_part.Name, m_part.UUID);
|
||||
StoreScriptError(itemId, msg);
|
||||
m_log.ErrorFormat(
|
||||
"[PRIM INVENTORY]: " +
|
||||
"Couldn't start script with ID {0} since it {1}", itemId, msg);
|
||||
"[PRIM INVENTORY]: Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}",
|
||||
itemId, m_part.Name, m_part.UUID,
|
||||
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ using OpenSim.Region.Framework.Scenes.Types;
|
||||
using OpenSim.Region.Physics.Manager;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using TeleportFlags = OpenSim.Framework.Constants.TeleportFlags;
|
||||
|
||||
namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
@@ -1188,6 +1189,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
client.Name, Scene.RegionInfo.RegionName, AbsolutePosition);
|
||||
|
||||
Vector3 look = Velocity;
|
||||
|
||||
if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
|
||||
{
|
||||
look = new Vector3(0.99f, 0.042f, 0);
|
||||
@@ -1214,7 +1216,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_callbackURI = null;
|
||||
}
|
||||
|
||||
//m_log.DebugFormat("[SCENE PRESENCE] Completed movement");
|
||||
// m_log.DebugFormat("[SCENE PRESENCE] Completed movement");
|
||||
|
||||
ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
|
||||
ValidateAndSendAppearanceAndAgentData();
|
||||
@@ -1282,8 +1284,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE PRESENCE]: In {0} received agent update from {1}",
|
||||
// Scene.RegionInfo.RegionName, remoteClient.Name);
|
||||
// "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}",
|
||||
// Scene.RegionInfo.RegionName, remoteClient.Name, agentData.ControlFlags);
|
||||
|
||||
if (IsChildAgent)
|
||||
{
|
||||
@@ -1753,9 +1755,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;
|
||||
@@ -2323,6 +2325,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <param name="vec">The vector in which to move. This is relative to the rotation argument</param>
|
||||
public void AddNewMovement(Vector3 vec)
|
||||
{
|
||||
// m_log.DebugFormat("[SCENE PRESENCE]: Adding new movement {0} for {1}", vec, Name);
|
||||
|
||||
Vector3 direc = vec * Rotation;
|
||||
direc.Normalize();
|
||||
|
||||
@@ -3814,7 +3818,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_reprioritization_called = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void CheckLandingPoint(ref Vector3 pos)
|
||||
{
|
||||
// Never constrain lures
|
||||
@@ -3840,26 +3844,93 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckAndAdjustTelehub(SceneObjectGroup telehub, ref Vector3 pos)
|
||||
{
|
||||
if ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) ==
|
||||
(TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) ||
|
||||
(m_teleportFlags & TeleportFlags.ViaLandmark) != 0 ||
|
||||
(m_teleportFlags & TeleportFlags.ViaLocation) != 0 ||
|
||||
(m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)
|
||||
{
|
||||
if (GodLevel < 200 &&
|
||||
((!m_scene.Permissions.IsGod(m_uuid) &&
|
||||
!m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid)) ||
|
||||
(m_teleportFlags & TeleportFlags.ViaLocation) != 0 ||
|
||||
(m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0))
|
||||
{
|
||||
SpawnPoint[] spawnPoints = m_scene.RegionInfo.RegionSettings.SpawnPoints().ToArray();
|
||||
if (spawnPoints.Length == 0)
|
||||
return;
|
||||
|
||||
float distance = 9999;
|
||||
int closest = -1;
|
||||
|
||||
for (int i = 0 ; i < spawnPoints.Length ; i++)
|
||||
{
|
||||
Vector3 spawnPosition = spawnPoints[i].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
|
||||
Vector3 offset = spawnPosition - pos;
|
||||
float d = Vector3.Mag(offset);
|
||||
if (d >= distance)
|
||||
continue;
|
||||
ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y);
|
||||
if (land == null)
|
||||
continue;
|
||||
if (land.IsEitherBannedOrRestricted(UUID))
|
||||
continue;
|
||||
distance = d;
|
||||
closest = i;
|
||||
}
|
||||
if (closest == -1)
|
||||
return;
|
||||
|
||||
pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckAndAdjustLandingPoint(ref Vector3 pos)
|
||||
{
|
||||
string reason;
|
||||
|
||||
// Honor bans
|
||||
if (!m_scene.TestLandRestrictions(UUID, out reason, ref pos.X, ref pos.Y))
|
||||
return;
|
||||
|
||||
SceneObjectGroup telehub = null;
|
||||
if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero && (telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject)) != null)
|
||||
{
|
||||
if (!m_scene.RegionInfo.EstateSettings.AllowDirectTeleport)
|
||||
{
|
||||
CheckAndAdjustTelehub(telehub, ref pos);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y);
|
||||
if (land != null)
|
||||
{
|
||||
if (Scene.DEBUG)
|
||||
TeleportFlagsDebug();
|
||||
|
||||
// If we come in via login, landmark or map, we want to
|
||||
// honor landing points. If we come in via Lure, we want
|
||||
// to ignore them.
|
||||
if ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) == (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) ||
|
||||
if ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) ==
|
||||
(TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) ||
|
||||
(m_teleportFlags & TeleportFlags.ViaLandmark) != 0 ||
|
||||
(m_teleportFlags & TeleportFlags.ViaLocation) != 0)
|
||||
(m_teleportFlags & TeleportFlags.ViaLocation) != 0 ||
|
||||
(m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)
|
||||
{
|
||||
// Don't restrict gods, estate managers, or land owners to
|
||||
// the TP point. This behaviour mimics agni.
|
||||
if (land.LandData.LandingType == (byte)LandingType.LandingPoint &&
|
||||
land.LandData.UserLocation != Vector3.Zero &&
|
||||
GodLevel < 200 &&
|
||||
((land.LandData.OwnerID != m_uuid &&
|
||||
(!m_scene.Permissions.IsGod(m_uuid)) &&
|
||||
(!m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid))) || (m_teleportFlags & TeleportFlags.ViaLocation) != 0))
|
||||
((land.LandData.OwnerID != m_uuid &&
|
||||
!m_scene.Permissions.IsGod(m_uuid) &&
|
||||
!m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid)) ||
|
||||
(m_teleportFlags & TeleportFlags.ViaLocation) != 0 ||
|
||||
(m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0))
|
||||
{
|
||||
pos = land.LandData.UserLocation;
|
||||
}
|
||||
@@ -4030,5 +4101,30 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void TeleportFlagsDebug() {
|
||||
|
||||
// Some temporary debugging help to show all the TeleportFlags we have...
|
||||
bool HG = false;
|
||||
if((m_teleportFlags & TeleportFlags.ViaHGLogin) == TeleportFlags.ViaHGLogin)
|
||||
HG = true;
|
||||
|
||||
m_log.InfoFormat("[SCENE PRESENCE]: TELEPORT ******************");
|
||||
|
||||
uint i = 0u;
|
||||
for (int x = 0; x <= 30 ; x++, i = 1u << x)
|
||||
{
|
||||
i = 1u << x;
|
||||
|
||||
if((m_teleportFlags & (TeleportFlags)i) == (TeleportFlags)i)
|
||||
if (HG == false)
|
||||
m_log.InfoFormat("[SCENE PRESENCE]: Teleport Flags include {0}", ((TeleportFlags) i).ToString());
|
||||
else
|
||||
m_log.InfoFormat("[SCENE PRESENCE]: HG Teleport Flags include {0}", ((TeleportFlags)i).ToString());
|
||||
}
|
||||
|
||||
m_log.InfoFormat("[SCENE PRESENCE]: TELEPORT ******************");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ using System.Xml;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Serialization.External;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
@@ -54,7 +55,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
/// Deserialize a scene object from the original xml format
|
||||
/// </summary>
|
||||
/// <param name="xmlData"></param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The scene object deserialized. Null on failure.</returns>
|
||||
public static SceneObjectGroup FromOriginalXmlFormat(string xmlData)
|
||||
{
|
||||
//m_log.DebugFormat("[SOG]: Starting deserialization of SOG");
|
||||
@@ -276,14 +277,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
|
||||
#region manual serialization
|
||||
|
||||
private delegate void SOPXmlProcessor(SceneObjectPart sop, XmlTextReader reader);
|
||||
private static Dictionary<string, SOPXmlProcessor> m_SOPXmlProcessors = new Dictionary<string, SOPXmlProcessor>();
|
||||
private static Dictionary<string, Action<SceneObjectPart, XmlTextReader>> m_SOPXmlProcessors
|
||||
= new Dictionary<string, Action<SceneObjectPart, XmlTextReader>>();
|
||||
|
||||
private delegate void TaskInventoryXmlProcessor(TaskInventoryItem item, XmlTextReader reader);
|
||||
private static Dictionary<string, TaskInventoryXmlProcessor> m_TaskInventoryXmlProcessors = new Dictionary<string, TaskInventoryXmlProcessor>();
|
||||
private static Dictionary<string, Action<TaskInventoryItem, XmlTextReader>> m_TaskInventoryXmlProcessors
|
||||
= new Dictionary<string, Action<TaskInventoryItem, XmlTextReader>>();
|
||||
|
||||
private delegate void ShapeXmlProcessor(PrimitiveBaseShape shape, XmlTextReader reader);
|
||||
private static Dictionary<string, ShapeXmlProcessor> m_ShapeXmlProcessors = new Dictionary<string, ShapeXmlProcessor>();
|
||||
private static Dictionary<string, Action<PrimitiveBaseShape, XmlTextReader>> m_ShapeXmlProcessors
|
||||
= new Dictionary<string, Action<PrimitiveBaseShape, XmlTextReader>>();
|
||||
|
||||
static SceneObjectSerializer()
|
||||
{
|
||||
@@ -807,10 +808,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
|
||||
private static void ProcessTIOldItemID(TaskInventoryItem item, XmlTextReader reader)
|
||||
{
|
||||
Util.ReadUUID(reader, "OldItemID");
|
||||
// On deserialization, the old item id MUST BE UUID.Zero!!!!!
|
||||
// Setting this to the saved value will BREAK script persistence!
|
||||
// item.OldItemID = Util.ReadUUID(reader, "OldItemID");
|
||||
item.OldItemID = Util.ReadUUID(reader, "OldItemID");
|
||||
}
|
||||
|
||||
private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlTextReader reader)
|
||||
@@ -1147,12 +1145,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
|
||||
if (sop.CreatorData != null && sop.CreatorData != string.Empty)
|
||||
writer.WriteElementString("CreatorData", sop.CreatorData);
|
||||
else if (options.ContainsKey("profile"))
|
||||
else if (options.ContainsKey("home"))
|
||||
{
|
||||
if (m_UserManagement == null)
|
||||
m_UserManagement = sop.ParentGroup.Scene.RequestModuleInterface<IUserManagement>();
|
||||
string name = m_UserManagement.GetUserName(sop.CreatorID);
|
||||
writer.WriteElementString("CreatorData", (string)options["profile"] + "/" + sop.CreatorID + ";" + name);
|
||||
writer.WriteElementString("CreatorData", (string)options["home"] + ";" + name);
|
||||
}
|
||||
|
||||
WriteUUID(writer, "FolderID", sop.FolderID, options);
|
||||
@@ -1205,8 +1203,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
writer.WriteElementString("ObjectSaleType", sop.ObjectSaleType.ToString());
|
||||
writer.WriteElementString("OwnershipCost", sop.OwnershipCost.ToString());
|
||||
WriteUUID(writer, "GroupID", sop.GroupID, options);
|
||||
WriteUUID(writer, "OwnerID", sop.OwnerID, options);
|
||||
WriteUUID(writer, "LastOwnerID", sop.LastOwnerID, options);
|
||||
|
||||
UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.OwnerID;
|
||||
WriteUUID(writer, "OwnerID", ownerID, options);
|
||||
|
||||
UUID lastOwnerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.LastOwnerID;
|
||||
WriteUUID(writer, "LastOwnerID", lastOwnerID, options);
|
||||
|
||||
writer.WriteElementString("BaseMask", sop.BaseMask.ToString());
|
||||
writer.WriteElementString("OwnerMask", sop.OwnerMask.ToString());
|
||||
writer.WriteElementString("GroupMask", sop.GroupMask.ToString());
|
||||
@@ -1293,17 +1296,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
writer.WriteElementString("BasePermissions", item.BasePermissions.ToString());
|
||||
writer.WriteElementString("CreationDate", item.CreationDate.ToString());
|
||||
|
||||
|
||||
WriteUUID(writer, "CreatorID", item.CreatorID, options);
|
||||
|
||||
if (item.CreatorData != null && item.CreatorData != string.Empty)
|
||||
writer.WriteElementString("CreatorData", item.CreatorData);
|
||||
else if (options.ContainsKey("profile"))
|
||||
else if (options.ContainsKey("home"))
|
||||
{
|
||||
if (m_UserManagement == null)
|
||||
m_UserManagement = scene.RequestModuleInterface<IUserManagement>();
|
||||
string name = m_UserManagement.GetUserName(item.CreatorID);
|
||||
writer.WriteElementString("CreatorData", (string)options["profile"] + "/" + item.CreatorID + ";" + name);
|
||||
writer.WriteElementString("CreatorData", (string)options["home"] + ";" + name);
|
||||
}
|
||||
|
||||
writer.WriteElementString("Description", item.Description);
|
||||
@@ -1314,10 +1316,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
writer.WriteElementString("InvType", item.InvType.ToString());
|
||||
WriteUUID(writer, "ItemID", item.ItemID, options);
|
||||
WriteUUID(writer, "OldItemID", item.OldItemID, options);
|
||||
WriteUUID(writer, "LastOwnerID", item.LastOwnerID, options);
|
||||
|
||||
UUID lastOwnerID = options.ContainsKey("wipe-owners") ? UUID.Zero : item.LastOwnerID;
|
||||
WriteUUID(writer, "LastOwnerID", lastOwnerID, options);
|
||||
|
||||
writer.WriteElementString("Name", item.Name);
|
||||
writer.WriteElementString("NextPermissions", item.NextPermissions.ToString());
|
||||
WriteUUID(writer, "OwnerID", item.OwnerID, options);
|
||||
|
||||
UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : item.OwnerID;
|
||||
WriteUUID(writer, "OwnerID", ownerID, options);
|
||||
|
||||
writer.WriteElementString("CurrentPermissions", item.CurrentPermissions.ToString());
|
||||
WriteUUID(writer, "ParentID", item.ParentID, options);
|
||||
WriteUUID(writer, "ParentPartID", item.ParentPartID, options);
|
||||
@@ -1473,34 +1481,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
|
||||
reader.ReadStartElement("SceneObjectPart");
|
||||
|
||||
string nodeName = string.Empty;
|
||||
while (reader.NodeType != XmlNodeType.EndElement)
|
||||
{
|
||||
nodeName = reader.Name;
|
||||
SOPXmlProcessor p = null;
|
||||
if (m_SOPXmlProcessors.TryGetValue(reader.Name, out p))
|
||||
{
|
||||
//m_log.DebugFormat("[XXX] Processing: {0}", reader.Name);
|
||||
try
|
||||
{
|
||||
p(obj, reader);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[SceneObjectSerializer]: exception while parsing {0} in object {1} {2}: {3}{4}",
|
||||
obj.Name, obj.UUID, nodeName, e.Message, e.StackTrace);
|
||||
if (reader.NodeType == XmlNodeType.EndElement)
|
||||
reader.Read();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element {0}", nodeName);
|
||||
reader.ReadOuterXml(); // ignore
|
||||
}
|
||||
|
||||
}
|
||||
ExternalRepresentationUtils.ExecuteReadProcessors(
|
||||
obj,
|
||||
m_SOPXmlProcessors,
|
||||
reader,
|
||||
(o, nodeName, e)
|
||||
=> m_log.ErrorFormat(
|
||||
"[SceneObjectSerializer]: Exception while parsing {0} in object {1} {2}: {3}{4}",
|
||||
((SceneObjectPart)o).Name, ((SceneObjectPart)o).UUID, nodeName, e.Message, e.StackTrace));
|
||||
|
||||
reader.ReadEndElement(); // SceneObjectPart
|
||||
|
||||
@@ -1519,17 +1507,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
reader.ReadStartElement("TaskInventoryItem", String.Empty); // TaskInventory
|
||||
|
||||
TaskInventoryItem item = new TaskInventoryItem();
|
||||
while (reader.NodeType != XmlNodeType.EndElement)
|
||||
{
|
||||
TaskInventoryXmlProcessor p = null;
|
||||
if (m_TaskInventoryXmlProcessors.TryGetValue(reader.Name, out p))
|
||||
p(item, reader);
|
||||
else
|
||||
{
|
||||
// m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element in TaskInventory {0}, {1}", reader.Name, reader.Value);
|
||||
reader.ReadOuterXml();
|
||||
}
|
||||
}
|
||||
|
||||
ExternalRepresentationUtils.ExecuteReadProcessors(
|
||||
item,
|
||||
m_TaskInventoryXmlProcessors,
|
||||
reader);
|
||||
|
||||
reader.ReadEndElement(); // TaskInventoryItem
|
||||
tinv.Add(item.ItemID, item);
|
||||
|
||||
@@ -1556,35 +1539,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
|
||||
reader.ReadStartElement(name, String.Empty); // Shape
|
||||
|
||||
string nodeName = string.Empty;
|
||||
while (reader.NodeType != XmlNodeType.EndElement)
|
||||
{
|
||||
nodeName = reader.Name;
|
||||
//m_log.DebugFormat("[XXX] Processing: {0}", reader.Name);
|
||||
ShapeXmlProcessor p = null;
|
||||
if (m_ShapeXmlProcessors.TryGetValue(reader.Name, out p))
|
||||
{
|
||||
try
|
||||
{
|
||||
p(shape, reader);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
errors = true;
|
||||
m_log.DebugFormat(
|
||||
"[SceneObjectSerializer]: exception while parsing Shape property {0}: {1}{2}",
|
||||
nodeName, e.Message, e.StackTrace);
|
||||
|
||||
if (reader.NodeType == XmlNodeType.EndElement)
|
||||
reader.Read();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element in Shape {0}", reader.Name);
|
||||
reader.ReadOuterXml();
|
||||
}
|
||||
}
|
||||
ExternalRepresentationUtils.ExecuteReadProcessors(
|
||||
shape,
|
||||
m_ShapeXmlProcessors,
|
||||
reader,
|
||||
(o, nodeName, e)
|
||||
=> m_log.ErrorFormat(
|
||||
"[SceneObjectSerializer]: Exception while parsing Shape property {0}: {1}{2}",
|
||||
nodeName, e.Message, e.StackTrace));
|
||||
|
||||
reader.ReadEndElement(); // Shape
|
||||
|
||||
|
||||
@@ -39,14 +39,31 @@ using log4net;
|
||||
|
||||
namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Linking tests
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class SceneObjectLinkingTests
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Links to self should be ignored.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestLinkToSelf()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
UUID ownerId = TestHelpers.ParseTail(0x1);
|
||||
int nParts = 3;
|
||||
|
||||
TestScene scene = SceneHelpers.SetupScene();
|
||||
SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(nParts, ownerId, "TestLinkToSelf_", 0x10);
|
||||
scene.AddSceneObject(sog1);
|
||||
scene.LinkObjects(ownerId, sog1.LocalId, new List<uint>() { sog1.Parts[1].LocalId });
|
||||
// sog1.LinkToGroup(sog1);
|
||||
|
||||
Assert.That(sog1.Parts.Length, Is.EqualTo(nParts));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLinkDelink2SceneObjects()
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user