Compare commits
38 Commits
master
...
0.8.2-post
Author | SHA1 | Date |
---|---|---|
Diva Canto | eb988d72bc | |
Diva Canto | 00efc288d1 | |
Kevin Cozens | 48b6d7ad27 | |
Diva Canto | 28e35420ea | |
Melanie Thielker | ea7b316c4b | |
Melanie Thielker | 0bae05ff46 | |
Diva Canto | cbf5dfc16f | |
Diva Canto | 928706b207 | |
Diva Canto | e726fa11f3 | |
Diva Canto | 736343bee9 | |
Diva Canto | 363d7054ea | |
Diva Canto | 997cafb556 | |
Diva Canto | 497f575b9b | |
UbitUmarov | 0a122c9b40 | |
UbitUmarov | 46cd2da82c | |
Melanie Thielker | dc46089054 | |
Melanie Thielker | 22cf03ea0b | |
Diva Canto | 13bdd25cfd | |
Diva Canto | a2ae17ad33 | |
UbitUmarov | 8c75625e85 | |
Diva Canto | f3829c10e0 | |
Diva Canto | 4251fdf120 | |
Diva Canto | 9074c3d6f6 | |
Diva Canto | de7f31abd1 | |
Diva Canto | 2e7c2ee998 | |
Shy Robbiani | e4e31d9acf | |
Diva Canto | 7c1f6ba913 | |
Diva Canto | f980355da4 | |
Diva Canto | be744b68b4 | |
Diva Canto | 465abf01c0 | |
Diva Canto | 8a96d42e97 | |
UbitUmarov | 84c8a7ae53 | |
Diva Canto | 36af6a3baa | |
Diva Canto | 2c729a1a63 | |
Diva Canto | 426bbb63dd | |
Melanie Thielker | 4fd48ae8b3 | |
Diva Canto | a7f42ea8f1 | |
Diva Canto | 36573b4568 |
|
@ -1,6 +1,5 @@
|
||||||
.project
|
.project
|
||||||
.settings
|
.settings
|
||||||
.gitignore
|
|
||||||
*.csproj
|
*.csproj
|
||||||
*.csproj.user
|
*.csproj.user
|
||||||
*.build
|
*.build
|
||||||
|
@ -11,7 +10,6 @@
|
||||||
*.pidb
|
*.pidb
|
||||||
*.dll.build
|
*.dll.build
|
||||||
*.dll
|
*.dll
|
||||||
*.log
|
|
||||||
|
|
||||||
# Ignore .user and .suo files as these are user preference specific
|
# Ignore .user and .suo files as these are user preference specific
|
||||||
# http://stackoverflow.com/questions/72298/should-i-add-the-visual-studio-suo-and-user-files-to-source-control
|
# http://stackoverflow.com/questions/72298/should-i-add-the-visual-studio-suo-and-user-files-to-source-control
|
||||||
|
@ -31,8 +29,6 @@
|
||||||
*/*/*/*/*/bin
|
*/*/*/*/*/bin
|
||||||
*/*/*/*/*/*/bin
|
*/*/*/*/*/*/bin
|
||||||
*/*/*/*/*/*/*/bin
|
*/*/*/*/*/*/*/bin
|
||||||
.vs/
|
|
||||||
addon-modules/
|
|
||||||
bin/Debug/*.dll
|
bin/Debug/*.dll
|
||||||
bin/*.dll.mdb
|
bin/*.dll.mdb
|
||||||
bin/*.db
|
bin/*.db
|
||||||
|
@ -94,6 +90,7 @@ TAGS
|
||||||
Makefile.local
|
Makefile.local
|
||||||
bin/.version
|
bin/.version
|
||||||
compile.bat
|
compile.bat
|
||||||
|
addon-modules
|
||||||
OpenSim/Data/Tests/test-results/
|
OpenSim/Data/Tests/test-results/
|
||||||
OpenSim/Framework/Serialization/Tests/test-results/
|
OpenSim/Framework/Serialization/Tests/test-results/
|
||||||
OpenSim/Framework/Servers/Tests/test-results/
|
OpenSim/Framework/Servers/Tests/test-results/
|
||||||
|
|
|
@ -113,12 +113,10 @@
|
||||||
</exec>
|
</exec>
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.coremodules.tests)==0}" />
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.coremodules.tests)==0}" />
|
||||||
|
|
||||||
<!--
|
|
||||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.optionalmodules.tests">
|
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.optionalmodules.tests">
|
||||||
<arg value="./bin/OpenSim.Region.OptionalModules.Tests.dll" />
|
<arg value="./bin/OpenSim.Region.OptionalModules.Tests.dll" />
|
||||||
</exec>
|
</exec>
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.optionalmodules.tests)==0}" />
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.optionalmodules.tests)==0}" />
|
||||||
-->
|
|
||||||
|
|
||||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.framework.tests">
|
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.framework.tests">
|
||||||
<arg value="./bin/OpenSim.Region.Framework.Tests.dll" />
|
<arg value="./bin/OpenSim.Region.Framework.Tests.dll" />
|
||||||
|
@ -145,12 +143,7 @@
|
||||||
</exec>
|
</exec>
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.services.inventoryservice.tests)==0}" />
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.services.inventoryservice.tests)==0}" />
|
||||||
|
|
||||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.tests.permissions">
|
<delete dir="%temp%"/>
|
||||||
<arg value="./bin/OpenSim.Tests.Permissions.dll" />
|
|
||||||
</exec>
|
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.tests.permissions)==0}" />
|
|
||||||
|
|
||||||
<delete dir="%temp%"/>
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="test-stress" depends="build, find-nunit">
|
<target name="test-stress" depends="build, find-nunit">
|
||||||
|
@ -233,12 +226,10 @@
|
||||||
<arg value="-xml=test-results/OpenSim.Region.CoreModules.Tests.dll-Results.xml" />
|
<arg value="-xml=test-results/OpenSim.Region.CoreModules.Tests.dll-Results.xml" />
|
||||||
</exec>
|
</exec>
|
||||||
|
|
||||||
<!--
|
|
||||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.region.optionalmodules.tests">
|
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.region.optionalmodules.tests">
|
||||||
<arg value="./bin/OpenSim.Region.OptionalModules.Tests.dll" />
|
<arg value="./bin/OpenSim.Region.OptionalModules.Tests.dll" />
|
||||||
<arg value="-xml=test-results/OpenSim.Region.OptionalModules.Tests.dll-Results.xml" />
|
<arg value="-xml=test-results/OpenSim.Region.OptionalModules.Tests.dll-Results.xml" />
|
||||||
</exec>
|
</exec>
|
||||||
-->
|
|
||||||
|
|
||||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.region.framework.tests">
|
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.region.framework.tests">
|
||||||
<arg value="./bin/OpenSim.Region.Framework.Tests.dll" />
|
<arg value="./bin/OpenSim.Region.Framework.Tests.dll" />
|
||||||
|
@ -265,23 +256,17 @@
|
||||||
<arg value="-xml=test-results/OpenSim.Services.InventoryService.Tests.dll-Results.xml" />
|
<arg value="-xml=test-results/OpenSim.Services.InventoryService.Tests.dll-Results.xml" />
|
||||||
</exec>
|
</exec>
|
||||||
|
|
||||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.tests.permissions">
|
|
||||||
<arg value="./bin/OpenSim.Tests.Permissions.dll" />
|
|
||||||
<arg value="-xml=test-results/OpenSim.Tests.Permissions.dll-Results.xml" />
|
|
||||||
</exec>
|
|
||||||
|
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.tests)==0}" />
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.tests)==0}" />
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.tests)==0}" />
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.tests)==0}" />
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.servers.tests)==0}" />
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.servers.tests)==0}" />
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.clientstack.lindenudp.tests)==0}" />
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.clientstack.lindenudp.tests)==0}" />
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.scriptengine.tests)==0}" />
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.scriptengine.tests)==0}" />
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.coremodules.tests)==0}" />
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.coremodules.tests)==0}" />
|
||||||
<!-- <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.optionalmodules.tests)==0}" /> -->
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.optionalmodules.tests)==0}" />
|
||||||
<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.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.data.tests)==0}" />
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.capabilities.handlers.tests)==0}" />
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.capabilities.handlers.tests)==0}" />
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.services.inventoryservice.tests)==0}" />
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.services.inventoryservice.tests)==0}" />
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.tests.permissions)==0}" />
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="doxygen">
|
<target name="doxygen">
|
||||||
|
|
35
BUILDING.md
35
BUILDING.md
|
@ -1,35 +1,38 @@
|
||||||
# Building on Windows
|
# Building on Windows
|
||||||
|
|
||||||
Steps:
|
Steps:
|
||||||
|
|
||||||
* runprebuild.bat
|
* runprebuild.bat
|
||||||
* Load OpenSim.sln into Visual Studio .NET and build the solution.
|
* Load OpenSim.sln into Visual Studio .NET and build the solution.
|
||||||
* chdir bin
|
* chdir bin
|
||||||
* copy OpenSim.ini.example to OpenSim.ini and other appropriate files in bin/config-include
|
* copy OpenSim.ini.example to OpenSim.ini and other appropriate files in bin/config-include
|
||||||
* run OpenSim.exe
|
* run OpenSim.exe
|
||||||
|
|
||||||
# Building on Linux / Mac
|
# Building on Linux
|
||||||
|
|
||||||
Prereqs:
|
Prereqs:
|
||||||
|
* Mono >= 2.4.3
|
||||||
* Mono > 5.0
|
* Nant >= 0.85
|
||||||
* On some Linux distributions you may need to install additional packages.
|
* On some Linux distributions you may need to install additional packages.
|
||||||
* msbuild or xbuild if still supported by the mono version
|
See http://opensimulator.org/wiki/Dependencies for more information.
|
||||||
* 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:
|
From the distribution type:
|
||||||
|
|
||||||
* ./runprebuild.sh
|
* ./runprebuild.sh
|
||||||
* type msbuild or xbuild
|
* nant (or !* xbuild)
|
||||||
* cd bin
|
* cd bin
|
||||||
* copy OpenSim.ini.example to OpenSim.ini and other appropriate files in bin/config-include
|
* copy OpenSim.ini.example to OpenSim.ini and other appropriate files in bin/config-include
|
||||||
* review and change those ini files according to your needs
|
* run mono OpenSim.exe
|
||||||
* windows: execute opensim.exe or opensim32.exe for small regions
|
!* xbuild option switches
|
||||||
* linux: run ./opensim.sh
|
!* clean: xbuild /target:clean
|
||||||
* msbuild (xbuild) option switches
|
!* debug: (default) xbuild /property:Configuration=Debug
|
||||||
* clean: msbuild /target:clean
|
!* release: xbuild /property:Configuration=Release
|
||||||
* debug: (default) msbuild /property:Configuration=Debug
|
|
||||||
* release: msbuild /property:Configuration=Release
|
# Using Monodevelop
|
||||||
|
|
||||||
|
From the distribution type:
|
||||||
|
* ./runprebuild.sh
|
||||||
|
* type monodevelop OpenSim.sln
|
||||||
|
|
||||||
# References
|
# References
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,14 @@ The following people have contributed to OpenSim (Thank you for your effort!)
|
||||||
These folks represent the current core team for OpenSim, and are the
|
These folks represent the current core team for OpenSim, and are the
|
||||||
people that make the day to day of OpenSim happen.
|
people that make the day to day of OpenSim happen.
|
||||||
|
|
||||||
|
* justincc (OSVW Consulting, justincc.org)
|
||||||
* Melanie Thielker
|
* Melanie Thielker
|
||||||
* Diva (Crista Lopes, University of California, Irvine)
|
* Diva (Crista Lopes, University of California, Irvine)
|
||||||
|
* BlueWall (James Hughes)
|
||||||
|
* Nebadon Izumi (Michael Cerquoni, OSgrid)
|
||||||
|
* Snoopy Pfeffer
|
||||||
* Robert Adams (MisterBlue)
|
* Robert Adams (MisterBlue)
|
||||||
|
* Oren Hurvitz (Kitely)
|
||||||
* Kevin Cozens
|
* Kevin Cozens
|
||||||
* Leal Duarte (Ubit Umarov)
|
* Leal Duarte (Ubit Umarov)
|
||||||
|
|
||||||
|
@ -15,8 +20,11 @@ Core developers who have temporarily (we hope) gone chasing the white rabbit.
|
||||||
They are in all similar to the active core developers, except that they haven't
|
They are in all similar to the active core developers, except that they haven't
|
||||||
been that active lately, so their voting rights are awaiting their come back.
|
been that active lately, so their voting rights are awaiting their come back.
|
||||||
|
|
||||||
* Nebadon Izumi (Michael Cerquoni, OSgrid)
|
* Teravus (w3z)
|
||||||
* Alicia Raven
|
* Arthur Rodrigo S Valadares (IBM)
|
||||||
|
* Dan Lake
|
||||||
|
* Marck
|
||||||
|
* Mic Bowman
|
||||||
|
|
||||||
= Past Open Sim Developers =
|
= Past Open Sim Developers =
|
||||||
These folks are alumns of the OpenSim core group, but are now
|
These folks are alumns of the OpenSim core group, but are now
|
||||||
|
@ -49,15 +57,7 @@ where we are today.
|
||||||
* John Hurliman
|
* John Hurliman
|
||||||
* chi11ken (Genkii)
|
* chi11ken (Genkii)
|
||||||
* dahlia
|
* dahlia
|
||||||
* justincc (OSVW Consulting, justincc.org)
|
|
||||||
* Arthur Rodrigo S Valadares (IBM)
|
|
||||||
* BlueWall (James Hughes)
|
|
||||||
* Dan Lake
|
|
||||||
* Marck
|
|
||||||
* Mic Bowman
|
|
||||||
* Oren Hurvitz (Kitely)
|
|
||||||
* Snoopy Pfeffer
|
|
||||||
* Teravus (w3z)
|
|
||||||
|
|
||||||
= Additional OpenSim Contributors =
|
= Additional OpenSim Contributors =
|
||||||
These folks have contributed code patches or content to OpenSimulator to help make it
|
These folks have contributed code patches or content to OpenSimulator to help make it
|
||||||
|
@ -69,9 +69,9 @@ what it is today.
|
||||||
* alex_carnell
|
* alex_carnell
|
||||||
* Alan Webb (IBM)
|
* Alan Webb (IBM)
|
||||||
* Aleric
|
* Aleric
|
||||||
|
* Alicia Raven
|
||||||
* Allen Kerensky
|
* Allen Kerensky
|
||||||
* BigFootAg
|
* BigFootAg
|
||||||
* Bill Blight
|
|
||||||
* BlueWall Slade
|
* BlueWall Slade
|
||||||
* bobshaffer2
|
* bobshaffer2
|
||||||
* brianw/Sir_Ahzz
|
* brianw/Sir_Ahzz
|
||||||
|
@ -89,7 +89,6 @@ what it is today.
|
||||||
* dmiles (Daxtron Labs)
|
* dmiles (Daxtron Labs)
|
||||||
* Dong Jun Lan (IBM)
|
* Dong Jun Lan (IBM)
|
||||||
* DoranZemlja
|
* DoranZemlja
|
||||||
* Drake Arconis
|
|
||||||
* dr0b3rts
|
* dr0b3rts
|
||||||
* dslake
|
* dslake
|
||||||
* eeyore
|
* eeyore
|
||||||
|
@ -108,7 +107,6 @@ what it is today.
|
||||||
* Flyte Xevious
|
* Flyte Xevious
|
||||||
* Freaky Tech
|
* Freaky Tech
|
||||||
* Garmin Kawaguichi
|
* Garmin Kawaguichi
|
||||||
* Geir Noklebye
|
|
||||||
* Glenn Martin (MOSES)
|
* Glenn Martin (MOSES)
|
||||||
* Gryc Ueusp
|
* Gryc Ueusp
|
||||||
* H-H-H (ginge264)
|
* H-H-H (ginge264)
|
||||||
|
@ -117,7 +115,6 @@ what it is today.
|
||||||
* Imaze Rhiano
|
* Imaze Rhiano
|
||||||
* Intimidated
|
* Intimidated
|
||||||
* Jak Daniels
|
* Jak Daniels
|
||||||
* Jeff Kelly
|
|
||||||
* Jeremy Bongio (IBM)
|
* Jeremy Bongio (IBM)
|
||||||
* jhurliman
|
* jhurliman
|
||||||
* John R Sohn (XenReborn)
|
* John R Sohn (XenReborn)
|
||||||
|
@ -131,7 +128,6 @@ what it is today.
|
||||||
* KittyLiu
|
* KittyLiu
|
||||||
* Kurt Taylor (IBM)
|
* Kurt Taylor (IBM)
|
||||||
* Lani Global
|
* Lani Global
|
||||||
* lickx
|
|
||||||
* lillith_xue
|
* lillith_xue
|
||||||
* lkalif
|
* lkalif
|
||||||
* LuciusSirnah
|
* LuciusSirnah
|
||||||
|
@ -140,10 +136,8 @@ what it is today.
|
||||||
* Magnuz Binder
|
* Magnuz Binder
|
||||||
* maimedleech
|
* maimedleech
|
||||||
* Mana Janus
|
* Mana Janus
|
||||||
* Mandarinka Tasty
|
|
||||||
* MarcelEdward
|
* MarcelEdward
|
||||||
* Matt Lehmann
|
* Matt Lehmann
|
||||||
* mewtwo0641
|
|
||||||
* Mic Bowman
|
* Mic Bowman
|
||||||
* Michelle Argus
|
* Michelle Argus
|
||||||
* Michael Cortez (The Flotsam Project, http://osflotsam.org/)
|
* Michael Cortez (The Flotsam Project, http://osflotsam.org/)
|
||||||
|
@ -151,7 +145,6 @@ what it is today.
|
||||||
* Micheil Merlin
|
* Micheil Merlin
|
||||||
* Mike Osias (IBM)
|
* Mike Osias (IBM)
|
||||||
* Mike Pitman (IBM)
|
* Mike Pitman (IBM)
|
||||||
* Mike Rieker (Dreamnation)
|
|
||||||
* mikemig
|
* mikemig
|
||||||
* mikkopa/_someone - RealXtend
|
* mikkopa/_someone - RealXtend
|
||||||
* Misterblue
|
* Misterblue
|
||||||
|
@ -165,7 +158,6 @@ what it is today.
|
||||||
* openlifegrid.com
|
* openlifegrid.com
|
||||||
* otakup0pe
|
* otakup0pe
|
||||||
* Pixel Tomsen
|
* Pixel Tomsen
|
||||||
* Quill Littlefeather
|
|
||||||
* ralphos
|
* ralphos
|
||||||
* RemedyTomm
|
* RemedyTomm
|
||||||
* Revolution
|
* Revolution
|
||||||
|
@ -185,20 +177,14 @@ what it is today.
|
||||||
* SpotOn3D
|
* SpotOn3D
|
||||||
* Stefan_Boom / stoehr
|
* Stefan_Boom / stoehr
|
||||||
* Steven Zielinski (MOSES)
|
* Steven Zielinski (MOSES)
|
||||||
* Stolen Ruby
|
|
||||||
* Strawberry Fride
|
* Strawberry Fride
|
||||||
* Talun
|
* Talun
|
||||||
* TechplexEngineer (Blake Bourque)
|
* TechplexEngineer (Blake Bourque)
|
||||||
* TBG Renfold
|
* TBG Renfold
|
||||||
* Terry Ford
|
|
||||||
* tglion
|
* tglion
|
||||||
* tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud)
|
* tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud)
|
||||||
* TomDataWorks
|
|
||||||
* TomTheDragon (muckwaddle)
|
|
||||||
* tyre
|
* tyre
|
||||||
* uriesk
|
|
||||||
* Vegaslon <vegaslon@gmail.com>
|
* Vegaslon <vegaslon@gmail.com>
|
||||||
* Vincent Sylvester
|
|
||||||
* VikingErik
|
* VikingErik
|
||||||
* Vytek
|
* Vytek
|
||||||
* webmage (IBM)
|
* webmage (IBM)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -252,7 +252,7 @@ namespace OpenSim.Groups
|
||||||
|
|
||||||
m_debugEnabled = verbose;
|
m_debugEnabled = verbose;
|
||||||
|
|
||||||
MainConsole.Instance.Output("{0} verbose logging set to {1}", Name, m_debugEnabled);
|
MainConsole.Instance.OutputFormat("{0} verbose logging set to {1}", Name, m_debugEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -599,16 +599,13 @@ namespace OpenSim.Groups
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Sending chatterbox invite instant message");
|
if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Sending chatterbox invite instant message");
|
||||||
|
|
||||||
UUID fromAgent = new UUID(msg.fromAgentID);
|
|
||||||
// Force? open the group session dialog???
|
// Force? open the group session dialog???
|
||||||
// and simultanously deliver the message, so we don't need to do a seperate client.SendInstantMessage(msg);
|
// and simultanously deliver the message, so we don't need to do a seperate client.SendInstantMessage(msg);
|
||||||
IEventQueue eq = activeClient.Scene.RequestModuleInterface<IEventQueue>();
|
IEventQueue eq = activeClient.Scene.RequestModuleInterface<IEventQueue>();
|
||||||
if (eq != null)
|
|
||||||
{
|
|
||||||
eq.ChatterboxInvitation(
|
eq.ChatterboxInvitation(
|
||||||
GroupID
|
GroupID
|
||||||
, groupInfo.GroupName
|
, groupInfo.GroupName
|
||||||
, fromAgent
|
, new UUID(msg.fromAgentID)
|
||||||
, msg.message
|
, msg.message
|
||||||
, AgentID
|
, AgentID
|
||||||
, msg.fromAgentName
|
, msg.fromAgentName
|
||||||
|
@ -623,10 +620,14 @@ namespace OpenSim.Groups
|
||||||
, OpenMetaverse.Utils.StringToBytes(groupInfo.GroupName)
|
, OpenMetaverse.Utils.StringToBytes(groupInfo.GroupName)
|
||||||
);
|
);
|
||||||
|
|
||||||
var update = new GroupChatListAgentUpdateData(AgentID);
|
eq.ChatterBoxSessionAgentListUpdates(
|
||||||
var updates = new List<GroupChatListAgentUpdateData> { update };
|
new UUID(GroupID)
|
||||||
eq.ChatterBoxSessionAgentListUpdates(GroupID, new UUID(msg.toAgentID), updates);
|
, AgentID
|
||||||
}
|
, new UUID(msg.toAgentID)
|
||||||
|
, false //canVoiceChat
|
||||||
|
, false //isModerator
|
||||||
|
, false //text mute
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -661,12 +662,14 @@ namespace OpenSim.Groups
|
||||||
ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID);
|
ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID);
|
||||||
|
|
||||||
IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>();
|
IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>();
|
||||||
if (queue != null)
|
queue.ChatterBoxSessionAgentListUpdates(
|
||||||
{
|
GroupID
|
||||||
var update = new GroupChatListAgentUpdateData(AgentID);
|
, AgentID
|
||||||
var updates = new List<GroupChatListAgentUpdateData> { update };
|
, new UUID(im.toAgentID)
|
||||||
queue.ChatterBoxSessionAgentListUpdates(GroupID, remoteClient.AgentId, updates);
|
, false //canVoiceChat
|
||||||
}
|
, false //isModerator
|
||||||
|
, false //text mute
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -708,7 +711,11 @@ namespace OpenSim.Groups
|
||||||
bodyMap.Add("session_info", sessionMap);
|
bodyMap.Add("session_info", sessionMap);
|
||||||
|
|
||||||
IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>();
|
IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>();
|
||||||
queue?.Enqueue(queue.BuildEvent("ChatterBoxSessionStartReply", bodyMap), remoteClient.AgentId);
|
|
||||||
|
if (queue != null)
|
||||||
|
{
|
||||||
|
queue.Enqueue(queue.BuildEvent("ChatterBoxSessionStartReply", bodyMap), remoteClient.AgentId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DebugGridInstantMessage(GridInstantMessage im)
|
private void DebugGridInstantMessage(GridInstantMessage im)
|
||||||
|
|
|
@ -38,7 +38,7 @@ using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
using PermissionMask = OpenSim.Framework.PermissionMask;
|
using DirFindFlags = OpenMetaverse.DirectoryManager.DirFindFlags;
|
||||||
|
|
||||||
namespace OpenSim.Groups
|
namespace OpenSim.Groups
|
||||||
{
|
{
|
||||||
|
@ -127,7 +127,7 @@ namespace OpenSim.Groups
|
||||||
|
|
||||||
m_debugEnabled = verbose;
|
m_debugEnabled = verbose;
|
||||||
|
|
||||||
MainConsole.Instance.Output("{0} verbose logging set to {1}", Name, m_debugEnabled);
|
MainConsole.Instance.OutputFormat("{0} verbose logging set to {1}", Name, m_debugEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegionLoaded(Scene scene)
|
public void RegionLoaded(Scene scene)
|
||||||
|
@ -137,6 +137,13 @@ namespace OpenSim.Groups
|
||||||
|
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
|
scene.EventManager.OnNewClient += OnNewClient;
|
||||||
|
scene.EventManager.OnMakeRootAgent += OnMakeRoot;
|
||||||
|
scene.EventManager.OnMakeChildAgent += OnMakeChild;
|
||||||
|
scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
|
||||||
|
// The InstantMessageModule itself doesn't do this,
|
||||||
|
// so lets see if things explode if we don't do it
|
||||||
|
// scene.EventManager.OnClientClosed += OnClientClosed;
|
||||||
|
|
||||||
if (m_groupData == null)
|
if (m_groupData == null)
|
||||||
{
|
{
|
||||||
|
@ -175,11 +182,6 @@ namespace OpenSim.Groups
|
||||||
m_sceneList.Add(scene);
|
m_sceneList.Add(scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
scene.EventManager.OnNewClient += OnNewClient;
|
|
||||||
scene.EventManager.OnMakeRootAgent += OnMakeRoot;
|
|
||||||
scene.EventManager.OnMakeChildAgent += OnMakeChild;
|
|
||||||
scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
|
|
||||||
scene.EventManager.OnClientClosed += OnClientClosed;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +196,6 @@ namespace OpenSim.Groups
|
||||||
scene.EventManager.OnMakeRootAgent -= OnMakeRoot;
|
scene.EventManager.OnMakeRootAgent -= OnMakeRoot;
|
||||||
scene.EventManager.OnMakeChildAgent -= OnMakeChild;
|
scene.EventManager.OnMakeChildAgent -= OnMakeChild;
|
||||||
scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
|
scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
|
||||||
scene.EventManager.OnClientClosed -= OnClientClosed;
|
|
||||||
|
|
||||||
lock (m_sceneList)
|
lock (m_sceneList)
|
||||||
{
|
{
|
||||||
|
@ -233,10 +234,9 @@ namespace OpenSim.Groups
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest;
|
client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest;
|
||||||
//client.OnRequestAvatarProperties += OnRequestAvatarProperties;
|
client.OnRequestAvatarProperties += OnRequestAvatarProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void OnMakeRoot(ScenePresence sp)
|
private void OnMakeRoot(ScenePresence sp)
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
@ -245,12 +245,8 @@ namespace OpenSim.Groups
|
||||||
// Used for Notices and Group Invites/Accept/Reject
|
// Used for Notices and Group Invites/Accept/Reject
|
||||||
sp.ControllingClient.OnInstantMessage += OnInstantMessage;
|
sp.ControllingClient.OnInstantMessage += OnInstantMessage;
|
||||||
|
|
||||||
// Send out group data update for compatibility.
|
// Send client their groups information.
|
||||||
// There might be some problem with the thread we're generating this on but not
|
SendAgentGroupDataUpdate(sp.ControllingClient, sp.UUID);
|
||||||
// doing the update at this time causes problems (Mantis #7920 and #7915)
|
|
||||||
// TODO: move sending this update to a later time in the rootification of the client.
|
|
||||||
if(!sp.m_haveGroupInformation)
|
|
||||||
SendAgentGroupDataUpdate(sp.ControllingClient, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnMakeChild(ScenePresence sp)
|
private void OnMakeChild(ScenePresence sp)
|
||||||
|
@ -261,33 +257,28 @@ namespace OpenSim.Groups
|
||||||
// Used for Notices and Group Invites/Accept/Reject
|
// Used for Notices and Group Invites/Accept/Reject
|
||||||
sp.ControllingClient.OnInstantMessage -= OnInstantMessage;
|
sp.ControllingClient.OnInstantMessage -= OnInstantMessage;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID)
|
private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID)
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
|
//GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetRequestingAgentID(remoteClient), avatarID).ToArray();
|
||||||
GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID);
|
GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID);
|
||||||
remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups);
|
remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
private void OnClientClosed(UUID AgentId, Scene scene)
|
|
||||||
{
|
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
|
||||||
if (scene == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ScenePresence sp = scene.GetScenePresence(AgentId);
|
|
||||||
IClientAPI client = sp.ControllingClient;
|
|
||||||
if (client != null)
|
|
||||||
{
|
|
||||||
client.OnAgentDataUpdateRequest -= OnAgentDataUpdateRequest;
|
|
||||||
//client.OnRequestAvatarProperties -= OnRequestAvatarProperties;
|
|
||||||
// make child possible not called?
|
|
||||||
client.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest;
|
|
||||||
client.OnInstantMessage -= OnInstantMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
* This becomes very problematic in a shared module. In a shared module you may have more then one
|
||||||
|
* reference to IClientAPI's, one for 0 or 1 root connections, and 0 or more child connections.
|
||||||
|
* The OnClientClosed event does not provide anything to indicate which one of those should be closed
|
||||||
|
* nor does it provide what scene it was from so that the specific reference can be looked up.
|
||||||
|
* The InstantMessageModule.cs does not currently worry about unregistering the handles,
|
||||||
|
* and it should be an issue, since it's the client that references us not the other way around
|
||||||
|
* , so as long as we don't keep a reference to the client laying around, the client can still be GC'ed
|
||||||
|
private void OnClientClosed(UUID AgentId)
|
||||||
|
{
|
||||||
|
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
lock (m_ActiveClients)
|
lock (m_ActiveClients)
|
||||||
{
|
{
|
||||||
if (m_ActiveClients.ContainsKey(AgentId))
|
if (m_ActiveClients.ContainsKey(AgentId))
|
||||||
|
@ -305,22 +296,31 @@ namespace OpenSim.Groups
|
||||||
if (m_debugEnabled) m_log.WarnFormat("[Groups]: Client closed that wasn't registered here.");
|
if (m_debugEnabled) m_log.WarnFormat("[Groups]: Client closed that wasn't registered here.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID)
|
private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID)
|
||||||
{
|
{
|
||||||
// this a private message for own agent only
|
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
if (dataForAgentID != GetRequestingAgentID(remoteClient))
|
|
||||||
return;
|
|
||||||
|
|
||||||
SendAgentGroupDataUpdate(remoteClient, false);
|
UUID activeGroupID = UUID.Zero;
|
||||||
|
string activeGroupTitle = string.Empty;
|
||||||
|
string activeGroupName = string.Empty;
|
||||||
|
ulong activeGroupPowers = (ulong)GroupPowers.None;
|
||||||
|
|
||||||
// also current viewers do ignore it and ask later on a much nicer thread
|
GroupMembershipData membership = m_groupData.GetAgentActiveMembership(GetRequestingAgentIDStr(remoteClient), dataForAgentID.ToString());
|
||||||
// its a info request not a change, so nothing is sent to others
|
if (membership != null)
|
||||||
// they do get the group title with the avatar object update on arrivel to a region
|
{
|
||||||
|
activeGroupID = membership.GroupID;
|
||||||
|
activeGroupTitle = membership.GroupTitle;
|
||||||
|
activeGroupPowers = membership.GroupPowers;
|
||||||
|
}
|
||||||
|
|
||||||
|
SendAgentDataUpdate(remoteClient, dataForAgentID, activeGroupID, activeGroupName, activeGroupPowers, activeGroupTitle);
|
||||||
|
|
||||||
|
SendScenePresenceUpdate(dataForAgentID, activeGroupTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleUUIDGroupNameRequest(UUID GroupID, IClientAPI remoteClient)
|
private void HandleUUIDGroupNameRequest(UUID GroupID, IClientAPI remoteClient)
|
||||||
|
@ -344,24 +344,14 @@ namespace OpenSim.Groups
|
||||||
|
|
||||||
private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
|
private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
|
||||||
{
|
{
|
||||||
if (m_debugEnabled)
|
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
m_log.DebugFormat("[Groups]: OnInstantMessage called");
|
|
||||||
|
|
||||||
if(remoteClient == null || !remoteClient.IsActive || remoteClient.AgentId == UUID.Zero)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Scene scene = (Scene)remoteClient.Scene;
|
|
||||||
if (scene == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
string remoteAgentIDstr = remoteClient.AgentId.ToString();
|
|
||||||
|
|
||||||
//m_log.DebugFormat("[Groups]: IM From {0} to {1} msg {2} type {3}", im.fromAgentID, im.toAgentID, im.message, (InstantMessageDialog)im.dialog);
|
//m_log.DebugFormat("[Groups]: IM From {0} to {1} msg {2} type {3}", im.fromAgentID, im.toAgentID, im.message, (InstantMessageDialog)im.dialog);
|
||||||
// Group invitations
|
// Group invitations
|
||||||
if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline))
|
if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline))
|
||||||
{
|
{
|
||||||
UUID inviteID = new UUID(im.imSessionID);
|
UUID inviteID = new UUID(im.imSessionID);
|
||||||
GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(remoteAgentIDstr, inviteID);
|
GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(GetRequestingAgentIDStr(remoteClient), inviteID);
|
||||||
|
|
||||||
if (inviteInfo == null)
|
if (inviteInfo == null)
|
||||||
{
|
{
|
||||||
|
@ -384,7 +374,7 @@ namespace OpenSim.Groups
|
||||||
|
|
||||||
// and the sessionid is the role
|
// and the sessionid is the role
|
||||||
string reason = string.Empty;
|
string reason = string.Empty;
|
||||||
if (!m_groupData.AddAgentToGroup(remoteAgentIDstr, invitee.ToString(), inviteInfo.GroupID, inviteInfo.RoleID, string.Empty, out reason))
|
if (!m_groupData.AddAgentToGroup(GetRequestingAgentIDStr(remoteClient), invitee.ToString(), inviteInfo.GroupID, inviteInfo.RoleID, string.Empty, out reason))
|
||||||
remoteClient.SendAgentAlertMessage("Unable to add you to the group: " + reason, false);
|
remoteClient.SendAgentAlertMessage("Unable to add you to the group: " + reason, false);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -404,162 +394,111 @@ namespace OpenSim.Groups
|
||||||
msg.binaryBucket = new byte[0];
|
msg.binaryBucket = new byte[0];
|
||||||
|
|
||||||
OutgoingInstantMessage(msg, invitee);
|
OutgoingInstantMessage(msg, invitee);
|
||||||
IClientAPI inviteeClient = GetActiveRootClient(invitee);
|
|
||||||
if(inviteeClient !=null)
|
UpdateAllClientsWithGroupInfo(invitee);
|
||||||
{
|
|
||||||
SendAgentGroupDataUpdate(inviteeClient,true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_groupData.RemoveAgentToGroupInvite(remoteAgentIDstr, inviteID);
|
m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentIDStr(remoteClient), inviteID);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reject
|
// Reject
|
||||||
if (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)
|
if (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)
|
||||||
{
|
{
|
||||||
if (m_debugEnabled)
|
if (m_debugEnabled) m_log.DebugFormat("[Groups]: Received a reject invite notice.");
|
||||||
m_log.DebugFormat("[Groups]: Received a reject invite notice.");
|
m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentIDStr(remoteClient), inviteID);
|
||||||
|
|
||||||
m_groupData.RemoveAgentToGroupInvite(remoteAgentIDstr, inviteID);
|
m_groupData.RemoveAgentFromGroup(GetRequestingAgentIDStr(remoteClient), inviteInfo.AgentID, inviteInfo.GroupID);
|
||||||
m_groupData.RemoveAgentFromGroup(remoteAgentIDstr, inviteInfo.AgentID, inviteInfo.GroupID);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group notices
|
// Group notices
|
||||||
else if ((im.dialog == (byte)InstantMessageDialog.GroupNotice))
|
if ((im.dialog == (byte)InstantMessageDialog.GroupNotice))
|
||||||
{
|
{
|
||||||
if (!m_groupNoticesEnabled)
|
if (!m_groupNoticesEnabled)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
UUID GroupID = new UUID(im.toAgentID);
|
UUID GroupID = new UUID(im.toAgentID);
|
||||||
GroupMembershipData grpMemberData = m_groupData.GetAgentGroupMembership(remoteAgentIDstr, remoteAgentIDstr, GroupID);
|
if (m_groupData.GetGroupRecord(GetRequestingAgentIDStr(remoteClient), GroupID, null) != null)
|
||||||
if (grpMemberData == null)
|
|
||||||
{
|
{
|
||||||
remoteClient.SendAgentAlertMessage("Group membership not found", false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((grpMemberData.GroupPowers & (ulong)GroupPowers.SendNotices) == 0)
|
|
||||||
{
|
|
||||||
remoteClient.SendAgentAlertMessage("No permission to send notice to group", false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int index = im.message.IndexOf('|');
|
|
||||||
if (index < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
string Subject = im.message.Substring(0, index);
|
|
||||||
string Message = im.message.Substring(index + 1);
|
|
||||||
|
|
||||||
UUID NoticeID = UUID.Random();
|
UUID NoticeID = UUID.Random();
|
||||||
|
string Subject = im.message.Substring(0, im.message.IndexOf('|'));
|
||||||
|
string Message = im.message.Substring(Subject.Length + 1);
|
||||||
|
|
||||||
InventoryItemBase item = null;
|
InventoryItemBase item = null;
|
||||||
bool hasAttachment = false;
|
bool hasAttachment = false;
|
||||||
|
|
||||||
if (im.binaryBucket.Length >= 1 && im.binaryBucket[0] > 0)
|
if (im.binaryBucket.Length >= 1 && im.binaryBucket[0] > 0)
|
||||||
{
|
{
|
||||||
UUID itemID = UUID.Zero;
|
|
||||||
UUID ownerID = UUID.Zero;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
string binBucket = Utils.BytesToString(im.binaryBucket);
|
|
||||||
binBucket = binBucket.Substring(15); // remove extra LLSD pre header
|
|
||||||
|
|
||||||
OSDMap binBucketMAP = (OSDMap)OSDParser.DeserializeLLSDXml(binBucket);
|
|
||||||
itemID = binBucketMAP["item_id"].AsUUID();
|
|
||||||
ownerID = binBucketMAP["owner_id"].AsUUID();
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
m_log.DebugFormat("[GROUPS]: failed to decode group notice bucket");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (itemID != UUID.Zero && ownerID != UUID.Zero)
|
|
||||||
{
|
|
||||||
item = scene.InventoryService.GetItem(ownerID, itemID);
|
|
||||||
if(item != null)
|
|
||||||
{
|
|
||||||
if ((item.CurrentPermissions & (uint)(PermissionMask.Transfer | PermissionMask.Copy)) !=
|
|
||||||
(uint)(PermissionMask.Transfer | PermissionMask.Copy))
|
|
||||||
{
|
|
||||||
remoteClient.SendAgentAlertMessage("Item must be have Copy and Transfer rights to attach to group notice", false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
hasAttachment = true;
|
hasAttachment = true;
|
||||||
|
string binBucket = OpenMetaverse.Utils.BytesToString(im.binaryBucket);
|
||||||
|
binBucket = binBucket.Remove(0, 14).Trim();
|
||||||
|
|
||||||
|
OSD binBucketOSD = OSDParser.DeserializeLLSDXml(binBucket);
|
||||||
|
if (binBucketOSD is OSDMap)
|
||||||
|
{
|
||||||
|
OSDMap binBucketMap = (OSDMap)binBucketOSD;
|
||||||
|
|
||||||
|
UUID itemID = binBucketMap["item_id"].AsUUID();
|
||||||
|
UUID ownerID = binBucketMap["owner_id"].AsUUID();
|
||||||
|
item = new InventoryItemBase(itemID, ownerID);
|
||||||
|
item = m_sceneList[0].InventoryService.GetItem(item);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
m_log.DebugFormat("[Groups]: Received OSD with unexpected type: {0}", binBucketOSD.GetType());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_groupData.AddGroupNotice(remoteAgentIDstr, GroupID, NoticeID, im.fromAgentName, Subject, Message,
|
if (m_groupData.AddGroupNotice(GetRequestingAgentIDStr(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message,
|
||||||
hasAttachment,
|
hasAttachment,
|
||||||
(byte)(item == null ? 0 : item.AssetType),
|
(byte)(item == null ? 0 : item.AssetType),
|
||||||
item == null ? null : item.Name,
|
item == null ? null : item.Name,
|
||||||
item == null ? UUID.Zero : item.ID,
|
item == null ? UUID.Zero : item.ID,
|
||||||
item == null ? UUID.Zero.ToString() : item.Owner.ToString()))
|
item == null ? UUID.Zero.ToString() : item.Owner.ToString()))
|
||||||
{
|
{
|
||||||
OnNewGroupNotice?.Invoke(GroupID, NoticeID);
|
if (OnNewGroupNotice != null)
|
||||||
|
{
|
||||||
|
OnNewGroupNotice(GroupID, NoticeID);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Send notice out to everyone that wants notices
|
// Send notice out to everyone that wants notices
|
||||||
foreach (GroupMembersData member in m_groupData.GetGroupMembers(remoteAgentIDstr, GroupID))
|
foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentIDStr(remoteClient), GroupID))
|
||||||
{
|
{
|
||||||
GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)InstantMessageDialog.GroupNotice);
|
|
||||||
if (member.AcceptNotices)
|
if (member.AcceptNotices)
|
||||||
{
|
{
|
||||||
// Build notice IIM, one of reach, because the sending may be async
|
// Build notice IIM, one of reach, because the sending may be async
|
||||||
|
GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice);
|
||||||
msg.toAgentID = member.AgentID.Guid;
|
msg.toAgentID = member.AgentID.Guid;
|
||||||
OutgoingInstantMessage(msg, member.AgentID);
|
OutgoingInstantMessage(msg, member.AgentID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (im.dialog == (byte)InstantMessageDialog.GroupNoticeInventoryAccepted)
|
if (im.dialog == (byte)InstantMessageDialog.GroupNoticeInventoryAccepted)
|
||||||
{
|
{
|
||||||
if (!m_groupNoticesEnabled)
|
if (im.binaryBucket.Length < 16) // Invalid
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
//// 16 bytes are the UUID. Maybe.
|
||||||
|
// UUID folderID = new UUID(im.binaryBucket, 0);
|
||||||
UUID noticeID = new UUID(im.imSessionID);
|
UUID noticeID = new UUID(im.imSessionID);
|
||||||
|
|
||||||
if (m_debugEnabled)
|
GroupNoticeInfo notice = m_groupData.GetGroupNotice(remoteClient.AgentId.ToString(), noticeID);
|
||||||
m_log.DebugFormat("[xmlGROUPS]: Accepted notice {0} for {1}", noticeID, remoteClient.AgentId);
|
if (notice != null)
|
||||||
|
|
||||||
if (noticeID == UUID.Zero)
|
|
||||||
return;
|
|
||||||
|
|
||||||
UUID folderID = UUID.Zero;
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
if (im.binaryBucket != null && im.binaryBucket.Length >= 16)
|
|
||||||
folderID = new UUID(im.binaryBucket, 0);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
m_log.DebugFormat("[xmlGROUPS]: GroupNoticeInventoryAccepted failed to decode target folder");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GroupNoticeInfo notice = m_groupData.GetGroupNotice(remoteAgentIDstr, noticeID);
|
|
||||||
if (notice == null)
|
|
||||||
{
|
|
||||||
if (m_debugEnabled)
|
|
||||||
m_log.DebugFormat(
|
|
||||||
"[GROUPS]: Could not find notice {0} for {1} on GroupNoticeInventoryAccepted.",
|
|
||||||
noticeID, remoteClient.AgentId);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
string tmp;
|
|
||||||
UUID giver = new UUID(im.toAgentID);
|
UUID giver = new UUID(im.toAgentID);
|
||||||
|
string tmp = string.Empty;
|
||||||
Util.ParseUniversalUserIdentifier(notice.noticeData.AttachmentOwnerID, out giver, out tmp, out tmp, out tmp, out tmp);
|
Util.ParseUniversalUserIdentifier(notice.noticeData.AttachmentOwnerID, out giver, out tmp, out tmp, out tmp, out tmp);
|
||||||
|
|
||||||
m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId);
|
m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId);
|
||||||
|
string message;
|
||||||
string message = "Could not find group notice attached item";
|
InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId,
|
||||||
InventoryItemBase itemCopy = scene.GiveInventoryItem(remoteClient.AgentId,
|
giver, notice.noticeData.AttachmentItemID, out message);
|
||||||
giver, notice.noticeData.AttachmentItemID, folderID, out message);
|
|
||||||
|
|
||||||
if (itemCopy == null)
|
if (itemCopy == null)
|
||||||
{
|
{
|
||||||
|
@ -570,78 +509,14 @@ namespace OpenSim.Groups
|
||||||
remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0);
|
remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (im.dialog == (byte)InstantMessageDialog.GroupNoticeInventoryDeclined)
|
|
||||||
{
|
|
||||||
if (!m_groupNoticesEnabled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
UUID noticeID = new UUID(im.imSessionID);
|
|
||||||
|
|
||||||
if (m_debugEnabled)
|
|
||||||
m_log.DebugFormat("[GROUPS]: Accepted notice {0} for {1}", noticeID, remoteAgentIDstr);
|
|
||||||
|
|
||||||
if (noticeID == UUID.Zero)
|
|
||||||
return;
|
|
||||||
|
|
||||||
UUID remoteAgentID = remoteClient.AgentId;
|
|
||||||
|
|
||||||
GroupNoticeInfo notice = m_groupData.GetGroupNotice(remoteAgentIDstr, noticeID);
|
|
||||||
if (notice == null)
|
|
||||||
{
|
|
||||||
if (m_debugEnabled)
|
|
||||||
m_log.DebugFormat(
|
|
||||||
"[GROUPS]: Could not find notice {0} for {1} on GroupNoticeInventoryAccepted.",
|
|
||||||
noticeID, remoteClient.AgentId);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
string giver = notice.noticeData.AttachmentOwnerID;
|
|
||||||
UUID attachmentUUID = notice.noticeData.AttachmentItemID;
|
|
||||||
|
|
||||||
if (attachmentUUID == null ||
|
|
||||||
attachmentUUID == UUID.Zero ||
|
|
||||||
giver == null ||
|
|
||||||
giver == UUID.Zero.ToString()
|
|
||||||
)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (m_debugEnabled)
|
|
||||||
m_log.DebugFormat("[xmlGroups]: Deny inventory from {0} to {1}", giver, remoteAgentIDstr);
|
|
||||||
|
|
||||||
string message = String.Empty;
|
|
||||||
|
|
||||||
InventoryItemBase itemCopy = scene.InventoryService.GetItem(remoteAgentID, attachmentUUID);
|
|
||||||
if (itemCopy == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
InventoryFolderBase trash = scene.InventoryService.GetFolderForType(remoteAgentID, FolderType.Trash);
|
|
||||||
if (trash == null)
|
|
||||||
{
|
|
||||||
m_log.DebugFormat("[GROUPS]: failed to find trash folder for {0} ", remoteAgentID);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (itemCopy.Folder == trash.ID || remoteAgentIDstr == notice.noticeData.AttachmentOwnerID)
|
|
||||||
return;
|
|
||||||
|
|
||||||
itemCopy.Folder = trash.ID;
|
|
||||||
scene.InventoryService.MoveItems(itemCopy.Owner, new List<InventoryItemBase>() { itemCopy });
|
|
||||||
|
|
||||||
if (itemCopy == null)
|
|
||||||
{
|
|
||||||
remoteClient.SendAgentAlertMessage(message, false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Interop, received special 210 code for ejecting a group member
|
// Interop, received special 210 code for ejecting a group member
|
||||||
// this only works within the comms servers domain, and won't work hypergrid
|
// this only works within the comms servers domain, and won't work hypergrid
|
||||||
// TODO:FIXME: Use a presense server of some kind to find out where the
|
// TODO:FIXME: Use a presense server of some kind to find out where the
|
||||||
// client actually is, and try contacting that region directly to notify them,
|
// client actually is, and try contacting that region directly to notify them,
|
||||||
// or provide the notification via xmlrpc update queue
|
// or provide the notification via xmlrpc update queue
|
||||||
else if ((im.dialog == 210))
|
if ((im.dialog == 210))
|
||||||
{
|
{
|
||||||
// This is sent from the region that the ejectee was ejected from
|
// This is sent from the region that the ejectee was ejected from
|
||||||
// if it's being delivered here, then the ejectee is here
|
// if it's being delivered here, then the ejectee is here
|
||||||
|
@ -649,16 +524,14 @@ namespace OpenSim.Groups
|
||||||
|
|
||||||
UUID ejecteeID = new UUID(im.toAgentID);
|
UUID ejecteeID = new UUID(im.toAgentID);
|
||||||
|
|
||||||
im.imSessionID = UUID.Zero.Guid;
|
|
||||||
im.dialog = (byte)InstantMessageDialog.MessageFromAgent;
|
im.dialog = (byte)InstantMessageDialog.MessageFromAgent;
|
||||||
OutgoingInstantMessage(im, ejecteeID);
|
OutgoingInstantMessage(im, ejecteeID);
|
||||||
|
|
||||||
IClientAPI ejectee = GetActiveRootClient(ejecteeID);
|
IClientAPI ejectee = GetActiveClient(ejecteeID);
|
||||||
if (ejectee != null)
|
if (ejectee != null)
|
||||||
{
|
{
|
||||||
UUID groupID = new UUID(im.imSessionID);
|
UUID groupID = new UUID(im.imSessionID);
|
||||||
ejectee.SendAgentDropGroup(groupID);
|
ejectee.SendAgentDropGroup(groupID);
|
||||||
SendAgentGroupDataUpdate(ejectee,true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -678,7 +551,7 @@ namespace OpenSim.Groups
|
||||||
case (byte)InstantMessageDialog.GroupInvitation:
|
case (byte)InstantMessageDialog.GroupInvitation:
|
||||||
case (byte)InstantMessageDialog.GroupNotice:
|
case (byte)InstantMessageDialog.GroupNotice:
|
||||||
UUID toAgentID = new UUID(msg.toAgentID);
|
UUID toAgentID = new UUID(msg.toAgentID);
|
||||||
IClientAPI localClient = GetActiveRootClient(toAgentID);
|
IClientAPI localClient = GetActiveClient(toAgentID);
|
||||||
if (localClient != null)
|
if (localClient != null)
|
||||||
{
|
{
|
||||||
localClient.SendInstantMessage(msg);
|
localClient.SendInstantMessage(msg);
|
||||||
|
@ -714,7 +587,7 @@ namespace OpenSim.Groups
|
||||||
// anyone who is in any region that can see this client, should probably be
|
// anyone who is in any region that can see this client, should probably be
|
||||||
// updated with new group info. At a minimum, they should get ScenePresence
|
// updated with new group info. At a minimum, they should get ScenePresence
|
||||||
// updated with new title.
|
// updated with new title.
|
||||||
SendAgentGroupDataUpdate(remoteClient, true);
|
UpdateAllClientsWithGroupInfo(remoteClient.AgentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -761,6 +634,7 @@ namespace OpenSim.Groups
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID)
|
public List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID)
|
||||||
|
@ -840,12 +714,6 @@ namespace OpenSim.Groups
|
||||||
return m_groupData.GetAgentGroupMembership(UUID.Zero.ToString(), agentID.ToString(), groupID);
|
return m_groupData.GetAgentGroupMembership(UUID.Zero.ToString(), agentID.ToString(), groupID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GroupMembershipData GetActiveMembershipData(UUID agentID)
|
|
||||||
{
|
|
||||||
string agentIDstr = agentID.ToString();
|
|
||||||
return m_groupData.GetAgentActiveMembership(agentIDstr, agentIDstr);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish)
|
public void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish)
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
@ -882,7 +750,7 @@ namespace OpenSim.Groups
|
||||||
|
|
||||||
if (avatar != null)
|
if (avatar != null)
|
||||||
{
|
{
|
||||||
if (avatar.GodController.UserLevel < m_levelGroupCreate)
|
if (avatar.UserLevel < m_levelGroupCreate)
|
||||||
{
|
{
|
||||||
remoteClient.SendCreateGroupReply(UUID.Zero, false, String.Format("Insufficient permissions to create a group. Requires level {0}", m_levelGroupCreate));
|
remoteClient.SendCreateGroupReply(UUID.Zero, false, String.Format("Insufficient permissions to create a group. Requires level {0}", m_levelGroupCreate));
|
||||||
return UUID.Zero;
|
return UUID.Zero;
|
||||||
|
@ -890,7 +758,7 @@ namespace OpenSim.Groups
|
||||||
}
|
}
|
||||||
|
|
||||||
// check funds
|
// check funds
|
||||||
// is there a money module present ?
|
// is there is a money module present ?
|
||||||
IMoneyModule money = scene.RequestModuleInterface<IMoneyModule>();
|
IMoneyModule money = scene.RequestModuleInterface<IMoneyModule>();
|
||||||
if (money != null)
|
if (money != null)
|
||||||
{
|
{
|
||||||
|
@ -907,13 +775,13 @@ namespace OpenSim.Groups
|
||||||
|
|
||||||
if (groupID != UUID.Zero)
|
if (groupID != UUID.Zero)
|
||||||
{
|
{
|
||||||
if (money != null && money.GroupCreationCharge > 0)
|
if (money != null)
|
||||||
money.ApplyCharge(remoteClient.AgentId, money.GroupCreationCharge, MoneyTransactionType.GroupCreate, name);
|
money.ApplyCharge(remoteClient.AgentId, money.GroupCreationCharge, MoneyTransactionType.GroupCreate);
|
||||||
|
|
||||||
remoteClient.SendCreateGroupReply(groupID, true, "Group created successfully");
|
remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly");
|
||||||
|
|
||||||
// Update the founder with new group information.
|
// Update the founder with new group information.
|
||||||
SendAgentGroupDataUpdate(remoteClient, true);
|
SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
remoteClient.SendCreateGroupReply(groupID, false, reason);
|
remoteClient.SendCreateGroupReply(groupID, false, reason);
|
||||||
|
@ -966,7 +834,7 @@ namespace OpenSim.Groups
|
||||||
// the client currently has set active, then we need to do a scene presence update too
|
// the client currently has set active, then we need to do a scene presence update too
|
||||||
// if (m_groupData.GetAgentActiveMembership(GetRequestingAgentID(remoteClient)).GroupID == GroupID)
|
// if (m_groupData.GetAgentActiveMembership(GetRequestingAgentID(remoteClient)).GroupID == GroupID)
|
||||||
|
|
||||||
SendDataUpdate(remoteClient, true);
|
UpdateAllClientsWithGroupInfo(GetRequestingAgentID(remoteClient));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1007,7 +875,7 @@ namespace OpenSim.Groups
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This update really should send out updates for everyone in the role that just got changed.
|
// TODO: This update really should send out updates for everyone in the role that just got changed.
|
||||||
SendDataUpdate(remoteClient, true);
|
SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GroupRoleChanges(IClientAPI remoteClient, UUID groupID, UUID roleID, UUID memberID, uint changes)
|
public void GroupRoleChanges(IClientAPI remoteClient, UUID groupID, UUID roleID, UUID memberID, uint changes)
|
||||||
|
@ -1033,7 +901,7 @@ namespace OpenSim.Groups
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This update really should send out updates for everyone in the role that just got changed.
|
// TODO: This update really should send out updates for everyone in the role that just got changed.
|
||||||
SendDataUpdate(remoteClient, true);
|
SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GroupNoticeRequest(IClientAPI remoteClient, UUID groupNoticeID)
|
public void GroupNoticeRequest(IClientAPI remoteClient, UUID groupNoticeID)
|
||||||
|
@ -1075,7 +943,6 @@ namespace OpenSim.Groups
|
||||||
bucket = new byte[19 + name.Length];
|
bucket = new byte[19 + name.Length];
|
||||||
bucket[0] = 1; // has attachment?
|
bucket[0] = 1; // has attachment?
|
||||||
bucket[1] = info.noticeData.AttachmentType; // attachment type
|
bucket[1] = info.noticeData.AttachmentType; // attachment type
|
||||||
info.GroupID.ToBytes(bucket, 2);
|
|
||||||
name.CopyTo(bucket, 18);
|
name.CopyTo(bucket, 18);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1086,6 +953,7 @@ namespace OpenSim.Groups
|
||||||
bucket[18] = 0; // null terminated
|
bucket[18] = 0; // null terminated
|
||||||
}
|
}
|
||||||
|
|
||||||
|
info.GroupID.ToBytes(bucket, 2);
|
||||||
msg.binaryBucket = bucket;
|
msg.binaryBucket = bucket;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1101,37 +969,27 @@ namespace OpenSim.Groups
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendAgentGroupDataUpdate(IClientAPI remoteClient)
|
||||||
|
{
|
||||||
|
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
|
// Send agent information about his groups
|
||||||
|
SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient));
|
||||||
|
}
|
||||||
|
|
||||||
public void JoinGroupRequest(IClientAPI remoteClient, UUID groupID)
|
public void JoinGroupRequest(IClientAPI remoteClient, UUID groupID)
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
GroupRecord groupRecord = GetGroupRecord(groupID);
|
|
||||||
IMoneyModule money = remoteClient.Scene.RequestModuleInterface<IMoneyModule>();
|
|
||||||
|
|
||||||
// Should check to see if there's an outstanding invitation
|
|
||||||
|
|
||||||
if (money != null && groupRecord.MembershipFee > 0)
|
|
||||||
{
|
|
||||||
// Does the agent have the funds to cover the group join fee?
|
|
||||||
if (!money.AmountCovered(remoteClient.AgentId, groupRecord.MembershipFee))
|
|
||||||
{
|
|
||||||
remoteClient.SendAlertMessage("Insufficient funds to join the group.");
|
|
||||||
remoteClient.SendJoinGroupReply(groupID, false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
string reason = string.Empty;
|
string reason = string.Empty;
|
||||||
|
// Should check to see if OpenEnrollment, or if there's an outstanding invitation
|
||||||
if (m_groupData.AddAgentToGroup(GetRequestingAgentIDStr(remoteClient), GetRequestingAgentIDStr(remoteClient), groupID, UUID.Zero, string.Empty, out reason))
|
if (m_groupData.AddAgentToGroup(GetRequestingAgentIDStr(remoteClient), GetRequestingAgentIDStr(remoteClient), groupID, UUID.Zero, string.Empty, out reason))
|
||||||
{
|
{
|
||||||
if (money != null && groupRecord.MembershipFee > 0)
|
|
||||||
money.ApplyCharge(remoteClient.AgentId, groupRecord.MembershipFee, MoneyTransactionType.GroupJoin, groupRecord.GroupName);
|
|
||||||
|
|
||||||
remoteClient.SendJoinGroupReply(groupID, true);
|
remoteClient.SendJoinGroupReply(groupID, true);
|
||||||
|
|
||||||
// Should this send updates to everyone in the group?
|
// Should this send updates to everyone in the group?
|
||||||
SendAgentGroupDataUpdate(remoteClient, true);
|
SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient));
|
||||||
|
|
||||||
if (reason != string.Empty)
|
if (reason != string.Empty)
|
||||||
// A warning
|
// A warning
|
||||||
|
@ -1153,7 +1011,7 @@ namespace OpenSim.Groups
|
||||||
|
|
||||||
// SL sends out notifcations to the group messaging session that the person has left
|
// SL sends out notifcations to the group messaging session that the person has left
|
||||||
// Should this also update everyone who is in the group?
|
// Should this also update everyone who is in the group?
|
||||||
SendAgentGroupDataUpdate(remoteClient, true);
|
SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EjectGroupMemberRequest(IClientAPI remoteClient, UUID groupID, UUID ejecteeID)
|
public void EjectGroupMemberRequest(IClientAPI remoteClient, UUID groupID, UUID ejecteeID)
|
||||||
|
@ -1212,31 +1070,10 @@ namespace OpenSim.Groups
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IClientAPI ejecteeClient = GetActiveRootClient(ejecteeID);
|
|
||||||
|
|
||||||
// Send Message to Ejectee
|
// Send Message to Ejectee
|
||||||
GridInstantMessage msg = new GridInstantMessage();
|
GridInstantMessage msg = new GridInstantMessage();
|
||||||
|
|
||||||
// if local send a normal message
|
|
||||||
if(ejecteeClient != null)
|
|
||||||
{
|
|
||||||
msg.imSessionID = UUID.Zero.Guid;
|
msg.imSessionID = UUID.Zero.Guid;
|
||||||
msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageFromAgent;
|
|
||||||
// also execute and send update
|
|
||||||
ejecteeClient.SendAgentDropGroup(groupID);
|
|
||||||
SendAgentGroupDataUpdate(ejecteeClient,true);
|
|
||||||
}
|
|
||||||
else // send
|
|
||||||
{
|
|
||||||
// Interop, received special 210 code for ejecting a group member
|
|
||||||
// this only works within the comms servers domain, and won't work hypergrid
|
|
||||||
// TODO:FIXME: Use a presence server of some kind to find out where the
|
|
||||||
// client actually is, and try contacting that region directly to notify them,
|
|
||||||
// or provide the notification via xmlrpc update queue
|
|
||||||
|
|
||||||
msg.imSessionID = groupInfo.GroupID.Guid;
|
|
||||||
msg.dialog = (byte)210; //interop
|
|
||||||
}
|
|
||||||
msg.fromAgentID = agentID.Guid;
|
msg.fromAgentID = agentID.Guid;
|
||||||
// msg.fromAgentID = info.GroupID;
|
// msg.fromAgentID = info.GroupID;
|
||||||
msg.toAgentID = ejecteeID.Guid;
|
msg.toAgentID = ejecteeID.Guid;
|
||||||
|
@ -1244,7 +1081,7 @@ namespace OpenSim.Groups
|
||||||
msg.timestamp = 0;
|
msg.timestamp = 0;
|
||||||
msg.fromAgentName = agentName;
|
msg.fromAgentName = agentName;
|
||||||
msg.message = string.Format("You have been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName);
|
msg.message = string.Format("You have been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName);
|
||||||
|
msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageFromAgent;
|
||||||
msg.fromGroup = false;
|
msg.fromGroup = false;
|
||||||
msg.offline = (byte)0;
|
msg.offline = (byte)0;
|
||||||
msg.ParentEstateID = 0;
|
msg.ParentEstateID = 0;
|
||||||
|
@ -1254,7 +1091,11 @@ namespace OpenSim.Groups
|
||||||
OutgoingInstantMessage(msg, ejecteeID);
|
OutgoingInstantMessage(msg, ejecteeID);
|
||||||
|
|
||||||
// Message to ejector
|
// Message to ejector
|
||||||
|
// Interop, received special 210 code for ejecting a group member
|
||||||
|
// this only works within the comms servers domain, and won't work hypergrid
|
||||||
|
// TODO:FIXME: Use a presense server of some kind to find out where the
|
||||||
|
// client actually is, and try contacting that region directly to notify them,
|
||||||
|
// or provide the notification via xmlrpc update queue
|
||||||
|
|
||||||
msg = new GridInstantMessage();
|
msg = new GridInstantMessage();
|
||||||
msg.imSessionID = UUID.Zero.Guid;
|
msg.imSessionID = UUID.Zero.Guid;
|
||||||
|
@ -1270,7 +1111,7 @@ namespace OpenSim.Groups
|
||||||
{
|
{
|
||||||
msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName, "Unknown member");
|
msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName, "Unknown member");
|
||||||
}
|
}
|
||||||
msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageFromAgent;
|
msg.dialog = (byte)210; //interop
|
||||||
msg.fromGroup = false;
|
msg.fromGroup = false;
|
||||||
msg.offline = (byte)0;
|
msg.offline = (byte)0;
|
||||||
msg.ParentEstateID = 0;
|
msg.ParentEstateID = 0;
|
||||||
|
@ -1278,6 +1119,11 @@ namespace OpenSim.Groups
|
||||||
msg.RegionID = regionInfo.RegionID.Guid;
|
msg.RegionID = regionInfo.RegionID.Guid;
|
||||||
msg.binaryBucket = new byte[0];
|
msg.binaryBucket = new byte[0];
|
||||||
OutgoingInstantMessage(msg, agentID);
|
OutgoingInstantMessage(msg, agentID);
|
||||||
|
|
||||||
|
|
||||||
|
// SL sends out messages to everyone in the group
|
||||||
|
// Who all should receive updates and what should they be updated with?
|
||||||
|
UpdateAllClientsWithGroupInfo(ejecteeID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID)
|
public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID)
|
||||||
|
@ -1334,24 +1180,12 @@ namespace OpenSim.Groups
|
||||||
|
|
||||||
public List<DirGroupsReplyData> FindGroups(IClientAPI remoteClient, string query)
|
public List<DirGroupsReplyData> FindGroups(IClientAPI remoteClient, string query)
|
||||||
{
|
{
|
||||||
return m_groupData.FindGroups(remoteClient.AgentId.ToString(), query);
|
return m_groupData.FindGroups(GetRequestingAgentIDStr(remoteClient), query);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Client/Update Tools
|
#region Client/Update Tools
|
||||||
private IClientAPI GetActiveRootClient(UUID agentID)
|
|
||||||
{
|
|
||||||
foreach (Scene scene in m_sceneList)
|
|
||||||
{
|
|
||||||
ScenePresence sp = scene.GetScenePresence(agentID);
|
|
||||||
if (sp != null && !sp.IsChildAgent && !sp.IsDeleted)
|
|
||||||
{
|
|
||||||
return sp.ControllingClient;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Try to find an active IClientAPI reference for agentID giving preference to root connections
|
/// Try to find an active IClientAPI reference for agentID giving preference to root connections
|
||||||
|
@ -1364,7 +1198,7 @@ namespace OpenSim.Groups
|
||||||
foreach (Scene scene in m_sceneList)
|
foreach (Scene scene in m_sceneList)
|
||||||
{
|
{
|
||||||
ScenePresence sp = scene.GetScenePresence(agentID);
|
ScenePresence sp = scene.GetScenePresence(agentID);
|
||||||
if (sp != null&& !sp.IsDeleted)
|
if (sp != null)
|
||||||
{
|
{
|
||||||
if (!sp.IsChildAgent)
|
if (!sp.IsChildAgent)
|
||||||
{
|
{
|
||||||
|
@ -1381,6 +1215,71 @@ namespace OpenSim.Groups
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Send 'remoteClient' the group membership 'data' for agent 'dataForAgentID'.
|
||||||
|
/// </summary>
|
||||||
|
private void SendGroupMembershipInfoViaCaps(IClientAPI remoteClient, UUID dataForAgentID, GroupMembershipData[] data)
|
||||||
|
{
|
||||||
|
if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
|
// NPCs currently don't have a CAPs structure or event queues. There is a strong argument for conveying this information
|
||||||
|
// to them anyway since it makes writing server-side bots a lot easier, but for now we don't do anything.
|
||||||
|
if (remoteClient.SceneAgent.PresenceType == PresenceType.Npc)
|
||||||
|
return;
|
||||||
|
|
||||||
|
OSDArray AgentData = new OSDArray(1);
|
||||||
|
OSDMap AgentDataMap = new OSDMap(1);
|
||||||
|
AgentDataMap.Add("AgentID", OSD.FromUUID(dataForAgentID));
|
||||||
|
AgentData.Add(AgentDataMap);
|
||||||
|
|
||||||
|
OSDArray GroupData = new OSDArray(data.Length);
|
||||||
|
OSDArray NewGroupData = new OSDArray(data.Length);
|
||||||
|
|
||||||
|
foreach (GroupMembershipData membership in data)
|
||||||
|
{
|
||||||
|
if (GetRequestingAgentID(remoteClient) != dataForAgentID)
|
||||||
|
{
|
||||||
|
if (!membership.ListInProfile)
|
||||||
|
{
|
||||||
|
// If we're sending group info to remoteclient about another agent,
|
||||||
|
// filter out groups the other agent doesn't want to share.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
OSDMap GroupDataMap = new OSDMap(6);
|
||||||
|
OSDMap NewGroupDataMap = new OSDMap(1);
|
||||||
|
|
||||||
|
GroupDataMap.Add("GroupID", OSD.FromUUID(membership.GroupID));
|
||||||
|
GroupDataMap.Add("GroupPowers", OSD.FromULong(membership.GroupPowers));
|
||||||
|
GroupDataMap.Add("AcceptNotices", OSD.FromBoolean(membership.AcceptNotices));
|
||||||
|
GroupDataMap.Add("GroupInsigniaID", OSD.FromUUID(membership.GroupPicture));
|
||||||
|
GroupDataMap.Add("Contribution", OSD.FromInteger(membership.Contribution));
|
||||||
|
GroupDataMap.Add("GroupName", OSD.FromString(membership.GroupName));
|
||||||
|
NewGroupDataMap.Add("ListInProfile", OSD.FromBoolean(membership.ListInProfile));
|
||||||
|
|
||||||
|
GroupData.Add(GroupDataMap);
|
||||||
|
NewGroupData.Add(NewGroupDataMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
OSDMap llDataStruct = new OSDMap(3);
|
||||||
|
llDataStruct.Add("AgentData", AgentData);
|
||||||
|
llDataStruct.Add("GroupData", GroupData);
|
||||||
|
llDataStruct.Add("NewGroupData", NewGroupData);
|
||||||
|
|
||||||
|
if (m_debugEnabled)
|
||||||
|
{
|
||||||
|
m_log.InfoFormat("[Groups]: {0}", OSDParser.SerializeJsonString(llDataStruct));
|
||||||
|
}
|
||||||
|
|
||||||
|
IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>();
|
||||||
|
|
||||||
|
if (queue != null)
|
||||||
|
{
|
||||||
|
queue.Enqueue(queue.BuildEvent("AgentGroupDataUpdate", llDataStruct), GetRequestingAgentID(remoteClient));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void SendScenePresenceUpdate(UUID AgentID, string Title)
|
private void SendScenePresenceUpdate(UUID AgentID, string Title)
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[Groups]: Updating scene title for {0} with title: {1}", AgentID, Title);
|
if (m_debugEnabled) m_log.DebugFormat("[Groups]: Updating scene title for {0} with title: {1}", AgentID, Title);
|
||||||
|
@ -1397,39 +1296,53 @@ namespace OpenSim.Groups
|
||||||
presence.Grouptitle = Title;
|
presence.Grouptitle = Title;
|
||||||
|
|
||||||
if (! presence.IsChildAgent)
|
if (! presence.IsChildAgent)
|
||||||
presence.SendAvatarDataToAllAgents();
|
presence.SendAvatarDataToAllClients();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendAgentGroupDataUpdate(IClientAPI remoteClient)
|
|
||||||
{
|
|
||||||
SendAgentGroupDataUpdate(remoteClient, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tell remoteClient about its agent groups, and optionally send title to others
|
/// Send updates to all clients who might be interested in groups data for dataForClientID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void SendAgentGroupDataUpdate(IClientAPI remoteClient, bool tellOthers)
|
private void UpdateAllClientsWithGroupInfo(UUID dataForClientID)
|
||||||
|
{
|
||||||
|
if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
|
// TODO: Probably isn't nessesary to update every client in every scene.
|
||||||
|
// Need to examine client updates and do only what's nessesary.
|
||||||
|
lock (m_sceneList)
|
||||||
|
{
|
||||||
|
foreach (Scene scene in m_sceneList)
|
||||||
|
{
|
||||||
|
scene.ForEachClient(delegate(IClientAPI client) { SendAgentGroupDataUpdate(client, dataForClientID); });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update remoteClient with group information about dataForAgentID
|
||||||
|
/// </summary>
|
||||||
|
private void SendAgentGroupDataUpdate(IClientAPI remoteClient, UUID dataForAgentID)
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called for {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name);
|
if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called for {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name);
|
||||||
|
|
||||||
// NPCs currently don't have a CAPs structure or event queues. There is a strong argument for conveying this information
|
|
||||||
// to them anyway since it makes writing server-side bots a lot easier, but for now we don't do anything.
|
|
||||||
if (remoteClient.SceneAgent.PresenceType == PresenceType.Npc)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// TODO: All the client update functions need to be reexamined because most do too much and send too much stuff
|
// TODO: All the client update functions need to be reexamined because most do too much and send too much stuff
|
||||||
|
|
||||||
UUID agentID = GetRequestingAgentID(remoteClient);
|
OnAgentDataUpdateRequest(remoteClient, dataForAgentID, UUID.Zero);
|
||||||
|
|
||||||
SendDataUpdate(remoteClient, tellOthers);
|
// Need to send a group membership update to the client
|
||||||
|
// UDP version doesn't seem to behave nicely. But we're going to send it out here
|
||||||
|
// with an empty group membership to hopefully remove groups being displayed due
|
||||||
|
// to the core Groups Stub
|
||||||
|
//remoteClient.SendGroupMembership(new GroupMembershipData[0]);
|
||||||
|
|
||||||
GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, agentID);
|
GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, dataForAgentID);
|
||||||
|
SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray);
|
||||||
|
|
||||||
remoteClient.UpdateGroupMembership(membershipArray);
|
//remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray);
|
||||||
remoteClient.SendAgentGroupDataUpdate(agentID, membershipArray);
|
if (remoteClient.AgentId == dataForAgentID)
|
||||||
|
remoteClient.RefreshGroupMembership();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1481,49 +1394,27 @@ namespace OpenSim.Groups
|
||||||
return membershipArray;
|
return membershipArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
//tell remoteClient about its agent group info, and optionally send title to others
|
|
||||||
private void SendDataUpdate(IClientAPI remoteClient, bool tellOthers)
|
|
||||||
{
|
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
|
||||||
|
|
||||||
UUID activeGroupID = UUID.Zero;
|
private void SendAgentDataUpdate(IClientAPI remoteClient, UUID dataForAgentID, UUID activeGroupID, string activeGroupName, ulong activeGroupPowers, string activeGroupTitle)
|
||||||
string activeGroupTitle = string.Empty;
|
|
||||||
string activeGroupName = string.Empty;
|
|
||||||
ulong activeGroupPowers = (ulong)GroupPowers.None;
|
|
||||||
|
|
||||||
UUID agentID = GetRequestingAgentID(remoteClient);
|
|
||||||
GroupMembershipData membership = m_groupData.GetAgentActiveMembership(agentID.ToString(), agentID.ToString());
|
|
||||||
if (membership != null)
|
|
||||||
{
|
{
|
||||||
activeGroupID = membership.GroupID;
|
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
activeGroupTitle = membership.GroupTitle;
|
|
||||||
activeGroupPowers = membership.GroupPowers;
|
// TODO: All the client update functions need to be reexamined because most do too much and send too much stuff
|
||||||
activeGroupName = membership.GroupName;
|
string firstname = "Unknown", lastname = "Unknown";
|
||||||
|
string name = m_UserManagement.GetUserName(dataForAgentID);
|
||||||
|
if (!string.IsNullOrEmpty(name))
|
||||||
|
{
|
||||||
|
string[] parts = name.Split(new char[] { ' ' });
|
||||||
|
if (parts.Length >= 2)
|
||||||
|
{
|
||||||
|
firstname = parts[0];
|
||||||
|
lastname = parts[1];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(remoteClient.Scene.RegionInfo.ScopeID, agentID);
|
remoteClient.SendAgentDataUpdate(dataForAgentID, activeGroupID, firstname,
|
||||||
string firstname, lastname;
|
|
||||||
if (account != null)
|
|
||||||
{
|
|
||||||
firstname = account.FirstName;
|
|
||||||
lastname = account.LastName;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
firstname = "Unknown";
|
|
||||||
lastname = "Unknown";
|
|
||||||
}
|
|
||||||
|
|
||||||
remoteClient.SendAgentDataUpdate(agentID, activeGroupID, firstname,
|
|
||||||
lastname, activeGroupPowers, activeGroupName,
|
lastname, activeGroupPowers, activeGroupName,
|
||||||
activeGroupTitle);
|
activeGroupTitle);
|
||||||
|
|
||||||
if (tellOthers)
|
|
||||||
SendScenePresenceUpdate(agentID, activeGroupTitle);
|
|
||||||
|
|
||||||
ScenePresence sp = (ScenePresence)remoteClient.SceneAgent;
|
|
||||||
if (sp != null)
|
|
||||||
sp.Grouptitle = activeGroupTitle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -1534,7 +1425,7 @@ namespace OpenSim.Groups
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
IClientAPI localClient = GetActiveRootClient(msgTo);
|
IClientAPI localClient = GetActiveClient(msgTo);
|
||||||
if (localClient != null)
|
if (localClient != null)
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.InfoFormat("[Groups]: MsgTo ({0}) is local, delivering directly", localClient.Name);
|
if (m_debugEnabled) m_log.InfoFormat("[Groups]: MsgTo ({0}) is local, delivering directly", localClient.Name);
|
||||||
|
@ -1572,4 +1463,5 @@ namespace OpenSim.Groups
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -246,9 +246,9 @@ namespace OpenSim.Groups
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DirGroupsReplyData> FindGroups(string RequestingAgentIDstr, string search)
|
public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search)
|
||||||
{
|
{
|
||||||
return m_LocalGroupsConnector.FindGroups(RequestingAgentIDstr, search);
|
return m_LocalGroupsConnector.FindGroups(AgentUUI(RequestingAgentID), search);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<GroupMembersData> GetGroupMembers(string RequestingAgentID, UUID GroupID)
|
public List<GroupMembersData> GetGroupMembers(string RequestingAgentID, UUID GroupID)
|
||||||
|
@ -605,8 +605,14 @@ namespace OpenSim.Groups
|
||||||
private string AgentUUI(string AgentIDStr)
|
private string AgentUUI(string AgentIDStr)
|
||||||
{
|
{
|
||||||
UUID AgentID = UUID.Zero;
|
UUID AgentID = UUID.Zero;
|
||||||
if (!UUID.TryParse(AgentIDStr, out AgentID) || AgentID == UUID.Zero)
|
try
|
||||||
return UUID.Zero.ToString();
|
{
|
||||||
|
AgentID = new UUID(AgentIDStr);
|
||||||
|
}
|
||||||
|
catch (FormatException)
|
||||||
|
{
|
||||||
|
return AgentID.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
if (m_UserManagement.IsLocalGridUser(AgentID))
|
if (m_UserManagement.IsLocalGridUser(AgentID))
|
||||||
return AgentID.ToString();
|
return AgentID.ToString();
|
||||||
|
@ -630,8 +636,14 @@ namespace OpenSim.Groups
|
||||||
private string AgentUUIForOutside(string AgentIDStr)
|
private string AgentUUIForOutside(string AgentIDStr)
|
||||||
{
|
{
|
||||||
UUID AgentID = UUID.Zero;
|
UUID AgentID = UUID.Zero;
|
||||||
if (!UUID.TryParse(AgentIDStr, out AgentID) || AgentID == UUID.Zero)
|
try
|
||||||
return UUID.Zero.ToString();
|
{
|
||||||
|
AgentID = new UUID(AgentIDStr);
|
||||||
|
}
|
||||||
|
catch (FormatException)
|
||||||
|
{
|
||||||
|
return AgentID.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
AgentCircuitData agent = null;
|
AgentCircuitData agent = null;
|
||||||
foreach (Scene scene in m_Scenes)
|
foreach (Scene scene in m_Scenes)
|
||||||
|
|
|
@ -115,10 +115,9 @@ namespace OpenSim.Groups
|
||||||
protected override byte[] ProcessRequest(string path, Stream requestData,
|
protected override byte[] ProcessRequest(string path, Stream requestData,
|
||||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||||
{
|
{
|
||||||
string body;
|
StreamReader sr = new StreamReader(requestData);
|
||||||
using(StreamReader sr = new StreamReader(requestData))
|
string body = sr.ReadToEnd();
|
||||||
body = sr.ReadToEnd();
|
sr.Close();
|
||||||
|
|
||||||
body = body.Trim();
|
body = body.Trim();
|
||||||
|
|
||||||
//m_log.DebugFormat("[XXX]: query String: {0}", body);
|
//m_log.DebugFormat("[XXX]: query String: {0}", body);
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace OpenSim.Groups
|
||||||
bool UpdateGroup(string RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee,
|
bool UpdateGroup(string RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee,
|
||||||
bool openEnrollment, bool allowPublish, bool maturePublish, out string reason);
|
bool openEnrollment, bool allowPublish, bool maturePublish, out string reason);
|
||||||
ExtendedGroupRecord GetGroupRecord(string RequestingAgentID, UUID GroupID, string GroupName);
|
ExtendedGroupRecord GetGroupRecord(string RequestingAgentID, UUID GroupID, string GroupName);
|
||||||
List<DirGroupsReplyData> FindGroups(string RequestingAgentIDstr, string search);
|
List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search);
|
||||||
List<GroupMembersData> GetGroupMembers(string RequestingAgentID, UUID GroupID);
|
List<GroupMembersData> GetGroupMembers(string RequestingAgentID, UUID GroupID);
|
||||||
|
|
||||||
bool AddGroupRole(string RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, out string reason);
|
bool AddGroupRole(string RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, out string reason);
|
||||||
|
|
|
@ -173,9 +173,9 @@ namespace OpenSim.Groups
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DirGroupsReplyData> FindGroups(string RequestingAgentIDstr, string search)
|
public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search)
|
||||||
{
|
{
|
||||||
return m_GroupsService.FindGroups(RequestingAgentIDstr, search);
|
return m_GroupsService.FindGroups(RequestingAgentID, search);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<GroupMembersData> GetGroupMembers(string RequestingAgentID, UUID GroupID)
|
public List<GroupMembersData> GetGroupMembers(string RequestingAgentID, UUID GroupID)
|
||||||
|
|
|
@ -30,7 +30,7 @@ using Mono.Addins;
|
||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
[assembly: AssemblyVersion(OpenSim.VersionInfo.AssemblyVersionNumber)]
|
[assembly: AssemblyVersion("0.8.3.*")]
|
||||||
|
|
||||||
[assembly: Addin("OpenSim.Groups", OpenSim.VersionInfo.VersionNumber)]
|
[assembly: Addin("OpenSim.Groups", OpenSim.VersionInfo.VersionNumber)]
|
||||||
[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
|
[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
|
||||||
|
|
|
@ -153,7 +153,7 @@ namespace OpenSim.Groups
|
||||||
return GroupsDataUtils.GroupRecord((Dictionary<string, object>)ret["RESULT"]);
|
return GroupsDataUtils.GroupRecord((Dictionary<string, object>)ret["RESULT"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DirGroupsReplyData> FindGroups(string RequestingAgentIDstr, string query)
|
public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string query)
|
||||||
{
|
{
|
||||||
List<DirGroupsReplyData> hits = new List<DirGroupsReplyData>();
|
List<DirGroupsReplyData> hits = new List<DirGroupsReplyData>();
|
||||||
if (string.IsNullOrEmpty(query))
|
if (string.IsNullOrEmpty(query))
|
||||||
|
@ -161,7 +161,7 @@ namespace OpenSim.Groups
|
||||||
|
|
||||||
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
||||||
sendData["Query"] = query;
|
sendData["Query"] = query;
|
||||||
sendData["RequestingAgentID"] = RequestingAgentIDstr;
|
sendData["RequestingAgentID"] = RequestingAgentID;
|
||||||
|
|
||||||
Dictionary<string, object> ret = MakeRequest("FINDGROUPS", sendData);
|
Dictionary<string, object> ret = MakeRequest("FINDGROUPS", sendData);
|
||||||
|
|
||||||
|
|
|
@ -192,10 +192,10 @@ namespace OpenSim.Groups
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DirGroupsReplyData> FindGroups(string RequestingAgentIDstr, string search)
|
public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search)
|
||||||
{
|
{
|
||||||
// TODO!
|
// TODO!
|
||||||
return m_GroupsService.FindGroups(RequestingAgentIDstr, search);
|
return m_GroupsService.FindGroups(RequestingAgentID, search);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID, string token, out string reason)
|
public bool AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID, string token, out string reason)
|
||||||
|
|
|
@ -91,10 +91,9 @@ namespace OpenSim.Groups
|
||||||
protected override byte[] ProcessRequest(string path, Stream requestData,
|
protected override byte[] ProcessRequest(string path, Stream requestData,
|
||||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||||
{
|
{
|
||||||
string body;
|
StreamReader sr = new StreamReader(requestData);
|
||||||
using(StreamReader sr = new StreamReader(requestData))
|
string body = sr.ReadToEnd();
|
||||||
body = sr.ReadToEnd();
|
sr.Close();
|
||||||
|
|
||||||
body = body.Trim();
|
body = body.Trim();
|
||||||
|
|
||||||
//m_log.DebugFormat("[XXX]: query String: {0}", body);
|
//m_log.DebugFormat("[XXX]: query String: {0}", body);
|
||||||
|
@ -287,7 +286,7 @@ namespace OpenSim.Groups
|
||||||
string requestingAgentID = request["RequestingAgentID"].ToString();
|
string requestingAgentID = request["RequestingAgentID"].ToString();
|
||||||
|
|
||||||
if (!m_GroupsService.RemoveAgentFromGroup(requestingAgentID, agentID, groupID))
|
if (!m_GroupsService.RemoveAgentFromGroup(requestingAgentID, agentID, groupID))
|
||||||
NullResult(result, string.Format("Insufficient permissions. {0}", agentID));
|
NullResult(result, string.Format("Insufficient permissions.", agentID));
|
||||||
else
|
else
|
||||||
result["RESULT"] = "true";
|
result["RESULT"] = "true";
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,8 +43,7 @@ namespace OpenSim.Groups
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
public const GroupPowers DefaultEveryonePowers =
|
public const GroupPowers DefaultEveryonePowers = GroupPowers.AllowSetHome |
|
||||||
GroupPowers.AllowSetHome |
|
|
||||||
GroupPowers.Accountable |
|
GroupPowers.Accountable |
|
||||||
GroupPowers.JoinChat |
|
GroupPowers.JoinChat |
|
||||||
GroupPowers.AllowVoiceChat |
|
GroupPowers.AllowVoiceChat |
|
||||||
|
@ -52,23 +51,31 @@ namespace OpenSim.Groups
|
||||||
GroupPowers.StartProposal |
|
GroupPowers.StartProposal |
|
||||||
GroupPowers.VoteOnProposal;
|
GroupPowers.VoteOnProposal;
|
||||||
|
|
||||||
public const GroupPowers OfficersPowers = DefaultEveryonePowers |
|
public const GroupPowers OwnerPowers = GroupPowers.Accountable |
|
||||||
|
GroupPowers.AllowEditLand |
|
||||||
GroupPowers.AllowFly |
|
GroupPowers.AllowFly |
|
||||||
GroupPowers.AllowLandmark |
|
GroupPowers.AllowLandmark |
|
||||||
GroupPowers.AllowRez |
|
GroupPowers.AllowRez |
|
||||||
|
GroupPowers.AllowSetHome |
|
||||||
|
GroupPowers.AllowVoiceChat |
|
||||||
|
GroupPowers.AssignMember |
|
||||||
GroupPowers.AssignMemberLimited |
|
GroupPowers.AssignMemberLimited |
|
||||||
|
GroupPowers.ChangeActions |
|
||||||
GroupPowers.ChangeIdentity |
|
GroupPowers.ChangeIdentity |
|
||||||
GroupPowers.ChangeMedia |
|
GroupPowers.ChangeMedia |
|
||||||
GroupPowers.ChangeOptions |
|
GroupPowers.ChangeOptions |
|
||||||
|
GroupPowers.CreateRole |
|
||||||
GroupPowers.DeedObject |
|
GroupPowers.DeedObject |
|
||||||
|
GroupPowers.DeleteRole |
|
||||||
GroupPowers.Eject |
|
GroupPowers.Eject |
|
||||||
GroupPowers.FindPlaces |
|
GroupPowers.FindPlaces |
|
||||||
|
GroupPowers.HostEvent |
|
||||||
GroupPowers.Invite |
|
GroupPowers.Invite |
|
||||||
|
GroupPowers.JoinChat |
|
||||||
GroupPowers.LandChangeIdentity |
|
GroupPowers.LandChangeIdentity |
|
||||||
GroupPowers.LandDeed |
|
GroupPowers.LandDeed |
|
||||||
GroupPowers.LandDivideJoin |
|
GroupPowers.LandDivideJoin |
|
||||||
GroupPowers.LandEdit |
|
GroupPowers.LandEdit |
|
||||||
GroupPowers.AllowEnvironment |
|
|
||||||
GroupPowers.LandEjectAndFreeze |
|
GroupPowers.LandEjectAndFreeze |
|
||||||
GroupPowers.LandGardening |
|
GroupPowers.LandGardening |
|
||||||
GroupPowers.LandManageAllowed |
|
GroupPowers.LandManageAllowed |
|
||||||
|
@ -77,29 +84,19 @@ namespace OpenSim.Groups
|
||||||
GroupPowers.LandOptions |
|
GroupPowers.LandOptions |
|
||||||
GroupPowers.LandRelease |
|
GroupPowers.LandRelease |
|
||||||
GroupPowers.LandSetSale |
|
GroupPowers.LandSetSale |
|
||||||
GroupPowers.MemberVisible |
|
|
||||||
GroupPowers.ModerateChat |
|
GroupPowers.ModerateChat |
|
||||||
GroupPowers.ObjectManipulate |
|
GroupPowers.ObjectManipulate |
|
||||||
GroupPowers.ObjectSetForSale |
|
GroupPowers.ObjectSetForSale |
|
||||||
|
GroupPowers.ReceiveNotices |
|
||||||
|
GroupPowers.RemoveMember |
|
||||||
GroupPowers.ReturnGroupOwned |
|
GroupPowers.ReturnGroupOwned |
|
||||||
GroupPowers.ReturnGroupSet |
|
GroupPowers.ReturnGroupSet |
|
||||||
GroupPowers.ReturnNonGroup |
|
GroupPowers.ReturnNonGroup |
|
||||||
GroupPowers.RoleProperties |
|
GroupPowers.RoleProperties |
|
||||||
GroupPowers.SendNotices |
|
GroupPowers.SendNotices |
|
||||||
GroupPowers.SetLandingPoint;
|
GroupPowers.SetLandingPoint |
|
||||||
|
GroupPowers.StartProposal |
|
||||||
public const GroupPowers OwnerPowers = OfficersPowers |
|
GroupPowers.VoteOnProposal;
|
||||||
GroupPowers.Accountable |
|
|
||||||
GroupPowers.AllowEditLand |
|
|
||||||
GroupPowers.AssignMember |
|
|
||||||
GroupPowers.ChangeActions |
|
|
||||||
GroupPowers.CreateRole |
|
|
||||||
GroupPowers.DeleteRole |
|
|
||||||
GroupPowers.ExperienceAdmin |
|
|
||||||
GroupPowers.ExperienceCreator |
|
|
||||||
GroupPowers.GroupBanAccess |
|
|
||||||
GroupPowers.HostEvent |
|
|
||||||
GroupPowers.RemoveMember;
|
|
||||||
|
|
||||||
#region Daily Cleanup
|
#region Daily Cleanup
|
||||||
|
|
||||||
|
@ -154,25 +151,20 @@ namespace OpenSim.Groups
|
||||||
data.Data["ShowInList"] = showInList ? "1" : "0";
|
data.Data["ShowInList"] = showInList ? "1" : "0";
|
||||||
data.Data["AllowPublish"] = allowPublish ? "1" : "0";
|
data.Data["AllowPublish"] = allowPublish ? "1" : "0";
|
||||||
data.Data["MaturePublish"] = maturePublish ? "1" : "0";
|
data.Data["MaturePublish"] = maturePublish ? "1" : "0";
|
||||||
UUID ownerRoleID = UUID.Random();
|
UUID roleID = UUID.Random();
|
||||||
data.Data["OwnerRoleID"] = ownerRoleID.ToString();
|
data.Data["OwnerRoleID"] = roleID.ToString();
|
||||||
|
|
||||||
if (!m_Database.StoreGroup(data))
|
if (!m_Database.StoreGroup(data))
|
||||||
return UUID.Zero;
|
return UUID.Zero;
|
||||||
|
|
||||||
// Create Everyone role
|
// Create Everyone role
|
||||||
_AddOrUpdateGroupRole(RequestingAgentID, data.GroupID, UUID.Zero, "Everyone", "Everyone in the group is in the everyone role.", "Member of " + name, (ulong)DefaultEveryonePowers, true);
|
_AddOrUpdateGroupRole(RequestingAgentID, data.GroupID, UUID.Zero, "Everyone", "Everyone in the group", "Member of " + name, (ulong)DefaultEveryonePowers, true);
|
||||||
|
|
||||||
// Create Officers role
|
|
||||||
UUID officersRoleID = UUID.Random();
|
|
||||||
_AddOrUpdateGroupRole(RequestingAgentID, data.GroupID, officersRoleID, "Officers", "The officers of the group, with more powers than regular members.", "Officer of " + name, (ulong)OfficersPowers, true);
|
|
||||||
|
|
||||||
// Create Owner role
|
// Create Owner role
|
||||||
_AddOrUpdateGroupRole(RequestingAgentID, data.GroupID, ownerRoleID, "Owners", "Owners of the group", "Owner of " + name, (ulong)OwnerPowers, true);
|
_AddOrUpdateGroupRole(RequestingAgentID, data.GroupID, roleID, "Owners", "Owners of the group", "Owner of " + name, (ulong)OwnerPowers, true);
|
||||||
|
|
||||||
// Add founder to group
|
// Add founder to group
|
||||||
_AddAgentToGroup(RequestingAgentID, founderID.ToString(), data.GroupID, ownerRoleID);
|
_AddAgentToGroup(RequestingAgentID, founderID.ToString(), data.GroupID, roleID);
|
||||||
_AddAgentToGroup(RequestingAgentID, founderID.ToString(), data.GroupID, officersRoleID);
|
|
||||||
|
|
||||||
return data.GroupID;
|
return data.GroupID;
|
||||||
}
|
}
|
||||||
|
@ -231,22 +223,15 @@ namespace OpenSim.Groups
|
||||||
if (d.Data.ContainsKey("Location") && d.Data["Location"] != string.Empty)
|
if (d.Data.ContainsKey("Location") && d.Data["Location"] != string.Empty)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int nmembers = m_Database.MemberCount(d.GroupID);
|
|
||||||
if(nmembers == 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
DirGroupsReplyData g = new DirGroupsReplyData();
|
DirGroupsReplyData g = new DirGroupsReplyData();
|
||||||
|
g.groupID = d.GroupID;
|
||||||
|
|
||||||
if (d.Data.ContainsKey("Name"))
|
if (d.Data.ContainsKey("Name"))
|
||||||
g.groupName = d.Data["Name"];
|
g.groupName = d.Data["Name"];
|
||||||
else
|
else
|
||||||
{
|
|
||||||
m_log.DebugFormat("[Groups]: Key Name not found");
|
m_log.DebugFormat("[Groups]: Key Name not found");
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
g.groupID = d.GroupID;
|
g.members = m_Database.MemberCount(d.GroupID);
|
||||||
g.members = nmembers;
|
|
||||||
|
|
||||||
groups.Add(g);
|
groups.Add(g);
|
||||||
}
|
}
|
||||||
|
@ -500,8 +485,8 @@ namespace OpenSim.Groups
|
||||||
|
|
||||||
// check permissions
|
// check permissions
|
||||||
bool limited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMemberLimited);
|
bool limited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMemberLimited);
|
||||||
bool unlimited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMember) || IsOwner(RequestingAgentID, GroupID);
|
bool unlimited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMember) | IsOwner(RequestingAgentID, GroupID);
|
||||||
if (!limited && !unlimited)
|
if (!limited || !unlimited)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[Groups]: ({0}) Attempt at assigning {1} to role {2} denied because of lack of permission", RequestingAgentID, AgentID, RoleID);
|
m_log.DebugFormat("[Groups]: ({0}) Attempt at assigning {1} to role {2} denied because of lack of permission", RequestingAgentID, AgentID, RoleID);
|
||||||
return false;
|
return false;
|
||||||
|
@ -511,7 +496,7 @@ namespace OpenSim.Groups
|
||||||
if (!unlimited && limited)
|
if (!unlimited && limited)
|
||||||
{
|
{
|
||||||
// check whether person's has this role
|
// check whether person's has this role
|
||||||
RoleMembershipData rolemembership = m_Database.RetrieveRoleMember(GroupID, RoleID, RequestingAgentID);
|
RoleMembershipData rolemembership = m_Database.RetrieveRoleMember(GroupID, RoleID, AgentID);
|
||||||
if (rolemembership == null)
|
if (rolemembership == null)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[Groups]: ({0}) Attempt at assigning {1} to role {2} denied because of limited permission", RequestingAgentID, AgentID, RoleID);
|
m_log.DebugFormat("[Groups]: ({0}) Attempt at assigning {1} to role {2} denied because of limited permission", RequestingAgentID, AgentID, RoleID);
|
||||||
|
@ -531,26 +516,13 @@ namespace OpenSim.Groups
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// check permissions
|
// check permissions
|
||||||
bool limited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMemberLimited);
|
|
||||||
bool unlimited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMember) || IsOwner(RequestingAgentID, GroupID);
|
bool unlimited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMember) || IsOwner(RequestingAgentID, GroupID);
|
||||||
if (!limited && !unlimited)
|
if (!unlimited)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[Groups]: ({0}) Attempt at removing {1} from role {2} denied because of lack of permission", RequestingAgentID, AgentID, RoleID);
|
m_log.DebugFormat("[Groups]: ({0}) Attempt at removing {1} from role {2} denied because of lack of permission", RequestingAgentID, AgentID, RoleID);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// AssignMemberLimited means that the person can assign another person to the same roles that she has in the group
|
|
||||||
if (!unlimited && limited)
|
|
||||||
{
|
|
||||||
// check whether person's has this role
|
|
||||||
RoleMembershipData rolemembership = m_Database.RetrieveRoleMember(GroupID, RoleID, RequestingAgentID);
|
|
||||||
if (rolemembership == null)
|
|
||||||
{
|
|
||||||
m_log.DebugFormat("[Groups]: ({0}) Attempt at removing {1} from role {2} denied because of limited permission", RequestingAgentID, AgentID, RoleID);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RoleMembershipData rolemember = m_Database.RetrieveRoleMember(GroupID, RoleID, AgentID);
|
RoleMembershipData rolemember = m_Database.RetrieveRoleMember(GroupID, RoleID, AgentID);
|
||||||
|
|
||||||
if (rolemember == null)
|
if (rolemember == null)
|
||||||
|
@ -840,7 +812,7 @@ namespace OpenSim.Groups
|
||||||
if (RoleID != UUID.Zero)
|
if (RoleID != UUID.Zero)
|
||||||
_AddAgentToGroupRole(RequestingAgentID, AgentID, GroupID, RoleID);
|
_AddAgentToGroupRole(RequestingAgentID, AgentID, GroupID, RoleID);
|
||||||
|
|
||||||
// Make this the active group
|
// Make thit this active group
|
||||||
PrincipalData pdata = new PrincipalData();
|
PrincipalData pdata = new PrincipalData();
|
||||||
pdata.PrincipalID = AgentID;
|
pdata.PrincipalID = AgentID;
|
||||||
pdata.ActiveGroupID = GroupID;
|
pdata.ActiveGroupID = GroupID;
|
||||||
|
@ -858,7 +830,7 @@ namespace OpenSim.Groups
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!add && data == null) // it doesn't exist, can't update
|
if (!add && data == null) // it deosn't exist, can't update
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[Groups]: Group {0} doesn't exist. Can't update it", groupID);
|
m_log.DebugFormat("[Groups]: Group {0} doesn't exist. Can't update it", groupID);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -114,6 +114,7 @@ namespace OpenSim.OfflineIM
|
||||||
scene.ForEachClient(delegate(IClientAPI client)
|
scene.ForEachClient(delegate(IClientAPI client)
|
||||||
{
|
{
|
||||||
client.OnRetrieveInstantMessages -= RetrieveInstantMessages;
|
client.OnRetrieveInstantMessages -= RetrieveInstantMessages;
|
||||||
|
client.OnMuteListRequest -= OnMuteListRequest;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,6 +162,7 @@ namespace OpenSim.OfflineIM
|
||||||
private void OnNewClient(IClientAPI client)
|
private void OnNewClient(IClientAPI client)
|
||||||
{
|
{
|
||||||
client.OnRetrieveInstantMessages += RetrieveInstantMessages;
|
client.OnRetrieveInstantMessages += RetrieveInstantMessages;
|
||||||
|
client.OnMuteListRequest += OnMuteListRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RetrieveInstantMessages(IClientAPI client)
|
private void RetrieveInstantMessages(IClientAPI client)
|
||||||
|
@ -192,6 +194,20 @@ namespace OpenSim.OfflineIM
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Apparently this is needed in order for the viewer to request the IMs.
|
||||||
|
private void OnMuteListRequest(IClientAPI client, uint crc)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[OfflineIM.V2] Got mute list request for crc {0}", crc);
|
||||||
|
string filename = "mutes" + client.AgentId.ToString();
|
||||||
|
|
||||||
|
IXfer xfer = client.Scene.RequestModuleInterface<IXfer>();
|
||||||
|
if (xfer != null)
|
||||||
|
{
|
||||||
|
xfer.AddNewFile(filename, new Byte[0]);
|
||||||
|
client.SendMuteListUpdate(filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void UndeliveredMessage(GridInstantMessage im)
|
private void UndeliveredMessage(GridInstantMessage im)
|
||||||
{
|
{
|
||||||
if (im.dialog != (byte)InstantMessageDialog.MessageFromObject &&
|
if (im.dialog != (byte)InstantMessageDialog.MessageFromObject &&
|
||||||
|
|
|
@ -30,7 +30,7 @@ using Mono.Addins;
|
||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
[assembly: AssemblyVersion(OpenSim.VersionInfo.AssemblyVersionNumber)]
|
[assembly: AssemblyVersion("0.8.3.*")]
|
||||||
|
|
||||||
[assembly: Addin("OpenSim.OfflineIM", OpenSim.VersionInfo.VersionNumber)]
|
[assembly: Addin("OpenSim.OfflineIM", OpenSim.VersionInfo.VersionNumber)]
|
||||||
[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
|
[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
|
||||||
|
|
|
@ -110,8 +110,9 @@ namespace OpenSim.OfflineIM
|
||||||
{
|
{
|
||||||
m_serializer.Serialize(writer, im);
|
m_serializer.Serialize(writer, im);
|
||||||
writer.Flush();
|
writer.Flush();
|
||||||
imXml = Util.UTF8NoBomEncoding.GetString(mstream.ToArray());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
imXml = Util.UTF8NoBomEncoding.GetString(mstream.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
OfflineIMData data = new OfflineIMData();
|
OfflineIMData data = new OfflineIMData();
|
||||||
|
|
|
@ -61,8 +61,9 @@ using Mono.Addins;
|
||||||
//
|
//
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("0.7.6.*")]
|
||||||
|
|
||||||
[assembly : AssemblyVersion(OpenSim.VersionInfo.AssemblyVersionNumber)]
|
[assembly : AssemblyVersion("0.8.2.*")]
|
||||||
|
|
||||||
[assembly: Addin("OpenSim.ApplicationPlugins.LoadRegions", OpenSim.VersionInfo.VersionNumber)]
|
[assembly: Addin("OpenSim.ApplicationPlugins.LoadRegions", OpenSim.VersionInfo.VersionNumber)]
|
||||||
[assembly: AddinDependency("OpenSim", OpenSim.VersionInfo.VersionNumber)]
|
[assembly: AddinDependency("OpenSim", OpenSim.VersionInfo.VersionNumber)]
|
||||||
|
|
|
@ -49,9 +49,6 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||||
|
|
||||||
public RegionInfo[] LoadRegions()
|
public RegionInfo[] LoadRegions()
|
||||||
{
|
{
|
||||||
int tries = 3;
|
|
||||||
int wait = 2000;
|
|
||||||
|
|
||||||
if (m_configSource == null)
|
if (m_configSource == null)
|
||||||
{
|
{
|
||||||
m_log.Error("[WEBLOADER]: Unable to load configuration source!");
|
m_log.Error("[WEBLOADER]: Unable to load configuration source!");
|
||||||
|
@ -59,7 +56,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IConfig startupConfig = (IConfig)m_configSource.Configs["Startup"];
|
IConfig startupConfig = (IConfig) m_configSource.Configs["Startup"];
|
||||||
string url = startupConfig.GetString("regionload_webserver_url", String.Empty).Trim();
|
string url = startupConfig.GetString("regionload_webserver_url", String.Empty).Trim();
|
||||||
bool allowRegionless = startupConfig.GetBoolean("allow_regionless", false);
|
bool allowRegionless = startupConfig.GetBoolean("allow_regionless", false);
|
||||||
|
|
||||||
|
@ -70,26 +67,34 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
while (tries > 0)
|
RegionInfo[] regionInfos = new RegionInfo[] {};
|
||||||
{
|
|
||||||
RegionInfo[] regionInfos = new RegionInfo[] { };
|
|
||||||
int regionCount = 0;
|
int regionCount = 0;
|
||||||
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
|
HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url);
|
||||||
webRequest.Timeout = 30000; //30 Second Timeout
|
webRequest.Timeout = 30000; //30 Second Timeout
|
||||||
m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url);
|
m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse();
|
|
||||||
m_log.Debug("[WEBLOADER]: Downloading region information...");
|
|
||||||
StreamReader reader = new StreamReader(webResponse.GetResponseStream());
|
|
||||||
string xmlSource = String.Empty;
|
string xmlSource = String.Empty;
|
||||||
|
|
||||||
|
using (HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse())
|
||||||
|
{
|
||||||
|
m_log.Debug("[WEBLOADER]: Downloading region information...");
|
||||||
|
|
||||||
|
using (Stream s = webResponse.GetResponseStream())
|
||||||
|
{
|
||||||
|
using (StreamReader reader = new StreamReader(s))
|
||||||
|
{
|
||||||
string tempStr = reader.ReadLine();
|
string tempStr = reader.ReadLine();
|
||||||
while (tempStr != null)
|
while (tempStr != null)
|
||||||
{
|
{
|
||||||
xmlSource = xmlSource + tempStr;
|
xmlSource = xmlSource + tempStr;
|
||||||
tempStr = reader.ReadLine();
|
tempStr = reader.ReadLine();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " +
|
m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " +
|
||||||
xmlSource.Length);
|
xmlSource.Length);
|
||||||
XmlDocument xmlDoc = new XmlDocument();
|
XmlDocument xmlDoc = new XmlDocument();
|
||||||
|
@ -106,38 +111,38 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||||
{
|
{
|
||||||
m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml);
|
m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml);
|
||||||
regionInfos[i] =
|
regionInfos[i] =
|
||||||
new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i], false, m_configSource);
|
new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (WebException ex)
|
catch (WebException ex)
|
||||||
{
|
{
|
||||||
if (((HttpWebResponse)ex.Response).StatusCode == HttpStatusCode.NotFound)
|
using (HttpWebResponse response = (HttpWebResponse)ex.Response)
|
||||||
|
{
|
||||||
|
if (response.StatusCode == HttpStatusCode.NotFound)
|
||||||
{
|
{
|
||||||
if (!allowRegionless)
|
if (!allowRegionless)
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (regionCount > 0 || allowRegionless)
|
if (regionCount > 0 | allowRegionless)
|
||||||
return regionInfos;
|
|
||||||
|
|
||||||
m_log.Debug("[WEBLOADER]: Request yielded no regions.");
|
|
||||||
tries--;
|
|
||||||
if (tries > 0)
|
|
||||||
{
|
{
|
||||||
m_log.Debug("[WEBLOADER]: Retrying");
|
return regionInfos;
|
||||||
System.Threading.Thread.Sleep(wait);
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
m_log.Error("[WEBLOADER]: No region configs were available.");
|
m_log.Error("[WEBLOADER]: No region configs were available.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -30,7 +30,7 @@ using Mono.Addins;
|
||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
[assembly: AssemblyVersion(OpenSim.VersionInfo.AssemblyVersionNumber)]
|
[assembly: AssemblyVersion("0.8.3.*")]
|
||||||
|
|
||||||
[assembly: Addin("OpenSim.ApplicationPlugins.RegionModulesController", OpenSim.VersionInfo.VersionNumber)]
|
[assembly: Addin("OpenSim.ApplicationPlugins.RegionModulesController", OpenSim.VersionInfo.VersionNumber)]
|
||||||
[assembly: AddinDependency("OpenSim", OpenSim.VersionInfo.VersionNumber)]
|
[assembly: AddinDependency("OpenSim", OpenSim.VersionInfo.VersionNumber)]
|
||||||
|
|
|
@ -30,7 +30,7 @@ using Mono.Addins;
|
||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
[assembly: AssemblyVersion(OpenSim.VersionInfo.AssemblyVersionNumber)]
|
[assembly: AssemblyVersion("0.8.3.*")]
|
||||||
|
|
||||||
[assembly: Addin("OpenSim.ApplicationPlugins.RemoteController", OpenSim.VersionInfo.VersionNumber)]
|
[assembly: Addin("OpenSim.ApplicationPlugins.RemoteController", OpenSim.VersionInfo.VersionNumber)]
|
||||||
[assembly: AddinDependency("OpenSim", OpenSim.VersionInfo.VersionNumber)]
|
[assembly: AddinDependency("OpenSim", OpenSim.VersionInfo.VersionNumber)]
|
||||||
|
|
|
@ -74,7 +74,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
|
|
||||||
private string m_name = "RemoteAdminPlugin";
|
private string m_name = "RemoteAdminPlugin";
|
||||||
private string m_version = "0.0";
|
private string m_version = "0.0";
|
||||||
private string m_openSimVersion;
|
|
||||||
|
|
||||||
public string Version
|
public string Version
|
||||||
{
|
{
|
||||||
|
@ -94,8 +93,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
|
|
||||||
public void Initialise(OpenSimBase openSim)
|
public void Initialise(OpenSimBase openSim)
|
||||||
{
|
{
|
||||||
m_openSimVersion = openSim.GetVersionText();
|
|
||||||
|
|
||||||
m_configSource = openSim.ConfigSource.Source;
|
m_configSource = openSim.ConfigSource.Source;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -138,13 +135,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
availableMethods["admin_region_query"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRegionQueryMethod);
|
availableMethods["admin_region_query"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRegionQueryMethod);
|
||||||
availableMethods["admin_shutdown"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcShutdownMethod);
|
availableMethods["admin_shutdown"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcShutdownMethod);
|
||||||
availableMethods["admin_broadcast"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAlertMethod);
|
availableMethods["admin_broadcast"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAlertMethod);
|
||||||
availableMethods["admin_dialog"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcDialogMethod);
|
|
||||||
availableMethods["admin_restart"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRestartMethod);
|
availableMethods["admin_restart"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRestartMethod);
|
||||||
availableMethods["admin_load_heightmap"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcLoadHeightmapMethod);
|
availableMethods["admin_load_heightmap"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcLoadHeightmapMethod);
|
||||||
availableMethods["admin_save_heightmap"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcSaveHeightmapMethod);
|
availableMethods["admin_save_heightmap"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcSaveHeightmapMethod);
|
||||||
|
|
||||||
availableMethods["admin_reset_land"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcResetLand);
|
|
||||||
|
|
||||||
// Agent management
|
// Agent management
|
||||||
availableMethods["admin_get_agents"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcGetAgentsMethod);
|
availableMethods["admin_get_agents"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcGetAgentsMethod);
|
||||||
availableMethods["admin_teleport_agent"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcTeleportAgentMethod);
|
availableMethods["admin_teleport_agent"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcTeleportAgentMethod);
|
||||||
|
@ -169,11 +163,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
availableMethods["admin_acl_list"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAccessListList);
|
availableMethods["admin_acl_list"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAccessListList);
|
||||||
availableMethods["admin_estate_reload"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcEstateReload);
|
availableMethods["admin_estate_reload"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcEstateReload);
|
||||||
|
|
||||||
// Misc
|
// Land management
|
||||||
availableMethods["admin_refresh_search"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRefreshSearch);
|
availableMethods["admin_reset_land"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcResetLand);
|
||||||
availableMethods["admin_refresh_map"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRefreshMap);
|
|
||||||
availableMethods["admin_get_opensim_version"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcGetOpenSimVersion);
|
|
||||||
availableMethods["admin_get_agent_count"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcGetAgentCount);
|
|
||||||
|
|
||||||
// Either enable full remote functionality or just selected features
|
// Either enable full remote functionality or just selected features
|
||||||
string enabledMethods = m_config.GetString("enabled_methods", "all");
|
string enabledMethods = m_config.GetString("enabled_methods", "all");
|
||||||
|
@ -274,148 +265,32 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Scene rebootedScene = null;
|
m_log.Info("[RADMIN]: Request to restart Region.");
|
||||||
bool restartAll = false;
|
|
||||||
|
|
||||||
IConfig startupConfig = m_configSource.Configs["Startup"];
|
|
||||||
if (startupConfig != null)
|
|
||||||
{
|
|
||||||
if (startupConfig.GetBoolean("InworldRestartShutsDown", false))
|
|
||||||
{
|
|
||||||
rebootedScene = m_application.SceneManager.CurrentOrFirstScene;
|
|
||||||
restartAll = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rebootedScene == null)
|
|
||||||
{
|
|
||||||
CheckRegionParams(requestData, responseData);
|
CheckRegionParams(requestData, responseData);
|
||||||
|
|
||||||
|
Scene rebootedScene = null;
|
||||||
GetSceneFromRegionParams(requestData, responseData, out rebootedScene);
|
GetSceneFromRegionParams(requestData, responseData, out rebootedScene);
|
||||||
}
|
|
||||||
|
|
||||||
IRestartModule restartModule = rebootedScene.RequestModuleInterface<IRestartModule>();
|
|
||||||
|
|
||||||
responseData["success"] = false;
|
responseData["success"] = false;
|
||||||
responseData["accepted"] = true;
|
responseData["accepted"] = true;
|
||||||
responseData["rebooting"] = true;
|
responseData["rebooting"] = true;
|
||||||
|
|
||||||
string message;
|
IRestartModule restartModule = rebootedScene.RequestModuleInterface<IRestartModule>();
|
||||||
List<int> times = new List<int>();
|
|
||||||
|
|
||||||
if (requestData.ContainsKey("alerts"))
|
|
||||||
{
|
|
||||||
string[] alertTimes = requestData["alerts"].ToString().Split( new char[] {','});
|
|
||||||
if (alertTimes.Length == 1 && Convert.ToInt32(alertTimes[0]) == -1)
|
|
||||||
{
|
|
||||||
m_log.Info("[RADMIN]: Request to cancel restart.");
|
|
||||||
|
|
||||||
if (restartModule != null)
|
if (restartModule != null)
|
||||||
{
|
{
|
||||||
message = "Restart has been cancelled";
|
List<int> times = new List<int> { 30, 15 };
|
||||||
|
|
||||||
if (requestData.ContainsKey("message"))
|
|
||||||
message = requestData["message"].ToString();
|
|
||||||
|
|
||||||
restartModule.AbortRestart(message);
|
|
||||||
|
|
||||||
|
restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true);
|
||||||
responseData["success"] = true;
|
responseData["success"] = true;
|
||||||
responseData["rebooting"] = false;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (string a in alertTimes)
|
|
||||||
times.Add(Convert.ToInt32(a));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int timeout = 30;
|
|
||||||
if (requestData.ContainsKey("milliseconds"))
|
|
||||||
timeout = Int32.Parse(requestData["milliseconds"].ToString()) / 1000;
|
|
||||||
while (timeout > 0)
|
|
||||||
{
|
|
||||||
times.Add(timeout);
|
|
||||||
if (timeout > 300)
|
|
||||||
timeout -= 120;
|
|
||||||
else if (timeout > 30)
|
|
||||||
timeout -= 30;
|
|
||||||
else
|
|
||||||
timeout -= 15;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_log.Info("[RADMIN]: Request to restart Region.");
|
|
||||||
|
|
||||||
message = "Region is restarting in {0}. Please save what you are doing and log out.";
|
|
||||||
|
|
||||||
if (requestData.ContainsKey("message"))
|
|
||||||
message = requestData["message"].ToString();
|
|
||||||
|
|
||||||
bool notice = true;
|
|
||||||
if (requestData.ContainsKey("noticetype")
|
|
||||||
&& ((string)requestData["noticetype"] == "dialog"))
|
|
||||||
{
|
|
||||||
notice = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (startupConfig.GetBoolean("SkipDelayOnEmptyRegion", false))
|
|
||||||
{
|
|
||||||
m_log.Info("[RADMIN]: Counting affected avatars");
|
|
||||||
int agents = 0;
|
|
||||||
|
|
||||||
if (restartAll)
|
|
||||||
{
|
|
||||||
foreach (Scene s in m_application.SceneManager.Scenes)
|
|
||||||
{
|
|
||||||
foreach (ScenePresence sp in s.GetScenePresences())
|
|
||||||
{
|
|
||||||
if (!sp.IsChildAgent && !sp.IsNPC)
|
|
||||||
agents++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
foreach (ScenePresence sp in rebootedScene.GetScenePresences())
|
|
||||||
{
|
|
||||||
if (!sp.IsChildAgent && !sp.IsNPC)
|
|
||||||
agents++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_log.InfoFormat("[RADMIN]: Avatars in region: {0}", agents);
|
|
||||||
|
|
||||||
if (agents == 0)
|
|
||||||
{
|
|
||||||
m_log.Info("[RADMIN]: No avatars detected, shutting down without delay");
|
|
||||||
|
|
||||||
times.Clear();
|
|
||||||
times.Add(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Scene> restartList;
|
|
||||||
|
|
||||||
if (restartAll)
|
|
||||||
restartList = m_application.SceneManager.Scenes;
|
|
||||||
else
|
|
||||||
restartList = new List<Scene>() { rebootedScene };
|
|
||||||
|
|
||||||
foreach (Scene s in m_application.SceneManager.Scenes)
|
|
||||||
{
|
|
||||||
restartModule = s.RequestModuleInterface<IRestartModule>();
|
|
||||||
if (restartModule != null)
|
|
||||||
restartModule.ScheduleRestart(UUID.Zero, message, times.ToArray(), notice);
|
|
||||||
}
|
|
||||||
responseData["success"] = true;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0} {1}", e.Message, e.StackTrace);
|
// m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0} {1}", e.Message, e.StackTrace);
|
||||||
responseData["rebooting"] = false;
|
responseData["rebooting"] = false;
|
||||||
|
|
||||||
throw;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.Info("[RADMIN]: Restart Region request complete");
|
m_log.Info("[RADMIN]: Restart Region request complete");
|
||||||
|
@ -445,32 +320,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
m_log.Info("[RADMIN]: Alert request complete");
|
m_log.Info("[RADMIN]: Alert request complete");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void XmlRpcDialogMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
|
|
||||||
{
|
|
||||||
Hashtable responseData = (Hashtable)response.Value;
|
|
||||||
|
|
||||||
m_log.Info("[RADMIN]: Dialog request started");
|
|
||||||
|
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
|
||||||
|
|
||||||
string message = (string)requestData["message"];
|
|
||||||
string fromuuid = (string)requestData["from"];
|
|
||||||
m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message);
|
|
||||||
|
|
||||||
responseData["accepted"] = true;
|
|
||||||
responseData["success"] = true;
|
|
||||||
|
|
||||||
m_application.SceneManager.ForEachScene(
|
|
||||||
delegate(Scene scene)
|
|
||||||
{
|
|
||||||
IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
|
|
||||||
if (dialogModule != null)
|
|
||||||
dialogModule.SendNotificationToUsersInRegion(UUID.Zero, fromuuid, message);
|
|
||||||
});
|
|
||||||
|
|
||||||
m_log.Info("[RADMIN]: Dialog request complete");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void XmlRpcLoadHeightmapMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
|
private void XmlRpcLoadHeightmapMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
|
||||||
{
|
{
|
||||||
m_log.Info("[RADMIN]: Load height maps request started");
|
m_log.Info("[RADMIN]: Load height maps request started");
|
||||||
|
@ -574,23 +423,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
message = "Region is going down now.";
|
message = "Region is going down now.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (requestData.ContainsKey("noticetype")
|
|
||||||
&& ((string) requestData["noticetype"] == "dialog"))
|
|
||||||
{
|
|
||||||
m_application.SceneManager.ForEachScene(
|
|
||||||
|
|
||||||
delegate(Scene scene)
|
|
||||||
{
|
|
||||||
IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
|
|
||||||
if (dialogModule != null)
|
|
||||||
dialogModule.SendNotificationToUsersInRegion(UUID.Zero, "System", message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!requestData.ContainsKey("noticetype")
|
|
||||||
|| ((string)requestData["noticetype"] != "none"))
|
|
||||||
{
|
|
||||||
m_application.SceneManager.ForEachScene(
|
m_application.SceneManager.ForEachScene(
|
||||||
delegate(Scene scene)
|
delegate(Scene scene)
|
||||||
{
|
{
|
||||||
|
@ -598,8 +430,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
if (dialogModule != null)
|
if (dialogModule != null)
|
||||||
dialogModule.SendGeneralAlert(message);
|
dialogModule.SendGeneralAlert(message);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Perform shutdown
|
// Perform shutdown
|
||||||
System.Timers.Timer shutdownTimer = new System.Timers.Timer(timeout); // Wait before firing
|
System.Timers.Timer shutdownTimer = new System.Timers.Timer(timeout); // Wait before firing
|
||||||
|
@ -1658,7 +1488,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
}
|
}
|
||||||
|
|
||||||
IRegionArchiverModule archiver = scene.RequestModuleInterface<IRegionArchiverModule>();
|
IRegionArchiverModule archiver = scene.RequestModuleInterface<IRegionArchiverModule>();
|
||||||
Dictionary<string, object> archiveOptions = new Dictionary<string, object>();
|
Dictionary<string, object> archiveOptions = new Dictionary<string,object>();
|
||||||
if (mergeOar) archiveOptions.Add("merge", null);
|
if (mergeOar) archiveOptions.Add("merge", null);
|
||||||
if (skipAssets) archiveOptions.Add("skipAssets", null);
|
if (skipAssets) archiveOptions.Add("skipAssets", null);
|
||||||
if (archiver != null)
|
if (archiver != null)
|
||||||
|
@ -1918,31 +1748,21 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
|
|
||||||
private void XmlRpcRegionQueryMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
|
private void XmlRpcRegionQueryMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
|
||||||
{
|
{
|
||||||
|
m_log.Info("[RADMIN]: Received Query XML Administrator Request");
|
||||||
|
|
||||||
Hashtable responseData = (Hashtable)response.Value;
|
Hashtable responseData = (Hashtable)response.Value;
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
Hashtable requestData = (Hashtable)request.Params[0];
|
||||||
|
|
||||||
int flags = 0;
|
|
||||||
string text = String.Empty;
|
|
||||||
int health = 0;
|
|
||||||
responseData["success"] = true;
|
|
||||||
|
|
||||||
CheckRegionParams(requestData, responseData);
|
CheckRegionParams(requestData, responseData);
|
||||||
|
|
||||||
Scene scene = null;
|
Scene scene = null;
|
||||||
try
|
|
||||||
{
|
|
||||||
GetSceneFromRegionParams(requestData, responseData, out scene);
|
GetSceneFromRegionParams(requestData, responseData, out scene);
|
||||||
health = scene.GetHealth(out flags, out text);
|
|
||||||
}
|
int health = scene.GetHealth();
|
||||||
catch
|
responseData["health"] = health;
|
||||||
{
|
|
||||||
responseData["error"] = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
responseData["success"] = true;
|
responseData["success"] = true;
|
||||||
responseData["health"] = health;
|
m_log.Info("[RADMIN]: Query XML Administrator Request complete");
|
||||||
responseData["flags"] = flags;
|
|
||||||
responseData["message"] = text;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void XmlRpcConsoleCommandMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
|
private void XmlRpcConsoleCommandMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
|
||||||
|
@ -2251,6 +2071,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
{
|
{
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
Hashtable requestData = (Hashtable)request.Params[0];
|
||||||
Hashtable responseData = (Hashtable)response.Value;
|
Hashtable responseData = (Hashtable)response.Value;
|
||||||
|
|
||||||
string musicURL = string.Empty;
|
string musicURL = string.Empty;
|
||||||
UUID groupID = UUID.Zero;
|
UUID groupID = UUID.Zero;
|
||||||
uint flags = 0;
|
uint flags = 0;
|
||||||
|
@ -2260,11 +2081,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
set_group = UUID.TryParse(requestData["group"].ToString(), out groupID);
|
set_group = UUID.TryParse(requestData["group"].ToString(), out groupID);
|
||||||
if (requestData.Contains("music") && requestData["music"] != null)
|
if (requestData.Contains("music") && requestData["music"] != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
musicURL = requestData["music"].ToString();
|
musicURL = requestData["music"].ToString();
|
||||||
set_music = true;
|
set_music = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (requestData.Contains("flags") && requestData["flags"] != null)
|
if (requestData.Contains("flags") && requestData["flags"] != null)
|
||||||
set_flags = UInt32.TryParse(requestData["flags"].ToString(), out flags);
|
set_flags = UInt32.TryParse(requestData["flags"].ToString(), out flags);
|
||||||
|
|
||||||
|
@ -2273,116 +2092,30 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
(set_music ? musicURL : "unchanged"),
|
(set_music ? musicURL : "unchanged"),
|
||||||
(set_flags ? flags.ToString() : "unchanged"));
|
(set_flags ? flags.ToString() : "unchanged"));
|
||||||
|
|
||||||
m_application.SceneManager.ForEachScene(delegate (Scene s)
|
m_application.SceneManager.ForEachScene(delegate(Scene s)
|
||||||
{
|
{
|
||||||
List<ILandObject> parcels = s.LandChannel.AllParcels();
|
List<ILandObject> parcels = s.LandChannel.AllParcels();
|
||||||
foreach (ILandObject p in parcels)
|
foreach (ILandObject p in parcels)
|
||||||
{
|
{
|
||||||
if (set_music)
|
if (set_music)
|
||||||
p.LandData.MusicURL = musicURL;
|
p.LandData.MusicURL = musicURL;
|
||||||
|
|
||||||
if (set_group)
|
if (set_group)
|
||||||
p.LandData.GroupID = groupID;
|
p.LandData.GroupID = groupID;
|
||||||
|
|
||||||
if (set_flags)
|
if (set_flags)
|
||||||
p.LandData.Flags = flags;
|
p.LandData.Flags = flags;
|
||||||
|
|
||||||
s.LandChannel.UpdateLandObject(p.LandData.LocalID, p.LandData);
|
s.LandChannel.UpdateLandObject(p.LandData.LocalID, p.LandData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
responseData["success"] = true;
|
responseData["success"] = true;
|
||||||
|
|
||||||
m_log.Info("[RADMIN]: Reset Land Request complete");
|
m_log.Info("[RADMIN]: Reset Land Request complete");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void XmlRpcRefreshSearch(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
|
|
||||||
{
|
|
||||||
m_log.Info("[RADMIN]: Received Refresh Search Request");
|
|
||||||
|
|
||||||
Hashtable responseData = (Hashtable)response.Value;
|
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
|
||||||
|
|
||||||
CheckRegionParams(requestData, responseData);
|
|
||||||
|
|
||||||
Scene scene = null;
|
|
||||||
GetSceneFromRegionParams(requestData, responseData, out scene);
|
|
||||||
|
|
||||||
ISearchModule searchModule = scene.RequestModuleInterface<ISearchModule>();
|
|
||||||
if (searchModule != null)
|
|
||||||
{
|
|
||||||
searchModule.Refresh();
|
|
||||||
responseData["success"] = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
responseData["success"] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_log.Info("[RADMIN]: Refresh Search Request complete");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void XmlRpcRefreshMap(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
|
|
||||||
{
|
|
||||||
m_log.Info("[RADMIN]: Received Refresh Map Request");
|
|
||||||
|
|
||||||
Hashtable responseData = (Hashtable)response.Value;
|
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
|
||||||
|
|
||||||
CheckRegionParams(requestData, responseData);
|
|
||||||
|
|
||||||
Scene scene = null;
|
|
||||||
GetSceneFromRegionParams(requestData, responseData, out scene);
|
|
||||||
|
|
||||||
IMapImageUploadModule mapTileModule = scene.RequestModuleInterface<IMapImageUploadModule>();
|
|
||||||
if (mapTileModule != null)
|
|
||||||
{
|
|
||||||
Util.FireAndForget((x) =>
|
|
||||||
{
|
|
||||||
mapTileModule.UploadMapTile(scene);
|
|
||||||
});
|
|
||||||
responseData["success"] = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
responseData["success"] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_log.Info("[RADMIN]: Refresh Map Request complete");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void XmlRpcGetOpenSimVersion(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
|
|
||||||
{
|
|
||||||
m_log.Info("[RADMIN]: Received Get OpenSim Version Request");
|
|
||||||
|
|
||||||
Hashtable responseData = (Hashtable)response.Value;
|
|
||||||
|
|
||||||
responseData["version"] = m_openSimVersion;
|
|
||||||
responseData["success"] = true;
|
|
||||||
|
|
||||||
m_log.Info("[RADMIN]: Get OpenSim Version Request complete");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void XmlRpcGetAgentCount(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
|
|
||||||
{
|
|
||||||
m_log.Info("[RADMIN]: Received Get Agent Count Request");
|
|
||||||
|
|
||||||
Hashtable responseData = (Hashtable)response.Value;
|
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
|
||||||
|
|
||||||
CheckRegionParams(requestData, responseData);
|
|
||||||
|
|
||||||
Scene scene = null;
|
|
||||||
GetSceneFromRegionParams(requestData, responseData, out scene);
|
|
||||||
|
|
||||||
if (scene == null)
|
|
||||||
{
|
|
||||||
responseData["success"] = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
responseData["count"] = scene.GetRootAgentCount();
|
|
||||||
responseData["success"] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_log.Info("[RADMIN]: Get Agent Count Request complete");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parse a float with the given parameter name from a request data hash table.
|
/// Parse a float with the given parameter name from a request data hash table.
|
||||||
|
@ -2872,7 +2605,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
if (wearable[0].ItemID != UUID.Zero)
|
if (wearable[0].ItemID != UUID.Zero)
|
||||||
{
|
{
|
||||||
// Get inventory item and copy it
|
// Get inventory item and copy it
|
||||||
InventoryItemBase item = inventoryService.GetItem(source, wearable[0].ItemID);
|
InventoryItemBase item = new InventoryItemBase(wearable[0].ItemID, source);
|
||||||
|
item = inventoryService.GetItem(item);
|
||||||
|
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
|
@ -2925,7 +2659,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
if (itemID != UUID.Zero)
|
if (itemID != UUID.Zero)
|
||||||
{
|
{
|
||||||
// Get inventory item and copy it
|
// Get inventory item and copy it
|
||||||
InventoryItemBase item = inventoryService.GetItem(source, itemID);
|
InventoryItemBase item = new InventoryItemBase(itemID, source);
|
||||||
|
item = inventoryService.GetItem(item);
|
||||||
|
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,10 +28,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Concurrent;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading;
|
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
@ -50,9 +48,9 @@ namespace OpenSim.Framework.Capabilities
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public delegate IClientAPI GetClientDelegate(UUID agentID);
|
public delegate IClientAPI GetClientDelegate(UUID agentID);
|
||||||
|
|
||||||
public class Caps : IDisposable
|
public class Caps
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private string m_httpListenerHostName;
|
private string m_httpListenerHostName;
|
||||||
private uint m_httpListenPort;
|
private uint m_httpListenPort;
|
||||||
|
@ -65,15 +63,14 @@ namespace OpenSim.Framework.Capabilities
|
||||||
|
|
||||||
private CapsHandlers m_capsHandlers;
|
private CapsHandlers m_capsHandlers;
|
||||||
|
|
||||||
private ConcurrentDictionary<string, PollServiceEventArgs> m_pollServiceHandlers
|
private Dictionary<string, PollServiceEventArgs> m_pollServiceHandlers
|
||||||
= new ConcurrentDictionary<string, PollServiceEventArgs>();
|
= new Dictionary<string, PollServiceEventArgs>();
|
||||||
|
|
||||||
private Dictionary<string, string> m_externalCapsHandlers = new Dictionary<string, string>();
|
private Dictionary<string, string> m_externalCapsHandlers = new Dictionary<string, string>();
|
||||||
|
|
||||||
private IHttpServer m_httpListener;
|
private IHttpServer m_httpListener;
|
||||||
private UUID m_agentID;
|
private UUID m_agentID;
|
||||||
private string m_regionName;
|
private string m_regionName;
|
||||||
private ManualResetEvent m_capsActive = new ManualResetEvent(false);
|
|
||||||
|
|
||||||
public UUID AgentID
|
public UUID AgentID
|
||||||
{
|
{
|
||||||
|
@ -120,19 +117,6 @@ namespace OpenSim.Framework.Capabilities
|
||||||
get { return m_externalCapsHandlers; }
|
get { return m_externalCapsHandlers; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Flags]
|
|
||||||
public enum CapsFlags:uint
|
|
||||||
{
|
|
||||||
None = 0,
|
|
||||||
SentSeeds = 1,
|
|
||||||
|
|
||||||
ObjectAnim = 0x100,
|
|
||||||
WLEnv = 0x200,
|
|
||||||
AdvEnv = 0x400
|
|
||||||
}
|
|
||||||
|
|
||||||
public CapsFlags Flags { get; set;}
|
|
||||||
|
|
||||||
public Caps(IHttpServer httpServer, string httpListen, uint httpPort, string capsPath,
|
public Caps(IHttpServer httpServer, string httpListen, uint httpPort, string capsPath,
|
||||||
UUID agent, string regionName)
|
UUID agent, string regionName)
|
||||||
{
|
{
|
||||||
|
@ -150,37 +134,8 @@ namespace OpenSim.Framework.Capabilities
|
||||||
}
|
}
|
||||||
|
|
||||||
m_agentID = agent;
|
m_agentID = agent;
|
||||||
m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort);
|
m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ? false : httpServer.UseSSL);
|
||||||
m_regionName = regionName;
|
m_regionName = regionName;
|
||||||
Flags = CapsFlags.None;
|
|
||||||
m_capsActive.Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
~Caps()
|
|
||||||
{
|
|
||||||
Flags = CapsFlags.None;
|
|
||||||
if (m_capsActive!= null)
|
|
||||||
{
|
|
||||||
m_capsActive.Dispose();
|
|
||||||
m_capsActive = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
Dispose(true);
|
|
||||||
GC.SuppressFinalize(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
Flags = CapsFlags.None;
|
|
||||||
if (m_capsActive != null)
|
|
||||||
{
|
|
||||||
DeregisterHandlers();
|
|
||||||
m_capsActive.Dispose();
|
|
||||||
m_capsActive = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -194,27 +149,15 @@ namespace OpenSim.Framework.Capabilities
|
||||||
m_capsHandlers[capName] = handler;
|
m_capsHandlers[capName] = handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegisterSimpleHandler(string capName, ISimpleStreamHandler handler, bool addToListener = true)
|
|
||||||
{
|
|
||||||
//m_log.DebugFormat("[CAPS]: Registering handler for \"{0}\": path {1}", capName, handler.Path);
|
|
||||||
m_capsHandlers.AddSimpleHandler(capName, handler, addToListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RegisterPollHandler(string capName, PollServiceEventArgs pollServiceHandler)
|
public void RegisterPollHandler(string capName, PollServiceEventArgs pollServiceHandler)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[CAPS]: Registering handler with name {0}, url {1} for {2}",
|
// "[CAPS]: Registering handler with name {0}, url {1} for {2}",
|
||||||
// capName, pollServiceHandler.Url, m_agentID, m_regionName);
|
// capName, pollServiceHandler.Url, m_agentID, m_regionName);
|
||||||
|
|
||||||
if(!m_pollServiceHandlers.TryAdd(capName, pollServiceHandler))
|
m_pollServiceHandlers.Add(capName, pollServiceHandler);
|
||||||
{
|
|
||||||
m_log.ErrorFormat(
|
|
||||||
"[CAPS]: Handler with name {0} already registered (ulr {1}, agent {2}, region {3}",
|
|
||||||
capName, pollServiceHandler.Url, m_agentID, m_regionName);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_httpListener.AddPollServiceHTTPHandler(pollServiceHandler);
|
m_httpListener.AddPollServiceHTTPHandler(pollServiceHandler.Url, pollServiceHandler);
|
||||||
|
|
||||||
// uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
|
// uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
|
||||||
// string protocol = "http";
|
// string protocol = "http";
|
||||||
|
@ -254,9 +197,8 @@ namespace OpenSim.Framework.Capabilities
|
||||||
|
|
||||||
foreach (PollServiceEventArgs handler in m_pollServiceHandlers.Values)
|
foreach (PollServiceEventArgs handler in m_pollServiceHandlers.Values)
|
||||||
{
|
{
|
||||||
m_httpListener.RemovePollServiceHTTPHandler(handler.Url);
|
m_httpListener.RemovePollServiceHTTPHandler("", handler.Url);
|
||||||
}
|
}
|
||||||
m_pollServiceHandlers.Clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryGetPollHandler(string name, out PollServiceEventArgs pollHandler)
|
public bool TryGetPollHandler(string name, out PollServiceEventArgs pollHandler)
|
||||||
|
@ -295,6 +237,9 @@ namespace OpenSim.Framework.Capabilities
|
||||||
port = MainServer.Instance.SSLPort;
|
port = MainServer.Instance.SSLPort;
|
||||||
protocol = "https";
|
protocol = "https";
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
// caps.RegisterHandler("FetchInventoryDescendents2", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));
|
||||||
|
|
||||||
caps[kvp.Key] = string.Format("{0}://{1}:{2}{3}", protocol, hostName, port, kvp.Value.Url);
|
caps[kvp.Key] = string.Format("{0}://{1}:{2}{3}", protocol, hostName, port, kvp.Value.Url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -308,19 +253,7 @@ namespace OpenSim.Framework.Capabilities
|
||||||
caps[kvp.Key] = kvp.Value;
|
caps[kvp.Key] = kvp.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return caps;
|
return caps;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Activate()
|
|
||||||
{
|
|
||||||
m_capsActive.Set();
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool WaitForActivation()
|
|
||||||
{
|
|
||||||
// Wait for 30s. If that elapses, return false and run without caps
|
|
||||||
return m_capsActive.WaitOne(120000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -27,7 +27,6 @@
|
||||||
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Concurrent;
|
|
||||||
using OpenSim.Framework.Servers;
|
using OpenSim.Framework.Servers;
|
||||||
using OpenSim.Framework.Servers.HttpServer;
|
using OpenSim.Framework.Servers.HttpServer;
|
||||||
|
|
||||||
|
@ -41,7 +40,6 @@ namespace OpenSim.Framework.Capabilities
|
||||||
public class CapsHandlers
|
public class CapsHandlers
|
||||||
{
|
{
|
||||||
private Dictionary<string, IRequestHandler> m_capsHandlers = new Dictionary<string, IRequestHandler>();
|
private Dictionary<string, IRequestHandler> m_capsHandlers = new Dictionary<string, IRequestHandler>();
|
||||||
private ConcurrentDictionary<string, ISimpleStreamHandler> m_capsSimpleHandlers = new ConcurrentDictionary<string, ISimpleStreamHandler>();
|
|
||||||
private IHttpServer m_httpListener;
|
private IHttpServer m_httpListener;
|
||||||
private string m_httpListenerHostName;
|
private string m_httpListenerHostName;
|
||||||
private uint m_httpListenerPort;
|
private uint m_httpListenerPort;
|
||||||
|
@ -55,15 +53,31 @@ namespace OpenSim.Framework.Capabilities
|
||||||
/// <param name="httpListener">base HTTP server</param>
|
/// <param name="httpListener">base HTTP server</param>
|
||||||
/// <param name="httpListenerHostname">host name of the HTTP server</param>
|
/// <param name="httpListenerHostname">host name of the HTTP server</param>
|
||||||
/// <param name="httpListenerPort">HTTP port</param>
|
/// <param name="httpListenerPort">HTTP port</param>
|
||||||
public CapsHandlers(IHttpServer httpListener, string httpListenerHostname, uint httpListenerPort)
|
public CapsHandlers(BaseHttpServer httpListener, string httpListenerHostname, uint httpListenerPort)
|
||||||
|
: this(httpListener,httpListenerHostname,httpListenerPort, false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary></summary>
|
||||||
|
/// CapsHandlers is a cap handler container but also takes
|
||||||
|
/// care of adding and removing cap handlers to and from the
|
||||||
|
/// supplied BaseHttpServer.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="httpListener">base HTTP server</param>
|
||||||
|
/// <param name="httpListenerHostname">host name of the HTTP
|
||||||
|
/// server</param>
|
||||||
|
/// <param name="httpListenerPort">HTTP port</param>
|
||||||
|
public CapsHandlers(IHttpServer httpListener, string httpListenerHostname, uint httpListenerPort, bool https)
|
||||||
{
|
{
|
||||||
m_httpListener = httpListener;
|
m_httpListener = httpListener;
|
||||||
m_httpListenerHostName = httpListenerHostname;
|
m_httpListenerHostName = httpListenerHostname;
|
||||||
m_httpListenerPort = httpListenerPort;
|
m_httpListenerPort = httpListenerPort;
|
||||||
if (httpListener != null && httpListener.UseSSL)
|
m_useSSL = https;
|
||||||
m_useSSL = true;
|
if (httpListener != null && m_useSSL)
|
||||||
else
|
{
|
||||||
m_useSSL = false;
|
m_httpListenerHostName = httpListener.SSLCommonName;
|
||||||
|
m_httpListenerPort = httpListener.SSLPort;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -74,36 +88,17 @@ namespace OpenSim.Framework.Capabilities
|
||||||
public void Remove(string capsName)
|
public void Remove(string capsName)
|
||||||
{
|
{
|
||||||
lock (m_capsHandlers)
|
lock (m_capsHandlers)
|
||||||
{
|
|
||||||
if(m_capsHandlers.ContainsKey(capsName))
|
|
||||||
{
|
{
|
||||||
m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[capsName].Path);
|
m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[capsName].Path);
|
||||||
m_httpListener.RemoveStreamHandler("PUT", m_capsHandlers[capsName].Path);
|
|
||||||
m_httpListener.RemoveStreamHandler("GET", m_capsHandlers[capsName].Path);
|
m_httpListener.RemoveStreamHandler("GET", m_capsHandlers[capsName].Path);
|
||||||
m_httpListener.RemoveStreamHandler("DELETE", m_capsHandlers[capsName].Path);
|
|
||||||
m_capsHandlers.Remove(capsName);
|
m_capsHandlers.Remove(capsName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(m_capsSimpleHandlers.TryRemove(capsName, out ISimpleStreamHandler hdr))
|
|
||||||
{
|
|
||||||
m_httpListener.RemoveSimpleStreamHandler(hdr.Path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddSimpleHandler(string capName, ISimpleStreamHandler handler, bool addToListener = true)
|
|
||||||
{
|
|
||||||
if(ContainsCap(capName))
|
|
||||||
Remove(capName);
|
|
||||||
if(m_capsSimpleHandlers.TryAdd(capName, handler) && addToListener)
|
|
||||||
m_httpListener.AddSimpleStreamHandler(handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool ContainsCap(string cap)
|
public bool ContainsCap(string cap)
|
||||||
{
|
{
|
||||||
lock (m_capsHandlers)
|
lock (m_capsHandlers)
|
||||||
if (m_capsHandlers.ContainsKey(cap))
|
return m_capsHandlers.ContainsKey(cap);
|
||||||
return true;
|
|
||||||
return m_capsSimpleHandlers.ContainsKey(cap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -130,9 +125,6 @@ namespace OpenSim.Framework.Capabilities
|
||||||
if (m_capsHandlers.ContainsKey(idx))
|
if (m_capsHandlers.ContainsKey(idx))
|
||||||
{
|
{
|
||||||
m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[idx].Path);
|
m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[idx].Path);
|
||||||
m_httpListener.RemoveStreamHandler("PUT", m_capsHandlers[idx].Path);
|
|
||||||
m_httpListener.RemoveStreamHandler("GET", m_capsHandlers[idx].Path);
|
|
||||||
m_httpListener.RemoveStreamHandler("DELETE", m_capsHandlers[idx].Path);
|
|
||||||
m_capsHandlers.Remove(idx);
|
m_capsHandlers.Remove(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,9 +146,8 @@ namespace OpenSim.Framework.Capabilities
|
||||||
{
|
{
|
||||||
lock (m_capsHandlers)
|
lock (m_capsHandlers)
|
||||||
{
|
{
|
||||||
string[] __keys = new string[m_capsHandlers.Keys.Count + m_capsSimpleHandlers.Keys.Count];
|
string[] __keys = new string[m_capsHandlers.Keys.Count];
|
||||||
m_capsHandlers.Keys.CopyTo(__keys, 0);
|
m_capsHandlers.Keys.CopyTo(__keys, 0);
|
||||||
m_capsSimpleHandlers.Keys.CopyTo(__keys, m_capsHandlers.Keys.Count);
|
|
||||||
return __keys;
|
return __keys;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,39 +161,24 @@ namespace OpenSim.Framework.Capabilities
|
||||||
public Hashtable GetCapsDetails(bool excludeSeed, List<string> requestedCaps)
|
public Hashtable GetCapsDetails(bool excludeSeed, List<string> requestedCaps)
|
||||||
{
|
{
|
||||||
Hashtable caps = new Hashtable();
|
Hashtable caps = new Hashtable();
|
||||||
|
string protocol = "http://";
|
||||||
|
|
||||||
|
if (m_useSSL)
|
||||||
|
protocol = "https://";
|
||||||
|
|
||||||
string protocol = m_useSSL ? "https://" : "http://";
|
|
||||||
string baseUrl = protocol + m_httpListenerHostName + ":" + m_httpListenerPort.ToString();
|
string baseUrl = protocol + m_httpListenerHostName + ":" + m_httpListenerPort.ToString();
|
||||||
|
|
||||||
if (requestedCaps == null)
|
|
||||||
{
|
|
||||||
lock (m_capsHandlers)
|
lock (m_capsHandlers)
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<string, ISimpleStreamHandler> kvp in m_capsSimpleHandlers)
|
foreach (string capsName in m_capsHandlers.Keys)
|
||||||
caps[kvp.Key] = baseUrl + kvp.Value.Path;
|
|
||||||
foreach (KeyValuePair<string, IRequestHandler> kvp in m_capsHandlers)
|
|
||||||
caps[kvp.Key] = baseUrl + kvp.Value.Path;
|
|
||||||
}
|
|
||||||
return caps;
|
|
||||||
}
|
|
||||||
|
|
||||||
lock (m_capsHandlers)
|
|
||||||
{
|
{
|
||||||
for(int i = 0; i < requestedCaps.Count; ++i)
|
|
||||||
{
|
|
||||||
string capsName = requestedCaps[i];
|
|
||||||
if (excludeSeed && "SEED" == capsName)
|
if (excludeSeed && "SEED" == capsName)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (m_capsSimpleHandlers.TryGetValue(capsName, out ISimpleStreamHandler shdr))
|
if (requestedCaps != null && !requestedCaps.Contains(capsName))
|
||||||
{
|
|
||||||
caps[capsName] = baseUrl + shdr.Path;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
if (m_capsHandlers.TryGetValue(capsName, out IRequestHandler chdr))
|
caps[capsName] = baseUrl + m_capsHandlers[capsName].Path;
|
||||||
{
|
|
||||||
caps[capsName] = baseUrl + chdr.Path;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,116 @@
|
||||||
|
/*
|
||||||
|
* 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.Collections.Specialized;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Web;
|
||||||
|
using log4net;
|
||||||
|
using Nini.Config;
|
||||||
|
using OpenMetaverse;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Framework.Capabilities;
|
||||||
|
using OpenSim.Framework.Servers;
|
||||||
|
using OpenSim.Framework.Servers.HttpServer;
|
||||||
|
//using OpenSim.Region.Framework.Interfaces;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||||
|
|
||||||
|
namespace OpenSim.Capabilities.Handlers
|
||||||
|
{
|
||||||
|
public class AvatarPickerSearchHandler : BaseStreamHandler
|
||||||
|
{
|
||||||
|
private static readonly ILog m_log =
|
||||||
|
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
private IPeople m_PeopleService;
|
||||||
|
|
||||||
|
public AvatarPickerSearchHandler(string path, IPeople peopleService, string name, string description)
|
||||||
|
: base("GET", path, name, description)
|
||||||
|
{
|
||||||
|
m_PeopleService = peopleService;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||||
|
{
|
||||||
|
// Try to parse the texture ID from the request URL
|
||||||
|
NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
|
||||||
|
string names = query.GetOne("names");
|
||||||
|
string psize = query.GetOne("page_size");
|
||||||
|
string pnumber = query.GetOne("page");
|
||||||
|
|
||||||
|
if (m_PeopleService == null)
|
||||||
|
return FailureResponse(names, (int)System.Net.HttpStatusCode.InternalServerError, httpResponse);
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(names) || names.Length < 3)
|
||||||
|
return FailureResponse(names, (int)System.Net.HttpStatusCode.BadRequest, httpResponse);
|
||||||
|
|
||||||
|
m_log.DebugFormat("[AVATAR PICKER SEARCH]: search for {0}", names);
|
||||||
|
|
||||||
|
int page_size = (string.IsNullOrEmpty(psize) ? 500 : Int32.Parse(psize));
|
||||||
|
int page_number = (string.IsNullOrEmpty(pnumber) ? 1 : Int32.Parse(pnumber));
|
||||||
|
|
||||||
|
// Full content request
|
||||||
|
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.OK;
|
||||||
|
//httpResponse.ContentLength = ??;
|
||||||
|
httpResponse.ContentType = "application/llsd+xml";
|
||||||
|
|
||||||
|
List<UserData> users = m_PeopleService.GetUserData(names, page_size, page_number);
|
||||||
|
|
||||||
|
LLSDAvatarPicker osdReply = new LLSDAvatarPicker();
|
||||||
|
osdReply.next_page_url = httpRequest.RawUrl;
|
||||||
|
foreach (UserData u in users)
|
||||||
|
osdReply.agents.Array.Add(ConvertUserData(u));
|
||||||
|
|
||||||
|
string reply = LLSDHelpers.SerialiseLLSDReply(osdReply);
|
||||||
|
return System.Text.Encoding.UTF8.GetBytes(reply);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LLSDPerson ConvertUserData(UserData user)
|
||||||
|
{
|
||||||
|
LLSDPerson p = new LLSDPerson();
|
||||||
|
p.legacy_first_name = user.FirstName;
|
||||||
|
p.legacy_last_name = user.LastName;
|
||||||
|
p.display_name = user.FirstName + " " + user.LastName;
|
||||||
|
if (user.LastName.StartsWith("@"))
|
||||||
|
p.username = user.FirstName.ToLower() + user.LastName.ToLower();
|
||||||
|
else
|
||||||
|
p.username = user.FirstName.ToLower() + "." + user.LastName.ToLower();
|
||||||
|
p.id = user.Id;
|
||||||
|
p.is_display_name_default = false;
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
private byte[] FailureResponse(string names, int statuscode, IOSHttpResponse httpResponse)
|
||||||
|
{
|
||||||
|
m_log.Error("[AVATAR PICKER SEARCH]: Error searching for " + names);
|
||||||
|
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||||
|
return System.Text.Encoding.UTF8.GetBytes(string.Empty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -29,12 +29,9 @@ using System;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using OpenSim.Server.Base;
|
using OpenSim.Server.Base;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
using OpenSim.Framework;
|
|
||||||
using OpenSim.Framework.Servers.HttpServer;
|
using OpenSim.Framework.Servers.HttpServer;
|
||||||
using OpenSim.Server.Handlers.Base;
|
using OpenSim.Server.Handlers.Base;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenMetaverse.StructuredData;
|
|
||||||
|
|
||||||
|
|
||||||
namespace OpenSim.Capabilities.Handlers
|
namespace OpenSim.Capabilities.Handlers
|
||||||
{
|
{
|
||||||
|
@ -70,16 +67,16 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
m_LibraryService =
|
m_LibraryService =
|
||||||
ServerUtils.LoadPlugin<ILibraryService>(libService, args);
|
ServerUtils.LoadPlugin<ILibraryService>(libService, args);
|
||||||
|
|
||||||
ExpiringKey<UUID> m_badRequests = new ExpiringKey<UUID>(30000);
|
|
||||||
|
|
||||||
FetchInvDescHandler webFetchHandler = new FetchInvDescHandler(m_InventoryService, m_LibraryService, null);
|
FetchInvDescHandler webFetchHandler = new FetchInvDescHandler(m_InventoryService, m_LibraryService, null);
|
||||||
ISimpleStreamHandler reqHandler
|
IRequestHandler reqHandler
|
||||||
= new SimpleStreamHandler("/CAPS/WebFetchInvDesc/", delegate(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
= new RestStreamHandler(
|
||||||
{
|
"POST",
|
||||||
webFetchHandler.FetchInventoryDescendentsRequest(httpRequest, httpResponse, m_badRequests);
|
"/CAPS/WebFetchInvDesc/" /*+ UUID.Random()*/,
|
||||||
});
|
webFetchHandler.FetchInventoryDescendentsRequest,
|
||||||
|
"FetchInvDescendents",
|
||||||
server.AddSimpleStreamHandler(reqHandler);
|
null);
|
||||||
|
server.AddStreamHandler(reqHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,12 +25,11 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System.Net;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenMetaverse.StructuredData;
|
using OpenMetaverse.StructuredData;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Framework.Capabilities;
|
||||||
using OpenSim.Framework.Servers.HttpServer;
|
using OpenSim.Framework.Servers.HttpServer;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
using OSDArray = OpenMetaverse.StructuredData.OSDArray;
|
using OSDArray = OpenMetaverse.StructuredData.OSDArray;
|
||||||
|
@ -60,107 +59,83 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
OSDMap requestmap = (OSDMap)OSDParser.DeserializeLLSDXml(Utils.StringToBytes(request));
|
OSDMap requestmap = (OSDMap)OSDParser.DeserializeLLSDXml(Utils.StringToBytes(request));
|
||||||
OSDArray itemsRequested = (OSDArray)requestmap["items"];
|
OSDArray itemsRequested = (OSDArray)requestmap["items"];
|
||||||
|
|
||||||
|
string reply;
|
||||||
|
LLSDFetchInventory llsdReply = new LLSDFetchInventory();
|
||||||
|
|
||||||
UUID[] itemIDs = new UUID[itemsRequested.Count];
|
UUID[] itemIDs = new UUID[itemsRequested.Count];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
foreach (OSDMap osdItemId in itemsRequested)
|
foreach (OSDMap osdItemId in itemsRequested)
|
||||||
{
|
{
|
||||||
itemIDs[i++] = osdItemId["item_id"].AsUUID();
|
itemIDs[i++] = osdItemId["item_id"].AsUUID();
|
||||||
}
|
}
|
||||||
|
|
||||||
InventoryItemBase[] items = null;
|
InventoryItemBase[] items = m_inventoryService.GetMultipleItems(m_agentID, itemIDs);
|
||||||
|
|
||||||
if (m_agentID != UUID.Zero)
|
if (items == null)
|
||||||
{
|
|
||||||
items = m_inventoryService.GetMultipleItems(m_agentID, itemIDs);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
// OMG!!! One by one!!! This is fallback code, in case the backend isn't updated
|
||||||
|
m_log.WarnFormat("[FETCH INVENTORY HANDLER]: GetMultipleItems failed. Falling back to fetching inventory items one by one.");
|
||||||
items = new InventoryItemBase[itemsRequested.Count];
|
items = new InventoryItemBase[itemsRequested.Count];
|
||||||
|
i = 0;
|
||||||
|
InventoryItemBase item = new InventoryItemBase();
|
||||||
|
item.Owner = m_agentID;
|
||||||
foreach (UUID id in itemIDs)
|
foreach (UUID id in itemIDs)
|
||||||
items[i++] = m_inventoryService.GetItem(UUID.Zero, id);
|
{
|
||||||
|
item.ID = id;
|
||||||
|
items[i++] = m_inventoryService.GetItem(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder lsl = LLSDxmlEncode.Start(4096);
|
|
||||||
LLSDxmlEncode.AddMap(lsl);
|
|
||||||
|
|
||||||
if(m_agentID == UUID.Zero && items.Length > 0)
|
|
||||||
LLSDxmlEncode.AddElem("agent_id", items[0].Owner, lsl);
|
|
||||||
else
|
|
||||||
LLSDxmlEncode.AddElem("agent_id", m_agentID, lsl);
|
|
||||||
|
|
||||||
if(items == null || items.Length == 0)
|
|
||||||
{
|
|
||||||
LLSDxmlEncode.AddEmptyArray("items", lsl);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LLSDxmlEncode.AddArray("items", lsl);
|
|
||||||
foreach (InventoryItemBase item in items)
|
foreach (InventoryItemBase item in items)
|
||||||
{
|
{
|
||||||
if (item != null)
|
if (item != null)
|
||||||
item.ToLLSDxml(lsl, 0xff);
|
|
||||||
}
|
|
||||||
LLSDxmlEncode.AddEndArray(lsl);
|
|
||||||
}
|
|
||||||
|
|
||||||
LLSDxmlEncode.AddEndMap(lsl);
|
|
||||||
return LLSDxmlEncode.End(lsl);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void FetchInventorySimpleRequest(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, OSDMap requestmap, ExpiringKey<UUID> BadRequests)
|
|
||||||
{
|
{
|
||||||
//m_log.DebugFormat("[FETCH INVENTORY HANDLER]: Received FetchInventory capability request {0}", request);
|
// 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;
|
||||||
|
|
||||||
if(BadRequests == null)
|
llsdReply.items.Array.Add(ConvertInventoryItem(item));
|
||||||
{
|
}
|
||||||
httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OSDArray itemsRequested = (OSDArray)requestmap["items"];
|
reply = LLSDHelpers.SerialiseLLSDReply(llsdReply);
|
||||||
|
|
||||||
UUID[] itemIDs = new UUID[itemsRequested.Count];
|
return reply;
|
||||||
int i = 0;
|
|
||||||
foreach (OSDMap osdItemId in itemsRequested)
|
|
||||||
{
|
|
||||||
UUID id = osdItemId["item_id"].AsUUID();
|
|
||||||
if(!BadRequests.ContainsKey(id))
|
|
||||||
itemIDs[i++] = id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
InventoryItemBase[] items = null;
|
/// <summary>
|
||||||
try
|
/// Convert an internal inventory item object into an LLSD object.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="invItem"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private LLSDInventoryItem ConvertInventoryItem(InventoryItemBase invItem)
|
||||||
{
|
{
|
||||||
// badrequests still not filled
|
LLSDInventoryItem llsdItem = new LLSDInventoryItem();
|
||||||
items = m_inventoryService.GetMultipleItems(m_agentID, itemIDs);
|
llsdItem.asset_id = invItem.AssetID;
|
||||||
}
|
llsdItem.created_at = invItem.CreationDate;
|
||||||
catch{ }
|
llsdItem.desc = invItem.Description;
|
||||||
|
llsdItem.flags = (int)invItem.Flags;
|
||||||
|
llsdItem.item_id = invItem.ID;
|
||||||
|
llsdItem.name = invItem.Name;
|
||||||
|
llsdItem.parent_id = invItem.Folder;
|
||||||
|
llsdItem.type = invItem.AssetType;
|
||||||
|
llsdItem.inv_type = invItem.InvType;
|
||||||
|
|
||||||
StringBuilder lsl = LLSDxmlEncode.Start(4096);
|
llsdItem.permissions = new LLSDPermissions();
|
||||||
LLSDxmlEncode.AddMap(lsl);
|
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;
|
||||||
|
llsdItem.sale_info.sale_type = invItem.SaleType;
|
||||||
|
|
||||||
LLSDxmlEncode.AddElem("agent_id", m_agentID, lsl);
|
return llsdItem;
|
||||||
|
|
||||||
if (items == null || items.Length == 0)
|
|
||||||
{
|
|
||||||
LLSDxmlEncode.AddEmptyArray("items", lsl);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LLSDxmlEncode.AddArray("items", lsl);
|
|
||||||
foreach (InventoryItemBase item in items)
|
|
||||||
{
|
|
||||||
if (item != null)
|
|
||||||
item.ToLLSDxml(lsl, 0xff);
|
|
||||||
}
|
|
||||||
LLSDxmlEncode.AddEndArray(lsl);
|
|
||||||
}
|
|
||||||
|
|
||||||
LLSDxmlEncode.AddEndMap(lsl);
|
|
||||||
httpResponse.RawBuffer = Util.UTF8.GetBytes(LLSDxmlEncode.End(lsl));
|
|
||||||
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.IO;
|
using System.Net;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using log4net;
|
using log4net;
|
||||||
using log4net.Config;
|
using log4net.Config;
|
||||||
|
@ -46,7 +46,7 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class FetchInventoryDescendents2HandlerTests : OpenSimTestCase
|
public class FetchInventoryDescendents2HandlerTests : OpenSimTestCase
|
||||||
{
|
{
|
||||||
private UUID m_userID = new UUID("00000000-0000-0000-0000-000000000001");
|
private UUID m_userID = UUID.Zero;
|
||||||
private Scene m_scene;
|
private Scene m_scene;
|
||||||
private UUID m_rootFolderID;
|
private UUID m_rootFolderID;
|
||||||
private int m_rootDescendents;
|
private int m_rootDescendents;
|
||||||
|
@ -103,7 +103,6 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
|
||||||
|
|
||||||
// Add a folder
|
// Add a folder
|
||||||
InventoryFolderBase folder = new InventoryFolderBase(new UUID("f0000000-0000-0000-0000-00000000000f"), "Test Folder", m_userID, m_rootFolderID);
|
InventoryFolderBase folder = new InventoryFolderBase(new UUID("f0000000-0000-0000-0000-00000000000f"), "Test Folder", m_userID, m_rootFolderID);
|
||||||
folder.Type = (short)FolderType.None;
|
|
||||||
m_scene.InventoryService.AddFolder(folder);
|
m_scene.InventoryService.AddFolder(folder);
|
||||||
|
|
||||||
// Add a link to notecard 2 in Test Folder
|
// Add a link to notecard 2 in Test Folder
|
||||||
|
@ -127,19 +126,6 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
|
||||||
Console.WriteLine("Number of descendents: " + m_rootDescendents);
|
Console.WriteLine("Number of descendents: " + m_rootDescendents);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string dorequest(FetchInvDescHandler handler, string request)
|
|
||||||
{
|
|
||||||
TestOSHttpRequest req = new TestOSHttpRequest();
|
|
||||||
TestOSHttpResponse resp = new TestOSHttpResponse();
|
|
||||||
using(ExpiringKey<UUID> bad = new ExpiringKey<UUID>(5000)) // bad but this is test
|
|
||||||
using (MemoryStream ms = new MemoryStream(Utils.StringToBytes(request), false))
|
|
||||||
{
|
|
||||||
req.InputStream = ms;
|
|
||||||
handler.FetchInventoryDescendentsRequest(req, resp, bad);
|
|
||||||
}
|
|
||||||
return Util.UTF8.GetString(resp.RawBuffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_001_SimpleFolder()
|
public void Test_001_SimpleFolder()
|
||||||
{
|
{
|
||||||
|
@ -148,18 +134,18 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
FetchInvDescHandler handler = new FetchInvDescHandler(m_scene.InventoryService, null, m_scene);
|
FetchInvDescHandler handler = new FetchInvDescHandler(m_scene.InventoryService, null, m_scene);
|
||||||
|
TestOSHttpRequest req = new TestOSHttpRequest();
|
||||||
|
TestOSHttpResponse resp = new TestOSHttpResponse();
|
||||||
|
|
||||||
string request = "<llsd><map><key>folders</key><array><map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
|
string request = "<llsd><map><key>folders</key><array><map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
|
||||||
request += m_rootFolderID;
|
request += m_rootFolderID;
|
||||||
request += "</uuid><key>owner_id</key><uuid>";
|
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000000</uuid><key>sort_order</key><integer>1</integer></map></array></map></llsd>";
|
||||||
request += m_userID.ToString();
|
|
||||||
request += "</uuid><key>sort_order</key><integer>1</integer></map></array></map></llsd>";
|
|
||||||
|
|
||||||
string llsdresponse = dorequest(handler, request);
|
string llsdresponse = handler.FetchInventoryDescendentsRequest(request, "/FETCH", string.Empty, req, resp);
|
||||||
|
|
||||||
Assert.That(llsdresponse != null, Is.True, "Incorrect null response");
|
Assert.That(llsdresponse != null, Is.True, "Incorrect null response");
|
||||||
Assert.That(llsdresponse != string.Empty, Is.True, "Incorrect empty response");
|
Assert.That(llsdresponse != string.Empty, Is.True, "Incorrect empty response");
|
||||||
Assert.That(llsdresponse.Contains(m_userID.ToString()), Is.True, "Response should contain userID");
|
Assert.That(llsdresponse.Contains("00000000-0000-0000-0000-000000000000"), Is.True, "Response should contain userID");
|
||||||
|
|
||||||
string descendents = "descendents</key><integer>" + m_rootDescendents + "</integer>";
|
string descendents = "descendents</key><integer>" + m_rootDescendents + "</integer>";
|
||||||
Assert.That(llsdresponse.Contains(descendents), Is.True, "Incorrect number of descendents");
|
Assert.That(llsdresponse.Contains(descendents), Is.True, "Incorrect number of descendents");
|
||||||
|
@ -172,17 +158,19 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
|
||||||
TestHelpers.InMethod();
|
TestHelpers.InMethod();
|
||||||
|
|
||||||
FetchInvDescHandler handler = new FetchInvDescHandler(m_scene.InventoryService, null, m_scene);
|
FetchInvDescHandler handler = new FetchInvDescHandler(m_scene.InventoryService, null, m_scene);
|
||||||
|
TestOSHttpRequest req = new TestOSHttpRequest();
|
||||||
|
TestOSHttpResponse resp = new TestOSHttpResponse();
|
||||||
|
|
||||||
string request = "<llsd><map><key>folders</key><array>";
|
string request = "<llsd><map><key>folders</key><array>";
|
||||||
request += "<map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
|
request += "<map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
|
||||||
request += m_rootFolderID;
|
request += m_rootFolderID;
|
||||||
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000001</uuid><key>sort_order</key><integer>1</integer></map>";
|
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000000</uuid><key>sort_order</key><integer>1</integer></map>";
|
||||||
request += "<map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
|
request += "<map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
|
||||||
request += m_notecardsFolder;
|
request += m_notecardsFolder;
|
||||||
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000001</uuid><key>sort_order</key><integer>1</integer></map>";
|
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000000</uuid><key>sort_order</key><integer>1</integer></map>";
|
||||||
request += "</array></map></llsd>";
|
request += "</array></map></llsd>";
|
||||||
|
|
||||||
string llsdresponse = dorequest(handler, request);
|
string llsdresponse = handler.FetchInventoryDescendentsRequest(request, "/FETCH", string.Empty, req, resp);
|
||||||
Console.WriteLine(llsdresponse);
|
Console.WriteLine(llsdresponse);
|
||||||
|
|
||||||
string descendents = "descendents</key><integer>" + m_rootDescendents + "</integer>";
|
string descendents = "descendents</key><integer>" + m_rootDescendents + "</integer>";
|
||||||
|
@ -200,12 +188,14 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
|
||||||
TestHelpers.InMethod();
|
TestHelpers.InMethod();
|
||||||
|
|
||||||
FetchInvDescHandler handler = new FetchInvDescHandler(m_scene.InventoryService, null, m_scene);
|
FetchInvDescHandler handler = new FetchInvDescHandler(m_scene.InventoryService, null, m_scene);
|
||||||
|
TestOSHttpRequest req = new TestOSHttpRequest();
|
||||||
|
TestOSHttpResponse resp = new TestOSHttpResponse();
|
||||||
|
|
||||||
string request = "<llsd><map><key>folders</key><array><map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
|
string request = "<llsd><map><key>folders</key><array><map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
|
||||||
request += "f0000000-0000-0000-0000-00000000000f";
|
request += "f0000000-0000-0000-0000-00000000000f";
|
||||||
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000001</uuid><key>sort_order</key><integer>1</integer></map></array></map></llsd>";
|
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000000</uuid><key>sort_order</key><integer>1</integer></map></array></map></llsd>";
|
||||||
|
|
||||||
string llsdresponse = dorequest(handler, request);
|
string llsdresponse = handler.FetchInventoryDescendentsRequest(request, "/FETCH", string.Empty, req, resp);
|
||||||
Console.WriteLine(llsdresponse);
|
Console.WriteLine(llsdresponse);
|
||||||
|
|
||||||
string descendents = "descendents</key><integer>2</integer>";
|
string descendents = "descendents</key><integer>2</integer>";
|
||||||
|
@ -225,11 +215,10 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
|
||||||
// Make sure the folder link is included
|
// Make sure the folder link is included
|
||||||
Assert.That(llsdresponse.Contains("Link to Objects folder"), Is.True, "Link to Objects folder is missing");
|
Assert.That(llsdresponse.Contains("Link to Objects folder"), Is.True, "Link to Objects folder is missing");
|
||||||
|
|
||||||
/* contents of link folder are not supposed to be listed
|
|
||||||
// Make sure the objects inside the Objects folder are included
|
// Make sure the objects inside the Objects folder are included
|
||||||
// Note: I'm not entirely sure this is needed, but that's what I found in the implementation
|
// Note: I'm not entirely sure this is needed, but that's what I found in the implementation
|
||||||
Assert.That(llsdresponse.Contains("Some Object"), Is.True, "Some Object item (contents of the source) is missing");
|
Assert.That(llsdresponse.Contains("Some Object"), Is.True, "Some Object item (contents of the source) is missing");
|
||||||
*/
|
|
||||||
// Make sure that the source item is before the link item
|
// Make sure that the source item is before the link item
|
||||||
pos1 = llsdresponse.IndexOf("Some Object");
|
pos1 = llsdresponse.IndexOf("Some Object");
|
||||||
pos2 = llsdresponse.IndexOf("Link to Objects folder");
|
pos2 = llsdresponse.IndexOf("Link to Objects folder");
|
||||||
|
@ -242,6 +231,8 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
|
||||||
TestHelpers.InMethod();
|
TestHelpers.InMethod();
|
||||||
|
|
||||||
FetchInvDescHandler handler = new FetchInvDescHandler(m_scene.InventoryService, null, m_scene);
|
FetchInvDescHandler handler = new FetchInvDescHandler(m_scene.InventoryService, null, m_scene);
|
||||||
|
TestOSHttpRequest req = new TestOSHttpRequest();
|
||||||
|
TestOSHttpResponse resp = new TestOSHttpResponse();
|
||||||
|
|
||||||
string request = "<llsd><map><key>folders</key><array>";
|
string request = "<llsd><map><key>folders</key><array>";
|
||||||
request += "<map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
|
request += "<map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
|
||||||
|
@ -258,7 +249,7 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
|
||||||
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000000</uuid><key>sort_order</key><integer>1</integer></map>";
|
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000000</uuid><key>sort_order</key><integer>1</integer></map>";
|
||||||
request += "</array></map></llsd>";
|
request += "</array></map></llsd>";
|
||||||
|
|
||||||
string llsdresponse = dorequest(handler, request);
|
string llsdresponse = handler.FetchInventoryDescendentsRequest(request, "/FETCH", string.Empty, req, resp);
|
||||||
Console.WriteLine(llsdresponse);
|
Console.WriteLine(llsdresponse);
|
||||||
|
|
||||||
string root_folder = "<key>folder_id</key><uuid>" + m_rootFolderID + "</uuid>";
|
string root_folder = "<key>folder_id</key><uuid>" + m_rootFolderID + "</uuid>";
|
||||||
|
@ -275,26 +266,27 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_005_FolderZero()
|
public void Test_005_FolderZero()
|
||||||
{
|
{
|
||||||
|
|
||||||
TestHelpers.InMethod();
|
TestHelpers.InMethod();
|
||||||
|
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
FetchInvDescHandler handler = new FetchInvDescHandler(m_scene.InventoryService, null, m_scene);
|
FetchInvDescHandler handler = new FetchInvDescHandler(m_scene.InventoryService, null, m_scene);
|
||||||
|
TestOSHttpRequest req = new TestOSHttpRequest();
|
||||||
|
TestOSHttpResponse resp = new TestOSHttpResponse();
|
||||||
|
|
||||||
string request = "<llsd><map><key>folders</key><array><map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
|
string request = "<llsd><map><key>folders</key><array><map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
|
||||||
request += UUID.Zero;
|
request += UUID.Zero;
|
||||||
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000000</uuid><key>sort_order</key><integer>1</integer></map></array></map></llsd>";
|
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000000</uuid><key>sort_order</key><integer>1</integer></map></array></map></llsd>";
|
||||||
|
|
||||||
string llsdresponse = dorequest(handler, request);
|
string llsdresponse = handler.FetchInventoryDescendentsRequest(request, "/FETCH", string.Empty, req, resp);
|
||||||
|
|
||||||
Assert.That(llsdresponse != null, Is.True, "Incorrect null response");
|
Assert.That(llsdresponse != null, Is.True, "Incorrect null response");
|
||||||
Assert.That(llsdresponse != string.Empty, Is.True, "Incorrect empty response");
|
Assert.That(llsdresponse != string.Empty, Is.True, "Incorrect empty response");
|
||||||
// we do return a answer now
|
Assert.That(llsdresponse.Contains("bad_folders</key><array><uuid>00000000-0000-0000-0000-000000000000"), Is.True, "Folder Zero should be a bad folder");
|
||||||
//Assert.That(llsdresponse.Contains("bad_folders</key><array><uuid>00000000-0000-0000-0000-000000000000"), Is.True, "Folder Zero should be a bad folder");
|
|
||||||
|
|
||||||
Console.WriteLine(llsdresponse);
|
Console.WriteLine(llsdresponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,190 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.Net;
|
|
||||||
using System.Reflection;
|
|
||||||
using log4net;
|
|
||||||
using Nini.Config;
|
|
||||||
using OpenMetaverse;
|
|
||||||
using OpenMetaverse.StructuredData;
|
|
||||||
using OpenSim.Framework;
|
|
||||||
using OpenSim.Framework.Servers;
|
|
||||||
using OpenSim.Framework.Servers.HttpServer;
|
|
||||||
using OpenSim.Services.Interfaces;
|
|
||||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
|
||||||
|
|
||||||
namespace OpenSim.Capabilities.Handlers
|
|
||||||
{
|
|
||||||
public class GetAssetsHandler
|
|
||||||
{
|
|
||||||
private static readonly ILog m_log =
|
|
||||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
|
||||||
|
|
||||||
private static readonly Dictionary<string, AssetType> queryTypes = new Dictionary<string, AssetType>()
|
|
||||||
{
|
|
||||||
{"texture_id", AssetType.Texture},
|
|
||||||
{"sound_id", AssetType.Sound},
|
|
||||||
{"callcard_id", AssetType.CallingCard},
|
|
||||||
{"landmark_id", AssetType.Landmark},
|
|
||||||
{"script_id", AssetType.LSLText},
|
|
||||||
{"clothing_id", AssetType.Clothing},
|
|
||||||
{"object_id", AssetType.Object},
|
|
||||||
{"notecard_id", AssetType.Notecard},
|
|
||||||
{"lsltext_id", AssetType.LSLText},
|
|
||||||
{"lslbyte_id", AssetType.LSLBytecode},
|
|
||||||
{"txtr_tga_id", AssetType.TextureTGA},
|
|
||||||
{"bodypart_id", AssetType.Bodypart},
|
|
||||||
{"snd_wav_id", AssetType.SoundWAV},
|
|
||||||
{"img_tga_id", AssetType.ImageTGA},
|
|
||||||
{"jpeg_id", AssetType.ImageJPEG},
|
|
||||||
{"animatn_id", AssetType.Animation},
|
|
||||||
{"gesture_id", AssetType.Gesture},
|
|
||||||
{"mesh_id", AssetType.Mesh},
|
|
||||||
{"settings_id", AssetType.Settings}
|
|
||||||
};
|
|
||||||
|
|
||||||
private IAssetService m_assetService;
|
|
||||||
|
|
||||||
public GetAssetsHandler(IAssetService assService)
|
|
||||||
{
|
|
||||||
m_assetService = assService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Handle(OSHttpRequest req, OSHttpResponse response)
|
|
||||||
{
|
|
||||||
response.ContentType = "text/plain";
|
|
||||||
|
|
||||||
if (m_assetService == null)
|
|
||||||
{
|
|
||||||
response.StatusCode = (int)HttpStatusCode.ServiceUnavailable;
|
|
||||||
response.KeepAlive = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
response.StatusCode = (int)HttpStatusCode.BadRequest;
|
|
||||||
|
|
||||||
var queries = req.QueryAsDictionary;
|
|
||||||
if(queries.Count == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
AssetType type = AssetType.Unknown;
|
|
||||||
string assetStr = string.Empty;
|
|
||||||
foreach (KeyValuePair<string,string> kvp in queries)
|
|
||||||
{
|
|
||||||
if (queryTypes.ContainsKey(kvp.Key))
|
|
||||||
{
|
|
||||||
type = queryTypes[kvp.Key];
|
|
||||||
assetStr = kvp.Value;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(type == AssetType.Unknown)
|
|
||||||
{
|
|
||||||
//m_log.Warn("[GETASSET]: Unknown type: " + query);
|
|
||||||
m_log.Warn("[GETASSET]: Unknown type");
|
|
||||||
response.StatusCode = (int)HttpStatusCode.NotFound;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (String.IsNullOrEmpty(assetStr))
|
|
||||||
return;
|
|
||||||
|
|
||||||
UUID assetID = UUID.Zero;
|
|
||||||
if(!UUID.TryParse(assetStr, out assetID))
|
|
||||||
return;
|
|
||||||
|
|
||||||
AssetBase asset = m_assetService.Get(assetID.ToString());
|
|
||||||
if(asset == null)
|
|
||||||
{
|
|
||||||
// m_log.Warn("[GETASSET]: not found: " + query + " " + assetStr);
|
|
||||||
response.StatusCode = (int)HttpStatusCode.NotFound;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (asset.Type != (sbyte)type)
|
|
||||||
return;
|
|
||||||
|
|
||||||
int len = asset.Data.Length;
|
|
||||||
|
|
||||||
string range = null;
|
|
||||||
if (req.Headers["Range"] != null)
|
|
||||||
range = req.Headers["Range"];
|
|
||||||
else if (req.Headers["range"] != null)
|
|
||||||
range = req.Headers["range"];
|
|
||||||
|
|
||||||
// range request
|
|
||||||
int start, end;
|
|
||||||
if (Util.TryParseHttpRange(range, out start, out end))
|
|
||||||
{
|
|
||||||
// Before clamping start make sure we can satisfy it in order to avoid
|
|
||||||
// sending back the last byte instead of an error status
|
|
||||||
if (start >= asset.Data.Length)
|
|
||||||
{
|
|
||||||
response.StatusCode = (int)HttpStatusCode.RequestedRangeNotSatisfiable;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (end == -1)
|
|
||||||
end = asset.Data.Length - 1;
|
|
||||||
else
|
|
||||||
end = Utils.Clamp(end, 0, asset.Data.Length - 1);
|
|
||||||
|
|
||||||
start = Utils.Clamp(start, 0, end);
|
|
||||||
len = end - start + 1;
|
|
||||||
|
|
||||||
//m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
|
|
||||||
response.AddHeader("Content-Range", String.Format("bytes {0}-{1}/{2}", start, end, asset.Data.Length));
|
|
||||||
response.StatusCode = (int)HttpStatusCode.PartialContent;
|
|
||||||
response.RawBufferStart = start;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
response.StatusCode = (int)HttpStatusCode.OK;
|
|
||||||
|
|
||||||
response.ContentType = asset.Metadata.ContentType;
|
|
||||||
response.RawBuffer = asset.Data;
|
|
||||||
response.RawBufferLen = len;
|
|
||||||
if (type == AssetType.Mesh || type == AssetType.Texture)
|
|
||||||
{
|
|
||||||
if(len > 8196)
|
|
||||||
{
|
|
||||||
//if(type == AssetType.Texture && ((asset.Flags & AssetFlags.AvatarBake)!= 0))
|
|
||||||
// responsedata["prio"] = 1;
|
|
||||||
//else
|
|
||||||
response.Priority = 2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
response.Priority = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
response.Priority = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,120 @@
|
||||||
|
/*
|
||||||
|
* 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.Collections.Specialized;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.IO;
|
||||||
|
using System.Web;
|
||||||
|
using log4net;
|
||||||
|
using Nini.Config;
|
||||||
|
using OpenMetaverse;
|
||||||
|
using OpenMetaverse.StructuredData;
|
||||||
|
using OpenMetaverse.Imaging;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Framework.Capabilities;
|
||||||
|
using OpenSim.Framework.Servers;
|
||||||
|
using OpenSim.Framework.Servers.HttpServer;
|
||||||
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||||
|
using OSDMap = OpenMetaverse.StructuredData.OSDMap;
|
||||||
|
using OSDArray = OpenMetaverse.StructuredData.OSDArray;
|
||||||
|
|
||||||
|
namespace OpenSim.Capabilities.Handlers
|
||||||
|
{
|
||||||
|
public class GetDisplayNamesHandler : BaseStreamHandler
|
||||||
|
{
|
||||||
|
private static readonly ILog m_log =
|
||||||
|
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
private IUserManagement m_UserManagement;
|
||||||
|
|
||||||
|
public GetDisplayNamesHandler(string path, IUserManagement umService, string name, string description)
|
||||||
|
: base("GET", path, name, description)
|
||||||
|
{
|
||||||
|
m_UserManagement = umService;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[GET_DISPLAY_NAMES]: called {0}", httpRequest.Url.Query);
|
||||||
|
|
||||||
|
NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
|
||||||
|
string[] ids = query.GetValues("ids");
|
||||||
|
|
||||||
|
|
||||||
|
if (m_UserManagement == null)
|
||||||
|
{
|
||||||
|
m_log.Error("[GET_DISPLAY_NAMES]: Cannot fetch display names without a user management component");
|
||||||
|
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.InternalServerError;
|
||||||
|
return new byte[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
OSDMap osdReply = new OSDMap();
|
||||||
|
OSDArray agents = new OSDArray();
|
||||||
|
|
||||||
|
osdReply["agents"] = agents;
|
||||||
|
foreach (string id in ids)
|
||||||
|
{
|
||||||
|
UUID uuid = UUID.Zero;
|
||||||
|
if (UUID.TryParse(id, out uuid))
|
||||||
|
{
|
||||||
|
string name = m_UserManagement.GetUserName(uuid);
|
||||||
|
if (!string.IsNullOrEmpty(name))
|
||||||
|
{
|
||||||
|
string[] parts = name.Split(new char[] {' '});
|
||||||
|
OSDMap osdname = new OSDMap();
|
||||||
|
osdname["display_name_next_update"] = OSD.FromDate(DateTime.MinValue);
|
||||||
|
osdname["display_name_expires"] = OSD.FromDate(DateTime.Now.AddMonths(1));
|
||||||
|
osdname["display_name"] = OSD.FromString(name);
|
||||||
|
osdname["legacy_first_name"] = parts[0];
|
||||||
|
osdname["legacy_last_name"] = parts[1];
|
||||||
|
osdname["username"] = OSD.FromString(name);
|
||||||
|
osdname["id"] = OSD.FromUUID(uuid);
|
||||||
|
osdname["is_display_name_default"] = OSD.FromBoolean(true);
|
||||||
|
|
||||||
|
agents.Add(osdname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Full content request
|
||||||
|
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.OK;
|
||||||
|
//httpResponse.ContentLength = ??;
|
||||||
|
httpResponse.ContentType = "application/llsd+xml";
|
||||||
|
|
||||||
|
string reply = OSDParser.SerializeLLSDXmlString(osdReply);
|
||||||
|
return System.Text.Encoding.UTF8.GetBytes(reply);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -35,13 +35,13 @@ using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Capabilities.Handlers
|
namespace OpenSim.Capabilities.Handlers
|
||||||
{
|
{
|
||||||
public class FetchInventory2ServerConnector : ServiceConnector
|
public class GetDisplayNamesServerConnector : ServiceConnector
|
||||||
{
|
{
|
||||||
private IInventoryService m_InventoryService;
|
private IUserManagement m_UserManagement;
|
||||||
private string m_ConfigName = "CapsService";
|
private string m_ConfigName = "CapsService";
|
||||||
|
|
||||||
public FetchInventory2ServerConnector(IConfigSource config, IHttpServer server, string configName)
|
public GetDisplayNamesServerConnector(IConfigSource config, IHttpServer server, string configName) :
|
||||||
: base(config, server, configName)
|
base(config, server, configName)
|
||||||
{
|
{
|
||||||
if (configName != String.Empty)
|
if (configName != String.Empty)
|
||||||
m_ConfigName = configName;
|
m_ConfigName = configName;
|
||||||
|
@ -50,22 +50,22 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
if (serverConfig == null)
|
if (serverConfig == null)
|
||||||
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
|
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
|
||||||
|
|
||||||
string invService = serverConfig.GetString("InventoryService", String.Empty);
|
string umService = serverConfig.GetString("AssetService", String.Empty);
|
||||||
|
|
||||||
if (invService == String.Empty)
|
if (umService == String.Empty)
|
||||||
throw new Exception("No InventoryService in config file");
|
throw new Exception("No AssetService in config file");
|
||||||
|
|
||||||
Object[] args = new Object[] { config };
|
Object[] args = new Object[] { config };
|
||||||
m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args);
|
m_UserManagement =
|
||||||
|
ServerUtils.LoadPlugin<IUserManagement>(umService, args);
|
||||||
|
|
||||||
if (m_InventoryService == null)
|
if (m_UserManagement == null)
|
||||||
throw new Exception(String.Format("Failed to load InventoryService from {0}; config is {1}", invService, m_ConfigName));
|
throw new Exception(String.Format("Failed to load UserManagement from {0}; config is {1}", umService, m_ConfigName));
|
||||||
|
|
||||||
FetchInventory2Handler fiHandler = new FetchInventory2Handler(m_InventoryService, UUID.Zero);
|
string rurl = serverConfig.GetString("GetTextureRedirectURL");
|
||||||
IRequestHandler reqHandler
|
|
||||||
= new RestStreamHandler(
|
server.AddStreamHandler(
|
||||||
"POST", "/CAPS/FetchInventory/", fiHandler.FetchInventoryRequest, "FetchInventory", null);
|
new GetDisplayNamesHandler("/CAPS/agents/", m_UserManagement, "GetDisplayNames", null));
|
||||||
server.AddStreamHandler(reqHandler);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -25,131 +25,229 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Specialized;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.IO;
|
|
||||||
using System.Web;
|
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nini.Config;
|
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenMetaverse.StructuredData;
|
using OpenMetaverse.Imaging;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Servers;
|
|
||||||
using OpenSim.Framework.Servers.HttpServer;
|
using OpenSim.Framework.Servers.HttpServer;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
using System;
|
||||||
|
using System.Collections.Specialized;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Web;
|
||||||
|
|
||||||
namespace OpenSim.Capabilities.Handlers
|
namespace OpenSim.Capabilities.Handlers
|
||||||
{
|
{
|
||||||
public class GetMeshHandler
|
public class GetMeshHandler : BaseStreamHandler
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log =
|
private static readonly ILog m_log =
|
||||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private IAssetService m_assetService;
|
private IAssetService m_assetService;
|
||||||
|
|
||||||
public const string DefaultFormat = "vnd.ll.mesh";
|
// TODO: Change this to a config option
|
||||||
|
private string m_RedirectURL = null;
|
||||||
|
|
||||||
public GetMeshHandler(IAssetService assService)
|
public GetMeshHandler(string path, IAssetService assService, string name, string description, string redirectURL)
|
||||||
|
: base("GET", path, name, description)
|
||||||
{
|
{
|
||||||
m_assetService = assService;
|
m_assetService = assService;
|
||||||
}
|
m_RedirectURL = redirectURL;
|
||||||
public Hashtable Handle(Hashtable request)
|
if (m_RedirectURL != null && !m_RedirectURL.EndsWith("/"))
|
||||||
{
|
m_RedirectURL += "/";
|
||||||
return ProcessGetMesh(request, UUID.Zero, null); ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Hashtable ProcessGetMesh(Hashtable request, UUID AgentId, Caps cap)
|
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||||
{
|
{
|
||||||
Hashtable responsedata = new Hashtable();
|
// Try to parse the texture ID from the request URL
|
||||||
|
NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
|
||||||
|
string textureStr = query.GetOne("mesh_id");
|
||||||
|
|
||||||
if (m_assetService == null)
|
if (m_assetService == null)
|
||||||
{
|
{
|
||||||
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.ServiceUnavailable;
|
m_log.Error("[GETMESH]: Cannot fetch mesh " + textureStr + " without an asset service");
|
||||||
responsedata["str_response_string"] = "The asset service is unavailable";
|
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||||
responsedata["keepalive"] = false;
|
|
||||||
return responsedata;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.BadRequest;
|
UUID meshID;
|
||||||
responsedata["content_type"] = "text/plain";
|
if (!String.IsNullOrEmpty(textureStr) && UUID.TryParse(textureStr, out meshID))
|
||||||
responsedata["int_bytes"] = 0;
|
|
||||||
|
|
||||||
string meshStr = string.Empty;
|
|
||||||
if (request.ContainsKey("mesh_id"))
|
|
||||||
meshStr = request["mesh_id"].ToString();
|
|
||||||
|
|
||||||
if (String.IsNullOrEmpty(meshStr))
|
|
||||||
return responsedata;
|
|
||||||
|
|
||||||
UUID meshID = UUID.Zero;
|
|
||||||
if(!UUID.TryParse(meshStr, out meshID))
|
|
||||||
return responsedata;
|
|
||||||
|
|
||||||
AssetBase mesh = m_assetService.Get(meshID.ToString());
|
|
||||||
if(mesh == null)
|
|
||||||
{
|
{
|
||||||
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.NotFound;
|
// OK, we have an array with preferred formats, possibly with only one entry
|
||||||
responsedata["str_response_string"] = "Mesh not found.";
|
|
||||||
return responsedata;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mesh.Type != (SByte)AssetType.Mesh)
|
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||||
|
AssetBase mesh;
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(m_RedirectURL))
|
||||||
{
|
{
|
||||||
responsedata["str_response_string"] = "Asset isn't a mesh.";
|
// Only try to fetch locally cached meshes. Misses are redirected
|
||||||
return responsedata;
|
mesh = m_assetService.GetCached(meshID.ToString());
|
||||||
}
|
|
||||||
|
|
||||||
string range = String.Empty;
|
if (mesh != null)
|
||||||
|
|
||||||
if (((Hashtable)request["headers"])["range"] != null)
|
|
||||||
range = (string)((Hashtable)request["headers"])["range"];
|
|
||||||
else if (((Hashtable)request["headers"])["Range"] != null)
|
|
||||||
range = (string)((Hashtable)request["headers"])["Range"];
|
|
||||||
|
|
||||||
responsedata["content_type"] = "application/vnd.ll.mesh";
|
|
||||||
if (String.IsNullOrEmpty(range))
|
|
||||||
{
|
{
|
||||||
// full mesh
|
if (mesh.Type != (sbyte)AssetType.Mesh)
|
||||||
responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data);
|
{
|
||||||
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.OK;
|
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||||
return responsedata;
|
}
|
||||||
|
WriteMeshData(httpRequest, httpResponse, mesh);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string textureUrl = m_RedirectURL + "?mesh_id="+ meshID.ToString();
|
||||||
|
m_log.Debug("[GETMESH]: Redirecting mesh request to " + textureUrl);
|
||||||
|
httpResponse.StatusCode = (int)OSHttpStatusCode.RedirectMovedPermanently;
|
||||||
|
httpResponse.RedirectLocation = textureUrl;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // no redirect
|
||||||
|
{
|
||||||
|
// try the cache
|
||||||
|
mesh = m_assetService.GetCached(meshID.ToString());
|
||||||
|
|
||||||
|
if (mesh == null)
|
||||||
|
{
|
||||||
|
// Fetch locally or remotely. Misses return a 404
|
||||||
|
mesh = m_assetService.Get(meshID.ToString());
|
||||||
|
|
||||||
|
if (mesh != null)
|
||||||
|
{
|
||||||
|
if (mesh.Type != (sbyte)AssetType.Mesh)
|
||||||
|
{
|
||||||
|
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
WriteMeshData(httpRequest, httpResponse, mesh);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // it was on the cache
|
||||||
|
{
|
||||||
|
if (mesh.Type != (sbyte)AssetType.Mesh)
|
||||||
|
{
|
||||||
|
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
WriteMeshData(httpRequest, httpResponse, mesh);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// range request
|
// not found
|
||||||
|
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.Warn("[GETTEXTURE]: Failed to parse a mesh_id from GetMesh request: " + httpRequest.Url);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WriteMeshData(IOSHttpRequest request, IOSHttpResponse response, AssetBase texture)
|
||||||
|
{
|
||||||
|
string range = request.Headers.GetOne("Range");
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(range))
|
||||||
|
{
|
||||||
|
// Range request
|
||||||
int start, end;
|
int start, end;
|
||||||
if (Util.TryParseHttpRange(range, out start, out end))
|
if (TryParseRange(range, out start, out end))
|
||||||
{
|
{
|
||||||
// Before clamping start make sure we can satisfy it in order to avoid
|
// Before clamping start make sure we can satisfy it in order to avoid
|
||||||
// sending back the last byte instead of an error status
|
// sending back the last byte instead of an error status
|
||||||
if (start >= mesh.Data.Length)
|
if (start >= texture.Data.Length)
|
||||||
{
|
{
|
||||||
responsedata["str_response_string"] = "This range doesnt exist.";
|
response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent;
|
||||||
return responsedata;
|
response.ContentType = texture.Metadata.ContentType;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Handle the case where no second range value was given. This is equivalent to requesting
|
||||||
|
// the rest of the entity.
|
||||||
|
if (end == -1)
|
||||||
|
end = int.MaxValue;
|
||||||
|
|
||||||
end = Utils.Clamp(end, 0, mesh.Data.Length - 1);
|
end = Utils.Clamp(end, 0, texture.Data.Length - 1);
|
||||||
start = Utils.Clamp(start, 0, end);
|
start = Utils.Clamp(start, 0, end);
|
||||||
int len = end - start + 1;
|
int len = end - start + 1;
|
||||||
|
|
||||||
//m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
|
if (0 == start && len == texture.Data.Length)
|
||||||
Hashtable headers = new Hashtable();
|
{
|
||||||
headers["Content-Range"] = String.Format("bytes {0}-{1}/{2}", start, end, mesh.Data.Length);
|
response.StatusCode = (int)System.Net.HttpStatusCode.OK;
|
||||||
responsedata["headers"] = headers;
|
}
|
||||||
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.PartialContent;
|
else
|
||||||
|
{
|
||||||
byte[] d = new byte[len];
|
response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent;
|
||||||
Array.Copy(mesh.Data, start, d, 0, len);
|
response.AddHeader("Content-Range", String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length));
|
||||||
responsedata["bin_response_data"] = d;
|
|
||||||
responsedata["int_bytes"] = len;
|
|
||||||
return responsedata;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.Warn("[GETMESH]: Failed to parse a range from GetMesh request, sending full asset: " + (string)request["uri"]);
|
response.ContentLength = len;
|
||||||
responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data);
|
response.ContentType = "application/vnd.ll.mesh";
|
||||||
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.OK;
|
|
||||||
return responsedata;
|
response.Body.Write(texture.Data, start, len);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.Warn("[GETMESH]: Malformed Range header: " + range);
|
||||||
|
response.StatusCode = (int)System.Net.HttpStatusCode.BadRequest;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Full content request
|
||||||
|
response.StatusCode = (int)System.Net.HttpStatusCode.OK;
|
||||||
|
response.ContentLength = texture.Data.Length;
|
||||||
|
response.ContentType = "application/vnd.ll.mesh";
|
||||||
|
response.Body.Write(texture.Data, 0, texture.Data.Length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Parse a range header.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// As per http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html,
|
||||||
|
/// this obeys range headers with two values (e.g. 533-4165) and no second value (e.g. 533-).
|
||||||
|
/// Where there is no value, -1 is returned.
|
||||||
|
/// FIXME: Need to cover the case where only a second value is specified (e.g. -4165), probably by returning -1
|
||||||
|
/// for start.</remarks>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <param name='header'></param>
|
||||||
|
/// <param name='start'>Start of the range. Undefined if this was not a number.</param>
|
||||||
|
/// <param name='end'>End of the range. Will be -1 if no end specified. Undefined if there was a raw string but this was not a number.</param>
|
||||||
|
private bool TryParseRange(string header, out int start, out int end)
|
||||||
|
{
|
||||||
|
start = end = 0;
|
||||||
|
|
||||||
|
if (header.StartsWith("bytes="))
|
||||||
|
{
|
||||||
|
string[] rangeValues = header.Substring(6).Split('-');
|
||||||
|
|
||||||
|
if (rangeValues.Length == 2)
|
||||||
|
{
|
||||||
|
if (!Int32.TryParse(rangeValues[0], out start))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
string rawEnd = rangeValues[1];
|
||||||
|
|
||||||
|
if (rawEnd == "")
|
||||||
|
{
|
||||||
|
end = -1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (Int32.TryParse(rawEnd, out end))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
start = end = 0;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -64,15 +64,13 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
|
|
||||||
string rurl = serverConfig.GetString("GetMeshRedirectURL");
|
string rurl = serverConfig.GetString("GetMeshRedirectURL");
|
||||||
|
|
||||||
GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService);
|
server.AddStreamHandler(
|
||||||
IRequestHandler reqHandler
|
new GetTextureHandler("/CAPS/GetMesh/" /*+ UUID.Random() */, m_AssetService, "GetMesh", null, rurl));
|
||||||
= new RestHTTPHandler(
|
|
||||||
"GET",
|
rurl = serverConfig.GetString("GetMesh2RedirectURL");
|
||||||
"/" + UUID.Random(),
|
|
||||||
httpMethod => gmeshHandler.ProcessGetMesh(httpMethod, UUID.Zero, null),
|
server.AddStreamHandler(
|
||||||
"GetMesh",
|
new GetTextureHandler("/CAPS/GetMesh2/" /*+ UUID.Random() */, m_AssetService, "GetMesh2", null, rurl));
|
||||||
null);
|
|
||||||
server.AddStreamHandler(reqHandler); ;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -47,34 +47,39 @@ using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||||
|
|
||||||
namespace OpenSim.Capabilities.Handlers
|
namespace OpenSim.Capabilities.Handlers
|
||||||
{
|
{
|
||||||
public class GetTextureHandler
|
public class GetTextureHandler : BaseStreamHandler
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log =
|
private static readonly ILog m_log =
|
||||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private IAssetService m_assetService;
|
private IAssetService m_assetService;
|
||||||
|
|
||||||
public const string DefaultFormat = "x-j2c";
|
public const string DefaultFormat = "x-j2c";
|
||||||
|
|
||||||
public GetTextureHandler(IAssetService assService)
|
// TODO: Change this to a config option
|
||||||
|
private string m_RedirectURL = null;
|
||||||
|
|
||||||
|
public GetTextureHandler(string path, IAssetService assService, string name, string description, string redirectURL)
|
||||||
|
: base("GET", path, name, description)
|
||||||
{
|
{
|
||||||
m_assetService = assService;
|
m_assetService = assService;
|
||||||
|
m_RedirectURL = redirectURL;
|
||||||
|
if (m_RedirectURL != null && !m_RedirectURL.EndsWith("/"))
|
||||||
|
m_RedirectURL += "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
public Hashtable Handle(Hashtable request)
|
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||||
{
|
{
|
||||||
Hashtable ret = new Hashtable();
|
// Try to parse the texture ID from the request URL
|
||||||
ret["int_response_code"] = (int)System.Net.HttpStatusCode.NotFound;
|
NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
|
||||||
ret["content_type"] = "text/plain";
|
string textureStr = query.GetOne("texture_id");
|
||||||
ret["int_bytes"] = 0;
|
string format = query.GetOne("format");
|
||||||
string textureStr = (string)request["texture_id"];
|
|
||||||
string format = (string)request["format"];
|
|
||||||
|
|
||||||
//m_log.DebugFormat("[GETTEXTURE]: called {0}", textureStr);
|
//m_log.DebugFormat("[GETTEXTURE]: called {0}", textureStr);
|
||||||
|
|
||||||
if (m_assetService == null)
|
if (m_assetService == null)
|
||||||
{
|
{
|
||||||
m_log.Error("[GETTEXTURE]: Cannot fetch texture " + textureStr + " without an asset service");
|
m_log.Error("[GETTEXTURE]: Cannot fetch texture " + textureStr + " without an asset service");
|
||||||
|
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
UUID textureID;
|
UUID textureID;
|
||||||
|
@ -89,39 +94,30 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
formats = new string[1] { DefaultFormat }; // default
|
formats = WebUtil.GetPreferredImageTypes(httpRequest.Headers.Get("Accept"));
|
||||||
if (((Hashtable)request["headers"])["Accept"] != null)
|
|
||||||
formats = WebUtil.GetPreferredImageTypes((string)((Hashtable)request["headers"])["Accept"]);
|
|
||||||
if (formats.Length == 0)
|
if (formats.Length == 0)
|
||||||
formats = new string[1] { DefaultFormat }; // default
|
formats = new string[1] { DefaultFormat }; // default
|
||||||
|
|
||||||
}
|
}
|
||||||
// OK, we have an array with preferred formats, possibly with only one entry
|
// OK, we have an array with preferred formats, possibly with only one entry
|
||||||
bool foundtexture = false;
|
|
||||||
|
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||||
foreach (string f in formats)
|
foreach (string f in formats)
|
||||||
{
|
{
|
||||||
foundtexture = FetchTexture(request, ret, textureID, f);
|
if (FetchTexture(httpRequest, httpResponse, textureID, f))
|
||||||
if (foundtexture)
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!foundtexture)
|
|
||||||
{
|
|
||||||
ret["int_response_code"] = 404;
|
|
||||||
ret["error_status_text"] = "not found";
|
|
||||||
ret["str_response_string"] = "not found";
|
|
||||||
ret["content_type"] = "text/plain";
|
|
||||||
ret["int_bytes"] = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.Warn("[GETTEXTURE]: Failed to parse a texture_id from GetTexture request: " + (string)request["uri"]);
|
m_log.Warn("[GETTEXTURE]: Failed to parse a texture_id from GetTexture request: " + httpRequest.Url);
|
||||||
}
|
}
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[GETTEXTURE]: For texture {0} sending back response {1}, data length {2}",
|
// "[GETTEXTURE]: For texture {0} sending back response {1}, data length {2}",
|
||||||
// textureID, httpResponse.StatusCode, httpResponse.ContentLength);
|
// textureID, httpResponse.StatusCode, httpResponse.ContentLength);
|
||||||
return ret;
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -132,7 +128,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
/// <param name="textureID"></param>
|
/// <param name="textureID"></param>
|
||||||
/// <param name="format"></param>
|
/// <param name="format"></param>
|
||||||
/// <returns>False for "caller try another codec"; true otherwise</returns>
|
/// <returns>False for "caller try another codec"; true otherwise</returns>
|
||||||
private bool FetchTexture(Hashtable request, Hashtable response, UUID textureID, string format)
|
private bool FetchTexture(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, UUID textureID, string format)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[GETTEXTURE]: {0} with requested format {1}", textureID, format);
|
// m_log.DebugFormat("[GETTEXTURE]: {0} with requested format {1}", textureID, format);
|
||||||
AssetBase texture;
|
AssetBase texture;
|
||||||
|
@ -141,12 +137,37 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
if (format != DefaultFormat)
|
if (format != DefaultFormat)
|
||||||
fullID = fullID + "-" + format;
|
fullID = fullID + "-" + format;
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(m_RedirectURL))
|
||||||
|
{
|
||||||
|
// Only try to fetch locally cached textures. Misses are redirected
|
||||||
|
texture = m_assetService.GetCached(fullID);
|
||||||
|
|
||||||
|
if (texture != null)
|
||||||
|
{
|
||||||
|
if (texture.Type != (sbyte)AssetType.Texture)
|
||||||
|
{
|
||||||
|
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
WriteTextureData(httpRequest, httpResponse, texture, format);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string textureUrl = m_RedirectURL + "?texture_id="+ textureID.ToString();
|
||||||
|
m_log.Debug("[GETTEXTURE]: Redirecting texture request to " + textureUrl);
|
||||||
|
httpResponse.StatusCode = (int)OSHttpStatusCode.RedirectMovedPermanently;
|
||||||
|
httpResponse.RedirectLocation = textureUrl;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // no redirect
|
||||||
|
{
|
||||||
// try the cache
|
// try the cache
|
||||||
texture = m_assetService.GetCached(fullID);
|
texture = m_assetService.GetCached(fullID);
|
||||||
|
|
||||||
if (texture == null)
|
if (texture == null)
|
||||||
{
|
{
|
||||||
//m_log.DebugFormat("[GETTEXTURE]: texture was not in the cache");
|
// m_log.DebugFormat("[GETTEXTURE]: texture was not in the cache");
|
||||||
|
|
||||||
// Fetch locally or remotely. Misses return a 404
|
// Fetch locally or remotely. Misses return a 404
|
||||||
texture = m_assetService.Get(textureID.ToString());
|
texture = m_assetService.Get(textureID.ToString());
|
||||||
|
@ -154,11 +175,13 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
if (texture != null)
|
if (texture != null)
|
||||||
{
|
{
|
||||||
if (texture.Type != (sbyte)AssetType.Texture)
|
if (texture.Type != (sbyte)AssetType.Texture)
|
||||||
|
{
|
||||||
|
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
if (format == DefaultFormat)
|
if (format == DefaultFormat)
|
||||||
{
|
{
|
||||||
WriteTextureData(request, response, texture, format);
|
WriteTextureData(httpRequest, httpResponse, texture, format);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -172,45 +195,34 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
newTexture.Temporary = true;
|
newTexture.Temporary = true;
|
||||||
newTexture.Local = true;
|
newTexture.Local = true;
|
||||||
m_assetService.Store(newTexture);
|
m_assetService.Store(newTexture);
|
||||||
WriteTextureData(request, response, newTexture, format);
|
WriteTextureData(httpRequest, httpResponse, newTexture, format);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // it was on the cache
|
else // it was on the cache
|
||||||
{
|
{
|
||||||
//m_log.DebugFormat("[GETTEXTURE]: texture was in the cache");
|
// m_log.DebugFormat("[GETTEXTURE]: texture was in the cache");
|
||||||
WriteTextureData(request, response, texture, format);
|
WriteTextureData(httpRequest, httpResponse, texture, format);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// not found
|
||||||
|
// m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found");
|
||||||
|
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//response = new Hashtable();
|
private void WriteTextureData(IOSHttpRequest request, IOSHttpResponse response, AssetBase texture, string format)
|
||||||
|
|
||||||
|
|
||||||
//WriteTextureData(request,response,null,format);
|
|
||||||
// not found
|
|
||||||
//m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void WriteTextureData(Hashtable request, Hashtable response, AssetBase texture, string format)
|
|
||||||
{
|
{
|
||||||
Hashtable headers = new Hashtable();
|
string range = request.Headers.GetOne("Range");
|
||||||
response["headers"] = headers;
|
|
||||||
|
|
||||||
string range = String.Empty;
|
|
||||||
|
|
||||||
if (((Hashtable)request["headers"])["range"] != null)
|
|
||||||
range = (string)((Hashtable)request["headers"])["range"];
|
|
||||||
|
|
||||||
else if (((Hashtable)request["headers"])["Range"] != null)
|
|
||||||
range = (string)((Hashtable)request["headers"])["Range"];
|
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(range)) // JP2's only
|
if (!String.IsNullOrEmpty(range)) // JP2's only
|
||||||
{
|
{
|
||||||
// Range request
|
// Range request
|
||||||
int start, end;
|
int start, end;
|
||||||
if (Util.TryParseHttpRange(range, out start, out end))
|
if (TryParseRange(range, out start, out end))
|
||||||
{
|
{
|
||||||
// Before clamping start make sure we can satisfy it in order to avoid
|
// Before clamping start make sure we can satisfy it in order to avoid
|
||||||
// sending back the last byte instead of an error status
|
// sending back the last byte instead of an error status
|
||||||
|
@ -232,8 +244,10 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
// However, if we return PartialContent (or OK) instead, the viewer will display that resolution.
|
// However, if we return PartialContent (or OK) instead, the viewer will display that resolution.
|
||||||
|
|
||||||
// response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable;
|
// response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable;
|
||||||
// viewers don't seem to handle RequestedRangeNotSatisfiable and keep retrying with same parameters
|
// response.AddHeader("Content-Range", String.Format("bytes */{0}", texture.Data.Length));
|
||||||
response["int_response_code"] = (int)System.Net.HttpStatusCode.NotFound;
|
// response.StatusCode = (int)System.Net.HttpStatusCode.OK;
|
||||||
|
response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent;
|
||||||
|
response.ContentType = texture.Metadata.ContentType;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -248,35 +262,41 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
|
|
||||||
// m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
|
// m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
|
||||||
|
|
||||||
response["content-type"] = texture.Metadata.ContentType;
|
// Always return PartialContent, even if the range covered the entire data length
|
||||||
response["int_response_code"] = (int)System.Net.HttpStatusCode.PartialContent;
|
// We were accidentally sending back 404 before in this situation
|
||||||
headers["Content-Range"] = String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length);
|
// https://issues.apache.org/bugzilla/show_bug.cgi?id=51878 supports sending 206 even if the
|
||||||
|
// entire range is requested, and viewer 3.2.2 (and very probably earlier) seems fine with this.
|
||||||
|
//
|
||||||
|
// We also do not want to send back OK even if the whole range was satisfiable since this causes
|
||||||
|
// HTTP textures on at least Imprudence 1.4.0-beta2 to never display the final texture quality.
|
||||||
|
// if (end > maxEnd)
|
||||||
|
// response.StatusCode = (int)System.Net.HttpStatusCode.OK;
|
||||||
|
// else
|
||||||
|
response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent;
|
||||||
|
|
||||||
byte[] d = new byte[len];
|
response.ContentLength = len;
|
||||||
Array.Copy(texture.Data, start, d, 0, len);
|
response.ContentType = texture.Metadata.ContentType;
|
||||||
response["bin_response_data"] = d;
|
response.AddHeader("Content-Range", String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length));
|
||||||
response["int_bytes"] = len;
|
|
||||||
|
response.Body.Write(texture.Data, start, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.Warn("[GETTEXTURE]: Malformed Range header: " + range);
|
m_log.Warn("[GETTEXTURE]: Malformed Range header: " + range);
|
||||||
response["int_response_code"] = (int)System.Net.HttpStatusCode.BadRequest;
|
response.StatusCode = (int)System.Net.HttpStatusCode.BadRequest;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // JP2's or other formats
|
else // JP2's or other formats
|
||||||
{
|
{
|
||||||
// Full content request
|
// Full content request
|
||||||
response["int_response_code"] = (int)System.Net.HttpStatusCode.OK;
|
response.StatusCode = (int)System.Net.HttpStatusCode.OK;
|
||||||
|
response.ContentLength = texture.Data.Length;
|
||||||
if (format == DefaultFormat)
|
if (format == DefaultFormat)
|
||||||
response["content_type"] = texture.Metadata.ContentType;
|
response.ContentType = texture.Metadata.ContentType;
|
||||||
else
|
else
|
||||||
response["content_type"] = "image/" + format;
|
response.ContentType = "image/" + format;
|
||||||
|
response.Body.Write(texture.Data, 0, texture.Data.Length);
|
||||||
response["bin_response_data"] = texture.Data;
|
|
||||||
response["int_bytes"] = texture.Data.Length;
|
|
||||||
|
|
||||||
// response.Body.Write(texture.Data, 0, texture.Data.Length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (response.StatusCode < 200 || response.StatusCode > 299)
|
// if (response.StatusCode < 200 || response.StatusCode > 299)
|
||||||
|
@ -289,29 +309,74 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length);
|
// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Parse a range header.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// As per http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html,
|
||||||
|
/// this obeys range headers with two values (e.g. 533-4165) and no second value (e.g. 533-).
|
||||||
|
/// Where there is no value, -1 is returned.
|
||||||
|
/// FIXME: Need to cover the case where only a second value is specified (e.g. -4165), probably by returning -1
|
||||||
|
/// for start.</remarks>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <param name='header'></param>
|
||||||
|
/// <param name='start'>Start of the range. Undefined if this was not a number.</param>
|
||||||
|
/// <param name='end'>End of the range. Will be -1 if no end specified. Undefined if there was a raw string but this was not a number.</param>
|
||||||
|
private bool TryParseRange(string header, out int start, out int end)
|
||||||
|
{
|
||||||
|
start = end = 0;
|
||||||
|
|
||||||
|
if (header.StartsWith("bytes="))
|
||||||
|
{
|
||||||
|
string[] rangeValues = header.Substring(6).Split('-');
|
||||||
|
|
||||||
|
if (rangeValues.Length == 2)
|
||||||
|
{
|
||||||
|
if (!Int32.TryParse(rangeValues[0], out start))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
string rawEnd = rangeValues[1];
|
||||||
|
|
||||||
|
if (rawEnd == "")
|
||||||
|
{
|
||||||
|
end = -1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (Int32.TryParse(rawEnd, out end))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
start = end = 0;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private byte[] ConvertTextureData(AssetBase texture, string format)
|
private byte[] ConvertTextureData(AssetBase texture, string format)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[GETTEXTURE]: Converting texture {0} to {1}", texture.ID, format);
|
m_log.DebugFormat("[GETTEXTURE]: Converting texture {0} to {1}", texture.ID, format);
|
||||||
byte[] data = new byte[0];
|
byte[] data = new byte[0];
|
||||||
|
|
||||||
MemoryStream imgstream = new MemoryStream();
|
MemoryStream imgstream = new MemoryStream();
|
||||||
Bitmap mTexture = null;
|
Bitmap mTexture = new Bitmap(1, 1);
|
||||||
ManagedImage managedImage = null;
|
ManagedImage managedImage;
|
||||||
Image image = null;
|
Image image = (Image)mTexture;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data
|
// Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data
|
||||||
|
|
||||||
|
imgstream = new MemoryStream();
|
||||||
|
|
||||||
// Decode image to System.Drawing.Image
|
// Decode image to System.Drawing.Image
|
||||||
if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image) && image != null)
|
if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image))
|
||||||
{
|
{
|
||||||
// Save to bitmap
|
// Save to bitmap
|
||||||
mTexture = new Bitmap(image);
|
mTexture = new Bitmap(image);
|
||||||
|
|
||||||
using(EncoderParameters myEncoderParameters = new EncoderParameters())
|
EncoderParameters myEncoderParameters = new EncoderParameters();
|
||||||
{
|
myEncoderParameters.Param[0] = new EncoderParameter(Encoder.Quality, 95L);
|
||||||
myEncoderParameters.Param[0] = new EncoderParameter(Encoder.Quality,95L);
|
|
||||||
|
|
||||||
// Save bitmap to stream
|
// Save bitmap to stream
|
||||||
ImageCodecInfo codec = GetEncoderInfo("image/" + format);
|
ImageCodecInfo codec = GetEncoderInfo("image/" + format);
|
||||||
|
@ -323,7 +388,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_log.WarnFormat("[GETTEXTURE]: No such codec {0}", format);
|
m_log.WarnFormat("[GETTEXTURE]: No such codec {0}", format);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -340,11 +405,12 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
if (image != null)
|
if (image != null)
|
||||||
image.Dispose();
|
image.Dispose();
|
||||||
|
|
||||||
if(managedImage != null)
|
|
||||||
managedImage.Clear();
|
|
||||||
if (imgstream != null)
|
if (imgstream != null)
|
||||||
|
{
|
||||||
|
imgstream.Close();
|
||||||
imgstream.Dispose();
|
imgstream.Dispose();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,394 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.Specialized;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Drawing.Imaging;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.IO;
|
|
||||||
using System.Net;
|
|
||||||
using System.Web;
|
|
||||||
using log4net;
|
|
||||||
using Nini.Config;
|
|
||||||
using OpenMetaverse;
|
|
||||||
using OpenMetaverse.StructuredData;
|
|
||||||
using OpenMetaverse.Imaging;
|
|
||||||
using OpenSim.Framework;
|
|
||||||
using OpenSim.Framework.Servers;
|
|
||||||
using OpenSim.Framework.Servers.HttpServer;
|
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
|
||||||
using OpenSim.Services.Interfaces;
|
|
||||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
|
||||||
|
|
||||||
namespace OpenSim.Capabilities.Handlers
|
|
||||||
{
|
|
||||||
public class GetTextureRobustHandler : BaseStreamHandler
|
|
||||||
{
|
|
||||||
private static readonly ILog m_log =
|
|
||||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
|
||||||
private IAssetService m_assetService;
|
|
||||||
|
|
||||||
public const string DefaultFormat = "x-j2c";
|
|
||||||
|
|
||||||
// TODO: Change this to a config option
|
|
||||||
private string m_RedirectURL = null;
|
|
||||||
|
|
||||||
public GetTextureRobustHandler(string path, IAssetService assService, string name, string description, string redirectURL)
|
|
||||||
: base("GET", path, name, description)
|
|
||||||
{
|
|
||||||
m_assetService = assService;
|
|
||||||
m_RedirectURL = redirectURL;
|
|
||||||
if (m_RedirectURL != null && !m_RedirectURL.EndsWith("/"))
|
|
||||||
m_RedirectURL += "/";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
|
||||||
{
|
|
||||||
// Try to parse the texture ID from the request URL
|
|
||||||
NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
|
|
||||||
string textureStr = query.GetOne("texture_id");
|
|
||||||
string format = query.GetOne("format");
|
|
||||||
|
|
||||||
//m_log.DebugFormat("[GETTEXTURE]: called {0}", textureStr);
|
|
||||||
|
|
||||||
if (m_assetService == null)
|
|
||||||
{
|
|
||||||
m_log.Error("[GETTEXTURE]: Cannot fetch texture " + textureStr + " without an asset service");
|
|
||||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
UUID textureID;
|
|
||||||
if (!String.IsNullOrEmpty(textureStr) && UUID.TryParse(textureStr, out textureID))
|
|
||||||
{
|
|
||||||
// m_log.DebugFormat("[GETTEXTURE]: Received request for texture id {0}", textureID);
|
|
||||||
|
|
||||||
string[] formats;
|
|
||||||
if (!string.IsNullOrEmpty(format))
|
|
||||||
{
|
|
||||||
formats = new string[1] { format.ToLower() };
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
formats = WebUtil.GetPreferredImageTypes(httpRequest.Headers.Get("Accept"));
|
|
||||||
if (formats.Length == 0)
|
|
||||||
formats = new string[1] { DefaultFormat }; // default
|
|
||||||
|
|
||||||
}
|
|
||||||
// OK, we have an array with preferred formats, possibly with only one entry
|
|
||||||
|
|
||||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
|
||||||
foreach (string f in formats)
|
|
||||||
{
|
|
||||||
if (FetchTexture(httpRequest, httpResponse, textureID, f))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.Warn("[GETTEXTURE]: Failed to parse a texture_id from GetTexture request: " + httpRequest.Url);
|
|
||||||
}
|
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
|
||||||
// "[GETTEXTURE]: For texture {0} sending back response {1}, data length {2}",
|
|
||||||
// textureID, httpResponse.StatusCode, httpResponse.ContentLength);
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="httpRequest"></param>
|
|
||||||
/// <param name="httpResponse"></param>
|
|
||||||
/// <param name="textureID"></param>
|
|
||||||
/// <param name="format"></param>
|
|
||||||
/// <returns>False for "caller try another codec"; true otherwise</returns>
|
|
||||||
private bool FetchTexture(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, UUID textureID, string format)
|
|
||||||
{
|
|
||||||
// m_log.DebugFormat("[GETTEXTURE]: {0} with requested format {1}", textureID, format);
|
|
||||||
if(!String.IsNullOrEmpty(m_RedirectURL))
|
|
||||||
{
|
|
||||||
string textureUrl = m_RedirectURL + "?texture_id=" + textureID.ToString();
|
|
||||||
m_log.Debug("[GETTEXTURE]: Redirecting texture request to " + textureUrl);
|
|
||||||
httpResponse.StatusCode = (int)HttpStatusCode.Moved;
|
|
||||||
httpResponse.AddHeader("Location:", textureUrl);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fetch, Misses or invalid return a 404
|
|
||||||
AssetBase texture = m_assetService.Get(textureID.ToString());
|
|
||||||
if (texture != null)
|
|
||||||
{
|
|
||||||
if (texture.Type != (sbyte)AssetType.Texture)
|
|
||||||
{
|
|
||||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (format == DefaultFormat)
|
|
||||||
{
|
|
||||||
WriteTextureData(httpRequest, httpResponse, texture, format);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// need to convert format
|
|
||||||
AssetBase newTexture = new AssetBase(texture.ID + "-" + format, texture.Name, (sbyte)AssetType.Texture, texture.Metadata.CreatorID);
|
|
||||||
newTexture.Data = ConvertTextureData(texture, format);
|
|
||||||
if (newTexture.Data.Length == 0)
|
|
||||||
return false; // !!! Caller try another codec, please!
|
|
||||||
|
|
||||||
newTexture.Flags = AssetFlags.Collectable;
|
|
||||||
newTexture.Temporary = true;
|
|
||||||
newTexture.Local = true;
|
|
||||||
WriteTextureData(httpRequest, httpResponse, newTexture, format);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// not found
|
|
||||||
// m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found");
|
|
||||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void WriteTextureData(IOSHttpRequest request, IOSHttpResponse response, AssetBase texture, string format)
|
|
||||||
{
|
|
||||||
string range = request.Headers.GetOne("Range");
|
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(range)) // JP2's only
|
|
||||||
{
|
|
||||||
// Range request
|
|
||||||
int start, end;
|
|
||||||
if (TryParseRange(range, out start, out end))
|
|
||||||
{
|
|
||||||
// Before clamping start make sure we can satisfy it in order to avoid
|
|
||||||
// sending back the last byte instead of an error status
|
|
||||||
if (start >= texture.Data.Length)
|
|
||||||
{
|
|
||||||
// m_log.DebugFormat(
|
|
||||||
// "[GETTEXTURE]: Client requested range for texture {0} starting at {1} but texture has end of {2}",
|
|
||||||
// texture.ID, start, texture.Data.Length);
|
|
||||||
|
|
||||||
// Stricly speaking, as per http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html, we should be sending back
|
|
||||||
// Requested Range Not Satisfiable (416) here. However, it appears that at least recent implementations
|
|
||||||
// of the Linden Lab viewer (3.2.1 and 3.3.4 and probably earlier), a viewer that has previously
|
|
||||||
// received a very small texture may attempt to fetch bytes from the server past the
|
|
||||||
// range of data that it received originally. Whether this happens appears to depend on whether
|
|
||||||
// the viewer's estimation of how large a request it needs to make for certain discard levels
|
|
||||||
// (http://wiki.secondlife.com/wiki/Image_System#Discard_Level_and_Mip_Mapping), chiefly discard
|
|
||||||
// level 2. If this estimate is greater than the total texture size, returning a RequestedRangeNotSatisfiable
|
|
||||||
// here will cause the viewer to treat the texture as bad and never display the full resolution
|
|
||||||
// However, if we return PartialContent (or OK) instead, the viewer will display that resolution.
|
|
||||||
|
|
||||||
// response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable;
|
|
||||||
// response.AddHeader("Content-Range", String.Format("bytes */{0}", texture.Data.Length));
|
|
||||||
// response.StatusCode = (int)System.Net.HttpStatusCode.OK;
|
|
||||||
response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent;
|
|
||||||
response.ContentType = texture.Metadata.ContentType;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Handle the case where no second range value was given. This is equivalent to requesting
|
|
||||||
// the rest of the entity.
|
|
||||||
if (end == -1)
|
|
||||||
end = int.MaxValue;
|
|
||||||
|
|
||||||
end = Utils.Clamp(end, 0, texture.Data.Length - 1);
|
|
||||||
start = Utils.Clamp(start, 0, end);
|
|
||||||
int len = end - start + 1;
|
|
||||||
|
|
||||||
// m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
|
|
||||||
|
|
||||||
// Always return PartialContent, even if the range covered the entire data length
|
|
||||||
// We were accidentally sending back 404 before in this situation
|
|
||||||
// https://issues.apache.org/bugzilla/show_bug.cgi?id=51878 supports sending 206 even if the
|
|
||||||
// entire range is requested, and viewer 3.2.2 (and very probably earlier) seems fine with this.
|
|
||||||
//
|
|
||||||
// We also do not want to send back OK even if the whole range was satisfiable since this causes
|
|
||||||
// HTTP textures on at least Imprudence 1.4.0-beta2 to never display the final texture quality.
|
|
||||||
// if (end > maxEnd)
|
|
||||||
// response.StatusCode = (int)System.Net.HttpStatusCode.OK;
|
|
||||||
// else
|
|
||||||
response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent;
|
|
||||||
|
|
||||||
response.ContentLength = len;
|
|
||||||
response.ContentType = texture.Metadata.ContentType;
|
|
||||||
response.AddHeader("Content-Range", String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length));
|
|
||||||
response.RawBuffer = texture.Data;
|
|
||||||
response.RawBufferStart = start;
|
|
||||||
response.RawBufferLen = len;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.Warn("[GETTEXTURE]: Malformed Range header: " + range);
|
|
||||||
response.StatusCode = (int)System.Net.HttpStatusCode.BadRequest;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // JP2's or other formats
|
|
||||||
{
|
|
||||||
// Full content request
|
|
||||||
response.StatusCode = (int)System.Net.HttpStatusCode.OK;
|
|
||||||
response.ContentLength = texture.Data.Length;
|
|
||||||
if (format == DefaultFormat)
|
|
||||||
response.ContentType = texture.Metadata.ContentType;
|
|
||||||
else
|
|
||||||
response.ContentType = "image/" + format;
|
|
||||||
response.RawBuffer = texture.Data;
|
|
||||||
response.RawBufferStart = 0;
|
|
||||||
response.RawBufferLen = texture.Data.Length;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (response.StatusCode < 200 || response.StatusCode > 299)
|
|
||||||
// m_log.WarnFormat(
|
|
||||||
// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})",
|
|
||||||
// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length);
|
|
||||||
// else
|
|
||||||
// m_log.DebugFormat(
|
|
||||||
// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})",
|
|
||||||
// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Parse a range header.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// As per http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html,
|
|
||||||
/// this obeys range headers with two values (e.g. 533-4165) and no second value (e.g. 533-).
|
|
||||||
/// Where there is no value, -1 is returned.
|
|
||||||
/// FIXME: Need to cover the case where only a second value is specified (e.g. -4165), probably by returning -1
|
|
||||||
/// for start.</remarks>
|
|
||||||
/// <returns></returns>
|
|
||||||
/// <param name='header'></param>
|
|
||||||
/// <param name='start'>Start of the range. Undefined if this was not a number.</param>
|
|
||||||
/// <param name='end'>End of the range. Will be -1 if no end specified. Undefined if there was a raw string but this was not a number.</param>
|
|
||||||
private bool TryParseRange(string header, out int start, out int end)
|
|
||||||
{
|
|
||||||
start = end = 0;
|
|
||||||
|
|
||||||
if (header.StartsWith("bytes="))
|
|
||||||
{
|
|
||||||
string[] rangeValues = header.Substring(6).Split('-');
|
|
||||||
|
|
||||||
if (rangeValues.Length == 2)
|
|
||||||
{
|
|
||||||
if (!Int32.TryParse(rangeValues[0], out start))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
string rawEnd = rangeValues[1];
|
|
||||||
|
|
||||||
if (rawEnd == "")
|
|
||||||
{
|
|
||||||
end = -1;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (Int32.TryParse(rawEnd, out end))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
start = end = 0;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] ConvertTextureData(AssetBase texture, string format)
|
|
||||||
{
|
|
||||||
m_log.DebugFormat("[GETTEXTURE]: Converting texture {0} to {1}", texture.ID, format);
|
|
||||||
byte[] data = new byte[0];
|
|
||||||
|
|
||||||
MemoryStream imgstream = new MemoryStream();
|
|
||||||
Bitmap mTexture = null;
|
|
||||||
ManagedImage managedImage = null;
|
|
||||||
Image image = null;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data
|
|
||||||
// Decode image to System.Drawing.Image
|
|
||||||
if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image) && image != null)
|
|
||||||
{
|
|
||||||
// Save to bitmap
|
|
||||||
mTexture = new Bitmap(image);
|
|
||||||
|
|
||||||
using(EncoderParameters myEncoderParameters = new EncoderParameters())
|
|
||||||
{
|
|
||||||
myEncoderParameters.Param[0] = new EncoderParameter(Encoder.Quality,95L);
|
|
||||||
|
|
||||||
// Save bitmap to stream
|
|
||||||
ImageCodecInfo codec = GetEncoderInfo("image/" + format);
|
|
||||||
if (codec != null)
|
|
||||||
{
|
|
||||||
mTexture.Save(imgstream, codec, myEncoderParameters);
|
|
||||||
// Write the stream to a byte array for output
|
|
||||||
data = imgstream.ToArray();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
m_log.WarnFormat("[GETTEXTURE]: No such codec {0}", format);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
m_log.WarnFormat("[GETTEXTURE]: Unable to convert texture {0} to {1}: {2}", texture.ID, format, e.Message);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
// Reclaim memory, these are unmanaged resources
|
|
||||||
// If we encountered an exception, one or more of these will be null
|
|
||||||
if (mTexture != null)
|
|
||||||
mTexture.Dispose();
|
|
||||||
|
|
||||||
if (image != null)
|
|
||||||
image.Dispose();
|
|
||||||
|
|
||||||
if(managedImage != null)
|
|
||||||
managedImage.Clear();
|
|
||||||
|
|
||||||
if (imgstream != null)
|
|
||||||
imgstream.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
// From msdn
|
|
||||||
private static ImageCodecInfo GetEncoderInfo(String mimeType)
|
|
||||||
{
|
|
||||||
ImageCodecInfo[] encoders;
|
|
||||||
encoders = ImageCodecInfo.GetImageEncoders();
|
|
||||||
for (int j = 0; j < encoders.Length; ++j)
|
|
||||||
{
|
|
||||||
if (encoders[j].MimeType == mimeType)
|
|
||||||
return encoders[j];
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -33,7 +33,6 @@ using OpenSim.Framework.Servers.HttpServer;
|
||||||
using OpenSim.Server.Handlers.Base;
|
using OpenSim.Server.Handlers.Base;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
|
||||||
|
|
||||||
namespace OpenSim.Capabilities.Handlers
|
namespace OpenSim.Capabilities.Handlers
|
||||||
{
|
{
|
||||||
public class GetTextureServerConnector : ServiceConnector
|
public class GetTextureServerConnector : ServiceConnector
|
||||||
|
@ -66,8 +65,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
string rurl = serverConfig.GetString("GetTextureRedirectURL");
|
string rurl = serverConfig.GetString("GetTextureRedirectURL");
|
||||||
;
|
;
|
||||||
server.AddStreamHandler(
|
server.AddStreamHandler(
|
||||||
new GetTextureRobustHandler("/CAPS/GetTexture", m_AssetService, "GetTexture", null, rurl));
|
new GetTextureHandler("/CAPS/GetTexture/" /*+ UUID.Random() */, m_AssetService, "GetTexture", null, rurl));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,6 @@ using OpenSim.Framework.Servers.HttpServer;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Tests.Common;
|
using OpenSim.Tests.Common;
|
||||||
|
|
||||||
/*
|
|
||||||
namespace OpenSim.Capabilities.Handlers.GetTexture.Tests
|
namespace OpenSim.Capabilities.Handlers.GetTexture.Tests
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
|
@ -61,4 +60,3 @@ namespace OpenSim.Capabilities.Handlers.GetTexture.Tests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
|
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
[assembly: AssemblyVersion(OpenSim.VersionInfo.AssemblyVersionNumber)]
|
[assembly: AssemblyVersion("0.8.3.*")]
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,181 @@
|
||||||
|
/*
|
||||||
|
* 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.Specialized;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.IO;
|
||||||
|
using System.Web;
|
||||||
|
using log4net;
|
||||||
|
using Nini.Config;
|
||||||
|
using OpenMetaverse;
|
||||||
|
using OpenMetaverse.StructuredData;
|
||||||
|
using OpenMetaverse.Imaging;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Framework.Capabilities;
|
||||||
|
using OpenSim.Framework.Servers;
|
||||||
|
using OpenSim.Framework.Servers.HttpServer;
|
||||||
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||||
|
|
||||||
|
namespace OpenSim.Capabilities.Handlers
|
||||||
|
{
|
||||||
|
public class UploadBakedTextureHandler
|
||||||
|
{
|
||||||
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
private Caps m_HostCapsObj;
|
||||||
|
private IAssetService m_assetService;
|
||||||
|
private bool m_persistBakedTextures;
|
||||||
|
|
||||||
|
public UploadBakedTextureHandler(Caps caps, IAssetService assetService, bool persistBakedTextures)
|
||||||
|
{
|
||||||
|
m_HostCapsObj = caps;
|
||||||
|
m_assetService = assetService;
|
||||||
|
m_persistBakedTextures = persistBakedTextures;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handle a request from the client for a Uri to upload a baked texture.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <param name="path"></param>
|
||||||
|
/// <param name="param"></param>
|
||||||
|
/// <param name="httpRequest"></param>
|
||||||
|
/// <param name="httpResponse"></param>
|
||||||
|
/// <returns>The upload response if the request is successful, null otherwise.</returns>
|
||||||
|
public string UploadBakedTexture(
|
||||||
|
string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath;
|
||||||
|
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
|
||||||
|
|
||||||
|
BakedTextureUploader uploader =
|
||||||
|
new BakedTextureUploader(capsBase + uploaderPath, m_HostCapsObj.HttpListener);
|
||||||
|
uploader.OnUpLoad += BakedTextureUploaded;
|
||||||
|
|
||||||
|
m_HostCapsObj.HttpListener.AddStreamHandler(
|
||||||
|
new BinaryStreamHandler(
|
||||||
|
"POST", capsBase + uploaderPath, uploader.uploaderCaps, "UploadBakedTexture", null));
|
||||||
|
|
||||||
|
string protocol = "http://";
|
||||||
|
|
||||||
|
if (m_HostCapsObj.SSLCaps)
|
||||||
|
protocol = "https://";
|
||||||
|
|
||||||
|
string uploaderURL = protocol + m_HostCapsObj.HostName + ":" +
|
||||||
|
m_HostCapsObj.Port.ToString() + capsBase + uploaderPath;
|
||||||
|
|
||||||
|
LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
|
||||||
|
uploadResponse.uploader = uploaderURL;
|
||||||
|
uploadResponse.state = "upload";
|
||||||
|
|
||||||
|
return LLSDHelpers.SerialiseLLSDReply(uploadResponse);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[UPLOAD BAKED TEXTURE HANDLER]: {0}{1}", e.Message, e.StackTrace);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when a baked texture has been successfully uploaded by a client.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="assetID"></param>
|
||||||
|
/// <param name="data"></param>
|
||||||
|
private void BakedTextureUploaded(UUID assetID, byte[] data)
|
||||||
|
{
|
||||||
|
// m_log.DebugFormat("[UPLOAD BAKED TEXTURE HANDLER]: Received baked texture {0}", assetID.ToString());
|
||||||
|
|
||||||
|
AssetBase asset;
|
||||||
|
asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_HostCapsObj.AgentID.ToString());
|
||||||
|
asset.Data = data;
|
||||||
|
asset.Temporary = true;
|
||||||
|
asset.Local = !m_persistBakedTextures; // Local assets aren't persisted, non-local are
|
||||||
|
m_assetService.Store(asset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class BakedTextureUploader
|
||||||
|
{
|
||||||
|
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
public event Action<UUID, byte[]> OnUpLoad;
|
||||||
|
|
||||||
|
private string uploaderPath = String.Empty;
|
||||||
|
private UUID newAssetID;
|
||||||
|
private IHttpServer httpListener;
|
||||||
|
|
||||||
|
public BakedTextureUploader(string path, IHttpServer httpServer)
|
||||||
|
{
|
||||||
|
newAssetID = UUID.Random();
|
||||||
|
uploaderPath = path;
|
||||||
|
httpListener = httpServer;
|
||||||
|
// m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handle raw uploaded baked texture data.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="data"></param>
|
||||||
|
/// <param name="path"></param>
|
||||||
|
/// <param name="param"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string uploaderCaps(byte[] data, string path, string param)
|
||||||
|
{
|
||||||
|
Action<UUID, byte[]> handlerUpLoad = OnUpLoad;
|
||||||
|
|
||||||
|
// Don't do this asynchronously, otherwise it's possible for the client to send set appearance information
|
||||||
|
// on another thread which might send out avatar updates before the asset has been put into the asset
|
||||||
|
// service.
|
||||||
|
if (handlerUpLoad != null)
|
||||||
|
handlerUpLoad(newAssetID, data);
|
||||||
|
|
||||||
|
string res = String.Empty;
|
||||||
|
LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
|
||||||
|
uploadComplete.new_asset = newAssetID.ToString();
|
||||||
|
uploadComplete.new_inventory_item = UUID.Zero;
|
||||||
|
uploadComplete.state = "complete";
|
||||||
|
|
||||||
|
res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
|
||||||
|
|
||||||
|
httpListener.RemoveStreamHandler("POST", uploaderPath);
|
||||||
|
|
||||||
|
// m_log.DebugFormat("[BAKED TEXTURE UPLOADER]: baked texture upload completed for {0}", newAssetID);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -29,35 +29,48 @@ using System;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using OpenSim.Server.Base;
|
using OpenSim.Server.Base;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
using OpenSim.Framework.ServiceAuth;
|
|
||||||
using OpenSim.Framework.Servers.HttpServer;
|
using OpenSim.Framework.Servers.HttpServer;
|
||||||
using OpenSim.Server.Handlers.Base;
|
using OpenSim.Server.Handlers.Base;
|
||||||
|
using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Server.Handlers.GridUser
|
namespace OpenSim.Capabilities.Handlers
|
||||||
{
|
{
|
||||||
public class MuteListServiceConnector : ServiceConnector
|
public class UploadBakedTextureServerConnector : ServiceConnector
|
||||||
{
|
{
|
||||||
private IMuteListService m_MuteListService;
|
private IAssetService m_AssetService;
|
||||||
private string m_ConfigName = "MuteListService";
|
private string m_ConfigName = "CapsService";
|
||||||
|
|
||||||
public MuteListServiceConnector(IConfigSource config, IHttpServer server, string configName) :
|
public UploadBakedTextureServerConnector(IConfigSource config, IHttpServer server, string configName) :
|
||||||
base(config, server, configName)
|
base(config, server, configName)
|
||||||
{
|
{
|
||||||
|
if (configName != String.Empty)
|
||||||
|
m_ConfigName = configName;
|
||||||
|
|
||||||
IConfig serverConfig = config.Configs[m_ConfigName];
|
IConfig serverConfig = config.Configs[m_ConfigName];
|
||||||
if (serverConfig == null)
|
if (serverConfig == null)
|
||||||
throw new Exception(String.Format("No section {0} in config file", m_ConfigName));
|
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
|
||||||
|
|
||||||
string service = serverConfig.GetString("LocalServiceModule", String.Empty);
|
string assetService = serverConfig.GetString("AssetService", String.Empty);
|
||||||
|
|
||||||
if (service == String.Empty)
|
if (assetService == String.Empty)
|
||||||
throw new Exception("LocalServiceModule not present in MuteListService config file MuteListService section");
|
throw new Exception("No AssetService in config file");
|
||||||
|
|
||||||
Object[] args = new Object[] { config };
|
Object[] args = new Object[] { config };
|
||||||
m_MuteListService = ServerUtils.LoadPlugin<IMuteListService>(service, args);
|
m_AssetService =
|
||||||
|
ServerUtils.LoadPlugin<IAssetService>(assetService, args);
|
||||||
|
|
||||||
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
|
if (m_AssetService == null)
|
||||||
|
throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));
|
||||||
|
|
||||||
|
// NEED TO FIX THIS
|
||||||
|
OpenSim.Framework.Capabilities.Caps caps = new OpenSim.Framework.Capabilities.Caps(server, "", server.Port, "", UUID.Zero, "");
|
||||||
|
server.AddStreamHandler(new RestStreamHandler(
|
||||||
|
"POST",
|
||||||
|
"/CAPS/UploadBakedTexture/",
|
||||||
|
new UploadBakedTextureHandler(caps, m_AssetService, true).UploadBakedTexture,
|
||||||
|
"UploadBakedTexture",
|
||||||
|
"Upload Baked Texture Capability"));
|
||||||
|
|
||||||
server.AddStreamHandler(new MuteListServerPostHandler(m_MuteListService, auth));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -107,18 +107,18 @@ namespace OpenSim.Framework.Capabilities
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static byte[] LLSDSerialize(object obj)
|
public static byte[] LLSDSerialize(object obj)
|
||||||
{
|
{
|
||||||
using(StringWriter sw = new StringWriter())
|
StringWriter sw = new StringWriter();
|
||||||
using(XmlTextWriter writer = new XmlTextWriter(sw))
|
XmlTextWriter writer = new XmlTextWriter(sw);
|
||||||
{
|
|
||||||
writer.Formatting = Formatting.None;
|
writer.Formatting = Formatting.None;
|
||||||
|
|
||||||
writer.WriteStartElement(String.Empty, "llsd", String.Empty);
|
writer.WriteStartElement(String.Empty, "llsd", String.Empty);
|
||||||
LLSDWriteOne(writer, obj);
|
LLSDWriteOne(writer, obj);
|
||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
writer.Flush();
|
|
||||||
|
writer.Close();
|
||||||
|
|
||||||
return Util.UTF8.GetBytes(sw.ToString());
|
return Util.UTF8.GetBytes(sw.ToString());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -566,7 +566,7 @@ namespace OpenSim.Framework.Capabilities
|
||||||
endPos = FindEnd(llsd, 1);
|
endPos = FindEnd(llsd, 1);
|
||||||
|
|
||||||
if (Double.TryParse(llsd.Substring(1, endPos - 1), NumberStyles.Float,
|
if (Double.TryParse(llsd.Substring(1, endPos - 1), NumberStyles.Float,
|
||||||
Culture.NumberFormatInfo, out value))
|
Utils.EnUsCulture.NumberFormat, out value))
|
||||||
return value;
|
return value;
|
||||||
else
|
else
|
||||||
throw new LLSDParseException("Failed to parse double value type");
|
throw new LLSDParseException("Failed to parse double value type");
|
||||||
|
|
|
@ -30,20 +30,13 @@ using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Capabilities
|
namespace OpenSim.Framework.Capabilities
|
||||||
{
|
{
|
||||||
|
|
||||||
[LLSDType("MAP")]
|
[LLSDType("MAP")]
|
||||||
public class LLSDAssetUploadComplete
|
public class LLSDAssetUploadComplete
|
||||||
{
|
{
|
||||||
public string new_asset = String.Empty;
|
public string new_asset = String.Empty;
|
||||||
public UUID new_inventory_item = UUID.Zero;
|
public UUID new_inventory_item = UUID.Zero;
|
||||||
// public UUID new_texture_folder_id = UUID.Zero;
|
|
||||||
public string state = String.Empty;
|
public string state = String.Empty;
|
||||||
public LLSDAssetUploadError error = null;
|
|
||||||
//public bool success = false;
|
//public bool success = false;
|
||||||
public int new_next_owner_mask = 0;
|
|
||||||
public int new_group_mask = 0;
|
|
||||||
public int new_everyone_mask = 0;
|
|
||||||
public int inventory_item_flags = 0;
|
|
||||||
|
|
||||||
public LLSDAssetUploadComplete()
|
public LLSDAssetUploadComplete()
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,28 +30,15 @@ using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Capabilities
|
namespace OpenSim.Framework.Capabilities
|
||||||
{
|
{
|
||||||
[OSDMap]
|
|
||||||
public class LLSDAssetResource
|
|
||||||
{
|
|
||||||
public OSDArray instance_list = new OSDArray();
|
|
||||||
public OSDArray texture_list = new OSDArray();
|
|
||||||
public OSDArray mesh_list = new OSDArray();
|
|
||||||
public string metric = String.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
[OSDMap]
|
[OSDMap]
|
||||||
public class LLSDAssetUploadRequest
|
public class LLSDAssetUploadRequest
|
||||||
{
|
{
|
||||||
public string asset_type = String.Empty;
|
public string asset_type = String.Empty;
|
||||||
public string description = String.Empty;
|
public string description = String.Empty;
|
||||||
public UUID folder_id = UUID.Zero;
|
public UUID folder_id = UUID.Zero;
|
||||||
public UUID texture_folder_id = UUID.Zero;
|
|
||||||
public int next_owner_mask = 0;
|
|
||||||
public int group_mask = 0;
|
|
||||||
public int everyone_mask = 0;
|
|
||||||
public string inventory_type = String.Empty;
|
public string inventory_type = String.Empty;
|
||||||
public string name = String.Empty;
|
public string name = String.Empty;
|
||||||
public LLSDAssetResource asset_resources = new LLSDAssetResource();
|
|
||||||
public LLSDAssetUploadRequest()
|
public LLSDAssetUploadRequest()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,51 +26,20 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using OpenMetaverse;
|
|
||||||
|
|
||||||
namespace OpenSim.Framework.Capabilities
|
namespace OpenSim.Framework.Capabilities
|
||||||
{
|
{
|
||||||
[OSDMap]
|
|
||||||
public class LLSDAssetUploadError
|
|
||||||
{
|
|
||||||
public string message = String.Empty;
|
|
||||||
public UUID identifier = UUID.Zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
[OSDMap]
|
|
||||||
public class LLSDAssetUploadResponsePricebrkDown
|
|
||||||
{
|
|
||||||
public int mesh_streaming;
|
|
||||||
public int mesh_physics;
|
|
||||||
public int mesh_instance;
|
|
||||||
public int texture;
|
|
||||||
public int model;
|
|
||||||
}
|
|
||||||
|
|
||||||
[OSDMap]
|
|
||||||
public class LLSDAssetUploadResponseData
|
|
||||||
{
|
|
||||||
public double resource_cost;
|
|
||||||
public double model_streaming_cost;
|
|
||||||
public double simulation_cost;
|
|
||||||
public double physics_cost;
|
|
||||||
public LLSDAssetUploadResponsePricebrkDown upload_price_breakdown = new LLSDAssetUploadResponsePricebrkDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
[OSDMap]
|
[OSDMap]
|
||||||
public class LLSDAssetUploadResponse
|
public class LLSDAssetUploadResponse
|
||||||
{
|
{
|
||||||
public string uploader = String.Empty;
|
public string uploader = String.Empty;
|
||||||
public string state = String.Empty;
|
public string state = String.Empty;
|
||||||
public int upload_price = 0;
|
|
||||||
public LLSDAssetUploadResponseData data = null;
|
|
||||||
public LLSDAssetUploadError error = null;
|
|
||||||
public LLSDAssetUploadResponse()
|
public LLSDAssetUploadResponse()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[OSDMap]
|
[OSDMap]
|
||||||
public class LLSDNewFileAngentInventoryVariablePriceReplyResponse
|
public class LLSDNewFileAngentInventoryVariablePriceReplyResponse
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
|
@ -25,56 +25,44 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Framework
|
namespace OpenSim.Framework.Capabilities
|
||||||
{
|
{
|
||||||
public enum ObjectChangeType : uint
|
[OSDMap]
|
||||||
|
public class LLSDEnvironmentRequest
|
||||||
{
|
{
|
||||||
// bits definitions
|
public UUID messageID;
|
||||||
Position = 0x01,
|
public UUID regionID;
|
||||||
Rotation = 0x02,
|
|
||||||
Scale = 0x04,
|
|
||||||
Group = 0x08,
|
|
||||||
UniformScale = 0x10,
|
|
||||||
|
|
||||||
// macros from above
|
|
||||||
// single prim
|
|
||||||
primP = 0x01,
|
|
||||||
primR = 0x02,
|
|
||||||
primPR = 0x03,
|
|
||||||
primS = 0x04,
|
|
||||||
primPS = 0x05,
|
|
||||||
primRS = 0x06,
|
|
||||||
primPSR = 0x07,
|
|
||||||
|
|
||||||
primUS = 0x14,
|
|
||||||
primPUS = 0x15,
|
|
||||||
primRUS = 0x16,
|
|
||||||
primPUSR = 0x17,
|
|
||||||
|
|
||||||
// group
|
|
||||||
groupP = 0x09,
|
|
||||||
groupR = 0x0A,
|
|
||||||
groupPR = 0x0B,
|
|
||||||
groupS = 0x0C,
|
|
||||||
groupPS = 0x0D,
|
|
||||||
groupRS = 0x0E,
|
|
||||||
groupPSR = 0x0F,
|
|
||||||
|
|
||||||
groupUS = 0x1C,
|
|
||||||
groupPUS = 0x1D,
|
|
||||||
groupRUS = 0x1E,
|
|
||||||
groupPUSR = 0x1F,
|
|
||||||
|
|
||||||
PRSmask = 0x07
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct ObjectChangeData
|
[OSDMap]
|
||||||
|
public class LLSDEnvironmentSetResponse
|
||||||
{
|
{
|
||||||
public Quaternion rotation;
|
public UUID regionID;
|
||||||
public Vector3 position;
|
public UUID messageID;
|
||||||
public Vector3 scale;
|
public Boolean success;
|
||||||
public ObjectChangeType change;
|
public String fail_reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class EnvironmentSettings
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// generates a empty llsd settings response for viewer
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="messageID">the message UUID</param>
|
||||||
|
/// <param name="regionID">the region UUID</param>
|
||||||
|
public static string EmptySettings(UUID messageID, UUID regionID)
|
||||||
|
{
|
||||||
|
OSDArray arr = new OSDArray();
|
||||||
|
LLSDEnvironmentRequest msg = new LLSDEnvironmentRequest();
|
||||||
|
msg.messageID = messageID;
|
||||||
|
msg.regionID = regionID;
|
||||||
|
arr.Array.Add(msg);
|
||||||
|
return LLSDHelpers.SerialiseLLSDReply(arr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -30,7 +30,6 @@ using System.Collections;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using OpenMetaverse;
|
|
||||||
|
|
||||||
namespace OpenSim.Framework.Capabilities
|
namespace OpenSim.Framework.Capabilities
|
||||||
{
|
{
|
||||||
|
@ -41,33 +40,18 @@ namespace OpenSim.Framework.Capabilities
|
||||||
|
|
||||||
public static string SerialiseLLSDReply(object obj)
|
public static string SerialiseLLSDReply(object obj)
|
||||||
{
|
{
|
||||||
using(StringWriter sw = new StringWriter())
|
StringWriter sw = new StringWriter();
|
||||||
using(XmlTextWriter writer = new XmlTextWriter(sw))
|
XmlTextWriter writer = new XmlTextWriter(sw);
|
||||||
{
|
|
||||||
writer.Formatting = Formatting.None;
|
writer.Formatting = Formatting.None;
|
||||||
writer.WriteStartElement(String.Empty, "llsd", String.Empty);
|
writer.WriteStartElement(String.Empty, "llsd", String.Empty);
|
||||||
SerializeOSDType(writer, obj);
|
SerializeOSDType(writer, obj);
|
||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
writer.Flush();
|
writer.Close();
|
||||||
|
|
||||||
//m_log.DebugFormat("[LLSD Helpers]: Generated serialized LLSD reply {0}", sw.ToString());
|
//m_log.DebugFormat("[LLSD Helpers]: Generated serialized LLSD reply {0}", sw.ToString());
|
||||||
|
|
||||||
return sw.ToString();
|
return sw.ToString();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static string SerialiseLLSDReplyNoHeader(object obj)
|
|
||||||
{
|
|
||||||
using(StringWriter sw = new StringWriter())
|
|
||||||
using(XmlTextWriter writer = new XmlTextWriter(sw))
|
|
||||||
{
|
|
||||||
writer.Formatting = Formatting.None;
|
|
||||||
SerializeOSDType(writer, obj);
|
|
||||||
writer.Flush();
|
|
||||||
//m_log.DebugFormat("[LLSD Helpers]: Generated serialized LLSD reply {0}", sw.ToString());
|
|
||||||
|
|
||||||
return sw.ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void SerializeOSDType(XmlTextWriter writer, object obj)
|
private static void SerializeOSDType(XmlTextWriter writer, object obj)
|
||||||
{
|
{
|
||||||
|
@ -173,22 +157,6 @@ namespace OpenSim.Framework.Capabilities
|
||||||
// the LLSD map/array types in the array need to be deserialised
|
// the LLSD map/array types in the array need to be deserialised
|
||||||
// but first we need to know the right class to deserialise them into.
|
// but first we need to know the right class to deserialise them into.
|
||||||
}
|
}
|
||||||
else if(enumerator.Value is Boolean && field.FieldType == typeof(int) )
|
|
||||||
{
|
|
||||||
int i = (bool)enumerator.Value ? 1 : 0;
|
|
||||||
field.SetValue(obj, i);
|
|
||||||
}
|
|
||||||
else if(field.FieldType == typeof(bool) && enumerator.Value is int)
|
|
||||||
{
|
|
||||||
bool b = (int)enumerator.Value != 0;
|
|
||||||
field.SetValue(obj, b);
|
|
||||||
}
|
|
||||||
else if(field.FieldType == typeof(UUID) && enumerator.Value is string)
|
|
||||||
{
|
|
||||||
UUID u;
|
|
||||||
UUID.TryParse((string)enumerator.Value, out u);
|
|
||||||
field.SetValue(obj, u);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
field.SetValue(obj, enumerator.Value);
|
field.SetValue(obj, enumerator.Value);
|
||||||
|
|
|
@ -37,6 +37,5 @@ namespace OpenSim.Framework.Capabilities
|
||||||
public string name;
|
public string name;
|
||||||
public int type;
|
public int type;
|
||||||
public int preferred_type;
|
public int preferred_type;
|
||||||
public int version;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,11 +25,17 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using OpenSim.Region.Framework.Scenes;
|
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
|
||||||
public interface IUserAccountCacheModule
|
namespace OpenSim.Framework.Capabilities
|
||||||
{
|
{
|
||||||
void Remove(string name);
|
[OSDMap]
|
||||||
void Remove(UUID id);
|
public class LLSDItemUpdate
|
||||||
|
{
|
||||||
|
public UUID item_id;
|
||||||
|
|
||||||
|
public LLSDItemUpdate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
/*
|
||||||
|
* 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.Collections;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Capabilities
|
||||||
|
{
|
||||||
|
[OSDMap]
|
||||||
|
public class LLSDParcelVoiceInfoResponse
|
||||||
|
{
|
||||||
|
public int parcel_local_id;
|
||||||
|
public string region_name;
|
||||||
|
public Hashtable voice_credentials;
|
||||||
|
|
||||||
|
public LLSDParcelVoiceInfoResponse()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public LLSDParcelVoiceInfoResponse(string region, int localID, Hashtable creds)
|
||||||
|
{
|
||||||
|
region_name = region;
|
||||||
|
parcel_local_id = localID;
|
||||||
|
voice_credentials = creds;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
/*
|
||||||
|
* 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 OpenMetaverse;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Capabilities
|
||||||
|
{
|
||||||
|
[LLSDType("MAP")]
|
||||||
|
public class LLSDRemoteParcelResponse
|
||||||
|
{
|
||||||
|
public UUID parcel_id;
|
||||||
|
|
||||||
|
public LLSDRemoteParcelResponse()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -61,9 +61,6 @@ namespace OpenSim.Framework.Capabilities
|
||||||
// OpenMetaverse.StructuredData.LLSDParser.DeserializeXml(new XmlTextReader(request));
|
// OpenMetaverse.StructuredData.LLSDParser.DeserializeXml(new XmlTextReader(request));
|
||||||
|
|
||||||
Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(request);
|
Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(request);
|
||||||
if(hash == null)
|
|
||||||
return new byte[0];
|
|
||||||
|
|
||||||
TRequest llsdRequest = new TRequest();
|
TRequest llsdRequest = new TRequest();
|
||||||
LLSDHelpers.DeserialiseOSDMap(hash, llsdRequest);
|
LLSDHelpers.DeserialiseOSDMap(hash, llsdRequest);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* 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 OpenMetaverse;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Capabilities
|
||||||
|
{
|
||||||
|
[OSDMap]
|
||||||
|
public class LLSDTaskScriptUpdate
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The item containing the script to update
|
||||||
|
/// </summary>
|
||||||
|
public UUID item_id;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The task containing the script
|
||||||
|
/// </summary>
|
||||||
|
public UUID task_id;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Signals whether the script is currently active
|
||||||
|
/// </summary>
|
||||||
|
public int is_script_running;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Capabilities
|
||||||
|
{
|
||||||
|
[OSDMap]
|
||||||
|
public class LLSDVoiceAccountResponse
|
||||||
|
{
|
||||||
|
public string username;
|
||||||
|
public string password;
|
||||||
|
public string voice_sip_uri_hostname;
|
||||||
|
public string voice_account_server_name;
|
||||||
|
|
||||||
|
public LLSDVoiceAccountResponse()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public LLSDVoiceAccountResponse(string user, string pass)
|
||||||
|
{
|
||||||
|
username = user;
|
||||||
|
password = pass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LLSDVoiceAccountResponse(string user, string pass, string sipUriHost, string accountServer)
|
||||||
|
{
|
||||||
|
username = user;
|
||||||
|
password = pass;
|
||||||
|
voice_sip_uri_hostname = sipUriHost;
|
||||||
|
voice_account_server_name = accountServer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -80,7 +80,7 @@ namespace OpenSim.ConsoleClient
|
||||||
while (m_Server.Running)
|
while (m_Server.Running)
|
||||||
{
|
{
|
||||||
System.Threading.Thread.Sleep(500);
|
System.Threading.Thread.Sleep(500);
|
||||||
MainConsole.Instance.Prompt();
|
// MainConsole.Instance.Prompt();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pidFile != String.Empty)
|
if (pidFile != String.Empty)
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace OpenSim.Data
|
||||||
public abstract class AssetDataBase : IAssetDataPlugin
|
public abstract class AssetDataBase : IAssetDataPlugin
|
||||||
{
|
{
|
||||||
public abstract AssetBase GetAsset(UUID uuid);
|
public abstract AssetBase GetAsset(UUID uuid);
|
||||||
public abstract bool StoreAsset(AssetBase asset);
|
public abstract void StoreAsset(AssetBase asset);
|
||||||
public abstract bool[] AssetsExist(UUID[] uuids);
|
public abstract bool[] AssetsExist(UUID[] uuids);
|
||||||
|
|
||||||
public abstract List<AssetMetadata> FetchAssetMetadataSet(int start, int count);
|
public abstract List<AssetMetadata> FetchAssetMetadataSet(int start, int count);
|
||||||
|
|
|
@ -47,25 +47,24 @@ namespace OpenSim.Data
|
||||||
if ((id == null) || (id == DBNull.Value))
|
if ((id == null) || (id == DBNull.Value))
|
||||||
return UUID.Zero;
|
return UUID.Zero;
|
||||||
|
|
||||||
Type idtype = id.GetType();
|
if (id.GetType() == typeof(Guid))
|
||||||
|
|
||||||
if (idtype == typeof(Guid))
|
|
||||||
return new UUID((Guid)id);
|
return new UUID((Guid)id);
|
||||||
|
|
||||||
if (id.GetType() == typeof(string))
|
if (id.GetType() == typeof(byte[]))
|
||||||
{
|
{
|
||||||
Guid gg;
|
if (((byte[])id).Length == 0)
|
||||||
if (Guid.TryParse((string)id, out gg))
|
|
||||||
return new UUID(gg);
|
|
||||||
return UUID.Zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (idtype == typeof(byte[]))
|
|
||||||
{
|
|
||||||
if (((byte[])id).Length < 16)
|
|
||||||
return UUID.Zero;
|
return UUID.Zero;
|
||||||
|
else if (((byte[])id).Length == 16)
|
||||||
return new UUID((byte[])id, 0);
|
return new UUID((byte[])id, 0);
|
||||||
}
|
}
|
||||||
|
else if (id.GetType() == typeof(string))
|
||||||
|
{
|
||||||
|
if (((string)id).Length == 0)
|
||||||
|
return UUID.Zero;
|
||||||
|
else if (((string)id).Length == 36)
|
||||||
|
return new UUID((string)id);
|
||||||
|
}
|
||||||
|
|
||||||
throw new Exception("Failed to convert db value to UUID: " + id.ToString());
|
throw new Exception("Failed to convert db value to UUID: " + id.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace OpenSim.Data
|
||||||
public interface IAssetDataPlugin : IPlugin
|
public interface IAssetDataPlugin : IPlugin
|
||||||
{
|
{
|
||||||
AssetBase GetAsset(UUID uuid);
|
AssetBase GetAsset(UUID uuid);
|
||||||
bool StoreAsset(AssetBase asset);
|
void StoreAsset(AssetBase asset);
|
||||||
bool[] AssetsExist(UUID[] uuids);
|
bool[] AssetsExist(UUID[] uuids);
|
||||||
List<AssetMetadata> FetchAssetMetadataSet(int start, int count);
|
List<AssetMetadata> FetchAssetMetadataSet(int start, int count);
|
||||||
void Initialise(string connect);
|
void Initialise(string connect);
|
||||||
|
|
|
@ -71,8 +71,6 @@ namespace OpenSim.Data
|
||||||
{
|
{
|
||||||
RegionData Get(UUID regionID, UUID ScopeID);
|
RegionData Get(UUID regionID, UUID ScopeID);
|
||||||
List<RegionData> Get(string regionName, UUID ScopeID);
|
List<RegionData> Get(string regionName, UUID ScopeID);
|
||||||
RegionData GetSpecific(string regionName, UUID ScopeID);
|
|
||||||
|
|
||||||
RegionData Get(int x, int y, UUID ScopeID);
|
RegionData Get(int x, int y, UUID ScopeID);
|
||||||
List<RegionData> Get(int xStart, int yStart, int xEnd, int yEnd, UUID ScopeID);
|
List<RegionData> Get(int xStart, int yStart, int xEnd, int yEnd, UUID ScopeID);
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,5 @@ namespace OpenSim.Data
|
||||||
bool Store(UserAccountData data);
|
bool Store(UserAccountData data);
|
||||||
bool Delete(string field, string val);
|
bool Delete(string field, string val);
|
||||||
UserAccountData[] GetUsers(UUID scopeID, string query);
|
UserAccountData[] GetUsers(UUID scopeID, string query);
|
||||||
UserAccountData[] GetUsersWhere(UUID scopeID, string where);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
|
|
|
@ -75,7 +75,6 @@ namespace OpenSim.Data.MySQL
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
Migration m = new Migration(dbcon, Assembly, "AssetStore");
|
Migration m = new Migration(dbcon, Assembly, "AssetStore");
|
||||||
m.Update();
|
m.Update();
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +144,6 @@ namespace OpenSim.Data.MySQL
|
||||||
string.Format("[ASSETS DB]: MySql failure fetching asset {0}. Exception ", assetID), e);
|
string.Format("[ASSETS DB]: MySql failure fetching asset {0}. Exception ", assetID), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return asset;
|
return asset;
|
||||||
|
@ -156,7 +154,17 @@ namespace OpenSim.Data.MySQL
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="asset">Asset UUID to create</param>
|
/// <param name="asset">Asset UUID to create</param>
|
||||||
/// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks>
|
/// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks>
|
||||||
override public bool StoreAsset(AssetBase asset)
|
override public void StoreAsset(AssetBase asset)
|
||||||
|
{
|
||||||
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
|
{
|
||||||
|
dbcon.Open();
|
||||||
|
|
||||||
|
using (MySqlCommand cmd =
|
||||||
|
new MySqlCommand(
|
||||||
|
"replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, CreatorID, data)" +
|
||||||
|
"VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?CreatorID, ?data)",
|
||||||
|
dbcon))
|
||||||
{
|
{
|
||||||
string assetName = asset.Name;
|
string assetName = asset.Name;
|
||||||
if (asset.Name.Length > AssetBase.MAX_ASSET_NAME)
|
if (asset.Name.Length > AssetBase.MAX_ASSET_NAME)
|
||||||
|
@ -176,16 +184,9 @@ namespace OpenSim.Data.MySQL
|
||||||
asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
|
asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
|
||||||
{
|
|
||||||
dbcon.Open();
|
|
||||||
using (MySqlCommand cmd =
|
|
||||||
new MySqlCommand(
|
|
||||||
"replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, CreatorID, data)" +
|
|
||||||
"VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?CreatorID, ?data)",
|
|
||||||
dbcon))
|
|
||||||
{
|
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
using (cmd)
|
||||||
{
|
{
|
||||||
// create unix epoch time
|
// create unix epoch time
|
||||||
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
||||||
|
@ -201,15 +202,15 @@ namespace OpenSim.Data.MySQL
|
||||||
cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
|
cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
|
||||||
cmd.Parameters.AddWithValue("?data", asset.Data);
|
cmd.Parameters.AddWithValue("?data", asset.Data);
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
dbcon.Close();
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
|
m_log.Error(
|
||||||
asset.FullID, asset.Name, e.Message);
|
string.Format(
|
||||||
dbcon.Close();
|
"[ASSET DB]: MySQL failure creating asset {0} with name {1}. Exception ",
|
||||||
return false;
|
asset.FullID, asset.Name)
|
||||||
|
, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,6 +226,8 @@ namespace OpenSim.Data.MySQL
|
||||||
= new MySqlCommand("update assets set access_time=?access_time where id=?id", dbcon))
|
= new MySqlCommand("update assets set access_time=?access_time where id=?id", dbcon))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
using (cmd)
|
||||||
{
|
{
|
||||||
// create unix epoch time
|
// create unix epoch time
|
||||||
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
||||||
|
@ -232,6 +235,7 @@ namespace OpenSim.Data.MySQL
|
||||||
cmd.Parameters.AddWithValue("?access_time", now);
|
cmd.Parameters.AddWithValue("?access_time", now);
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Error(
|
m_log.Error(
|
||||||
|
@ -241,7 +245,6 @@ namespace OpenSim.Data.MySQL
|
||||||
e);
|
e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,7 +277,6 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool[] results = new bool[uuids.Length];
|
bool[] results = new bool[uuids.Length];
|
||||||
|
@ -339,7 +341,6 @@ namespace OpenSim.Data.MySQL
|
||||||
e);
|
e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return retList;
|
return retList;
|
||||||
|
@ -356,7 +357,6 @@ namespace OpenSim.Data.MySQL
|
||||||
cmd.Parameters.AddWithValue("?id", id);
|
cmd.Parameters.AddWithValue("?id", id);
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -59,7 +59,6 @@ namespace OpenSim.Data.MySQL
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
Migration m = new Migration(dbcon, Assembly, "AuthStore");
|
Migration m = new Migration(dbcon, Assembly, "AuthStore");
|
||||||
m.Update();
|
m.Update();
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,34 +76,31 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
|
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
|
||||||
|
|
||||||
using(IDataReader result = cmd.ExecuteReader())
|
IDataReader result = cmd.ExecuteReader();
|
||||||
{
|
|
||||||
if(result.Read())
|
if (result.Read())
|
||||||
{
|
{
|
||||||
ret.PrincipalID = principalID;
|
ret.PrincipalID = principalID;
|
||||||
|
|
||||||
CheckColumnNames(result);
|
CheckColumnNames(result);
|
||||||
|
|
||||||
foreach(string s in m_ColumnNames)
|
foreach (string s in m_ColumnNames)
|
||||||
{
|
{
|
||||||
if(s == "UUID")
|
if (s == "UUID")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ret.Data[s] = result[s].ToString();
|
ret.Data[s] = result[s].ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
dbcon.Close();
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dbcon.Close();
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void CheckColumnNames(IDataReader result)
|
private void CheckColumnNames(IDataReader result)
|
||||||
{
|
{
|
||||||
|
|
|
@ -82,7 +82,6 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
Migration m = new Migration(dbcon, Assembly, "EstateStore");
|
Migration m = new Migration(dbcon, Assembly, "EstateStore");
|
||||||
m.Update();
|
m.Update();
|
||||||
dbcon.Close();
|
|
||||||
|
|
||||||
Type t = typeof(EstateSettings);
|
Type t = typeof(EstateSettings);
|
||||||
m_Fields = t.GetFields(BindingFlags.NonPublic |
|
m_Fields = t.GetFields(BindingFlags.NonPublic |
|
||||||
|
@ -144,6 +143,7 @@ namespace OpenSim.Data.MySQL
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
|
|
||||||
cmd.Connection = dbcon;
|
cmd.Connection = dbcon;
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
@ -171,8 +171,6 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
cmd.Connection = null;
|
|
||||||
|
|
||||||
if (!found && create)
|
if (!found && create)
|
||||||
{
|
{
|
||||||
|
@ -233,7 +231,6 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
es.Save();
|
es.Save();
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,7 +263,6 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveBanList(es);
|
SaveBanList(es);
|
||||||
|
@ -285,7 +281,7 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||||
{
|
{
|
||||||
cmd.CommandText = "select * from estateban where EstateID = ?EstateID";
|
cmd.CommandText = "select bannedUUID from estateban where EstateID = ?EstateID";
|
||||||
cmd.Parameters.AddWithValue("?EstateID", es.EstateID);
|
cmd.Parameters.AddWithValue("?EstateID", es.EstateID);
|
||||||
|
|
||||||
using (IDataReader r = cmd.ExecuteReader())
|
using (IDataReader r = cmd.ExecuteReader())
|
||||||
|
@ -293,16 +289,17 @@ namespace OpenSim.Data.MySQL
|
||||||
while (r.Read())
|
while (r.Read())
|
||||||
{
|
{
|
||||||
EstateBan eb = new EstateBan();
|
EstateBan eb = new EstateBan();
|
||||||
eb.BannedUserID = DBGuid.FromDB(r["bannedUUID"]); ;
|
|
||||||
|
UUID uuid = new UUID();
|
||||||
|
UUID.TryParse(r["bannedUUID"].ToString(), out uuid);
|
||||||
|
|
||||||
|
eb.BannedUserID = uuid;
|
||||||
eb.BannedHostAddress = "0.0.0.0";
|
eb.BannedHostAddress = "0.0.0.0";
|
||||||
eb.BannedHostIPMask = "0.0.0.0";
|
eb.BannedHostIPMask = "0.0.0.0";
|
||||||
eb.BanningUserID = DBGuid.FromDB(r["banningUUID"]);
|
|
||||||
eb.BanTime = Convert.ToInt32(r["banTime"]);
|
|
||||||
es.AddBan(eb);
|
es.AddBan(eb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,20 +318,17 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
cmd.Parameters.Clear();
|
cmd.Parameters.Clear();
|
||||||
|
|
||||||
cmd.CommandText = "insert into estateban (EstateID, bannedUUID, bannedIp, bannedIpHostMask, bannedNameMask, banningUUID, banTime) values ( ?EstateID, ?bannedUUID, '', '', '', ?banningUUID, ?banTime)";
|
cmd.CommandText = "insert into estateban (EstateID, bannedUUID, bannedIp, bannedIpHostMask, bannedNameMask) values ( ?EstateID, ?bannedUUID, '', '', '' )";
|
||||||
|
|
||||||
foreach (EstateBan b in es.EstateBans)
|
foreach (EstateBan b in es.EstateBans)
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString());
|
cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString());
|
||||||
cmd.Parameters.AddWithValue("?bannedUUID", b.BannedUserID.ToString());
|
cmd.Parameters.AddWithValue("?bannedUUID", b.BannedUserID.ToString());
|
||||||
cmd.Parameters.AddWithValue("?banningUUID", b.BanningUserID.ToString());
|
|
||||||
cmd.Parameters.AddWithValue("?banTime", b.BanTime);
|
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
cmd.Parameters.Clear();
|
cmd.Parameters.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,7 +358,6 @@ namespace OpenSim.Data.MySQL
|
||||||
cmd.Parameters.Clear();
|
cmd.Parameters.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,7 +383,6 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return uuids.ToArray();
|
return uuids.ToArray();
|
||||||
|
@ -445,6 +437,7 @@ namespace OpenSim.Data.MySQL
|
||||||
reader.Close();
|
reader.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dbcon.Close();
|
dbcon.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -473,6 +466,7 @@ namespace OpenSim.Data.MySQL
|
||||||
reader.Close();
|
reader.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dbcon.Close();
|
dbcon.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,10 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
protected MySqlConnection m_Connection = null;
|
||||||
protected string m_ConnectionString;
|
protected string m_ConnectionString;
|
||||||
protected string m_Table;
|
protected string m_Table;
|
||||||
|
protected Object m_connLock = new Object();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Number of days that must pass before we update the access time on an asset when it has been fetched
|
/// Number of days that must pass before we update the access time on an asset when it has been fetched
|
||||||
|
@ -73,13 +75,10 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (MySqlConnection conn = new MySqlConnection(m_ConnectionString))
|
OpenDatabase();
|
||||||
{
|
|
||||||
conn.Open();
|
Migration m = new Migration(m_Connection, Assembly, "FSAssetStore");
|
||||||
Migration m = new Migration(conn, Assembly, "FSAssetStore");
|
|
||||||
m.Update();
|
m.Update();
|
||||||
conn.Close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{
|
{
|
||||||
|
@ -101,68 +100,93 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private bool ExecuteNonQuery(MySqlCommand cmd)
|
private bool OpenDatabase()
|
||||||
{
|
|
||||||
using (MySqlConnection conn = new MySqlConnection(m_ConnectionString))
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
conn.Open();
|
m_Connection = new MySqlConnection(m_ConnectionString);
|
||||||
}
|
|
||||||
catch (MySqlException e)
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[FSASSETS]: Database open failed with {0}", e.ToString());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd.Connection = conn;
|
m_Connection.Open();
|
||||||
try
|
|
||||||
{
|
|
||||||
cmd.ExecuteNonQuery();
|
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{
|
{
|
||||||
cmd.Connection = null;
|
m_log.ErrorFormat("[FSASSETS]: Can't connect to database: {0}",
|
||||||
conn.Close();
|
e.Message.ToString());
|
||||||
m_log.ErrorFormat("[FSASSETS]: Query {0} failed with {1}", cmd.CommandText, e.ToString());
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
conn.Close();
|
|
||||||
cmd.Connection = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IDataReader ExecuteReader(MySqlCommand c)
|
||||||
|
{
|
||||||
|
IDataReader r = null;
|
||||||
|
MySqlConnection connection = (MySqlConnection) ((ICloneable)m_Connection).Clone();
|
||||||
|
connection.Open();
|
||||||
|
c.Connection = connection;
|
||||||
|
|
||||||
|
r = c.ExecuteReader();
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ExecuteNonQuery(MySqlCommand c)
|
||||||
|
{
|
||||||
|
lock (m_connLock)
|
||||||
|
{
|
||||||
|
bool errorSeen = false;
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
c.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
catch (MySqlException)
|
||||||
|
{
|
||||||
|
System.Threading.Thread.Sleep(500);
|
||||||
|
|
||||||
|
m_Connection.Close();
|
||||||
|
m_Connection = (MySqlConnection) ((ICloneable)m_Connection).Clone();
|
||||||
|
m_Connection.Open();
|
||||||
|
c.Connection = m_Connection;
|
||||||
|
|
||||||
|
if (!errorSeen)
|
||||||
|
{
|
||||||
|
errorSeen = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
m_log.ErrorFormat("[FSASSETS] MySQL command: {0}", c.CommandText);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#region IFSAssetDataPlugin Members
|
#region IFSAssetDataPlugin Members
|
||||||
|
|
||||||
public AssetMetadata Get(string id, out string hash)
|
public AssetMetadata Get(string id, out string hash)
|
||||||
{
|
{
|
||||||
hash = String.Empty;
|
hash = String.Empty;
|
||||||
|
|
||||||
AssetMetadata meta = new AssetMetadata();
|
MySqlCommand cmd = new MySqlCommand();
|
||||||
|
|
||||||
using (MySqlConnection conn = new MySqlConnection(m_ConnectionString))
|
cmd.CommandText = String.Format("select id, name, description, type, hash, create_time, access_time, asset_flags from {0} where id = ?id", m_Table);
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
conn.Open();
|
|
||||||
}
|
|
||||||
catch (MySqlException e)
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[FSASSETS]: Database open failed with {0}", e.ToString());
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
using (MySqlCommand cmd = conn.CreateCommand())
|
|
||||||
{
|
|
||||||
cmd.CommandText = String.Format("select id, name, description, type, hash, create_time, asset_flags, access_time from {0} where id = ?id", m_Table);
|
|
||||||
cmd.Parameters.AddWithValue("?id", id);
|
cmd.Parameters.AddWithValue("?id", id);
|
||||||
|
|
||||||
using (IDataReader reader = cmd.ExecuteReader())
|
IDataReader reader = ExecuteReader(cmd);
|
||||||
{
|
|
||||||
if (!reader.Read())
|
if (!reader.Read())
|
||||||
|
{
|
||||||
|
reader.Close();
|
||||||
|
FreeCommand(cmd);
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
AssetMetadata meta = new AssetMetadata();
|
||||||
|
|
||||||
hash = reader["hash"].ToString();
|
hash = reader["hash"].ToString();
|
||||||
|
|
||||||
|
@ -177,42 +201,34 @@ namespace OpenSim.Data.MySQL
|
||||||
meta.Flags = (AssetFlags)Convert.ToInt32(reader["asset_flags"]);
|
meta.Flags = (AssetFlags)Convert.ToInt32(reader["asset_flags"]);
|
||||||
|
|
||||||
int AccessTime = Convert.ToInt32(reader["access_time"]);
|
int AccessTime = Convert.ToInt32(reader["access_time"]);
|
||||||
UpdateAccessTime(id, AccessTime);
|
|
||||||
}
|
reader.Close();
|
||||||
}
|
|
||||||
conn.Close();
|
UpdateAccessTime(AccessTime, cmd);
|
||||||
}
|
|
||||||
|
FreeCommand(cmd);
|
||||||
|
|
||||||
return meta;
|
return meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateAccessTime(string AssetID, int AccessTime)
|
private void UpdateAccessTime(int AccessTime, MySqlCommand cmd)
|
||||||
{
|
{
|
||||||
// Reduce DB work by only updating access time if asset hasn't recently been accessed
|
// Reduce DB work by only updating access time if asset hasn't recently been accessed
|
||||||
// 0 By Default, Config option is "DaysBetweenAccessTimeUpdates"
|
// 0 By Default, Config option is "DaysBetweenAccessTimeUpdates"
|
||||||
if (DaysBetweenAccessTimeUpdates > 0 && (DateTime.UtcNow - Utils.UnixTimeToDateTime(AccessTime)).TotalDays < DaysBetweenAccessTimeUpdates)
|
if (DaysBetweenAccessTimeUpdates > 0 && (DateTime.UtcNow - Utils.UnixTimeToDateTime(AccessTime)).TotalDays < DaysBetweenAccessTimeUpdates)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
using (MySqlConnection conn = new MySqlConnection(m_ConnectionString))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
conn.Open();
|
|
||||||
}
|
|
||||||
catch (MySqlException e)
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[FSASSETS]: Database open failed with {0}", e.ToString());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
using (MySqlCommand cmd = conn.CreateCommand())
|
|
||||||
{
|
|
||||||
cmd.CommandText = String.Format("UPDATE {0} SET `access_time` = UNIX_TIMESTAMP() WHERE `id` = ?id", m_Table);
|
cmd.CommandText = String.Format("UPDATE {0} SET `access_time` = UNIX_TIMESTAMP() WHERE `id` = ?id", m_Table);
|
||||||
cmd.Parameters.AddWithValue("?id", AssetID);
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
conn.Close();
|
|
||||||
}
|
protected void FreeCommand(MySqlCommand cmd)
|
||||||
|
{
|
||||||
|
MySqlConnection c = cmd.Connection;
|
||||||
|
cmd.Dispose();
|
||||||
|
c.Close();
|
||||||
|
c.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Store(AssetMetadata meta, string hash)
|
public bool Store(AssetMetadata meta, string hash)
|
||||||
|
@ -222,13 +238,12 @@ namespace OpenSim.Data.MySQL
|
||||||
string oldhash;
|
string oldhash;
|
||||||
AssetMetadata existingAsset = Get(meta.ID, out oldhash);
|
AssetMetadata existingAsset = Get(meta.ID, out oldhash);
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand())
|
MySqlCommand cmd = m_Connection.CreateCommand();
|
||||||
{
|
|
||||||
cmd.Parameters.AddWithValue("?id", meta.ID);
|
cmd.Parameters.AddWithValue("?id", meta.ID);
|
||||||
cmd.Parameters.AddWithValue("?name", meta.Name);
|
cmd.Parameters.AddWithValue("?name", meta.Name);
|
||||||
cmd.Parameters.AddWithValue("?description", meta.Description);
|
cmd.Parameters.AddWithValue("?description", meta.Description);
|
||||||
// cmd.Parameters.AddWithValue("?type", meta.Type.ToString());
|
cmd.Parameters.AddWithValue("?type", meta.Type.ToString());
|
||||||
cmd.Parameters.AddWithValue("?type", meta.Type);
|
|
||||||
cmd.Parameters.AddWithValue("?hash", hash);
|
cmd.Parameters.AddWithValue("?hash", hash);
|
||||||
cmd.Parameters.AddWithValue("?asset_flags", meta.Flags);
|
cmd.Parameters.AddWithValue("?asset_flags", meta.Flags);
|
||||||
|
|
||||||
|
@ -238,6 +253,8 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
ExecuteNonQuery(cmd);
|
ExecuteNonQuery(cmd);
|
||||||
|
|
||||||
|
cmd.Dispose();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,13 +262,8 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
//ExecuteNonQuery(cmd);
|
//ExecuteNonQuery(cmd);
|
||||||
|
|
||||||
}
|
cmd.Dispose();
|
||||||
|
return false;
|
||||||
// return false;
|
|
||||||
// if the asset already exits
|
|
||||||
// assume it was already correctly stored
|
|
||||||
// or regions will keep retry.
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
|
@ -271,28 +283,12 @@ namespace OpenSim.Data.MySQL
|
||||||
if (uuids.Length == 0)
|
if (uuids.Length == 0)
|
||||||
return new bool[0];
|
return new bool[0];
|
||||||
|
|
||||||
bool[] results = new bool[uuids.Length];
|
|
||||||
for (int i = 0; i < uuids.Length; i++)
|
|
||||||
results[i] = false;
|
|
||||||
|
|
||||||
HashSet<UUID> exists = new HashSet<UUID>();
|
HashSet<UUID> exists = new HashSet<UUID>();
|
||||||
|
|
||||||
string ids = "'" + string.Join("','", uuids) + "'";
|
string ids = "'" + string.Join("','", uuids) + "'";
|
||||||
string sql = string.Format("select id from {1} where id in ({0})", ids, m_Table);
|
string sql = string.Format("select id from {1} where id in ({0})", ids, m_Table);
|
||||||
|
|
||||||
using (MySqlConnection conn = new MySqlConnection(m_ConnectionString))
|
using (MySqlCommand cmd = m_Connection.CreateCommand())
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
conn.Open();
|
|
||||||
}
|
|
||||||
catch (MySqlException e)
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[FSASSETS]: Failed to open database: {0}", e.ToString());
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
using (MySqlCommand cmd = conn.CreateCommand())
|
|
||||||
{
|
{
|
||||||
cmd.CommandText = sql;
|
cmd.CommandText = sql;
|
||||||
|
|
||||||
|
@ -305,9 +301,8 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
conn.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
bool[] results = new bool[uuids.Length];
|
||||||
for (int i = 0; i < uuids.Length; i++)
|
for (int i = 0; i < uuids.Length; i++)
|
||||||
results[i] = exists.Contains(uuids[i]);
|
results[i] = exists.Contains(uuids[i]);
|
||||||
return results;
|
return results;
|
||||||
|
@ -315,43 +310,27 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
public int Count()
|
public int Count()
|
||||||
{
|
{
|
||||||
int count = 0;
|
MySqlCommand cmd = m_Connection.CreateCommand();
|
||||||
|
|
||||||
using (MySqlConnection conn = new MySqlConnection(m_ConnectionString))
|
cmd.CommandText = String.Format("select count(*) as count from {0}", m_Table);
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
conn.Open();
|
|
||||||
}
|
|
||||||
catch (MySqlException e)
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[FSASSETS]: Failed to open database: {0}", e.ToString());
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
using(MySqlCommand cmd = conn.CreateCommand())
|
IDataReader reader = ExecuteReader(cmd);
|
||||||
{
|
|
||||||
cmd.CommandText = String.Format("select count(*) as count from {0}",m_Table);
|
|
||||||
|
|
||||||
using (IDataReader reader = cmd.ExecuteReader())
|
|
||||||
{
|
|
||||||
reader.Read();
|
reader.Read();
|
||||||
|
|
||||||
count = Convert.ToInt32(reader["count"]);
|
int count = Convert.ToInt32(reader["count"]);
|
||||||
}
|
|
||||||
}
|
reader.Close();
|
||||||
conn.Close();
|
FreeCommand(cmd);
|
||||||
}
|
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Delete(string id)
|
public bool Delete(string id)
|
||||||
{
|
{
|
||||||
using(MySqlCommand cmd = new MySqlCommand())
|
using (MySqlCommand cmd = m_Connection.CreateCommand())
|
||||||
{
|
{
|
||||||
|
cmd.CommandText = String.Format("delete from {0} where id = ?id", m_Table);
|
||||||
cmd.CommandText = String.Format("delete from {0} where id = ?id",m_Table);
|
|
||||||
|
|
||||||
cmd.Parameters.AddWithValue("?id", id);
|
cmd.Parameters.AddWithValue("?id", id);
|
||||||
|
|
||||||
|
@ -363,12 +342,12 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
public void Import(string conn, string table, int start, int count, bool force, FSStoreDelegate store)
|
public void Import(string conn, string table, int start, int count, bool force, FSStoreDelegate store)
|
||||||
{
|
{
|
||||||
int imported = 0;
|
MySqlConnection importConn;
|
||||||
|
|
||||||
using (MySqlConnection importConn = new MySqlConnection(conn))
|
|
||||||
{
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
importConn = new MySqlConnection(conn);
|
||||||
|
|
||||||
importConn.Open();
|
importConn.Open();
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
|
@ -379,8 +358,10 @@ namespace OpenSim.Data.MySQL
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using (MySqlCommand cmd = importConn.CreateCommand())
|
int imported = 0;
|
||||||
{
|
|
||||||
|
MySqlCommand cmd = importConn.CreateCommand();
|
||||||
|
|
||||||
string limit = String.Empty;
|
string limit = String.Empty;
|
||||||
if (count != -1)
|
if (count != -1)
|
||||||
{
|
{
|
||||||
|
@ -390,8 +371,8 @@ namespace OpenSim.Data.MySQL
|
||||||
cmd.CommandText = String.Format("select * from {0}{1}", table, limit);
|
cmd.CommandText = String.Format("select * from {0}{1}", table, limit);
|
||||||
|
|
||||||
MainConsole.Instance.Output("Querying database");
|
MainConsole.Instance.Output("Querying database");
|
||||||
using (IDataReader reader = cmd.ExecuteReader())
|
IDataReader reader = cmd.ExecuteReader();
|
||||||
{
|
|
||||||
MainConsole.Instance.Output("Reading data");
|
MainConsole.Instance.Output("Reading data");
|
||||||
|
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
|
@ -420,10 +401,10 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
imported++;
|
imported++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
reader.Close();
|
||||||
|
cmd.Dispose();
|
||||||
importConn.Close();
|
importConn.Close();
|
||||||
}
|
|
||||||
|
|
||||||
MainConsole.Instance.Output(String.Format("Import done, {0} assets imported", imported));
|
MainConsole.Instance.Output(String.Format("Import done, {0} assets imported", imported));
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ using MySql.Data.MySqlClient;
|
||||||
namespace OpenSim.Data.MySQL
|
namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Common code for a number of database modules
|
/// A database interface class to a user profile storage system
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MySqlFramework
|
public class MySqlFramework
|
||||||
{
|
{
|
||||||
|
@ -44,72 +44,23 @@ namespace OpenSim.Data.MySQL
|
||||||
log4net.LogManager.GetLogger(
|
log4net.LogManager.GetLogger(
|
||||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
protected string m_connectionString = String.Empty;
|
protected string m_connectionString;
|
||||||
protected MySqlTransaction m_trans = null;
|
|
||||||
|
|
||||||
// Constructor using a connection string. Instances constructed
|
|
||||||
// this way will open a new connection for each call.
|
|
||||||
protected MySqlFramework(string connectionString)
|
protected MySqlFramework(string connectionString)
|
||||||
{
|
{
|
||||||
m_connectionString = connectionString;
|
m_connectionString = connectionString;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor using a connection object. Instances constructed
|
|
||||||
// this way will use the connection object and never create
|
|
||||||
// new connections.
|
|
||||||
protected MySqlFramework(MySqlTransaction trans)
|
|
||||||
{
|
|
||||||
m_trans = trans;
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// All non queries are funneled through one connection
|
|
||||||
// to increase performance a little
|
|
||||||
//
|
|
||||||
protected int ExecuteNonQuery(MySqlCommand cmd)
|
protected int ExecuteNonQuery(MySqlCommand cmd)
|
||||||
{
|
|
||||||
if (m_trans == null)
|
|
||||||
{
|
{
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
int ret = ExecuteNonQueryWithConnection(cmd, dbcon);
|
|
||||||
dbcon.Close();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return ExecuteNonQueryWithTransaction(cmd, m_trans);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private int ExecuteNonQueryWithTransaction(MySqlCommand cmd, MySqlTransaction trans)
|
|
||||||
{
|
|
||||||
cmd.Transaction = trans;
|
|
||||||
return ExecuteNonQueryWithConnection(cmd, trans.Connection);
|
|
||||||
}
|
|
||||||
|
|
||||||
private int ExecuteNonQueryWithConnection(MySqlCommand cmd, MySqlConnection dbcon)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
cmd.Connection = dbcon;
|
cmd.Connection = dbcon;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int ret = cmd.ExecuteNonQuery();
|
return cmd.ExecuteNonQuery();
|
||||||
cmd.Connection = null;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
m_log.Error(e.Message, e);
|
|
||||||
m_log.Error(Environment.StackTrace.ToString());
|
|
||||||
cmd.Connection = null;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -118,4 +69,5 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -29,9 +29,11 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using log4net;
|
||||||
using MySql.Data.MySqlClient;
|
using MySql.Data.MySqlClient;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
|
||||||
namespace OpenSim.Data.MySQL
|
namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
|
@ -51,27 +53,14 @@ namespace OpenSim.Data.MySQL
|
||||||
get { return GetType().Assembly; }
|
get { return GetType().Assembly; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public MySQLGenericTableHandler(MySqlTransaction trans,
|
|
||||||
string realm, string storeName) : base(trans)
|
|
||||||
{
|
|
||||||
m_Realm = realm;
|
|
||||||
|
|
||||||
CommonConstruct(storeName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MySQLGenericTableHandler(string connectionString,
|
public MySQLGenericTableHandler(string connectionString,
|
||||||
string realm, string storeName) : base(connectionString)
|
string realm, string storeName) : base(connectionString)
|
||||||
{
|
{
|
||||||
m_Realm = realm;
|
m_Realm = realm;
|
||||||
|
m_connectionString = connectionString;
|
||||||
|
|
||||||
CommonConstruct(storeName);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void CommonConstruct(string storeName)
|
|
||||||
{
|
|
||||||
if (storeName != String.Empty)
|
if (storeName != String.Empty)
|
||||||
{
|
{
|
||||||
// We always use a new connection for any Migrations
|
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
|
@ -117,69 +106,30 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
public virtual T[] Get(string field, string key)
|
public virtual T[] Get(string field, string key)
|
||||||
{
|
{
|
||||||
using (MySqlCommand cmd = new MySqlCommand())
|
return Get(new string[] { field }, new string[] { key });
|
||||||
{
|
|
||||||
cmd.Parameters.AddWithValue(field, key);
|
|
||||||
cmd.CommandText = string.Format("select * from {0} where `{1}` = ?{1}", m_Realm, field);
|
|
||||||
return DoQuery(cmd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual T[] Get(string field, string[] keys)
|
|
||||||
{
|
|
||||||
int flen = keys.Length;
|
|
||||||
if(flen == 0)
|
|
||||||
return new T[0];
|
|
||||||
|
|
||||||
int flast = flen - 1;
|
|
||||||
StringBuilder sb = new StringBuilder(1024);
|
|
||||||
sb.AppendFormat("select * from {0} where {1} IN (?", m_Realm, field);
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand())
|
|
||||||
{
|
|
||||||
for (int i = 0 ; i < flen ; i++)
|
|
||||||
{
|
|
||||||
string fname = field + i.ToString();
|
|
||||||
cmd.Parameters.AddWithValue(fname, keys[i]);
|
|
||||||
|
|
||||||
sb.Append(fname);
|
|
||||||
if(i < flast)
|
|
||||||
sb.Append(",?");
|
|
||||||
else
|
|
||||||
sb.Append(")");
|
|
||||||
}
|
|
||||||
cmd.CommandText = sb.ToString();
|
|
||||||
return DoQuery(cmd);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual T[] Get(string[] fields, string[] keys)
|
public virtual T[] Get(string[] fields, string[] keys)
|
||||||
{
|
{
|
||||||
return Get(fields, keys, String.Empty);
|
if (fields.Length != keys.Length)
|
||||||
}
|
|
||||||
|
|
||||||
public virtual T[] Get(string[] fields, string[] keys, string options)
|
|
||||||
{
|
|
||||||
int flen = fields.Length;
|
|
||||||
if (flen == 0 || flen != keys.Length)
|
|
||||||
return new T[0];
|
return new T[0];
|
||||||
|
|
||||||
int flast = flen - 1;
|
List<string> terms = new List<string>();
|
||||||
StringBuilder sb = new StringBuilder(1024);
|
|
||||||
sb.AppendFormat("select * from {0} where ", m_Realm);
|
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand())
|
using (MySqlCommand cmd = new MySqlCommand())
|
||||||
{
|
{
|
||||||
for (int i = 0 ; i < flen ; i++)
|
for (int i = 0 ; i < fields.Length ; i++)
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue(fields[i], keys[i]);
|
cmd.Parameters.AddWithValue(fields[i], keys[i]);
|
||||||
if(i < flast)
|
terms.Add("`" + fields[i] + "` = ?" + fields[i]);
|
||||||
sb.AppendFormat("`{0}` = ?{0} and ", fields[i]);
|
|
||||||
else
|
|
||||||
sb.AppendFormat("`{0}` = ?{0} ", fields[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.Append(options);
|
string where = String.Join(" and ", terms.ToArray());
|
||||||
cmd.CommandText = sb.ToString();
|
|
||||||
|
string query = String.Format("select * from {0} where {1}",
|
||||||
|
m_Realm, where);
|
||||||
|
|
||||||
|
cmd.CommandText = query;
|
||||||
|
|
||||||
return DoQuery(cmd);
|
return DoQuery(cmd);
|
||||||
}
|
}
|
||||||
|
@ -187,33 +137,11 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
protected T[] DoQuery(MySqlCommand cmd)
|
protected T[] DoQuery(MySqlCommand cmd)
|
||||||
{
|
{
|
||||||
if (m_trans == null)
|
List<T> result = new List<T>();
|
||||||
{
|
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
T[] ret = DoQueryWithConnection(cmd, dbcon);
|
|
||||||
dbcon.Close();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return DoQueryWithTransaction(cmd, m_trans);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected T[] DoQueryWithTransaction(MySqlCommand cmd, MySqlTransaction trans)
|
|
||||||
{
|
|
||||||
cmd.Transaction = trans;
|
|
||||||
|
|
||||||
return DoQueryWithConnection(cmd, trans.Connection);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected T[] DoQueryWithConnection(MySqlCommand cmd, MySqlConnection dbcon)
|
|
||||||
{
|
|
||||||
List<T> result = new List<T>();
|
|
||||||
|
|
||||||
cmd.Connection = dbcon;
|
cmd.Connection = dbcon;
|
||||||
|
|
||||||
using (IDataReader reader = cmd.ExecuteReader())
|
using (IDataReader reader = cmd.ExecuteReader())
|
||||||
|
@ -236,7 +164,7 @@ namespace OpenSim.Data.MySQL
|
||||||
if (m_Fields[name].FieldType == typeof(bool))
|
if (m_Fields[name].FieldType == typeof(bool))
|
||||||
{
|
{
|
||||||
int v = Convert.ToInt32(reader[name]);
|
int v = Convert.ToInt32(reader[name]);
|
||||||
m_Fields[name].SetValue(row, v != 0);
|
m_Fields[name].SetValue(row, v != 0 ? true : false);
|
||||||
}
|
}
|
||||||
else if (m_Fields[name].FieldType == typeof(UUID))
|
else if (m_Fields[name].FieldType == typeof(UUID))
|
||||||
{
|
{
|
||||||
|
@ -247,11 +175,6 @@ namespace OpenSim.Data.MySQL
|
||||||
int v = Convert.ToInt32(reader[name]);
|
int v = Convert.ToInt32(reader[name]);
|
||||||
m_Fields[name].SetValue(row, v);
|
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
|
else
|
||||||
{
|
{
|
||||||
m_Fields[name].SetValue(row, reader[name]);
|
m_Fields[name].SetValue(row, reader[name]);
|
||||||
|
@ -276,7 +199,8 @@ namespace OpenSim.Data.MySQL
|
||||||
result.Add(row);
|
result.Add(row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cmd.Connection = null;
|
}
|
||||||
|
|
||||||
return result.ToArray();
|
return result.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,26 +279,25 @@ namespace OpenSim.Data.MySQL
|
||||||
// "[MYSQL GENERIC TABLE HANDLER]: Delete(string[] fields, string[] keys) invoked with {0}:{1}",
|
// "[MYSQL GENERIC TABLE HANDLER]: Delete(string[] fields, string[] keys) invoked with {0}:{1}",
|
||||||
// string.Join(",", fields), string.Join(",", keys));
|
// string.Join(",", fields), string.Join(",", keys));
|
||||||
|
|
||||||
int flen = fields.Length;
|
if (fields.Length != keys.Length)
|
||||||
if (flen == 0 || flen != keys.Length)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int flast = flen - 1;
|
List<string> terms = new List<string>();
|
||||||
StringBuilder sb = new StringBuilder(1024);
|
|
||||||
sb.AppendFormat("delete from {0} where ", m_Realm);
|
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand())
|
using (MySqlCommand cmd = new MySqlCommand())
|
||||||
{
|
{
|
||||||
for (int i = 0 ; i < flen ; i++)
|
for (int i = 0 ; i < fields.Length ; i++)
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue(fields[i], keys[i]);
|
cmd.Parameters.AddWithValue(fields[i], keys[i]);
|
||||||
if(i < flast)
|
terms.Add("`" + fields[i] + "` = ?" + fields[i]);
|
||||||
sb.AppendFormat("`{0}` = ?{0} and ", fields[i]);
|
|
||||||
else
|
|
||||||
sb.AppendFormat("`{0}` = ?{0}", fields[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.CommandText = sb.ToString();
|
string where = String.Join(" and ", terms.ToArray());
|
||||||
|
|
||||||
|
string query = String.Format("delete from {0} where {1}", m_Realm, where);
|
||||||
|
|
||||||
|
cmd.CommandText = query;
|
||||||
|
|
||||||
return ExecuteNonQuery(cmd) > 0;
|
return ExecuteNonQuery(cmd) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -386,27 +309,27 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
public long GetCount(string[] fields, string[] keys)
|
public long GetCount(string[] fields, string[] keys)
|
||||||
{
|
{
|
||||||
int flen = fields.Length;
|
if (fields.Length != keys.Length)
|
||||||
if (flen == 0 || flen != keys.Length)
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int flast = flen - 1;
|
List<string> terms = new List<string>();
|
||||||
StringBuilder sb = new StringBuilder(1024);
|
|
||||||
sb.AppendFormat("select count(*) from {0} where ", m_Realm);
|
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand())
|
using (MySqlCommand cmd = new MySqlCommand())
|
||||||
{
|
{
|
||||||
for (int i = 0 ; i < flen ; i++)
|
for (int i = 0; i < fields.Length; i++)
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue(fields[i], keys[i]);
|
cmd.Parameters.AddWithValue(fields[i], keys[i]);
|
||||||
if(i < flast)
|
terms.Add("`" + fields[i] + "` = ?" + fields[i]);
|
||||||
sb.AppendFormat("`{0}` = ?{0} and ", fields[i]);
|
|
||||||
else
|
|
||||||
sb.AppendFormat("`{0}` = ?{0}", fields[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.CommandText = sb.ToString();
|
string where = String.Join(" and ", terms.ToArray());
|
||||||
object result = DoQueryScalar(cmd);
|
|
||||||
|
string query = String.Format("select count(*) from {0} where {1}",
|
||||||
|
m_Realm, where);
|
||||||
|
|
||||||
|
cmd.CommandText = query;
|
||||||
|
|
||||||
|
Object result = DoQueryScalar(cmd);
|
||||||
|
|
||||||
return Convert.ToInt64(result);
|
return Convert.ToInt64(result);
|
||||||
}
|
}
|
||||||
|
@ -428,27 +351,15 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
|
|
||||||
public object DoQueryScalar(MySqlCommand cmd)
|
public object DoQueryScalar(MySqlCommand cmd)
|
||||||
{
|
|
||||||
if (m_trans == null)
|
|
||||||
{
|
{
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
cmd.Connection = dbcon;
|
cmd.Connection = dbcon;
|
||||||
|
|
||||||
object ret = cmd.ExecuteScalar();
|
|
||||||
cmd.Connection = null;
|
|
||||||
dbcon.Close();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cmd.Connection = m_trans.Connection;
|
|
||||||
cmd.Transaction = m_trans;
|
|
||||||
|
|
||||||
return cmd.ExecuteScalar();
|
return cmd.ExecuteScalar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -90,7 +90,7 @@ namespace OpenSim.Data.MySQL
|
||||||
else
|
else
|
||||||
pattern = string.Format("Name LIKE '%{0}%'", MySqlHelper.EscapeString(pattern));
|
pattern = string.Format("Name LIKE '%{0}%'", MySqlHelper.EscapeString(pattern));
|
||||||
|
|
||||||
return m_Groups.Get(string.Format("ShowInList=1 AND ({0})", pattern));
|
return m_Groups.Get(string.Format("ShowInList=1 AND ({0}) ORDER BY Name LIMIT 100", pattern));
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool DeleteGroup(UUID groupID)
|
public bool DeleteGroup(UUID groupID)
|
||||||
|
@ -431,7 +431,8 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand())
|
using (MySqlCommand cmd = new MySqlCommand())
|
||||||
{
|
{
|
||||||
cmd.CommandText = String.Format("delete from {0} where TMStamp < NOW() - INTERVAL 2 WEEK", m_Realm);
|
cmd.CommandText = String.Format("delete from {0} where TMStamp < ?tstamp", m_Realm);
|
||||||
|
cmd.Parameters.AddWithValue("?tstamp", now - 14 * 24 * 60 * 60); // > 2 weeks old
|
||||||
|
|
||||||
ExecuteNonQuery(cmd);
|
ExecuteNonQuery(cmd);
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,6 @@ namespace OpenSim.Data.MySQL
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
Migration m = new Migration(dbcon, assem, "InventoryStore");
|
Migration m = new Migration(dbcon, assem, "InventoryStore");
|
||||||
m.Update();
|
m.Update();
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +130,6 @@ namespace OpenSim.Data.MySQL
|
||||||
items.Add(item);
|
items.Add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
dbcon.Close();
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -172,7 +170,6 @@ namespace OpenSim.Data.MySQL
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
items.Add(readInventoryFolder(reader));
|
items.Add(readInventoryFolder(reader));
|
||||||
|
|
||||||
dbcon.Close();
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -224,7 +221,6 @@ namespace OpenSim.Data.MySQL
|
||||||
if (items.Count > 0)
|
if (items.Count > 0)
|
||||||
rootFolder = items[0];
|
rootFolder = items[0];
|
||||||
|
|
||||||
dbcon.Close();
|
|
||||||
return rootFolder;
|
return rootFolder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -265,7 +261,6 @@ namespace OpenSim.Data.MySQL
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
items.Add(readInventoryFolder(reader));
|
items.Add(readInventoryFolder(reader));
|
||||||
|
|
||||||
dbcon.Close();
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -357,7 +352,6 @@ namespace OpenSim.Data.MySQL
|
||||||
if (reader.Read())
|
if (reader.Read())
|
||||||
item = readInventoryItem(reader);
|
item = readInventoryItem(reader);
|
||||||
|
|
||||||
dbcon.Close();
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -423,7 +417,6 @@ namespace OpenSim.Data.MySQL
|
||||||
if (reader.Read())
|
if (reader.Read())
|
||||||
folder = readInventoryFolder(reader);
|
folder = readInventoryFolder(reader);
|
||||||
|
|
||||||
dbcon.Close();
|
|
||||||
return folder;
|
return folder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -511,7 +504,6 @@ namespace OpenSim.Data.MySQL
|
||||||
lock (m_dbLock)
|
lock (m_dbLock)
|
||||||
result.ExecuteNonQuery();
|
result.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
|
@ -548,7 +540,6 @@ namespace OpenSim.Data.MySQL
|
||||||
lock (m_dbLock)
|
lock (m_dbLock)
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
|
@ -609,7 +600,6 @@ namespace OpenSim.Data.MySQL
|
||||||
m_log.Error(e.ToString());
|
m_log.Error(e.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -653,7 +643,6 @@ namespace OpenSim.Data.MySQL
|
||||||
m_log.Error(e.ToString());
|
m_log.Error(e.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -817,7 +806,6 @@ namespace OpenSim.Data.MySQL
|
||||||
lock (m_dbLock)
|
lock (m_dbLock)
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
|
@ -845,7 +833,6 @@ namespace OpenSim.Data.MySQL
|
||||||
lock (m_dbLock)
|
lock (m_dbLock)
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
|
@ -899,7 +886,6 @@ namespace OpenSim.Data.MySQL
|
||||||
if (item != null)
|
if (item != null)
|
||||||
list.Add(item);
|
list.Add(item);
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,6 @@ namespace OpenSim.Data.MySQL
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
Migration m = new Migration(dbcon, Assembly, "GridStore");
|
Migration m = new Migration(dbcon, Assembly, "GridStore");
|
||||||
m.Update();
|
m.Update();
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,15 +80,16 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public RegionData GetSpecific(string regionName, UUID scopeID)
|
public RegionData Get(int posX, int posY, UUID scopeID)
|
||||||
{
|
{
|
||||||
string command = "select * from `" + m_Realm + "` where regionName = ?regionName";
|
string command = "select * from `"+m_Realm+"` where locX = ?posX and locY = ?posY";
|
||||||
if (scopeID != UUID.Zero)
|
if (scopeID != UUID.Zero)
|
||||||
command += " and ScopeID = ?scopeID";
|
command += " and ScopeID = ?scopeID";
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
using (MySqlCommand cmd = new MySqlCommand(command))
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue("?regionName", regionName);
|
cmd.Parameters.AddWithValue("?posX", posX.ToString());
|
||||||
|
cmd.Parameters.AddWithValue("?posY", posY.ToString());
|
||||||
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
|
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
|
||||||
|
|
||||||
List<RegionData> ret = RunCommand(cmd);
|
List<RegionData> ret = RunCommand(cmd);
|
||||||
|
@ -98,48 +98,6 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
return ret[0];
|
return ret[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public RegionData Get(int posX, int posY, UUID scopeID)
|
|
||||||
{
|
|
||||||
string command = "select * from `" + m_Realm + "` where locX between ?startX and ?endX and locY between ?startY and ?endY";
|
|
||||||
if (scopeID != UUID.Zero)
|
|
||||||
command += " and ScopeID = ?scopeID";
|
|
||||||
|
|
||||||
int startX = posX - (int)Constants.MaximumRegionSize;
|
|
||||||
int startY = posY - (int)Constants.MaximumRegionSize;
|
|
||||||
int endX = posX;
|
|
||||||
int endY = posY;
|
|
||||||
|
|
||||||
List<RegionData> ret;
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
|
||||||
{
|
|
||||||
cmd.Parameters.AddWithValue("?startX", startX.ToString());
|
|
||||||
cmd.Parameters.AddWithValue("?startY", startY.ToString());
|
|
||||||
cmd.Parameters.AddWithValue("?endX", endX.ToString());
|
|
||||||
cmd.Parameters.AddWithValue("?endY", endY.ToString());
|
|
||||||
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
|
|
||||||
|
|
||||||
ret = RunCommand(cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ret.Count == 0)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
// find the first that contains pos
|
|
||||||
RegionData rg = null;
|
|
||||||
foreach (RegionData r in ret)
|
|
||||||
{
|
|
||||||
if (posX >= r.posX && posX < r.posX + r.sizeX
|
|
||||||
&& posY >= r.posY && posY < r.posY + r.sizeY)
|
|
||||||
{
|
|
||||||
rg = r;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return rg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public RegionData Get(UUID regionID, UUID scopeID)
|
public RegionData Get(UUID regionID, UUID scopeID)
|
||||||
|
@ -163,7 +121,6 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
public List<RegionData> Get(int startX, int startY, int endX, int endY, UUID scopeID)
|
public List<RegionData> Get(int startX, int startY, int endX, int endY, UUID scopeID)
|
||||||
{
|
{
|
||||||
/* fix size regions
|
|
||||||
string command = "select * from `"+m_Realm+"` where locX between ?startX and ?endX and locY between ?startY and ?endY";
|
string command = "select * from `"+m_Realm+"` where locX between ?startX and ?endX and locY between ?startY and ?endY";
|
||||||
if (scopeID != UUID.Zero)
|
if (scopeID != UUID.Zero)
|
||||||
command += " and ScopeID = ?scopeID";
|
command += " and ScopeID = ?scopeID";
|
||||||
|
@ -178,38 +135,6 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
return RunCommand(cmd);
|
return RunCommand(cmd);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
string command = "select * from `" + m_Realm + "` where locX between ?startX and ?endX and locY between ?startY and ?endY";
|
|
||||||
if (scopeID != UUID.Zero)
|
|
||||||
command += " and ScopeID = ?scopeID";
|
|
||||||
|
|
||||||
int qstartX = startX - (int)Constants.MaximumRegionSize;
|
|
||||||
int qstartY = startY - (int)Constants.MaximumRegionSize;
|
|
||||||
|
|
||||||
List<RegionData> dbret;
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
|
||||||
{
|
|
||||||
cmd.Parameters.AddWithValue("?startX", qstartX.ToString());
|
|
||||||
cmd.Parameters.AddWithValue("?startY", qstartY.ToString());
|
|
||||||
cmd.Parameters.AddWithValue("?endX", endX.ToString());
|
|
||||||
cmd.Parameters.AddWithValue("?endY", endY.ToString());
|
|
||||||
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
|
|
||||||
|
|
||||||
dbret = RunCommand(cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<RegionData> ret = new List<RegionData>();
|
|
||||||
|
|
||||||
if (dbret.Count == 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
foreach (RegionData r in dbret)
|
|
||||||
{
|
|
||||||
if (r.posX + r.sizeX > startX && r.posX <= endX
|
|
||||||
&& r.posY + r.sizeY > startY && r.posY <= endY)
|
|
||||||
ret.Add(r);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<RegionData> RunCommand(MySqlCommand cmd)
|
public List<RegionData> RunCommand(MySqlCommand cmd)
|
||||||
|
@ -262,8 +187,6 @@ namespace OpenSim.Data.MySQL
|
||||||
retList.Add(ret);
|
retList.Add(ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cmd.Connection = null;
|
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return retList;
|
return retList;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -46,21 +46,17 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
string[] words = query.Split(new char[] {' '});
|
string[] words = query.Split(new char[] {' '});
|
||||||
|
|
||||||
bool valid = false;
|
|
||||||
|
|
||||||
for (int i = 0 ; i < words.Length ; i++)
|
for (int i = 0 ; i < words.Length ; i++)
|
||||||
{
|
{
|
||||||
if (words[i].Length > 2)
|
if (words[i].Length < 3)
|
||||||
valid = true;
|
{
|
||||||
// if (words[i].Length < 3)
|
if (i != words.Length - 1)
|
||||||
// {
|
Array.Copy(words, i + 1, words, i, words.Length - i - 1);
|
||||||
// if (i != words.Length - 1)
|
Array.Resize(ref words, words.Length - 1);
|
||||||
// Array.Copy(words, i + 1, words, i, words.Length - i - 1);
|
}
|
||||||
// Array.Resize(ref words, words.Length - 1);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!valid) || words.Length == 0)
|
if (words.Length == 0)
|
||||||
return new UserAccountData[0];
|
return new UserAccountData[0];
|
||||||
|
|
||||||
if (words.Length > 2)
|
if (words.Length > 2)
|
||||||
|
@ -70,13 +66,13 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
if (words.Length == 1)
|
if (words.Length == 1)
|
||||||
{
|
{
|
||||||
cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search) and active=1", m_Realm);
|
cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search)", m_Realm);
|
||||||
cmd.Parameters.AddWithValue("?search", "%" + words[0] + "%");
|
cmd.Parameters.AddWithValue("?search", "%" + words[0] + "%");
|
||||||
cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
|
cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst and LastName like ?searchLast) and active=1", m_Realm);
|
cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst or LastName like ?searchLast)", m_Realm);
|
||||||
cmd.Parameters.AddWithValue("?searchFirst", "%" + words[0] + "%");
|
cmd.Parameters.AddWithValue("?searchFirst", "%" + words[0] + "%");
|
||||||
cmd.Parameters.AddWithValue("?searchLast", "%" + words[1] + "%");
|
cmd.Parameters.AddWithValue("?searchLast", "%" + words[1] + "%");
|
||||||
cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
|
cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
|
||||||
|
@ -85,21 +81,5 @@ namespace OpenSim.Data.MySQL
|
||||||
return DoQuery(cmd);
|
return DoQuery(cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserAccountData[] GetUsersWhere(UUID scopeID, string where)
|
|
||||||
{
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand())
|
|
||||||
{
|
|
||||||
if (scopeID != UUID.Zero)
|
|
||||||
{
|
|
||||||
where = "(ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (" + where + ")";
|
|
||||||
cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd.CommandText = String.Format("select * from {0} where " + where, m_Realm);
|
|
||||||
|
|
||||||
return DoQuery(cmd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -69,7 +69,6 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
Migration m = new Migration(dbcon, Assembly, "UserProfiles");
|
Migration m = new Migration(dbcon, Assembly, "UserProfiles");
|
||||||
m.Update();
|
m.Update();
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion Member Functions
|
#endregion Member Functions
|
||||||
|
@ -90,7 +89,7 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
|
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
|
||||||
{
|
{
|
||||||
const string query = "SELECT classifieduuid, name FROM classifieds WHERE creatoruuid = ?Id";
|
string query = "SELECT classifieduuid, name FROM classifieds WHERE creatoruuid = ?Id";
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
|
using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
|
||||||
{
|
{
|
||||||
|
@ -112,7 +111,8 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[PROFILES_DATA] GetClassifiedRecords exception {0}", e.Message);
|
m_log.ErrorFormat("[PROFILES_DATA]" +
|
||||||
|
": UserAccount exception {0}", e.Message);
|
||||||
}
|
}
|
||||||
n.Add("classifieduuid", OSD.FromUUID(Id));
|
n.Add("classifieduuid", OSD.FromUUID(Id));
|
||||||
n.Add("name", OSD.FromString(Name));
|
n.Add("name", OSD.FromString(Name));
|
||||||
|
@ -121,58 +121,58 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool UpdateClassifiedRecord(UserClassifiedAdd ad, ref string result)
|
public bool UpdateClassifiedRecord(UserClassifiedAdd ad, ref string result)
|
||||||
{
|
{
|
||||||
const string query =
|
string query = string.Empty;
|
||||||
"INSERT INTO classifieds ("
|
|
||||||
+ "`classifieduuid`,"
|
|
||||||
+ "`creatoruuid`,"
|
query += "INSERT INTO classifieds (";
|
||||||
+ "`creationdate`,"
|
query += "`classifieduuid`,";
|
||||||
+ "`expirationdate`,"
|
query += "`creatoruuid`,";
|
||||||
+ "`category`,"
|
query += "`creationdate`,";
|
||||||
+ "`name`,"
|
query += "`expirationdate`,";
|
||||||
+ "`description`,"
|
query += "`category`,";
|
||||||
+ "`parceluuid`,"
|
query += "`name`,";
|
||||||
+ "`parentestate`,"
|
query += "`description`,";
|
||||||
+ "`snapshotuuid`,"
|
query += "`parceluuid`,";
|
||||||
+ "`simname`,"
|
query += "`parentestate`,";
|
||||||
+ "`posglobal`,"
|
query += "`snapshotuuid`,";
|
||||||
+ "`parcelname`,"
|
query += "`simname`,";
|
||||||
+ "`classifiedflags`,"
|
query += "`posglobal`,";
|
||||||
+ "`priceforlisting`) "
|
query += "`parcelname`,";
|
||||||
+ "VALUES ("
|
query += "`classifiedflags`,";
|
||||||
+ "?ClassifiedId,"
|
query += "`priceforlisting`) ";
|
||||||
+ "?CreatorId,"
|
query += "VALUES (";
|
||||||
+ "?CreatedDate,"
|
query += "?ClassifiedId,";
|
||||||
+ "?ExpirationDate,"
|
query += "?CreatorId,";
|
||||||
+ "?Category,"
|
query += "?CreatedDate,";
|
||||||
+ "?Name,"
|
query += "?ExpirationDate,";
|
||||||
+ "?Description,"
|
query += "?Category,";
|
||||||
+ "?ParcelId,"
|
query += "?Name,";
|
||||||
+ "?ParentEstate,"
|
query += "?Description,";
|
||||||
+ "?SnapshotId,"
|
query += "?ParcelId,";
|
||||||
+ "?SimName,"
|
query += "?ParentEstate,";
|
||||||
+ "?GlobalPos,"
|
query += "?SnapshotId,";
|
||||||
+ "?ParcelName,"
|
query += "?SimName,";
|
||||||
+ "?Flags,"
|
query += "?GlobalPos,";
|
||||||
+ "?ListingPrice ) "
|
query += "?ParcelName,";
|
||||||
+ "ON DUPLICATE KEY UPDATE "
|
query += "?Flags,";
|
||||||
+ "category=?Category, "
|
query += "?ListingPrice ) ";
|
||||||
+ "expirationdate=?ExpirationDate, "
|
query += "ON DUPLICATE KEY UPDATE ";
|
||||||
+ "name=?Name, "
|
query += "category=?Category, ";
|
||||||
+ "description=?Description, "
|
query += "expirationdate=?ExpirationDate, ";
|
||||||
+ "parentestate=?ParentEstate, "
|
query += "name=?Name, ";
|
||||||
+ "posglobal=?GlobalPos, "
|
query += "description=?Description, ";
|
||||||
+ "parcelname=?ParcelName, "
|
query += "parentestate=?ParentEstate, ";
|
||||||
+ "classifiedflags=?Flags, "
|
query += "posglobal=?GlobalPos, ";
|
||||||
+ "priceforlisting=?ListingPrice, "
|
query += "parcelname=?ParcelName, ";
|
||||||
+ "snapshotuuid=?SnapshotId"
|
query += "classifiedflags=?Flags, ";
|
||||||
;
|
query += "priceforlisting=?ListingPrice, ";
|
||||||
|
query += "snapshotuuid=?SnapshotId";
|
||||||
|
|
||||||
if(string.IsNullOrEmpty(ad.ParcelName))
|
if(string.IsNullOrEmpty(ad.ParcelName))
|
||||||
ad.ParcelName = "Unknown";
|
ad.ParcelName = "Unknown";
|
||||||
|
@ -228,12 +228,12 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[PROFILES_DATA]: UpdateClassifiedRecord exception {0}", e.Message);
|
m_log.ErrorFormat("[PROFILES_DATA]" +
|
||||||
|
": ClassifiedesUpdate exception {0}", e.Message);
|
||||||
result = e.Message;
|
result = e.Message;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,10 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
public bool DeleteClassifiedRecord(UUID recordId)
|
public bool DeleteClassifiedRecord(UUID recordId)
|
||||||
{
|
{
|
||||||
const string query = "DELETE FROM classifieds WHERE classifieduuid = ?recordId";
|
string query = string.Empty;
|
||||||
|
|
||||||
|
query += "DELETE FROM classifieds WHERE ";
|
||||||
|
query += "classifieduuid = ?recordId";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -255,12 +258,12 @@ namespace OpenSim.Data.MySQL
|
||||||
cmd.Parameters.AddWithValue("?recordId", recordId.ToString());
|
cmd.Parameters.AddWithValue("?recordId", recordId.ToString());
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[PROFILES_DATA]: DeleteClassifiedRecord exception {0}", e.Message);
|
m_log.ErrorFormat("[PROFILES_DATA]" +
|
||||||
|
": DeleteClassifiedRecord exception {0}", e.Message);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -268,8 +271,10 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
public bool GetClassifiedInfo(ref UserClassifiedAdd ad, ref string result)
|
public bool GetClassifiedInfo(ref UserClassifiedAdd ad, ref string result)
|
||||||
{
|
{
|
||||||
|
string query = string.Empty;
|
||||||
|
|
||||||
const string query = "SELECT * FROM classifieds WHERE classifieduuid = ?AdId";
|
query += "SELECT * FROM classifieds WHERE ";
|
||||||
|
query += "classifieduuid = ?AdId";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -307,7 +312,8 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[PROFILES_DATA]: GetClassifiedInfo exception {0}", e.Message);
|
m_log.ErrorFormat("[PROFILES_DATA]" +
|
||||||
|
": GetPickInfo exception {0}", e.Message);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -316,8 +322,10 @@ namespace OpenSim.Data.MySQL
|
||||||
#region Picks Queries
|
#region Picks Queries
|
||||||
public OSDArray GetAvatarPicks(UUID avatarId)
|
public OSDArray GetAvatarPicks(UUID avatarId)
|
||||||
{
|
{
|
||||||
const string query = "SELECT `pickuuid`,`name` FROM userpicks WHERE creatoruuid = ?Id";
|
string query = string.Empty;
|
||||||
|
|
||||||
|
query += "SELECT `pickuuid`,`name` FROM userpicks WHERE ";
|
||||||
|
query += "creatoruuid = ?Id";
|
||||||
OSDArray data = new OSDArray();
|
OSDArray data = new OSDArray();
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -344,20 +352,24 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[PROFILES_DATA]: GetAvatarPicks exception {0}", e.Message);
|
m_log.ErrorFormat("[PROFILES_DATA]" +
|
||||||
|
": GetAvatarPicks exception {0}", e.Message);
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserProfilePick GetPickInfo(UUID avatarId, UUID pickId)
|
public UserProfilePick GetPickInfo(UUID avatarId, UUID pickId)
|
||||||
{
|
{
|
||||||
|
string query = string.Empty;
|
||||||
UserProfilePick pick = new UserProfilePick();
|
UserProfilePick pick = new UserProfilePick();
|
||||||
const string query = "SELECT * FROM userpicks WHERE creatoruuid = ?CreatorId AND pickuuid = ?PickId";
|
|
||||||
|
query += "SELECT * FROM userpicks WHERE ";
|
||||||
|
query += "creatoruuid = ?CreatorId AND ";
|
||||||
|
query += "pickuuid = ?PickId";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -402,40 +414,41 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[PROFILES_DATA]: GetPickInfo exception {0}", e.Message);
|
m_log.ErrorFormat("[PROFILES_DATA]" +
|
||||||
|
": GetPickInfo exception {0}", e.Message);
|
||||||
}
|
}
|
||||||
return pick;
|
return pick;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool UpdatePicksRecord(UserProfilePick pick)
|
public bool UpdatePicksRecord(UserProfilePick pick)
|
||||||
{
|
{
|
||||||
const string query =
|
string query = string.Empty;
|
||||||
"INSERT INTO userpicks VALUES ("
|
|
||||||
+ "?PickId,"
|
query += "INSERT INTO userpicks VALUES (";
|
||||||
+ "?CreatorId,"
|
query += "?PickId,";
|
||||||
+ "?TopPick,"
|
query += "?CreatorId,";
|
||||||
+ "?ParcelId,"
|
query += "?TopPick,";
|
||||||
+ "?Name,"
|
query += "?ParcelId,";
|
||||||
+ "?Desc,"
|
query += "?Name,";
|
||||||
+ "?SnapshotId,"
|
query += "?Desc,";
|
||||||
+ "?User,"
|
query += "?SnapshotId,";
|
||||||
+ "?Original,"
|
query += "?User,";
|
||||||
+ "?SimName,"
|
query += "?Original,";
|
||||||
+ "?GlobalPos,"
|
query += "?SimName,";
|
||||||
+ "?SortOrder,"
|
query += "?GlobalPos,";
|
||||||
+ "?Enabled,"
|
query += "?SortOrder,";
|
||||||
+ "?Gatekeeper)"
|
query += "?Enabled,";
|
||||||
+ "ON DUPLICATE KEY UPDATE "
|
query += "?Gatekeeper)";
|
||||||
+ "parceluuid=?ParcelId,"
|
query += "ON DUPLICATE KEY UPDATE ";
|
||||||
+ "name=?Name,"
|
query += "parceluuid=?ParcelId,";
|
||||||
+ "description=?Desc,"
|
query += "name=?Name,";
|
||||||
+ "user=?User,"
|
query += "description=?Desc,";
|
||||||
+ "simname=?SimName,"
|
query += "user=?User,";
|
||||||
+ "snapshotuuid=?SnapshotId,"
|
query += "simname=?SimName,";
|
||||||
+ "pickuuid=?PickId,"
|
query += "snapshotuuid=?SnapshotId,";
|
||||||
+ "posglobal=?GlobalPos,"
|
query += "pickuuid=?PickId,";
|
||||||
+ "gatekeeper=?Gatekeeper"
|
query += "posglobal=?GlobalPos,";
|
||||||
;
|
query += "gatekeeper=?Gatekeeper";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -461,12 +474,12 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[PROFILES_DATA]: UpdatePicksRecord exception {0}", e.Message);
|
m_log.ErrorFormat("[PROFILES_DATA]" +
|
||||||
|
": UpdateAvatarNotes exception {0}", e.Message);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -474,7 +487,10 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
public bool DeletePicksRecord(UUID pickId)
|
public bool DeletePicksRecord(UUID pickId)
|
||||||
{
|
{
|
||||||
string query = "DELETE FROM userpicks WHERE pickuuid = ?PickId";
|
string query = string.Empty;
|
||||||
|
|
||||||
|
query += "DELETE FROM userpicks WHERE ";
|
||||||
|
query += "pickuuid = ?PickId";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -488,12 +504,12 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[PROFILES_DATA]: DeletePicksRecord exception {0}", e.Message);
|
m_log.ErrorFormat("[PROFILES_DATA]" +
|
||||||
|
": DeleteUserPickRecord exception {0}", e.Message);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -503,7 +519,12 @@ namespace OpenSim.Data.MySQL
|
||||||
#region Avatar Notes Queries
|
#region Avatar Notes Queries
|
||||||
public bool GetAvatarNotes(ref UserProfileNotes notes)
|
public bool GetAvatarNotes(ref UserProfileNotes notes)
|
||||||
{ // WIP
|
{ // WIP
|
||||||
const string query = "SELECT `notes` FROM usernotes WHERE useruuid = ?Id AND targetuuid = ?TargetId";
|
string query = string.Empty;
|
||||||
|
|
||||||
|
query += "SELECT `notes` FROM usernotes WHERE ";
|
||||||
|
query += "useruuid = ?Id AND ";
|
||||||
|
query += "targetuuid = ?TargetId";
|
||||||
|
OSDArray data = new OSDArray();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -528,37 +549,38 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[PROFILES_DATA]: GetAvatarNotes exception {0}", e.Message);
|
m_log.ErrorFormat("[PROFILES_DATA]" +
|
||||||
|
": GetAvatarNotes exception {0}", e.Message);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool UpdateAvatarNotes(ref UserProfileNotes note, ref string result)
|
public bool UpdateAvatarNotes(ref UserProfileNotes note, ref string result)
|
||||||
{
|
{
|
||||||
string query;
|
string query = string.Empty;
|
||||||
bool remove;
|
bool remove;
|
||||||
|
|
||||||
if(string.IsNullOrEmpty(note.Notes))
|
if(string.IsNullOrEmpty(note.Notes))
|
||||||
{
|
{
|
||||||
remove = true;
|
remove = true;
|
||||||
query = "DELETE FROM usernotes WHERE useruuid=?UserId AND targetuuid=?TargetId";
|
query += "DELETE FROM usernotes WHERE ";
|
||||||
|
query += "useruuid=?UserId AND ";
|
||||||
|
query += "targetuuid=?TargetId";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
remove = false;
|
remove = false;
|
||||||
query = "INSERT INTO usernotes VALUES ("
|
query += "INSERT INTO usernotes VALUES ( ";
|
||||||
+ "?UserId,"
|
query += "?UserId,";
|
||||||
+ "?TargetId,"
|
query += "?TargetId,";
|
||||||
+ "?Notes )"
|
query += "?Notes )";
|
||||||
+ "ON DUPLICATE KEY "
|
query += "ON DUPLICATE KEY ";
|
||||||
+ "UPDATE "
|
query += "UPDATE ";
|
||||||
+ "notes=?Notes"
|
query += "notes=?Notes";
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -575,12 +597,12 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[PROFILES_DATA]: UpdateAvatarNotes exception {0}", e.Message);
|
m_log.ErrorFormat("[PROFILES_DATA]" +
|
||||||
|
": UpdateAvatarNotes exception {0}", e.Message);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -591,7 +613,10 @@ namespace OpenSim.Data.MySQL
|
||||||
#region Avatar Properties
|
#region Avatar Properties
|
||||||
public bool GetAvatarProperties(ref UserProfileProperties props, ref string result)
|
public bool GetAvatarProperties(ref UserProfileProperties props, ref string result)
|
||||||
{
|
{
|
||||||
string query = "SELECT * FROM userprofile WHERE useruuid = ?Id";
|
string query = string.Empty;
|
||||||
|
|
||||||
|
query += "SELECT * FROM userprofile WHERE ";
|
||||||
|
query += "useruuid = ?Id";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -606,8 +631,6 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
if(reader.HasRows)
|
if(reader.HasRows)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[PROFILES_DATA]" +
|
|
||||||
": Getting data for {0}.", props.UserId);
|
|
||||||
reader.Read();
|
reader.Read();
|
||||||
props.WebUrl = (string)reader["profileURL"];
|
props.WebUrl = (string)reader["profileURL"];
|
||||||
UUID.TryParse((string)reader["profileImage"], out props.ImageId);
|
UUID.TryParse((string)reader["profileImage"], out props.ImageId);
|
||||||
|
@ -623,9 +646,6 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[PROFILES_DATA]" +
|
|
||||||
": No data for {0}", props.UserId);
|
|
||||||
|
|
||||||
props.WebUrl = string.Empty;
|
props.WebUrl = string.Empty;
|
||||||
props.ImageId = UUID.Zero;
|
props.ImageId = UUID.Zero;
|
||||||
props.AboutText = string.Empty;
|
props.AboutText = string.Empty;
|
||||||
|
@ -640,36 +660,35 @@ namespace OpenSim.Data.MySQL
|
||||||
props.PublishProfile = false;
|
props.PublishProfile = false;
|
||||||
props.PublishMature = false;
|
props.PublishMature = false;
|
||||||
|
|
||||||
query = "INSERT INTO userprofile ("
|
query = "INSERT INTO userprofile (";
|
||||||
+ "useruuid, "
|
query += "useruuid, ";
|
||||||
+ "profilePartner, "
|
query += "profilePartner, ";
|
||||||
+ "profileAllowPublish, "
|
query += "profileAllowPublish, ";
|
||||||
+ "profileMaturePublish, "
|
query += "profileMaturePublish, ";
|
||||||
+ "profileURL, "
|
query += "profileURL, ";
|
||||||
+ "profileWantToMask, "
|
query += "profileWantToMask, ";
|
||||||
+ "profileWantToText, "
|
query += "profileWantToText, ";
|
||||||
+ "profileSkillsMask, "
|
query += "profileSkillsMask, ";
|
||||||
+ "profileSkillsText, "
|
query += "profileSkillsText, ";
|
||||||
+ "profileLanguages, "
|
query += "profileLanguages, ";
|
||||||
+ "profileImage, "
|
query += "profileImage, ";
|
||||||
+ "profileAboutText, "
|
query += "profileAboutText, ";
|
||||||
+ "profileFirstImage, "
|
query += "profileFirstImage, ";
|
||||||
+ "profileFirstText) VALUES ("
|
query += "profileFirstText) VALUES (";
|
||||||
+ "?userId, "
|
query += "?userId, ";
|
||||||
+ "?profilePartner, "
|
query += "?profilePartner, ";
|
||||||
+ "?profileAllowPublish, "
|
query += "?profileAllowPublish, ";
|
||||||
+ "?profileMaturePublish, "
|
query += "?profileMaturePublish, ";
|
||||||
+ "?profileURL, "
|
query += "?profileURL, ";
|
||||||
+ "?profileWantToMask, "
|
query += "?profileWantToMask, ";
|
||||||
+ "?profileWantToText, "
|
query += "?profileWantToText, ";
|
||||||
+ "?profileSkillsMask, "
|
query += "?profileSkillsMask, ";
|
||||||
+ "?profileSkillsText, "
|
query += "?profileSkillsText, ";
|
||||||
+ "?profileLanguages, "
|
query += "?profileLanguages, ";
|
||||||
+ "?profileImage, "
|
query += "?profileImage, ";
|
||||||
+ "?profileAboutText, "
|
query += "?profileAboutText, ";
|
||||||
+ "?profileFirstImage, "
|
query += "?profileFirstImage, ";
|
||||||
+ "?profileFirstText)"
|
query += "?profileFirstText)";
|
||||||
;
|
|
||||||
|
|
||||||
dbcon.Close();
|
dbcon.Close();
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
|
@ -696,12 +715,12 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[PROFILES_DATA]: GetAvatarProperties exception {0}", e.Message);
|
m_log.ErrorFormat("[PROFILES_DATA]" +
|
||||||
|
": Requst properties exception {0}", e.Message);
|
||||||
result = e.Message;
|
result = e.Message;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -710,10 +729,15 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
public bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result)
|
public bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result)
|
||||||
{
|
{
|
||||||
const string query = "UPDATE userprofile SET profileURL=?profileURL,"
|
string query = string.Empty;
|
||||||
+ "profileImage=?image, profileAboutText=?abouttext,"
|
|
||||||
+ "profileFirstImage=?firstlifeimage, profileFirstText=?firstlifetext "
|
query += "UPDATE userprofile SET ";
|
||||||
+ "WHERE useruuid=?uuid";
|
query += "profileURL=?profileURL, ";
|
||||||
|
query += "profileImage=?image, ";
|
||||||
|
query += "profileAboutText=?abouttext,";
|
||||||
|
query += "profileFirstImage=?firstlifeimage,";
|
||||||
|
query += "profileFirstText=?firstlifetext ";
|
||||||
|
query += "WHERE useruuid=?uuid";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -731,12 +755,12 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[PROFILES_DATA]: UpdateAvatarProperties exception {0}", e.Message);
|
m_log.ErrorFormat("[PROFILES_DATA]" +
|
||||||
|
": AgentPropertiesUpdate exception {0}", e.Message);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -747,13 +771,15 @@ namespace OpenSim.Data.MySQL
|
||||||
#region Avatar Interests
|
#region Avatar Interests
|
||||||
public bool UpdateAvatarInterests(UserProfileProperties up, ref string result)
|
public bool UpdateAvatarInterests(UserProfileProperties up, ref string result)
|
||||||
{
|
{
|
||||||
const string query = "UPDATE userprofile SET "
|
string query = string.Empty;
|
||||||
+ "profileWantToMask=?WantMask, "
|
|
||||||
+ "profileWantToText=?WantText,"
|
query += "UPDATE userprofile SET ";
|
||||||
+ "profileSkillsMask=?SkillsMask,"
|
query += "profileWantToMask=?WantMask, ";
|
||||||
+ "profileSkillsText=?SkillsText, "
|
query += "profileWantToText=?WantText,";
|
||||||
+ "profileLanguages=?Languages "
|
query += "profileSkillsMask=?SkillsMask,";
|
||||||
+ "WHERE useruuid=?uuid";
|
query += "profileSkillsText=?SkillsText, ";
|
||||||
|
query += "profileLanguages=?Languages ";
|
||||||
|
query += "WHERE useruuid=?uuid";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -775,7 +801,8 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[PROFILES_DATA]: UpdateAvatarInterests exception {0}", e.Message);
|
m_log.ErrorFormat("[PROFILES_DATA]" +
|
||||||
|
": AgentInterestsUpdate exception {0}", e.Message);
|
||||||
result = e.Message;
|
result = e.Message;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -786,17 +813,18 @@ namespace OpenSim.Data.MySQL
|
||||||
public OSDArray GetUserImageAssets(UUID avatarId)
|
public OSDArray GetUserImageAssets(UUID avatarId)
|
||||||
{
|
{
|
||||||
OSDArray data = new OSDArray();
|
OSDArray data = new OSDArray();
|
||||||
const string queryA = "SELECT `snapshotuuid` FROM {0} WHERE `creatoruuid` = ?Id";
|
string query = "SELECT `snapshotuuid` FROM {0} WHERE `creatoruuid` = ?Id";
|
||||||
|
|
||||||
// Get classified image assets
|
// Get classified image assets
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
|
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand(string.Format (queryA,"`classifieds`"), dbcon))
|
using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`classifieds`"), dbcon))
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue("?Id", avatarId.ToString());
|
cmd.Parameters.AddWithValue("?Id", avatarId.ToString());
|
||||||
|
|
||||||
|
@ -815,7 +843,7 @@ namespace OpenSim.Data.MySQL
|
||||||
dbcon.Close();
|
dbcon.Close();
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand(string.Format (queryA,"`userpicks`"), dbcon))
|
using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`userpicks`"), dbcon))
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue("?Id", avatarId.ToString());
|
cmd.Parameters.AddWithValue("?Id", avatarId.ToString());
|
||||||
|
|
||||||
|
@ -834,9 +862,9 @@ namespace OpenSim.Data.MySQL
|
||||||
dbcon.Close();
|
dbcon.Close();
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
|
|
||||||
const string queryB = "SELECT `profileImage`, `profileFirstImage` FROM `userprofile` WHERE `useruuid` = ?Id";
|
query = "SELECT `profileImage`, `profileFirstImage` FROM `userprofile` WHERE `useruuid` = ?Id";
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand(queryB, dbcon))
|
using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`userpicks`"), dbcon))
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue("?Id", avatarId.ToString());
|
cmd.Parameters.AddWithValue("?Id", avatarId.ToString());
|
||||||
|
|
||||||
|
@ -852,12 +880,12 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[PROFILES_DATA]: GetUserImageAssets exception {0}", e.Message);
|
m_log.ErrorFormat("[PROFILES_DATA]" +
|
||||||
|
": GetAvatarNotes exception {0}", e.Message);
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@ -865,7 +893,13 @@ namespace OpenSim.Data.MySQL
|
||||||
#region User Preferences
|
#region User Preferences
|
||||||
public bool GetUserPreferences(ref UserPreferences pref, ref string result)
|
public bool GetUserPreferences(ref UserPreferences pref, ref string result)
|
||||||
{
|
{
|
||||||
const string query = "SELECT imviaemail,visible,email FROM usersettings WHERE useruuid = ?Id";
|
string query = string.Empty;
|
||||||
|
|
||||||
|
query += "SELECT imviaemail,visible,email FROM ";
|
||||||
|
query += "usersettings WHERE ";
|
||||||
|
query += "useruuid = ?Id";
|
||||||
|
|
||||||
|
OSDArray data = new OSDArray();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -875,9 +909,10 @@ namespace OpenSim.Data.MySQL
|
||||||
using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
|
using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString());
|
cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString());
|
||||||
|
|
||||||
using (MySqlDataReader reader = cmd.ExecuteReader())
|
using (MySqlDataReader reader = cmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
if (reader.HasRows)
|
if(reader.HasRows)
|
||||||
{
|
{
|
||||||
reader.Read();
|
reader.Read();
|
||||||
bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail);
|
bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail);
|
||||||
|
@ -889,9 +924,10 @@ namespace OpenSim.Data.MySQL
|
||||||
dbcon.Close();
|
dbcon.Close();
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
|
|
||||||
const string queryB = "INSERT INTO usersettings VALUES (?uuid,'false','false', ?Email)";
|
query = "INSERT INTO usersettings VALUES ";
|
||||||
|
query += "(?uuid,'false','false', ?Email)";
|
||||||
|
|
||||||
using (MySqlCommand put = new MySqlCommand(queryB, dbcon))
|
using (MySqlCommand put = new MySqlCommand(query, dbcon))
|
||||||
{
|
{
|
||||||
|
|
||||||
put.Parameters.AddWithValue("?Email", pref.EMail);
|
put.Parameters.AddWithValue("?Email", pref.EMail);
|
||||||
|
@ -902,12 +938,12 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[PROFILES_DATA]: GetUserPreferences exception {0}", e.Message);
|
m_log.ErrorFormat("[PROFILES_DATA]" +
|
||||||
|
": Get preferences exception {0}", e.Message);
|
||||||
result = e.Message;
|
result = e.Message;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -916,9 +952,13 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
public bool UpdateUserPreferences(ref UserPreferences pref, ref string result)
|
public bool UpdateUserPreferences(ref UserPreferences pref, ref string result)
|
||||||
{
|
{
|
||||||
const string query = "UPDATE usersettings SET imviaemail=?ImViaEmail,"
|
string query = string.Empty;
|
||||||
+ "visible=?Visible, email=?EMail "
|
|
||||||
+ "WHERE useruuid=?uuid";
|
query += "UPDATE usersettings SET ";
|
||||||
|
query += "imviaemail=?ImViaEmail, ";
|
||||||
|
query += "visible=?Visible, ";
|
||||||
|
query += "email=?EMail ";
|
||||||
|
query += "WHERE useruuid=?uuid";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -934,12 +974,12 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[PROFILES_DATA]: UpdateUserPreferences exception {0} {1}", e.Message, e.InnerException);
|
m_log.ErrorFormat("[PROFILES_DATA]" +
|
||||||
|
": UserPreferencesUpdate exception {0} {1}", e.Message, e.InnerException);
|
||||||
result = e.Message;
|
result = e.Message;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -950,7 +990,11 @@ namespace OpenSim.Data.MySQL
|
||||||
#region Integration
|
#region Integration
|
||||||
public bool GetUserAppData(ref UserAppData props, ref string result)
|
public bool GetUserAppData(ref UserAppData props, ref string result)
|
||||||
{
|
{
|
||||||
const string query = "SELECT * FROM `userdata` WHERE UserId = ?Id AND TagId = ?TagId";
|
string query = string.Empty;
|
||||||
|
|
||||||
|
query += "SELECT * FROM `userdata` WHERE ";
|
||||||
|
query += "UserId = ?Id AND ";
|
||||||
|
query += "TagId = ?TagId";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -972,8 +1016,13 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const string queryB = "INSERT INTO userdata VALUES (?UserId, ?TagId, ?DataKey, ?DataVal)";
|
query += "INSERT INTO userdata VALUES ( ";
|
||||||
using (MySqlCommand put = new MySqlCommand(queryB, dbcon))
|
query += "?UserId,";
|
||||||
|
query += "?TagId,";
|
||||||
|
query += "?DataKey,";
|
||||||
|
query += "?DataVal) ";
|
||||||
|
|
||||||
|
using (MySqlCommand put = new MySqlCommand(query, dbcon))
|
||||||
{
|
{
|
||||||
put.Parameters.AddWithValue("?UserId", props.UserId.ToString());
|
put.Parameters.AddWithValue("?UserId", props.UserId.ToString());
|
||||||
put.Parameters.AddWithValue("?TagId", props.TagId.ToString());
|
put.Parameters.AddWithValue("?TagId", props.TagId.ToString());
|
||||||
|
@ -985,12 +1034,12 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[PROFILES_DATA]: GetUserAppData exception {0}", e.Message);
|
m_log.ErrorFormat("[PROFILES_DATA]" +
|
||||||
|
": Requst application data exception {0}", e.Message);
|
||||||
result = e.Message;
|
result = e.Message;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -999,7 +1048,14 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
public bool SetUserAppData(UserAppData props, ref string result)
|
public bool SetUserAppData(UserAppData props, ref string result)
|
||||||
{
|
{
|
||||||
const string query = "UPDATE userdata SET TagId = ?TagId, DataKey = ?DataKey, DataVal = ?DataVal WHERE UserId = ?UserId AND TagId = ?TagId";
|
string query = string.Empty;
|
||||||
|
|
||||||
|
query += "UPDATE userdata SET ";
|
||||||
|
query += "TagId = ?TagId, ";
|
||||||
|
query += "DataKey = ?DataKey, ";
|
||||||
|
query += "DataVal = ?DataVal WHERE ";
|
||||||
|
query += "UserId = ?UserId AND ";
|
||||||
|
query += "TagId = ?TagId";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1015,12 +1071,12 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[PROFILES_DATA]: SetUserAppData exception {0}", e.Message);
|
m_log.ErrorFormat("[PROFILES_DATA]" +
|
||||||
|
": SetUserData exception {0}", e.Message);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -58,6 +58,11 @@ namespace OpenSim.Data.MySQL
|
||||||
private bool m_enableCompression = false;
|
private bool m_enableCompression = false;
|
||||||
private string m_connectionString;
|
private string m_connectionString;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// We can reuse this for all hashing since all methods are single-threaded through m_dbBLock
|
||||||
|
/// </summary>
|
||||||
|
private HashAlgorithm hasher = new SHA256CryptoServiceProvider();
|
||||||
|
|
||||||
#region IPlugin Members
|
#region IPlugin Members
|
||||||
|
|
||||||
public string Version { get { return "1.0.0.0"; } }
|
public string Version { get { return "1.0.0.0"; } }
|
||||||
|
@ -92,7 +97,6 @@ namespace OpenSim.Data.MySQL
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
Migration m = new Migration(dbcon, Assembly, "XAssetStore");
|
Migration m = new Migration(dbcon, Assembly, "XAssetStore");
|
||||||
m.Update();
|
m.Update();
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +130,6 @@ namespace OpenSim.Data.MySQL
|
||||||
// m_log.DebugFormat("[MYSQL XASSET DATA]: Looking for asset {0}", assetID);
|
// m_log.DebugFormat("[MYSQL XASSET DATA]: Looking for asset {0}", assetID);
|
||||||
|
|
||||||
AssetBase asset = null;
|
AssetBase asset = null;
|
||||||
int accessTime = 0;
|
|
||||||
|
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
{
|
{
|
||||||
|
@ -137,6 +140,7 @@ namespace OpenSim.Data.MySQL
|
||||||
dbcon))
|
dbcon))
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue("?ID", assetID.ToString());
|
cmd.Parameters.AddWithValue("?ID", assetID.ToString());
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
|
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
|
||||||
|
@ -155,7 +159,23 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
asset.Temporary = Convert.ToBoolean(dbReader["Temporary"]);
|
asset.Temporary = Convert.ToBoolean(dbReader["Temporary"]);
|
||||||
asset.Flags = (AssetFlags)Convert.ToInt32(dbReader["AssetFlags"]);
|
asset.Flags = (AssetFlags)Convert.ToInt32(dbReader["AssetFlags"]);
|
||||||
accessTime = (int)dbReader["AccessTime"];
|
|
||||||
|
if (m_enableCompression)
|
||||||
|
{
|
||||||
|
using (GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), CompressionMode.Decompress))
|
||||||
|
{
|
||||||
|
MemoryStream outputStream = new MemoryStream();
|
||||||
|
WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue);
|
||||||
|
// int compressedLength = asset.Data.Length;
|
||||||
|
asset.Data = outputStream.ToArray();
|
||||||
|
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}",
|
||||||
|
// asset.ID, asset.Name, asset.Data.Length, compressedLength);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateAccessTime(asset.Metadata, (int)dbReader["AccessTime"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -164,37 +184,8 @@ namespace OpenSim.Data.MySQL
|
||||||
m_log.Error(string.Format("[MYSQL XASSET DATA]: Failure fetching asset {0}", assetID), e);
|
m_log.Error(string.Format("[MYSQL XASSET DATA]: Failure fetching asset {0}", assetID), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(asset == null)
|
|
||||||
return asset;
|
|
||||||
|
|
||||||
if(accessTime > 0)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
UpdateAccessTime(asset.Metadata, accessTime);
|
|
||||||
}
|
|
||||||
catch { }
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_enableCompression && asset.Data != null)
|
|
||||||
{
|
|
||||||
using(MemoryStream ms = new MemoryStream(asset.Data))
|
|
||||||
using(GZipStream decompressionStream = new GZipStream(ms, CompressionMode.Decompress))
|
|
||||||
{
|
|
||||||
using(MemoryStream outputStream = new MemoryStream())
|
|
||||||
{
|
|
||||||
decompressionStream.CopyTo(outputStream, int.MaxValue);
|
|
||||||
// int compressedLength = asset.Data.Length;
|
|
||||||
asset.Data = outputStream.ToArray();
|
|
||||||
}
|
|
||||||
// m_log.DebugFormat(
|
|
||||||
// "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}",
|
|
||||||
// asset.ID, asset.Name, asset.Data.Length, compressedLength);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return asset;
|
return asset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,9 +236,7 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] hash;
|
byte[] hash = hasher.ComputeHash(asset.Data);
|
||||||
using (HashAlgorithm hasher = new SHA256CryptoServiceProvider())
|
|
||||||
hash = hasher.ComputeHash(asset.Data);
|
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[XASSET DB]: Compressed data size for {0} {1}, hash {2} is {3}",
|
// "[XASSET DB]: Compressed data size for {0} {1}, hash {2} is {3}",
|
||||||
|
@ -314,7 +303,6 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,7 +344,6 @@ namespace OpenSim.Data.MySQL
|
||||||
"[XASSET MYSQL DB]: Failure updating access_time for asset {0} with name {1}",
|
"[XASSET MYSQL DB]: Failure updating access_time for asset {0} with name {1}",
|
||||||
assetMetadata.ID, assetMetadata.Name);
|
assetMetadata.ID, assetMetadata.Name);
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,9 +440,8 @@ namespace OpenSim.Data.MySQL
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
using(MySqlCommand cmd = new MySqlCommand("SELECT Name, Description, AccessTime, AssetType, Temporary, ID, AssetFlags, CreatorID FROM XAssetsMeta LIMIT ?start, ?count",dbcon))
|
MySqlCommand cmd = new MySqlCommand("SELECT Name, Description, AccessTime, AssetType, Temporary, ID, AssetFlags, CreatorID FROM XAssetsMeta LIMIT ?start, ?count", dbcon);
|
||||||
{
|
cmd.Parameters.AddWithValue("?start", start);
|
||||||
cmd.Parameters.AddWithValue("?start",start);
|
|
||||||
cmd.Parameters.AddWithValue("?count", count);
|
cmd.Parameters.AddWithValue("?count", count);
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -474,7 +460,7 @@ namespace OpenSim.Data.MySQL
|
||||||
metadata.CreatorID = dbReader["CreatorID"].ToString();
|
metadata.CreatorID = dbReader["CreatorID"].ToString();
|
||||||
|
|
||||||
// We'll ignore this for now - it appears unused!
|
// We'll ignore this for now - it appears unused!
|
||||||
// metadata.SHA1 = dbReader["hash"]);
|
// metadata.SHA1 = dbReader["hash"]);
|
||||||
|
|
||||||
UpdateAccessTime(metadata, (int)dbReader["AccessTime"]);
|
UpdateAccessTime(metadata, (int)dbReader["AccessTime"]);
|
||||||
|
|
||||||
|
@ -487,8 +473,6 @@ namespace OpenSim.Data.MySQL
|
||||||
m_log.Error("[XASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString());
|
m_log.Error("[XASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
return retList;
|
return retList;
|
||||||
}
|
}
|
||||||
|
@ -506,9 +490,9 @@ namespace OpenSim.Data.MySQL
|
||||||
cmd.Parameters.AddWithValue("?ID", id);
|
cmd.Parameters.AddWithValue("?ID", id);
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: How do we deal with data from deleted assets? Probably not easily reapable unless we
|
// TODO: How do we deal with data from deleted assets? Probably not easily reapable unless we
|
||||||
// keep a reference count (?)
|
// keep a reference count (?)
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -193,9 +193,7 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
using (MySqlCommand cmd = new MySqlCommand())
|
using (MySqlCommand cmd = new MySqlCommand())
|
||||||
{
|
{
|
||||||
// cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags & 1", m_Realm);
|
cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags & 1", m_Realm);
|
||||||
|
|
||||||
cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags & 1");
|
|
||||||
|
|
||||||
cmd.Parameters.AddWithValue("?uuid", principalID.ToString());
|
cmd.Parameters.AddWithValue("?uuid", principalID.ToString());
|
||||||
cmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture);
|
cmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture);
|
||||||
|
@ -214,10 +212,7 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
cmd.Connection = dbcon;
|
cmd.Connection = dbcon;
|
||||||
|
|
||||||
// cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = ?PrincipalID and assetID = ?AssetID group by assetID", m_Realm);
|
cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = ?PrincipalID and assetID = ?AssetID group by assetID", m_Realm);
|
||||||
|
|
||||||
cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = ?PrincipalID and assetID = ?AssetID group by assetID");
|
|
||||||
|
|
||||||
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
|
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
|
||||||
cmd.Parameters.AddWithValue("?AssetID", assetID.ToString());
|
cmd.Parameters.AddWithValue("?AssetID", assetID.ToString());
|
||||||
|
|
||||||
|
@ -328,6 +323,7 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
cmd.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
dbcon.Close();
|
dbcon.Close();
|
||||||
|
|
|
@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
|
|
||||||
[assembly : AssemblyVersion(OpenSim.VersionInfo.AssemblyVersionNumber)]
|
[assembly : AssemblyVersion("0.8.2.*")]
|
||||||
|
|
||||||
|
|
|
@ -69,15 +69,3 @@ CREATE TABLE IF NOT EXISTS `estateban` (
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
:VERSION 35
|
|
||||||
BEGIN;
|
|
||||||
ALTER TABLE `estateban`
|
|
||||||
ADD COLUMN `banningUUID` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
|
|
||||||
ADD COLUMN `banTime` int(11) NOT NULL DEFAULT 0;
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
:VERSION 36
|
|
||||||
BEGIN;
|
|
||||||
ALTER TABLE `estate_settings`
|
|
||||||
ADD COLUMN `AllowEnviromentOverride` tinyint(4) NOT NULL DEFAULT '0';
|
|
||||||
COMMIT;
|
|
||||||
|
|
|
@ -16,9 +16,3 @@ CREATE TABLE `hg_traveling_data` (
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
:VERSION 2 # --------------------------
|
|
||||||
|
|
||||||
ALTER TABLE `hg_traveling_data` MODIFY `TMStamp` timestamp NOT NULL default CURRENT_TIMESTAMP;
|
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,6 @@ CREATE TABLE IF NOT EXISTS `im_offline` (
|
||||||
PRIMARY KEY (`ID`),
|
PRIMARY KEY (`ID`),
|
||||||
KEY `PrincipalID` (`PrincipalID`),
|
KEY `PrincipalID` (`PrincipalID`),
|
||||||
KEY `FromID` (`FromID`)
|
KEY `FromID` (`FromID`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
:VERSION 1
|
|
||||||
|
|
||||||
BEGIN;
|
|
||||||
|
|
||||||
CREATE TABLE `MuteList` (
|
|
||||||
`AgentID` char(36) NOT NULL,
|
|
||||||
`MuteID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
|
|
||||||
`MuteName` varchar(64) NOT NULL DEFAULT '',
|
|
||||||
`MuteType` int(11) NOT NULL DEFAULT '1',
|
|
||||||
`MuteFlags` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`Stamp` int(11) NOT NULL,
|
|
||||||
UNIQUE KEY `AgentID_2` (`AgentID`,`MuteID`,`MuteName`),
|
|
||||||
KEY `AgentID` (`AgentID`)
|
|
||||||
);
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -97,7 +97,7 @@ CREATE TABLE IF NOT EXISTS `prims` (
|
||||||
PRIMARY KEY (`UUID`),
|
PRIMARY KEY (`UUID`),
|
||||||
KEY `prims_regionuuid` (`RegionUUID`),
|
KEY `prims_regionuuid` (`RegionUUID`),
|
||||||
KEY `prims_scenegroupid` (`SceneGroupID`)
|
KEY `prims_scenegroupid` (`SceneGroupID`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `primshapes` (
|
CREATE TABLE IF NOT EXISTS `primshapes` (
|
||||||
`Shape` int(11) DEFAULT NULL,
|
`Shape` int(11) DEFAULT NULL,
|
||||||
|
@ -130,7 +130,7 @@ CREATE TABLE IF NOT EXISTS `primshapes` (
|
||||||
`Media` text,
|
`Media` text,
|
||||||
`LastAttachPoint` int(4) NOT NULL DEFAULT '0',
|
`LastAttachPoint` int(4) NOT NULL DEFAULT '0',
|
||||||
PRIMARY KEY (`UUID`)
|
PRIMARY KEY (`UUID`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `primitems` (
|
CREATE TABLE IF NOT EXISTS `primitems` (
|
||||||
`invType` int(11) DEFAULT NULL,
|
`invType` int(11) DEFAULT NULL,
|
||||||
|
@ -154,13 +154,13 @@ CREATE TABLE IF NOT EXISTS `primitems` (
|
||||||
`lastOwnerID` char(36) DEFAULT NULL,
|
`lastOwnerID` char(36) DEFAULT NULL,
|
||||||
PRIMARY KEY (`itemID`),
|
PRIMARY KEY (`itemID`),
|
||||||
KEY `primitems_primid` (`primID`)
|
KEY `primitems_primid` (`primID`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `terrain` (
|
CREATE TABLE IF NOT EXISTS `terrain` (
|
||||||
`RegionUUID` varchar(255) DEFAULT NULL,
|
`RegionUUID` varchar(255) DEFAULT NULL,
|
||||||
`Revision` int(11) DEFAULT NULL,
|
`Revision` int(11) DEFAULT NULL,
|
||||||
`Heightfield` longblob
|
`Heightfield` longblob
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `land` (
|
CREATE TABLE IF NOT EXISTS `land` (
|
||||||
`UUID` varchar(255) NOT NULL,
|
`UUID` varchar(255) NOT NULL,
|
||||||
|
@ -204,21 +204,21 @@ CREATE TABLE IF NOT EXISTS `land` (
|
||||||
`ObscureMusic` tinyint(1) NOT NULL DEFAULT '0',
|
`ObscureMusic` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
`ObscureMedia` tinyint(1) NOT NULL DEFAULT '0',
|
`ObscureMedia` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
PRIMARY KEY (`UUID`)
|
PRIMARY KEY (`UUID`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `landaccesslist` (
|
CREATE TABLE IF NOT EXISTS `landaccesslist` (
|
||||||
`LandUUID` varchar(255) DEFAULT NULL,
|
`LandUUID` varchar(255) DEFAULT NULL,
|
||||||
`AccessUUID` varchar(255) DEFAULT NULL,
|
`AccessUUID` varchar(255) DEFAULT NULL,
|
||||||
`Flags` int(11) DEFAULT NULL,
|
`Flags` int(11) DEFAULT NULL,
|
||||||
`Expires` int(11) NOT NULL DEFAULT '0'
|
`Expires` int(11) NOT NULL DEFAULT '0'
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `regionban` (
|
CREATE TABLE IF NOT EXISTS `regionban` (
|
||||||
`regionUUID` varchar(36) NOT NULL,
|
`regionUUID` varchar(36) NOT NULL,
|
||||||
`bannedUUID` varchar(36) NOT NULL,
|
`bannedUUID` varchar(36) NOT NULL,
|
||||||
`bannedIp` varchar(16) NOT NULL,
|
`bannedIp` varchar(16) NOT NULL,
|
||||||
`bannedIpHostMask` varchar(16) NOT NULL
|
`bannedIpHostMask` varchar(16) NOT NULL
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `regionsettings` (
|
CREATE TABLE IF NOT EXISTS `regionsettings` (
|
||||||
`regionUUID` char(36) NOT NULL,
|
`regionUUID` char(36) NOT NULL,
|
||||||
|
@ -265,7 +265,7 @@ CREATE TABLE IF NOT EXISTS `regionsettings` (
|
||||||
`parcel_tile_ID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
|
`parcel_tile_ID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
|
||||||
`covenant_datetime` int(10) unsigned NOT NULL DEFAULT '0',
|
`covenant_datetime` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
PRIMARY KEY (`regionUUID`)
|
PRIMARY KEY (`regionUUID`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `regionwindlight` (
|
CREATE TABLE IF NOT EXISTS `regionwindlight` (
|
||||||
`region_id` varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000',
|
`region_id` varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000',
|
||||||
|
@ -357,196 +357,3 @@ CREATE TABLE IF NOT EXISTS `regionextra` (
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
:VERSION 52 #---- avination fields
|
|
||||||
|
|
||||||
BEGIN;
|
|
||||||
|
|
||||||
ALTER TABLE `prims` ADD COLUMN `PassCollisions` tinyint(4) NOT NULL default '0';
|
|
||||||
ALTER TABLE `prims` ADD COLUMN `Vehicle` TEXT default NULL;
|
|
||||||
ALTER TABLE `regionsettings` ADD COLUMN `block_search` tinyint(4) NOT NULL default '0';
|
|
||||||
ALTER TABLE `regionsettings` ADD COLUMN `casino` tinyint(4) NOT NULL default '0';
|
|
||||||
ALTER TABLE `land` ADD COLUMN `SeeAVs` tinyint(4) NOT NULL default '1';
|
|
||||||
ALTER TABLE `land` ADD COLUMN `AnyAVSounds` tinyint(4) NOT NULL default '1';
|
|
||||||
ALTER TABLE `land` ADD COLUMN `GroupAVSounds` tinyint(4) NOT NULL default '1';
|
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
:VERSION 53 #---- STATUS ROTATION axis locks
|
|
||||||
|
|
||||||
BEGIN;
|
|
||||||
|
|
||||||
ALTER TABLE `prims` ADD COLUMN `RotationAxisLocks` tinyint(4) NOT NULL default '0';
|
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
:VERSION 54 #----- add baked terrain store
|
|
||||||
|
|
||||||
BEGIN;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `bakedterrain` (
|
|
||||||
`RegionUUID` varchar(255) DEFAULT NULL,
|
|
||||||
`Revision` int(11) DEFAULT NULL,
|
|
||||||
`Heightfield` longblob
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
:VERSION 55 #----- Increase float precision for windlight needed by scripts
|
|
||||||
|
|
||||||
BEGIN;
|
|
||||||
|
|
||||||
ALTER TABLE `regionwindlight`
|
|
||||||
|
|
||||||
MODIFY `water_fog_density_exponent` float(9,7) unsigned NOT NULL DEFAULT '4.0',
|
|
||||||
MODIFY `underwater_fog_modifier` float(9,8) unsigned NOT NULL DEFAULT '0.25',
|
|
||||||
MODIFY `reflection_wavelet_scale_1` float(9,7) unsigned NOT NULL DEFAULT '2.0',
|
|
||||||
MODIFY `reflection_wavelet_scale_2` float(9,7) unsigned NOT NULL DEFAULT '2.0',
|
|
||||||
MODIFY `reflection_wavelet_scale_3` float(9,7) unsigned NOT NULL DEFAULT '2.0',
|
|
||||||
MODIFY `fresnel_scale` float(9,8) unsigned NOT NULL DEFAULT '0.40',
|
|
||||||
MODIFY `fresnel_offset` float(9,8) unsigned NOT NULL DEFAULT '0.50',
|
|
||||||
MODIFY `refract_scale_above` float(9,8) unsigned NOT NULL DEFAULT '0.03',
|
|
||||||
MODIFY `refract_scale_below` float(9,8) unsigned NOT NULL DEFAULT '0.20',
|
|
||||||
MODIFY `blur_multiplier` float(9,8) unsigned NOT NULL DEFAULT '0.040',
|
|
||||||
MODIFY `big_wave_direction_x` float(9,8) NOT NULL DEFAULT '1.05',
|
|
||||||
MODIFY `big_wave_direction_y` float(9,8) NOT NULL DEFAULT '-0.42',
|
|
||||||
MODIFY `little_wave_direction_x` float(9,8) NOT NULL DEFAULT '1.11',
|
|
||||||
MODIFY `little_wave_direction_y` float(9,8) NOT NULL DEFAULT '-1.16',
|
|
||||||
MODIFY `horizon_r` float(9,8) unsigned NOT NULL DEFAULT '0.25',
|
|
||||||
MODIFY `horizon_g` float(9,8) unsigned NOT NULL DEFAULT '0.25',
|
|
||||||
MODIFY `horizon_b` float(9,8) unsigned NOT NULL DEFAULT '0.32',
|
|
||||||
MODIFY `horizon_i` float(9,8) unsigned NOT NULL DEFAULT '0.32',
|
|
||||||
MODIFY `haze_horizon` float(9,8) unsigned NOT NULL DEFAULT '0.19',
|
|
||||||
MODIFY `blue_density_r` float(9,8) unsigned NOT NULL DEFAULT '0.12',
|
|
||||||
MODIFY `blue_density_g` float(9,8) unsigned NOT NULL DEFAULT '0.22',
|
|
||||||
MODIFY `blue_density_b` float(9,8) unsigned NOT NULL DEFAULT '0.38',
|
|
||||||
MODIFY `blue_density_i` float(9,8) unsigned NOT NULL DEFAULT '0.38',
|
|
||||||
MODIFY `haze_density` float(9,8) unsigned NOT NULL DEFAULT '0.70',
|
|
||||||
MODIFY `density_multiplier` float(9,8) unsigned NOT NULL DEFAULT '0.18',
|
|
||||||
MODIFY `distance_multiplier` float(9,6) unsigned NOT NULL DEFAULT '0.8',
|
|
||||||
MODIFY `sun_moon_color_r` float(9,8) unsigned NOT NULL DEFAULT '0.24',
|
|
||||||
MODIFY `sun_moon_color_g` float(9,8) unsigned NOT NULL DEFAULT '0.26',
|
|
||||||
MODIFY `sun_moon_color_b` float(9,8) unsigned NOT NULL DEFAULT '0.30',
|
|
||||||
MODIFY `sun_moon_color_i` float(9,8) unsigned NOT NULL DEFAULT '0.30',
|
|
||||||
MODIFY `sun_moon_position` float(9,8) unsigned NOT NULL DEFAULT '0.317',
|
|
||||||
MODIFY `ambient_r` float(9,8) unsigned NOT NULL DEFAULT '0.35',
|
|
||||||
MODIFY `ambient_g` float(9,8) unsigned NOT NULL DEFAULT '0.35',
|
|
||||||
MODIFY `ambient_b` float(9,8) unsigned NOT NULL DEFAULT '0.35',
|
|
||||||
MODIFY `ambient_i` float(9,8) unsigned NOT NULL DEFAULT '0.35',
|
|
||||||
MODIFY `east_angle` float(9,8) unsigned NOT NULL DEFAULT '0.00',
|
|
||||||
MODIFY `sun_glow_focus` float(9,8) unsigned NOT NULL DEFAULT '0.10',
|
|
||||||
MODIFY `sun_glow_size` float(9,8) unsigned NOT NULL DEFAULT '1.75',
|
|
||||||
MODIFY `scene_gamma` float(9,7) unsigned NOT NULL DEFAULT '1.00',
|
|
||||||
MODIFY `star_brightness` float(9,8) unsigned NOT NULL DEFAULT '0.00',
|
|
||||||
MODIFY `cloud_color_r` float(9,8) unsigned NOT NULL DEFAULT '0.41',
|
|
||||||
MODIFY `cloud_color_g` float(9,8) unsigned NOT NULL DEFAULT '0.41',
|
|
||||||
MODIFY `cloud_color_b` float(9,8) unsigned NOT NULL DEFAULT '0.41',
|
|
||||||
MODIFY `cloud_color_i` float(9,8) unsigned NOT NULL DEFAULT '0.41',
|
|
||||||
MODIFY `cloud_x` float(9,8) unsigned NOT NULL DEFAULT '1.00',
|
|
||||||
MODIFY `cloud_y` float(9,8) unsigned NOT NULL DEFAULT '0.53',
|
|
||||||
MODIFY `cloud_density` float(9,8) unsigned NOT NULL DEFAULT '1.00',
|
|
||||||
MODIFY `cloud_coverage` float(9,8) unsigned NOT NULL DEFAULT '0.27',
|
|
||||||
MODIFY `cloud_scale` float(9,8) unsigned NOT NULL DEFAULT '0.42',
|
|
||||||
MODIFY `cloud_detail_x` float(9,8) unsigned NOT NULL DEFAULT '1.00',
|
|
||||||
MODIFY `cloud_detail_y` float(9,8) unsigned NOT NULL DEFAULT '0.53',
|
|
||||||
MODIFY `cloud_detail_density` float(9,8) unsigned NOT NULL DEFAULT '0.12',
|
|
||||||
MODIFY `cloud_scroll_x` float(9,7) NOT NULL DEFAULT '0.20',
|
|
||||||
MODIFY `cloud_scroll_y` float(9,7) NOT NULL DEFAULT '0.01';
|
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
:VERSION 56 #----- Add RezzerID field in table prims
|
|
||||||
|
|
||||||
BEGIN;
|
|
||||||
|
|
||||||
ALTER TABLE `prims` ADD COLUMN `RezzerID` char(36) DEFAULT NULL;
|
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
:VERSION 57 #----- Add physics inertia data
|
|
||||||
|
|
||||||
BEGIN;
|
|
||||||
ALTER TABLE `prims` ADD COLUMN `PhysInertia` TEXT default NULL;
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
:VERSION 58 #----- Add sop animations
|
|
||||||
|
|
||||||
BEGIN;
|
|
||||||
ALTER TABLE `prims` ADD COLUMN `sopanims` blob default NULL;
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
:VERSION 59 #----- Add standtarget and sit range
|
|
||||||
|
|
||||||
BEGIN;
|
|
||||||
ALTER TABLE `prims`
|
|
||||||
ADD COLUMN `standtargetx` float DEFAULT '0.0',
|
|
||||||
ADD COLUMN `standtargety` float DEFAULT '0.0',
|
|
||||||
ADD COLUMN `standtargetz` float DEFAULT '0.0',
|
|
||||||
ADD COLUMN `sitactrange` float DEFAULT '0.0';
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
:VERSION 60 #----- don't store float on double
|
|
||||||
|
|
||||||
BEGIN;
|
|
||||||
ALTER TABLE `prims`
|
|
||||||
MODIFY `PositionX` float DEFAULT '0.0',
|
|
||||||
MODIFY `PositionY` float DEFAULT '0.0',
|
|
||||||
MODIFY `PositionZ` float DEFAULT '0.0',
|
|
||||||
MODIFY `GroupPositionX` float DEFAULT '0.0',
|
|
||||||
MODIFY `GroupPositionY` float DEFAULT '0.0',
|
|
||||||
MODIFY `GroupPositionZ` float DEFAULT '0.0',
|
|
||||||
MODIFY `VelocityX` float DEFAULT '0.0',
|
|
||||||
MODIFY `VelocityY` float DEFAULT '0.0',
|
|
||||||
MODIFY `VelocityZ` float DEFAULT '0.0',
|
|
||||||
MODIFY `AngularVelocityX` float DEFAULT '0.0',
|
|
||||||
MODIFY `AngularVelocityY` float DEFAULT '0.0',
|
|
||||||
MODIFY `AngularVelocityZ` float DEFAULT '0.0',
|
|
||||||
MODIFY `AccelerationX` float DEFAULT '0.0',
|
|
||||||
MODIFY `AccelerationY` float DEFAULT '0.0',
|
|
||||||
MODIFY `AccelerationZ` float DEFAULT '0.0',
|
|
||||||
MODIFY `RotationX` float DEFAULT '0.0',
|
|
||||||
MODIFY `RotationY` float DEFAULT '0.0',
|
|
||||||
MODIFY `RotationZ` float DEFAULT '0.0',
|
|
||||||
MODIFY `RotationW` float DEFAULT '0.0',
|
|
||||||
MODIFY `SitTargetOffsetX` float DEFAULT '0.0',
|
|
||||||
MODIFY `SitTargetOffsetY` float DEFAULT '0.0',
|
|
||||||
MODIFY `SitTargetOffsetZ` float DEFAULT '0.0',
|
|
||||||
MODIFY `SitTargetOrientX` float DEFAULT '0.0',
|
|
||||||
MODIFY `SitTargetOrientY` float DEFAULT '0.0',
|
|
||||||
MODIFY `SitTargetOrientZ` float DEFAULT '0.0',
|
|
||||||
MODIFY `SitTargetOrientW` float DEFAULT '0.0',
|
|
||||||
MODIFY `OmegaX` float DEFAULT '0.0',
|
|
||||||
MODIFY `OmegaY` float DEFAULT '0.0',
|
|
||||||
MODIFY `OmegaZ` float DEFAULT '0.0',
|
|
||||||
MODIFY `CameraEyeOffsetX` float DEFAULT '0.0',
|
|
||||||
MODIFY `CameraEyeOffsetY` float DEFAULT '0.0',
|
|
||||||
MODIFY `CameraEyeOffsetZ` float DEFAULT '0.0',
|
|
||||||
MODIFY `CameraAtOffsetX` float DEFAULT '0.0',
|
|
||||||
MODIFY `CameraAtOffsetY` float DEFAULT '0.0',
|
|
||||||
MODIFY `CameraAtOffsetZ` float DEFAULT '0.0',
|
|
||||||
MODIFY `Density` float DEFAULT '1000.0',
|
|
||||||
MODIFY `GravityModifier` float DEFAULT '1.0',
|
|
||||||
MODIFY `Friction` float DEFAULT '0.6',
|
|
||||||
MODIFY `Restitution` float DEFAULT '0.5',
|
|
||||||
MODIFY `AttachedPosX` float DEFAULT '0',
|
|
||||||
MODIFY `AttachedPosY` float DEFAULT '0',
|
|
||||||
MODIFY `AttachedPosZ` float DEFAULT '0',
|
|
||||||
MODIFY `LoopedSoundGain` float DEFAULT '0';
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
:VERSION 61 #----- Add pseudo CRC and region cache id
|
|
||||||
|
|
||||||
BEGIN;
|
|
||||||
ALTER TABLE `prims` ADD COLUMN `pseudocrc` int DEFAULT '0';
|
|
||||||
ALTER TABLE `regionsettings` ADD COLUMN `cacheID` char(36) DEFAULT NULL;
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
:VERSION 62 #----- increase size of environment settings
|
|
||||||
BEGIN;
|
|
||||||
ALTER TABLE `regionenvironment` MODIFY `llsd_settings` MEDIUMTEXT;
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
:VERSION 63 #----- parcel environment store
|
|
||||||
BEGIN;
|
|
||||||
ALTER TABLE `land` ADD COLUMN `environment` MEDIUMTEXT default NULL;
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ CREATE TABLE IF NOT EXISTS `usernotes` (
|
||||||
`targetuuid` varchar(36) NOT NULL,
|
`targetuuid` varchar(36) NOT NULL,
|
||||||
`notes` text NOT NULL,
|
`notes` text NOT NULL,
|
||||||
UNIQUE KEY `useruuid` (`useruuid`,`targetuuid`)
|
UNIQUE KEY `useruuid` (`useruuid`,`targetuuid`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `userpicks` (
|
CREATE TABLE IF NOT EXISTS `userpicks` (
|
||||||
|
@ -46,7 +46,7 @@ CREATE TABLE IF NOT EXISTS `userpicks` (
|
||||||
`enabled` enum('true','false') NOT NULL,
|
`enabled` enum('true','false') NOT NULL,
|
||||||
`gatekeeper` varchar(255),
|
`gatekeeper` varchar(255),
|
||||||
PRIMARY KEY (`pickuuid`)
|
PRIMARY KEY (`pickuuid`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `userprofile` (
|
CREATE TABLE IF NOT EXISTS `userprofile` (
|
||||||
|
@ -65,7 +65,7 @@ CREATE TABLE IF NOT EXISTS `userprofile` (
|
||||||
`profileFirstImage` varchar(36) NOT NULL,
|
`profileFirstImage` varchar(36) NOT NULL,
|
||||||
`profileFirstText` text NOT NULL,
|
`profileFirstText` text NOT NULL,
|
||||||
PRIMARY KEY (`useruuid`)
|
PRIMARY KEY (`useruuid`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `userdata` (
|
CREATE TABLE IF NOT EXISTS `userdata` (
|
||||||
`UserId` char(36) NOT NULL,
|
`UserId` char(36) NOT NULL,
|
||||||
|
@ -73,7 +73,7 @@ CREATE TABLE IF NOT EXISTS `userdata` (
|
||||||
`DataKey` varchar(255),
|
`DataKey` varchar(255),
|
||||||
`DataVal` varchar(255),
|
`DataVal` varchar(255),
|
||||||
PRIMARY KEY (`UserId`,`TagId`)
|
PRIMARY KEY (`UserId`,`TagId`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `usersettings` (
|
CREATE TABLE IF NOT EXISTS `usersettings` (
|
||||||
`useruuid` varchar(36) NOT NULL,
|
`useruuid` varchar(36) NOT NULL,
|
||||||
|
@ -81,6 +81,6 @@ CREATE TABLE IF NOT EXISTS `usersettings` (
|
||||||
`visible` enum('true','false') NOT NULL,
|
`visible` enum('true','false') NOT NULL,
|
||||||
`email` varchar(254) NOT NULL,
|
`email` varchar(254) NOT NULL,
|
||||||
PRIMARY KEY (`useruuid`)
|
PRIMARY KEY (`useruuid`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||||
|
|
||||||
commit;
|
commit;
|
||||||
|
|
|
@ -31,7 +31,7 @@ CREATE TABLE `os_groups_membership` (
|
||||||
`AccessToken` char(36) NOT NULL default '',
|
`AccessToken` char(36) NOT NULL default '',
|
||||||
PRIMARY KEY (`GroupID`,`PrincipalID`),
|
PRIMARY KEY (`GroupID`,`PrincipalID`),
|
||||||
KEY `PrincipalID` (`PrincipalID`)
|
KEY `PrincipalID` (`PrincipalID`)
|
||||||
) ENGINE=InnoDB;
|
) ENGINE=MyISAM;
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE `os_groups_roles` (
|
CREATE TABLE `os_groups_roles` (
|
||||||
|
@ -43,7 +43,7 @@ CREATE TABLE `os_groups_roles` (
|
||||||
`Powers` bigint(20) unsigned NOT NULL default '0',
|
`Powers` bigint(20) unsigned NOT NULL default '0',
|
||||||
PRIMARY KEY (`GroupID`,`RoleID`),
|
PRIMARY KEY (`GroupID`,`RoleID`),
|
||||||
KEY `GroupID` (`GroupID`)
|
KEY `GroupID` (`GroupID`)
|
||||||
) ENGINE=InnoDB;
|
) ENGINE=MyISAM;
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE `os_groups_rolemembership` (
|
CREATE TABLE `os_groups_rolemembership` (
|
||||||
|
@ -52,7 +52,7 @@ CREATE TABLE `os_groups_rolemembership` (
|
||||||
`PrincipalID` VARCHAR(255) NOT NULL default '',
|
`PrincipalID` VARCHAR(255) NOT NULL default '',
|
||||||
PRIMARY KEY (`GroupID`,`RoleID`,`PrincipalID`),
|
PRIMARY KEY (`GroupID`,`RoleID`,`PrincipalID`),
|
||||||
KEY `PrincipalID` (`PrincipalID`)
|
KEY `PrincipalID` (`PrincipalID`)
|
||||||
) ENGINE=InnoDB;
|
) ENGINE=MyISAM;
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE `os_groups_invites` (
|
CREATE TABLE `os_groups_invites` (
|
||||||
|
@ -63,7 +63,7 @@ CREATE TABLE `os_groups_invites` (
|
||||||
`TMStamp` timestamp NOT NULL,
|
`TMStamp` timestamp NOT NULL,
|
||||||
PRIMARY KEY (`InviteID`),
|
PRIMARY KEY (`InviteID`),
|
||||||
UNIQUE KEY `PrincipalGroup` (`GroupID`,`PrincipalID`)
|
UNIQUE KEY `PrincipalGroup` (`GroupID`,`PrincipalID`)
|
||||||
) ENGINE=InnoDB;
|
) ENGINE=MyISAM;
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE `os_groups_notices` (
|
CREATE TABLE `os_groups_notices` (
|
||||||
|
@ -81,13 +81,13 @@ CREATE TABLE `os_groups_notices` (
|
||||||
PRIMARY KEY (`NoticeID`),
|
PRIMARY KEY (`NoticeID`),
|
||||||
KEY `GroupID` (`GroupID`),
|
KEY `GroupID` (`GroupID`),
|
||||||
KEY `TMStamp` (`TMStamp`)
|
KEY `TMStamp` (`TMStamp`)
|
||||||
) ENGINE=InnoDB;
|
) ENGINE=MyISAM;
|
||||||
|
|
||||||
CREATE TABLE `os_groups_principals` (
|
CREATE TABLE `os_groups_principals` (
|
||||||
`PrincipalID` VARCHAR(255) NOT NULL default '',
|
`PrincipalID` VARCHAR(255) NOT NULL default '',
|
||||||
`ActiveGroupID` char(36) NOT NULL default '',
|
`ActiveGroupID` char(36) NOT NULL default '',
|
||||||
PRIMARY KEY (`PrincipalID`)
|
PRIMARY KEY (`PrincipalID`)
|
||||||
) ENGINE=InnoDB;
|
) ENGINE=MyISAM;
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
|
@ -113,11 +113,3 @@ DROP TABLE `diva_groups_principals`;
|
||||||
DELETE FROM `migrations` WHERE name='diva_im_Store';
|
DELETE FROM `migrations` WHERE name='diva_im_Store';
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
:VERSION 3 # --------------------------
|
|
||||||
|
|
||||||
ALTER TABLE `os_groups_invites`
|
|
||||||
|
|
||||||
MODIFY `TMStamp` timestamp NOT NULL default CURRENT_TIMESTAMP;
|
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
|
|
|
@ -42,47 +42,6 @@ namespace OpenSim.Data.Null
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class NullGenericDataHandler
|
public class NullGenericDataHandler
|
||||||
{
|
{
|
||||||
protected List<T> Get<T>(string field, string val, List<T> inputEntities)
|
|
||||||
{
|
|
||||||
List<T> entities = inputEntities;
|
|
||||||
|
|
||||||
entities
|
|
||||||
= entities.Where(
|
|
||||||
e =>
|
|
||||||
{
|
|
||||||
FieldInfo fi = typeof(T).GetField(field);
|
|
||||||
if (fi == null)
|
|
||||||
throw new NotImplementedException(string.Format("No field {0} for val {1}", field, val));
|
|
||||||
|
|
||||||
return fi.GetValue(e).ToString() == val;
|
|
||||||
}
|
|
||||||
).ToList();
|
|
||||||
|
|
||||||
return entities;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected List<T> Get<T>(string field, string[] vals, List<T> inputEntities)
|
|
||||||
{
|
|
||||||
List<T> entities = new List<T>();
|
|
||||||
|
|
||||||
for (int i = 0; i < vals.Length; i++)
|
|
||||||
{
|
|
||||||
entities.AddRange (inputEntities.Where(
|
|
||||||
e =>
|
|
||||||
{
|
|
||||||
FieldInfo fi = typeof(T).GetField(field);
|
|
||||||
if (fi == null)
|
|
||||||
throw new NotImplementedException(string.Format("No field {0} for val {1}", field, vals[i]));
|
|
||||||
|
|
||||||
return fi.GetValue(e).ToString() == vals[i];
|
|
||||||
}
|
|
||||||
).ToList()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return entities;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected List<T> Get<T>(string[] fields, string[] vals, List<T> inputEntities)
|
protected List<T> Get<T>(string[] fields, string[] vals, List<T> inputEntities)
|
||||||
{
|
{
|
||||||
List<T> entities = inputEntities;
|
List<T> entities = inputEntities;
|
||||||
|
|
|
@ -68,34 +68,12 @@ namespace OpenSim.Data.Null
|
||||||
|
|
||||||
private delegate bool Matcher(string value);
|
private delegate bool Matcher(string value);
|
||||||
|
|
||||||
public RegionData GetSpecific(string regionName, UUID scopeID)
|
|
||||||
{
|
|
||||||
if (m_useStaticInstance && Instance != this)
|
|
||||||
return Instance.GetSpecific(regionName, scopeID);
|
|
||||||
|
|
||||||
string cleanName = regionName.ToLower();
|
|
||||||
Matcher queryMatch;
|
|
||||||
queryMatch = delegate (string s) { return s.Equals(cleanName); };
|
|
||||||
|
|
||||||
lock (m_regionData)
|
|
||||||
{
|
|
||||||
foreach (RegionData r in m_regionData.Values)
|
|
||||||
{
|
|
||||||
// m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanName, r.RegionName.ToLower());
|
|
||||||
if (queryMatch(r.RegionName.ToLower()))
|
|
||||||
return(r);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<RegionData> Get(string regionName, UUID scopeID)
|
public List<RegionData> Get(string regionName, UUID scopeID)
|
||||||
{
|
{
|
||||||
if (m_useStaticInstance && Instance != this)
|
if (m_useStaticInstance && Instance != this)
|
||||||
return Instance.Get(regionName, scopeID);
|
return Instance.Get(regionName, scopeID);
|
||||||
|
|
||||||
// m_log.DebugFormat("[NULL REGION DATA]: Getting region {0}, scope {1}", regionName, scopeID);
|
// m_log.DebugFormat("[NULL REGION DATA]: Getting region {0}, scope {1}", regionName, scopeID);
|
||||||
|
|
||||||
string cleanName = regionName.ToLower();
|
string cleanName = regionName.ToLower();
|
||||||
|
|
||||||
|
@ -156,22 +134,21 @@ namespace OpenSim.Data.Null
|
||||||
if (m_useStaticInstance && Instance != this)
|
if (m_useStaticInstance && Instance != this)
|
||||||
return Instance.Get(posX, posY, scopeID);
|
return Instance.Get(posX, posY, scopeID);
|
||||||
|
|
||||||
RegionData ret = null;
|
List<RegionData> ret = new List<RegionData>();
|
||||||
|
|
||||||
lock (m_regionData)
|
lock (m_regionData)
|
||||||
{
|
{
|
||||||
foreach (RegionData r in m_regionData.Values)
|
foreach (RegionData r in m_regionData.Values)
|
||||||
{
|
{
|
||||||
if (posX >= r.posX && posX < r.posX + r.sizeX
|
if (r.posX == posX && r.posY == posY)
|
||||||
&& posY >= r.posY && posY < r.posY + r.sizeY)
|
ret.Add(r);
|
||||||
{
|
|
||||||
ret = r;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
if (ret.Count > 0)
|
||||||
|
return ret[0];
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RegionData Get(UUID regionID, UUID scopeID)
|
public RegionData Get(UUID regionID, UUID scopeID)
|
||||||
|
@ -199,8 +176,7 @@ namespace OpenSim.Data.Null
|
||||||
{
|
{
|
||||||
foreach (RegionData r in m_regionData.Values)
|
foreach (RegionData r in m_regionData.Values)
|
||||||
{
|
{
|
||||||
if (r.posX + r.sizeX > startX && r.posX <= endX
|
if (r.posX >= startX && r.posX <= endX && r.posY >= startY && r.posY <= endY)
|
||||||
&& r.posY + r.sizeX > startY && r.posY <= endY)
|
|
||||||
ret.Add(r);
|
ret.Add(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,6 @@ namespace OpenSim.Data.Null
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary<UUID, TerrainData> m_terrains = new Dictionary<UUID, TerrainData>();
|
Dictionary<UUID, TerrainData> m_terrains = new Dictionary<UUID, TerrainData>();
|
||||||
Dictionary<UUID, TerrainData> m_bakedterrains = new Dictionary<UUID, TerrainData>();
|
|
||||||
public void StoreTerrain(TerrainData ter, UUID regionID)
|
public void StoreTerrain(TerrainData ter, UUID regionID)
|
||||||
{
|
{
|
||||||
if (m_terrains.ContainsKey(regionID))
|
if (m_terrains.ContainsKey(regionID))
|
||||||
|
@ -141,17 +140,10 @@ namespace OpenSim.Data.Null
|
||||||
m_terrains.Add(regionID, ter);
|
m_terrains.Add(regionID, ter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StoreBakedTerrain(TerrainData ter, UUID regionID)
|
|
||||||
{
|
|
||||||
if (m_bakedterrains.ContainsKey(regionID))
|
|
||||||
m_bakedterrains.Remove(regionID);
|
|
||||||
m_bakedterrains.Add(regionID, ter);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Legacy. Just don't do this.
|
// Legacy. Just don't do this.
|
||||||
public void StoreTerrain(double[,] ter, UUID regionID)
|
public void StoreTerrain(double[,] ter, UUID regionID)
|
||||||
{
|
{
|
||||||
TerrainData terrData = new TerrainData(ter);
|
TerrainData terrData = new HeightmapTerrainData(ter);
|
||||||
StoreTerrain(terrData, regionID);
|
StoreTerrain(terrData, regionID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,15 +167,6 @@ namespace OpenSim.Data.Null
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TerrainData LoadBakedTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
|
|
||||||
{
|
|
||||||
if (m_bakedterrains.ContainsKey(regionID))
|
|
||||||
{
|
|
||||||
return m_bakedterrains[regionID];
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RemoveLandObject(UUID globalID)
|
public void RemoveLandObject(UUID globalID)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -201,11 +184,6 @@ namespace OpenSim.Data.Null
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID[] GetObjectIDs(UUID regionID)
|
|
||||||
{
|
|
||||||
return new UUID[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SaveExtra(UUID regionID, string name, string value)
|
public void SaveExtra(UUID regionID, string name, string value)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,10 +193,5 @@ namespace OpenSim.Data.Null
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserAccountData[] GetUsersWhere(UUID scopeID, string where)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
|
|
||||||
[assembly : AssemblyVersion(OpenSim.VersionInfo.AssemblyVersionNumber)]
|
[assembly : AssemblyVersion("0.8.2.*")]
|
||||||
|
|
||||||
|
|
|
@ -44,12 +44,20 @@ namespace OpenSim.Data.PGSQL
|
||||||
|
|
||||||
public AgentPreferencesData GetPrefs(UUID agentID)
|
public AgentPreferencesData GetPrefs(UUID agentID)
|
||||||
{
|
{
|
||||||
|
// Until someone sends in a table that works
|
||||||
AgentPreferencesData[] ret = Get("PrincipalID", agentID.ToString());
|
|
||||||
|
|
||||||
if (ret.Length == 0)
|
|
||||||
return null;
|
return null;
|
||||||
return ret[0];
|
//AgentPreferencesData[] ret = Get("PrincipalID", agentID.ToString());
|
||||||
|
|
||||||
|
//if (ret.Length == 0)
|
||||||
|
// return null;
|
||||||
|
|
||||||
|
//return ret[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Store(AgentPreferencesData row)
|
||||||
|
{
|
||||||
|
// Until someone sends in a table that works
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,7 @@ namespace OpenSim.Data.PGSQL
|
||||||
/// Create asset in m_database
|
/// Create asset in m_database
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="asset">the asset</param>
|
/// <param name="asset">the asset</param>
|
||||||
override public bool StoreAsset(AssetBase asset)
|
override public void StoreAsset(AssetBase asset)
|
||||||
{
|
{
|
||||||
|
|
||||||
string sql =
|
string sql =
|
||||||
|
@ -208,7 +208,6 @@ namespace OpenSim.Data.PGSQL
|
||||||
m_log.Error("[ASSET DB]: Error storing item :" + e.Message + " sql "+sql);
|
m_log.Error("[ASSET DB]: Error storing item :" + e.Message + " sql "+sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -286,7 +286,7 @@ namespace OpenSim.Data.PGSQL
|
||||||
{
|
{
|
||||||
es.ClearBans();
|
es.ClearBans();
|
||||||
|
|
||||||
string sql = "select * from estateban where \"EstateID\" = :EstateID";
|
string sql = "select \"bannedUUID\" from estateban where \"EstateID\" = :EstateID";
|
||||||
|
|
||||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
||||||
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
||||||
|
@ -302,8 +302,6 @@ namespace OpenSim.Data.PGSQL
|
||||||
EstateBan eb = new EstateBan();
|
EstateBan eb = new EstateBan();
|
||||||
|
|
||||||
eb.BannedUserID = new UUID((Guid)reader["bannedUUID"]); //uuid;
|
eb.BannedUserID = new UUID((Guid)reader["bannedUUID"]); //uuid;
|
||||||
eb.BanningUserID = new UUID((Guid)reader["banningUUID"]); //uuid;
|
|
||||||
eb.BanTime = Convert.ToInt32(reader["banTime"]);
|
|
||||||
eb.BannedHostAddress = "0.0.0.0";
|
eb.BannedHostAddress = "0.0.0.0";
|
||||||
eb.BannedHostIPMask = "0.0.0.0";
|
eb.BannedHostIPMask = "0.0.0.0";
|
||||||
es.AddBan(eb);
|
es.AddBan(eb);
|
||||||
|
@ -348,15 +346,11 @@ namespace OpenSim.Data.PGSQL
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
|
|
||||||
//Insert after
|
//Insert after
|
||||||
cmd.CommandText = "insert into estateban (\"EstateID\", \"bannedUUID\",\"bannedIp\", \"bannedIpHostMask\", \"bannedNameMask\", \"banningUUID\",\"banTime\" ) values ( :EstateID, :bannedUUID, '','','', :banningUUID, :banTime )";
|
cmd.CommandText = "insert into estateban (\"EstateID\", \"bannedUUID\",\"bannedIp\", \"bannedIpHostMask\", \"bannedNameMask\") values ( :EstateID, :bannedUUID, '','','' )";
|
||||||
cmd.Parameters.AddWithValue("bannedUUID", Guid.Empty);
|
cmd.Parameters.AddWithValue("bannedUUID", Guid.Empty);
|
||||||
foreach (EstateBan b in es.EstateBans)
|
foreach (EstateBan b in es.EstateBans)
|
||||||
{
|
{
|
||||||
cmd.Parameters["EstateID"].Value = b.EstateID;
|
|
||||||
cmd.Parameters["bannedUUID"].Value = b.BannedUserID.Guid;
|
cmd.Parameters["bannedUUID"].Value = b.BannedUserID.Guid;
|
||||||
cmd.Parameters["banningUUID"].Value = b.BanningUserID.Guid;
|
|
||||||
cmd.Parameters["banTime"].Value = b.BanTime;
|
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,316 +0,0 @@
|
||||||
/*
|
|
||||||
* 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 System.Collections.Generic;
|
|
||||||
using System.Data;
|
|
||||||
using OpenSim.Framework;
|
|
||||||
using OpenSim.Framework.Console;
|
|
||||||
using log4net;
|
|
||||||
using OpenMetaverse;
|
|
||||||
using Npgsql;
|
|
||||||
using NpgsqlTypes;
|
|
||||||
|
|
||||||
namespace OpenSim.Data.PGSQL
|
|
||||||
{
|
|
||||||
public class PGSQLFSAssetData : IFSAssetDataPlugin
|
|
||||||
{
|
|
||||||
private const string _migrationStore = "FSAssetStore";
|
|
||||||
private static string m_Table = "fsassets";
|
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
|
||||||
private long m_ticksToEpoch;
|
|
||||||
|
|
||||||
private PGSQLManager m_database;
|
|
||||||
private string m_connectionString;
|
|
||||||
|
|
||||||
public PGSQLFSAssetData()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Initialise(string connect, string realm, int UpdateAccessTime)
|
|
||||||
{
|
|
||||||
DaysBetweenAccessTimeUpdates = UpdateAccessTime;
|
|
||||||
|
|
||||||
m_ticksToEpoch = new System.DateTime(1970, 1, 1).Ticks;
|
|
||||||
|
|
||||||
m_connectionString = connect;
|
|
||||||
m_database = new PGSQLManager(m_connectionString);
|
|
||||||
|
|
||||||
//New migration to check for DB changes
|
|
||||||
m_database.CheckMigration(_migrationStore);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Initialise()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Number of days that must pass before we update the access time on an asset when it has been fetched
|
|
||||||
/// Config option to change this is "DaysBetweenAccessTimeUpdates"
|
|
||||||
/// </summary>
|
|
||||||
private int DaysBetweenAccessTimeUpdates = 0;
|
|
||||||
|
|
||||||
protected virtual Assembly Assembly
|
|
||||||
{
|
|
||||||
get { return GetType().Assembly; }
|
|
||||||
}
|
|
||||||
|
|
||||||
#region IPlugin Members
|
|
||||||
|
|
||||||
public string Version { get { return "1.0.0.0"; } }
|
|
||||||
|
|
||||||
public void Dispose() { }
|
|
||||||
|
|
||||||
public string Name
|
|
||||||
{
|
|
||||||
get { return "PGSQL FSAsset storage engine"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region IFSAssetDataPlugin Members
|
|
||||||
|
|
||||||
public AssetMetadata Get(string id, out string hash)
|
|
||||||
{
|
|
||||||
hash = String.Empty;
|
|
||||||
AssetMetadata meta = null;
|
|
||||||
UUID uuid = new UUID(id);
|
|
||||||
|
|
||||||
string query = String.Format("select \"id\", \"type\", \"hash\", \"create_time\", \"access_time\", \"asset_flags\" from {0} where \"id\" = :id", m_Table);
|
|
||||||
using (NpgsqlConnection dbcon = new NpgsqlConnection(m_connectionString))
|
|
||||||
using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
|
|
||||||
{
|
|
||||||
dbcon.Open();
|
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("id", uuid));
|
|
||||||
using (NpgsqlDataReader reader = cmd.ExecuteReader(CommandBehavior.Default))
|
|
||||||
{
|
|
||||||
if (reader.Read())
|
|
||||||
{
|
|
||||||
meta = new AssetMetadata();
|
|
||||||
hash = reader["hash"].ToString();
|
|
||||||
meta.ID = id;
|
|
||||||
meta.FullID = uuid;
|
|
||||||
meta.Name = String.Empty;
|
|
||||||
meta.Description = String.Empty;
|
|
||||||
meta.Type = (sbyte)Convert.ToInt32(reader["type"]);
|
|
||||||
meta.ContentType = SLUtil.SLAssetTypeToContentType(meta.Type);
|
|
||||||
meta.CreationDate = Util.ToDateTime(Convert.ToInt32(reader["create_time"]));
|
|
||||||
meta.Flags = (AssetFlags)Convert.ToInt32(reader["asset_flags"]);
|
|
||||||
int atime = Convert.ToInt32(reader["access_time"]);
|
|
||||||
UpdateAccessTime(atime, uuid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return meta;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateAccessTime(int AccessTime, UUID id)
|
|
||||||
{
|
|
||||||
// Reduce DB work by only updating access time if asset hasn't recently been accessed
|
|
||||||
// 0 By Default, Config option is "DaysBetweenAccessTimeUpdates"
|
|
||||||
if (DaysBetweenAccessTimeUpdates > 0 && (DateTime.UtcNow - Utils.UnixTimeToDateTime(AccessTime)).TotalDays < DaysBetweenAccessTimeUpdates)
|
|
||||||
return;
|
|
||||||
|
|
||||||
string query = String.Format("UPDATE {0} SET \"access_time\" = :access_time WHERE \"id\" = :id", m_Table);
|
|
||||||
using (NpgsqlConnection dbcon = new NpgsqlConnection(m_connectionString))
|
|
||||||
using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
|
|
||||||
{
|
|
||||||
dbcon.Open();
|
|
||||||
int now = (int)((System.DateTime.Now.Ticks - m_ticksToEpoch) / 10000000);
|
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("id", id));
|
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("access_time", now));
|
|
||||||
cmd.ExecuteNonQuery();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Store(AssetMetadata meta, string hash)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
bool found = false;
|
|
||||||
string oldhash;
|
|
||||||
AssetMetadata existingAsset = Get(meta.ID, out oldhash);
|
|
||||||
|
|
||||||
string query = String.Format("UPDATE {0} SET \"access_time\" = :access_time WHERE \"id\" = :id", m_Table);
|
|
||||||
if (existingAsset == null)
|
|
||||||
{
|
|
||||||
query = String.Format("insert into {0} (\"id\", \"type\", \"hash\", \"asset_flags\", \"create_time\", \"access_time\") values ( :id, :type, :hash, :asset_flags, :create_time, :access_time)", m_Table);
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
using (NpgsqlConnection dbcon = new NpgsqlConnection(m_connectionString))
|
|
||||||
using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
|
|
||||||
{
|
|
||||||
dbcon.Open();
|
|
||||||
int now = (int)((System.DateTime.Now.Ticks - m_ticksToEpoch) / 10000000);
|
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("id", meta.FullID));
|
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("type", meta.Type));
|
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("hash", hash));
|
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("asset_flags", Convert.ToInt32(meta.Flags)));
|
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("create_time", now));
|
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("access_time", now));
|
|
||||||
cmd.ExecuteNonQuery();
|
|
||||||
}
|
|
||||||
return found;
|
|
||||||
}
|
|
||||||
catch(Exception e)
|
|
||||||
{
|
|
||||||
m_log.Error("[PGSQL FSASSETS] Failed to store asset with ID " + meta.ID);
|
|
||||||
m_log.Error(e.ToString());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Check if the assets exist in the database.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="uuids">The asset UUID's</param>
|
|
||||||
/// <returns>For each asset: true if it exists, false otherwise</returns>
|
|
||||||
public bool[] AssetsExist(UUID[] uuids)
|
|
||||||
{
|
|
||||||
if (uuids.Length == 0)
|
|
||||||
return new bool[0];
|
|
||||||
|
|
||||||
HashSet<UUID> exists = new HashSet<UUID>();
|
|
||||||
|
|
||||||
string ids = "'" + string.Join("','", uuids) + "'";
|
|
||||||
string query = string.Format("select \"id\" from {1} where id in ({0})", ids, m_Table);
|
|
||||||
using (NpgsqlConnection dbcon = new NpgsqlConnection(m_connectionString))
|
|
||||||
using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
|
|
||||||
{
|
|
||||||
dbcon.Open();
|
|
||||||
using (NpgsqlDataReader reader = cmd.ExecuteReader(CommandBehavior.Default))
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
|
||||||
UUID id = DBGuid.FromDB(reader["id"]);;
|
|
||||||
exists.Add(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool[] results = new bool[uuids.Length];
|
|
||||||
for (int i = 0; i < uuids.Length; i++)
|
|
||||||
results[i] = exists.Contains(uuids[i]);
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Count()
|
|
||||||
{
|
|
||||||
int count = 0;
|
|
||||||
string query = String.Format("select count(*) as count from {0}", m_Table);
|
|
||||||
using (NpgsqlConnection dbcon = new NpgsqlConnection(m_connectionString))
|
|
||||||
using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
|
|
||||||
{
|
|
||||||
dbcon.Open();
|
|
||||||
IDataReader reader = cmd.ExecuteReader();
|
|
||||||
reader.Read();
|
|
||||||
count = Convert.ToInt32(reader["count"]);
|
|
||||||
reader.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Delete(string id)
|
|
||||||
{
|
|
||||||
string query = String.Format("delete from {0} where \"id\" = :id", m_Table);
|
|
||||||
using (NpgsqlConnection dbcon = new NpgsqlConnection(m_connectionString))
|
|
||||||
using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
|
|
||||||
{
|
|
||||||
dbcon.Open();
|
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("id", new UUID(id)));
|
|
||||||
cmd.ExecuteNonQuery();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Import(string conn, string table, int start, int count, bool force, FSStoreDelegate store)
|
|
||||||
{
|
|
||||||
int imported = 0;
|
|
||||||
string limit = String.Empty;
|
|
||||||
if(count != -1)
|
|
||||||
{
|
|
||||||
limit = String.Format(" limit {0} offset {1}", start, count);
|
|
||||||
}
|
|
||||||
string query = String.Format("select * from {0}{1}", table, limit);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (NpgsqlConnection remote = new NpgsqlConnection(conn))
|
|
||||||
using (NpgsqlCommand cmd = new NpgsqlCommand(query, remote))
|
|
||||||
{
|
|
||||||
remote.Open();
|
|
||||||
MainConsole.Instance.Output("Querying database");
|
|
||||||
MainConsole.Instance.Output("Reading data");
|
|
||||||
using (NpgsqlDataReader reader = cmd.ExecuteReader(CommandBehavior.Default))
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
|
||||||
if ((imported % 100) == 0)
|
|
||||||
{
|
|
||||||
MainConsole.Instance.Output(String.Format("{0} assets imported so far", imported));
|
|
||||||
}
|
|
||||||
|
|
||||||
AssetBase asset = new AssetBase();
|
|
||||||
AssetMetadata meta = new AssetMetadata();
|
|
||||||
|
|
||||||
meta.ID = reader["id"].ToString();
|
|
||||||
meta.FullID = new UUID(meta.ID);
|
|
||||||
|
|
||||||
meta.Name = String.Empty;
|
|
||||||
meta.Description = String.Empty;
|
|
||||||
meta.Type = (sbyte)Convert.ToInt32(reader["assetType"]);
|
|
||||||
meta.ContentType = SLUtil.SLAssetTypeToContentType(meta.Type);
|
|
||||||
meta.CreationDate = Util.ToDateTime(Convert.ToInt32(reader["create_time"]));
|
|
||||||
|
|
||||||
asset.Metadata = meta;
|
|
||||||
asset.Data = (byte[])reader["data"];
|
|
||||||
|
|
||||||
store(asset, force);
|
|
||||||
|
|
||||||
imported++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[PGSQL FSASSETS]: Error importing assets: {0}",
|
|
||||||
e.Message.ToString());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
MainConsole.Instance.Output(String.Format("Import done, {0} assets imported", imported));
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -145,21 +145,26 @@ namespace OpenSim.Data.PGSQL
|
||||||
private List<string> GetConstraints()
|
private List<string> GetConstraints()
|
||||||
{
|
{
|
||||||
List<string> constraints = new List<string>();
|
List<string> constraints = new List<string>();
|
||||||
string query = string.Format(@"select
|
string query = string.Format(@"SELECT kcu.column_name
|
||||||
a.attname as column_name
|
FROM information_schema.table_constraints tc
|
||||||
from
|
LEFT JOIN information_schema.key_column_usage kcu
|
||||||
pg_class t,
|
ON tc.constraint_catalog = kcu.constraint_catalog
|
||||||
pg_class i,
|
AND tc.constraint_schema = kcu.constraint_schema
|
||||||
pg_index ix,
|
AND tc.constraint_name = kcu.constraint_name
|
||||||
pg_attribute a
|
|
||||||
where
|
LEFT JOIN information_schema.referential_constraints rc
|
||||||
t.oid = ix.indrelid
|
ON tc.constraint_catalog = rc.constraint_catalog
|
||||||
and i.oid = ix.indexrelid
|
AND tc.constraint_schema = rc.constraint_schema
|
||||||
and a.attrelid = t.oid
|
AND tc.constraint_name = rc.constraint_name
|
||||||
and a.attnum = ANY(ix.indkey)
|
|
||||||
and t.relkind = 'r'
|
LEFT JOIN information_schema.constraint_column_usage ccu
|
||||||
and ix.indisunique = true
|
ON rc.unique_constraint_catalog = ccu.constraint_catalog
|
||||||
and t.relname = lower('{0}')
|
AND rc.unique_constraint_schema = ccu.constraint_schema
|
||||||
|
AND rc.unique_constraint_name = ccu.constraint_name
|
||||||
|
|
||||||
|
where tc.table_name = lower('{0}')
|
||||||
|
and lower(tc.constraint_type) in ('primary key')
|
||||||
|
and kcu.column_name is not null
|
||||||
;", m_Realm);
|
;", m_Realm);
|
||||||
|
|
||||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_ConnectionString))
|
using (NpgsqlConnection conn = new NpgsqlConnection(m_ConnectionString))
|
||||||
|
@ -180,54 +185,7 @@ namespace OpenSim.Data.PGSQL
|
||||||
|
|
||||||
public virtual T[] Get(string field, string key)
|
public virtual T[] Get(string field, string key)
|
||||||
{
|
{
|
||||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_ConnectionString))
|
return Get(new string[] { field }, new string[] { key });
|
||||||
using (NpgsqlCommand cmd = new NpgsqlCommand())
|
|
||||||
{
|
|
||||||
if ( m_FieldTypes.ContainsKey(field) )
|
|
||||||
cmd.Parameters.Add(m_database.CreateParameter(field, key, m_FieldTypes[field]));
|
|
||||||
else
|
|
||||||
cmd.Parameters.Add(m_database.CreateParameter(field, key));
|
|
||||||
|
|
||||||
string query = String.Format("SELECT * FROM {0} WHERE \"{1}\" = :{1}", m_Realm, field, field);
|
|
||||||
|
|
||||||
cmd.Connection = conn;
|
|
||||||
cmd.CommandText = query;
|
|
||||||
conn.Open();
|
|
||||||
return DoQuery(cmd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual T[] Get(string field, string[] keys)
|
|
||||||
{
|
|
||||||
|
|
||||||
int flen = keys.Length;
|
|
||||||
if(flen == 0)
|
|
||||||
return new T[0];
|
|
||||||
|
|
||||||
int flast = flen - 1;
|
|
||||||
StringBuilder sb = new StringBuilder(1024);
|
|
||||||
sb.AppendFormat("select * from {0} where {1} IN ('", m_Realm, field);
|
|
||||||
|
|
||||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_ConnectionString))
|
|
||||||
using (NpgsqlCommand cmd = new NpgsqlCommand())
|
|
||||||
{
|
|
||||||
|
|
||||||
for (int i = 0 ; i < flen ; i++)
|
|
||||||
{
|
|
||||||
sb.Append(keys[i]);
|
|
||||||
if(i < flast)
|
|
||||||
sb.Append("','");
|
|
||||||
else
|
|
||||||
sb.Append("')");
|
|
||||||
}
|
|
||||||
|
|
||||||
string query = sb.ToString();
|
|
||||||
|
|
||||||
cmd.Connection = conn;
|
|
||||||
cmd.CommandText = query;
|
|
||||||
conn.Open();
|
|
||||||
return DoQuery(cmd);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual T[] Get(string[] fields, string[] keys)
|
public virtual T[] Get(string[] fields, string[] keys)
|
||||||
|
|
|
@ -86,13 +86,13 @@ namespace OpenSim.Data.PGSQL
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(pattern)) // True for where clause
|
if (string.IsNullOrEmpty(pattern)) // True for where clause
|
||||||
{
|
{
|
||||||
pattern = "1";
|
pattern = " 1 ORDER BY lower(\"Name\") LIMIT 100";
|
||||||
|
|
||||||
return m_Groups.Get(pattern);
|
return m_Groups.Get(pattern);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pattern = " \"ShowInList\" = 1 AND lower(\"Name\") LIKE lower('%" + pattern + "%')";
|
pattern = " \"ShowInList\" = 1 AND lower(\"Name\") LIKE lower('%" + pattern + "%') ORDER BY lower(\"Name\") LIMIT 100";
|
||||||
|
|
||||||
return m_Groups.Get(pattern, new NpgsqlParameter("pattern", pattern));
|
return m_Groups.Get(pattern, new NpgsqlParameter("pattern", pattern));
|
||||||
}
|
}
|
||||||
|
@ -435,7 +435,7 @@ namespace OpenSim.Data.PGSQL
|
||||||
|
|
||||||
using (NpgsqlCommand cmd = new NpgsqlCommand())
|
using (NpgsqlCommand cmd = new NpgsqlCommand())
|
||||||
{
|
{
|
||||||
cmd.CommandText = String.Format("delete from {0} where \"TMStamp\"::abstime::timestamp < now() - INTERVAL '2 week'", m_Realm);
|
cmd.CommandText = String.Format("delete from {0} where \"TMStamp\" < CURRENT_DATE - INTERVAL '2 week'", m_Realm);
|
||||||
|
|
||||||
ExecuteNonQuery(cmd);
|
ExecuteNonQuery(cmd);
|
||||||
}
|
}
|
||||||
|
@ -461,7 +461,7 @@ namespace OpenSim.Data.PGSQL
|
||||||
|
|
||||||
using (NpgsqlCommand cmd = new NpgsqlCommand())
|
using (NpgsqlCommand cmd = new NpgsqlCommand())
|
||||||
{
|
{
|
||||||
cmd.CommandText = String.Format("delete from {0} where \"TMStamp\"::abstime::timestamp < now() - INTERVAL '2 week'", m_Realm);
|
cmd.CommandText = String.Format("delete from {0} where \"TMStamp\" < CURRENT_DATE - INTERVAL '2 week'", m_Realm);
|
||||||
|
|
||||||
ExecuteNonQuery(cmd);
|
ExecuteNonQuery(cmd);
|
||||||
}
|
}
|
||||||
|
|
|
@ -251,7 +251,7 @@ namespace OpenSim.Data.PGSQL
|
||||||
}
|
}
|
||||||
if (PGFieldType == "double precision")
|
if (PGFieldType == "double precision")
|
||||||
{
|
{
|
||||||
return Convert.ToDouble(value);
|
return (Double)value;
|
||||||
}
|
}
|
||||||
return CreateParameterValue(value);
|
return CreateParameterValue(value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,14 +26,16 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Data;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using RegionFlags = OpenSim.Framework.RegionFlags;
|
using RegionFlags = OpenSim.Framework.RegionFlags;
|
||||||
using Npgsql;
|
using Npgsql;
|
||||||
|
|
||||||
|
@ -114,16 +116,17 @@ namespace OpenSim.Data.PGSQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public RegionData GetSpecific(string regionName, UUID scopeID)
|
public RegionData Get(int posX, int posY, UUID scopeID)
|
||||||
{
|
{
|
||||||
string sql = "select * from " + m_Realm + " where lower(\"regionName\") = lower(:regionName) ";
|
string sql = "select * from "+m_Realm+" where \"locX\" = :posX and \"locY\" = :posY";
|
||||||
if (scopeID != UUID.Zero)
|
if (scopeID != UUID.Zero)
|
||||||
sql += " and \"ScopeID\" = :scopeID";
|
sql += " and \"ScopeID\" = :scopeID";
|
||||||
|
|
||||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_ConnectionString))
|
using (NpgsqlConnection conn = new NpgsqlConnection(m_ConnectionString))
|
||||||
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
||||||
{
|
{
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("regionName", regionName));
|
cmd.Parameters.Add(m_database.CreateParameter("posX", posX));
|
||||||
|
cmd.Parameters.Add(m_database.CreateParameter("posY", posY));
|
||||||
if (scopeID != UUID.Zero)
|
if (scopeID != UUID.Zero)
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("scopeID", scopeID));
|
cmd.Parameters.Add(m_database.CreateParameter("scopeID", scopeID));
|
||||||
conn.Open();
|
conn.Open();
|
||||||
|
@ -135,50 +138,6 @@ namespace OpenSim.Data.PGSQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public RegionData Get(int posX, int posY, UUID scopeID)
|
|
||||||
{
|
|
||||||
// extend database search for maximum region size area
|
|
||||||
string sql = "select * from "+m_Realm+" where \"locX\" between :startX and :endX and \"locY\" between :startY and :endY";
|
|
||||||
if (scopeID != UUID.Zero)
|
|
||||||
sql += " and \"ScopeID\" = :scopeID";
|
|
||||||
|
|
||||||
int startX = posX - (int)Constants.MaximumRegionSize;
|
|
||||||
int startY = posY - (int)Constants.MaximumRegionSize;
|
|
||||||
int endX = posX;
|
|
||||||
int endY = posY;
|
|
||||||
|
|
||||||
List<RegionData> ret;
|
|
||||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_ConnectionString))
|
|
||||||
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
|
||||||
{
|
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("startX", startX));
|
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("startY", startY));
|
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("endX", endX));
|
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("endY", endY));
|
|
||||||
if (scopeID != UUID.Zero)
|
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("scopeID", scopeID));
|
|
||||||
conn.Open();
|
|
||||||
ret = RunCommand(cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ret.Count == 0)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
// Find the first that contains pos
|
|
||||||
RegionData rg = null;
|
|
||||||
foreach (RegionData r in ret)
|
|
||||||
{
|
|
||||||
if (posX >= r.posX && posX < r.posX + r.sizeX
|
|
||||||
&& posY >= r.posY && posY < r.posY + r.sizeY)
|
|
||||||
{
|
|
||||||
rg = r;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return rg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RegionData Get(UUID regionID, UUID scopeID)
|
public RegionData Get(UUID regionID, UUID scopeID)
|
||||||
{
|
{
|
||||||
string sql = "select * from "+m_Realm+" where uuid = :regionID";
|
string sql = "select * from "+m_Realm+" where uuid = :regionID";
|
||||||
|
@ -201,41 +160,21 @@ namespace OpenSim.Data.PGSQL
|
||||||
|
|
||||||
public List<RegionData> Get(int startX, int startY, int endX, int endY, UUID scopeID)
|
public List<RegionData> Get(int startX, int startY, int endX, int endY, UUID scopeID)
|
||||||
{
|
{
|
||||||
// extend database search for maximum region size area
|
|
||||||
string sql = "select * from "+m_Realm+" where \"locX\" between :startX and :endX and \"locY\" between :startY and :endY";
|
string sql = "select * from "+m_Realm+" where \"locX\" between :startX and :endX and \"locY\" between :startY and :endY";
|
||||||
if (scopeID != UUID.Zero)
|
if (scopeID != UUID.Zero)
|
||||||
sql += " and \"ScopeID\" = :scopeID";
|
sql += " and \"ScopeID\" = :scopeID";
|
||||||
|
|
||||||
int qstartX = startX - (int)Constants.MaximumRegionSize;
|
|
||||||
int qstartY = startY - (int)Constants.MaximumRegionSize;
|
|
||||||
|
|
||||||
List<RegionData> dbret;
|
|
||||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_ConnectionString))
|
using (NpgsqlConnection conn = new NpgsqlConnection(m_ConnectionString))
|
||||||
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
||||||
{
|
{
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("startX", qstartX));
|
cmd.Parameters.Add(m_database.CreateParameter("startX", startX));
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("startY", qstartY));
|
cmd.Parameters.Add(m_database.CreateParameter("startY", startY));
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("endX", endX));
|
cmd.Parameters.Add(m_database.CreateParameter("endX", endX));
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("endY", endY));
|
cmd.Parameters.Add(m_database.CreateParameter("endY", endY));
|
||||||
if (scopeID != UUID.Zero)
|
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("scopeID", scopeID));
|
cmd.Parameters.Add(m_database.CreateParameter("scopeID", scopeID));
|
||||||
conn.Open();
|
conn.Open();
|
||||||
|
return RunCommand(cmd);
|
||||||
dbret = RunCommand(cmd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<RegionData> ret = new List<RegionData>();
|
|
||||||
|
|
||||||
if(dbret.Count == 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
foreach (RegionData r in dbret)
|
|
||||||
{
|
|
||||||
if (r.posX + r.sizeX > startX && r.posX <= endX
|
|
||||||
&& r.posY + r.sizeY > startY && r.posY <= endY)
|
|
||||||
ret.Add(r);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<RegionData> RunCommand(NpgsqlCommand cmd)
|
public List<RegionData> RunCommand(NpgsqlCommand cmd)
|
||||||
|
|
|
@ -31,13 +31,11 @@ using System.Data;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading;
|
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Data;
|
|
||||||
using Npgsql;
|
using Npgsql;
|
||||||
|
|
||||||
namespace OpenSim.Data.PGSQL
|
namespace OpenSim.Data.PGSQL
|
||||||
|
@ -350,13 +348,10 @@ namespace OpenSim.Data.PGSQL
|
||||||
""CameraEyeOffsetY"" = :CameraEyeOffsetY, ""CameraEyeOffsetZ"" = :CameraEyeOffsetZ, ""CameraAtOffsetX"" = :CameraAtOffsetX,
|
""CameraEyeOffsetY"" = :CameraEyeOffsetY, ""CameraEyeOffsetZ"" = :CameraEyeOffsetZ, ""CameraAtOffsetX"" = :CameraAtOffsetX,
|
||||||
""CameraAtOffsetY"" = :CameraAtOffsetY, ""CameraAtOffsetZ"" = :CameraAtOffsetZ, ""ForceMouselook"" = :ForceMouselook,
|
""CameraAtOffsetY"" = :CameraAtOffsetY, ""CameraAtOffsetZ"" = :CameraAtOffsetZ, ""ForceMouselook"" = :ForceMouselook,
|
||||||
""ScriptAccessPin"" = :ScriptAccessPin, ""AllowedDrop"" = :AllowedDrop, ""DieAtEdge"" = :DieAtEdge, ""SalePrice"" = :SalePrice,
|
""ScriptAccessPin"" = :ScriptAccessPin, ""AllowedDrop"" = :AllowedDrop, ""DieAtEdge"" = :DieAtEdge, ""SalePrice"" = :SalePrice,
|
||||||
""PhysicsShapeType"" = :PhysicsShapeType, ""Density"" = :Density, ""GravityModifier"" = :GravityModifier, ""Friction"" = :Friction, ""Restitution"" = :Restitution,
|
""SaleType"" = :SaleType, ""ColorR"" = :ColorR, ""ColorG"" = :ColorG, ""ColorB"" = :ColorB, ""ColorA"" = :ColorA, ""ParticleSystem"" = :ParticleSystem,
|
||||||
""PassCollisions"" = :PassCollisions, ""RotationAxisLocks"" = :RotationAxisLocks, ""RezzerID"" = :RezzerID,
|
|
||||||
""ClickAction"" = :ClickAction, ""Material"" = :Material, ""CollisionSound"" = :CollisionSound, ""CollisionSoundVolume"" = :CollisionSoundVolume, ""PassTouches"" = :PassTouches,
|
""ClickAction"" = :ClickAction, ""Material"" = :Material, ""CollisionSound"" = :CollisionSound, ""CollisionSoundVolume"" = :CollisionSoundVolume, ""PassTouches"" = :PassTouches,
|
||||||
""LinkNumber"" = :LinkNumber, ""MediaURL"" = :MediaURL, ""DynAttrs"" = :DynAttrs, ""Vehicle"" = :Vehicle,
|
""LinkNumber"" = :LinkNumber, ""MediaURL"" = :MediaURL, ""DynAttrs"" = :DynAttrs,
|
||||||
""PhysInertia"" = :PhysInertia, ""standtargetx"" =:standtargetx, ""standtargety"" =:standtargety, ""standtargetz"" =:standtargetz,
|
""PhysicsShapeType"" = :PhysicsShapeType, ""Density"" = :Density, ""GravityModifier"" = :GravityModifier, ""Friction"" = :Friction, ""Restitution"" = :Restitution
|
||||||
""sitactrange"" =:sitactrange, ""pseudocrc"" = :pseudocrc
|
|
||||||
|
|
||||||
WHERE ""UUID"" = :UUID ;
|
WHERE ""UUID"" = :UUID ;
|
||||||
|
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
|
@ -370,8 +365,7 @@ namespace OpenSim.Data.PGSQL
|
||||||
""OmegaY"", ""OmegaZ"", ""CameraEyeOffsetX"", ""CameraEyeOffsetY"", ""CameraEyeOffsetZ"", ""CameraAtOffsetX"", ""CameraAtOffsetY"", ""CameraAtOffsetZ"",
|
""OmegaY"", ""OmegaZ"", ""CameraEyeOffsetX"", ""CameraEyeOffsetY"", ""CameraEyeOffsetZ"", ""CameraAtOffsetX"", ""CameraAtOffsetY"", ""CameraAtOffsetZ"",
|
||||||
""ForceMouselook"", ""ScriptAccessPin"", ""AllowedDrop"", ""DieAtEdge"", ""SalePrice"", ""SaleType"", ""ColorR"", ""ColorG"", ""ColorB"", ""ColorA"",
|
""ForceMouselook"", ""ScriptAccessPin"", ""AllowedDrop"", ""DieAtEdge"", ""SalePrice"", ""SaleType"", ""ColorR"", ""ColorG"", ""ColorB"", ""ColorA"",
|
||||||
""ParticleSystem"", ""ClickAction"", ""Material"", ""CollisionSound"", ""CollisionSoundVolume"", ""PassTouches"", ""LinkNumber"", ""MediaURL"", ""DynAttrs"",
|
""ParticleSystem"", ""ClickAction"", ""Material"", ""CollisionSound"", ""CollisionSoundVolume"", ""PassTouches"", ""LinkNumber"", ""MediaURL"", ""DynAttrs"",
|
||||||
""PhysicsShapeType"", ""Density"", ""GravityModifier"", ""Friction"", ""Restitution"", ""PassCollisions"", ""RotationAxisLocks"", ""RezzerID"" , ""Vehicle"", ""PhysInertia"",
|
""PhysicsShapeType"", ""Density"", ""GravityModifier"", ""Friction"", ""Restitution""
|
||||||
""standtargetx"", ""standtargety"", ""standtargetz"", ""sitactrange"", ""pseudocrc""
|
|
||||||
) Select
|
) Select
|
||||||
:UUID, :CreationDate, :Name, :Text, :Description, :SitName, :TouchName, :ObjectFlags, :OwnerMask, :NextOwnerMask, :GroupMask,
|
:UUID, :CreationDate, :Name, :Text, :Description, :SitName, :TouchName, :ObjectFlags, :OwnerMask, :NextOwnerMask, :GroupMask,
|
||||||
:EveryoneMask, :BaseMask, :PositionX, :PositionY, :PositionZ, :GroupPositionX, :GroupPositionY, :GroupPositionZ, :VelocityX,
|
:EveryoneMask, :BaseMask, :PositionX, :PositionY, :PositionZ, :GroupPositionX, :GroupPositionY, :GroupPositionZ, :VelocityX,
|
||||||
|
@ -382,8 +376,7 @@ namespace OpenSim.Data.PGSQL
|
||||||
:OmegaY, :OmegaZ, :CameraEyeOffsetX, :CameraEyeOffsetY, :CameraEyeOffsetZ, :CameraAtOffsetX, :CameraAtOffsetY, :CameraAtOffsetZ,
|
:OmegaY, :OmegaZ, :CameraEyeOffsetX, :CameraEyeOffsetY, :CameraEyeOffsetZ, :CameraAtOffsetX, :CameraAtOffsetY, :CameraAtOffsetZ,
|
||||||
:ForceMouselook, :ScriptAccessPin, :AllowedDrop, :DieAtEdge, :SalePrice, :SaleType, :ColorR, :ColorG, :ColorB, :ColorA,
|
:ForceMouselook, :ScriptAccessPin, :AllowedDrop, :DieAtEdge, :SalePrice, :SaleType, :ColorR, :ColorG, :ColorB, :ColorA,
|
||||||
:ParticleSystem, :ClickAction, :Material, :CollisionSound, :CollisionSoundVolume, :PassTouches, :LinkNumber, :MediaURL, :DynAttrs,
|
:ParticleSystem, :ClickAction, :Material, :CollisionSound, :CollisionSoundVolume, :PassTouches, :LinkNumber, :MediaURL, :DynAttrs,
|
||||||
:PhysicsShapeType, :Density, :GravityModifier, :Friction, :Restitution, :PassCollisions, :RotationAxisLocks, :RezzerID, :Vehicle, :PhysInertia,
|
:PhysicsShapeType, :Density, :GravityModifier, :Friction, :Restitution
|
||||||
:standtargetx, :standtargety, :standtargetz,:sitactrange, :pseudocrc
|
|
||||||
where not EXISTS (SELECT ""UUID"" FROM prims WHERE ""UUID"" = :UUID);
|
where not EXISTS (SELECT ""UUID"" FROM prims WHERE ""UUID"" = :UUID);
|
||||||
";
|
";
|
||||||
|
|
||||||
|
@ -559,12 +552,9 @@ namespace OpenSim.Data.PGSQL
|
||||||
if (reader.Read())
|
if (reader.Read())
|
||||||
{
|
{
|
||||||
rev = Convert.ToInt32(reader["Revision"]);
|
rev = Convert.ToInt32(reader["Revision"]);
|
||||||
if ((reader["Heightfield"] != DBNull.Value))
|
|
||||||
{
|
|
||||||
byte[] blob = (byte[])reader["Heightfield"];
|
byte[] blob = (byte[])reader["Heightfield"];
|
||||||
terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob);
|
terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_Log.Info("[REGION DB]: No terrain found for region");
|
_Log.Info("[REGION DB]: No terrain found for region");
|
||||||
|
@ -578,43 +568,10 @@ namespace OpenSim.Data.PGSQL
|
||||||
return terrData;
|
return terrData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TerrainData LoadBakedTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
|
|
||||||
{
|
|
||||||
TerrainData terrData = null;
|
|
||||||
|
|
||||||
string sql = @"select ""RegionUUID"", ""Revision"", ""Heightfield"" from bakedterrain
|
|
||||||
where ""RegionUUID"" = :RegionUUID; ";
|
|
||||||
|
|
||||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
|
||||||
{
|
|
||||||
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
|
||||||
{
|
|
||||||
// PGSqlParameter param = new PGSqlParameter();
|
|
||||||
cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", regionID));
|
|
||||||
conn.Open();
|
|
||||||
using (NpgsqlDataReader reader = cmd.ExecuteReader())
|
|
||||||
{
|
|
||||||
int rev;
|
|
||||||
if (reader.Read())
|
|
||||||
{
|
|
||||||
rev = Convert.ToInt32(reader["Revision"]);
|
|
||||||
if ((reader["Heightfield"] != DBNull.Value))
|
|
||||||
{
|
|
||||||
byte[] blob = (byte[])reader["Heightfield"];
|
|
||||||
terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return terrData;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Legacy entry point for when terrain was always a 256x256 heightmap
|
// Legacy entry point for when terrain was always a 256x256 heightmap
|
||||||
public void StoreTerrain(double[,] terrain, UUID regionID)
|
public void StoreTerrain(double[,] terrain, UUID regionID)
|
||||||
{
|
{
|
||||||
StoreTerrain(new TerrainData(terrain), regionID);
|
StoreTerrain(new HeightmapTerrainData(terrain), regionID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -661,49 +618,6 @@ namespace OpenSim.Data.PGSQL
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Stores the baked terrain map to DB.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="terrain">terrain map data.</param>
|
|
||||||
/// <param name="regionID">regionID.</param>
|
|
||||||
public void StoreBakedTerrain(TerrainData terrData, UUID regionID)
|
|
||||||
{
|
|
||||||
//Delete old terrain map
|
|
||||||
string sql = @"delete from bakedterrain where ""RegionUUID""=:RegionUUID";
|
|
||||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
|
||||||
{
|
|
||||||
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
|
||||||
{
|
|
||||||
cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", regionID));
|
|
||||||
conn.Open();
|
|
||||||
cmd.ExecuteNonQuery();
|
|
||||||
|
|
||||||
_Log.InfoFormat("{0} Deleted bakedterrain id = {1}", LogHeader, regionID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int terrainDBRevision;
|
|
||||||
Array terrainDBblob;
|
|
||||||
terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob);
|
|
||||||
|
|
||||||
sql = @"insert into bakedterrain(""RegionUUID"", ""Revision"", ""Heightfield"") values(:RegionUUID, :Revision, :Heightfield)";
|
|
||||||
|
|
||||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
|
||||||
{
|
|
||||||
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
|
||||||
{
|
|
||||||
cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", regionID));
|
|
||||||
cmd.Parameters.Add(_Database.CreateParameter("Revision", terrainDBRevision));
|
|
||||||
cmd.Parameters.Add(_Database.CreateParameter("Heightfield", terrainDBblob));
|
|
||||||
conn.Open();
|
|
||||||
cmd.ExecuteNonQuery();
|
|
||||||
|
|
||||||
_Log.InfoFormat("{0} Stored bakedterrain id = {1}, terrainSize = <{2},{3}>",
|
|
||||||
LogHeader, regionID, terrData.SizeX, terrData.SizeY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads all the land objects of a region.
|
/// Loads all the land objects of a region.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -769,15 +683,11 @@ namespace OpenSim.Data.PGSQL
|
||||||
string sql = @"INSERT INTO land
|
string sql = @"INSERT INTO land
|
||||||
(""UUID"",""RegionUUID"",""LocalLandID"",""Bitmap"",""Name"",""Description"",""OwnerUUID"",""IsGroupOwned"",""Area"",""AuctionID"",""Category"",""ClaimDate"",""ClaimPrice"",
|
(""UUID"",""RegionUUID"",""LocalLandID"",""Bitmap"",""Name"",""Description"",""OwnerUUID"",""IsGroupOwned"",""Area"",""AuctionID"",""Category"",""ClaimDate"",""ClaimPrice"",
|
||||||
""GroupUUID"",""SalePrice"",""LandStatus"",""LandFlags"",""LandingType"",""MediaAutoScale"",""MediaTextureUUID"",""MediaURL"",""MusicURL"",""PassHours"",""PassPrice"",
|
""GroupUUID"",""SalePrice"",""LandStatus"",""LandFlags"",""LandingType"",""MediaAutoScale"",""MediaTextureUUID"",""MediaURL"",""MusicURL"",""PassHours"",""PassPrice"",
|
||||||
""SnapshotUUID"",""UserLocationX"",""UserLocationY"",""UserLocationZ"",""UserLookAtX"",""UserLookAtY"",""UserLookAtZ"",""AuthbuyerID"",""OtherCleanTime"",""Dwell"",
|
""SnapshotUUID"",""UserLocationX"",""UserLocationY"",""UserLocationZ"",""UserLookAtX"",""UserLookAtY"",""UserLookAtZ"",""AuthbuyerID"",""OtherCleanTime"")
|
||||||
""MediaType"",""MediaDescription"",""MediaSize"",""MediaLoop"",""ObscureMusic"",""ObscureMedia"",""SeeAVs"",""AnyAVSounds"",""GroupAVSounds"",
|
|
||||||
""environment"")
|
|
||||||
VALUES
|
VALUES
|
||||||
(:UUID,:RegionUUID,:LocalLandID,:Bitmap,:Name,:Description,:OwnerUUID,:IsGroupOwned,:Area,:AuctionID,:Category,:ClaimDate,:ClaimPrice,
|
(:UUID,:RegionUUID,:LocalLandID,:Bitmap,:Name,:Description,:OwnerUUID,:IsGroupOwned,:Area,:AuctionID,:Category,:ClaimDate,:ClaimPrice,
|
||||||
:GroupUUID,:SalePrice,:LandStatus,:LandFlags,:LandingType,:MediaAutoScale,:MediaTextureUUID,:MediaURL,:MusicURL,:PassHours,:PassPrice,
|
:GroupUUID,:SalePrice,:LandStatus,:LandFlags,:LandingType,:MediaAutoScale,:MediaTextureUUID,:MediaURL,:MusicURL,:PassHours,:PassPrice,
|
||||||
:SnapshotUUID,:UserLocationX,:UserLocationY,:UserLocationZ,:UserLookAtX,:UserLookAtY,:UserLookAtZ,:AuthbuyerID,:OtherCleanTime,:Dwell,
|
:SnapshotUUID,:UserLocationX,:UserLocationY,:UserLocationZ,:UserLookAtX,:UserLookAtY,:UserLookAtZ,:AuthbuyerID,:OtherCleanTime)";
|
||||||
:MediaType,:MediaDescription,:MediaWidth::text || ',' || :MediaHeight::text,:MediaLoop,:ObscureMusic,:ObscureMedia,:SeeAVs::int::smallint,
|
|
||||||
:AnyAVSounds::int::smallint,:GroupAVSounds::int::smallint,:environment)";
|
|
||||||
|
|
||||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
||||||
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
||||||
|
@ -826,6 +736,477 @@ namespace OpenSim.Data.PGSQL
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
|
||||||
|
{
|
||||||
|
RegionLightShareData nWP = new RegionLightShareData();
|
||||||
|
nWP.OnSave += StoreRegionWindlightSettings;
|
||||||
|
|
||||||
|
string sql = @"select * from regionwindlight where ""region_id"" = :regionID";
|
||||||
|
|
||||||
|
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
||||||
|
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
||||||
|
{
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("regionID", regionUUID.ToString() ));
|
||||||
|
conn.Open();
|
||||||
|
using (NpgsqlDataReader result = cmd.ExecuteReader())
|
||||||
|
{
|
||||||
|
if (!result.Read())
|
||||||
|
{
|
||||||
|
//No result, so store our default windlight profile and return it
|
||||||
|
nWP.regionID = regionUUID;
|
||||||
|
StoreRegionWindlightSettings(nWP);
|
||||||
|
return nWP;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nWP.regionID = DBGuid.FromDB(result["region_id"]);
|
||||||
|
nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]);
|
||||||
|
nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]);
|
||||||
|
nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]);
|
||||||
|
nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]);
|
||||||
|
nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]);
|
||||||
|
nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]);
|
||||||
|
nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]);
|
||||||
|
nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]);
|
||||||
|
nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]);
|
||||||
|
nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]);
|
||||||
|
nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]);
|
||||||
|
nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]);
|
||||||
|
nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]);
|
||||||
|
nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]);
|
||||||
|
nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]);
|
||||||
|
nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]);
|
||||||
|
nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]);
|
||||||
|
UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture);
|
||||||
|
nWP.horizon.X = Convert.ToSingle(result["horizon_r"]);
|
||||||
|
nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]);
|
||||||
|
nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]);
|
||||||
|
nWP.horizon.W = Convert.ToSingle(result["horizon_i"]);
|
||||||
|
nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]);
|
||||||
|
nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]);
|
||||||
|
nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]);
|
||||||
|
nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]);
|
||||||
|
nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]);
|
||||||
|
nWP.hazeDensity = Convert.ToSingle(result["haze_density"]);
|
||||||
|
nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]);
|
||||||
|
nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]);
|
||||||
|
nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]);
|
||||||
|
nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]);
|
||||||
|
nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]);
|
||||||
|
nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]);
|
||||||
|
nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]);
|
||||||
|
nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]);
|
||||||
|
nWP.ambient.X = Convert.ToSingle(result["ambient_r"]);
|
||||||
|
nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]);
|
||||||
|
nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]);
|
||||||
|
nWP.ambient.W = Convert.ToSingle(result["ambient_i"]);
|
||||||
|
nWP.eastAngle = Convert.ToSingle(result["east_angle"]);
|
||||||
|
nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]);
|
||||||
|
nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]);
|
||||||
|
nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]);
|
||||||
|
nWP.starBrightness = Convert.ToSingle(result["star_brightness"]);
|
||||||
|
nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]);
|
||||||
|
nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]);
|
||||||
|
nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]);
|
||||||
|
nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]);
|
||||||
|
nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]);
|
||||||
|
nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]);
|
||||||
|
nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]);
|
||||||
|
nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]);
|
||||||
|
nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]);
|
||||||
|
nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]);
|
||||||
|
nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]);
|
||||||
|
nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]);
|
||||||
|
nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]);
|
||||||
|
nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]);
|
||||||
|
nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]);
|
||||||
|
nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]);
|
||||||
|
nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]);
|
||||||
|
nWP.valid = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nWP;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveRegionWindlightSettings(UUID regionID)
|
||||||
|
{
|
||||||
|
string sql = @"delete from regionwindlight where ""region_id"" = :region_id";
|
||||||
|
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
||||||
|
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
||||||
|
{
|
||||||
|
conn.Open();
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("region_id", regionID.ToString()));
|
||||||
|
cmd.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StoreRegionWindlightSettings(RegionLightShareData wl)
|
||||||
|
{
|
||||||
|
string sql = @"select region_id from regionwindlight where ""region_id"" = :region_id limit 1;";
|
||||||
|
bool exists = false;
|
||||||
|
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
||||||
|
{
|
||||||
|
conn.Open();
|
||||||
|
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
||||||
|
{
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("region_id", wl.regionID.ToString() ));
|
||||||
|
NpgsqlDataReader dr = cmd.ExecuteReader();
|
||||||
|
exists = dr.Read();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (exists)
|
||||||
|
{
|
||||||
|
RemoveRegionWindlightSettings(wl.regionID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// sql insert
|
||||||
|
sql = @"INSERT INTO regionwindlight
|
||||||
|
(region_id
|
||||||
|
,water_color_r
|
||||||
|
,water_color_g
|
||||||
|
,water_color_b
|
||||||
|
,water_fog_density_exponent
|
||||||
|
,underwater_fog_modifier
|
||||||
|
,reflection_wavelet_scale_1
|
||||||
|
,reflection_wavelet_scale_2
|
||||||
|
,reflection_wavelet_scale_3
|
||||||
|
,fresnel_scale
|
||||||
|
,fresnel_offset
|
||||||
|
,refract_scale_above
|
||||||
|
,refract_scale_below
|
||||||
|
,blur_multiplier
|
||||||
|
,big_wave_direction_x
|
||||||
|
,big_wave_direction_y
|
||||||
|
,little_wave_direction_x
|
||||||
|
,little_wave_direction_y
|
||||||
|
,normal_map_texture
|
||||||
|
,horizon_r
|
||||||
|
,horizon_g
|
||||||
|
,horizon_b
|
||||||
|
,horizon_i
|
||||||
|
,haze_horizon
|
||||||
|
,blue_density_r
|
||||||
|
,blue_density_g
|
||||||
|
,blue_density_b
|
||||||
|
,blue_density_i
|
||||||
|
,haze_density
|
||||||
|
,density_multiplier
|
||||||
|
,distance_multiplier
|
||||||
|
,max_altitude
|
||||||
|
,sun_moon_color_r
|
||||||
|
,sun_moon_color_g
|
||||||
|
,sun_moon_color_b
|
||||||
|
,sun_moon_color_i
|
||||||
|
,sun_moon_position
|
||||||
|
,ambient_r
|
||||||
|
,ambient_g
|
||||||
|
,ambient_b
|
||||||
|
,ambient_i
|
||||||
|
,east_angle
|
||||||
|
,sun_glow_focus
|
||||||
|
,sun_glow_size
|
||||||
|
,scene_gamma
|
||||||
|
,star_brightness
|
||||||
|
,cloud_color_r
|
||||||
|
,cloud_color_g
|
||||||
|
,cloud_color_b
|
||||||
|
,cloud_color_i
|
||||||
|
,cloud_x
|
||||||
|
,cloud_y
|
||||||
|
,cloud_density
|
||||||
|
,cloud_coverage
|
||||||
|
,cloud_scale
|
||||||
|
,cloud_detail_x
|
||||||
|
,cloud_detail_y
|
||||||
|
,cloud_detail_density
|
||||||
|
,cloud_scroll_x
|
||||||
|
,cloud_scroll_x_lock
|
||||||
|
,cloud_scroll_y
|
||||||
|
,cloud_scroll_y_lock
|
||||||
|
,draw_classic_clouds)
|
||||||
|
VALUES
|
||||||
|
(:region_id
|
||||||
|
,:water_color_r
|
||||||
|
,:water_color_g
|
||||||
|
,:water_color_b
|
||||||
|
,:water_fog_density_exponent
|
||||||
|
,:underwater_fog_modifier
|
||||||
|
,:reflection_wavelet_scale_1
|
||||||
|
,:reflection_wavelet_scale_2
|
||||||
|
,:reflection_wavelet_scale_3
|
||||||
|
,:fresnel_scale
|
||||||
|
,:fresnel_offset
|
||||||
|
,:refract_scale_above
|
||||||
|
,:refract_scale_below
|
||||||
|
,:blur_multiplier
|
||||||
|
,:big_wave_direction_x
|
||||||
|
,:big_wave_direction_y
|
||||||
|
,:little_wave_direction_x
|
||||||
|
,:little_wave_direction_y
|
||||||
|
,:normal_map_texture
|
||||||
|
,:horizon_r
|
||||||
|
,:horizon_g
|
||||||
|
,:horizon_b
|
||||||
|
,:horizon_i
|
||||||
|
,:haze_horizon
|
||||||
|
,:blue_density_r
|
||||||
|
,:blue_density_g
|
||||||
|
,:blue_density_b
|
||||||
|
,:blue_density_i
|
||||||
|
,:haze_density
|
||||||
|
,:density_multiplier
|
||||||
|
,:distance_multiplier
|
||||||
|
,:max_altitude
|
||||||
|
,:sun_moon_color_r
|
||||||
|
,:sun_moon_color_g
|
||||||
|
,:sun_moon_color_b
|
||||||
|
,:sun_moon_color_i
|
||||||
|
,:sun_moon_position
|
||||||
|
,:ambient_r
|
||||||
|
,:ambient_g
|
||||||
|
,:ambient_b
|
||||||
|
,:ambient_i
|
||||||
|
,:east_angle
|
||||||
|
,:sun_glow_focus
|
||||||
|
,:sun_glow_size
|
||||||
|
,:scene_gamma
|
||||||
|
,:star_brightness
|
||||||
|
,:cloud_color_r
|
||||||
|
,:cloud_color_g
|
||||||
|
,:cloud_color_b
|
||||||
|
,:cloud_color_i
|
||||||
|
,:cloud_x
|
||||||
|
,:cloud_y
|
||||||
|
,:cloud_density
|
||||||
|
,:cloud_coverage
|
||||||
|
,:cloud_scale
|
||||||
|
,:cloud_detail_x
|
||||||
|
,:cloud_detail_y
|
||||||
|
,:cloud_detail_density
|
||||||
|
,:cloud_scroll_x
|
||||||
|
,:cloud_scroll_x_lock
|
||||||
|
,:cloud_scroll_y
|
||||||
|
,:cloud_scroll_y_lock
|
||||||
|
,:draw_classic_clouds);";
|
||||||
|
|
||||||
|
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
||||||
|
{
|
||||||
|
conn.Open();
|
||||||
|
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
||||||
|
{
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("region_id", wl.regionID.ToString()));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("water_color_r", wl.waterColor.X));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("water_color_g", wl.waterColor.Y));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("water_color_b", wl.waterColor.Z));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("water_fog_density_exponent", wl.waterFogDensityExponent));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("underwater_fog_modifier", wl.underwaterFogModifier));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("fresnel_scale", wl.fresnelScale));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("fresnel_offset", wl.fresnelOffset));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("refract_scale_above", wl.refractScaleAbove));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("refract_scale_below", wl.refractScaleBelow));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("blur_multiplier", wl.blurMultiplier));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("big_wave_direction_x", wl.bigWaveDirection.X));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("big_wave_direction_y", wl.bigWaveDirection.Y));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("little_wave_direction_x", wl.littleWaveDirection.X));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("little_wave_direction_y", wl.littleWaveDirection.Y));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("normal_map_texture", wl.normalMapTexture.ToString()));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("horizon_r", wl.horizon.X));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("horizon_g", wl.horizon.Y));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("horizon_b", wl.horizon.Z));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("horizon_i", wl.horizon.W));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("haze_horizon", wl.hazeHorizon));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("blue_density_r", wl.blueDensity.X));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("blue_density_g", wl.blueDensity.Y));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("blue_density_b", wl.blueDensity.Z));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("blue_density_i", wl.blueDensity.W));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("haze_density", wl.hazeDensity));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("density_multiplier", wl.densityMultiplier));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("distance_multiplier", wl.distanceMultiplier));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("max_altitude", wl.maxAltitude));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_r", wl.sunMoonColor.X));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_g", wl.sunMoonColor.Y));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_b", wl.sunMoonColor.Z));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_i", wl.sunMoonColor.W));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("sun_moon_position", wl.sunMoonPosition));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("ambient_r", wl.ambient.X));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("ambient_g", wl.ambient.Y));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("ambient_b", wl.ambient.Z));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("ambient_i", wl.ambient.W));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("east_angle", wl.eastAngle));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("sun_glow_focus", wl.sunGlowFocus));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("sun_glow_size", wl.sunGlowSize));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("scene_gamma", wl.sceneGamma));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("star_brightness", wl.starBrightness));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("cloud_color_r", wl.cloudColor.X));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("cloud_color_g", wl.cloudColor.Y));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("cloud_color_b", wl.cloudColor.Z));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("cloud_color_i", wl.cloudColor.W));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("cloud_x", wl.cloudXYDensity.X));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("cloud_y", wl.cloudXYDensity.Y));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("cloud_density", wl.cloudXYDensity.Z));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("cloud_coverage", wl.cloudCoverage));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("cloud_scale", wl.cloudScale));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("cloud_detail_x", wl.cloudDetailXYDensity.X));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("cloud_detail_y", wl.cloudDetailXYDensity.Y));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("cloud_detail_density", wl.cloudDetailXYDensity.Z));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_x", wl.cloudScrollX));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_x_lock", wl.cloudScrollXLock));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_y", wl.cloudScrollY));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_y_lock", wl.cloudScrollYLock));
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("draw_classic_clouds", wl.drawClassicClouds));
|
||||||
|
|
||||||
|
cmd.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#region update
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// // sql update
|
||||||
|
// sql = @"UPDATE [OpenSim].[dbo].[regionwindlight]
|
||||||
|
// SET [region_id] = @region_id
|
||||||
|
// ,[water_color_r] = @water_color_r
|
||||||
|
// ,[water_color_g] = @water_color_g
|
||||||
|
// ,[water_color_b] = @water_color_b
|
||||||
|
// ,[water_fog_density_exponent] = @water_fog_density_exponent
|
||||||
|
// ,[underwater_fog_modifier] = @underwater_fog_modifier
|
||||||
|
// ,[reflection_wavelet_scale_1] = @reflection_wavelet_scale_1
|
||||||
|
// ,[reflection_wavelet_scale_2] = @reflection_wavelet_scale_2
|
||||||
|
// ,[reflection_wavelet_scale_3] = @reflection_wavelet_scale_3
|
||||||
|
// ,[fresnel_scale] = @fresnel_scale
|
||||||
|
// ,[fresnel_offset] = @fresnel_offset
|
||||||
|
// ,[refract_scale_above] = @refract_scale_above
|
||||||
|
// ,[refract_scale_below] = @refract_scale_below
|
||||||
|
// ,[blur_multiplier] = @blur_multiplier
|
||||||
|
// ,[big_wave_direction_x] = @big_wave_direction_x
|
||||||
|
// ,[big_wave_direction_y] = @big_wave_direction_y
|
||||||
|
// ,[little_wave_direction_x] = @little_wave_direction_x
|
||||||
|
// ,[little_wave_direction_y] = @little_wave_direction_y
|
||||||
|
// ,[normal_map_texture] = @normal_map_texture
|
||||||
|
// ,[horizon_r] = @horizon_r
|
||||||
|
// ,[horizon_g] = @horizon_g
|
||||||
|
// ,[horizon_b] = @horizon_b
|
||||||
|
// ,[horizon_i] = @horizon_i
|
||||||
|
// ,[haze_horizon] = @haze_horizon
|
||||||
|
// ,[blue_density_r] = @blue_density_r
|
||||||
|
// ,[blue_density_g] = @blue_density_g
|
||||||
|
// ,[blue_density_b] = @blue_density_b
|
||||||
|
// ,[blue_density_i] = @blue_density_i
|
||||||
|
// ,[haze_density] = @haze_density
|
||||||
|
// ,[density_multiplier] = @density_multiplier
|
||||||
|
// ,[distance_multiplier] = @distance_multiplier
|
||||||
|
// ,[max_altitude] = @max_altitude
|
||||||
|
// ,[sun_moon_color_r] = @sun_moon_color_r
|
||||||
|
// ,[sun_moon_color_g] = @sun_moon_color_g
|
||||||
|
// ,[sun_moon_color_b] = @sun_moon_color_b
|
||||||
|
// ,[sun_moon_color_i] = @sun_moon_color_i
|
||||||
|
// ,[sun_moon_position] = @sun_moon_position
|
||||||
|
// ,[ambient_r] = @ambient_r
|
||||||
|
// ,[ambient_g] = @ambient_g
|
||||||
|
// ,[ambient_b] = @ambient_b
|
||||||
|
// ,[ambient_i] = @ambient_i
|
||||||
|
// ,[east_angle] = @east_angle
|
||||||
|
// ,[sun_glow_focus] = @sun_glow_focus
|
||||||
|
// ,[sun_glow_size] = @sun_glow_size
|
||||||
|
// ,[scene_gamma] = @scene_gamma
|
||||||
|
// ,[star_brightness] = @star_brightness
|
||||||
|
// ,[cloud_color_r] = @cloud_color_r
|
||||||
|
// ,[cloud_color_g] = @cloud_color_g
|
||||||
|
// ,[cloud_color_b] = @cloud_color_b
|
||||||
|
// ,[cloud_color_i] = @cloud_color_i
|
||||||
|
// ,[cloud_x] = @cloud_x
|
||||||
|
// ,[cloud_y] = @cloud_y
|
||||||
|
// ,[cloud_density] = @cloud_density
|
||||||
|
// ,[cloud_coverage] = @cloud_coverage
|
||||||
|
// ,[cloud_scale] = @cloud_scale
|
||||||
|
// ,[cloud_detail_x] = @cloud_detail_x
|
||||||
|
// ,[cloud_detail_y] = @cloud_detail_y
|
||||||
|
// ,[cloud_detail_density] = @cloud_detail_density
|
||||||
|
// ,[cloud_scroll_x] = @cloud_scroll_x
|
||||||
|
// ,[cloud_scroll_x_lock] = @cloud_scroll_x_lock
|
||||||
|
// ,[cloud_scroll_y] = @cloud_scroll_y
|
||||||
|
// ,[cloud_scroll_y_lock] = @cloud_scroll_y_lock
|
||||||
|
// ,[draw_classic_clouds] = @draw_classic_clouds
|
||||||
|
// WHERE region_id = @region_id";
|
||||||
|
// using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||||
|
// {
|
||||||
|
// conn.Open();
|
||||||
|
// using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||||
|
// {
|
||||||
|
// cmd.Parameters.AddWithValue("region_id", wl.regionID);
|
||||||
|
// cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X);
|
||||||
|
// cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y);
|
||||||
|
// cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z);
|
||||||
|
// cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent);
|
||||||
|
// cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier);
|
||||||
|
// cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X);
|
||||||
|
// cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y);
|
||||||
|
// cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z);
|
||||||
|
// cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale);
|
||||||
|
// cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset);
|
||||||
|
// cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove);
|
||||||
|
// cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow);
|
||||||
|
// cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier);
|
||||||
|
// cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X);
|
||||||
|
// cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y);
|
||||||
|
// cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X);
|
||||||
|
// cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y);
|
||||||
|
// cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture);
|
||||||
|
// cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X);
|
||||||
|
// cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y);
|
||||||
|
// cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z);
|
||||||
|
// cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W);
|
||||||
|
// cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon);
|
||||||
|
// cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X);
|
||||||
|
// cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y);
|
||||||
|
// cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z);
|
||||||
|
// cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W);
|
||||||
|
// cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity);
|
||||||
|
// cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier);
|
||||||
|
// cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier);
|
||||||
|
// cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude);
|
||||||
|
// cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X);
|
||||||
|
// cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y);
|
||||||
|
// cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z);
|
||||||
|
// cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W);
|
||||||
|
// cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition);
|
||||||
|
// cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X);
|
||||||
|
// cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y);
|
||||||
|
// cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z);
|
||||||
|
// cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W);
|
||||||
|
// cmd.Parameters.AddWithValue("east_angle", wl.eastAngle);
|
||||||
|
// cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus);
|
||||||
|
// cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize);
|
||||||
|
// cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma);
|
||||||
|
// cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness);
|
||||||
|
// cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X);
|
||||||
|
// cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y);
|
||||||
|
// cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z);
|
||||||
|
// cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W);
|
||||||
|
// cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X);
|
||||||
|
// cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y);
|
||||||
|
// cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z);
|
||||||
|
// cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage);
|
||||||
|
// cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale);
|
||||||
|
// cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X);
|
||||||
|
// cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y);
|
||||||
|
// cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z);
|
||||||
|
// cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX);
|
||||||
|
// cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock);
|
||||||
|
// cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY);
|
||||||
|
// cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock);
|
||||||
|
// cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds);
|
||||||
|
|
||||||
|
// cmd.ExecuteNonQuery();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
#region Environment Settings
|
#region Environment Settings
|
||||||
public string LoadRegionEnvironmentSettings(UUID regionUUID)
|
public string LoadRegionEnvironmentSettings(UUID regionUUID)
|
||||||
|
@ -966,7 +1347,7 @@ namespace OpenSim.Data.PGSQL
|
||||||
,terrain_lower_limit = :terrain_lower_limit ,use_estate_sun = :use_estate_sun ,fixed_sun = :fixed_sun ,sun_position = :sun_position
|
,terrain_lower_limit = :terrain_lower_limit ,use_estate_sun = :use_estate_sun ,fixed_sun = :fixed_sun ,sun_position = :sun_position
|
||||||
,covenant = :covenant ,covenant_datetime = :covenant_datetime, sunvectorx = :sunvectorx, sunvectory = :sunvectory, sunvectorz = :sunvectorz,
|
,covenant = :covenant ,covenant_datetime = :covenant_datetime, sunvectorx = :sunvectorx, sunvectory = :sunvectory, sunvectorz = :sunvectorz,
|
||||||
""Sandbox"" = :Sandbox, loaded_creation_datetime = :loaded_creation_datetime, loaded_creation_id = :loaded_creation_id, ""map_tile_ID"" = :TerrainImageID,
|
""Sandbox"" = :Sandbox, loaded_creation_datetime = :loaded_creation_datetime, loaded_creation_id = :loaded_creation_id, ""map_tile_ID"" = :TerrainImageID,
|
||||||
""TelehubObject"" = :telehubobject, ""parcel_tile_ID"" = :ParcelImageID, ""cacheID"" = :cacheID
|
""TelehubObject"" = :telehubobject, ""parcel_tile_ID"" = :ParcelImageID
|
||||||
WHERE ""regionUUID"" = :regionUUID";
|
WHERE ""regionUUID"" = :regionUUID";
|
||||||
|
|
||||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
||||||
|
@ -1081,8 +1462,6 @@ namespace OpenSim.Data.PGSQL
|
||||||
newSettings.ParcelImageID = new UUID((Guid)row["parcel_tile_ID"]);
|
newSettings.ParcelImageID = new UUID((Guid)row["parcel_tile_ID"]);
|
||||||
newSettings.TelehubObject = new UUID((Guid)row["TelehubObject"]);
|
newSettings.TelehubObject = new UUID((Guid)row["TelehubObject"]);
|
||||||
|
|
||||||
if (!(row["cacheID"] is DBNull))
|
|
||||||
newSettings.CacheID = new UUID((Guid)row["cacheID"]);
|
|
||||||
return newSettings;
|
return newSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1136,7 +1515,6 @@ namespace OpenSim.Data.PGSQL
|
||||||
newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]);
|
newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]);
|
||||||
|
|
||||||
newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
|
newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
|
||||||
newData.Dwell = Convert.ToSingle(row["Dwell"]);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1163,39 +1541,6 @@ namespace OpenSim.Data.PGSQL
|
||||||
newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
|
newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
|
||||||
newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
|
newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
|
||||||
|
|
||||||
newData.SeeAVs = Convert.ToBoolean(row["SeeAVs"]);
|
|
||||||
newData.AnyAVSounds = Convert.ToBoolean(row["AnyAVSounds"]);
|
|
||||||
newData.GroupAVSounds = Convert.ToBoolean(row["GroupAVSounds"]);
|
|
||||||
|
|
||||||
if (row["environment"] is DBNull)
|
|
||||||
{
|
|
||||||
newData.Environment = null;
|
|
||||||
newData.EnvironmentVersion = -1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string env = (string)row["environment"];
|
|
||||||
if (string.IsNullOrEmpty(env))
|
|
||||||
{
|
|
||||||
newData.Environment = null;
|
|
||||||
newData.EnvironmentVersion = -1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ViewerEnvironment VEnv = ViewerEnvironment.FromOSDString(env);
|
|
||||||
newData.Environment = VEnv;
|
|
||||||
newData.EnvironmentVersion = VEnv.version;
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
newData.Environment = null;
|
|
||||||
newData.EnvironmentVersion = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return newData;
|
return newData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1243,12 +1588,6 @@ namespace OpenSim.Data.PGSQL
|
||||||
prim.OwnerID = new UUID((Guid)primRow["OwnerID"]);
|
prim.OwnerID = new UUID((Guid)primRow["OwnerID"]);
|
||||||
prim.GroupID = new UUID((Guid)primRow["GroupID"]);
|
prim.GroupID = new UUID((Guid)primRow["GroupID"]);
|
||||||
prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]);
|
prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]);
|
||||||
|
|
||||||
if (primRow["RezzerID"] != DBNull.Value)
|
|
||||||
prim.RezzerID = new UUID((Guid)primRow["RezzerID"]);
|
|
||||||
else
|
|
||||||
prim.RezzerID = UUID.Zero;
|
|
||||||
|
|
||||||
prim.OwnerMask = Convert.ToUInt32(primRow["OwnerMask"]);
|
prim.OwnerMask = Convert.ToUInt32(primRow["OwnerMask"]);
|
||||||
prim.NextOwnerMask = Convert.ToUInt32(primRow["NextOwnerMask"]);
|
prim.NextOwnerMask = Convert.ToUInt32(primRow["NextOwnerMask"]);
|
||||||
prim.GroupMask = Convert.ToUInt32(primRow["GroupMask"]);
|
prim.GroupMask = Convert.ToUInt32(primRow["GroupMask"]);
|
||||||
|
@ -1292,20 +1631,12 @@ namespace OpenSim.Data.PGSQL
|
||||||
Convert.ToSingle(primRow["SitTargetOffsetY"]),
|
Convert.ToSingle(primRow["SitTargetOffsetY"]),
|
||||||
Convert.ToSingle(primRow["SitTargetOffsetZ"]));
|
Convert.ToSingle(primRow["SitTargetOffsetZ"]));
|
||||||
|
|
||||||
|
|
||||||
prim.SitTargetOrientationLL = new Quaternion(
|
prim.SitTargetOrientationLL = new Quaternion(
|
||||||
Convert.ToSingle(primRow["SitTargetOrientX"]),
|
Convert.ToSingle(primRow["SitTargetOrientX"]),
|
||||||
Convert.ToSingle(primRow["SitTargetOrientY"]),
|
Convert.ToSingle(primRow["SitTargetOrientY"]),
|
||||||
Convert.ToSingle(primRow["SitTargetOrientZ"]),
|
Convert.ToSingle(primRow["SitTargetOrientZ"]),
|
||||||
Convert.ToSingle(primRow["SitTargetOrientW"]));
|
Convert.ToSingle(primRow["SitTargetOrientW"]));
|
||||||
|
|
||||||
prim.StandOffset = new Vector3(
|
|
||||||
Convert.ToSingle(primRow["standtargetx"]),
|
|
||||||
Convert.ToSingle(primRow["standtargety"]),
|
|
||||||
Convert.ToSingle(primRow["standtargetz"]));
|
|
||||||
|
|
||||||
prim.SitActiveRange = Convert.ToSingle(primRow["sitactrange"]);
|
|
||||||
|
|
||||||
prim.PayPrice[0] = Convert.ToInt32(primRow["PayPrice"]);
|
prim.PayPrice[0] = Convert.ToInt32(primRow["PayPrice"]);
|
||||||
prim.PayPrice[1] = Convert.ToInt32(primRow["PayButton1"]);
|
prim.PayPrice[1] = Convert.ToInt32(primRow["PayButton1"]);
|
||||||
prim.PayPrice[2] = Convert.ToInt32(primRow["PayButton2"]);
|
prim.PayPrice[2] = Convert.ToInt32(primRow["PayButton2"]);
|
||||||
|
@ -1314,10 +1645,7 @@ namespace OpenSim.Data.PGSQL
|
||||||
|
|
||||||
prim.Sound = new UUID((Guid)primRow["LoopedSound"]);
|
prim.Sound = new UUID((Guid)primRow["LoopedSound"]);
|
||||||
prim.SoundGain = Convert.ToSingle(primRow["LoopedSoundGain"]);
|
prim.SoundGain = Convert.ToSingle(primRow["LoopedSoundGain"]);
|
||||||
if (prim.Sound != UUID.Zero)
|
|
||||||
prim.SoundFlags = 1; // If it's persisted at all, it's looped
|
prim.SoundFlags = 1; // If it's persisted at all, it's looped
|
||||||
else
|
|
||||||
prim.SoundFlags = 0;
|
|
||||||
|
|
||||||
if (!(primRow["TextureAnimation"] is DBNull))
|
if (!(primRow["TextureAnimation"] is DBNull))
|
||||||
prim.TextureAnimation = (Byte[])primRow["TextureAnimation"];
|
prim.TextureAnimation = (Byte[])primRow["TextureAnimation"];
|
||||||
|
@ -1364,7 +1692,6 @@ namespace OpenSim.Data.PGSQL
|
||||||
prim.CollisionSoundVolume = Convert.ToSingle(primRow["CollisionSoundVolume"]);
|
prim.CollisionSoundVolume = Convert.ToSingle(primRow["CollisionSoundVolume"]);
|
||||||
|
|
||||||
prim.PassTouches = (bool)primRow["PassTouches"];
|
prim.PassTouches = (bool)primRow["PassTouches"];
|
||||||
prim.PassCollisions = (bool)primRow["PassCollisions"];
|
|
||||||
|
|
||||||
if (!(primRow["MediaURL"] is System.DBNull))
|
if (!(primRow["MediaURL"] is System.DBNull))
|
||||||
prim.MediaUrl = (string)primRow["MediaURL"];
|
prim.MediaUrl = (string)primRow["MediaURL"];
|
||||||
|
@ -1372,31 +1699,13 @@ namespace OpenSim.Data.PGSQL
|
||||||
if (!(primRow["DynAttrs"] is System.DBNull) && (string)primRow["DynAttrs"] != "")
|
if (!(primRow["DynAttrs"] is System.DBNull) && (string)primRow["DynAttrs"] != "")
|
||||||
prim.DynAttrs = DAMap.FromXml((string)primRow["DynAttrs"]);
|
prim.DynAttrs = DAMap.FromXml((string)primRow["DynAttrs"]);
|
||||||
else
|
else
|
||||||
prim.DynAttrs = null;
|
prim.DynAttrs = new DAMap();
|
||||||
|
|
||||||
prim.PhysicsShapeType = Convert.ToByte(primRow["PhysicsShapeType"]);
|
prim.PhysicsShapeType = Convert.ToByte(primRow["PhysicsShapeType"]);
|
||||||
prim.Density = Convert.ToSingle(primRow["Density"]);
|
prim.Density = Convert.ToSingle(primRow["Density"]);
|
||||||
prim.GravityModifier = Convert.ToSingle(primRow["GravityModifier"]);
|
prim.GravityModifier = Convert.ToSingle(primRow["GravityModifier"]);
|
||||||
prim.Friction = Convert.ToSingle(primRow["Friction"]);
|
prim.Friction = Convert.ToSingle(primRow["Friction"]);
|
||||||
prim.Restitution = Convert.ToSingle(primRow["Restitution"]);
|
prim.Restitution = Convert.ToSingle(primRow["Restitution"]);
|
||||||
prim.RotationAxisLocks = Convert.ToByte(primRow["RotationAxisLocks"]);
|
|
||||||
|
|
||||||
SOPVehicle vehicle = null;
|
|
||||||
if (!(primRow["Vehicle"] is System.DBNull))
|
|
||||||
{
|
|
||||||
vehicle = SOPVehicle.FromXml2(primRow["Vehicle"].ToString());
|
|
||||||
if (vehicle != null)
|
|
||||||
prim.VehicleParams = vehicle;
|
|
||||||
}
|
|
||||||
|
|
||||||
PhysicsInertiaData pdata = null;
|
|
||||||
if (!(primRow["PhysInertia"] is System.DBNull))
|
|
||||||
pdata = PhysicsInertiaData.FromXml2(primRow["PhysInertia"].ToString());
|
|
||||||
prim.PhysicsInertia = pdata;
|
|
||||||
|
|
||||||
int pseudocrc = Convert.ToInt32(primRow["pseudocrc"]);
|
|
||||||
if(pseudocrc != 0)
|
|
||||||
prim.PseudoCRC = pseudocrc;
|
|
||||||
|
|
||||||
return prim;
|
return prim;
|
||||||
}
|
}
|
||||||
|
@ -1584,8 +1893,6 @@ namespace OpenSim.Data.PGSQL
|
||||||
parameters.Add(_Database.CreateParameter("ParcelImageID", settings.ParcelImageID));
|
parameters.Add(_Database.CreateParameter("ParcelImageID", settings.ParcelImageID));
|
||||||
parameters.Add(_Database.CreateParameter("TelehubObject", settings.TelehubObject));
|
parameters.Add(_Database.CreateParameter("TelehubObject", settings.TelehubObject));
|
||||||
|
|
||||||
parameters.Add(_Database.CreateParameter("cacheID", settings.CacheID));
|
|
||||||
|
|
||||||
return parameters.ToArray();
|
return parameters.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1635,31 +1942,6 @@ namespace OpenSim.Data.PGSQL
|
||||||
parameters.Add(_Database.CreateParameter("UserLookAtZ", land.UserLookAt.Z));
|
parameters.Add(_Database.CreateParameter("UserLookAtZ", land.UserLookAt.Z));
|
||||||
parameters.Add(_Database.CreateParameter("AuthBuyerID", land.AuthBuyerID));
|
parameters.Add(_Database.CreateParameter("AuthBuyerID", land.AuthBuyerID));
|
||||||
parameters.Add(_Database.CreateParameter("OtherCleanTime", land.OtherCleanTime));
|
parameters.Add(_Database.CreateParameter("OtherCleanTime", land.OtherCleanTime));
|
||||||
parameters.Add(_Database.CreateParameter("Dwell", land.Dwell));
|
|
||||||
parameters.Add(_Database.CreateParameter("MediaDescription", land.MediaDescription));
|
|
||||||
parameters.Add(_Database.CreateParameter("MediaType", land.MediaType));
|
|
||||||
parameters.Add(_Database.CreateParameter("MediaWidth", land.MediaWidth));
|
|
||||||
parameters.Add(_Database.CreateParameter("MediaHeight", land.MediaHeight));
|
|
||||||
parameters.Add(_Database.CreateParameter("MediaLoop", land.MediaLoop));
|
|
||||||
parameters.Add(_Database.CreateParameter("ObscureMusic", land.ObscureMusic));
|
|
||||||
parameters.Add(_Database.CreateParameter("ObscureMedia", land.ObscureMedia));
|
|
||||||
parameters.Add(_Database.CreateParameter("SeeAVs", land.SeeAVs));
|
|
||||||
parameters.Add(_Database.CreateParameter("AnyAVSounds", land.AnyAVSounds));
|
|
||||||
parameters.Add(_Database.CreateParameter("GroupAVSounds", land.GroupAVSounds));
|
|
||||||
|
|
||||||
if (land.Environment == null)
|
|
||||||
parameters.Add(_Database.CreateParameter("environment", ""));
|
|
||||||
else
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
parameters.Add(_Database.CreateParameter("environment", ViewerEnvironment.ToOSDString(land.Environment)));
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
parameters.Add(_Database.CreateParameter("environment", ""));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return parameters.ToArray();
|
return parameters.ToArray();
|
||||||
}
|
}
|
||||||
|
@ -1714,7 +1996,6 @@ namespace OpenSim.Data.PGSQL
|
||||||
parameters.Add(_Database.CreateParameter("OwnerID", prim.OwnerID));
|
parameters.Add(_Database.CreateParameter("OwnerID", prim.OwnerID));
|
||||||
parameters.Add(_Database.CreateParameter("GroupID", prim.GroupID));
|
parameters.Add(_Database.CreateParameter("GroupID", prim.GroupID));
|
||||||
parameters.Add(_Database.CreateParameter("LastOwnerID", prim.LastOwnerID));
|
parameters.Add(_Database.CreateParameter("LastOwnerID", prim.LastOwnerID));
|
||||||
parameters.Add(_Database.CreateParameter("RezzerID", prim.RezzerID));
|
|
||||||
parameters.Add(_Database.CreateParameter("OwnerMask", prim.OwnerMask));
|
parameters.Add(_Database.CreateParameter("OwnerMask", prim.OwnerMask));
|
||||||
parameters.Add(_Database.CreateParameter("NextOwnerMask", prim.NextOwnerMask));
|
parameters.Add(_Database.CreateParameter("NextOwnerMask", prim.NextOwnerMask));
|
||||||
parameters.Add(_Database.CreateParameter("GroupMask", prim.GroupMask));
|
parameters.Add(_Database.CreateParameter("GroupMask", prim.GroupMask));
|
||||||
|
@ -1754,13 +2035,6 @@ namespace OpenSim.Data.PGSQL
|
||||||
parameters.Add(_Database.CreateParameter("SitTargetOrientY", sitTargetOrient.Y));
|
parameters.Add(_Database.CreateParameter("SitTargetOrientY", sitTargetOrient.Y));
|
||||||
parameters.Add(_Database.CreateParameter("SitTargetOrientZ", sitTargetOrient.Z));
|
parameters.Add(_Database.CreateParameter("SitTargetOrientZ", sitTargetOrient.Z));
|
||||||
|
|
||||||
Vector3 standTargetPos = prim.StandOffset;
|
|
||||||
parameters.Add(_Database.CreateParameter("standtargetx", standTargetPos.X));
|
|
||||||
parameters.Add(_Database.CreateParameter("standtargety", standTargetPos.Y));
|
|
||||||
parameters.Add(_Database.CreateParameter("standtargetz", standTargetPos.Z));
|
|
||||||
|
|
||||||
parameters.Add(_Database.CreateParameter("sitactrange", prim.SitActiveRange));
|
|
||||||
|
|
||||||
parameters.Add(_Database.CreateParameter("PayPrice", prim.PayPrice[0]));
|
parameters.Add(_Database.CreateParameter("PayPrice", prim.PayPrice[0]));
|
||||||
parameters.Add(_Database.CreateParameter("PayButton1", prim.PayPrice[1]));
|
parameters.Add(_Database.CreateParameter("PayButton1", prim.PayPrice[1]));
|
||||||
parameters.Add(_Database.CreateParameter("PayButton2", prim.PayPrice[2]));
|
parameters.Add(_Database.CreateParameter("PayButton2", prim.PayPrice[2]));
|
||||||
|
@ -1821,33 +2095,12 @@ namespace OpenSim.Data.PGSQL
|
||||||
parameters.Add(_Database.CreateParameter("CollisionSound", prim.CollisionSound));
|
parameters.Add(_Database.CreateParameter("CollisionSound", prim.CollisionSound));
|
||||||
parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume));
|
parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume));
|
||||||
|
|
||||||
parameters.Add(_Database.CreateParameter("PassTouches", (bool)prim.PassTouches));
|
parameters.Add(_Database.CreateParameter("PassTouches", prim.PassTouches));
|
||||||
parameters.Add(_Database.CreateParameter("PassCollisions", (bool)prim.PassCollisions));
|
|
||||||
|
|
||||||
if (prim.PassTouches)
|
|
||||||
parameters.Add(_Database.CreateParameter("PassTouches", true));
|
|
||||||
else
|
|
||||||
parameters.Add(_Database.CreateParameter("PassTouches", false));
|
|
||||||
|
|
||||||
if (prim.PassCollisions)
|
|
||||||
parameters.Add(_Database.CreateParameter("PassCollisions", true));
|
|
||||||
else
|
|
||||||
parameters.Add(_Database.CreateParameter("PassCollisions", false));
|
|
||||||
|
|
||||||
parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum));
|
parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum));
|
||||||
parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl));
|
parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl));
|
||||||
|
|
||||||
if (prim.VehicleParams != null)
|
if (prim.DynAttrs.CountNamespaces > 0)
|
||||||
parameters.Add(_Database.CreateParameter("Vehicle", prim.VehicleParams.ToXml2()));
|
|
||||||
else
|
|
||||||
parameters.Add(_Database.CreateParameter("Vehicle", String.Empty));
|
|
||||||
|
|
||||||
if (prim.PhysicsInertia != null)
|
|
||||||
parameters.Add(_Database.CreateParameter("PhysInertia", prim.PhysicsInertia.ToXml2()));
|
|
||||||
else
|
|
||||||
parameters.Add(_Database.CreateParameter("PhysInertia", String.Empty));
|
|
||||||
|
|
||||||
if (prim.DynAttrs != null && prim.DynAttrs.CountNamespaces > 0)
|
|
||||||
parameters.Add(_Database.CreateParameter("DynAttrs", prim.DynAttrs.ToXml()));
|
parameters.Add(_Database.CreateParameter("DynAttrs", prim.DynAttrs.ToXml()));
|
||||||
else
|
else
|
||||||
parameters.Add(_Database.CreateParameter("DynAttrs", null));
|
parameters.Add(_Database.CreateParameter("DynAttrs", null));
|
||||||
|
@ -1857,15 +2110,12 @@ namespace OpenSim.Data.PGSQL
|
||||||
parameters.Add(_Database.CreateParameter("GravityModifier", (double)prim.GravityModifier));
|
parameters.Add(_Database.CreateParameter("GravityModifier", (double)prim.GravityModifier));
|
||||||
parameters.Add(_Database.CreateParameter("Friction", (double)prim.Friction));
|
parameters.Add(_Database.CreateParameter("Friction", (double)prim.Friction));
|
||||||
parameters.Add(_Database.CreateParameter("Restitution", (double)prim.Restitution));
|
parameters.Add(_Database.CreateParameter("Restitution", (double)prim.Restitution));
|
||||||
parameters.Add(_Database.CreateParameter("RotationAxisLocks", prim.RotationAxisLocks));
|
|
||||||
|
|
||||||
parameters.Add(_Database.CreateParameter("pseudocrc", prim.PseudoCRC));
|
|
||||||
|
|
||||||
return parameters.ToArray();
|
return parameters.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates the primshape parameters for storing in DB.
|
/// Creates the primshape parameters for stroing in DB.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="prim">Basic data of SceneObjectpart prim.</param>
|
/// <param name="prim">Basic data of SceneObjectpart prim.</param>
|
||||||
/// <param name="sceneGroupID">The scene group ID.</param>
|
/// <param name="sceneGroupID">The scene group ID.</param>
|
||||||
|
@ -1977,11 +2227,6 @@ namespace OpenSim.Data.PGSQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID[] GetObjectIDs(UUID regionID)
|
|
||||||
{
|
|
||||||
return new UUID[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SaveExtra(UUID regionID, string name, string value)
|
public void SaveExtra(UUID regionID, string name, string value)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -325,10 +325,5 @@ namespace OpenSim.Data.PGSQL
|
||||||
return DoQuery(cmd);
|
return DoQuery(cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserAccountData[] GetUsersWhere(UUID scopeID, string where)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue