diff options
author | Mike Mazur | 2009-02-24 23:40:08 +0000 |
---|---|---|
committer | Mike Mazur | 2009-02-24 23:40:08 +0000 |
commit | d81fb565c1f48b013d107651c3bf383bd59e4daa (patch) | |
tree | 78b90903c6ee6dbce33f28b352d64e3b82fe3768 /OpenSim | |
parent | Close-to-final tweaking with appearance. This time sending *everything*. Addr... (diff) | |
download | opensim-SC_OLD-d81fb565c1f48b013d107651c3bf383bd59e4daa.zip opensim-SC_OLD-d81fb565c1f48b013d107651c3bf383bd59e4daa.tar.gz opensim-SC_OLD-d81fb565c1f48b013d107651c3bf383bd59e4daa.tar.bz2 opensim-SC_OLD-d81fb565c1f48b013d107651c3bf383bd59e4daa.tar.xz |
Setting svn:eol-style=native on new files.
Diffstat (limited to 'OpenSim')
27 files changed, 6122 insertions, 6122 deletions
diff --git a/OpenSim/Grid/Framework/IGridMessagingMapper.cs b/OpenSim/Grid/Framework/IGridMessagingMapper.cs index b89f102..3a21431 100644 --- a/OpenSim/Grid/Framework/IGridMessagingMapper.cs +++ b/OpenSim/Grid/Framework/IGridMessagingMapper.cs | |||
@@ -1,40 +1,40 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using OpenSim.Framework.Servers; | 30 | using OpenSim.Framework.Servers; |
31 | 31 | ||
32 | namespace OpenSim.Grid.Framework | 32 | namespace OpenSim.Grid.Framework |
33 | { | 33 | { |
34 | public interface IGridMessagingMapper | 34 | public interface IGridMessagingMapper |
35 | { | 35 | { |
36 | List<MessageServerInfo> GetMessageServersList(); | 36 | List<MessageServerInfo> GetMessageServersList(); |
37 | void RegisterMessageServer(MessageServerInfo m); | 37 | void RegisterMessageServer(MessageServerInfo m); |
38 | void DeRegisterMessageServer(MessageServerInfo m); | 38 | void DeRegisterMessageServer(MessageServerInfo m); |
39 | } | 39 | } |
40 | } | 40 | } |
diff --git a/OpenSim/Grid/Framework/IMessageRegionService.cs b/OpenSim/Grid/Framework/IMessageRegionService.cs index 2fdb40e..8c1d15a 100644 --- a/OpenSim/Grid/Framework/IMessageRegionService.cs +++ b/OpenSim/Grid/Framework/IMessageRegionService.cs | |||
@@ -1,38 +1,38 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using OpenSim.Data; | 29 | using OpenSim.Data; |
30 | 30 | ||
31 | namespace OpenSim.Grid.Framework | 31 | namespace OpenSim.Grid.Framework |
32 | { | 32 | { |
33 | public interface IMessageRegionService | 33 | public interface IMessageRegionService |
34 | { | 34 | { |
35 | int ClearRegionCache(); | 35 | int ClearRegionCache(); |
36 | RegionProfileData GetRegionInfo(ulong regionhandle); | 36 | RegionProfileData GetRegionInfo(ulong regionhandle); |
37 | } | 37 | } |
38 | } | 38 | } |
diff --git a/OpenSim/Grid/Framework/IMessageUserServerService.cs b/OpenSim/Grid/Framework/IMessageUserServerService.cs index 614606b..9ebaf61 100644 --- a/OpenSim/Grid/Framework/IMessageUserServerService.cs +++ b/OpenSim/Grid/Framework/IMessageUserServerService.cs | |||
@@ -1,35 +1,35 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | namespace OpenSim.Grid.Framework | 29 | namespace OpenSim.Grid.Framework |
30 | { | 30 | { |
31 | public interface IMessageUserServerService | 31 | public interface IMessageUserServerService |
32 | { | 32 | { |
33 | bool SendToUserServer(System.Collections.Hashtable request, string method); | 33 | bool SendToUserServer(System.Collections.Hashtable request, string method); |
34 | } | 34 | } |
35 | } | 35 | } |
diff --git a/OpenSim/Grid/Framework/IUGAIMCore.cs b/OpenSim/Grid/Framework/IUGAIMCore.cs index a7df0d4..46fde8c 100644 --- a/OpenSim/Grid/Framework/IUGAIMCore.cs +++ b/OpenSim/Grid/Framework/IUGAIMCore.cs | |||
@@ -1,40 +1,40 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using OpenSim.Framework.Servers; | 29 | using OpenSim.Framework.Servers; |
30 | 30 | ||
31 | namespace OpenSim.Grid.Framework | 31 | namespace OpenSim.Grid.Framework |
32 | { | 32 | { |
33 | public interface IUGAIMCore | 33 | public interface IUGAIMCore |
34 | { | 34 | { |
35 | T Get<T>(); | 35 | T Get<T>(); |
36 | void RegisterInterface<T>(T iface); | 36 | void RegisterInterface<T>(T iface); |
37 | bool TryGet<T>(out T iface); | 37 | bool TryGet<T>(out T iface); |
38 | BaseHttpServer GetHttpServer(); | 38 | BaseHttpServer GetHttpServer(); |
39 | } | 39 | } |
40 | } | 40 | } |
diff --git a/OpenSim/Grid/Framework/XMPPHTTPService.cs b/OpenSim/Grid/Framework/XMPPHTTPService.cs index bb09c8a..e87c2be 100644 --- a/OpenSim/Grid/Framework/XMPPHTTPService.cs +++ b/OpenSim/Grid/Framework/XMPPHTTPService.cs | |||
@@ -1,110 +1,110 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using OpenSim.Framework.Servers; | 33 | using OpenSim.Framework.Servers; |
34 | 34 | ||
35 | namespace OpenSim.Grid.Framework | 35 | namespace OpenSim.Grid.Framework |
36 | { | 36 | { |
37 | public class XMPPHTTPStreamHandler : BaseStreamHandler | 37 | public class XMPPHTTPStreamHandler : BaseStreamHandler |
38 | { | 38 | { |
39 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 39 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
40 | 40 | ||
41 | 41 | ||
42 | /// <summary> | 42 | /// <summary> |
43 | /// Constructor. | 43 | /// Constructor. |
44 | /// </summary> | 44 | /// </summary> |
45 | /// <param name="assetManager"></param> | 45 | /// <param name="assetManager"></param> |
46 | /// <param name="assetProvider"></param> | 46 | /// <param name="assetProvider"></param> |
47 | public XMPPHTTPStreamHandler() | 47 | public XMPPHTTPStreamHandler() |
48 | : base("GET", "/presence") | 48 | : base("GET", "/presence") |
49 | { | 49 | { |
50 | m_log.Info("[REST]: In Get Request"); | 50 | m_log.Info("[REST]: In Get Request"); |
51 | 51 | ||
52 | } | 52 | } |
53 | 53 | ||
54 | public override byte[] Handle(string path, Stream request, | 54 | public override byte[] Handle(string path, Stream request, |
55 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 55 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
56 | { | 56 | { |
57 | string param = GetParam(path); | 57 | string param = GetParam(path); |
58 | byte[] result = new byte[] {}; | 58 | byte[] result = new byte[] {}; |
59 | try | 59 | try |
60 | { | 60 | { |
61 | string[] p = param.Split(new char[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries); | 61 | string[] p = param.Split(new char[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries); |
62 | 62 | ||
63 | if (p.Length > 0) | 63 | if (p.Length > 0) |
64 | { | 64 | { |
65 | UUID assetID = UUID.Zero; | 65 | UUID assetID = UUID.Zero; |
66 | 66 | ||
67 | if (!UUID.TryParse(p[0], out assetID)) | 67 | if (!UUID.TryParse(p[0], out assetID)) |
68 | { | 68 | { |
69 | m_log.InfoFormat( | 69 | m_log.InfoFormat( |
70 | "[REST]: GET:/presence ignoring request with malformed UUID {0}", p[0]); | 70 | "[REST]: GET:/presence ignoring request with malformed UUID {0}", p[0]); |
71 | return result; | 71 | return result; |
72 | } | 72 | } |
73 | 73 | ||
74 | } | 74 | } |
75 | } | 75 | } |
76 | catch (Exception e) | 76 | catch (Exception e) |
77 | { | 77 | { |
78 | m_log.Error(e.ToString()); | 78 | m_log.Error(e.ToString()); |
79 | } | 79 | } |
80 | return result; | 80 | return result; |
81 | } | 81 | } |
82 | } | 82 | } |
83 | 83 | ||
84 | public class PostXMPPStreamHandler : BaseStreamHandler | 84 | public class PostXMPPStreamHandler : BaseStreamHandler |
85 | { | 85 | { |
86 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 86 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
87 | 87 | ||
88 | public override byte[] Handle(string path, Stream request, | 88 | public override byte[] Handle(string path, Stream request, |
89 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 89 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
90 | { | 90 | { |
91 | string param = GetParam(path); | 91 | string param = GetParam(path); |
92 | 92 | ||
93 | UUID assetId; | 93 | UUID assetId; |
94 | if (param.Length > 0) | 94 | if (param.Length > 0) |
95 | UUID.TryParse(param, out assetId); | 95 | UUID.TryParse(param, out assetId); |
96 | // byte[] txBuffer = new byte[4096]; | 96 | // byte[] txBuffer = new byte[4096]; |
97 | 97 | ||
98 | // TODO: Read POST serialize XMPP stanzas | 98 | // TODO: Read POST serialize XMPP stanzas |
99 | 99 | ||
100 | return new byte[] {}; | 100 | return new byte[] {}; |
101 | } | 101 | } |
102 | 102 | ||
103 | public PostXMPPStreamHandler() | 103 | public PostXMPPStreamHandler() |
104 | : base("POST", "/presence") | 104 | : base("POST", "/presence") |
105 | { | 105 | { |
106 | 106 | ||
107 | } | 107 | } |
108 | 108 | ||
109 | } | 109 | } |
110 | } | 110 | } |
diff --git a/OpenSim/Grid/GridServer.Modules/GridDBService.cs b/OpenSim/Grid/GridServer.Modules/GridDBService.cs index b728f1f..2274214 100644 --- a/OpenSim/Grid/GridServer.Modules/GridDBService.cs +++ b/OpenSim/Grid/GridServer.Modules/GridDBService.cs | |||
@@ -1,284 +1,284 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Xml; | 33 | using System.Xml; |
34 | using log4net; | 34 | using log4net; |
35 | using Nwc.XmlRpc; | 35 | using Nwc.XmlRpc; |
36 | using OpenMetaverse; | 36 | using OpenMetaverse; |
37 | using OpenSim.Data; | 37 | using OpenSim.Data; |
38 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
39 | using OpenSim.Framework.Communications; | 39 | using OpenSim.Framework.Communications; |
40 | using OpenSim.Framework.Servers; | 40 | using OpenSim.Framework.Servers; |
41 | 41 | ||
42 | 42 | ||
43 | namespace OpenSim.Grid.GridServer.Modules | 43 | namespace OpenSim.Grid.GridServer.Modules |
44 | { | 44 | { |
45 | public class GridDBService | 45 | public class GridDBService |
46 | { | 46 | { |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | private List<IGridDataPlugin> _plugins = new List<IGridDataPlugin>(); | 49 | private List<IGridDataPlugin> _plugins = new List<IGridDataPlugin>(); |
50 | private List<ILogDataPlugin> _logplugins = new List<ILogDataPlugin>(); | 50 | private List<ILogDataPlugin> _logplugins = new List<ILogDataPlugin>(); |
51 | 51 | ||
52 | /// <summary> | 52 | /// <summary> |
53 | /// Adds a list of grid and log data plugins, as described by | 53 | /// Adds a list of grid and log data plugins, as described by |
54 | /// `provider' and `connect', to `_plugins' and `_logplugins', | 54 | /// `provider' and `connect', to `_plugins' and `_logplugins', |
55 | /// respectively. | 55 | /// respectively. |
56 | /// </summary> | 56 | /// </summary> |
57 | /// <param name="provider"> | 57 | /// <param name="provider"> |
58 | /// The filename of the inventory server plugin DLL. | 58 | /// The filename of the inventory server plugin DLL. |
59 | /// </param> | 59 | /// </param> |
60 | /// <param name="connect"> | 60 | /// <param name="connect"> |
61 | /// The connection string for the storage backend. | 61 | /// The connection string for the storage backend. |
62 | /// </param> | 62 | /// </param> |
63 | public void AddPlugin(string provider, string connect) | 63 | public void AddPlugin(string provider, string connect) |
64 | { | 64 | { |
65 | _plugins = DataPluginFactory.LoadDataPlugins<IGridDataPlugin>(provider, connect); | 65 | _plugins = DataPluginFactory.LoadDataPlugins<IGridDataPlugin>(provider, connect); |
66 | _logplugins = DataPluginFactory.LoadDataPlugins<ILogDataPlugin>(provider, connect); | 66 | _logplugins = DataPluginFactory.LoadDataPlugins<ILogDataPlugin>(provider, connect); |
67 | } | 67 | } |
68 | 68 | ||
69 | public int GetNumberOfPlugins() | 69 | public int GetNumberOfPlugins() |
70 | { | 70 | { |
71 | return _plugins.Count; | 71 | return _plugins.Count; |
72 | } | 72 | } |
73 | 73 | ||
74 | /// <summary> | 74 | /// <summary> |
75 | /// Logs a piece of information to the database | 75 | /// Logs a piece of information to the database |
76 | /// </summary> | 76 | /// </summary> |
77 | /// <param name="target">What you were operating on (in grid server, this will likely be the region UUIDs)</param> | 77 | /// <param name="target">What you were operating on (in grid server, this will likely be the region UUIDs)</param> |
78 | /// <param name="method">Which method is being called?</param> | 78 | /// <param name="method">Which method is being called?</param> |
79 | /// <param name="args">What arguments are being passed?</param> | 79 | /// <param name="args">What arguments are being passed?</param> |
80 | /// <param name="priority">How high priority is this? 1 = Max, 6 = Verbose</param> | 80 | /// <param name="priority">How high priority is this? 1 = Max, 6 = Verbose</param> |
81 | /// <param name="message">The message to log</param> | 81 | /// <param name="message">The message to log</param> |
82 | private void logToDB(string target, string method, string args, int priority, string message) | 82 | private void logToDB(string target, string method, string args, int priority, string message) |
83 | { | 83 | { |
84 | foreach (ILogDataPlugin plugin in _logplugins) | 84 | foreach (ILogDataPlugin plugin in _logplugins) |
85 | { | 85 | { |
86 | try | 86 | try |
87 | { | 87 | { |
88 | plugin.saveLog("Gridserver", target, method, args, priority, message); | 88 | plugin.saveLog("Gridserver", target, method, args, priority, message); |
89 | } | 89 | } |
90 | catch (Exception) | 90 | catch (Exception) |
91 | { | 91 | { |
92 | m_log.Warn("[storage]: Unable to write log via " + plugin.Name); | 92 | m_log.Warn("[storage]: Unable to write log via " + plugin.Name); |
93 | } | 93 | } |
94 | } | 94 | } |
95 | } | 95 | } |
96 | 96 | ||
97 | /// <summary> | 97 | /// <summary> |
98 | /// Returns a region by argument | 98 | /// Returns a region by argument |
99 | /// </summary> | 99 | /// </summary> |
100 | /// <param name="uuid">A UUID key of the region to return</param> | 100 | /// <param name="uuid">A UUID key of the region to return</param> |
101 | /// <returns>A SimProfileData for the region</returns> | 101 | /// <returns>A SimProfileData for the region</returns> |
102 | public RegionProfileData GetRegion(UUID uuid) | 102 | public RegionProfileData GetRegion(UUID uuid) |
103 | { | 103 | { |
104 | foreach (IGridDataPlugin plugin in _plugins) | 104 | foreach (IGridDataPlugin plugin in _plugins) |
105 | { | 105 | { |
106 | try | 106 | try |
107 | { | 107 | { |
108 | return plugin.GetProfileByUUID(uuid); | 108 | return plugin.GetProfileByUUID(uuid); |
109 | } | 109 | } |
110 | catch (Exception e) | 110 | catch (Exception e) |
111 | { | 111 | { |
112 | m_log.Warn("[storage]: GetRegion - " + e.Message); | 112 | m_log.Warn("[storage]: GetRegion - " + e.Message); |
113 | } | 113 | } |
114 | } | 114 | } |
115 | return null; | 115 | return null; |
116 | } | 116 | } |
117 | 117 | ||
118 | /// <summary> | 118 | /// <summary> |
119 | /// Returns a region by argument | 119 | /// Returns a region by argument |
120 | /// </summary> | 120 | /// </summary> |
121 | /// <param name="uuid">A regionHandle of the region to return</param> | 121 | /// <param name="uuid">A regionHandle of the region to return</param> |
122 | /// <returns>A SimProfileData for the region</returns> | 122 | /// <returns>A SimProfileData for the region</returns> |
123 | public RegionProfileData GetRegion(ulong handle) | 123 | public RegionProfileData GetRegion(ulong handle) |
124 | { | 124 | { |
125 | foreach (IGridDataPlugin plugin in _plugins) | 125 | foreach (IGridDataPlugin plugin in _plugins) |
126 | { | 126 | { |
127 | try | 127 | try |
128 | { | 128 | { |
129 | return plugin.GetProfileByHandle(handle); | 129 | return plugin.GetProfileByHandle(handle); |
130 | } | 130 | } |
131 | catch (Exception ex) | 131 | catch (Exception ex) |
132 | { | 132 | { |
133 | m_log.Debug("[storage]: " + ex.Message); | 133 | m_log.Debug("[storage]: " + ex.Message); |
134 | m_log.Warn("[storage]: Unable to find region " + handle.ToString() + " via " + plugin.Name); | 134 | m_log.Warn("[storage]: Unable to find region " + handle.ToString() + " via " + plugin.Name); |
135 | } | 135 | } |
136 | } | 136 | } |
137 | return null; | 137 | return null; |
138 | } | 138 | } |
139 | 139 | ||
140 | /// <summary> | 140 | /// <summary> |
141 | /// Returns a region by argument | 141 | /// Returns a region by argument |
142 | /// </summary> | 142 | /// </summary> |
143 | /// <param name="regionName">A partial regionName of the region to return</param> | 143 | /// <param name="regionName">A partial regionName of the region to return</param> |
144 | /// <returns>A SimProfileData for the region</returns> | 144 | /// <returns>A SimProfileData for the region</returns> |
145 | public RegionProfileData GetRegion(string regionName) | 145 | public RegionProfileData GetRegion(string regionName) |
146 | { | 146 | { |
147 | foreach (IGridDataPlugin plugin in _plugins) | 147 | foreach (IGridDataPlugin plugin in _plugins) |
148 | { | 148 | { |
149 | try | 149 | try |
150 | { | 150 | { |
151 | return plugin.GetProfileByString(regionName); | 151 | return plugin.GetProfileByString(regionName); |
152 | } | 152 | } |
153 | catch | 153 | catch |
154 | { | 154 | { |
155 | m_log.Warn("[storage]: Unable to find region " + regionName + " via " + plugin.Name); | 155 | m_log.Warn("[storage]: Unable to find region " + regionName + " via " + plugin.Name); |
156 | } | 156 | } |
157 | } | 157 | } |
158 | return null; | 158 | return null; |
159 | } | 159 | } |
160 | 160 | ||
161 | public List<RegionProfileData> GetRegions(uint xmin, uint ymin, uint xmax, uint ymax) | 161 | public List<RegionProfileData> GetRegions(uint xmin, uint ymin, uint xmax, uint ymax) |
162 | { | 162 | { |
163 | List<RegionProfileData> regions = new List<RegionProfileData>(); | 163 | List<RegionProfileData> regions = new List<RegionProfileData>(); |
164 | 164 | ||
165 | foreach (IGridDataPlugin plugin in _plugins) | 165 | foreach (IGridDataPlugin plugin in _plugins) |
166 | { | 166 | { |
167 | try | 167 | try |
168 | { | 168 | { |
169 | regions.AddRange(plugin.GetProfilesInRange(xmin, ymin, xmax, ymax)); | 169 | regions.AddRange(plugin.GetProfilesInRange(xmin, ymin, xmax, ymax)); |
170 | } | 170 | } |
171 | catch | 171 | catch |
172 | { | 172 | { |
173 | m_log.Warn("[storage]: Unable to query regionblock via " + plugin.Name); | 173 | m_log.Warn("[storage]: Unable to query regionblock via " + plugin.Name); |
174 | } | 174 | } |
175 | } | 175 | } |
176 | 176 | ||
177 | return regions; | 177 | return regions; |
178 | } | 178 | } |
179 | 179 | ||
180 | public List<RegionProfileData> GetRegions(string name, int maxNum) | 180 | public List<RegionProfileData> GetRegions(string name, int maxNum) |
181 | { | 181 | { |
182 | List<RegionProfileData> regions = new List<RegionProfileData>(); | 182 | List<RegionProfileData> regions = new List<RegionProfileData>(); |
183 | foreach (IGridDataPlugin plugin in _plugins) | 183 | foreach (IGridDataPlugin plugin in _plugins) |
184 | { | 184 | { |
185 | try | 185 | try |
186 | { | 186 | { |
187 | int num = maxNum - regions.Count; | 187 | int num = maxNum - regions.Count; |
188 | List<RegionProfileData> profiles = plugin.GetRegionsByName(name, (uint)num); | 188 | List<RegionProfileData> profiles = plugin.GetRegionsByName(name, (uint)num); |
189 | if (profiles != null) regions.AddRange(profiles); | 189 | if (profiles != null) regions.AddRange(profiles); |
190 | } | 190 | } |
191 | catch | 191 | catch |
192 | { | 192 | { |
193 | m_log.Warn("[storage]: Unable to query regionblock via " + plugin.Name); | 193 | m_log.Warn("[storage]: Unable to query regionblock via " + plugin.Name); |
194 | } | 194 | } |
195 | } | 195 | } |
196 | 196 | ||
197 | return regions; | 197 | return regions; |
198 | } | 198 | } |
199 | 199 | ||
200 | public DataResponse AddUpdateRegion(RegionProfileData sim, RegionProfileData existingSim) | 200 | public DataResponse AddUpdateRegion(RegionProfileData sim, RegionProfileData existingSim) |
201 | { | 201 | { |
202 | DataResponse insertResponse = DataResponse.RESPONSE_ERROR; | 202 | DataResponse insertResponse = DataResponse.RESPONSE_ERROR; |
203 | foreach (IGridDataPlugin plugin in _plugins) | 203 | foreach (IGridDataPlugin plugin in _plugins) |
204 | { | 204 | { |
205 | try | 205 | try |
206 | { | 206 | { |
207 | if (existingSim == null) | 207 | if (existingSim == null) |
208 | { | 208 | { |
209 | insertResponse = plugin.AddProfile(sim); | 209 | insertResponse = plugin.AddProfile(sim); |
210 | } | 210 | } |
211 | else | 211 | else |
212 | { | 212 | { |
213 | insertResponse = plugin.UpdateProfile(sim); | 213 | insertResponse = plugin.UpdateProfile(sim); |
214 | } | 214 | } |
215 | } | 215 | } |
216 | catch (Exception e) | 216 | catch (Exception e) |
217 | { | 217 | { |
218 | m_log.Warn("[LOGIN END]: " + | 218 | m_log.Warn("[LOGIN END]: " + |
219 | "Unable to login region " + sim.ToString() + " via " + plugin.Name); | 219 | "Unable to login region " + sim.ToString() + " via " + plugin.Name); |
220 | m_log.Warn("[LOGIN END]: " + e.ToString()); | 220 | m_log.Warn("[LOGIN END]: " + e.ToString()); |
221 | } | 221 | } |
222 | } | 222 | } |
223 | return insertResponse; | 223 | return insertResponse; |
224 | } | 224 | } |
225 | 225 | ||
226 | public DataResponse DeleteRegion(string uuid) | 226 | public DataResponse DeleteRegion(string uuid) |
227 | { | 227 | { |
228 | DataResponse insertResponse = DataResponse.RESPONSE_ERROR; | 228 | DataResponse insertResponse = DataResponse.RESPONSE_ERROR; |
229 | foreach (IGridDataPlugin plugin in _plugins) | 229 | foreach (IGridDataPlugin plugin in _plugins) |
230 | { | 230 | { |
231 | //OpenSim.Data.MySQL.MySQLGridData dbengine = new OpenSim.Data.MySQL.MySQLGridData(); | 231 | //OpenSim.Data.MySQL.MySQLGridData dbengine = new OpenSim.Data.MySQL.MySQLGridData(); |
232 | try | 232 | try |
233 | { | 233 | { |
234 | //Nice are we not using multiple databases? | 234 | //Nice are we not using multiple databases? |
235 | //MySQLGridData mysqldata = (MySQLGridData)(plugin); | 235 | //MySQLGridData mysqldata = (MySQLGridData)(plugin); |
236 | 236 | ||
237 | //DataResponse insertResponse = mysqldata.DeleteProfile(TheSim); | 237 | //DataResponse insertResponse = mysqldata.DeleteProfile(TheSim); |
238 | insertResponse = plugin.DeleteProfile(uuid); | 238 | insertResponse = plugin.DeleteProfile(uuid); |
239 | } | 239 | } |
240 | catch (Exception) | 240 | catch (Exception) |
241 | { | 241 | { |
242 | m_log.Error("storage Unable to delete region " + uuid + " via " + plugin.Name); | 242 | m_log.Error("storage Unable to delete region " + uuid + " via " + plugin.Name); |
243 | //MainLog.Instance.Warn("storage", e.ToString()); | 243 | //MainLog.Instance.Warn("storage", e.ToString()); |
244 | insertResponse = DataResponse.RESPONSE_ERROR; | 244 | insertResponse = DataResponse.RESPONSE_ERROR; |
245 | } | 245 | } |
246 | } | 246 | } |
247 | return insertResponse; | 247 | return insertResponse; |
248 | } | 248 | } |
249 | 249 | ||
250 | public string CheckReservations(RegionProfileData theSim, XmlNode authkeynode) | 250 | public string CheckReservations(RegionProfileData theSim, XmlNode authkeynode) |
251 | { | 251 | { |
252 | foreach (IGridDataPlugin plugin in _plugins) | 252 | foreach (IGridDataPlugin plugin in _plugins) |
253 | { | 253 | { |
254 | try | 254 | try |
255 | { | 255 | { |
256 | //Check reservations | 256 | //Check reservations |
257 | ReservationData reserveData = | 257 | ReservationData reserveData = |
258 | plugin.GetReservationAtPoint(theSim.regionLocX, theSim.regionLocY); | 258 | plugin.GetReservationAtPoint(theSim.regionLocX, theSim.regionLocY); |
259 | if ((reserveData != null && reserveData.gridRecvKey == theSim.regionRecvKey) || | 259 | if ((reserveData != null && reserveData.gridRecvKey == theSim.regionRecvKey) || |
260 | (reserveData == null && authkeynode.InnerText != theSim.regionRecvKey)) | 260 | (reserveData == null && authkeynode.InnerText != theSim.regionRecvKey)) |
261 | { | 261 | { |
262 | plugin.AddProfile(theSim); | 262 | plugin.AddProfile(theSim); |
263 | m_log.Info("[grid]: New sim added to grid (" + theSim.regionName + ")"); | 263 | m_log.Info("[grid]: New sim added to grid (" + theSim.regionName + ")"); |
264 | logToDB(theSim.ToString(), "RestSetSimMethod", String.Empty, 5, | 264 | logToDB(theSim.ToString(), "RestSetSimMethod", String.Empty, 5, |
265 | "Region successfully updated and connected to grid."); | 265 | "Region successfully updated and connected to grid."); |
266 | } | 266 | } |
267 | else | 267 | else |
268 | { | 268 | { |
269 | m_log.Warn("[grid]: " + | 269 | m_log.Warn("[grid]: " + |
270 | "Unable to update region (RestSetSimMethod): Incorrect reservation auth key."); | 270 | "Unable to update region (RestSetSimMethod): Incorrect reservation auth key."); |
271 | // Wanted: " + reserveData.gridRecvKey + ", Got: " + theSim.regionRecvKey + "."); | 271 | // Wanted: " + reserveData.gridRecvKey + ", Got: " + theSim.regionRecvKey + "."); |
272 | return "Unable to update region (RestSetSimMethod): Incorrect auth key."; | 272 | return "Unable to update region (RestSetSimMethod): Incorrect auth key."; |
273 | } | 273 | } |
274 | } | 274 | } |
275 | catch (Exception e) | 275 | catch (Exception e) |
276 | { | 276 | { |
277 | m_log.Warn("[GRID]: GetRegionPlugin Handle " + plugin.Name + " unable to add new sim: " + | 277 | m_log.Warn("[GRID]: GetRegionPlugin Handle " + plugin.Name + " unable to add new sim: " + |
278 | e.ToString()); | 278 | e.ToString()); |
279 | } | 279 | } |
280 | } | 280 | } |
281 | return "OK"; | 281 | return "OK"; |
282 | } | 282 | } |
283 | } | 283 | } |
284 | } | 284 | } |
diff --git a/OpenSim/Grid/GridServer.Modules/GridMessagingModule.cs b/OpenSim/Grid/GridServer.Modules/GridMessagingModule.cs index 9c2b5ca..ee38310 100644 --- a/OpenSim/Grid/GridServer.Modules/GridMessagingModule.cs +++ b/OpenSim/Grid/GridServer.Modules/GridMessagingModule.cs | |||
@@ -1,161 +1,161 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Text; | 32 | using System.Text; |
33 | using Nwc.XmlRpc; | 33 | using Nwc.XmlRpc; |
34 | using log4net; | 34 | using log4net; |
35 | using OpenSim.Framework.Servers; | 35 | using OpenSim.Framework.Servers; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Grid.Framework; | 37 | using OpenSim.Grid.Framework; |
38 | 38 | ||
39 | namespace OpenSim.Grid.GridServer.Modules | 39 | namespace OpenSim.Grid.GridServer.Modules |
40 | { | 40 | { |
41 | public class GridMessagingModule : IGridMessagingMapper | 41 | public class GridMessagingModule : IGridMessagingMapper |
42 | { | 42 | { |
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
44 | 44 | ||
45 | protected GridDBService m_gridDBService; | 45 | protected GridDBService m_gridDBService; |
46 | protected IUGAIMCore m_gridCore; | 46 | protected IUGAIMCore m_gridCore; |
47 | 47 | ||
48 | protected GridConfig m_config; | 48 | protected GridConfig m_config; |
49 | 49 | ||
50 | /// <value> | 50 | /// <value> |
51 | /// Used to notify old regions as to which OpenSim version to upgrade to | 51 | /// Used to notify old regions as to which OpenSim version to upgrade to |
52 | /// </value> | 52 | /// </value> |
53 | private string m_opensimVersion; | 53 | private string m_opensimVersion; |
54 | 54 | ||
55 | protected BaseHttpServer m_httpServer; | 55 | protected BaseHttpServer m_httpServer; |
56 | 56 | ||
57 | // This is here so that the grid server can hand out MessageServer settings to regions on registration | 57 | // This is here so that the grid server can hand out MessageServer settings to regions on registration |
58 | private List<MessageServerInfo> m_messageServers = new List<MessageServerInfo>(); | 58 | private List<MessageServerInfo> m_messageServers = new List<MessageServerInfo>(); |
59 | 59 | ||
60 | public GridMessagingModule() | 60 | public GridMessagingModule() |
61 | { | 61 | { |
62 | } | 62 | } |
63 | 63 | ||
64 | public void Initialise(string opensimVersion, GridDBService gridDBService, IUGAIMCore gridCore, GridConfig config) | 64 | public void Initialise(string opensimVersion, GridDBService gridDBService, IUGAIMCore gridCore, GridConfig config) |
65 | { | 65 | { |
66 | m_opensimVersion = opensimVersion; | 66 | m_opensimVersion = opensimVersion; |
67 | m_gridDBService = gridDBService; | 67 | m_gridDBService = gridDBService; |
68 | m_gridCore = gridCore; | 68 | m_gridCore = gridCore; |
69 | m_config = config; | 69 | m_config = config; |
70 | 70 | ||
71 | m_gridCore.RegisterInterface<IGridMessagingMapper>(this); | 71 | m_gridCore.RegisterInterface<IGridMessagingMapper>(this); |
72 | 72 | ||
73 | RegisterHandlers(); | 73 | RegisterHandlers(); |
74 | } | 74 | } |
75 | 75 | ||
76 | public void PostInitialise() | 76 | public void PostInitialise() |
77 | { | 77 | { |
78 | 78 | ||
79 | } | 79 | } |
80 | 80 | ||
81 | public void RegisterHandlers() | 81 | public void RegisterHandlers() |
82 | { | 82 | { |
83 | //have these in separate method as some servers restart the http server and reregister all the handlers. | 83 | //have these in separate method as some servers restart the http server and reregister all the handlers. |
84 | m_httpServer = m_gridCore.GetHttpServer(); | 84 | m_httpServer = m_gridCore.GetHttpServer(); |
85 | 85 | ||
86 | // Message Server ---> Grid Server | 86 | // Message Server ---> Grid Server |
87 | m_httpServer.AddXmlRPCHandler("register_messageserver", XmlRPCRegisterMessageServer); | 87 | m_httpServer.AddXmlRPCHandler("register_messageserver", XmlRPCRegisterMessageServer); |
88 | m_httpServer.AddXmlRPCHandler("deregister_messageserver", XmlRPCDeRegisterMessageServer); | 88 | m_httpServer.AddXmlRPCHandler("deregister_messageserver", XmlRPCDeRegisterMessageServer); |
89 | } | 89 | } |
90 | 90 | ||
91 | public List<MessageServerInfo> GetMessageServersList() | 91 | public List<MessageServerInfo> GetMessageServersList() |
92 | { | 92 | { |
93 | lock (m_messageServers) | 93 | lock (m_messageServers) |
94 | { | 94 | { |
95 | return new List<MessageServerInfo>(m_messageServers); | 95 | return new List<MessageServerInfo>(m_messageServers); |
96 | } | 96 | } |
97 | } | 97 | } |
98 | 98 | ||
99 | public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request) | 99 | public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request) |
100 | { | 100 | { |
101 | XmlRpcResponse response = new XmlRpcResponse(); | 101 | XmlRpcResponse response = new XmlRpcResponse(); |
102 | Hashtable requestData = (Hashtable)request.Params[0]; | 102 | Hashtable requestData = (Hashtable)request.Params[0]; |
103 | Hashtable responseData = new Hashtable(); | 103 | Hashtable responseData = new Hashtable(); |
104 | 104 | ||
105 | if (requestData.Contains("uri")) | 105 | if (requestData.Contains("uri")) |
106 | { | 106 | { |
107 | string URI = (string)requestData["URI"]; | 107 | string URI = (string)requestData["URI"]; |
108 | string sendkey = (string)requestData["sendkey"]; | 108 | string sendkey = (string)requestData["sendkey"]; |
109 | string recvkey = (string)requestData["recvkey"]; | 109 | string recvkey = (string)requestData["recvkey"]; |
110 | MessageServerInfo m = new MessageServerInfo(); | 110 | MessageServerInfo m = new MessageServerInfo(); |
111 | m.URI = URI; | 111 | m.URI = URI; |
112 | m.sendkey = sendkey; | 112 | m.sendkey = sendkey; |
113 | m.recvkey = recvkey; | 113 | m.recvkey = recvkey; |
114 | RegisterMessageServer(m); | 114 | RegisterMessageServer(m); |
115 | responseData["responsestring"] = "TRUE"; | 115 | responseData["responsestring"] = "TRUE"; |
116 | response.Value = responseData; | 116 | response.Value = responseData; |
117 | } | 117 | } |
118 | return response; | 118 | return response; |
119 | } | 119 | } |
120 | 120 | ||
121 | public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request) | 121 | public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request) |
122 | { | 122 | { |
123 | XmlRpcResponse response = new XmlRpcResponse(); | 123 | XmlRpcResponse response = new XmlRpcResponse(); |
124 | Hashtable requestData = (Hashtable)request.Params[0]; | 124 | Hashtable requestData = (Hashtable)request.Params[0]; |
125 | Hashtable responseData = new Hashtable(); | 125 | Hashtable responseData = new Hashtable(); |
126 | 126 | ||
127 | if (requestData.Contains("uri")) | 127 | if (requestData.Contains("uri")) |
128 | { | 128 | { |
129 | string URI = (string)requestData["uri"]; | 129 | string URI = (string)requestData["uri"]; |
130 | string sendkey = (string)requestData["sendkey"]; | 130 | string sendkey = (string)requestData["sendkey"]; |
131 | string recvkey = (string)requestData["recvkey"]; | 131 | string recvkey = (string)requestData["recvkey"]; |
132 | MessageServerInfo m = new MessageServerInfo(); | 132 | MessageServerInfo m = new MessageServerInfo(); |
133 | m.URI = URI; | 133 | m.URI = URI; |
134 | m.sendkey = sendkey; | 134 | m.sendkey = sendkey; |
135 | m.recvkey = recvkey; | 135 | m.recvkey = recvkey; |
136 | DeRegisterMessageServer(m); | 136 | DeRegisterMessageServer(m); |
137 | responseData["responsestring"] = "TRUE"; | 137 | responseData["responsestring"] = "TRUE"; |
138 | response.Value = responseData; | 138 | response.Value = responseData; |
139 | } | 139 | } |
140 | return response; | 140 | return response; |
141 | } | 141 | } |
142 | 142 | ||
143 | public void RegisterMessageServer(MessageServerInfo m) | 143 | public void RegisterMessageServer(MessageServerInfo m) |
144 | { | 144 | { |
145 | lock (m_messageServers) | 145 | lock (m_messageServers) |
146 | { | 146 | { |
147 | if (!m_messageServers.Contains(m)) | 147 | if (!m_messageServers.Contains(m)) |
148 | m_messageServers.Add(m); | 148 | m_messageServers.Add(m); |
149 | } | 149 | } |
150 | } | 150 | } |
151 | 151 | ||
152 | public void DeRegisterMessageServer(MessageServerInfo m) | 152 | public void DeRegisterMessageServer(MessageServerInfo m) |
153 | { | 153 | { |
154 | lock (m_messageServers) | 154 | lock (m_messageServers) |
155 | { | 155 | { |
156 | if (m_messageServers.Contains(m)) | 156 | if (m_messageServers.Contains(m)) |
157 | m_messageServers.Remove(m); | 157 | m_messageServers.Remove(m); |
158 | } | 158 | } |
159 | } | 159 | } |
160 | } | 160 | } |
161 | } | 161 | } |
diff --git a/OpenSim/Grid/GridServer.Modules/GridRestModule.cs b/OpenSim/Grid/GridServer.Modules/GridRestModule.cs index cd6d4d5..716f923 100644 --- a/OpenSim/Grid/GridServer.Modules/GridRestModule.cs +++ b/OpenSim/Grid/GridServer.Modules/GridRestModule.cs | |||
@@ -1,282 +1,282 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Xml; | 33 | using System.Xml; |
34 | using log4net; | 34 | using log4net; |
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenSim.Data; | 36 | using OpenSim.Data; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Communications; | 38 | using OpenSim.Framework.Communications; |
39 | using OpenSim.Framework.Servers; | 39 | using OpenSim.Framework.Servers; |
40 | using OpenSim.Grid.Framework; | 40 | using OpenSim.Grid.Framework; |
41 | 41 | ||
42 | namespace OpenSim.Grid.GridServer.Modules | 42 | namespace OpenSim.Grid.GridServer.Modules |
43 | { | 43 | { |
44 | public class GridRestModule | 44 | public class GridRestModule |
45 | { | 45 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | private GridDBService m_gridDBService; | 48 | private GridDBService m_gridDBService; |
49 | private IUGAIMCore m_gridCore; | 49 | private IUGAIMCore m_gridCore; |
50 | 50 | ||
51 | protected GridConfig m_config; | 51 | protected GridConfig m_config; |
52 | 52 | ||
53 | /// <value> | 53 | /// <value> |
54 | /// Used to notify old regions as to which OpenSim version to upgrade to | 54 | /// Used to notify old regions as to which OpenSim version to upgrade to |
55 | /// </value> | 55 | /// </value> |
56 | private string m_opensimVersion; | 56 | private string m_opensimVersion; |
57 | 57 | ||
58 | protected BaseHttpServer m_httpServer; | 58 | protected BaseHttpServer m_httpServer; |
59 | 59 | ||
60 | /// <summary> | 60 | /// <summary> |
61 | /// Constructor | 61 | /// Constructor |
62 | /// </summary> | 62 | /// </summary> |
63 | /// <param name="opensimVersion"> | 63 | /// <param name="opensimVersion"> |
64 | /// Used to notify old regions as to which OpenSim version to upgrade to | 64 | /// Used to notify old regions as to which OpenSim version to upgrade to |
65 | /// </param> | 65 | /// </param> |
66 | public GridRestModule() | 66 | public GridRestModule() |
67 | { | 67 | { |
68 | } | 68 | } |
69 | 69 | ||
70 | public void Initialise(string opensimVersion, GridDBService gridDBService, IUGAIMCore gridCore, GridConfig config) | 70 | public void Initialise(string opensimVersion, GridDBService gridDBService, IUGAIMCore gridCore, GridConfig config) |
71 | { | 71 | { |
72 | m_opensimVersion = opensimVersion; | 72 | m_opensimVersion = opensimVersion; |
73 | m_gridDBService = gridDBService; | 73 | m_gridDBService = gridDBService; |
74 | m_gridCore = gridCore; | 74 | m_gridCore = gridCore; |
75 | m_config = config; | 75 | m_config = config; |
76 | RegisterHandlers(); | 76 | RegisterHandlers(); |
77 | } | 77 | } |
78 | 78 | ||
79 | public void PostInitialise() | 79 | public void PostInitialise() |
80 | { | 80 | { |
81 | 81 | ||
82 | } | 82 | } |
83 | 83 | ||
84 | public void RegisterHandlers() | 84 | public void RegisterHandlers() |
85 | { | 85 | { |
86 | //have these in separate method as some servers restart the http server and reregister all the handlers. | 86 | //have these in separate method as some servers restart the http server and reregister all the handlers. |
87 | m_httpServer = m_gridCore.GetHttpServer(); | 87 | m_httpServer = m_gridCore.GetHttpServer(); |
88 | 88 | ||
89 | m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", RestGetSimMethod)); | 89 | m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", RestGetSimMethod)); |
90 | m_httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", RestSetSimMethod)); | 90 | m_httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", RestSetSimMethod)); |
91 | 91 | ||
92 | m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/regions/", RestGetRegionMethod)); | 92 | m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/regions/", RestGetRegionMethod)); |
93 | m_httpServer.AddStreamHandler(new RestStreamHandler("POST", "/regions/", RestSetRegionMethod)); | 93 | m_httpServer.AddStreamHandler(new RestStreamHandler("POST", "/regions/", RestSetRegionMethod)); |
94 | } | 94 | } |
95 | 95 | ||
96 | /// <summary> | 96 | /// <summary> |
97 | /// Performs a REST Get Operation | 97 | /// Performs a REST Get Operation |
98 | /// </summary> | 98 | /// </summary> |
99 | /// <param name="request"></param> | 99 | /// <param name="request"></param> |
100 | /// <param name="path"></param> | 100 | /// <param name="path"></param> |
101 | /// <param name="param"></param> | 101 | /// <param name="param"></param> |
102 | /// <param name="httpRequest">HTTP request header object</param> | 102 | /// <param name="httpRequest">HTTP request header object</param> |
103 | /// <param name="httpResponse">HTTP response header object</param> | 103 | /// <param name="httpResponse">HTTP response header object</param> |
104 | /// <returns></returns> | 104 | /// <returns></returns> |
105 | public string RestGetRegionMethod(string request, string path, string param, | 105 | public string RestGetRegionMethod(string request, string path, string param, |
106 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 106 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
107 | { | 107 | { |
108 | return RestGetSimMethod(String.Empty, "/sims/", param, httpRequest, httpResponse); | 108 | return RestGetSimMethod(String.Empty, "/sims/", param, httpRequest, httpResponse); |
109 | } | 109 | } |
110 | 110 | ||
111 | /// <summary> | 111 | /// <summary> |
112 | /// Performs a REST Set Operation | 112 | /// Performs a REST Set Operation |
113 | /// </summary> | 113 | /// </summary> |
114 | /// <param name="request"></param> | 114 | /// <param name="request"></param> |
115 | /// <param name="path"></param> | 115 | /// <param name="path"></param> |
116 | /// <param name="param"></param> | 116 | /// <param name="param"></param> |
117 | /// <param name="httpRequest">HTTP request header object</param> | 117 | /// <param name="httpRequest">HTTP request header object</param> |
118 | /// <param name="httpResponse">HTTP response header object</param> | 118 | /// <param name="httpResponse">HTTP response header object</param> |
119 | /// <returns></returns> | 119 | /// <returns></returns> |
120 | public string RestSetRegionMethod(string request, string path, string param, | 120 | public string RestSetRegionMethod(string request, string path, string param, |
121 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 121 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
122 | { | 122 | { |
123 | return RestSetSimMethod(String.Empty, "/sims/", param, httpRequest, httpResponse); | 123 | return RestSetSimMethod(String.Empty, "/sims/", param, httpRequest, httpResponse); |
124 | } | 124 | } |
125 | 125 | ||
126 | /// <summary> | 126 | /// <summary> |
127 | /// Returns information about a sim via a REST Request | 127 | /// Returns information about a sim via a REST Request |
128 | /// </summary> | 128 | /// </summary> |
129 | /// <param name="request"></param> | 129 | /// <param name="request"></param> |
130 | /// <param name="path"></param> | 130 | /// <param name="path"></param> |
131 | /// <param name="param">A string representing the sim's UUID</param> | 131 | /// <param name="param">A string representing the sim's UUID</param> |
132 | /// <param name="httpRequest">HTTP request header object</param> | 132 | /// <param name="httpRequest">HTTP request header object</param> |
133 | /// <param name="httpResponse">HTTP response header object</param> | 133 | /// <param name="httpResponse">HTTP response header object</param> |
134 | /// <returns>Information about the sim in XML</returns> | 134 | /// <returns>Information about the sim in XML</returns> |
135 | public string RestGetSimMethod(string request, string path, string param, | 135 | public string RestGetSimMethod(string request, string path, string param, |
136 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 136 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
137 | { | 137 | { |
138 | string respstring = String.Empty; | 138 | string respstring = String.Empty; |
139 | 139 | ||
140 | RegionProfileData TheSim; | 140 | RegionProfileData TheSim; |
141 | 141 | ||
142 | UUID UUID; | 142 | UUID UUID; |
143 | if (UUID.TryParse(param, out UUID)) | 143 | if (UUID.TryParse(param, out UUID)) |
144 | { | 144 | { |
145 | TheSim = m_gridDBService.GetRegion(UUID); | 145 | TheSim = m_gridDBService.GetRegion(UUID); |
146 | 146 | ||
147 | if (!(TheSim == null)) | 147 | if (!(TheSim == null)) |
148 | { | 148 | { |
149 | respstring = "<Root>"; | 149 | respstring = "<Root>"; |
150 | respstring += "<authkey>" + TheSim.regionSendKey + "</authkey>"; | 150 | respstring += "<authkey>" + TheSim.regionSendKey + "</authkey>"; |
151 | respstring += "<sim>"; | 151 | respstring += "<sim>"; |
152 | respstring += "<uuid>" + TheSim.UUID.ToString() + "</uuid>"; | 152 | respstring += "<uuid>" + TheSim.UUID.ToString() + "</uuid>"; |
153 | respstring += "<regionname>" + TheSim.regionName + "</regionname>"; | 153 | respstring += "<regionname>" + TheSim.regionName + "</regionname>"; |
154 | respstring += "<sim_ip>" + TheSim.serverIP + "</sim_ip>"; | 154 | respstring += "<sim_ip>" + TheSim.serverIP + "</sim_ip>"; |
155 | respstring += "<sim_port>" + TheSim.serverPort.ToString() + "</sim_port>"; | 155 | respstring += "<sim_port>" + TheSim.serverPort.ToString() + "</sim_port>"; |
156 | respstring += "<region_locx>" + TheSim.regionLocX.ToString() + "</region_locx>"; | 156 | respstring += "<region_locx>" + TheSim.regionLocX.ToString() + "</region_locx>"; |
157 | respstring += "<region_locy>" + TheSim.regionLocY.ToString() + "</region_locy>"; | 157 | respstring += "<region_locy>" + TheSim.regionLocY.ToString() + "</region_locy>"; |
158 | respstring += "<estate_id>1</estate_id>"; | 158 | respstring += "<estate_id>1</estate_id>"; |
159 | respstring += "</sim>"; | 159 | respstring += "</sim>"; |
160 | respstring += "</Root>"; | 160 | respstring += "</Root>"; |
161 | } | 161 | } |
162 | } | 162 | } |
163 | else | 163 | else |
164 | { | 164 | { |
165 | respstring = "<Root>"; | 165 | respstring = "<Root>"; |
166 | respstring += "<error>Param must be a UUID</error>"; | 166 | respstring += "<error>Param must be a UUID</error>"; |
167 | respstring += "</Root>"; | 167 | respstring += "</Root>"; |
168 | } | 168 | } |
169 | 169 | ||
170 | return respstring; | 170 | return respstring; |
171 | } | 171 | } |
172 | 172 | ||
173 | /// <summary> | 173 | /// <summary> |
174 | /// Creates or updates a sim via a REST Method Request | 174 | /// Creates or updates a sim via a REST Method Request |
175 | /// BROKEN with SQL Update | 175 | /// BROKEN with SQL Update |
176 | /// </summary> | 176 | /// </summary> |
177 | /// <param name="request"></param> | 177 | /// <param name="request"></param> |
178 | /// <param name="path"></param> | 178 | /// <param name="path"></param> |
179 | /// <param name="param"></param> | 179 | /// <param name="param"></param> |
180 | /// <param name="httpRequest">HTTP request header object</param> | 180 | /// <param name="httpRequest">HTTP request header object</param> |
181 | /// <param name="httpResponse">HTTP response header object</param> | 181 | /// <param name="httpResponse">HTTP response header object</param> |
182 | /// <returns>"OK" or an error</returns> | 182 | /// <returns>"OK" or an error</returns> |
183 | public string RestSetSimMethod(string request, string path, string param, | 183 | public string RestSetSimMethod(string request, string path, string param, |
184 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 184 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
185 | { | 185 | { |
186 | m_log.Info("Processing region update via REST method"); | 186 | m_log.Info("Processing region update via REST method"); |
187 | RegionProfileData theSim; | 187 | RegionProfileData theSim; |
188 | theSim = m_gridDBService.GetRegion(new UUID(param)); | 188 | theSim = m_gridDBService.GetRegion(new UUID(param)); |
189 | if (theSim == null) | 189 | if (theSim == null) |
190 | { | 190 | { |
191 | theSim = new RegionProfileData(); | 191 | theSim = new RegionProfileData(); |
192 | UUID UUID = new UUID(param); | 192 | UUID UUID = new UUID(param); |
193 | theSim.UUID = UUID; | 193 | theSim.UUID = UUID; |
194 | theSim.regionRecvKey = m_config.SimRecvKey; | 194 | theSim.regionRecvKey = m_config.SimRecvKey; |
195 | } | 195 | } |
196 | 196 | ||
197 | XmlDocument doc = new XmlDocument(); | 197 | XmlDocument doc = new XmlDocument(); |
198 | doc.LoadXml(request); | 198 | doc.LoadXml(request); |
199 | XmlNode rootnode = doc.FirstChild; | 199 | XmlNode rootnode = doc.FirstChild; |
200 | XmlNode authkeynode = rootnode.ChildNodes[0]; | 200 | XmlNode authkeynode = rootnode.ChildNodes[0]; |
201 | if (authkeynode.Name != "authkey") | 201 | if (authkeynode.Name != "authkey") |
202 | { | 202 | { |
203 | return "ERROR! bad XML - expected authkey tag"; | 203 | return "ERROR! bad XML - expected authkey tag"; |
204 | } | 204 | } |
205 | 205 | ||
206 | XmlNode simnode = rootnode.ChildNodes[1]; | 206 | XmlNode simnode = rootnode.ChildNodes[1]; |
207 | if (simnode.Name != "sim") | 207 | if (simnode.Name != "sim") |
208 | { | 208 | { |
209 | return "ERROR! bad XML - expected sim tag"; | 209 | return "ERROR! bad XML - expected sim tag"; |
210 | } | 210 | } |
211 | 211 | ||
212 | //theSim.regionSendKey = Cfg; | 212 | //theSim.regionSendKey = Cfg; |
213 | theSim.regionRecvKey = m_config.SimRecvKey; | 213 | theSim.regionRecvKey = m_config.SimRecvKey; |
214 | theSim.regionSendKey = m_config.SimSendKey; | 214 | theSim.regionSendKey = m_config.SimSendKey; |
215 | theSim.regionSecret = m_config.SimRecvKey; | 215 | theSim.regionSecret = m_config.SimRecvKey; |
216 | theSim.regionDataURI = String.Empty; | 216 | theSim.regionDataURI = String.Empty; |
217 | theSim.regionAssetURI = m_config.DefaultAssetServer; | 217 | theSim.regionAssetURI = m_config.DefaultAssetServer; |
218 | theSim.regionAssetRecvKey = m_config.AssetRecvKey; | 218 | theSim.regionAssetRecvKey = m_config.AssetRecvKey; |
219 | theSim.regionAssetSendKey = m_config.AssetSendKey; | 219 | theSim.regionAssetSendKey = m_config.AssetSendKey; |
220 | theSim.regionUserURI = m_config.DefaultUserServer; | 220 | theSim.regionUserURI = m_config.DefaultUserServer; |
221 | theSim.regionUserSendKey = m_config.UserSendKey; | 221 | theSim.regionUserSendKey = m_config.UserSendKey; |
222 | theSim.regionUserRecvKey = m_config.UserRecvKey; | 222 | theSim.regionUserRecvKey = m_config.UserRecvKey; |
223 | 223 | ||
224 | for (int i = 0; i < simnode.ChildNodes.Count; i++) | 224 | for (int i = 0; i < simnode.ChildNodes.Count; i++) |
225 | { | 225 | { |
226 | switch (simnode.ChildNodes[i].Name) | 226 | switch (simnode.ChildNodes[i].Name) |
227 | { | 227 | { |
228 | case "regionname": | 228 | case "regionname": |
229 | theSim.regionName = simnode.ChildNodes[i].InnerText; | 229 | theSim.regionName = simnode.ChildNodes[i].InnerText; |
230 | break; | 230 | break; |
231 | 231 | ||
232 | case "sim_ip": | 232 | case "sim_ip": |
233 | theSim.serverIP = simnode.ChildNodes[i].InnerText; | 233 | theSim.serverIP = simnode.ChildNodes[i].InnerText; |
234 | break; | 234 | break; |
235 | 235 | ||
236 | case "sim_port": | 236 | case "sim_port": |
237 | theSim.serverPort = Convert.ToUInt32(simnode.ChildNodes[i].InnerText); | 237 | theSim.serverPort = Convert.ToUInt32(simnode.ChildNodes[i].InnerText); |
238 | break; | 238 | break; |
239 | 239 | ||
240 | case "region_locx": | 240 | case "region_locx": |
241 | theSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); | 241 | theSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); |
242 | theSim.regionHandle = Utils.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize)); | 242 | theSim.regionHandle = Utils.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize)); |
243 | break; | 243 | break; |
244 | 244 | ||
245 | case "region_locy": | 245 | case "region_locy": |
246 | theSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); | 246 | theSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); |
247 | theSim.regionHandle = Utils.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize)); | 247 | theSim.regionHandle = Utils.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize)); |
248 | break; | 248 | break; |
249 | } | 249 | } |
250 | } | 250 | } |
251 | 251 | ||
252 | theSim.serverURI = "http://" + theSim.serverIP + ":" + theSim.serverPort + "/"; | 252 | theSim.serverURI = "http://" + theSim.serverIP + ":" + theSim.serverPort + "/"; |
253 | bool requirePublic = false; | 253 | bool requirePublic = false; |
254 | bool requireValid = true; | 254 | bool requireValid = true; |
255 | 255 | ||
256 | if (requirePublic && | 256 | if (requirePublic && |
257 | (theSim.serverIP.StartsWith("172.16") || theSim.serverIP.StartsWith("192.168") || | 257 | (theSim.serverIP.StartsWith("172.16") || theSim.serverIP.StartsWith("192.168") || |
258 | theSim.serverIP.StartsWith("10.") || theSim.serverIP.StartsWith("0.") || | 258 | theSim.serverIP.StartsWith("10.") || theSim.serverIP.StartsWith("0.") || |
259 | theSim.serverIP.StartsWith("255."))) | 259 | theSim.serverIP.StartsWith("255."))) |
260 | { | 260 | { |
261 | return "ERROR! Servers must register with public addresses."; | 261 | return "ERROR! Servers must register with public addresses."; |
262 | } | 262 | } |
263 | 263 | ||
264 | if (requireValid && (theSim.serverIP.StartsWith("0.") || theSim.serverIP.StartsWith("255."))) | 264 | if (requireValid && (theSim.serverIP.StartsWith("0.") || theSim.serverIP.StartsWith("255."))) |
265 | { | 265 | { |
266 | return "ERROR! 0.*.*.* / 255.*.*.* Addresses are invalid, please check your server config and try again"; | 266 | return "ERROR! 0.*.*.* / 255.*.*.* Addresses are invalid, please check your server config and try again"; |
267 | } | 267 | } |
268 | 268 | ||
269 | try | 269 | try |
270 | { | 270 | { |
271 | m_log.Info("[DATA]: " + | 271 | m_log.Info("[DATA]: " + |
272 | "Updating / adding via " + m_gridDBService.GetNumberOfPlugins() + " storage provider(s) registered."); | 272 | "Updating / adding via " + m_gridDBService.GetNumberOfPlugins() + " storage provider(s) registered."); |
273 | 273 | ||
274 | return m_gridDBService.CheckReservations(theSim, authkeynode); | 274 | return m_gridDBService.CheckReservations(theSim, authkeynode); |
275 | } | 275 | } |
276 | catch (Exception e) | 276 | catch (Exception e) |
277 | { | 277 | { |
278 | return "ERROR! Could not save to database! (" + e.ToString() + ")"; | 278 | return "ERROR! Could not save to database! (" + e.ToString() + ")"; |
279 | } | 279 | } |
280 | } | 280 | } |
281 | } | 281 | } |
282 | } | 282 | } |
diff --git a/OpenSim/Grid/GridServer.Modules/GridXmlRpcModule.cs b/OpenSim/Grid/GridServer.Modules/GridXmlRpcModule.cs index d5af900..292ce0d 100644 --- a/OpenSim/Grid/GridServer.Modules/GridXmlRpcModule.cs +++ b/OpenSim/Grid/GridServer.Modules/GridXmlRpcModule.cs | |||
@@ -1,885 +1,885 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Xml; | 33 | using System.Xml; |
34 | using log4net; | 34 | using log4net; |
35 | using Nwc.XmlRpc; | 35 | using Nwc.XmlRpc; |
36 | using OpenMetaverse; | 36 | using OpenMetaverse; |
37 | using OpenSim.Data; | 37 | using OpenSim.Data; |
38 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
39 | using OpenSim.Framework.Communications; | 39 | using OpenSim.Framework.Communications; |
40 | using OpenSim.Framework.Servers; | 40 | using OpenSim.Framework.Servers; |
41 | using OpenSim.Grid.Framework; | 41 | using OpenSim.Grid.Framework; |
42 | 42 | ||
43 | namespace OpenSim.Grid.GridServer.Modules | 43 | namespace OpenSim.Grid.GridServer.Modules |
44 | { | 44 | { |
45 | public class GridXmlRpcModule | 45 | public class GridXmlRpcModule |
46 | { | 46 | { |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | private GridDBService m_gridDBService; | 49 | private GridDBService m_gridDBService; |
50 | private IUGAIMCore m_gridCore; | 50 | private IUGAIMCore m_gridCore; |
51 | 51 | ||
52 | protected GridConfig m_config; | 52 | protected GridConfig m_config; |
53 | 53 | ||
54 | protected IGridMessagingMapper m_messagingServerMapper; | 54 | protected IGridMessagingMapper m_messagingServerMapper; |
55 | /// <value> | 55 | /// <value> |
56 | /// Used to notify old regions as to which OpenSim version to upgrade to | 56 | /// Used to notify old regions as to which OpenSim version to upgrade to |
57 | /// </value> | 57 | /// </value> |
58 | private string m_opensimVersion; | 58 | private string m_opensimVersion; |
59 | 59 | ||
60 | protected BaseHttpServer m_httpServer; | 60 | protected BaseHttpServer m_httpServer; |
61 | 61 | ||
62 | /// <summary> | 62 | /// <summary> |
63 | /// Constructor | 63 | /// Constructor |
64 | /// </summary> | 64 | /// </summary> |
65 | /// <param name="opensimVersion"> | 65 | /// <param name="opensimVersion"> |
66 | /// Used to notify old regions as to which OpenSim version to upgrade to | 66 | /// Used to notify old regions as to which OpenSim version to upgrade to |
67 | /// </param> | 67 | /// </param> |
68 | public GridXmlRpcModule() | 68 | public GridXmlRpcModule() |
69 | { | 69 | { |
70 | } | 70 | } |
71 | 71 | ||
72 | public void Initialise(string opensimVersion, GridDBService gridDBService, IUGAIMCore gridCore, GridConfig config) | 72 | public void Initialise(string opensimVersion, GridDBService gridDBService, IUGAIMCore gridCore, GridConfig config) |
73 | { | 73 | { |
74 | m_opensimVersion = opensimVersion; | 74 | m_opensimVersion = opensimVersion; |
75 | m_gridDBService = gridDBService; | 75 | m_gridDBService = gridDBService; |
76 | m_gridCore = gridCore; | 76 | m_gridCore = gridCore; |
77 | m_config = config; | 77 | m_config = config; |
78 | RegisterHandlers(); | 78 | RegisterHandlers(); |
79 | } | 79 | } |
80 | 80 | ||
81 | public void PostInitialise() | 81 | public void PostInitialise() |
82 | { | 82 | { |
83 | IGridMessagingMapper messagingModule; | 83 | IGridMessagingMapper messagingModule; |
84 | if (m_gridCore.TryGet<IGridMessagingMapper>(out messagingModule)) | 84 | if (m_gridCore.TryGet<IGridMessagingMapper>(out messagingModule)) |
85 | { | 85 | { |
86 | m_messagingServerMapper = messagingModule; | 86 | m_messagingServerMapper = messagingModule; |
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
90 | public void RegisterHandlers() | 90 | public void RegisterHandlers() |
91 | { | 91 | { |
92 | //have these in separate method as some servers restart the http server and reregister all the handlers. | 92 | //have these in separate method as some servers restart the http server and reregister all the handlers. |
93 | m_httpServer = m_gridCore.GetHttpServer(); | 93 | m_httpServer = m_gridCore.GetHttpServer(); |
94 | 94 | ||
95 | m_httpServer.AddXmlRPCHandler("simulator_login", XmlRpcSimulatorLoginMethod); | 95 | m_httpServer.AddXmlRPCHandler("simulator_login", XmlRpcSimulatorLoginMethod); |
96 | m_httpServer.AddXmlRPCHandler("simulator_data_request", XmlRpcSimulatorDataRequestMethod); | 96 | m_httpServer.AddXmlRPCHandler("simulator_data_request", XmlRpcSimulatorDataRequestMethod); |
97 | m_httpServer.AddXmlRPCHandler("simulator_after_region_moved", XmlRpcDeleteRegionMethod); | 97 | m_httpServer.AddXmlRPCHandler("simulator_after_region_moved", XmlRpcDeleteRegionMethod); |
98 | m_httpServer.AddXmlRPCHandler("map_block", XmlRpcMapBlockMethod); | 98 | m_httpServer.AddXmlRPCHandler("map_block", XmlRpcMapBlockMethod); |
99 | m_httpServer.AddXmlRPCHandler("search_for_region_by_name", XmlRpcSearchForRegionMethod); | 99 | m_httpServer.AddXmlRPCHandler("search_for_region_by_name", XmlRpcSearchForRegionMethod); |
100 | } | 100 | } |
101 | 101 | ||
102 | /// <summary> | 102 | /// <summary> |
103 | /// Returns a XML String containing a list of the neighbouring regions | 103 | /// Returns a XML String containing a list of the neighbouring regions |
104 | /// </summary> | 104 | /// </summary> |
105 | /// <param name="reqhandle">The regionhandle for the center sim</param> | 105 | /// <param name="reqhandle">The regionhandle for the center sim</param> |
106 | /// <returns>An XML string containing neighbour entities</returns> | 106 | /// <returns>An XML string containing neighbour entities</returns> |
107 | public string GetXMLNeighbours(ulong reqhandle) | 107 | public string GetXMLNeighbours(ulong reqhandle) |
108 | { | 108 | { |
109 | string response = String.Empty; | 109 | string response = String.Empty; |
110 | RegionProfileData central_region = m_gridDBService.GetRegion(reqhandle); | 110 | RegionProfileData central_region = m_gridDBService.GetRegion(reqhandle); |
111 | RegionProfileData neighbour; | 111 | RegionProfileData neighbour; |
112 | for (int x = -1; x < 2; x++) | 112 | for (int x = -1; x < 2; x++) |
113 | { | 113 | { |
114 | for (int y = -1; y < 2; y++) | 114 | for (int y = -1; y < 2; y++) |
115 | { | 115 | { |
116 | if ( | 116 | if ( |
117 | m_gridDBService.GetRegion( | 117 | m_gridDBService.GetRegion( |
118 | Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize), | 118 | Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize), |
119 | (uint)(central_region.regionLocY + y) * Constants.RegionSize)) != null) | 119 | (uint)(central_region.regionLocY + y) * Constants.RegionSize)) != null) |
120 | { | 120 | { |
121 | neighbour = | 121 | neighbour = |
122 | m_gridDBService.GetRegion( | 122 | m_gridDBService.GetRegion( |
123 | Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize), | 123 | Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize), |
124 | (uint)(central_region.regionLocY + y) * Constants.RegionSize)); | 124 | (uint)(central_region.regionLocY + y) * Constants.RegionSize)); |
125 | 125 | ||
126 | response += "<neighbour>"; | 126 | response += "<neighbour>"; |
127 | response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>"; | 127 | response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>"; |
128 | response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>"; | 128 | response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>"; |
129 | response += "<locx>" + neighbour.regionLocX.ToString() + "</locx>"; | 129 | response += "<locx>" + neighbour.regionLocX.ToString() + "</locx>"; |
130 | response += "<locy>" + neighbour.regionLocY.ToString() + "</locy>"; | 130 | response += "<locy>" + neighbour.regionLocY.ToString() + "</locy>"; |
131 | response += "<regionhandle>" + neighbour.regionHandle.ToString() + "</regionhandle>"; | 131 | response += "<regionhandle>" + neighbour.regionHandle.ToString() + "</regionhandle>"; |
132 | response += "</neighbour>"; | 132 | response += "</neighbour>"; |
133 | } | 133 | } |
134 | } | 134 | } |
135 | } | 135 | } |
136 | return response; | 136 | return response; |
137 | } | 137 | } |
138 | 138 | ||
139 | /// <summary> | 139 | /// <summary> |
140 | /// Checks that it's valid to replace the existing region data with new data | 140 | /// Checks that it's valid to replace the existing region data with new data |
141 | /// | 141 | /// |
142 | /// Currently, this means ensure that the keys passed in by the new region | 142 | /// Currently, this means ensure that the keys passed in by the new region |
143 | /// match those in the original region. (XXX Is this correct? Shouldn't we simply check | 143 | /// match those in the original region. (XXX Is this correct? Shouldn't we simply check |
144 | /// against the keys in the current configuration?) | 144 | /// against the keys in the current configuration?) |
145 | /// </summary> | 145 | /// </summary> |
146 | /// <param name="sim"></param> | 146 | /// <param name="sim"></param> |
147 | /// <returns></returns> | 147 | /// <returns></returns> |
148 | protected virtual void ValidateOverwriteKeys(RegionProfileData sim, RegionProfileData existingSim) | 148 | protected virtual void ValidateOverwriteKeys(RegionProfileData sim, RegionProfileData existingSim) |
149 | { | 149 | { |
150 | if (!(existingSim.regionRecvKey == sim.regionRecvKey && existingSim.regionSendKey == sim.regionSendKey)) | 150 | if (!(existingSim.regionRecvKey == sim.regionRecvKey && existingSim.regionSendKey == sim.regionSendKey)) |
151 | { | 151 | { |
152 | throw new LoginException( | 152 | throw new LoginException( |
153 | String.Format( | 153 | String.Format( |
154 | "Authentication failed when trying to login existing region {0} at location {1} {2} currently occupied by {3}" | 154 | "Authentication failed when trying to login existing region {0} at location {1} {2} currently occupied by {3}" |
155 | + " with the region's send key {4} (expected {5}) and the region's receive key {6} (expected {7})", | 155 | + " with the region's send key {4} (expected {5}) and the region's receive key {6} (expected {7})", |
156 | sim.regionName, sim.regionLocX, sim.regionLocY, existingSim.regionName, | 156 | sim.regionName, sim.regionLocX, sim.regionLocY, existingSim.regionName, |
157 | sim.regionSendKey, existingSim.regionSendKey, sim.regionRecvKey, existingSim.regionRecvKey), | 157 | sim.regionSendKey, existingSim.regionSendKey, sim.regionRecvKey, existingSim.regionRecvKey), |
158 | "The keys required to login your region did not match the grid server keys. Please check your grid send and receive keys."); | 158 | "The keys required to login your region did not match the grid server keys. Please check your grid send and receive keys."); |
159 | } | 159 | } |
160 | } | 160 | } |
161 | 161 | ||
162 | /// <summary> | 162 | /// <summary> |
163 | /// Checks that the new region data is valid. | 163 | /// Checks that the new region data is valid. |
164 | /// | 164 | /// |
165 | /// Currently, this means checking that the keys passed in by the new region | 165 | /// Currently, this means checking that the keys passed in by the new region |
166 | /// match those in the grid server's configuration. | 166 | /// match those in the grid server's configuration. |
167 | /// </summary> | 167 | /// </summary> |
168 | /// | 168 | /// |
169 | /// <param name="sim"></param> | 169 | /// <param name="sim"></param> |
170 | /// <exception cref="LoginException">Thrown if region login failed</exception> | 170 | /// <exception cref="LoginException">Thrown if region login failed</exception> |
171 | protected virtual void ValidateNewRegionKeys(RegionProfileData sim) | 171 | protected virtual void ValidateNewRegionKeys(RegionProfileData sim) |
172 | { | 172 | { |
173 | if (!(sim.regionRecvKey == m_config.SimSendKey && sim.regionSendKey == m_config.SimRecvKey)) | 173 | if (!(sim.regionRecvKey == m_config.SimSendKey && sim.regionSendKey == m_config.SimRecvKey)) |
174 | { | 174 | { |
175 | throw new LoginException( | 175 | throw new LoginException( |
176 | String.Format( | 176 | String.Format( |
177 | "Authentication failed when trying to login new region {0} at location {1} {2}" | 177 | "Authentication failed when trying to login new region {0} at location {1} {2}" |
178 | + " with the region's send key {3} (expected {4}) and the region's receive key {5} (expected {6})", | 178 | + " with the region's send key {3} (expected {4}) and the region's receive key {5} (expected {6})", |
179 | sim.regionName, sim.regionLocX, sim.regionLocY, | 179 | sim.regionName, sim.regionLocX, sim.regionLocY, |
180 | sim.regionSendKey, m_config.SimRecvKey, sim.regionRecvKey, m_config.SimSendKey), | 180 | sim.regionSendKey, m_config.SimRecvKey, sim.regionRecvKey, m_config.SimSendKey), |
181 | "The keys required to login your region did not match your existing region keys. Please check your grid send and receive keys."); | 181 | "The keys required to login your region did not match your existing region keys. Please check your grid send and receive keys."); |
182 | } | 182 | } |
183 | } | 183 | } |
184 | 184 | ||
185 | /// <summary> | 185 | /// <summary> |
186 | /// Check that a region's http uri is externally contactable. | 186 | /// Check that a region's http uri is externally contactable. |
187 | /// </summary> | 187 | /// </summary> |
188 | /// <param name="sim"></param> | 188 | /// <param name="sim"></param> |
189 | /// <exception cref="LoginException">Thrown if the region is not contactable</exception> | 189 | /// <exception cref="LoginException">Thrown if the region is not contactable</exception> |
190 | protected virtual void ValidateRegionContactable(RegionProfileData sim) | 190 | protected virtual void ValidateRegionContactable(RegionProfileData sim) |
191 | { | 191 | { |
192 | string regionStatusUrl = String.Format("{0}{1}", sim.httpServerURI, "simstatus/"); | 192 | string regionStatusUrl = String.Format("{0}{1}", sim.httpServerURI, "simstatus/"); |
193 | string regionStatusResponse; | 193 | string regionStatusResponse; |
194 | 194 | ||
195 | RestClient rc = new RestClient(regionStatusUrl); | 195 | RestClient rc = new RestClient(regionStatusUrl); |
196 | rc.RequestMethod = "GET"; | 196 | rc.RequestMethod = "GET"; |
197 | 197 | ||
198 | m_log.DebugFormat("[LOGIN]: Contacting {0} for status of region {1}", regionStatusUrl, sim.regionName); | 198 | m_log.DebugFormat("[LOGIN]: Contacting {0} for status of region {1}", regionStatusUrl, sim.regionName); |
199 | 199 | ||
200 | try | 200 | try |
201 | { | 201 | { |
202 | Stream rs = rc.Request(); | 202 | Stream rs = rc.Request(); |
203 | StreamReader sr = new StreamReader(rs); | 203 | StreamReader sr = new StreamReader(rs); |
204 | regionStatusResponse = sr.ReadToEnd(); | 204 | regionStatusResponse = sr.ReadToEnd(); |
205 | sr.Close(); | 205 | sr.Close(); |
206 | } | 206 | } |
207 | catch (Exception e) | 207 | catch (Exception e) |
208 | { | 208 | { |
209 | throw new LoginException( | 209 | throw new LoginException( |
210 | String.Format("Region status request to {0} failed", regionStatusUrl), | 210 | String.Format("Region status request to {0} failed", regionStatusUrl), |
211 | String.Format( | 211 | String.Format( |
212 | "The grid service could not contact the http url {0} at your region. Please make sure this url is reachable by the grid service", | 212 | "The grid service could not contact the http url {0} at your region. Please make sure this url is reachable by the grid service", |
213 | regionStatusUrl), | 213 | regionStatusUrl), |
214 | e); | 214 | e); |
215 | } | 215 | } |
216 | 216 | ||
217 | if (!regionStatusResponse.Equals("OK")) | 217 | if (!regionStatusResponse.Equals("OK")) |
218 | { | 218 | { |
219 | throw new LoginException( | 219 | throw new LoginException( |
220 | String.Format( | 220 | String.Format( |
221 | "Region {0} at {1} returned status response {2} rather than {3}", | 221 | "Region {0} at {1} returned status response {2} rather than {3}", |
222 | sim.regionName, regionStatusUrl, regionStatusResponse, "OK"), | 222 | sim.regionName, regionStatusUrl, regionStatusResponse, "OK"), |
223 | String.Format( | 223 | String.Format( |
224 | "When the grid service asked for the status of your region, it received the response {0} rather than {1}. Please check your status", | 224 | "When the grid service asked for the status of your region, it received the response {0} rather than {1}. Please check your status", |
225 | regionStatusResponse, "OK")); | 225 | regionStatusResponse, "OK")); |
226 | } | 226 | } |
227 | } | 227 | } |
228 | 228 | ||
229 | /// <summary> | 229 | /// <summary> |
230 | /// Construct an XMLRPC error response | 230 | /// Construct an XMLRPC error response |
231 | /// </summary> | 231 | /// </summary> |
232 | /// <param name="error"></param> | 232 | /// <param name="error"></param> |
233 | /// <returns></returns> | 233 | /// <returns></returns> |
234 | public static XmlRpcResponse ErrorResponse(string error) | 234 | public static XmlRpcResponse ErrorResponse(string error) |
235 | { | 235 | { |
236 | XmlRpcResponse errorResponse = new XmlRpcResponse(); | 236 | XmlRpcResponse errorResponse = new XmlRpcResponse(); |
237 | Hashtable errorResponseData = new Hashtable(); | 237 | Hashtable errorResponseData = new Hashtable(); |
238 | errorResponse.Value = errorResponseData; | 238 | errorResponse.Value = errorResponseData; |
239 | errorResponseData["error"] = error; | 239 | errorResponseData["error"] = error; |
240 | return errorResponse; | 240 | return errorResponse; |
241 | } | 241 | } |
242 | 242 | ||
243 | /// <summary> | 243 | /// <summary> |
244 | /// Performed when a region connects to the grid server initially. | 244 | /// Performed when a region connects to the grid server initially. |
245 | /// </summary> | 245 | /// </summary> |
246 | /// <param name="request">The XML RPC Request</param> | 246 | /// <param name="request">The XML RPC Request</param> |
247 | /// <returns>Startup parameters</returns> | 247 | /// <returns>Startup parameters</returns> |
248 | public XmlRpcResponse XmlRpcSimulatorLoginMethod(XmlRpcRequest request) | 248 | public XmlRpcResponse XmlRpcSimulatorLoginMethod(XmlRpcRequest request) |
249 | { | 249 | { |
250 | RegionProfileData sim; | 250 | RegionProfileData sim; |
251 | RegionProfileData existingSim; | 251 | RegionProfileData existingSim; |
252 | 252 | ||
253 | Hashtable requestData = (Hashtable)request.Params[0]; | 253 | Hashtable requestData = (Hashtable)request.Params[0]; |
254 | UUID uuid; | 254 | UUID uuid; |
255 | 255 | ||
256 | if (!requestData.ContainsKey("UUID") || !UUID.TryParse((string)requestData["UUID"], out uuid)) | 256 | if (!requestData.ContainsKey("UUID") || !UUID.TryParse((string)requestData["UUID"], out uuid)) |
257 | { | 257 | { |
258 | m_log.Debug("[LOGIN PRELUDE]: Region connected without a UUID, sending back error response."); | 258 | m_log.Debug("[LOGIN PRELUDE]: Region connected without a UUID, sending back error response."); |
259 | return ErrorResponse("No UUID passed to grid server - unable to connect you"); | 259 | return ErrorResponse("No UUID passed to grid server - unable to connect you"); |
260 | } | 260 | } |
261 | 261 | ||
262 | try | 262 | try |
263 | { | 263 | { |
264 | sim = RegionFromRequest(requestData); | 264 | sim = RegionFromRequest(requestData); |
265 | } | 265 | } |
266 | catch (FormatException e) | 266 | catch (FormatException e) |
267 | { | 267 | { |
268 | m_log.Debug("[LOGIN PRELUDE]: Invalid login parameters, sending back error response."); | 268 | m_log.Debug("[LOGIN PRELUDE]: Invalid login parameters, sending back error response."); |
269 | return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e.ToString()); | 269 | return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e.ToString()); |
270 | } | 270 | } |
271 | 271 | ||
272 | m_log.InfoFormat("[LOGIN BEGIN]: Received login request from simulator: {0}", sim.regionName); | 272 | m_log.InfoFormat("[LOGIN BEGIN]: Received login request from simulator: {0}", sim.regionName); |
273 | 273 | ||
274 | if (!m_config.AllowRegionRegistration) | 274 | if (!m_config.AllowRegionRegistration) |
275 | { | 275 | { |
276 | m_log.DebugFormat( | 276 | m_log.DebugFormat( |
277 | "[LOGIN END]: Disabled region registration blocked login request from simulator: {0}", | 277 | "[LOGIN END]: Disabled region registration blocked login request from simulator: {0}", |
278 | sim.regionName); | 278 | sim.regionName); |
279 | 279 | ||
280 | return ErrorResponse("This grid is currently not accepting region registrations."); | 280 | return ErrorResponse("This grid is currently not accepting region registrations."); |
281 | } | 281 | } |
282 | 282 | ||
283 | int majorInterfaceVersion = 0; | 283 | int majorInterfaceVersion = 0; |
284 | if (requestData.ContainsKey("major_interface_version")) | 284 | if (requestData.ContainsKey("major_interface_version")) |
285 | int.TryParse((string)requestData["major_interface_version"], out majorInterfaceVersion); | 285 | int.TryParse((string)requestData["major_interface_version"], out majorInterfaceVersion); |
286 | 286 | ||
287 | if (majorInterfaceVersion != VersionInfo.MajorInterfaceVersion) | 287 | if (majorInterfaceVersion != VersionInfo.MajorInterfaceVersion) |
288 | { | 288 | { |
289 | return ErrorResponse( | 289 | return ErrorResponse( |
290 | String.Format( | 290 | String.Format( |
291 | "Your region service implements OGS1 interface version {0}" | 291 | "Your region service implements OGS1 interface version {0}" |
292 | + " but this grid requires that the region implement OGS1 interface version {1} to connect." | 292 | + " but this grid requires that the region implement OGS1 interface version {1} to connect." |
293 | + " Try changing to OpenSimulator {2}", | 293 | + " Try changing to OpenSimulator {2}", |
294 | majorInterfaceVersion, VersionInfo.MajorInterfaceVersion, m_opensimVersion)); | 294 | majorInterfaceVersion, VersionInfo.MajorInterfaceVersion, m_opensimVersion)); |
295 | } | 295 | } |
296 | 296 | ||
297 | existingSim = m_gridDBService.GetRegion(sim.regionHandle); | 297 | existingSim = m_gridDBService.GetRegion(sim.regionHandle); |
298 | 298 | ||
299 | if (existingSim == null || existingSim.UUID == sim.UUID || sim.UUID != sim.originUUID) | 299 | if (existingSim == null || existingSim.UUID == sim.UUID || sim.UUID != sim.originUUID) |
300 | { | 300 | { |
301 | try | 301 | try |
302 | { | 302 | { |
303 | if (existingSim == null) | 303 | if (existingSim == null) |
304 | { | 304 | { |
305 | ValidateNewRegionKeys(sim); | 305 | ValidateNewRegionKeys(sim); |
306 | } | 306 | } |
307 | else | 307 | else |
308 | { | 308 | { |
309 | ValidateOverwriteKeys(sim, existingSim); | 309 | ValidateOverwriteKeys(sim, existingSim); |
310 | } | 310 | } |
311 | 311 | ||
312 | ValidateRegionContactable(sim); | 312 | ValidateRegionContactable(sim); |
313 | } | 313 | } |
314 | catch (LoginException e) | 314 | catch (LoginException e) |
315 | { | 315 | { |
316 | string logMsg = e.Message; | 316 | string logMsg = e.Message; |
317 | if (e.InnerException != null) | 317 | if (e.InnerException != null) |
318 | logMsg += ", " + e.InnerException.Message; | 318 | logMsg += ", " + e.InnerException.Message; |
319 | 319 | ||
320 | m_log.WarnFormat("[LOGIN END]: {0}", logMsg); | 320 | m_log.WarnFormat("[LOGIN END]: {0}", logMsg); |
321 | 321 | ||
322 | return e.XmlRpcErrorResponse; | 322 | return e.XmlRpcErrorResponse; |
323 | } | 323 | } |
324 | 324 | ||
325 | DataResponse insertResponse = m_gridDBService.AddUpdateRegion(sim, existingSim); | 325 | DataResponse insertResponse = m_gridDBService.AddUpdateRegion(sim, existingSim); |
326 | 326 | ||
327 | switch (insertResponse) | 327 | switch (insertResponse) |
328 | { | 328 | { |
329 | case DataResponse.RESPONSE_OK: | 329 | case DataResponse.RESPONSE_OK: |
330 | m_log.Info("[LOGIN END]: " + (existingSim == null ? "New" : "Existing") + " sim login successful: " + sim.regionName); | 330 | m_log.Info("[LOGIN END]: " + (existingSim == null ? "New" : "Existing") + " sim login successful: " + sim.regionName); |
331 | break; | 331 | break; |
332 | case DataResponse.RESPONSE_ERROR: | 332 | case DataResponse.RESPONSE_ERROR: |
333 | m_log.Warn("[LOGIN END]: Sim login failed (Error): " + sim.regionName); | 333 | m_log.Warn("[LOGIN END]: Sim login failed (Error): " + sim.regionName); |
334 | break; | 334 | break; |
335 | case DataResponse.RESPONSE_INVALIDCREDENTIALS: | 335 | case DataResponse.RESPONSE_INVALIDCREDENTIALS: |
336 | m_log.Warn("[LOGIN END]: " + | 336 | m_log.Warn("[LOGIN END]: " + |
337 | "Sim login failed (Invalid Credentials): " + sim.regionName); | 337 | "Sim login failed (Invalid Credentials): " + sim.regionName); |
338 | break; | 338 | break; |
339 | case DataResponse.RESPONSE_AUTHREQUIRED: | 339 | case DataResponse.RESPONSE_AUTHREQUIRED: |
340 | m_log.Warn("[LOGIN END]: " + | 340 | m_log.Warn("[LOGIN END]: " + |
341 | "Sim login failed (Authentication Required): " + | 341 | "Sim login failed (Authentication Required): " + |
342 | sim.regionName); | 342 | sim.regionName); |
343 | break; | 343 | break; |
344 | } | 344 | } |
345 | 345 | ||
346 | XmlRpcResponse response = CreateLoginResponse(sim); | 346 | XmlRpcResponse response = CreateLoginResponse(sim); |
347 | 347 | ||
348 | return response; | 348 | return response; |
349 | } | 349 | } |
350 | else | 350 | else |
351 | { | 351 | { |
352 | m_log.Warn("[LOGIN END]: Failed to login region " + sim.regionName + " at location " + sim.regionLocX + " " + sim.regionLocY + " currently occupied by " + existingSim.regionName); | 352 | m_log.Warn("[LOGIN END]: Failed to login region " + sim.regionName + " at location " + sim.regionLocX + " " + sim.regionLocY + " currently occupied by " + existingSim.regionName); |
353 | return ErrorResponse("Another region already exists at that location. Please try another."); | 353 | return ErrorResponse("Another region already exists at that location. Please try another."); |
354 | } | 354 | } |
355 | } | 355 | } |
356 | 356 | ||
357 | /// <summary> | 357 | /// <summary> |
358 | /// Construct a successful response to a simulator's login attempt. | 358 | /// Construct a successful response to a simulator's login attempt. |
359 | /// </summary> | 359 | /// </summary> |
360 | /// <param name="sim"></param> | 360 | /// <param name="sim"></param> |
361 | /// <returns></returns> | 361 | /// <returns></returns> |
362 | private XmlRpcResponse CreateLoginResponse(RegionProfileData sim) | 362 | private XmlRpcResponse CreateLoginResponse(RegionProfileData sim) |
363 | { | 363 | { |
364 | XmlRpcResponse response = new XmlRpcResponse(); | 364 | XmlRpcResponse response = new XmlRpcResponse(); |
365 | Hashtable responseData = new Hashtable(); | 365 | Hashtable responseData = new Hashtable(); |
366 | response.Value = responseData; | 366 | response.Value = responseData; |
367 | 367 | ||
368 | ArrayList SimNeighboursData = GetSimNeighboursData(sim); | 368 | ArrayList SimNeighboursData = GetSimNeighboursData(sim); |
369 | 369 | ||
370 | responseData["UUID"] = sim.UUID.ToString(); | 370 | responseData["UUID"] = sim.UUID.ToString(); |
371 | responseData["region_locx"] = sim.regionLocX.ToString(); | 371 | responseData["region_locx"] = sim.regionLocX.ToString(); |
372 | responseData["region_locy"] = sim.regionLocY.ToString(); | 372 | responseData["region_locy"] = sim.regionLocY.ToString(); |
373 | responseData["regionname"] = sim.regionName; | 373 | responseData["regionname"] = sim.regionName; |
374 | responseData["estate_id"] = "1"; | 374 | responseData["estate_id"] = "1"; |
375 | responseData["neighbours"] = SimNeighboursData; | 375 | responseData["neighbours"] = SimNeighboursData; |
376 | 376 | ||
377 | responseData["sim_ip"] = sim.serverIP; | 377 | responseData["sim_ip"] = sim.serverIP; |
378 | responseData["sim_port"] = sim.serverPort.ToString(); | 378 | responseData["sim_port"] = sim.serverPort.ToString(); |
379 | responseData["asset_url"] = sim.regionAssetURI; | 379 | responseData["asset_url"] = sim.regionAssetURI; |
380 | responseData["asset_sendkey"] = sim.regionAssetSendKey; | 380 | responseData["asset_sendkey"] = sim.regionAssetSendKey; |
381 | responseData["asset_recvkey"] = sim.regionAssetRecvKey; | 381 | responseData["asset_recvkey"] = sim.regionAssetRecvKey; |
382 | responseData["user_url"] = sim.regionUserURI; | 382 | responseData["user_url"] = sim.regionUserURI; |
383 | responseData["user_sendkey"] = sim.regionUserSendKey; | 383 | responseData["user_sendkey"] = sim.regionUserSendKey; |
384 | responseData["user_recvkey"] = sim.regionUserRecvKey; | 384 | responseData["user_recvkey"] = sim.regionUserRecvKey; |
385 | responseData["authkey"] = sim.regionSecret; | 385 | responseData["authkey"] = sim.regionSecret; |
386 | 386 | ||
387 | // New! If set, use as URL to local sim storage (ie http://remotehost/region.Yap) | 387 | // New! If set, use as URL to local sim storage (ie http://remotehost/region.Yap) |
388 | responseData["data_uri"] = sim.regionDataURI; | 388 | responseData["data_uri"] = sim.regionDataURI; |
389 | 389 | ||
390 | responseData["allow_forceful_banlines"] = m_config.AllowForcefulBanlines; | 390 | responseData["allow_forceful_banlines"] = m_config.AllowForcefulBanlines; |
391 | 391 | ||
392 | // Instead of sending a multitude of message servers to the registering sim | 392 | // Instead of sending a multitude of message servers to the registering sim |
393 | // we should probably be sending a single one and parhaps it's backup | 393 | // we should probably be sending a single one and parhaps it's backup |
394 | // that has responsibility over routing it's messages. | 394 | // that has responsibility over routing it's messages. |
395 | 395 | ||
396 | // The Sim won't be contacting us again about any of the message server stuff during it's time up. | 396 | // The Sim won't be contacting us again about any of the message server stuff during it's time up. |
397 | 397 | ||
398 | responseData["messageserver_count"] = 0; | 398 | responseData["messageserver_count"] = 0; |
399 | 399 | ||
400 | // IGridMessagingModule messagingModule; | 400 | // IGridMessagingModule messagingModule; |
401 | // if (m_gridCore.TryGet<IGridMessagingModule>(out messagingModule)) | 401 | // if (m_gridCore.TryGet<IGridMessagingModule>(out messagingModule)) |
402 | //{ | 402 | //{ |
403 | if(m_messagingServerMapper != null) | 403 | if(m_messagingServerMapper != null) |
404 | { | 404 | { |
405 | List<MessageServerInfo> messageServers = m_messagingServerMapper.GetMessageServersList(); | 405 | List<MessageServerInfo> messageServers = m_messagingServerMapper.GetMessageServersList(); |
406 | responseData["messageserver_count"] = messageServers.Count; | 406 | responseData["messageserver_count"] = messageServers.Count; |
407 | 407 | ||
408 | for (int i = 0; i < messageServers.Count; i++) | 408 | for (int i = 0; i < messageServers.Count; i++) |
409 | { | 409 | { |
410 | responseData["messageserver_uri" + i] = messageServers[i].URI; | 410 | responseData["messageserver_uri" + i] = messageServers[i].URI; |
411 | responseData["messageserver_sendkey" + i] = messageServers[i].sendkey; | 411 | responseData["messageserver_sendkey" + i] = messageServers[i].sendkey; |
412 | responseData["messageserver_recvkey" + i] = messageServers[i].recvkey; | 412 | responseData["messageserver_recvkey" + i] = messageServers[i].recvkey; |
413 | } | 413 | } |
414 | } | 414 | } |
415 | return response; | 415 | return response; |
416 | } | 416 | } |
417 | 417 | ||
418 | private ArrayList GetSimNeighboursData(RegionProfileData sim) | 418 | private ArrayList GetSimNeighboursData(RegionProfileData sim) |
419 | { | 419 | { |
420 | ArrayList SimNeighboursData = new ArrayList(); | 420 | ArrayList SimNeighboursData = new ArrayList(); |
421 | 421 | ||
422 | RegionProfileData neighbour; | 422 | RegionProfileData neighbour; |
423 | Hashtable NeighbourBlock; | 423 | Hashtable NeighbourBlock; |
424 | 424 | ||
425 | //First use the fast method. (not implemented in SQLLite) | 425 | //First use the fast method. (not implemented in SQLLite) |
426 | List<RegionProfileData> neighbours = m_gridDBService.GetRegions(sim.regionLocX - 1, sim.regionLocY - 1, sim.regionLocX + 1, sim.regionLocY + 1); | 426 | List<RegionProfileData> neighbours = m_gridDBService.GetRegions(sim.regionLocX - 1, sim.regionLocY - 1, sim.regionLocX + 1, sim.regionLocY + 1); |
427 | 427 | ||
428 | if (neighbours.Count > 0) | 428 | if (neighbours.Count > 0) |
429 | { | 429 | { |
430 | foreach (RegionProfileData aSim in neighbours) | 430 | foreach (RegionProfileData aSim in neighbours) |
431 | { | 431 | { |
432 | NeighbourBlock = new Hashtable(); | 432 | NeighbourBlock = new Hashtable(); |
433 | NeighbourBlock["sim_ip"] = aSim.serverIP; | 433 | NeighbourBlock["sim_ip"] = aSim.serverIP; |
434 | NeighbourBlock["sim_port"] = aSim.serverPort.ToString(); | 434 | NeighbourBlock["sim_port"] = aSim.serverPort.ToString(); |
435 | NeighbourBlock["region_locx"] = aSim.regionLocX.ToString(); | 435 | NeighbourBlock["region_locx"] = aSim.regionLocX.ToString(); |
436 | NeighbourBlock["region_locy"] = aSim.regionLocY.ToString(); | 436 | NeighbourBlock["region_locy"] = aSim.regionLocY.ToString(); |
437 | NeighbourBlock["UUID"] = aSim.ToString(); | 437 | NeighbourBlock["UUID"] = aSim.ToString(); |
438 | NeighbourBlock["regionHandle"] = aSim.regionHandle.ToString(); | 438 | NeighbourBlock["regionHandle"] = aSim.regionHandle.ToString(); |
439 | 439 | ||
440 | if (aSim.UUID != sim.UUID) | 440 | if (aSim.UUID != sim.UUID) |
441 | { | 441 | { |
442 | SimNeighboursData.Add(NeighbourBlock); | 442 | SimNeighboursData.Add(NeighbourBlock); |
443 | } | 443 | } |
444 | } | 444 | } |
445 | } | 445 | } |
446 | else | 446 | else |
447 | { | 447 | { |
448 | for (int x = -1; x < 2; x++) | 448 | for (int x = -1; x < 2; x++) |
449 | { | 449 | { |
450 | for (int y = -1; y < 2; y++) | 450 | for (int y = -1; y < 2; y++) |
451 | { | 451 | { |
452 | if ( | 452 | if ( |
453 | m_gridDBService.GetRegion( | 453 | m_gridDBService.GetRegion( |
454 | Utils.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize), | 454 | Utils.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize), |
455 | (uint)(sim.regionLocY + y) * Constants.RegionSize)) != null) | 455 | (uint)(sim.regionLocY + y) * Constants.RegionSize)) != null) |
456 | { | 456 | { |
457 | neighbour = | 457 | neighbour = |
458 | m_gridDBService.GetRegion( | 458 | m_gridDBService.GetRegion( |
459 | Utils.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize), | 459 | Utils.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize), |
460 | (uint)(sim.regionLocY + y) * Constants.RegionSize)); | 460 | (uint)(sim.regionLocY + y) * Constants.RegionSize)); |
461 | 461 | ||
462 | NeighbourBlock = new Hashtable(); | 462 | NeighbourBlock = new Hashtable(); |
463 | NeighbourBlock["sim_ip"] = neighbour.serverIP; | 463 | NeighbourBlock["sim_ip"] = neighbour.serverIP; |
464 | NeighbourBlock["sim_port"] = neighbour.serverPort.ToString(); | 464 | NeighbourBlock["sim_port"] = neighbour.serverPort.ToString(); |
465 | NeighbourBlock["region_locx"] = neighbour.regionLocX.ToString(); | 465 | NeighbourBlock["region_locx"] = neighbour.regionLocX.ToString(); |
466 | NeighbourBlock["region_locy"] = neighbour.regionLocY.ToString(); | 466 | NeighbourBlock["region_locy"] = neighbour.regionLocY.ToString(); |
467 | NeighbourBlock["UUID"] = neighbour.UUID.ToString(); | 467 | NeighbourBlock["UUID"] = neighbour.UUID.ToString(); |
468 | NeighbourBlock["regionHandle"] = neighbour.regionHandle.ToString(); | 468 | NeighbourBlock["regionHandle"] = neighbour.regionHandle.ToString(); |
469 | 469 | ||
470 | if (neighbour.UUID != sim.UUID) SimNeighboursData.Add(NeighbourBlock); | 470 | if (neighbour.UUID != sim.UUID) SimNeighboursData.Add(NeighbourBlock); |
471 | } | 471 | } |
472 | } | 472 | } |
473 | } | 473 | } |
474 | } | 474 | } |
475 | return SimNeighboursData; | 475 | return SimNeighboursData; |
476 | } | 476 | } |
477 | 477 | ||
478 | /// <summary> | 478 | /// <summary> |
479 | /// Loads the grid's own RegionProfileData object with data from the XMLRPC simulator_login request from a region | 479 | /// Loads the grid's own RegionProfileData object with data from the XMLRPC simulator_login request from a region |
480 | /// </summary> | 480 | /// </summary> |
481 | /// <param name="requestData"></param> | 481 | /// <param name="requestData"></param> |
482 | /// <returns></returns> | 482 | /// <returns></returns> |
483 | private RegionProfileData RegionFromRequest(Hashtable requestData) | 483 | private RegionProfileData RegionFromRequest(Hashtable requestData) |
484 | { | 484 | { |
485 | RegionProfileData sim; | 485 | RegionProfileData sim; |
486 | sim = new RegionProfileData(); | 486 | sim = new RegionProfileData(); |
487 | 487 | ||
488 | sim.UUID = new UUID((string)requestData["UUID"]); | 488 | sim.UUID = new UUID((string)requestData["UUID"]); |
489 | sim.originUUID = new UUID((string)requestData["originUUID"]); | 489 | sim.originUUID = new UUID((string)requestData["originUUID"]); |
490 | 490 | ||
491 | sim.regionRecvKey = String.Empty; | 491 | sim.regionRecvKey = String.Empty; |
492 | sim.regionSendKey = String.Empty; | 492 | sim.regionSendKey = String.Empty; |
493 | 493 | ||
494 | if (requestData.ContainsKey("region_secret")) | 494 | if (requestData.ContainsKey("region_secret")) |
495 | { | 495 | { |
496 | string regionsecret = (string)requestData["region_secret"]; | 496 | string regionsecret = (string)requestData["region_secret"]; |
497 | if (regionsecret.Length > 0) | 497 | if (regionsecret.Length > 0) |
498 | sim.regionSecret = regionsecret; | 498 | sim.regionSecret = regionsecret; |
499 | else | 499 | else |
500 | sim.regionSecret = m_config.SimRecvKey; | 500 | sim.regionSecret = m_config.SimRecvKey; |
501 | 501 | ||
502 | } | 502 | } |
503 | else | 503 | else |
504 | { | 504 | { |
505 | sim.regionSecret = m_config.SimRecvKey; | 505 | sim.regionSecret = m_config.SimRecvKey; |
506 | } | 506 | } |
507 | 507 | ||
508 | sim.regionDataURI = String.Empty; | 508 | sim.regionDataURI = String.Empty; |
509 | sim.regionAssetURI = m_config.DefaultAssetServer; | 509 | sim.regionAssetURI = m_config.DefaultAssetServer; |
510 | sim.regionAssetRecvKey = m_config.AssetRecvKey; | 510 | sim.regionAssetRecvKey = m_config.AssetRecvKey; |
511 | sim.regionAssetSendKey = m_config.AssetSendKey; | 511 | sim.regionAssetSendKey = m_config.AssetSendKey; |
512 | sim.regionUserURI = m_config.DefaultUserServer; | 512 | sim.regionUserURI = m_config.DefaultUserServer; |
513 | sim.regionUserSendKey = m_config.UserSendKey; | 513 | sim.regionUserSendKey = m_config.UserSendKey; |
514 | sim.regionUserRecvKey = m_config.UserRecvKey; | 514 | sim.regionUserRecvKey = m_config.UserRecvKey; |
515 | 515 | ||
516 | sim.serverIP = (string)requestData["sim_ip"]; | 516 | sim.serverIP = (string)requestData["sim_ip"]; |
517 | sim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]); | 517 | sim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]); |
518 | sim.httpPort = Convert.ToUInt32((string)requestData["http_port"]); | 518 | sim.httpPort = Convert.ToUInt32((string)requestData["http_port"]); |
519 | sim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]); | 519 | sim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]); |
520 | sim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]); | 520 | sim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]); |
521 | sim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]); | 521 | sim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]); |
522 | sim.regionLocZ = 0; | 522 | sim.regionLocZ = 0; |
523 | 523 | ||
524 | UUID textureID; | 524 | UUID textureID; |
525 | if (UUID.TryParse((string)requestData["map-image-id"], out textureID)) | 525 | if (UUID.TryParse((string)requestData["map-image-id"], out textureID)) |
526 | { | 526 | { |
527 | sim.regionMapTextureID = textureID; | 527 | sim.regionMapTextureID = textureID; |
528 | } | 528 | } |
529 | 529 | ||
530 | // part of an initial brutish effort to provide accurate information (as per the xml region spec) | 530 | // part of an initial brutish effort to provide accurate information (as per the xml region spec) |
531 | // wrt the ownership of a given region | 531 | // wrt the ownership of a given region |
532 | // the (very bad) assumption is that this value is being read and handled inconsistently or | 532 | // the (very bad) assumption is that this value is being read and handled inconsistently or |
533 | // not at all. Current strategy is to put the code in place to support the validity of this information | 533 | // not at all. Current strategy is to put the code in place to support the validity of this information |
534 | // and to roll forward debugging any issues from that point | 534 | // and to roll forward debugging any issues from that point |
535 | // | 535 | // |
536 | // this particular section of the mod attempts to receive a value from the region's xml file by way of | 536 | // this particular section of the mod attempts to receive a value from the region's xml file by way of |
537 | // OSG1GridServices for the region's owner | 537 | // OSG1GridServices for the region's owner |
538 | sim.owner_uuid = (UUID)(string)requestData["master_avatar_uuid"]; | 538 | sim.owner_uuid = (UUID)(string)requestData["master_avatar_uuid"]; |
539 | 539 | ||
540 | try | 540 | try |
541 | { | 541 | { |
542 | sim.regionRecvKey = (string)requestData["recvkey"]; | 542 | sim.regionRecvKey = (string)requestData["recvkey"]; |
543 | sim.regionSendKey = (string)requestData["authkey"]; | 543 | sim.regionSendKey = (string)requestData["authkey"]; |
544 | } | 544 | } |
545 | catch (KeyNotFoundException) { } | 545 | catch (KeyNotFoundException) { } |
546 | 546 | ||
547 | sim.regionHandle = Utils.UIntsToLong((sim.regionLocX * Constants.RegionSize), (sim.regionLocY * Constants.RegionSize)); | 547 | sim.regionHandle = Utils.UIntsToLong((sim.regionLocX * Constants.RegionSize), (sim.regionLocY * Constants.RegionSize)); |
548 | sim.serverURI = (string)requestData["server_uri"]; | 548 | sim.serverURI = (string)requestData["server_uri"]; |
549 | 549 | ||
550 | sim.httpServerURI = "http://" + sim.serverIP + ":" + sim.httpPort + "/"; | 550 | sim.httpServerURI = "http://" + sim.serverIP + ":" + sim.httpPort + "/"; |
551 | 551 | ||
552 | sim.regionName = (string)requestData["sim_name"]; | 552 | sim.regionName = (string)requestData["sim_name"]; |
553 | return sim; | 553 | return sim; |
554 | } | 554 | } |
555 | 555 | ||
556 | /// <summary> | 556 | /// <summary> |
557 | /// Returns an XML RPC response to a simulator profile request | 557 | /// Returns an XML RPC response to a simulator profile request |
558 | /// Performed after moving a region. | 558 | /// Performed after moving a region. |
559 | /// </summary> | 559 | /// </summary> |
560 | /// <param name="request"></param> | 560 | /// <param name="request"></param> |
561 | /// <returns></returns> | 561 | /// <returns></returns> |
562 | /// <param name="request">The XMLRPC Request</param> | 562 | /// <param name="request">The XMLRPC Request</param> |
563 | /// <returns>Processing parameters</returns> | 563 | /// <returns>Processing parameters</returns> |
564 | public XmlRpcResponse XmlRpcDeleteRegionMethod(XmlRpcRequest request) | 564 | public XmlRpcResponse XmlRpcDeleteRegionMethod(XmlRpcRequest request) |
565 | { | 565 | { |
566 | XmlRpcResponse response = new XmlRpcResponse(); | 566 | XmlRpcResponse response = new XmlRpcResponse(); |
567 | Hashtable responseData = new Hashtable(); | 567 | Hashtable responseData = new Hashtable(); |
568 | response.Value = responseData; | 568 | response.Value = responseData; |
569 | 569 | ||
570 | //RegionProfileData TheSim = null; | 570 | //RegionProfileData TheSim = null; |
571 | string uuid; | 571 | string uuid; |
572 | Hashtable requestData = (Hashtable)request.Params[0]; | 572 | Hashtable requestData = (Hashtable)request.Params[0]; |
573 | 573 | ||
574 | if (requestData.ContainsKey("UUID")) | 574 | if (requestData.ContainsKey("UUID")) |
575 | { | 575 | { |
576 | //TheSim = GetRegion(new UUID((string) requestData["UUID"])); | 576 | //TheSim = GetRegion(new UUID((string) requestData["UUID"])); |
577 | uuid = requestData["UUID"].ToString(); | 577 | uuid = requestData["UUID"].ToString(); |
578 | m_log.InfoFormat("[LOGOUT]: Logging out region: {0}", uuid); | 578 | m_log.InfoFormat("[LOGOUT]: Logging out region: {0}", uuid); |
579 | // logToDB((new LLUUID((string)requestData["UUID"])).ToString(),"XmlRpcDeleteRegionMethod","", 5,"Attempting delete with UUID."); | 579 | // logToDB((new LLUUID((string)requestData["UUID"])).ToString(),"XmlRpcDeleteRegionMethod","", 5,"Attempting delete with UUID."); |
580 | } | 580 | } |
581 | else | 581 | else |
582 | { | 582 | { |
583 | responseData["error"] = "No UUID or region_handle passed to grid server - unable to delete"; | 583 | responseData["error"] = "No UUID or region_handle passed to grid server - unable to delete"; |
584 | return response; | 584 | return response; |
585 | } | 585 | } |
586 | 586 | ||
587 | DataResponse insertResponse = m_gridDBService.DeleteRegion(uuid); | 587 | DataResponse insertResponse = m_gridDBService.DeleteRegion(uuid); |
588 | 588 | ||
589 | string insertResp = ""; | 589 | string insertResp = ""; |
590 | switch (insertResponse) | 590 | switch (insertResponse) |
591 | { | 591 | { |
592 | case DataResponse.RESPONSE_OK: | 592 | case DataResponse.RESPONSE_OK: |
593 | //MainLog.Instance.Verbose("grid", "Deleting region successful: " + uuid); | 593 | //MainLog.Instance.Verbose("grid", "Deleting region successful: " + uuid); |
594 | insertResp = "Deleting region successful: " + uuid; | 594 | insertResp = "Deleting region successful: " + uuid; |
595 | break; | 595 | break; |
596 | case DataResponse.RESPONSE_ERROR: | 596 | case DataResponse.RESPONSE_ERROR: |
597 | //MainLog.Instance.Warn("storage", "Deleting region failed (Error): " + uuid); | 597 | //MainLog.Instance.Warn("storage", "Deleting region failed (Error): " + uuid); |
598 | insertResp = "Deleting region failed (Error): " + uuid; | 598 | insertResp = "Deleting region failed (Error): " + uuid; |
599 | break; | 599 | break; |
600 | case DataResponse.RESPONSE_INVALIDCREDENTIALS: | 600 | case DataResponse.RESPONSE_INVALIDCREDENTIALS: |
601 | //MainLog.Instance.Warn("storage", "Deleting region failed (Invalid Credentials): " + uuid); | 601 | //MainLog.Instance.Warn("storage", "Deleting region failed (Invalid Credentials): " + uuid); |
602 | insertResp = "Deleting region (Invalid Credentials): " + uuid; | 602 | insertResp = "Deleting region (Invalid Credentials): " + uuid; |
603 | break; | 603 | break; |
604 | case DataResponse.RESPONSE_AUTHREQUIRED: | 604 | case DataResponse.RESPONSE_AUTHREQUIRED: |
605 | //MainLog.Instance.Warn("storage", "Deleting region failed (Authentication Required): " + uuid); | 605 | //MainLog.Instance.Warn("storage", "Deleting region failed (Authentication Required): " + uuid); |
606 | insertResp = "Deleting region (Authentication Required): " + uuid; | 606 | insertResp = "Deleting region (Authentication Required): " + uuid; |
607 | break; | 607 | break; |
608 | } | 608 | } |
609 | 609 | ||
610 | responseData["status"] = insertResp; | 610 | responseData["status"] = insertResp; |
611 | 611 | ||
612 | return response; | 612 | return response; |
613 | } | 613 | } |
614 | 614 | ||
615 | /// <summary> | 615 | /// <summary> |
616 | /// Returns an XML RPC response to a simulator profile request | 616 | /// Returns an XML RPC response to a simulator profile request |
617 | /// </summary> | 617 | /// </summary> |
618 | /// <param name="request"></param> | 618 | /// <param name="request"></param> |
619 | /// <returns></returns> | 619 | /// <returns></returns> |
620 | public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request) | 620 | public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request) |
621 | { | 621 | { |
622 | Hashtable requestData = (Hashtable)request.Params[0]; | 622 | Hashtable requestData = (Hashtable)request.Params[0]; |
623 | Hashtable responseData = new Hashtable(); | 623 | Hashtable responseData = new Hashtable(); |
624 | RegionProfileData simData = null; | 624 | RegionProfileData simData = null; |
625 | if (requestData.ContainsKey("region_UUID")) | 625 | if (requestData.ContainsKey("region_UUID")) |
626 | { | 626 | { |
627 | UUID regionID = new UUID((string)requestData["region_UUID"]); | 627 | UUID regionID = new UUID((string)requestData["region_UUID"]); |
628 | simData = m_gridDBService.GetRegion(regionID); | 628 | simData = m_gridDBService.GetRegion(regionID); |
629 | if (simData == null) | 629 | if (simData == null) |
630 | { | 630 | { |
631 | m_log.WarnFormat("[DATA] didn't find region for regionID {0} from {1}", | 631 | m_log.WarnFormat("[DATA] didn't find region for regionID {0} from {1}", |
632 | regionID, request.Params.Count > 1 ? request.Params[1] : "unknwon source"); | 632 | regionID, request.Params.Count > 1 ? request.Params[1] : "unknwon source"); |
633 | } | 633 | } |
634 | } | 634 | } |
635 | else if (requestData.ContainsKey("region_handle")) | 635 | else if (requestData.ContainsKey("region_handle")) |
636 | { | 636 | { |
637 | //CFK: The if/else below this makes this message redundant. | 637 | //CFK: The if/else below this makes this message redundant. |
638 | //CFK: m_log.Info("requesting data for region " + (string) requestData["region_handle"]); | 638 | //CFK: m_log.Info("requesting data for region " + (string) requestData["region_handle"]); |
639 | ulong regionHandle = Convert.ToUInt64((string)requestData["region_handle"]); | 639 | ulong regionHandle = Convert.ToUInt64((string)requestData["region_handle"]); |
640 | simData = m_gridDBService.GetRegion(regionHandle); | 640 | simData = m_gridDBService.GetRegion(regionHandle); |
641 | if (simData == null) | 641 | if (simData == null) |
642 | { | 642 | { |
643 | m_log.WarnFormat("[DATA] didn't find region for regionHandle {0} from {1}", | 643 | m_log.WarnFormat("[DATA] didn't find region for regionHandle {0} from {1}", |
644 | regionHandle, request.Params.Count > 1 ? request.Params[1] : "unknwon source"); | 644 | regionHandle, request.Params.Count > 1 ? request.Params[1] : "unknwon source"); |
645 | } | 645 | } |
646 | } | 646 | } |
647 | else if (requestData.ContainsKey("region_name_search")) | 647 | else if (requestData.ContainsKey("region_name_search")) |
648 | { | 648 | { |
649 | string regionName = (string)requestData["region_name_search"]; | 649 | string regionName = (string)requestData["region_name_search"]; |
650 | simData = m_gridDBService.GetRegion(regionName); | 650 | simData = m_gridDBService.GetRegion(regionName); |
651 | if (simData == null) | 651 | if (simData == null) |
652 | { | 652 | { |
653 | m_log.WarnFormat("[DATA] didn't find region for regionName {0} from {1}", | 653 | m_log.WarnFormat("[DATA] didn't find region for regionName {0} from {1}", |
654 | regionName, request.Params.Count > 1 ? request.Params[1] : "unknwon source"); | 654 | regionName, request.Params.Count > 1 ? request.Params[1] : "unknwon source"); |
655 | } | 655 | } |
656 | } | 656 | } |
657 | else m_log.Warn("[DATA] regionlookup without regionID, regionHandle or regionHame"); | 657 | else m_log.Warn("[DATA] regionlookup without regionID, regionHandle or regionHame"); |
658 | 658 | ||
659 | if (simData == null) | 659 | if (simData == null) |
660 | { | 660 | { |
661 | //Sim does not exist | 661 | //Sim does not exist |
662 | responseData["error"] = "Sim does not exist"; | 662 | responseData["error"] = "Sim does not exist"; |
663 | } | 663 | } |
664 | else | 664 | else |
665 | { | 665 | { |
666 | m_log.Info("[DATA]: found " + (string)simData.regionName + " regionHandle = " + | 666 | m_log.Info("[DATA]: found " + (string)simData.regionName + " regionHandle = " + |
667 | (string)requestData["region_handle"]); | 667 | (string)requestData["region_handle"]); |
668 | responseData["sim_ip"] = simData.serverIP; | 668 | responseData["sim_ip"] = simData.serverIP; |
669 | responseData["sim_port"] = simData.serverPort.ToString(); | 669 | responseData["sim_port"] = simData.serverPort.ToString(); |
670 | responseData["server_uri"] = simData.serverURI; | 670 | responseData["server_uri"] = simData.serverURI; |
671 | responseData["http_port"] = simData.httpPort.ToString(); | 671 | responseData["http_port"] = simData.httpPort.ToString(); |
672 | responseData["remoting_port"] = simData.remotingPort.ToString(); | 672 | responseData["remoting_port"] = simData.remotingPort.ToString(); |
673 | responseData["region_locx"] = simData.regionLocX.ToString(); | 673 | responseData["region_locx"] = simData.regionLocX.ToString(); |
674 | responseData["region_locy"] = simData.regionLocY.ToString(); | 674 | responseData["region_locy"] = simData.regionLocY.ToString(); |
675 | responseData["region_UUID"] = simData.UUID.Guid.ToString(); | 675 | responseData["region_UUID"] = simData.UUID.Guid.ToString(); |
676 | responseData["region_name"] = simData.regionName; | 676 | responseData["region_name"] = simData.regionName; |
677 | responseData["regionHandle"] = simData.regionHandle.ToString(); | 677 | responseData["regionHandle"] = simData.regionHandle.ToString(); |
678 | } | 678 | } |
679 | 679 | ||
680 | XmlRpcResponse response = new XmlRpcResponse(); | 680 | XmlRpcResponse response = new XmlRpcResponse(); |
681 | response.Value = responseData; | 681 | response.Value = responseData; |
682 | return response; | 682 | return response; |
683 | } | 683 | } |
684 | 684 | ||
685 | public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request) | 685 | public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request) |
686 | { | 686 | { |
687 | int xmin = 980, ymin = 980, xmax = 1020, ymax = 1020; | 687 | int xmin = 980, ymin = 980, xmax = 1020, ymax = 1020; |
688 | 688 | ||
689 | Hashtable requestData = (Hashtable)request.Params[0]; | 689 | Hashtable requestData = (Hashtable)request.Params[0]; |
690 | if (requestData.ContainsKey("xmin")) | 690 | if (requestData.ContainsKey("xmin")) |
691 | { | 691 | { |
692 | xmin = (Int32)requestData["xmin"]; | 692 | xmin = (Int32)requestData["xmin"]; |
693 | } | 693 | } |
694 | if (requestData.ContainsKey("ymin")) | 694 | if (requestData.ContainsKey("ymin")) |
695 | { | 695 | { |
696 | ymin = (Int32)requestData["ymin"]; | 696 | ymin = (Int32)requestData["ymin"]; |
697 | } | 697 | } |
698 | if (requestData.ContainsKey("xmax")) | 698 | if (requestData.ContainsKey("xmax")) |
699 | { | 699 | { |
700 | xmax = (Int32)requestData["xmax"]; | 700 | xmax = (Int32)requestData["xmax"]; |
701 | } | 701 | } |
702 | if (requestData.ContainsKey("ymax")) | 702 | if (requestData.ContainsKey("ymax")) |
703 | { | 703 | { |
704 | ymax = (Int32)requestData["ymax"]; | 704 | ymax = (Int32)requestData["ymax"]; |
705 | } | 705 | } |
706 | //CFK: The second log is more meaningful and either standard or fast generally occurs. | 706 | //CFK: The second log is more meaningful and either standard or fast generally occurs. |
707 | //CFK: m_log.Info("[MAP]: World map request for range (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); | 707 | //CFK: m_log.Info("[MAP]: World map request for range (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); |
708 | 708 | ||
709 | XmlRpcResponse response = new XmlRpcResponse(); | 709 | XmlRpcResponse response = new XmlRpcResponse(); |
710 | Hashtable responseData = new Hashtable(); | 710 | Hashtable responseData = new Hashtable(); |
711 | response.Value = responseData; | 711 | response.Value = responseData; |
712 | IList simProfileList = new ArrayList(); | 712 | IList simProfileList = new ArrayList(); |
713 | 713 | ||
714 | bool fastMode = (m_config.DatabaseProvider == "OpenSim.Data.MySQL.dll" || m_config.DatabaseProvider == "OpenSim.Data.MSSQL.dll"); | 714 | bool fastMode = (m_config.DatabaseProvider == "OpenSim.Data.MySQL.dll" || m_config.DatabaseProvider == "OpenSim.Data.MSSQL.dll"); |
715 | 715 | ||
716 | if (fastMode) | 716 | if (fastMode) |
717 | { | 717 | { |
718 | List<RegionProfileData> neighbours = m_gridDBService.GetRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax); | 718 | List<RegionProfileData> neighbours = m_gridDBService.GetRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax); |
719 | 719 | ||
720 | foreach (RegionProfileData aSim in neighbours) | 720 | foreach (RegionProfileData aSim in neighbours) |
721 | { | 721 | { |
722 | Hashtable simProfileBlock = new Hashtable(); | 722 | Hashtable simProfileBlock = new Hashtable(); |
723 | simProfileBlock["x"] = aSim.regionLocX.ToString(); | 723 | simProfileBlock["x"] = aSim.regionLocX.ToString(); |
724 | simProfileBlock["y"] = aSim.regionLocY.ToString(); | 724 | simProfileBlock["y"] = aSim.regionLocY.ToString(); |
725 | //m_log.DebugFormat("[MAP]: Sending neighbour info for {0},{1}", aSim.regionLocX, aSim.regionLocY); | 725 | //m_log.DebugFormat("[MAP]: Sending neighbour info for {0},{1}", aSim.regionLocX, aSim.regionLocY); |
726 | simProfileBlock["name"] = aSim.regionName; | 726 | simProfileBlock["name"] = aSim.regionName; |
727 | simProfileBlock["access"] = 21; | 727 | simProfileBlock["access"] = 21; |
728 | simProfileBlock["region-flags"] = 512; | 728 | simProfileBlock["region-flags"] = 512; |
729 | simProfileBlock["water-height"] = 0; | 729 | simProfileBlock["water-height"] = 0; |
730 | simProfileBlock["agents"] = 1; | 730 | simProfileBlock["agents"] = 1; |
731 | simProfileBlock["map-image-id"] = aSim.regionMapTextureID.ToString(); | 731 | simProfileBlock["map-image-id"] = aSim.regionMapTextureID.ToString(); |
732 | 732 | ||
733 | // For Sugilite compatibility | 733 | // For Sugilite compatibility |
734 | simProfileBlock["regionhandle"] = aSim.regionHandle.ToString(); | 734 | simProfileBlock["regionhandle"] = aSim.regionHandle.ToString(); |
735 | simProfileBlock["sim_ip"] = aSim.serverIP; | 735 | simProfileBlock["sim_ip"] = aSim.serverIP; |
736 | simProfileBlock["sim_port"] = aSim.serverPort.ToString(); | 736 | simProfileBlock["sim_port"] = aSim.serverPort.ToString(); |
737 | simProfileBlock["sim_uri"] = aSim.serverURI.ToString(); | 737 | simProfileBlock["sim_uri"] = aSim.serverURI.ToString(); |
738 | simProfileBlock["uuid"] = aSim.UUID.ToString(); | 738 | simProfileBlock["uuid"] = aSim.UUID.ToString(); |
739 | simProfileBlock["remoting_port"] = aSim.remotingPort.ToString(); | 739 | simProfileBlock["remoting_port"] = aSim.remotingPort.ToString(); |
740 | simProfileBlock["http_port"] = aSim.httpPort.ToString(); | 740 | simProfileBlock["http_port"] = aSim.httpPort.ToString(); |
741 | 741 | ||
742 | simProfileList.Add(simProfileBlock); | 742 | simProfileList.Add(simProfileBlock); |
743 | } | 743 | } |
744 | m_log.Info("[MAP]: Fast map " + simProfileList.Count.ToString() + | 744 | m_log.Info("[MAP]: Fast map " + simProfileList.Count.ToString() + |
745 | " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); | 745 | " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); |
746 | } | 746 | } |
747 | else | 747 | else |
748 | { | 748 | { |
749 | RegionProfileData simProfile; | 749 | RegionProfileData simProfile; |
750 | for (int x = xmin; x < xmax + 1; x++) | 750 | for (int x = xmin; x < xmax + 1; x++) |
751 | { | 751 | { |
752 | for (int y = ymin; y < ymax + 1; y++) | 752 | for (int y = ymin; y < ymax + 1; y++) |
753 | { | 753 | { |
754 | ulong regHandle = Utils.UIntsToLong((uint)(x * Constants.RegionSize), (uint)(y * Constants.RegionSize)); | 754 | ulong regHandle = Utils.UIntsToLong((uint)(x * Constants.RegionSize), (uint)(y * Constants.RegionSize)); |
755 | simProfile = m_gridDBService.GetRegion(regHandle); | 755 | simProfile = m_gridDBService.GetRegion(regHandle); |
756 | if (simProfile != null) | 756 | if (simProfile != null) |
757 | { | 757 | { |
758 | Hashtable simProfileBlock = new Hashtable(); | 758 | Hashtable simProfileBlock = new Hashtable(); |
759 | simProfileBlock["x"] = x; | 759 | simProfileBlock["x"] = x; |
760 | simProfileBlock["y"] = y; | 760 | simProfileBlock["y"] = y; |
761 | simProfileBlock["name"] = simProfile.regionName; | 761 | simProfileBlock["name"] = simProfile.regionName; |
762 | simProfileBlock["access"] = 0; | 762 | simProfileBlock["access"] = 0; |
763 | simProfileBlock["region-flags"] = 0; | 763 | simProfileBlock["region-flags"] = 0; |
764 | simProfileBlock["water-height"] = 20; | 764 | simProfileBlock["water-height"] = 20; |
765 | simProfileBlock["agents"] = 1; | 765 | simProfileBlock["agents"] = 1; |
766 | simProfileBlock["map-image-id"] = simProfile.regionMapTextureID.ToString(); | 766 | simProfileBlock["map-image-id"] = simProfile.regionMapTextureID.ToString(); |
767 | 767 | ||
768 | // For Sugilite compatibility | 768 | // For Sugilite compatibility |
769 | simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString(); | 769 | simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString(); |
770 | simProfileBlock["sim_ip"] = simProfile.serverIP.ToString(); | 770 | simProfileBlock["sim_ip"] = simProfile.serverIP.ToString(); |
771 | simProfileBlock["sim_port"] = simProfile.serverPort.ToString(); | 771 | simProfileBlock["sim_port"] = simProfile.serverPort.ToString(); |
772 | simProfileBlock["sim_uri"] = simProfile.serverURI.ToString(); | 772 | simProfileBlock["sim_uri"] = simProfile.serverURI.ToString(); |
773 | simProfileBlock["uuid"] = simProfile.UUID.ToString(); | 773 | simProfileBlock["uuid"] = simProfile.UUID.ToString(); |
774 | simProfileBlock["remoting_port"] = simProfile.remotingPort.ToString(); | 774 | simProfileBlock["remoting_port"] = simProfile.remotingPort.ToString(); |
775 | simProfileBlock["http_port"] = simProfile.httpPort; | 775 | simProfileBlock["http_port"] = simProfile.httpPort; |
776 | 776 | ||
777 | simProfileList.Add(simProfileBlock); | 777 | simProfileList.Add(simProfileBlock); |
778 | } | 778 | } |
779 | } | 779 | } |
780 | } | 780 | } |
781 | m_log.Info("[MAP]: Std map " + simProfileList.Count.ToString() + | 781 | m_log.Info("[MAP]: Std map " + simProfileList.Count.ToString() + |
782 | " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); | 782 | " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); |
783 | } | 783 | } |
784 | 784 | ||
785 | responseData["sim-profiles"] = simProfileList; | 785 | responseData["sim-profiles"] = simProfileList; |
786 | 786 | ||
787 | return response; | 787 | return response; |
788 | } | 788 | } |
789 | 789 | ||
790 | /// <summary> | 790 | /// <summary> |
791 | /// Returns up to <code>maxNumber</code> profiles of regions that have a name starting with <code>name</code> | 791 | /// Returns up to <code>maxNumber</code> profiles of regions that have a name starting with <code>name</code> |
792 | /// </summary> | 792 | /// </summary> |
793 | /// <param name="request"></param> | 793 | /// <param name="request"></param> |
794 | /// <returns></returns> | 794 | /// <returns></returns> |
795 | public XmlRpcResponse XmlRpcSearchForRegionMethod(XmlRpcRequest request) | 795 | public XmlRpcResponse XmlRpcSearchForRegionMethod(XmlRpcRequest request) |
796 | { | 796 | { |
797 | Hashtable requestData = (Hashtable)request.Params[0]; | 797 | Hashtable requestData = (Hashtable)request.Params[0]; |
798 | 798 | ||
799 | if (!requestData.ContainsKey("name") || !requestData.Contains("maxNumber")) | 799 | if (!requestData.ContainsKey("name") || !requestData.Contains("maxNumber")) |
800 | { | 800 | { |
801 | m_log.Warn("[DATA] Invalid region-search request; missing name or maxNumber"); | 801 | m_log.Warn("[DATA] Invalid region-search request; missing name or maxNumber"); |
802 | return new XmlRpcResponse(500, "Missing name or maxNumber in region search request"); | 802 | return new XmlRpcResponse(500, "Missing name or maxNumber in region search request"); |
803 | } | 803 | } |
804 | 804 | ||
805 | Hashtable responseData = new Hashtable(); | 805 | Hashtable responseData = new Hashtable(); |
806 | 806 | ||
807 | string name = (string)requestData["name"]; | 807 | string name = (string)requestData["name"]; |
808 | int maxNumber = Convert.ToInt32((string)requestData["maxNumber"]); | 808 | int maxNumber = Convert.ToInt32((string)requestData["maxNumber"]); |
809 | if (maxNumber == 0 || name.Length < 3) | 809 | if (maxNumber == 0 || name.Length < 3) |
810 | { | 810 | { |
811 | // either we didn't want any, or we were too unspecific | 811 | // either we didn't want any, or we were too unspecific |
812 | responseData["numFound"] = 0; | 812 | responseData["numFound"] = 0; |
813 | } | 813 | } |
814 | else | 814 | else |
815 | { | 815 | { |
816 | List<RegionProfileData> sims = m_gridDBService.GetRegions(name, maxNumber); | 816 | List<RegionProfileData> sims = m_gridDBService.GetRegions(name, maxNumber); |
817 | 817 | ||
818 | responseData["numFound"] = sims.Count; | 818 | responseData["numFound"] = sims.Count; |
819 | for (int i = 0; i < sims.Count; ++i) | 819 | for (int i = 0; i < sims.Count; ++i) |
820 | { | 820 | { |
821 | RegionProfileData sim = sims[i]; | 821 | RegionProfileData sim = sims[i]; |
822 | string prefix = "region" + i + "."; | 822 | string prefix = "region" + i + "."; |
823 | responseData[prefix + "region_name"] = sim.regionName; | 823 | responseData[prefix + "region_name"] = sim.regionName; |
824 | responseData[prefix + "region_UUID"] = sim.UUID.ToString(); | 824 | responseData[prefix + "region_UUID"] = sim.UUID.ToString(); |
825 | responseData[prefix + "region_locx"] = sim.regionLocX.ToString(); | 825 | responseData[prefix + "region_locx"] = sim.regionLocX.ToString(); |
826 | responseData[prefix + "region_locy"] = sim.regionLocY.ToString(); | 826 | responseData[prefix + "region_locy"] = sim.regionLocY.ToString(); |
827 | responseData[prefix + "sim_ip"] = sim.serverIP.ToString(); | 827 | responseData[prefix + "sim_ip"] = sim.serverIP.ToString(); |
828 | responseData[prefix + "sim_port"] = sim.serverPort.ToString(); | 828 | responseData[prefix + "sim_port"] = sim.serverPort.ToString(); |
829 | responseData[prefix + "remoting_port"] = sim.remotingPort.ToString(); | 829 | responseData[prefix + "remoting_port"] = sim.remotingPort.ToString(); |
830 | responseData[prefix + "http_port"] = sim.httpPort.ToString(); | 830 | responseData[prefix + "http_port"] = sim.httpPort.ToString(); |
831 | responseData[prefix + "map_UUID"] = sim.regionMapTextureID.ToString(); | 831 | responseData[prefix + "map_UUID"] = sim.regionMapTextureID.ToString(); |
832 | } | 832 | } |
833 | } | 833 | } |
834 | 834 | ||
835 | XmlRpcResponse response = new XmlRpcResponse(); | 835 | XmlRpcResponse response = new XmlRpcResponse(); |
836 | response.Value = responseData; | 836 | response.Value = responseData; |
837 | return response; | 837 | return response; |
838 | } | 838 | } |
839 | 839 | ||
840 | /// <summary> | 840 | /// <summary> |
841 | /// Construct an XMLRPC registration disabled response | 841 | /// Construct an XMLRPC registration disabled response |
842 | /// </summary> | 842 | /// </summary> |
843 | /// <param name="error"></param> | 843 | /// <param name="error"></param> |
844 | /// <returns></returns> | 844 | /// <returns></returns> |
845 | public static XmlRpcResponse XmlRPCRegionRegistrationDisabledResponse(string error) | 845 | public static XmlRpcResponse XmlRPCRegionRegistrationDisabledResponse(string error) |
846 | { | 846 | { |
847 | XmlRpcResponse errorResponse = new XmlRpcResponse(); | 847 | XmlRpcResponse errorResponse = new XmlRpcResponse(); |
848 | Hashtable errorResponseData = new Hashtable(); | 848 | Hashtable errorResponseData = new Hashtable(); |
849 | errorResponse.Value = errorResponseData; | 849 | errorResponse.Value = errorResponseData; |
850 | errorResponseData["restricted"] = error; | 850 | errorResponseData["restricted"] = error; |
851 | return errorResponse; | 851 | return errorResponse; |
852 | } | 852 | } |
853 | } | 853 | } |
854 | 854 | ||
855 | /// <summary> | 855 | /// <summary> |
856 | /// Exception generated when a simulator fails to login to the grid | 856 | /// Exception generated when a simulator fails to login to the grid |
857 | /// </summary> | 857 | /// </summary> |
858 | public class LoginException : Exception | 858 | public class LoginException : Exception |
859 | { | 859 | { |
860 | /// <summary> | 860 | /// <summary> |
861 | /// Return an XmlRpcResponse version of the exception message suitable for sending to a client | 861 | /// Return an XmlRpcResponse version of the exception message suitable for sending to a client |
862 | /// </summary> | 862 | /// </summary> |
863 | /// <param name="message"></param> | 863 | /// <param name="message"></param> |
864 | /// <param name="xmlRpcMessage"></param> | 864 | /// <param name="xmlRpcMessage"></param> |
865 | public XmlRpcResponse XmlRpcErrorResponse | 865 | public XmlRpcResponse XmlRpcErrorResponse |
866 | { | 866 | { |
867 | get { return m_xmlRpcErrorResponse; } | 867 | get { return m_xmlRpcErrorResponse; } |
868 | } | 868 | } |
869 | private XmlRpcResponse m_xmlRpcErrorResponse; | 869 | private XmlRpcResponse m_xmlRpcErrorResponse; |
870 | 870 | ||
871 | public LoginException(string message, string xmlRpcMessage) | 871 | public LoginException(string message, string xmlRpcMessage) |
872 | : base(message) | 872 | : base(message) |
873 | { | 873 | { |
874 | // FIXME: Might be neater to refactor and put the method inside here | 874 | // FIXME: Might be neater to refactor and put the method inside here |
875 | m_xmlRpcErrorResponse = GridXmlRpcModule.ErrorResponse(xmlRpcMessage); | 875 | m_xmlRpcErrorResponse = GridXmlRpcModule.ErrorResponse(xmlRpcMessage); |
876 | } | 876 | } |
877 | 877 | ||
878 | public LoginException(string message, string xmlRpcMessage, Exception e) | 878 | public LoginException(string message, string xmlRpcMessage, Exception e) |
879 | : base(message, e) | 879 | : base(message, e) |
880 | { | 880 | { |
881 | // FIXME: Might be neater to refactor and put the method inside here | 881 | // FIXME: Might be neater to refactor and put the method inside here |
882 | m_xmlRpcErrorResponse = GridXmlRpcModule.ErrorResponse(xmlRpcMessage); | 882 | m_xmlRpcErrorResponse = GridXmlRpcModule.ErrorResponse(xmlRpcMessage); |
883 | } | 883 | } |
884 | } | 884 | } |
885 | } | 885 | } |
diff --git a/OpenSim/Grid/MessagingServer.Modules/MessageRegionModule.cs b/OpenSim/Grid/MessagingServer.Modules/MessageRegionModule.cs index f77ef4b..7b3edfb 100644 --- a/OpenSim/Grid/MessagingServer.Modules/MessageRegionModule.cs +++ b/OpenSim/Grid/MessagingServer.Modules/MessageRegionModule.cs | |||
@@ -1,213 +1,213 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Net; | 31 | using System.Net; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Threading; | 33 | using System.Threading; |
34 | using System.Timers; | 34 | using System.Timers; |
35 | using log4net; | 35 | using log4net; |
36 | using Nwc.XmlRpc; | 36 | using Nwc.XmlRpc; |
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
38 | using OpenSim.Data; | 38 | using OpenSim.Data; |
39 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
40 | using OpenSim.Grid.Framework; | 40 | using OpenSim.Grid.Framework; |
41 | using Timer = System.Timers.Timer; | 41 | using Timer = System.Timers.Timer; |
42 | 42 | ||
43 | namespace OpenSim.Grid.MessagingServer.Modules | 43 | namespace OpenSim.Grid.MessagingServer.Modules |
44 | { | 44 | { |
45 | public class MessageRegionModule : IMessageRegionService | 45 | public class MessageRegionModule : IMessageRegionService |
46 | { | 46 | { |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | private MessageServerConfig m_cfg; | 49 | private MessageServerConfig m_cfg; |
50 | 50 | ||
51 | private IMessageUserServerService m_userServerModule; | 51 | private IMessageUserServerService m_userServerModule; |
52 | 52 | ||
53 | private IUGAIMCore m_messageCore; | 53 | private IUGAIMCore m_messageCore; |
54 | 54 | ||
55 | // a dictionary of all current regions this server knows about | 55 | // a dictionary of all current regions this server knows about |
56 | private Dictionary<ulong, RegionProfileData> m_regionInfoCache = new Dictionary<ulong, RegionProfileData>(); | 56 | private Dictionary<ulong, RegionProfileData> m_regionInfoCache = new Dictionary<ulong, RegionProfileData>(); |
57 | 57 | ||
58 | public MessageRegionModule(MessageServerConfig config, IUGAIMCore messageCore) | 58 | public MessageRegionModule(MessageServerConfig config, IUGAIMCore messageCore) |
59 | { | 59 | { |
60 | m_cfg = config; | 60 | m_cfg = config; |
61 | m_messageCore = messageCore; | 61 | m_messageCore = messageCore; |
62 | } | 62 | } |
63 | 63 | ||
64 | public void Initialise() | 64 | public void Initialise() |
65 | { | 65 | { |
66 | m_messageCore.RegisterInterface<IMessageRegionService>(this); | 66 | m_messageCore.RegisterInterface<IMessageRegionService>(this); |
67 | } | 67 | } |
68 | 68 | ||
69 | public void PostInitialise() | 69 | public void PostInitialise() |
70 | { | 70 | { |
71 | IMessageUserServerService messageUserServer; | 71 | IMessageUserServerService messageUserServer; |
72 | if (m_messageCore.TryGet<IMessageUserServerService>(out messageUserServer)) | 72 | if (m_messageCore.TryGet<IMessageUserServerService>(out messageUserServer)) |
73 | { | 73 | { |
74 | m_userServerModule = messageUserServer; | 74 | m_userServerModule = messageUserServer; |
75 | } | 75 | } |
76 | } | 76 | } |
77 | 77 | ||
78 | public void RegisterHandlers() | 78 | public void RegisterHandlers() |
79 | { | 79 | { |
80 | //have these in separate method as some servers restart the http server and reregister all the handlers. | 80 | //have these in separate method as some servers restart the http server and reregister all the handlers. |
81 | 81 | ||
82 | } | 82 | } |
83 | 83 | ||
84 | /// <summary> | 84 | /// <summary> |
85 | /// Gets and caches a RegionInfo object from the gridserver based on regionhandle | 85 | /// Gets and caches a RegionInfo object from the gridserver based on regionhandle |
86 | /// if the regionhandle is already cached, use the cached values | 86 | /// if the regionhandle is already cached, use the cached values |
87 | /// Gets called by lots of threads!!!!! | 87 | /// Gets called by lots of threads!!!!! |
88 | /// </summary> | 88 | /// </summary> |
89 | /// <param name="regionhandle">handle to the XY of the region we're looking for</param> | 89 | /// <param name="regionhandle">handle to the XY of the region we're looking for</param> |
90 | /// <returns>A RegionInfo object to stick in the presence info</returns> | 90 | /// <returns>A RegionInfo object to stick in the presence info</returns> |
91 | public RegionProfileData GetRegionInfo(ulong regionhandle) | 91 | public RegionProfileData GetRegionInfo(ulong regionhandle) |
92 | { | 92 | { |
93 | RegionProfileData regionInfo = null; | 93 | RegionProfileData regionInfo = null; |
94 | 94 | ||
95 | lock (m_regionInfoCache) | 95 | lock (m_regionInfoCache) |
96 | { | 96 | { |
97 | m_regionInfoCache.TryGetValue(regionhandle, out regionInfo); | 97 | m_regionInfoCache.TryGetValue(regionhandle, out regionInfo); |
98 | } | 98 | } |
99 | 99 | ||
100 | if (regionInfo == null) // not found in cache | 100 | if (regionInfo == null) // not found in cache |
101 | { | 101 | { |
102 | regionInfo = RequestRegionInfo(regionhandle); | 102 | regionInfo = RequestRegionInfo(regionhandle); |
103 | 103 | ||
104 | if (regionInfo != null) // lookup was successful | 104 | if (regionInfo != null) // lookup was successful |
105 | { | 105 | { |
106 | lock (m_regionInfoCache) | 106 | lock (m_regionInfoCache) |
107 | { | 107 | { |
108 | m_regionInfoCache[regionhandle] = regionInfo; | 108 | m_regionInfoCache[regionhandle] = regionInfo; |
109 | } | 109 | } |
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
113 | return regionInfo; | 113 | return regionInfo; |
114 | } | 114 | } |
115 | 115 | ||
116 | public int ClearRegionCache() | 116 | public int ClearRegionCache() |
117 | { | 117 | { |
118 | int cachecount = 0; | 118 | int cachecount = 0; |
119 | 119 | ||
120 | lock (m_regionInfoCache) | 120 | lock (m_regionInfoCache) |
121 | { | 121 | { |
122 | cachecount = m_regionInfoCache.Count; | 122 | cachecount = m_regionInfoCache.Count; |
123 | m_regionInfoCache.Clear(); | 123 | m_regionInfoCache.Clear(); |
124 | } | 124 | } |
125 | 125 | ||
126 | return cachecount; | 126 | return cachecount; |
127 | } | 127 | } |
128 | 128 | ||
129 | /// <summary> | 129 | /// <summary> |
130 | /// Get RegionProfileData from the GridServer. | 130 | /// Get RegionProfileData from the GridServer. |
131 | /// We'll cache this information in GetRegionInfo and use it for presence updates | 131 | /// We'll cache this information in GetRegionInfo and use it for presence updates |
132 | /// </summary> | 132 | /// </summary> |
133 | /// <param name="regionHandle"></param> | 133 | /// <param name="regionHandle"></param> |
134 | /// <returns></returns> | 134 | /// <returns></returns> |
135 | public RegionProfileData RequestRegionInfo(ulong regionHandle) | 135 | public RegionProfileData RequestRegionInfo(ulong regionHandle) |
136 | { | 136 | { |
137 | RegionProfileData regionProfile = null; | 137 | RegionProfileData regionProfile = null; |
138 | try | 138 | try |
139 | { | 139 | { |
140 | Hashtable requestData = new Hashtable(); | 140 | Hashtable requestData = new Hashtable(); |
141 | requestData["region_handle"] = regionHandle.ToString(); | 141 | requestData["region_handle"] = regionHandle.ToString(); |
142 | requestData["authkey"] = m_cfg.GridSendKey; | 142 | requestData["authkey"] = m_cfg.GridSendKey; |
143 | 143 | ||
144 | ArrayList SendParams = new ArrayList(); | 144 | ArrayList SendParams = new ArrayList(); |
145 | SendParams.Add(requestData); | 145 | SendParams.Add(requestData); |
146 | 146 | ||
147 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); | 147 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); |
148 | 148 | ||
149 | XmlRpcResponse GridResp = GridReq.Send(m_cfg.GridServerURL, 3000); | 149 | XmlRpcResponse GridResp = GridReq.Send(m_cfg.GridServerURL, 3000); |
150 | 150 | ||
151 | Hashtable responseData = (Hashtable)GridResp.Value; | 151 | Hashtable responseData = (Hashtable)GridResp.Value; |
152 | 152 | ||
153 | if (responseData.ContainsKey("error")) | 153 | if (responseData.ContainsKey("error")) |
154 | { | 154 | { |
155 | m_log.Error("[GRID]: error received from grid server" + responseData["error"]); | 155 | m_log.Error("[GRID]: error received from grid server" + responseData["error"]); |
156 | return null; | 156 | return null; |
157 | } | 157 | } |
158 | 158 | ||
159 | uint regX = Convert.ToUInt32((string)responseData["region_locx"]); | 159 | uint regX = Convert.ToUInt32((string)responseData["region_locx"]); |
160 | uint regY = Convert.ToUInt32((string)responseData["region_locy"]); | 160 | uint regY = Convert.ToUInt32((string)responseData["region_locy"]); |
161 | string internalIpStr = (string)responseData["sim_ip"]; | 161 | string internalIpStr = (string)responseData["sim_ip"]; |
162 | 162 | ||
163 | regionProfile = new RegionProfileData(); | 163 | regionProfile = new RegionProfileData(); |
164 | regionProfile.httpPort = (uint)Convert.ToInt32((string)responseData["http_port"]); | 164 | regionProfile.httpPort = (uint)Convert.ToInt32((string)responseData["http_port"]); |
165 | regionProfile.httpServerURI = "http://" + internalIpStr + ":" + regionProfile.httpPort + "/"; | 165 | regionProfile.httpServerURI = "http://" + internalIpStr + ":" + regionProfile.httpPort + "/"; |
166 | regionProfile.regionHandle = Utils.UIntsToLong((regX * Constants.RegionSize), (regY * Constants.RegionSize)); | 166 | regionProfile.regionHandle = Utils.UIntsToLong((regX * Constants.RegionSize), (regY * Constants.RegionSize)); |
167 | regionProfile.regionLocX = regX; | 167 | regionProfile.regionLocX = regX; |
168 | regionProfile.regionLocY = regY; | 168 | regionProfile.regionLocY = regY; |
169 | 169 | ||
170 | regionProfile.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); | 170 | regionProfile.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); |
171 | regionProfile.UUID = new UUID((string)responseData["region_UUID"]); | 171 | regionProfile.UUID = new UUID((string)responseData["region_UUID"]); |
172 | regionProfile.regionName = (string)responseData["region_name"]; | 172 | regionProfile.regionName = (string)responseData["region_name"]; |
173 | } | 173 | } |
174 | catch (WebException) | 174 | catch (WebException) |
175 | { | 175 | { |
176 | m_log.Error("[GRID]: " + | 176 | m_log.Error("[GRID]: " + |
177 | "Region lookup failed for: " + regionHandle.ToString() + | 177 | "Region lookup failed for: " + regionHandle.ToString() + |
178 | " - Is the GridServer down?"); | 178 | " - Is the GridServer down?"); |
179 | } | 179 | } |
180 | 180 | ||
181 | return regionProfile; | 181 | return regionProfile; |
182 | } | 182 | } |
183 | 183 | ||
184 | public XmlRpcResponse RegionStartup(XmlRpcRequest request) | 184 | public XmlRpcResponse RegionStartup(XmlRpcRequest request) |
185 | { | 185 | { |
186 | Hashtable requestData = (Hashtable)request.Params[0]; | 186 | Hashtable requestData = (Hashtable)request.Params[0]; |
187 | Hashtable result = new Hashtable(); | 187 | Hashtable result = new Hashtable(); |
188 | result["success"] = "FALSE"; | 188 | result["success"] = "FALSE"; |
189 | 189 | ||
190 | if (m_userServerModule.SendToUserServer(requestData, "region_startup")) | 190 | if (m_userServerModule.SendToUserServer(requestData, "region_startup")) |
191 | result["success"] = "TRUE"; | 191 | result["success"] = "TRUE"; |
192 | 192 | ||
193 | XmlRpcResponse response = new XmlRpcResponse(); | 193 | XmlRpcResponse response = new XmlRpcResponse(); |
194 | response.Value = result; | 194 | response.Value = result; |
195 | return response; | 195 | return response; |
196 | } | 196 | } |
197 | 197 | ||
198 | public XmlRpcResponse RegionShutdown(XmlRpcRequest request) | 198 | public XmlRpcResponse RegionShutdown(XmlRpcRequest request) |
199 | { | 199 | { |
200 | Hashtable requestData = (Hashtable)request.Params[0]; | 200 | Hashtable requestData = (Hashtable)request.Params[0]; |
201 | Hashtable result = new Hashtable(); | 201 | Hashtable result = new Hashtable(); |
202 | result["success"] = "FALSE"; | 202 | result["success"] = "FALSE"; |
203 | 203 | ||
204 | if (m_userServerModule.SendToUserServer(requestData, "region_shutdown")) | 204 | if (m_userServerModule.SendToUserServer(requestData, "region_shutdown")) |
205 | result["success"] = "TRUE"; | 205 | result["success"] = "TRUE"; |
206 | 206 | ||
207 | XmlRpcResponse response = new XmlRpcResponse(); | 207 | XmlRpcResponse response = new XmlRpcResponse(); |
208 | response.Value = result; | 208 | response.Value = result; |
209 | return response; | 209 | return response; |
210 | } | 210 | } |
211 | 211 | ||
212 | } | 212 | } |
213 | } | 213 | } |
diff --git a/OpenSim/Grid/MessagingServer.Modules/MessageService.cs b/OpenSim/Grid/MessagingServer.Modules/MessageService.cs index 15cfa3b..c76f332 100644 --- a/OpenSim/Grid/MessagingServer.Modules/MessageService.cs +++ b/OpenSim/Grid/MessagingServer.Modules/MessageService.cs | |||
@@ -1,488 +1,488 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Net; | 31 | using System.Net; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Threading; | 33 | using System.Threading; |
34 | using System.Timers; | 34 | using System.Timers; |
35 | using log4net; | 35 | using log4net; |
36 | using Nwc.XmlRpc; | 36 | using Nwc.XmlRpc; |
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
38 | using OpenSim.Data; | 38 | using OpenSim.Data; |
39 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
40 | using OpenSim.Grid.Framework; | 40 | using OpenSim.Grid.Framework; |
41 | using Timer=System.Timers.Timer; | 41 | using Timer=System.Timers.Timer; |
42 | 42 | ||
43 | namespace OpenSim.Grid.MessagingServer.Modules | 43 | namespace OpenSim.Grid.MessagingServer.Modules |
44 | { | 44 | { |
45 | public class MessageService | 45 | public class MessageService |
46 | { | 46 | { |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | private MessageServerConfig m_cfg; | 49 | private MessageServerConfig m_cfg; |
50 | private UserDataBaseService m_userDataBaseService; | 50 | private UserDataBaseService m_userDataBaseService; |
51 | 51 | ||
52 | private IUGAIMCore m_messageCore; | 52 | private IUGAIMCore m_messageCore; |
53 | 53 | ||
54 | private IMessageUserServerService m_userServerModule; | 54 | private IMessageUserServerService m_userServerModule; |
55 | private IMessageRegionService m_regionModule; | 55 | private IMessageRegionService m_regionModule; |
56 | 56 | ||
57 | // a dictionary of all current presences this server knows about | 57 | // a dictionary of all current presences this server knows about |
58 | private Dictionary<UUID, UserPresenceData> m_presences = new Dictionary<UUID,UserPresenceData>(); | 58 | private Dictionary<UUID, UserPresenceData> m_presences = new Dictionary<UUID,UserPresenceData>(); |
59 | 59 | ||
60 | public MessageService(MessageServerConfig cfg, IUGAIMCore messageCore, UserDataBaseService userDataBaseService) | 60 | public MessageService(MessageServerConfig cfg, IUGAIMCore messageCore, UserDataBaseService userDataBaseService) |
61 | { | 61 | { |
62 | m_cfg = cfg; | 62 | m_cfg = cfg; |
63 | m_messageCore = messageCore; | 63 | m_messageCore = messageCore; |
64 | 64 | ||
65 | m_userDataBaseService = userDataBaseService; | 65 | m_userDataBaseService = userDataBaseService; |
66 | 66 | ||
67 | //??? | 67 | //??? |
68 | UserConfig uc = new UserConfig(); | 68 | UserConfig uc = new UserConfig(); |
69 | uc.DatabaseConnect = cfg.DatabaseConnect; | 69 | uc.DatabaseConnect = cfg.DatabaseConnect; |
70 | uc.DatabaseProvider = cfg.DatabaseProvider; | 70 | uc.DatabaseProvider = cfg.DatabaseProvider; |
71 | } | 71 | } |
72 | 72 | ||
73 | public void Initialise() | 73 | public void Initialise() |
74 | { | 74 | { |
75 | } | 75 | } |
76 | 76 | ||
77 | public void PostInitialise() | 77 | public void PostInitialise() |
78 | { | 78 | { |
79 | IMessageUserServerService messageUserServer; | 79 | IMessageUserServerService messageUserServer; |
80 | if (m_messageCore.TryGet<IMessageUserServerService>(out messageUserServer)) | 80 | if (m_messageCore.TryGet<IMessageUserServerService>(out messageUserServer)) |
81 | { | 81 | { |
82 | m_userServerModule = messageUserServer; | 82 | m_userServerModule = messageUserServer; |
83 | } | 83 | } |
84 | 84 | ||
85 | IMessageRegionService messageRegion; | 85 | IMessageRegionService messageRegion; |
86 | if (m_messageCore.TryGet<IMessageRegionService>(out messageRegion)) | 86 | if (m_messageCore.TryGet<IMessageRegionService>(out messageRegion)) |
87 | { | 87 | { |
88 | m_regionModule = messageRegion; | 88 | m_regionModule = messageRegion; |
89 | } | 89 | } |
90 | } | 90 | } |
91 | 91 | ||
92 | public void RegisterHandlers() | 92 | public void RegisterHandlers() |
93 | { | 93 | { |
94 | //have these in separate method as some servers restart the http server and reregister all the handlers. | 94 | //have these in separate method as some servers restart the http server and reregister all the handlers. |
95 | 95 | ||
96 | } | 96 | } |
97 | 97 | ||
98 | #region FriendList Methods | 98 | #region FriendList Methods |
99 | 99 | ||
100 | /// <summary> | 100 | /// <summary> |
101 | /// Process Friendlist subscriptions for a user | 101 | /// Process Friendlist subscriptions for a user |
102 | /// The login method calls this for a User | 102 | /// The login method calls this for a User |
103 | /// </summary> | 103 | /// </summary> |
104 | /// <param name="userpresence">The Agent we're processing the friendlist subscriptions for</param> | 104 | /// <param name="userpresence">The Agent we're processing the friendlist subscriptions for</param> |
105 | private void ProcessFriendListSubscriptions(UserPresenceData userpresence) | 105 | private void ProcessFriendListSubscriptions(UserPresenceData userpresence) |
106 | { | 106 | { |
107 | lock (m_presences) | 107 | lock (m_presences) |
108 | { | 108 | { |
109 | m_presences[userpresence.agentData.AgentID] = userpresence; | 109 | m_presences[userpresence.agentData.AgentID] = userpresence; |
110 | } | 110 | } |
111 | 111 | ||
112 | Dictionary<UUID, FriendListItem> uFriendList = userpresence.friendData; | 112 | Dictionary<UUID, FriendListItem> uFriendList = userpresence.friendData; |
113 | foreach (KeyValuePair<UUID, FriendListItem> pair in uFriendList) | 113 | foreach (KeyValuePair<UUID, FriendListItem> pair in uFriendList) |
114 | { | 114 | { |
115 | UserPresenceData friendup = null; | 115 | UserPresenceData friendup = null; |
116 | lock (m_presences) | 116 | lock (m_presences) |
117 | { | 117 | { |
118 | m_presences.TryGetValue(pair.Key, out friendup); | 118 | m_presences.TryGetValue(pair.Key, out friendup); |
119 | } | 119 | } |
120 | if (friendup != null) | 120 | if (friendup != null) |
121 | { | 121 | { |
122 | SubscribeToPresenceUpdates(userpresence, friendup, pair.Value); | 122 | SubscribeToPresenceUpdates(userpresence, friendup, pair.Value); |
123 | } | 123 | } |
124 | } | 124 | } |
125 | } | 125 | } |
126 | 126 | ||
127 | /// <summary> | 127 | /// <summary> |
128 | /// Enqueues a presence update, sending info about user 'talkingAbout' to user 'receiver'. | 128 | /// Enqueues a presence update, sending info about user 'talkingAbout' to user 'receiver'. |
129 | /// </summary> | 129 | /// </summary> |
130 | /// <param name="talkingAbout">We are sending presence information about this user.</param> | 130 | /// <param name="talkingAbout">We are sending presence information about this user.</param> |
131 | /// <param name="receiver">We are sending the presence update to this user</param> | 131 | /// <param name="receiver">We are sending the presence update to this user</param> |
132 | private void enqueuePresenceUpdate(UserPresenceData talkingAbout, UserPresenceData receiver) | 132 | private void enqueuePresenceUpdate(UserPresenceData talkingAbout, UserPresenceData receiver) |
133 | { | 133 | { |
134 | UserAgentData p2Handle = m_userDataBaseService.GetUserAgentData(receiver.agentData.AgentID); | 134 | UserAgentData p2Handle = m_userDataBaseService.GetUserAgentData(receiver.agentData.AgentID); |
135 | if (p2Handle != null) | 135 | if (p2Handle != null) |
136 | { | 136 | { |
137 | if (receiver.lookupUserRegionYN) | 137 | if (receiver.lookupUserRegionYN) |
138 | { | 138 | { |
139 | receiver.regionData.regionHandle = p2Handle.Handle; | 139 | receiver.regionData.regionHandle = p2Handle.Handle; |
140 | } | 140 | } |
141 | else | 141 | else |
142 | { | 142 | { |
143 | receiver.lookupUserRegionYN = true; // TODO Huh? | 143 | receiver.lookupUserRegionYN = true; // TODO Huh? |
144 | } | 144 | } |
145 | 145 | ||
146 | PresenceInformer friendlistupdater = new PresenceInformer(); | 146 | PresenceInformer friendlistupdater = new PresenceInformer(); |
147 | friendlistupdater.presence1 = talkingAbout; | 147 | friendlistupdater.presence1 = talkingAbout; |
148 | friendlistupdater.presence2 = receiver; | 148 | friendlistupdater.presence2 = receiver; |
149 | friendlistupdater.OnGetRegionData += m_regionModule.GetRegionInfo; | 149 | friendlistupdater.OnGetRegionData += m_regionModule.GetRegionInfo; |
150 | friendlistupdater.OnDone += PresenceUpdateDone; | 150 | friendlistupdater.OnDone += PresenceUpdateDone; |
151 | WaitCallback cb = new WaitCallback(friendlistupdater.go); | 151 | WaitCallback cb = new WaitCallback(friendlistupdater.go); |
152 | ThreadPool.QueueUserWorkItem(cb); | 152 | ThreadPool.QueueUserWorkItem(cb); |
153 | } | 153 | } |
154 | else | 154 | else |
155 | { | 155 | { |
156 | m_log.WarnFormat("no data found for user {0}", receiver.agentData.AgentID); | 156 | m_log.WarnFormat("no data found for user {0}", receiver.agentData.AgentID); |
157 | // Skip because we can't find any data on the user | 157 | // Skip because we can't find any data on the user |
158 | } | 158 | } |
159 | } | 159 | } |
160 | 160 | ||
161 | /// <summary> | 161 | /// <summary> |
162 | /// Does the necessary work to subscribe one agent to another's presence notifications | 162 | /// Does the necessary work to subscribe one agent to another's presence notifications |
163 | /// Gets called by ProcessFriendListSubscriptions. You shouldn't call this directly | 163 | /// Gets called by ProcessFriendListSubscriptions. You shouldn't call this directly |
164 | /// unless you know what you're doing | 164 | /// unless you know what you're doing |
165 | /// </summary> | 165 | /// </summary> |
166 | /// <param name="userpresence">P1</param> | 166 | /// <param name="userpresence">P1</param> |
167 | /// <param name="friendpresence">P2</param> | 167 | /// <param name="friendpresence">P2</param> |
168 | /// <param name="uFriendListItem"></param> | 168 | /// <param name="uFriendListItem"></param> |
169 | private void SubscribeToPresenceUpdates(UserPresenceData userpresence, | 169 | private void SubscribeToPresenceUpdates(UserPresenceData userpresence, |
170 | UserPresenceData friendpresence, | 170 | UserPresenceData friendpresence, |
171 | FriendListItem uFriendListItem) | 171 | FriendListItem uFriendListItem) |
172 | { | 172 | { |
173 | // Can the friend see me online? | 173 | // Can the friend see me online? |
174 | if ((uFriendListItem.FriendListOwnerPerms & (uint)FriendRights.CanSeeOnline) != 0) | 174 | if ((uFriendListItem.FriendListOwnerPerms & (uint)FriendRights.CanSeeOnline) != 0) |
175 | { | 175 | { |
176 | // tell user to update friend about user's presence changes | 176 | // tell user to update friend about user's presence changes |
177 | if (!userpresence.subscriptionData.Contains(friendpresence.agentData.AgentID)) | 177 | if (!userpresence.subscriptionData.Contains(friendpresence.agentData.AgentID)) |
178 | { | 178 | { |
179 | userpresence.subscriptionData.Add(friendpresence.agentData.AgentID); | 179 | userpresence.subscriptionData.Add(friendpresence.agentData.AgentID); |
180 | } | 180 | } |
181 | 181 | ||
182 | // send an update about user's presence to the friend | 182 | // send an update about user's presence to the friend |
183 | enqueuePresenceUpdate(userpresence, friendpresence); | 183 | enqueuePresenceUpdate(userpresence, friendpresence); |
184 | } | 184 | } |
185 | 185 | ||
186 | // Can I see the friend online? | 186 | // Can I see the friend online? |
187 | if ((uFriendListItem.FriendPerms & (uint)FriendRights.CanSeeOnline) != 0) | 187 | if ((uFriendListItem.FriendPerms & (uint)FriendRights.CanSeeOnline) != 0) |
188 | { | 188 | { |
189 | // tell friend to update user about friend's presence changes | 189 | // tell friend to update user about friend's presence changes |
190 | if (!friendpresence.subscriptionData.Contains(userpresence.agentData.AgentID)) | 190 | if (!friendpresence.subscriptionData.Contains(userpresence.agentData.AgentID)) |
191 | { | 191 | { |
192 | friendpresence.subscriptionData.Add(userpresence.agentData.AgentID); | 192 | friendpresence.subscriptionData.Add(userpresence.agentData.AgentID); |
193 | } | 193 | } |
194 | 194 | ||
195 | // send an update about friend's presence to user. | 195 | // send an update about friend's presence to user. |
196 | enqueuePresenceUpdate(friendpresence, userpresence); | 196 | enqueuePresenceUpdate(friendpresence, userpresence); |
197 | } | 197 | } |
198 | } | 198 | } |
199 | 199 | ||
200 | /// <summary> | 200 | /// <summary> |
201 | /// Logoff Processor. Call this to clean up agent presence data and send logoff presence notifications | 201 | /// Logoff Processor. Call this to clean up agent presence data and send logoff presence notifications |
202 | /// </summary> | 202 | /// </summary> |
203 | /// <param name="AgentID"></param> | 203 | /// <param name="AgentID"></param> |
204 | private void ProcessLogOff(UUID AgentID) | 204 | private void ProcessLogOff(UUID AgentID) |
205 | { | 205 | { |
206 | m_log.Info("[LOGOFF]: Processing Logoff"); | 206 | m_log.Info("[LOGOFF]: Processing Logoff"); |
207 | 207 | ||
208 | UserPresenceData userPresence = null; | 208 | UserPresenceData userPresence = null; |
209 | lock (m_presences) | 209 | lock (m_presences) |
210 | { | 210 | { |
211 | m_presences.TryGetValue(AgentID, out userPresence); | 211 | m_presences.TryGetValue(AgentID, out userPresence); |
212 | } | 212 | } |
213 | 213 | ||
214 | if (userPresence != null) // found the user | 214 | if (userPresence != null) // found the user |
215 | { | 215 | { |
216 | List<UUID> AgentsNeedingNotification = userPresence.subscriptionData; | 216 | List<UUID> AgentsNeedingNotification = userPresence.subscriptionData; |
217 | userPresence.OnlineYN = false; | 217 | userPresence.OnlineYN = false; |
218 | 218 | ||
219 | for (int i = 0; i < AgentsNeedingNotification.Count; i++) | 219 | for (int i = 0; i < AgentsNeedingNotification.Count; i++) |
220 | { | 220 | { |
221 | UserPresenceData friendPresence = null; | 221 | UserPresenceData friendPresence = null; |
222 | lock (m_presences) | 222 | lock (m_presences) |
223 | { | 223 | { |
224 | m_presences.TryGetValue(AgentsNeedingNotification[i], out friendPresence); | 224 | m_presences.TryGetValue(AgentsNeedingNotification[i], out friendPresence); |
225 | } | 225 | } |
226 | 226 | ||
227 | // This might need to be enumerated and checked before we try to remove it. | 227 | // This might need to be enumerated and checked before we try to remove it. |
228 | if (friendPresence != null) | 228 | if (friendPresence != null) |
229 | { | 229 | { |
230 | lock (friendPresence) | 230 | lock (friendPresence) |
231 | { | 231 | { |
232 | // no updates for this user anymore | 232 | // no updates for this user anymore |
233 | friendPresence.subscriptionData.Remove(AgentID); | 233 | friendPresence.subscriptionData.Remove(AgentID); |
234 | 234 | ||
235 | // set user's entry in the friend's list to offline (if it exists) | 235 | // set user's entry in the friend's list to offline (if it exists) |
236 | if (friendPresence.friendData.ContainsKey(AgentID)) | 236 | if (friendPresence.friendData.ContainsKey(AgentID)) |
237 | { | 237 | { |
238 | friendPresence.friendData[AgentID].onlinestatus = false; | 238 | friendPresence.friendData[AgentID].onlinestatus = false; |
239 | } | 239 | } |
240 | } | 240 | } |
241 | 241 | ||
242 | enqueuePresenceUpdate(userPresence, friendPresence); | 242 | enqueuePresenceUpdate(userPresence, friendPresence); |
243 | } | 243 | } |
244 | } | 244 | } |
245 | } | 245 | } |
246 | } | 246 | } |
247 | 247 | ||
248 | #endregion | 248 | #endregion |
249 | 249 | ||
250 | private void PresenceUpdateDone(PresenceInformer obj) | 250 | private void PresenceUpdateDone(PresenceInformer obj) |
251 | { | 251 | { |
252 | obj.OnGetRegionData -= m_regionModule.GetRegionInfo; | 252 | obj.OnGetRegionData -= m_regionModule.GetRegionInfo; |
253 | obj.OnDone -= PresenceUpdateDone; | 253 | obj.OnDone -= PresenceUpdateDone; |
254 | } | 254 | } |
255 | 255 | ||
256 | #region UserServer Comms | 256 | #region UserServer Comms |
257 | 257 | ||
258 | /// <summary> | 258 | /// <summary> |
259 | /// Returns a list of FriendsListItems that describe the friends and permissions in the friend | 259 | /// Returns a list of FriendsListItems that describe the friends and permissions in the friend |
260 | /// relationship for UUID friendslistowner. For faster lookup, we index by friend's UUID. | 260 | /// relationship for UUID friendslistowner. For faster lookup, we index by friend's UUID. |
261 | /// </summary> | 261 | /// </summary> |
262 | /// <param name="friendlistowner">The agent that we're retreiving the friends Data for.</param> | 262 | /// <param name="friendlistowner">The agent that we're retreiving the friends Data for.</param> |
263 | private Dictionary<UUID, FriendListItem> GetUserFriendList(UUID friendlistowner) | 263 | private Dictionary<UUID, FriendListItem> GetUserFriendList(UUID friendlistowner) |
264 | { | 264 | { |
265 | Dictionary<UUID, FriendListItem> buddies = new Dictionary<UUID,FriendListItem>(); | 265 | Dictionary<UUID, FriendListItem> buddies = new Dictionary<UUID,FriendListItem>(); |
266 | 266 | ||
267 | try | 267 | try |
268 | { | 268 | { |
269 | Hashtable param = new Hashtable(); | 269 | Hashtable param = new Hashtable(); |
270 | param["ownerID"] = friendlistowner.ToString(); | 270 | param["ownerID"] = friendlistowner.ToString(); |
271 | 271 | ||
272 | IList parameters = new ArrayList(); | 272 | IList parameters = new ArrayList(); |
273 | parameters.Add(param); | 273 | parameters.Add(param); |
274 | XmlRpcRequest req = new XmlRpcRequest("get_user_friend_list", parameters); | 274 | XmlRpcRequest req = new XmlRpcRequest("get_user_friend_list", parameters); |
275 | XmlRpcResponse resp = req.Send(m_cfg.UserServerURL, 3000); | 275 | XmlRpcResponse resp = req.Send(m_cfg.UserServerURL, 3000); |
276 | Hashtable respData = (Hashtable)resp.Value; | 276 | Hashtable respData = (Hashtable)resp.Value; |
277 | 277 | ||
278 | if (respData.Contains("avcount")) | 278 | if (respData.Contains("avcount")) |
279 | { | 279 | { |
280 | buddies = ConvertXMLRPCDataToFriendListItemList(respData); | 280 | buddies = ConvertXMLRPCDataToFriendListItemList(respData); |
281 | } | 281 | } |
282 | 282 | ||
283 | } | 283 | } |
284 | catch (WebException e) | 284 | catch (WebException e) |
285 | { | 285 | { |
286 | m_log.Warn("Error when trying to fetch Avatar's friends list: " + | 286 | m_log.Warn("Error when trying to fetch Avatar's friends list: " + |
287 | e.Message); | 287 | e.Message); |
288 | // Return Empty list (no friends) | 288 | // Return Empty list (no friends) |
289 | } | 289 | } |
290 | return buddies; | 290 | return buddies; |
291 | } | 291 | } |
292 | 292 | ||
293 | /// <summary> | 293 | /// <summary> |
294 | /// Converts XMLRPC Friend List to FriendListItem Object | 294 | /// Converts XMLRPC Friend List to FriendListItem Object |
295 | /// </summary> | 295 | /// </summary> |
296 | /// <param name="data">XMLRPC response data Hashtable</param> | 296 | /// <param name="data">XMLRPC response data Hashtable</param> |
297 | /// <returns></returns> | 297 | /// <returns></returns> |
298 | public Dictionary<UUID, FriendListItem> ConvertXMLRPCDataToFriendListItemList(Hashtable data) | 298 | public Dictionary<UUID, FriendListItem> ConvertXMLRPCDataToFriendListItemList(Hashtable data) |
299 | { | 299 | { |
300 | Dictionary<UUID, FriendListItem> buddies = new Dictionary<UUID,FriendListItem>(); | 300 | Dictionary<UUID, FriendListItem> buddies = new Dictionary<UUID,FriendListItem>(); |
301 | int buddycount = Convert.ToInt32((string)data["avcount"]); | 301 | int buddycount = Convert.ToInt32((string)data["avcount"]); |
302 | 302 | ||
303 | for (int i = 0; i < buddycount; i++) | 303 | for (int i = 0; i < buddycount; i++) |
304 | { | 304 | { |
305 | FriendListItem buddylistitem = new FriendListItem(); | 305 | FriendListItem buddylistitem = new FriendListItem(); |
306 | 306 | ||
307 | buddylistitem.FriendListOwner = new UUID((string)data["ownerID" + i.ToString()]); | 307 | buddylistitem.FriendListOwner = new UUID((string)data["ownerID" + i.ToString()]); |
308 | buddylistitem.Friend = new UUID((string)data["friendID" + i.ToString()]); | 308 | buddylistitem.Friend = new UUID((string)data["friendID" + i.ToString()]); |
309 | buddylistitem.FriendListOwnerPerms = (uint)Convert.ToInt32((string)data["ownerPerms" + i.ToString()]); | 309 | buddylistitem.FriendListOwnerPerms = (uint)Convert.ToInt32((string)data["ownerPerms" + i.ToString()]); |
310 | buddylistitem.FriendPerms = (uint)Convert.ToInt32((string)data["friendPerms" + i.ToString()]); | 310 | buddylistitem.FriendPerms = (uint)Convert.ToInt32((string)data["friendPerms" + i.ToString()]); |
311 | 311 | ||
312 | buddies.Add(buddylistitem.Friend, buddylistitem); | 312 | buddies.Add(buddylistitem.Friend, buddylistitem); |
313 | } | 313 | } |
314 | 314 | ||
315 | return buddies; | 315 | return buddies; |
316 | } | 316 | } |
317 | 317 | ||
318 | /// <summary> | 318 | /// <summary> |
319 | /// UserServer sends an expect_user method | 319 | /// UserServer sends an expect_user method |
320 | /// this handles the method and provisions the | 320 | /// this handles the method and provisions the |
321 | /// necessary info for presence to work | 321 | /// necessary info for presence to work |
322 | /// </summary> | 322 | /// </summary> |
323 | /// <param name="request">UserServer Data</param> | 323 | /// <param name="request">UserServer Data</param> |
324 | /// <returns></returns> | 324 | /// <returns></returns> |
325 | public XmlRpcResponse UserLoggedOn(XmlRpcRequest request) | 325 | public XmlRpcResponse UserLoggedOn(XmlRpcRequest request) |
326 | { | 326 | { |
327 | Hashtable requestData = (Hashtable)request.Params[0]; | 327 | Hashtable requestData = (Hashtable)request.Params[0]; |
328 | 328 | ||
329 | AgentCircuitData agentData = new AgentCircuitData(); | 329 | AgentCircuitData agentData = new AgentCircuitData(); |
330 | agentData.SessionID = new UUID((string)requestData["sessionid"]); | 330 | agentData.SessionID = new UUID((string)requestData["sessionid"]); |
331 | agentData.SecureSessionID = new UUID((string)requestData["secure_session_id"]); | 331 | agentData.SecureSessionID = new UUID((string)requestData["secure_session_id"]); |
332 | agentData.firstname = (string)requestData["firstname"]; | 332 | agentData.firstname = (string)requestData["firstname"]; |
333 | agentData.lastname = (string)requestData["lastname"]; | 333 | agentData.lastname = (string)requestData["lastname"]; |
334 | agentData.AgentID = new UUID((string)requestData["agentid"]); | 334 | agentData.AgentID = new UUID((string)requestData["agentid"]); |
335 | agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); | 335 | agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); |
336 | agentData.CapsPath = (string)requestData["caps_path"]; | 336 | agentData.CapsPath = (string)requestData["caps_path"]; |
337 | 337 | ||
338 | if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) | 338 | if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) |
339 | { | 339 | { |
340 | agentData.child = true; | 340 | agentData.child = true; |
341 | } | 341 | } |
342 | else | 342 | else |
343 | { | 343 | { |
344 | agentData.startpos = | 344 | agentData.startpos = |
345 | new Vector3(Convert.ToSingle(requestData["positionx"]), | 345 | new Vector3(Convert.ToSingle(requestData["positionx"]), |
346 | Convert.ToSingle(requestData["positiony"]), | 346 | Convert.ToSingle(requestData["positiony"]), |
347 | Convert.ToSingle(requestData["positionz"])); | 347 | Convert.ToSingle(requestData["positionz"])); |
348 | agentData.child = false; | 348 | agentData.child = false; |
349 | } | 349 | } |
350 | 350 | ||
351 | ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); | 351 | ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); |
352 | 352 | ||
353 | m_log.InfoFormat("[LOGON]: User {0} {1} logged into region {2} as {3} agent, building indexes for user", | 353 | m_log.InfoFormat("[LOGON]: User {0} {1} logged into region {2} as {3} agent, building indexes for user", |
354 | agentData.firstname, agentData.lastname, regionHandle, agentData.child ? "child" : "root"); | 354 | agentData.firstname, agentData.lastname, regionHandle, agentData.child ? "child" : "root"); |
355 | 355 | ||
356 | UserPresenceData up = new UserPresenceData(); | 356 | UserPresenceData up = new UserPresenceData(); |
357 | up.agentData = agentData; | 357 | up.agentData = agentData; |
358 | up.friendData = GetUserFriendList(agentData.AgentID); | 358 | up.friendData = GetUserFriendList(agentData.AgentID); |
359 | up.regionData = m_regionModule.GetRegionInfo(regionHandle); | 359 | up.regionData = m_regionModule.GetRegionInfo(regionHandle); |
360 | up.OnlineYN = true; | 360 | up.OnlineYN = true; |
361 | up.lookupUserRegionYN = false; | 361 | up.lookupUserRegionYN = false; |
362 | ProcessFriendListSubscriptions(up); | 362 | ProcessFriendListSubscriptions(up); |
363 | 363 | ||
364 | return new XmlRpcResponse(); | 364 | return new XmlRpcResponse(); |
365 | } | 365 | } |
366 | 366 | ||
367 | /// <summary> | 367 | /// <summary> |
368 | /// The UserServer got a Logoff message | 368 | /// The UserServer got a Logoff message |
369 | /// Cleanup time for that user. Send out presence notifications | 369 | /// Cleanup time for that user. Send out presence notifications |
370 | /// </summary> | 370 | /// </summary> |
371 | /// <param name="request"></param> | 371 | /// <param name="request"></param> |
372 | /// <returns></returns> | 372 | /// <returns></returns> |
373 | public XmlRpcResponse UserLoggedOff(XmlRpcRequest request) | 373 | public XmlRpcResponse UserLoggedOff(XmlRpcRequest request) |
374 | { | 374 | { |
375 | m_log.Info("[USERLOGOFF]: User logged off called"); | 375 | m_log.Info("[USERLOGOFF]: User logged off called"); |
376 | Hashtable requestData = (Hashtable)request.Params[0]; | 376 | Hashtable requestData = (Hashtable)request.Params[0]; |
377 | 377 | ||
378 | UUID AgentID = new UUID((string)requestData["agentid"]); | 378 | UUID AgentID = new UUID((string)requestData["agentid"]); |
379 | ProcessLogOff(AgentID); | 379 | ProcessLogOff(AgentID); |
380 | 380 | ||
381 | return new XmlRpcResponse(); | 381 | return new XmlRpcResponse(); |
382 | } | 382 | } |
383 | 383 | ||
384 | #endregion | 384 | #endregion |
385 | 385 | ||
386 | public XmlRpcResponse GetPresenceInfoBulk(XmlRpcRequest request) | 386 | public XmlRpcResponse GetPresenceInfoBulk(XmlRpcRequest request) |
387 | { | 387 | { |
388 | Hashtable paramHash = (Hashtable)request.Params[0]; | 388 | Hashtable paramHash = (Hashtable)request.Params[0]; |
389 | Hashtable result = new Hashtable(); | 389 | Hashtable result = new Hashtable(); |
390 | 390 | ||
391 | // TODO check access (recv_key/send_key) | 391 | // TODO check access (recv_key/send_key) |
392 | 392 | ||
393 | IList list = (IList)paramHash["uuids"]; | 393 | IList list = (IList)paramHash["uuids"]; |
394 | 394 | ||
395 | // convert into List<UUID> | 395 | // convert into List<UUID> |
396 | List<UUID> uuids = new List<UUID>(); | 396 | List<UUID> uuids = new List<UUID>(); |
397 | for (int i = 0; i < list.Count; ++i) | 397 | for (int i = 0; i < list.Count; ++i) |
398 | { | 398 | { |
399 | UUID uuid; | 399 | UUID uuid; |
400 | if (UUID.TryParse((string)list[i], out uuid)) | 400 | if (UUID.TryParse((string)list[i], out uuid)) |
401 | { | 401 | { |
402 | uuids.Add(uuid); | 402 | uuids.Add(uuid); |
403 | } | 403 | } |
404 | } | 404 | } |
405 | 405 | ||
406 | try { | 406 | try { |
407 | Dictionary<UUID, FriendRegionInfo> infos = m_userDataBaseService.GetFriendRegionInfos(uuids); | 407 | Dictionary<UUID, FriendRegionInfo> infos = m_userDataBaseService.GetFriendRegionInfos(uuids); |
408 | m_log.DebugFormat("[FRIEND]: Got {0} region entries back.", infos.Count); | 408 | m_log.DebugFormat("[FRIEND]: Got {0} region entries back.", infos.Count); |
409 | int count = 0; | 409 | int count = 0; |
410 | foreach (KeyValuePair<UUID, FriendRegionInfo> pair in infos) | 410 | foreach (KeyValuePair<UUID, FriendRegionInfo> pair in infos) |
411 | { | 411 | { |
412 | result["uuid_" + count] = pair.Key.ToString(); | 412 | result["uuid_" + count] = pair.Key.ToString(); |
413 | result["isOnline_" + count] = pair.Value.isOnline; | 413 | result["isOnline_" + count] = pair.Value.isOnline; |
414 | result["regionHandle_" + count] = pair.Value.regionHandle.ToString(); // XML-RPC doesn't know ulongs | 414 | result["regionHandle_" + count] = pair.Value.regionHandle.ToString(); // XML-RPC doesn't know ulongs |
415 | ++count; | 415 | ++count; |
416 | } | 416 | } |
417 | result["count"] = count; | 417 | result["count"] = count; |
418 | 418 | ||
419 | XmlRpcResponse response = new XmlRpcResponse(); | 419 | XmlRpcResponse response = new XmlRpcResponse(); |
420 | response.Value = result; | 420 | response.Value = result; |
421 | return response; | 421 | return response; |
422 | } | 422 | } |
423 | catch(Exception e) { | 423 | catch(Exception e) { |
424 | m_log.Error("Got exception:", e); | 424 | m_log.Error("Got exception:", e); |
425 | throw e; | 425 | throw e; |
426 | } | 426 | } |
427 | } | 427 | } |
428 | 428 | ||
429 | public XmlRpcResponse AgentLocation(XmlRpcRequest request) | 429 | public XmlRpcResponse AgentLocation(XmlRpcRequest request) |
430 | { | 430 | { |
431 | Hashtable requestData = (Hashtable)request.Params[0]; | 431 | Hashtable requestData = (Hashtable)request.Params[0]; |
432 | Hashtable result = new Hashtable(); | 432 | Hashtable result = new Hashtable(); |
433 | result["success"] = "FALSE"; | 433 | result["success"] = "FALSE"; |
434 | 434 | ||
435 | if (m_userServerModule.SendToUserServer(requestData, "agent_location")) | 435 | if (m_userServerModule.SendToUserServer(requestData, "agent_location")) |
436 | result["success"] = "TRUE"; | 436 | result["success"] = "TRUE"; |
437 | 437 | ||
438 | 438 | ||
439 | XmlRpcResponse response = new XmlRpcResponse(); | 439 | XmlRpcResponse response = new XmlRpcResponse(); |
440 | response.Value = result; | 440 | response.Value = result; |
441 | return response; | 441 | return response; |
442 | } | 442 | } |
443 | 443 | ||
444 | public XmlRpcResponse AgentLeaving(XmlRpcRequest request) | 444 | public XmlRpcResponse AgentLeaving(XmlRpcRequest request) |
445 | { | 445 | { |
446 | Hashtable requestData = (Hashtable)request.Params[0]; | 446 | Hashtable requestData = (Hashtable)request.Params[0]; |
447 | Hashtable result = new Hashtable(); | 447 | Hashtable result = new Hashtable(); |
448 | result["success"] = "FALSE"; | 448 | result["success"] = "FALSE"; |
449 | 449 | ||
450 | if (m_userServerModule.SendToUserServer(requestData, "agent_leaving")) | 450 | if (m_userServerModule.SendToUserServer(requestData, "agent_leaving")) |
451 | result["success"] = "TRUE"; | 451 | result["success"] = "TRUE"; |
452 | 452 | ||
453 | XmlRpcResponse response = new XmlRpcResponse(); | 453 | XmlRpcResponse response = new XmlRpcResponse(); |
454 | response.Value = result; | 454 | response.Value = result; |
455 | return response; | 455 | return response; |
456 | } | 456 | } |
457 | 457 | ||
458 | public XmlRpcResponse ProcessRegionShutdown(XmlRpcRequest request) | 458 | public XmlRpcResponse ProcessRegionShutdown(XmlRpcRequest request) |
459 | { | 459 | { |
460 | Hashtable requestData = (Hashtable)request.Params[0]; | 460 | Hashtable requestData = (Hashtable)request.Params[0]; |
461 | Hashtable result = new Hashtable(); | 461 | Hashtable result = new Hashtable(); |
462 | result["success"] = "FALSE"; | 462 | result["success"] = "FALSE"; |
463 | 463 | ||
464 | UUID regionID; | 464 | UUID regionID; |
465 | if (UUID.TryParse((string)requestData["regionid"], out regionID)) | 465 | if (UUID.TryParse((string)requestData["regionid"], out regionID)) |
466 | { | 466 | { |
467 | m_log.DebugFormat("[PRESENCE] Processing region restart for {0}", regionID); | 467 | m_log.DebugFormat("[PRESENCE] Processing region restart for {0}", regionID); |
468 | result["success"] = "TRUE"; | 468 | result["success"] = "TRUE"; |
469 | 469 | ||
470 | foreach (UserPresenceData up in m_presences.Values) | 470 | foreach (UserPresenceData up in m_presences.Values) |
471 | { | 471 | { |
472 | if (up.regionData.UUID == regionID) | 472 | if (up.regionData.UUID == regionID) |
473 | { | 473 | { |
474 | if (up.OnlineYN) | 474 | if (up.OnlineYN) |
475 | { | 475 | { |
476 | m_log.DebugFormat("[PRESENCE] Logging off {0} because the region they were in has gone", up.agentData.AgentID); | 476 | m_log.DebugFormat("[PRESENCE] Logging off {0} because the region they were in has gone", up.agentData.AgentID); |
477 | ProcessLogOff(up.agentData.AgentID); | 477 | ProcessLogOff(up.agentData.AgentID); |
478 | } | 478 | } |
479 | } | 479 | } |
480 | } | 480 | } |
481 | } | 481 | } |
482 | 482 | ||
483 | XmlRpcResponse response = new XmlRpcResponse(); | 483 | XmlRpcResponse response = new XmlRpcResponse(); |
484 | response.Value = result; | 484 | response.Value = result; |
485 | return response; | 485 | return response; |
486 | } | 486 | } |
487 | } | 487 | } |
488 | } \ No newline at end of file | 488 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/MessagingServer.Modules/MessageUserServerModule.cs b/OpenSim/Grid/MessagingServer.Modules/MessageUserServerModule.cs index 9293b3e..e153c39 100644 --- a/OpenSim/Grid/MessagingServer.Modules/MessageUserServerModule.cs +++ b/OpenSim/Grid/MessagingServer.Modules/MessageUserServerModule.cs | |||
@@ -1,186 +1,186 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Net; | 31 | using System.Net; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Threading; | 33 | using System.Threading; |
34 | using System.Timers; | 34 | using System.Timers; |
35 | using log4net; | 35 | using log4net; |
36 | using Nwc.XmlRpc; | 36 | using Nwc.XmlRpc; |
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
38 | using OpenSim.Data; | 38 | using OpenSim.Data; |
39 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
40 | using OpenSim.Grid.Framework; | 40 | using OpenSim.Grid.Framework; |
41 | using Timer = System.Timers.Timer; | 41 | using Timer = System.Timers.Timer; |
42 | 42 | ||
43 | namespace OpenSim.Grid.MessagingServer.Modules | 43 | namespace OpenSim.Grid.MessagingServer.Modules |
44 | { | 44 | { |
45 | public class MessageUserServerModule : IMessageUserServerService | 45 | public class MessageUserServerModule : IMessageUserServerService |
46 | { | 46 | { |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | private MessageServerConfig m_cfg; | 49 | private MessageServerConfig m_cfg; |
50 | 50 | ||
51 | private IUGAIMCore m_messageCore; | 51 | private IUGAIMCore m_messageCore; |
52 | 52 | ||
53 | private Timer reconnectTimer = new Timer(300000); // 5 mins | 53 | private Timer reconnectTimer = new Timer(300000); // 5 mins |
54 | 54 | ||
55 | public MessageUserServerModule(MessageServerConfig config, IUGAIMCore messageCore) | 55 | public MessageUserServerModule(MessageServerConfig config, IUGAIMCore messageCore) |
56 | { | 56 | { |
57 | m_cfg = config; | 57 | m_cfg = config; |
58 | m_messageCore = messageCore; | 58 | m_messageCore = messageCore; |
59 | 59 | ||
60 | reconnectTimer.Elapsed += registerWithUserServer; | 60 | reconnectTimer.Elapsed += registerWithUserServer; |
61 | reconnectTimer.Start(); | 61 | reconnectTimer.Start(); |
62 | } | 62 | } |
63 | 63 | ||
64 | public void Initialise() | 64 | public void Initialise() |
65 | { | 65 | { |
66 | m_messageCore.RegisterInterface<IMessageUserServerService>(this); | 66 | m_messageCore.RegisterInterface<IMessageUserServerService>(this); |
67 | } | 67 | } |
68 | 68 | ||
69 | public void PostInitialise() | 69 | public void PostInitialise() |
70 | { | 70 | { |
71 | 71 | ||
72 | } | 72 | } |
73 | 73 | ||
74 | public void RegisterHandlers() | 74 | public void RegisterHandlers() |
75 | { | 75 | { |
76 | //have these in separate method as some servers restart the http server and reregister all the handlers. | 76 | //have these in separate method as some servers restart the http server and reregister all the handlers. |
77 | 77 | ||
78 | } | 78 | } |
79 | 79 | ||
80 | public void registerWithUserServer(object sender, ElapsedEventArgs e) | 80 | public void registerWithUserServer(object sender, ElapsedEventArgs e) |
81 | { | 81 | { |
82 | registerWithUserServer(); | 82 | registerWithUserServer(); |
83 | } | 83 | } |
84 | 84 | ||
85 | public bool registerWithUserServer() | 85 | public bool registerWithUserServer() |
86 | { | 86 | { |
87 | Hashtable UserParams = new Hashtable(); | 87 | Hashtable UserParams = new Hashtable(); |
88 | // Login / Authentication | 88 | // Login / Authentication |
89 | 89 | ||
90 | if (m_cfg.HttpSSL) | 90 | if (m_cfg.HttpSSL) |
91 | { | 91 | { |
92 | UserParams["uri"] = "https://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; | 92 | UserParams["uri"] = "https://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; |
93 | } | 93 | } |
94 | else | 94 | else |
95 | { | 95 | { |
96 | UserParams["uri"] = "http://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; | 96 | UserParams["uri"] = "http://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; |
97 | } | 97 | } |
98 | 98 | ||
99 | UserParams["recvkey"] = m_cfg.UserRecvKey; | 99 | UserParams["recvkey"] = m_cfg.UserRecvKey; |
100 | UserParams["sendkey"] = m_cfg.UserRecvKey; | 100 | UserParams["sendkey"] = m_cfg.UserRecvKey; |
101 | 101 | ||
102 | // Package into an XMLRPC Request | 102 | // Package into an XMLRPC Request |
103 | ArrayList SendParams = new ArrayList(); | 103 | ArrayList SendParams = new ArrayList(); |
104 | SendParams.Add(UserParams); | 104 | SendParams.Add(UserParams); |
105 | 105 | ||
106 | bool success = true; | 106 | bool success = true; |
107 | string[] servers = m_cfg.UserServerURL.Split(' '); | 107 | string[] servers = m_cfg.UserServerURL.Split(' '); |
108 | 108 | ||
109 | foreach (string srv in servers) | 109 | foreach (string srv in servers) |
110 | { | 110 | { |
111 | // Send Request | 111 | // Send Request |
112 | try | 112 | try |
113 | { | 113 | { |
114 | XmlRpcRequest UserReq = new XmlRpcRequest("register_messageserver", SendParams); | 114 | XmlRpcRequest UserReq = new XmlRpcRequest("register_messageserver", SendParams); |
115 | XmlRpcResponse UserResp = UserReq.Send(srv, 16000); | 115 | XmlRpcResponse UserResp = UserReq.Send(srv, 16000); |
116 | 116 | ||
117 | // Process Response | 117 | // Process Response |
118 | Hashtable GridRespData = (Hashtable)UserResp.Value; | 118 | Hashtable GridRespData = (Hashtable)UserResp.Value; |
119 | // if we got a response, we were successful | 119 | // if we got a response, we were successful |
120 | if (!GridRespData.ContainsKey("responsestring")) | 120 | if (!GridRespData.ContainsKey("responsestring")) |
121 | success = false; | 121 | success = false; |
122 | else | 122 | else |
123 | m_log.InfoFormat("[SERVER] Registered with {0}", srv); | 123 | m_log.InfoFormat("[SERVER] Registered with {0}", srv); |
124 | } | 124 | } |
125 | catch | 125 | catch |
126 | { | 126 | { |
127 | m_log.ErrorFormat("Unable to connect to server {0}. Server not running?", srv); | 127 | m_log.ErrorFormat("Unable to connect to server {0}. Server not running?", srv); |
128 | success = false; | 128 | success = false; |
129 | } | 129 | } |
130 | } | 130 | } |
131 | return success; | 131 | return success; |
132 | } | 132 | } |
133 | 133 | ||
134 | public bool deregisterWithUserServer() | 134 | public bool deregisterWithUserServer() |
135 | { | 135 | { |
136 | Hashtable request = new Hashtable(); | 136 | Hashtable request = new Hashtable(); |
137 | 137 | ||
138 | return SendToUserServer(request, "deregister_messageserver"); | 138 | return SendToUserServer(request, "deregister_messageserver"); |
139 | } | 139 | } |
140 | 140 | ||
141 | public bool SendToUserServer(Hashtable request, string method) | 141 | public bool SendToUserServer(Hashtable request, string method) |
142 | { | 142 | { |
143 | // Login / Authentication | 143 | // Login / Authentication |
144 | 144 | ||
145 | if (m_cfg.HttpSSL) | 145 | if (m_cfg.HttpSSL) |
146 | { | 146 | { |
147 | request["uri"] = "https://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; | 147 | request["uri"] = "https://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; |
148 | } | 148 | } |
149 | else | 149 | else |
150 | { | 150 | { |
151 | request["uri"] = "http://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; | 151 | request["uri"] = "http://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; |
152 | } | 152 | } |
153 | 153 | ||
154 | request["recvkey"] = m_cfg.UserRecvKey; | 154 | request["recvkey"] = m_cfg.UserRecvKey; |
155 | request["sendkey"] = m_cfg.UserRecvKey; | 155 | request["sendkey"] = m_cfg.UserRecvKey; |
156 | 156 | ||
157 | // Package into an XMLRPC Request | 157 | // Package into an XMLRPC Request |
158 | ArrayList SendParams = new ArrayList(); | 158 | ArrayList SendParams = new ArrayList(); |
159 | SendParams.Add(request); | 159 | SendParams.Add(request); |
160 | 160 | ||
161 | bool success = true; | 161 | bool success = true; |
162 | string[] servers = m_cfg.UserServerURL.Split(' '); | 162 | string[] servers = m_cfg.UserServerURL.Split(' '); |
163 | 163 | ||
164 | // Send Request | 164 | // Send Request |
165 | foreach (string srv in servers) | 165 | foreach (string srv in servers) |
166 | { | 166 | { |
167 | try | 167 | try |
168 | { | 168 | { |
169 | XmlRpcRequest UserReq = new XmlRpcRequest(method, SendParams); | 169 | XmlRpcRequest UserReq = new XmlRpcRequest(method, SendParams); |
170 | XmlRpcResponse UserResp = UserReq.Send(m_cfg.UserServerURL, 16000); | 170 | XmlRpcResponse UserResp = UserReq.Send(m_cfg.UserServerURL, 16000); |
171 | // Process Response | 171 | // Process Response |
172 | Hashtable UserRespData = (Hashtable)UserResp.Value; | 172 | Hashtable UserRespData = (Hashtable)UserResp.Value; |
173 | // if we got a response, we were successful | 173 | // if we got a response, we were successful |
174 | if (!UserRespData.ContainsKey("responsestring")) | 174 | if (!UserRespData.ContainsKey("responsestring")) |
175 | success = false; | 175 | success = false; |
176 | } | 176 | } |
177 | catch | 177 | catch |
178 | { | 178 | { |
179 | m_log.ErrorFormat("Unable to connect to server {0}. Server not running?", srv); | 179 | m_log.ErrorFormat("Unable to connect to server {0}. Server not running?", srv); |
180 | success = false; | 180 | success = false; |
181 | } | 181 | } |
182 | } | 182 | } |
183 | return success; | 183 | return success; |
184 | } | 184 | } |
185 | } | 185 | } |
186 | } | 186 | } |
diff --git a/OpenSim/Grid/MessagingServer.Modules/PresenceBackreferenceEntry.cs b/OpenSim/Grid/MessagingServer.Modules/PresenceBackreferenceEntry.cs index b6023e3..ddb143f 100644 --- a/OpenSim/Grid/MessagingServer.Modules/PresenceBackreferenceEntry.cs +++ b/OpenSim/Grid/MessagingServer.Modules/PresenceBackreferenceEntry.cs | |||
@@ -1,96 +1,96 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using OpenMetaverse; | 29 | using OpenMetaverse; |
30 | 30 | ||
31 | namespace OpenSim.Grid.MessagingServer.Modules | 31 | namespace OpenSim.Grid.MessagingServer.Modules |
32 | { | 32 | { |
33 | // This is a wrapper for a List<UUID> so it can be happily stored in a hashtable. | 33 | // This is a wrapper for a List<UUID> so it can be happily stored in a hashtable. |
34 | public class PresenceBackreferenceEntry | 34 | public class PresenceBackreferenceEntry |
35 | { | 35 | { |
36 | List<UUID> AgentList = new List<UUID>(); | 36 | List<UUID> AgentList = new List<UUID>(); |
37 | 37 | ||
38 | public PresenceBackreferenceEntry() | 38 | public PresenceBackreferenceEntry() |
39 | { | 39 | { |
40 | 40 | ||
41 | } | 41 | } |
42 | 42 | ||
43 | public void Add(UUID item) | 43 | public void Add(UUID item) |
44 | { | 44 | { |
45 | lock (AgentList) | 45 | lock (AgentList) |
46 | { | 46 | { |
47 | AgentList.Add(item); | 47 | AgentList.Add(item); |
48 | } | 48 | } |
49 | } | 49 | } |
50 | 50 | ||
51 | public UUID getitem(int index) | 51 | public UUID getitem(int index) |
52 | { | 52 | { |
53 | UUID result = UUID.Zero; | 53 | UUID result = UUID.Zero; |
54 | lock (AgentList) | 54 | lock (AgentList) |
55 | { | 55 | { |
56 | if (index > 0 && index < AgentList.Count) | 56 | if (index > 0 && index < AgentList.Count) |
57 | { | 57 | { |
58 | result = AgentList[index]; | 58 | result = AgentList[index]; |
59 | } | 59 | } |
60 | } | 60 | } |
61 | return result; | 61 | return result; |
62 | } | 62 | } |
63 | 63 | ||
64 | public int Count | 64 | public int Count |
65 | { | 65 | { |
66 | get | 66 | get |
67 | { | 67 | { |
68 | int count = 0; | 68 | int count = 0; |
69 | lock (AgentList) | 69 | lock (AgentList) |
70 | { | 70 | { |
71 | count = AgentList.Count; | 71 | count = AgentList.Count; |
72 | } | 72 | } |
73 | return count; | 73 | return count; |
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | public void Remove(UUID item) | 77 | public void Remove(UUID item) |
78 | { | 78 | { |
79 | lock (AgentList) | 79 | lock (AgentList) |
80 | { | 80 | { |
81 | if (AgentList.Contains(item)) | 81 | if (AgentList.Contains(item)) |
82 | AgentList.Remove(item); | 82 | AgentList.Remove(item); |
83 | } | 83 | } |
84 | } | 84 | } |
85 | 85 | ||
86 | public bool contains(UUID item) | 86 | public bool contains(UUID item) |
87 | { | 87 | { |
88 | bool result = false; | 88 | bool result = false; |
89 | lock (AgentList) | 89 | lock (AgentList) |
90 | { | 90 | { |
91 | result = AgentList.Contains(item); | 91 | result = AgentList.Contains(item); |
92 | } | 92 | } |
93 | return result; | 93 | return result; |
94 | } | 94 | } |
95 | } | 95 | } |
96 | } | 96 | } |
diff --git a/OpenSim/Grid/MessagingServer.Modules/PresenceInformer.cs b/OpenSim/Grid/MessagingServer.Modules/PresenceInformer.cs index 5d13c1b..67d630e 100644 --- a/OpenSim/Grid/MessagingServer.Modules/PresenceInformer.cs +++ b/OpenSim/Grid/MessagingServer.Modules/PresenceInformer.cs | |||
@@ -1,135 +1,135 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System.Collections; | 28 | using System.Collections; |
29 | using System.Net; | 29 | using System.Net; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using Nwc.XmlRpc; | 32 | using Nwc.XmlRpc; |
33 | using OpenSim.Data; | 33 | using OpenSim.Data; |
34 | 34 | ||
35 | namespace OpenSim.Grid.MessagingServer.Modules | 35 | namespace OpenSim.Grid.MessagingServer.Modules |
36 | { | 36 | { |
37 | public delegate RegionProfileData GetRegionData(ulong region_handle); | 37 | public delegate RegionProfileData GetRegionData(ulong region_handle); |
38 | public delegate void Done(PresenceInformer obj); | 38 | public delegate void Done(PresenceInformer obj); |
39 | 39 | ||
40 | 40 | ||
41 | public class PresenceInformer | 41 | public class PresenceInformer |
42 | { | 42 | { |
43 | public event GetRegionData OnGetRegionData; | 43 | public event GetRegionData OnGetRegionData; |
44 | public event Done OnDone; | 44 | public event Done OnDone; |
45 | 45 | ||
46 | private GetRegionData handlerGetRegionData = null; | 46 | private GetRegionData handlerGetRegionData = null; |
47 | private Done handlerDone = null; | 47 | private Done handlerDone = null; |
48 | 48 | ||
49 | public UserPresenceData presence1 = null; | 49 | public UserPresenceData presence1 = null; |
50 | public UserPresenceData presence2 = null; | 50 | public UserPresenceData presence2 = null; |
51 | public string gridserverurl, gridserversendkey, gridserverrecvkey; | 51 | public string gridserverurl, gridserversendkey, gridserverrecvkey; |
52 | public bool lookupRegion = true; | 52 | public bool lookupRegion = true; |
53 | //public methodGroup | 53 | //public methodGroup |
54 | 54 | ||
55 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 55 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
56 | 56 | ||
57 | public PresenceInformer() | 57 | public PresenceInformer() |
58 | { | 58 | { |
59 | 59 | ||
60 | } | 60 | } |
61 | public void go(object o) | 61 | public void go(object o) |
62 | { | 62 | { |
63 | if (presence1 != null && presence2 != null) | 63 | if (presence1 != null && presence2 != null) |
64 | { | 64 | { |
65 | SendRegionPresenceUpdate(presence1, presence2); | 65 | SendRegionPresenceUpdate(presence1, presence2); |
66 | } | 66 | } |
67 | 67 | ||
68 | } | 68 | } |
69 | 69 | ||
70 | /// <summary> | 70 | /// <summary> |
71 | /// Informs a region about an Agent | 71 | /// Informs a region about an Agent |
72 | /// </summary> | 72 | /// </summary> |
73 | /// <param name="TalkingAbout">User to talk about</param> | 73 | /// <param name="TalkingAbout">User to talk about</param> |
74 | /// <param name="UserToUpdate">User we're sending this too (contains the region)</param> | 74 | /// <param name="UserToUpdate">User we're sending this too (contains the region)</param> |
75 | public void SendRegionPresenceUpdate(UserPresenceData TalkingAbout, UserPresenceData UserToUpdate) | 75 | public void SendRegionPresenceUpdate(UserPresenceData TalkingAbout, UserPresenceData UserToUpdate) |
76 | { | 76 | { |
77 | // TODO: Fill in pertenant Presence Data from 'TalkingAbout' | 77 | // TODO: Fill in pertenant Presence Data from 'TalkingAbout' |
78 | RegionProfileData whichRegion = new RegionProfileData(); | 78 | RegionProfileData whichRegion = new RegionProfileData(); |
79 | if (lookupRegion) | 79 | if (lookupRegion) |
80 | { | 80 | { |
81 | handlerGetRegionData = OnGetRegionData; | 81 | handlerGetRegionData = OnGetRegionData; |
82 | if (handlerGetRegionData != null) | 82 | if (handlerGetRegionData != null) |
83 | { | 83 | { |
84 | whichRegion = handlerGetRegionData(UserToUpdate.regionData.regionHandle); | 84 | whichRegion = handlerGetRegionData(UserToUpdate.regionData.regionHandle); |
85 | } | 85 | } |
86 | //RegionProfileData rp = RegionProfileData.RequestSimProfileData(UserToUpdate.regionData.regionHandle, gridserverurl, gridserversendkey, gridserverrecvkey); | 86 | //RegionProfileData rp = RegionProfileData.RequestSimProfileData(UserToUpdate.regionData.regionHandle, gridserverurl, gridserversendkey, gridserverrecvkey); |
87 | 87 | ||
88 | //whichRegion = rp; | 88 | //whichRegion = rp; |
89 | } | 89 | } |
90 | else | 90 | else |
91 | { | 91 | { |
92 | whichRegion = UserToUpdate.regionData; | 92 | whichRegion = UserToUpdate.regionData; |
93 | } | 93 | } |
94 | //whichRegion.httpServerURI | 94 | //whichRegion.httpServerURI |
95 | 95 | ||
96 | if (whichRegion != null) | 96 | if (whichRegion != null) |
97 | { | 97 | { |
98 | Hashtable PresenceParams = new Hashtable(); | 98 | Hashtable PresenceParams = new Hashtable(); |
99 | PresenceParams.Add("agent_id",TalkingAbout.agentData.AgentID.ToString()); | 99 | PresenceParams.Add("agent_id",TalkingAbout.agentData.AgentID.ToString()); |
100 | PresenceParams.Add("notify_id",UserToUpdate.agentData.AgentID.ToString()); | 100 | PresenceParams.Add("notify_id",UserToUpdate.agentData.AgentID.ToString()); |
101 | if (TalkingAbout.OnlineYN) | 101 | if (TalkingAbout.OnlineYN) |
102 | PresenceParams.Add("status","TRUE"); | 102 | PresenceParams.Add("status","TRUE"); |
103 | else | 103 | else |
104 | PresenceParams.Add("status","FALSE"); | 104 | PresenceParams.Add("status","FALSE"); |
105 | 105 | ||
106 | ArrayList SendParams = new ArrayList(); | 106 | ArrayList SendParams = new ArrayList(); |
107 | SendParams.Add(PresenceParams); | 107 | SendParams.Add(PresenceParams); |
108 | 108 | ||
109 | m_log.InfoFormat("[PRESENCE]: Informing {0}@{1} at {2} about {3}", TalkingAbout.agentData.firstname + " " + TalkingAbout.agentData.lastname, whichRegion.regionName, whichRegion.httpServerURI, UserToUpdate.agentData.firstname + " " + UserToUpdate.agentData.lastname); | 109 | m_log.InfoFormat("[PRESENCE]: Informing {0}@{1} at {2} about {3}", TalkingAbout.agentData.firstname + " " + TalkingAbout.agentData.lastname, whichRegion.regionName, whichRegion.httpServerURI, UserToUpdate.agentData.firstname + " " + UserToUpdate.agentData.lastname); |
110 | // Send | 110 | // Send |
111 | XmlRpcRequest RegionReq = new XmlRpcRequest("presence_update", SendParams); | 111 | XmlRpcRequest RegionReq = new XmlRpcRequest("presence_update", SendParams); |
112 | try | 112 | try |
113 | { | 113 | { |
114 | // XmlRpcResponse RegionResp = RegionReq.Send(whichRegion.httpServerURI, 6000); | 114 | // XmlRpcResponse RegionResp = RegionReq.Send(whichRegion.httpServerURI, 6000); |
115 | RegionReq.Send(whichRegion.httpServerURI, 6000); | 115 | RegionReq.Send(whichRegion.httpServerURI, 6000); |
116 | } | 116 | } |
117 | catch (WebException) | 117 | catch (WebException) |
118 | { | 118 | { |
119 | m_log.WarnFormat("[INFORM]: failed notifying region {0} containing user {1} about {2}", whichRegion.regionName, UserToUpdate.agentData.firstname + " " + UserToUpdate.agentData.lastname, TalkingAbout.agentData.firstname + " " + TalkingAbout.agentData.lastname); | 119 | m_log.WarnFormat("[INFORM]: failed notifying region {0} containing user {1} about {2}", whichRegion.regionName, UserToUpdate.agentData.firstname + " " + UserToUpdate.agentData.lastname, TalkingAbout.agentData.firstname + " " + TalkingAbout.agentData.lastname); |
120 | } | 120 | } |
121 | } | 121 | } |
122 | else | 122 | else |
123 | { | 123 | { |
124 | m_log.Info("[PRESENCEUPDATER]: Region data was null skipping"); | 124 | m_log.Info("[PRESENCEUPDATER]: Region data was null skipping"); |
125 | 125 | ||
126 | } | 126 | } |
127 | 127 | ||
128 | handlerDone = OnDone; | 128 | handlerDone = OnDone; |
129 | if (handlerDone != null) | 129 | if (handlerDone != null) |
130 | { | 130 | { |
131 | handlerDone(this); | 131 | handlerDone(this); |
132 | } | 132 | } |
133 | } | 133 | } |
134 | } | 134 | } |
135 | } | 135 | } |
diff --git a/OpenSim/Grid/MessagingServer.Modules/PresenceService.cs b/OpenSim/Grid/MessagingServer.Modules/PresenceService.cs index cacc34e..d235e58 100644 --- a/OpenSim/Grid/MessagingServer.Modules/PresenceService.cs +++ b/OpenSim/Grid/MessagingServer.Modules/PresenceService.cs | |||
@@ -1,33 +1,33 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | namespace OpenSim.Grid.MessagingServer.Modules | 28 | namespace OpenSim.Grid.MessagingServer.Modules |
29 | { | 29 | { |
30 | class PresenceService | 30 | class PresenceService |
31 | { | 31 | { |
32 | } | 32 | } |
33 | } | 33 | } |
diff --git a/OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs b/OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs index ee1da86..6dec026 100644 --- a/OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs +++ b/OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs | |||
@@ -1,75 +1,75 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using OpenMetaverse; | 28 | using OpenMetaverse; |
29 | using OpenSim.Framework; | 29 | using OpenSim.Framework; |
30 | using OpenSim.Framework.Communications; | 30 | using OpenSim.Framework.Communications; |
31 | 31 | ||
32 | namespace OpenSim.Grid.MessagingServer.Modules | 32 | namespace OpenSim.Grid.MessagingServer.Modules |
33 | { | 33 | { |
34 | public class UserDataBaseService : UserManagerBase | 34 | public class UserDataBaseService : UserManagerBase |
35 | { | 35 | { |
36 | /// <summary> | 36 | /// <summary> |
37 | /// Constructor. | 37 | /// Constructor. |
38 | /// </summary> | 38 | /// </summary> |
39 | /// Passing null to parent because we never use any function that requires an interservice inventory call. | 39 | /// Passing null to parent because we never use any function that requires an interservice inventory call. |
40 | public UserDataBaseService() | 40 | public UserDataBaseService() |
41 | : base(null) | 41 | : base(null) |
42 | { | 42 | { |
43 | } | 43 | } |
44 | 44 | ||
45 | public UserAgentData GetUserAgentData(UUID AgentID) | 45 | public UserAgentData GetUserAgentData(UUID AgentID) |
46 | { | 46 | { |
47 | UserProfileData userProfile = GetUserProfile(AgentID); | 47 | UserProfileData userProfile = GetUserProfile(AgentID); |
48 | 48 | ||
49 | if (userProfile != null) | 49 | if (userProfile != null) |
50 | { | 50 | { |
51 | return userProfile.CurrentAgent; | 51 | return userProfile.CurrentAgent; |
52 | } | 52 | } |
53 | 53 | ||
54 | return null; | 54 | return null; |
55 | } | 55 | } |
56 | 56 | ||
57 | public override UserProfileData SetupMasterUser(string firstName, string lastName) | 57 | public override UserProfileData SetupMasterUser(string firstName, string lastName) |
58 | { | 58 | { |
59 | //throw new Exception("The method or operation is not implemented."); | 59 | //throw new Exception("The method or operation is not implemented."); |
60 | return null; | 60 | return null; |
61 | } | 61 | } |
62 | 62 | ||
63 | public override UserProfileData SetupMasterUser(string firstName, string lastName, string password) | 63 | public override UserProfileData SetupMasterUser(string firstName, string lastName, string password) |
64 | { | 64 | { |
65 | //throw new Exception("The method or operation is not implemented."); | 65 | //throw new Exception("The method or operation is not implemented."); |
66 | return null; | 66 | return null; |
67 | } | 67 | } |
68 | 68 | ||
69 | public override UserProfileData SetupMasterUser(UUID uuid) | 69 | public override UserProfileData SetupMasterUser(UUID uuid) |
70 | { | 70 | { |
71 | //throw new Exception("The method or operation is not implemented."); | 71 | //throw new Exception("The method or operation is not implemented."); |
72 | return null; | 72 | return null; |
73 | } | 73 | } |
74 | } | 74 | } |
75 | } | 75 | } |
diff --git a/OpenSim/Grid/MessagingServer.Modules/UserPresenceData.cs b/OpenSim/Grid/MessagingServer.Modules/UserPresenceData.cs index 2b56fe8..d548fc6 100644 --- a/OpenSim/Grid/MessagingServer.Modules/UserPresenceData.cs +++ b/OpenSim/Grid/MessagingServer.Modules/UserPresenceData.cs | |||
@@ -1,50 +1,50 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using OpenMetaverse; | 30 | using OpenMetaverse; |
31 | using OpenSim.Data; | 31 | using OpenSim.Data; |
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | 33 | ||
34 | namespace OpenSim.Grid.MessagingServer | 34 | namespace OpenSim.Grid.MessagingServer |
35 | { | 35 | { |
36 | public class UserPresenceData | 36 | public class UserPresenceData |
37 | { | 37 | { |
38 | public AgentCircuitData agentData = new AgentCircuitData(); | 38 | public AgentCircuitData agentData = new AgentCircuitData(); |
39 | public RegionProfileData regionData = new RegionProfileData(); | 39 | public RegionProfileData regionData = new RegionProfileData(); |
40 | public string httpURI = String.Empty; | 40 | public string httpURI = String.Empty; |
41 | public Dictionary<UUID, FriendListItem> friendData = new Dictionary<UUID,FriendListItem>(); | 41 | public Dictionary<UUID, FriendListItem> friendData = new Dictionary<UUID,FriendListItem>(); |
42 | public List<UUID> subscriptionData = new List<UUID>(); | 42 | public List<UUID> subscriptionData = new List<UUID>(); |
43 | public bool OnlineYN = true; | 43 | public bool OnlineYN = true; |
44 | public bool lookupUserRegionYN = true; | 44 | public bool lookupUserRegionYN = true; |
45 | 45 | ||
46 | public UserPresenceData() | 46 | public UserPresenceData() |
47 | { | 47 | { |
48 | } | 48 | } |
49 | } | 49 | } |
50 | } | 50 | } |
diff --git a/OpenSim/Grid/MessagingServer.Modules/WorkUnitBase.cs b/OpenSim/Grid/MessagingServer.Modules/WorkUnitBase.cs index cbd9443..0e0d562 100644 --- a/OpenSim/Grid/MessagingServer.Modules/WorkUnitBase.cs +++ b/OpenSim/Grid/MessagingServer.Modules/WorkUnitBase.cs | |||
@@ -1,33 +1,33 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | namespace OpenSim.Grid.MessagingServer.Modules | 28 | namespace OpenSim.Grid.MessagingServer.Modules |
29 | { | 29 | { |
30 | public class WorkUnitBase | 30 | public class WorkUnitBase |
31 | { | 31 | { |
32 | } | 32 | } |
33 | } | 33 | } |
diff --git a/OpenSim/Grid/MessagingServer.Modules/WorkUnitPresenceUpdate.cs b/OpenSim/Grid/MessagingServer.Modules/WorkUnitPresenceUpdate.cs index 7150cea..8eda305 100644 --- a/OpenSim/Grid/MessagingServer.Modules/WorkUnitPresenceUpdate.cs +++ b/OpenSim/Grid/MessagingServer.Modules/WorkUnitPresenceUpdate.cs | |||
@@ -1,33 +1,33 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | namespace OpenSim.Grid.MessagingServer.Modules | 28 | namespace OpenSim.Grid.MessagingServer.Modules |
29 | { | 29 | { |
30 | public class WorkUnitPresenceUpdate : WorkUnitBase | 30 | public class WorkUnitPresenceUpdate : WorkUnitBase |
31 | { | 31 | { |
32 | } | 32 | } |
33 | } | 33 | } |
diff --git a/OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs b/OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs index b98c614..59e9805 100644 --- a/OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs +++ b/OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs | |||
@@ -1,509 +1,509 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System.Collections; | 28 | using System.Collections; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Net; | 30 | using System.Net; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Threading; | 32 | using System.Threading; |
33 | using log4net; | 33 | using log4net; |
34 | using Nwc.XmlRpc; | 34 | using Nwc.XmlRpc; |
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Servers; | 37 | using OpenSim.Framework.Servers; |
38 | 38 | ||
39 | namespace OpenSim.Grid.UserServer.Modules | 39 | namespace OpenSim.Grid.UserServer.Modules |
40 | { | 40 | { |
41 | public enum NotificationRequest : int | 41 | public enum NotificationRequest : int |
42 | { | 42 | { |
43 | Login = 0, | 43 | Login = 0, |
44 | Logout = 1, | 44 | Logout = 1, |
45 | Shutdown = 2 | 45 | Shutdown = 2 |
46 | } | 46 | } |
47 | 47 | ||
48 | public struct PresenceNotification | 48 | public struct PresenceNotification |
49 | { | 49 | { |
50 | public NotificationRequest request; | 50 | public NotificationRequest request; |
51 | public UUID agentID; | 51 | public UUID agentID; |
52 | public UUID sessionID; | 52 | public UUID sessionID; |
53 | public UUID RegionID; | 53 | public UUID RegionID; |
54 | public ulong regionhandle; | 54 | public ulong regionhandle; |
55 | public float positionX; | 55 | public float positionX; |
56 | public float positionY; | 56 | public float positionY; |
57 | public float positionZ; | 57 | public float positionZ; |
58 | public string firstname; | 58 | public string firstname; |
59 | public string lastname; | 59 | public string lastname; |
60 | } | 60 | } |
61 | 61 | ||
62 | public delegate void AgentLocationDelegate(UUID agentID, UUID regionID, ulong regionHandle); | 62 | public delegate void AgentLocationDelegate(UUID agentID, UUID regionID, ulong regionHandle); |
63 | public delegate void AgentLeavingDelegate(UUID agentID, UUID regionID, ulong regionHandle); | 63 | public delegate void AgentLeavingDelegate(UUID agentID, UUID regionID, ulong regionHandle); |
64 | public delegate void RegionStartupDelegate(UUID regionID); | 64 | public delegate void RegionStartupDelegate(UUID regionID); |
65 | public delegate void RegionShutdownDelegate(UUID regionID); | 65 | public delegate void RegionShutdownDelegate(UUID regionID); |
66 | 66 | ||
67 | 67 | ||
68 | public class MessageServersConnector | 68 | public class MessageServersConnector |
69 | { | 69 | { |
70 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 70 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
71 | 71 | ||
72 | public Dictionary<string, MessageServerInfo> MessageServers; | 72 | public Dictionary<string, MessageServerInfo> MessageServers; |
73 | 73 | ||
74 | private BaseHttpServer m_httpServer; | 74 | private BaseHttpServer m_httpServer; |
75 | 75 | ||
76 | private BlockingQueue<PresenceNotification> m_NotifyQueue = | 76 | private BlockingQueue<PresenceNotification> m_NotifyQueue = |
77 | new BlockingQueue<PresenceNotification>(); | 77 | new BlockingQueue<PresenceNotification>(); |
78 | 78 | ||
79 | Thread m_NotifyThread; | 79 | Thread m_NotifyThread; |
80 | 80 | ||
81 | public event AgentLocationDelegate OnAgentLocation; | 81 | public event AgentLocationDelegate OnAgentLocation; |
82 | public event AgentLeavingDelegate OnAgentLeaving; | 82 | public event AgentLeavingDelegate OnAgentLeaving; |
83 | public event RegionStartupDelegate OnRegionStartup; | 83 | public event RegionStartupDelegate OnRegionStartup; |
84 | public event RegionShutdownDelegate OnRegionShutdown; | 84 | public event RegionShutdownDelegate OnRegionShutdown; |
85 | 85 | ||
86 | public MessageServersConnector() | 86 | public MessageServersConnector() |
87 | { | 87 | { |
88 | MessageServers = new Dictionary<string, MessageServerInfo>(); | 88 | MessageServers = new Dictionary<string, MessageServerInfo>(); |
89 | m_NotifyThread = new Thread(new ThreadStart(NotifyQueueRunner)); | 89 | m_NotifyThread = new Thread(new ThreadStart(NotifyQueueRunner)); |
90 | m_NotifyThread.Start(); | 90 | m_NotifyThread.Start(); |
91 | } | 91 | } |
92 | 92 | ||
93 | public void Initialise() | 93 | public void Initialise() |
94 | { | 94 | { |
95 | 95 | ||
96 | } | 96 | } |
97 | 97 | ||
98 | public void PostInitialise() | 98 | public void PostInitialise() |
99 | { | 99 | { |
100 | 100 | ||
101 | } | 101 | } |
102 | 102 | ||
103 | public void RegisterHandlers(BaseHttpServer httpServer) | 103 | public void RegisterHandlers(BaseHttpServer httpServer) |
104 | { | 104 | { |
105 | m_httpServer = httpServer; | 105 | m_httpServer = httpServer; |
106 | 106 | ||
107 | m_httpServer.AddXmlRPCHandler("region_startup", RegionStartup); | 107 | m_httpServer.AddXmlRPCHandler("region_startup", RegionStartup); |
108 | m_httpServer.AddXmlRPCHandler("region_shutdown", RegionShutdown); | 108 | m_httpServer.AddXmlRPCHandler("region_shutdown", RegionShutdown); |
109 | m_httpServer.AddXmlRPCHandler("agent_location", AgentLocation); | 109 | m_httpServer.AddXmlRPCHandler("agent_location", AgentLocation); |
110 | m_httpServer.AddXmlRPCHandler("agent_leaving", AgentLeaving); | 110 | m_httpServer.AddXmlRPCHandler("agent_leaving", AgentLeaving); |
111 | // Message Server ---> User Server | 111 | // Message Server ---> User Server |
112 | m_httpServer.AddXmlRPCHandler("register_messageserver", XmlRPCRegisterMessageServer); | 112 | m_httpServer.AddXmlRPCHandler("register_messageserver", XmlRPCRegisterMessageServer); |
113 | m_httpServer.AddXmlRPCHandler("agent_change_region", XmlRPCUserMovedtoRegion); | 113 | m_httpServer.AddXmlRPCHandler("agent_change_region", XmlRPCUserMovedtoRegion); |
114 | m_httpServer.AddXmlRPCHandler("deregister_messageserver", XmlRPCDeRegisterMessageServer); | 114 | m_httpServer.AddXmlRPCHandler("deregister_messageserver", XmlRPCDeRegisterMessageServer); |
115 | } | 115 | } |
116 | 116 | ||
117 | public void RegisterMessageServer(string URI, MessageServerInfo serverData) | 117 | public void RegisterMessageServer(string URI, MessageServerInfo serverData) |
118 | { | 118 | { |
119 | lock (MessageServers) | 119 | lock (MessageServers) |
120 | { | 120 | { |
121 | if (!MessageServers.ContainsKey(URI)) | 121 | if (!MessageServers.ContainsKey(URI)) |
122 | MessageServers.Add(URI, serverData); | 122 | MessageServers.Add(URI, serverData); |
123 | } | 123 | } |
124 | } | 124 | } |
125 | 125 | ||
126 | public void DeRegisterMessageServer(string URI) | 126 | public void DeRegisterMessageServer(string URI) |
127 | { | 127 | { |
128 | lock (MessageServers) | 128 | lock (MessageServers) |
129 | { | 129 | { |
130 | if (MessageServers.ContainsKey(URI)) | 130 | if (MessageServers.ContainsKey(URI)) |
131 | MessageServers.Remove(URI); | 131 | MessageServers.Remove(URI); |
132 | } | 132 | } |
133 | } | 133 | } |
134 | 134 | ||
135 | public void AddResponsibleRegion(string URI, ulong regionhandle) | 135 | public void AddResponsibleRegion(string URI, ulong regionhandle) |
136 | { | 136 | { |
137 | if (!MessageServers.ContainsKey(URI)) | 137 | if (!MessageServers.ContainsKey(URI)) |
138 | { | 138 | { |
139 | m_log.Warn("[MSGSERVER]: Got addResponsibleRegion Request for a MessageServer that isn't registered"); | 139 | m_log.Warn("[MSGSERVER]: Got addResponsibleRegion Request for a MessageServer that isn't registered"); |
140 | } | 140 | } |
141 | else | 141 | else |
142 | { | 142 | { |
143 | MessageServerInfo msginfo = MessageServers["URI"]; | 143 | MessageServerInfo msginfo = MessageServers["URI"]; |
144 | msginfo.responsibleForRegions.Add(regionhandle); | 144 | msginfo.responsibleForRegions.Add(regionhandle); |
145 | MessageServers["URI"] = msginfo; | 145 | MessageServers["URI"] = msginfo; |
146 | } | 146 | } |
147 | } | 147 | } |
148 | public void RemoveResponsibleRegion(string URI, ulong regionhandle) | 148 | public void RemoveResponsibleRegion(string URI, ulong regionhandle) |
149 | { | 149 | { |
150 | if (!MessageServers.ContainsKey(URI)) | 150 | if (!MessageServers.ContainsKey(URI)) |
151 | { | 151 | { |
152 | m_log.Warn("[MSGSERVER]: Got RemoveResponsibleRegion Request for a MessageServer that isn't registered"); | 152 | m_log.Warn("[MSGSERVER]: Got RemoveResponsibleRegion Request for a MessageServer that isn't registered"); |
153 | } | 153 | } |
154 | else | 154 | else |
155 | { | 155 | { |
156 | MessageServerInfo msginfo = MessageServers["URI"]; | 156 | MessageServerInfo msginfo = MessageServers["URI"]; |
157 | if (msginfo.responsibleForRegions.Contains(regionhandle)) | 157 | if (msginfo.responsibleForRegions.Contains(regionhandle)) |
158 | { | 158 | { |
159 | msginfo.responsibleForRegions.Remove(regionhandle); | 159 | msginfo.responsibleForRegions.Remove(regionhandle); |
160 | MessageServers["URI"] = msginfo; | 160 | MessageServers["URI"] = msginfo; |
161 | } | 161 | } |
162 | } | 162 | } |
163 | 163 | ||
164 | } | 164 | } |
165 | public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request) | 165 | public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request) |
166 | { | 166 | { |
167 | XmlRpcResponse response = new XmlRpcResponse(); | 167 | XmlRpcResponse response = new XmlRpcResponse(); |
168 | Hashtable requestData = (Hashtable)request.Params[0]; | 168 | Hashtable requestData = (Hashtable)request.Params[0]; |
169 | Hashtable responseData = new Hashtable(); | 169 | Hashtable responseData = new Hashtable(); |
170 | 170 | ||
171 | if (requestData.Contains("uri")) | 171 | if (requestData.Contains("uri")) |
172 | { | 172 | { |
173 | string URI = (string)requestData["uri"]; | 173 | string URI = (string)requestData["uri"]; |
174 | string sendkey=(string)requestData["sendkey"]; | 174 | string sendkey=(string)requestData["sendkey"]; |
175 | string recvkey=(string)requestData["recvkey"]; | 175 | string recvkey=(string)requestData["recvkey"]; |
176 | MessageServerInfo m = new MessageServerInfo(); | 176 | MessageServerInfo m = new MessageServerInfo(); |
177 | m.URI = URI; | 177 | m.URI = URI; |
178 | m.sendkey = sendkey; | 178 | m.sendkey = sendkey; |
179 | m.recvkey = recvkey; | 179 | m.recvkey = recvkey; |
180 | RegisterMessageServer(URI, m); | 180 | RegisterMessageServer(URI, m); |
181 | responseData["responsestring"] = "TRUE"; | 181 | responseData["responsestring"] = "TRUE"; |
182 | response.Value = responseData; | 182 | response.Value = responseData; |
183 | } | 183 | } |
184 | return response; | 184 | return response; |
185 | } | 185 | } |
186 | public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request) | 186 | public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request) |
187 | { | 187 | { |
188 | XmlRpcResponse response = new XmlRpcResponse(); | 188 | XmlRpcResponse response = new XmlRpcResponse(); |
189 | Hashtable requestData = (Hashtable)request.Params[0]; | 189 | Hashtable requestData = (Hashtable)request.Params[0]; |
190 | Hashtable responseData = new Hashtable(); | 190 | Hashtable responseData = new Hashtable(); |
191 | 191 | ||
192 | if (requestData.Contains("uri")) | 192 | if (requestData.Contains("uri")) |
193 | { | 193 | { |
194 | string URI = (string)requestData["uri"]; | 194 | string URI = (string)requestData["uri"]; |
195 | 195 | ||
196 | DeRegisterMessageServer(URI); | 196 | DeRegisterMessageServer(URI); |
197 | responseData["responsestring"] = "TRUE"; | 197 | responseData["responsestring"] = "TRUE"; |
198 | response.Value = responseData; | 198 | response.Value = responseData; |
199 | } | 199 | } |
200 | return response; | 200 | return response; |
201 | } | 201 | } |
202 | public XmlRpcResponse XmlRPCUserMovedtoRegion(XmlRpcRequest request) | 202 | public XmlRpcResponse XmlRPCUserMovedtoRegion(XmlRpcRequest request) |
203 | { | 203 | { |
204 | XmlRpcResponse response = new XmlRpcResponse(); | 204 | XmlRpcResponse response = new XmlRpcResponse(); |
205 | Hashtable requestData = (Hashtable)request.Params[0]; | 205 | Hashtable requestData = (Hashtable)request.Params[0]; |
206 | Hashtable responseData = new Hashtable(); | 206 | Hashtable responseData = new Hashtable(); |
207 | 207 | ||
208 | if (requestData.Contains("fromuri")) | 208 | if (requestData.Contains("fromuri")) |
209 | { | 209 | { |
210 | // string sURI = (string)requestData["fromuri"]; | 210 | // string sURI = (string)requestData["fromuri"]; |
211 | // string sagentID = (string)requestData["agentid"]; | 211 | // string sagentID = (string)requestData["agentid"]; |
212 | // string ssessionID = (string)requestData["sessionid"]; | 212 | // string ssessionID = (string)requestData["sessionid"]; |
213 | // string scurrentRegionID = (string)requestData["regionid"]; | 213 | // string scurrentRegionID = (string)requestData["regionid"]; |
214 | // string sregionhandle = (string)requestData["regionhandle"]; | 214 | // string sregionhandle = (string)requestData["regionhandle"]; |
215 | // string scurrentpos = (string)requestData["currentpos"]; | 215 | // string scurrentpos = (string)requestData["currentpos"]; |
216 | //Vector3.TryParse((string)reader["currentPos"], out retval.currentPos); | 216 | //Vector3.TryParse((string)reader["currentPos"], out retval.currentPos); |
217 | // TODO: Okay now raise event so the user server can pass this data to the Usermanager | 217 | // TODO: Okay now raise event so the user server can pass this data to the Usermanager |
218 | 218 | ||
219 | responseData["responsestring"] = "TRUE"; | 219 | responseData["responsestring"] = "TRUE"; |
220 | response.Value = responseData; | 220 | response.Value = responseData; |
221 | } | 221 | } |
222 | return response; | 222 | return response; |
223 | } | 223 | } |
224 | 224 | ||
225 | public void TellMessageServersAboutUser(UUID agentID, UUID sessionID, UUID RegionID, | 225 | public void TellMessageServersAboutUser(UUID agentID, UUID sessionID, UUID RegionID, |
226 | ulong regionhandle, float positionX, float positionY, | 226 | ulong regionhandle, float positionX, float positionY, |
227 | float positionZ, string firstname, string lastname) | 227 | float positionZ, string firstname, string lastname) |
228 | { | 228 | { |
229 | PresenceNotification notification = new PresenceNotification(); | 229 | PresenceNotification notification = new PresenceNotification(); |
230 | 230 | ||
231 | notification.request = NotificationRequest.Login; | 231 | notification.request = NotificationRequest.Login; |
232 | notification.agentID = agentID; | 232 | notification.agentID = agentID; |
233 | notification.sessionID = sessionID; | 233 | notification.sessionID = sessionID; |
234 | notification.RegionID = RegionID; | 234 | notification.RegionID = RegionID; |
235 | notification.regionhandle = regionhandle; | 235 | notification.regionhandle = regionhandle; |
236 | notification.positionX = positionX; | 236 | notification.positionX = positionX; |
237 | notification.positionY = positionY; | 237 | notification.positionY = positionY; |
238 | notification.positionZ = positionZ; | 238 | notification.positionZ = positionZ; |
239 | notification.firstname = firstname; | 239 | notification.firstname = firstname; |
240 | notification.lastname = lastname; | 240 | notification.lastname = lastname; |
241 | 241 | ||
242 | m_NotifyQueue.Enqueue(notification); | 242 | m_NotifyQueue.Enqueue(notification); |
243 | } | 243 | } |
244 | 244 | ||
245 | private void TellMessageServersAboutUserInternal(UUID agentID, UUID sessionID, UUID RegionID, | 245 | private void TellMessageServersAboutUserInternal(UUID agentID, UUID sessionID, UUID RegionID, |
246 | ulong regionhandle, float positionX, float positionY, | 246 | ulong regionhandle, float positionX, float positionY, |
247 | float positionZ, string firstname, string lastname) | 247 | float positionZ, string firstname, string lastname) |
248 | { | 248 | { |
249 | // Loop over registered Message Servers (AND THERE WILL BE MORE THEN ONE :D) | 249 | // Loop over registered Message Servers (AND THERE WILL BE MORE THEN ONE :D) |
250 | lock (MessageServers) | 250 | lock (MessageServers) |
251 | { | 251 | { |
252 | if (MessageServers.Count > 0) | 252 | if (MessageServers.Count > 0) |
253 | { | 253 | { |
254 | m_log.Info("[MSGCONNECTOR]: Sending login notice to registered message servers"); | 254 | m_log.Info("[MSGCONNECTOR]: Sending login notice to registered message servers"); |
255 | } | 255 | } |
256 | // else | 256 | // else |
257 | // { | 257 | // { |
258 | // m_log.Debug("[MSGCONNECTOR]: No Message Servers registered, ignoring"); | 258 | // m_log.Debug("[MSGCONNECTOR]: No Message Servers registered, ignoring"); |
259 | // } | 259 | // } |
260 | foreach (MessageServerInfo serv in MessageServers.Values) | 260 | foreach (MessageServerInfo serv in MessageServers.Values) |
261 | { | 261 | { |
262 | NotifyMessageServerAboutUser(serv, agentID, sessionID, RegionID, | 262 | NotifyMessageServerAboutUser(serv, agentID, sessionID, RegionID, |
263 | regionhandle, positionX, positionY, positionZ, | 263 | regionhandle, positionX, positionY, positionZ, |
264 | firstname, lastname); | 264 | firstname, lastname); |
265 | } | 265 | } |
266 | } | 266 | } |
267 | } | 267 | } |
268 | 268 | ||
269 | private void TellMessageServersAboutUserLogoffInternal(UUID agentID) | 269 | private void TellMessageServersAboutUserLogoffInternal(UUID agentID) |
270 | { | 270 | { |
271 | lock (MessageServers) | 271 | lock (MessageServers) |
272 | { | 272 | { |
273 | if (MessageServers.Count > 0) | 273 | if (MessageServers.Count > 0) |
274 | { | 274 | { |
275 | m_log.Info("[MSGCONNECTOR]: Sending logoff notice to registered message servers"); | 275 | m_log.Info("[MSGCONNECTOR]: Sending logoff notice to registered message servers"); |
276 | } | 276 | } |
277 | else | 277 | else |
278 | { | 278 | { |
279 | // m_log.Debug("[MSGCONNECTOR]: No Message Servers registered, ignoring"); | 279 | // m_log.Debug("[MSGCONNECTOR]: No Message Servers registered, ignoring"); |
280 | } | 280 | } |
281 | foreach (MessageServerInfo serv in MessageServers.Values) | 281 | foreach (MessageServerInfo serv in MessageServers.Values) |
282 | { | 282 | { |
283 | NotifyMessageServerAboutUserLogoff(serv,agentID); | 283 | NotifyMessageServerAboutUserLogoff(serv,agentID); |
284 | } | 284 | } |
285 | } | 285 | } |
286 | } | 286 | } |
287 | 287 | ||
288 | private void TellMessageServersAboutRegionShutdownInternal(UUID regionID) | 288 | private void TellMessageServersAboutRegionShutdownInternal(UUID regionID) |
289 | { | 289 | { |
290 | lock (MessageServers) | 290 | lock (MessageServers) |
291 | { | 291 | { |
292 | if (MessageServers.Count > 0) | 292 | if (MessageServers.Count > 0) |
293 | { | 293 | { |
294 | m_log.Info("[MSGCONNECTOR]: Sending region down notice to registered message servers"); | 294 | m_log.Info("[MSGCONNECTOR]: Sending region down notice to registered message servers"); |
295 | } | 295 | } |
296 | else | 296 | else |
297 | { | 297 | { |
298 | // m_log.Debug("[MSGCONNECTOR]: No Message Servers registered, ignoring"); | 298 | // m_log.Debug("[MSGCONNECTOR]: No Message Servers registered, ignoring"); |
299 | } | 299 | } |
300 | foreach (MessageServerInfo serv in MessageServers.Values) | 300 | foreach (MessageServerInfo serv in MessageServers.Values) |
301 | { | 301 | { |
302 | NotifyMessageServerAboutRegionShutdown(serv,regionID); | 302 | NotifyMessageServerAboutRegionShutdown(serv,regionID); |
303 | } | 303 | } |
304 | } | 304 | } |
305 | } | 305 | } |
306 | 306 | ||
307 | public void TellMessageServersAboutUserLogoff(UUID agentID) | 307 | public void TellMessageServersAboutUserLogoff(UUID agentID) |
308 | { | 308 | { |
309 | PresenceNotification notification = new PresenceNotification(); | 309 | PresenceNotification notification = new PresenceNotification(); |
310 | 310 | ||
311 | notification.request = NotificationRequest.Logout; | 311 | notification.request = NotificationRequest.Logout; |
312 | notification.agentID = agentID; | 312 | notification.agentID = agentID; |
313 | 313 | ||
314 | m_NotifyQueue.Enqueue(notification); | 314 | m_NotifyQueue.Enqueue(notification); |
315 | } | 315 | } |
316 | 316 | ||
317 | public void TellMessageServersAboutRegionShutdown(UUID regionID) | 317 | public void TellMessageServersAboutRegionShutdown(UUID regionID) |
318 | { | 318 | { |
319 | PresenceNotification notification = new PresenceNotification(); | 319 | PresenceNotification notification = new PresenceNotification(); |
320 | 320 | ||
321 | notification.request = NotificationRequest.Shutdown; | 321 | notification.request = NotificationRequest.Shutdown; |
322 | notification.RegionID = regionID; | 322 | notification.RegionID = regionID; |
323 | 323 | ||
324 | m_NotifyQueue.Enqueue(notification); | 324 | m_NotifyQueue.Enqueue(notification); |
325 | } | 325 | } |
326 | 326 | ||
327 | private void NotifyMessageServerAboutUserLogoff(MessageServerInfo serv, UUID agentID) | 327 | private void NotifyMessageServerAboutUserLogoff(MessageServerInfo serv, UUID agentID) |
328 | { | 328 | { |
329 | Hashtable reqparams = new Hashtable(); | 329 | Hashtable reqparams = new Hashtable(); |
330 | reqparams["sendkey"] = serv.sendkey; | 330 | reqparams["sendkey"] = serv.sendkey; |
331 | reqparams["agentid"] = agentID.ToString(); | 331 | reqparams["agentid"] = agentID.ToString(); |
332 | ArrayList SendParams = new ArrayList(); | 332 | ArrayList SendParams = new ArrayList(); |
333 | SendParams.Add(reqparams); | 333 | SendParams.Add(reqparams); |
334 | 334 | ||
335 | XmlRpcRequest GridReq = new XmlRpcRequest("logout_of_simulator", SendParams); | 335 | XmlRpcRequest GridReq = new XmlRpcRequest("logout_of_simulator", SendParams); |
336 | try | 336 | try |
337 | { | 337 | { |
338 | GridReq.Send(serv.URI, 6000); | 338 | GridReq.Send(serv.URI, 6000); |
339 | } | 339 | } |
340 | catch (WebException) | 340 | catch (WebException) |
341 | { | 341 | { |
342 | m_log.Warn("[MSGCONNECTOR]: Unable to notify Message Server about log out. Other users might still think this user is online"); | 342 | m_log.Warn("[MSGCONNECTOR]: Unable to notify Message Server about log out. Other users might still think this user is online"); |
343 | } | 343 | } |
344 | m_log.Info("[LOGOUT]: Notified : " + serv.URI + " about user logout"); | 344 | m_log.Info("[LOGOUT]: Notified : " + serv.URI + " about user logout"); |
345 | } | 345 | } |
346 | 346 | ||
347 | private void NotifyMessageServerAboutRegionShutdown(MessageServerInfo serv, UUID regionID) | 347 | private void NotifyMessageServerAboutRegionShutdown(MessageServerInfo serv, UUID regionID) |
348 | { | 348 | { |
349 | Hashtable reqparams = new Hashtable(); | 349 | Hashtable reqparams = new Hashtable(); |
350 | reqparams["sendkey"] = serv.sendkey; | 350 | reqparams["sendkey"] = serv.sendkey; |
351 | reqparams["regionid"] = regionID.ToString(); | 351 | reqparams["regionid"] = regionID.ToString(); |
352 | ArrayList SendParams = new ArrayList(); | 352 | ArrayList SendParams = new ArrayList(); |
353 | SendParams.Add(reqparams); | 353 | SendParams.Add(reqparams); |
354 | 354 | ||
355 | XmlRpcRequest GridReq = new XmlRpcRequest("process_region_shutdown", SendParams); | 355 | XmlRpcRequest GridReq = new XmlRpcRequest("process_region_shutdown", SendParams); |
356 | try | 356 | try |
357 | { | 357 | { |
358 | GridReq.Send(serv.URI, 6000); | 358 | GridReq.Send(serv.URI, 6000); |
359 | } | 359 | } |
360 | catch (WebException) | 360 | catch (WebException) |
361 | { | 361 | { |
362 | m_log.Warn("[MSGCONNECTOR]: Unable to notify Message Server about region shutdown."); | 362 | m_log.Warn("[MSGCONNECTOR]: Unable to notify Message Server about region shutdown."); |
363 | } | 363 | } |
364 | m_log.Info("[REGION UPDOWN]: Notified : " + serv.URI + " about region state change"); | 364 | m_log.Info("[REGION UPDOWN]: Notified : " + serv.URI + " about region state change"); |
365 | } | 365 | } |
366 | 366 | ||
367 | private void NotifyMessageServerAboutUser(MessageServerInfo serv, | 367 | private void NotifyMessageServerAboutUser(MessageServerInfo serv, |
368 | UUID agentID, UUID sessionID, UUID RegionID, | 368 | UUID agentID, UUID sessionID, UUID RegionID, |
369 | ulong regionhandle, float positionX, float positionY, float positionZ, | 369 | ulong regionhandle, float positionX, float positionY, float positionZ, |
370 | string firstname, string lastname) | 370 | string firstname, string lastname) |
371 | { | 371 | { |
372 | Hashtable reqparams = new Hashtable(); | 372 | Hashtable reqparams = new Hashtable(); |
373 | reqparams["sendkey"] = serv.sendkey; | 373 | reqparams["sendkey"] = serv.sendkey; |
374 | reqparams["agentid"] = agentID.ToString(); | 374 | reqparams["agentid"] = agentID.ToString(); |
375 | reqparams["sessionid"] = sessionID.ToString(); | 375 | reqparams["sessionid"] = sessionID.ToString(); |
376 | reqparams["regionid"] = RegionID.ToString(); | 376 | reqparams["regionid"] = RegionID.ToString(); |
377 | reqparams["regionhandle"] = regionhandle.ToString(); | 377 | reqparams["regionhandle"] = regionhandle.ToString(); |
378 | reqparams["positionx"] = positionX.ToString(); | 378 | reqparams["positionx"] = positionX.ToString(); |
379 | reqparams["positiony"] = positionY.ToString(); | 379 | reqparams["positiony"] = positionY.ToString(); |
380 | reqparams["positionz"] = positionZ.ToString(); | 380 | reqparams["positionz"] = positionZ.ToString(); |
381 | reqparams["firstname"] = firstname; | 381 | reqparams["firstname"] = firstname; |
382 | reqparams["lastname"] = lastname; | 382 | reqparams["lastname"] = lastname; |
383 | 383 | ||
384 | //reqparams["position"] = Position.ToString(); | 384 | //reqparams["position"] = Position.ToString(); |
385 | 385 | ||
386 | ArrayList SendParams = new ArrayList(); | 386 | ArrayList SendParams = new ArrayList(); |
387 | SendParams.Add(reqparams); | 387 | SendParams.Add(reqparams); |
388 | 388 | ||
389 | XmlRpcRequest GridReq = new XmlRpcRequest("login_to_simulator", SendParams); | 389 | XmlRpcRequest GridReq = new XmlRpcRequest("login_to_simulator", SendParams); |
390 | try | 390 | try |
391 | { | 391 | { |
392 | GridReq.Send(serv.URI, 6000); | 392 | GridReq.Send(serv.URI, 6000); |
393 | m_log.Info("[LOGIN]: Notified : " + serv.URI + " about user login"); | 393 | m_log.Info("[LOGIN]: Notified : " + serv.URI + " about user login"); |
394 | } | 394 | } |
395 | catch (WebException) | 395 | catch (WebException) |
396 | { | 396 | { |
397 | m_log.Warn("[MSGCONNECTOR]: Unable to notify Message Server about login. Presence might be borked for this user"); | 397 | m_log.Warn("[MSGCONNECTOR]: Unable to notify Message Server about login. Presence might be borked for this user"); |
398 | } | 398 | } |
399 | 399 | ||
400 | } | 400 | } |
401 | 401 | ||
402 | private void NotifyQueueRunner() | 402 | private void NotifyQueueRunner() |
403 | { | 403 | { |
404 | while (true) | 404 | while (true) |
405 | { | 405 | { |
406 | PresenceNotification presence = m_NotifyQueue.Dequeue(); | 406 | PresenceNotification presence = m_NotifyQueue.Dequeue(); |
407 | 407 | ||
408 | if (presence.request == NotificationRequest.Shutdown) | 408 | if (presence.request == NotificationRequest.Shutdown) |
409 | { | 409 | { |
410 | TellMessageServersAboutRegionShutdownInternal(presence.RegionID); | 410 | TellMessageServersAboutRegionShutdownInternal(presence.RegionID); |
411 | } | 411 | } |
412 | 412 | ||
413 | if (presence.request == NotificationRequest.Login) | 413 | if (presence.request == NotificationRequest.Login) |
414 | { | 414 | { |
415 | TellMessageServersAboutUserInternal(presence.agentID, | 415 | TellMessageServersAboutUserInternal(presence.agentID, |
416 | presence.sessionID, presence.RegionID, | 416 | presence.sessionID, presence.RegionID, |
417 | presence.regionhandle, presence.positionX, | 417 | presence.regionhandle, presence.positionX, |
418 | presence.positionY, presence.positionZ, | 418 | presence.positionY, presence.positionZ, |
419 | presence.firstname, presence.lastname); | 419 | presence.firstname, presence.lastname); |
420 | } | 420 | } |
421 | 421 | ||
422 | if (presence.request == NotificationRequest.Logout) | 422 | if (presence.request == NotificationRequest.Logout) |
423 | { | 423 | { |
424 | TellMessageServersAboutUserLogoffInternal(presence.agentID); | 424 | TellMessageServersAboutUserLogoffInternal(presence.agentID); |
425 | } | 425 | } |
426 | } | 426 | } |
427 | } | 427 | } |
428 | 428 | ||
429 | public XmlRpcResponse RegionStartup(XmlRpcRequest request) | 429 | public XmlRpcResponse RegionStartup(XmlRpcRequest request) |
430 | { | 430 | { |
431 | Hashtable requestData = (Hashtable)request.Params[0]; | 431 | Hashtable requestData = (Hashtable)request.Params[0]; |
432 | Hashtable result = new Hashtable(); | 432 | Hashtable result = new Hashtable(); |
433 | 433 | ||
434 | UUID regionID; | 434 | UUID regionID; |
435 | if (UUID.TryParse((string)requestData["RegionUUID"], out regionID)) | 435 | if (UUID.TryParse((string)requestData["RegionUUID"], out regionID)) |
436 | { | 436 | { |
437 | if (OnRegionStartup != null) | 437 | if (OnRegionStartup != null) |
438 | OnRegionStartup(regionID); | 438 | OnRegionStartup(regionID); |
439 | 439 | ||
440 | result["responsestring"] = "TRUE"; | 440 | result["responsestring"] = "TRUE"; |
441 | } | 441 | } |
442 | 442 | ||
443 | XmlRpcResponse response = new XmlRpcResponse(); | 443 | XmlRpcResponse response = new XmlRpcResponse(); |
444 | response.Value = result; | 444 | response.Value = result; |
445 | return response; | 445 | return response; |
446 | } | 446 | } |
447 | 447 | ||
448 | public XmlRpcResponse RegionShutdown(XmlRpcRequest request) | 448 | public XmlRpcResponse RegionShutdown(XmlRpcRequest request) |
449 | { | 449 | { |
450 | Hashtable requestData = (Hashtable)request.Params[0]; | 450 | Hashtable requestData = (Hashtable)request.Params[0]; |
451 | Hashtable result = new Hashtable(); | 451 | Hashtable result = new Hashtable(); |
452 | 452 | ||
453 | UUID regionID; | 453 | UUID regionID; |
454 | if (UUID.TryParse((string)requestData["RegionUUID"], out regionID)) | 454 | if (UUID.TryParse((string)requestData["RegionUUID"], out regionID)) |
455 | { | 455 | { |
456 | if (OnRegionShutdown != null) | 456 | if (OnRegionShutdown != null) |
457 | OnRegionShutdown(regionID); | 457 | OnRegionShutdown(regionID); |
458 | 458 | ||
459 | result["responsestring"] = "TRUE"; | 459 | result["responsestring"] = "TRUE"; |
460 | } | 460 | } |
461 | 461 | ||
462 | XmlRpcResponse response = new XmlRpcResponse(); | 462 | XmlRpcResponse response = new XmlRpcResponse(); |
463 | response.Value = result; | 463 | response.Value = result; |
464 | return response; | 464 | return response; |
465 | } | 465 | } |
466 | 466 | ||
467 | public XmlRpcResponse AgentLocation(XmlRpcRequest request) | 467 | public XmlRpcResponse AgentLocation(XmlRpcRequest request) |
468 | { | 468 | { |
469 | Hashtable requestData = (Hashtable)request.Params[0]; | 469 | Hashtable requestData = (Hashtable)request.Params[0]; |
470 | Hashtable result = new Hashtable(); | 470 | Hashtable result = new Hashtable(); |
471 | 471 | ||
472 | UUID agentID; | 472 | UUID agentID; |
473 | UUID regionID; | 473 | UUID regionID; |
474 | ulong regionHandle; | 474 | ulong regionHandle; |
475 | if (UUID.TryParse((string)requestData["AgentID"], out agentID) && UUID.TryParse((string)requestData["RegionUUID"], out regionID) && ulong.TryParse((string)requestData["RegionHandle"], out regionHandle)) | 475 | if (UUID.TryParse((string)requestData["AgentID"], out agentID) && UUID.TryParse((string)requestData["RegionUUID"], out regionID) && ulong.TryParse((string)requestData["RegionHandle"], out regionHandle)) |
476 | { | 476 | { |
477 | if (OnAgentLocation != null) | 477 | if (OnAgentLocation != null) |
478 | OnAgentLocation(agentID, regionID, regionHandle); | 478 | OnAgentLocation(agentID, regionID, regionHandle); |
479 | 479 | ||
480 | result["responsestring"] = "TRUE"; | 480 | result["responsestring"] = "TRUE"; |
481 | } | 481 | } |
482 | 482 | ||
483 | XmlRpcResponse response = new XmlRpcResponse(); | 483 | XmlRpcResponse response = new XmlRpcResponse(); |
484 | response.Value = result; | 484 | response.Value = result; |
485 | return response; | 485 | return response; |
486 | } | 486 | } |
487 | 487 | ||
488 | public XmlRpcResponse AgentLeaving(XmlRpcRequest request) | 488 | public XmlRpcResponse AgentLeaving(XmlRpcRequest request) |
489 | { | 489 | { |
490 | Hashtable requestData = (Hashtable)request.Params[0]; | 490 | Hashtable requestData = (Hashtable)request.Params[0]; |
491 | Hashtable result = new Hashtable(); | 491 | Hashtable result = new Hashtable(); |
492 | 492 | ||
493 | UUID agentID; | 493 | UUID agentID; |
494 | UUID regionID; | 494 | UUID regionID; |
495 | ulong regionHandle; | 495 | ulong regionHandle; |
496 | if (UUID.TryParse((string)requestData["AgentID"], out agentID) && UUID.TryParse((string)requestData["RegionUUID"], out regionID) && ulong.TryParse((string)requestData["RegionHandle"], out regionHandle)) | 496 | if (UUID.TryParse((string)requestData["AgentID"], out agentID) && UUID.TryParse((string)requestData["RegionUUID"], out regionID) && ulong.TryParse((string)requestData["RegionHandle"], out regionHandle)) |
497 | { | 497 | { |
498 | if (OnAgentLeaving != null) | 498 | if (OnAgentLeaving != null) |
499 | OnAgentLeaving(agentID, regionID, regionHandle); | 499 | OnAgentLeaving(agentID, regionID, regionHandle); |
500 | 500 | ||
501 | result["responsestring"] = "TRUE"; | 501 | result["responsestring"] = "TRUE"; |
502 | } | 502 | } |
503 | 503 | ||
504 | XmlRpcResponse response = new XmlRpcResponse(); | 504 | XmlRpcResponse response = new XmlRpcResponse(); |
505 | response.Value = result; | 505 | response.Value = result; |
506 | return response; | 506 | return response; |
507 | } | 507 | } |
508 | } | 508 | } |
509 | } | 509 | } |
diff --git a/OpenSim/Grid/UserServer.Modules/OpenIdService.cs b/OpenSim/Grid/UserServer.Modules/OpenIdService.cs index 5c8501f..28a8fdb 100644 --- a/OpenSim/Grid/UserServer.Modules/OpenIdService.cs +++ b/OpenSim/Grid/UserServer.Modules/OpenIdService.cs | |||
@@ -1,337 +1,337 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Collections.Specialized; | 30 | using System.Collections.Specialized; |
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Net; | 32 | using System.Net; |
33 | using System.Web; | 33 | using System.Web; |
34 | using DotNetOpenId; | 34 | using DotNetOpenId; |
35 | using DotNetOpenId.Provider; | 35 | using DotNetOpenId.Provider; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Servers; | 37 | using OpenSim.Framework.Servers; |
38 | 38 | ||
39 | namespace OpenSim.Grid.UserServer.Modules | 39 | namespace OpenSim.Grid.UserServer.Modules |
40 | { | 40 | { |
41 | /// <summary> | 41 | /// <summary> |
42 | /// Temporary, in-memory store for OpenID associations | 42 | /// Temporary, in-memory store for OpenID associations |
43 | /// </summary> | 43 | /// </summary> |
44 | public class ProviderMemoryStore : IAssociationStore<AssociationRelyingPartyType> | 44 | public class ProviderMemoryStore : IAssociationStore<AssociationRelyingPartyType> |
45 | { | 45 | { |
46 | private class AssociationItem | 46 | private class AssociationItem |
47 | { | 47 | { |
48 | public AssociationRelyingPartyType DistinguishingFactor; | 48 | public AssociationRelyingPartyType DistinguishingFactor; |
49 | public string Handle; | 49 | public string Handle; |
50 | public DateTime Expires; | 50 | public DateTime Expires; |
51 | public byte[] PrivateData; | 51 | public byte[] PrivateData; |
52 | } | 52 | } |
53 | 53 | ||
54 | Dictionary<string, AssociationItem> m_store = new Dictionary<string, AssociationItem>(); | 54 | Dictionary<string, AssociationItem> m_store = new Dictionary<string, AssociationItem>(); |
55 | SortedList<DateTime, AssociationItem> m_sortedStore = new SortedList<DateTime, AssociationItem>(); | 55 | SortedList<DateTime, AssociationItem> m_sortedStore = new SortedList<DateTime, AssociationItem>(); |
56 | object m_syncRoot = new object(); | 56 | object m_syncRoot = new object(); |
57 | 57 | ||
58 | #region IAssociationStore<AssociationRelyingPartyType> Members | 58 | #region IAssociationStore<AssociationRelyingPartyType> Members |
59 | 59 | ||
60 | public void StoreAssociation(AssociationRelyingPartyType distinguishingFactor, Association assoc) | 60 | public void StoreAssociation(AssociationRelyingPartyType distinguishingFactor, Association assoc) |
61 | { | 61 | { |
62 | AssociationItem item = new AssociationItem(); | 62 | AssociationItem item = new AssociationItem(); |
63 | item.DistinguishingFactor = distinguishingFactor; | 63 | item.DistinguishingFactor = distinguishingFactor; |
64 | item.Handle = assoc.Handle; | 64 | item.Handle = assoc.Handle; |
65 | item.Expires = assoc.Expires.ToLocalTime(); | 65 | item.Expires = assoc.Expires.ToLocalTime(); |
66 | item.PrivateData = assoc.SerializePrivateData(); | 66 | item.PrivateData = assoc.SerializePrivateData(); |
67 | 67 | ||
68 | lock (m_syncRoot) | 68 | lock (m_syncRoot) |
69 | { | 69 | { |
70 | m_store[item.Handle] = item; | 70 | m_store[item.Handle] = item; |
71 | m_sortedStore[item.Expires] = item; | 71 | m_sortedStore[item.Expires] = item; |
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | public Association GetAssociation(AssociationRelyingPartyType distinguishingFactor) | 75 | public Association GetAssociation(AssociationRelyingPartyType distinguishingFactor) |
76 | { | 76 | { |
77 | lock (m_syncRoot) | 77 | lock (m_syncRoot) |
78 | { | 78 | { |
79 | if (m_sortedStore.Count > 0) | 79 | if (m_sortedStore.Count > 0) |
80 | { | 80 | { |
81 | AssociationItem item = m_sortedStore.Values[m_sortedStore.Count - 1]; | 81 | AssociationItem item = m_sortedStore.Values[m_sortedStore.Count - 1]; |
82 | return Association.Deserialize(item.Handle, item.Expires.ToUniversalTime(), item.PrivateData); | 82 | return Association.Deserialize(item.Handle, item.Expires.ToUniversalTime(), item.PrivateData); |
83 | } | 83 | } |
84 | else | 84 | else |
85 | { | 85 | { |
86 | return null; | 86 | return null; |
87 | } | 87 | } |
88 | } | 88 | } |
89 | } | 89 | } |
90 | 90 | ||
91 | public Association GetAssociation(AssociationRelyingPartyType distinguishingFactor, string handle) | 91 | public Association GetAssociation(AssociationRelyingPartyType distinguishingFactor, string handle) |
92 | { | 92 | { |
93 | AssociationItem item; | 93 | AssociationItem item; |
94 | bool success = false; | 94 | bool success = false; |
95 | lock (m_syncRoot) | 95 | lock (m_syncRoot) |
96 | success = m_store.TryGetValue(handle, out item); | 96 | success = m_store.TryGetValue(handle, out item); |
97 | 97 | ||
98 | if (success) | 98 | if (success) |
99 | return Association.Deserialize(item.Handle, item.Expires.ToUniversalTime(), item.PrivateData); | 99 | return Association.Deserialize(item.Handle, item.Expires.ToUniversalTime(), item.PrivateData); |
100 | else | 100 | else |
101 | return null; | 101 | return null; |
102 | } | 102 | } |
103 | 103 | ||
104 | public bool RemoveAssociation(AssociationRelyingPartyType distinguishingFactor, string handle) | 104 | public bool RemoveAssociation(AssociationRelyingPartyType distinguishingFactor, string handle) |
105 | { | 105 | { |
106 | lock (m_syncRoot) | 106 | lock (m_syncRoot) |
107 | { | 107 | { |
108 | for (int i = 0; i < m_sortedStore.Values.Count; i++) | 108 | for (int i = 0; i < m_sortedStore.Values.Count; i++) |
109 | { | 109 | { |
110 | AssociationItem item = m_sortedStore.Values[i]; | 110 | AssociationItem item = m_sortedStore.Values[i]; |
111 | if (item.Handle == handle) | 111 | if (item.Handle == handle) |
112 | { | 112 | { |
113 | m_sortedStore.RemoveAt(i); | 113 | m_sortedStore.RemoveAt(i); |
114 | break; | 114 | break; |
115 | } | 115 | } |
116 | } | 116 | } |
117 | 117 | ||
118 | return m_store.Remove(handle); | 118 | return m_store.Remove(handle); |
119 | } | 119 | } |
120 | } | 120 | } |
121 | 121 | ||
122 | public void ClearExpiredAssociations() | 122 | public void ClearExpiredAssociations() |
123 | { | 123 | { |
124 | lock (m_syncRoot) | 124 | lock (m_syncRoot) |
125 | { | 125 | { |
126 | List<AssociationItem> itemsCopy = new List<AssociationItem>(m_sortedStore.Values); | 126 | List<AssociationItem> itemsCopy = new List<AssociationItem>(m_sortedStore.Values); |
127 | DateTime now = DateTime.Now; | 127 | DateTime now = DateTime.Now; |
128 | 128 | ||
129 | for (int i = 0; i < itemsCopy.Count; i++) | 129 | for (int i = 0; i < itemsCopy.Count; i++) |
130 | { | 130 | { |
131 | AssociationItem item = itemsCopy[i]; | 131 | AssociationItem item = itemsCopy[i]; |
132 | 132 | ||
133 | if (item.Expires <= now) | 133 | if (item.Expires <= now) |
134 | { | 134 | { |
135 | m_sortedStore.RemoveAt(i); | 135 | m_sortedStore.RemoveAt(i); |
136 | m_store.Remove(item.Handle); | 136 | m_store.Remove(item.Handle); |
137 | } | 137 | } |
138 | } | 138 | } |
139 | } | 139 | } |
140 | } | 140 | } |
141 | 141 | ||
142 | #endregion | 142 | #endregion |
143 | } | 143 | } |
144 | 144 | ||
145 | public class OpenIdStreamHandler : IStreamHandler | 145 | public class OpenIdStreamHandler : IStreamHandler |
146 | { | 146 | { |
147 | #region HTML | 147 | #region HTML |
148 | 148 | ||
149 | /// <summary>Login form used to authenticate OpenID requests</summary> | 149 | /// <summary>Login form used to authenticate OpenID requests</summary> |
150 | const string LOGIN_PAGE = | 150 | const string LOGIN_PAGE = |
151 | @"<html> | 151 | @"<html> |
152 | <head><title>OpenSim OpenID Login</title></head> | 152 | <head><title>OpenSim OpenID Login</title></head> |
153 | <body> | 153 | <body> |
154 | <h3>OpenSim Login</h3> | 154 | <h3>OpenSim Login</h3> |
155 | <form method=""post""> | 155 | <form method=""post""> |
156 | <label for=""first"">First Name:</label> <input readonly type=""text"" name=""first"" id=""first"" value=""{0}""/> | 156 | <label for=""first"">First Name:</label> <input readonly type=""text"" name=""first"" id=""first"" value=""{0}""/> |
157 | <label for=""last"">Last Name:</label> <input readonly type=""text"" name=""last"" id=""last"" value=""{1}""/> | 157 | <label for=""last"">Last Name:</label> <input readonly type=""text"" name=""last"" id=""last"" value=""{1}""/> |
158 | <label for=""pass"">Password:</label> <input type=""password"" name=""pass"" id=""pass""/> | 158 | <label for=""pass"">Password:</label> <input type=""password"" name=""pass"" id=""pass""/> |
159 | <input type=""submit"" value=""Login""> | 159 | <input type=""submit"" value=""Login""> |
160 | </form> | 160 | </form> |
161 | </body> | 161 | </body> |
162 | </html>"; | 162 | </html>"; |
163 | 163 | ||
164 | /// <summary>Page shown for a valid OpenID identity</summary> | 164 | /// <summary>Page shown for a valid OpenID identity</summary> |
165 | const string OPENID_PAGE = | 165 | const string OPENID_PAGE = |
166 | @"<html> | 166 | @"<html> |
167 | <head> | 167 | <head> |
168 | <title>{2} {3}</title> | 168 | <title>{2} {3}</title> |
169 | <link rel=""openid2.provider openid.server"" href=""{0}://{1}/openid/server/""/> | 169 | <link rel=""openid2.provider openid.server"" href=""{0}://{1}/openid/server/""/> |
170 | </head> | 170 | </head> |
171 | <body>OpenID identifier for {2} {3}</body> | 171 | <body>OpenID identifier for {2} {3}</body> |
172 | </html> | 172 | </html> |
173 | "; | 173 | "; |
174 | 174 | ||
175 | /// <summary>Page shown for an invalid OpenID identity</summary> | 175 | /// <summary>Page shown for an invalid OpenID identity</summary> |
176 | const string INVALID_OPENID_PAGE = | 176 | const string INVALID_OPENID_PAGE = |
177 | @"<html><head><title>Identity not found</title></head> | 177 | @"<html><head><title>Identity not found</title></head> |
178 | <body>Invalid OpenID identity</body></html>"; | 178 | <body>Invalid OpenID identity</body></html>"; |
179 | 179 | ||
180 | /// <summary>Page shown if the OpenID endpoint is requested directly</summary> | 180 | /// <summary>Page shown if the OpenID endpoint is requested directly</summary> |
181 | const string ENDPOINT_PAGE = | 181 | const string ENDPOINT_PAGE = |
182 | @"<html><head><title>OpenID Endpoint</title></head><body> | 182 | @"<html><head><title>OpenID Endpoint</title></head><body> |
183 | This is an OpenID server endpoint, not a human-readable resource. | 183 | This is an OpenID server endpoint, not a human-readable resource. |
184 | For more information, see <a href='http://openid.net/'>http://openid.net/</a>. | 184 | For more information, see <a href='http://openid.net/'>http://openid.net/</a>. |
185 | </body></html>"; | 185 | </body></html>"; |
186 | 186 | ||
187 | #endregion HTML | 187 | #endregion HTML |
188 | 188 | ||
189 | public string ContentType { get { return m_contentType; } } | 189 | public string ContentType { get { return m_contentType; } } |
190 | public string HttpMethod { get { return m_httpMethod; } } | 190 | public string HttpMethod { get { return m_httpMethod; } } |
191 | public string Path { get { return m_path; } } | 191 | public string Path { get { return m_path; } } |
192 | 192 | ||
193 | string m_contentType; | 193 | string m_contentType; |
194 | string m_httpMethod; | 194 | string m_httpMethod; |
195 | string m_path; | 195 | string m_path; |
196 | UserLoginService m_loginService; | 196 | UserLoginService m_loginService; |
197 | ProviderMemoryStore m_openidStore = new ProviderMemoryStore(); | 197 | ProviderMemoryStore m_openidStore = new ProviderMemoryStore(); |
198 | 198 | ||
199 | /// <summary> | 199 | /// <summary> |
200 | /// Constructor | 200 | /// Constructor |
201 | /// </summary> | 201 | /// </summary> |
202 | public OpenIdStreamHandler(string httpMethod, string path, UserLoginService loginService) | 202 | public OpenIdStreamHandler(string httpMethod, string path, UserLoginService loginService) |
203 | { | 203 | { |
204 | m_loginService = loginService; | 204 | m_loginService = loginService; |
205 | m_httpMethod = httpMethod; | 205 | m_httpMethod = httpMethod; |
206 | m_path = path; | 206 | m_path = path; |
207 | 207 | ||
208 | m_contentType = "text/html"; | 208 | m_contentType = "text/html"; |
209 | } | 209 | } |
210 | 210 | ||
211 | /// <summary> | 211 | /// <summary> |
212 | /// Handles all GET and POST requests for OpenID identifier pages and endpoint | 212 | /// Handles all GET and POST requests for OpenID identifier pages and endpoint |
213 | /// server communication | 213 | /// server communication |
214 | /// </summary> | 214 | /// </summary> |
215 | public void Handle(string path, Stream request, Stream response, OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 215 | public void Handle(string path, Stream request, Stream response, OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
216 | { | 216 | { |
217 | Uri providerEndpoint = new Uri(String.Format("{0}://{1}{2}", httpRequest.Url.Scheme, httpRequest.Url.Authority, httpRequest.Url.AbsolutePath)); | 217 | Uri providerEndpoint = new Uri(String.Format("{0}://{1}{2}", httpRequest.Url.Scheme, httpRequest.Url.Authority, httpRequest.Url.AbsolutePath)); |
218 | 218 | ||
219 | // Defult to returning HTML content | 219 | // Defult to returning HTML content |
220 | m_contentType = "text/html"; | 220 | m_contentType = "text/html"; |
221 | 221 | ||
222 | try | 222 | try |
223 | { | 223 | { |
224 | NameValueCollection postQuery = HttpUtility.ParseQueryString(new StreamReader(httpRequest.InputStream).ReadToEnd()); | 224 | NameValueCollection postQuery = HttpUtility.ParseQueryString(new StreamReader(httpRequest.InputStream).ReadToEnd()); |
225 | NameValueCollection getQuery = HttpUtility.ParseQueryString(httpRequest.Url.Query); | 225 | NameValueCollection getQuery = HttpUtility.ParseQueryString(httpRequest.Url.Query); |
226 | NameValueCollection openIdQuery = (postQuery.GetValues("openid.mode") != null ? postQuery : getQuery); | 226 | NameValueCollection openIdQuery = (postQuery.GetValues("openid.mode") != null ? postQuery : getQuery); |
227 | 227 | ||
228 | OpenIdProvider provider = new OpenIdProvider(m_openidStore, providerEndpoint, httpRequest.Url, openIdQuery); | 228 | OpenIdProvider provider = new OpenIdProvider(m_openidStore, providerEndpoint, httpRequest.Url, openIdQuery); |
229 | 229 | ||
230 | if (provider.Request != null) | 230 | if (provider.Request != null) |
231 | { | 231 | { |
232 | if (!provider.Request.IsResponseReady && provider.Request is IAuthenticationRequest) | 232 | if (!provider.Request.IsResponseReady && provider.Request is IAuthenticationRequest) |
233 | { | 233 | { |
234 | IAuthenticationRequest authRequest = (IAuthenticationRequest)provider.Request; | 234 | IAuthenticationRequest authRequest = (IAuthenticationRequest)provider.Request; |
235 | string[] passwordValues = postQuery.GetValues("pass"); | 235 | string[] passwordValues = postQuery.GetValues("pass"); |
236 | 236 | ||
237 | UserProfileData profile; | 237 | UserProfileData profile; |
238 | if (TryGetProfile(new Uri(authRequest.ClaimedIdentifier.ToString()), out profile)) | 238 | if (TryGetProfile(new Uri(authRequest.ClaimedIdentifier.ToString()), out profile)) |
239 | { | 239 | { |
240 | // Check for form POST data | 240 | // Check for form POST data |
241 | if (passwordValues != null && passwordValues.Length == 1) | 241 | if (passwordValues != null && passwordValues.Length == 1) |
242 | { | 242 | { |
243 | if (profile != null && m_loginService.AuthenticateUser(profile, passwordValues[0])) | 243 | if (profile != null && m_loginService.AuthenticateUser(profile, passwordValues[0])) |
244 | authRequest.IsAuthenticated = true; | 244 | authRequest.IsAuthenticated = true; |
245 | else | 245 | else |
246 | authRequest.IsAuthenticated = false; | 246 | authRequest.IsAuthenticated = false; |
247 | } | 247 | } |
248 | else | 248 | else |
249 | { | 249 | { |
250 | // Authentication was requested, send the client a login form | 250 | // Authentication was requested, send the client a login form |
251 | using (StreamWriter writer = new StreamWriter(response)) | 251 | using (StreamWriter writer = new StreamWriter(response)) |
252 | writer.Write(String.Format(LOGIN_PAGE, profile.FirstName, profile.SurName)); | 252 | writer.Write(String.Format(LOGIN_PAGE, profile.FirstName, profile.SurName)); |
253 | return; | 253 | return; |
254 | } | 254 | } |
255 | } | 255 | } |
256 | else | 256 | else |
257 | { | 257 | { |
258 | // Cannot find an avatar matching the claimed identifier | 258 | // Cannot find an avatar matching the claimed identifier |
259 | authRequest.IsAuthenticated = false; | 259 | authRequest.IsAuthenticated = false; |
260 | } | 260 | } |
261 | } | 261 | } |
262 | 262 | ||
263 | // Add OpenID headers to the response | 263 | // Add OpenID headers to the response |
264 | foreach (string key in provider.Request.Response.Headers.Keys) | 264 | foreach (string key in provider.Request.Response.Headers.Keys) |
265 | httpResponse.AddHeader(key, provider.Request.Response.Headers[key]); | 265 | httpResponse.AddHeader(key, provider.Request.Response.Headers[key]); |
266 | 266 | ||
267 | string[] contentTypeValues = provider.Request.Response.Headers.GetValues("Content-Type"); | 267 | string[] contentTypeValues = provider.Request.Response.Headers.GetValues("Content-Type"); |
268 | if (contentTypeValues != null && contentTypeValues.Length == 1) | 268 | if (contentTypeValues != null && contentTypeValues.Length == 1) |
269 | m_contentType = contentTypeValues[0]; | 269 | m_contentType = contentTypeValues[0]; |
270 | 270 | ||
271 | // Set the response code and document body based on the OpenID result | 271 | // Set the response code and document body based on the OpenID result |
272 | httpResponse.StatusCode = (int)provider.Request.Response.Code; | 272 | httpResponse.StatusCode = (int)provider.Request.Response.Code; |
273 | response.Write(provider.Request.Response.Body, 0, provider.Request.Response.Body.Length); | 273 | response.Write(provider.Request.Response.Body, 0, provider.Request.Response.Body.Length); |
274 | response.Close(); | 274 | response.Close(); |
275 | } | 275 | } |
276 | else if (httpRequest.Url.AbsolutePath.Contains("/openid/server")) | 276 | else if (httpRequest.Url.AbsolutePath.Contains("/openid/server")) |
277 | { | 277 | { |
278 | // Standard HTTP GET was made on the OpenID endpoint, send the client the default error page | 278 | // Standard HTTP GET was made on the OpenID endpoint, send the client the default error page |
279 | using (StreamWriter writer = new StreamWriter(response)) | 279 | using (StreamWriter writer = new StreamWriter(response)) |
280 | writer.Write(ENDPOINT_PAGE); | 280 | writer.Write(ENDPOINT_PAGE); |
281 | } | 281 | } |
282 | else | 282 | else |
283 | { | 283 | { |
284 | // Try and lookup this avatar | 284 | // Try and lookup this avatar |
285 | UserProfileData profile; | 285 | UserProfileData profile; |
286 | if (TryGetProfile(httpRequest.Url, out profile)) | 286 | if (TryGetProfile(httpRequest.Url, out profile)) |
287 | { | 287 | { |
288 | using (StreamWriter writer = new StreamWriter(response)) | 288 | using (StreamWriter writer = new StreamWriter(response)) |
289 | { | 289 | { |
290 | // TODO: Print out a full profile page for this avatar | 290 | // TODO: Print out a full profile page for this avatar |
291 | writer.Write(String.Format(OPENID_PAGE, httpRequest.Url.Scheme, | 291 | writer.Write(String.Format(OPENID_PAGE, httpRequest.Url.Scheme, |
292 | httpRequest.Url.Authority, profile.FirstName, profile.SurName)); | 292 | httpRequest.Url.Authority, profile.FirstName, profile.SurName)); |
293 | } | 293 | } |
294 | } | 294 | } |
295 | else | 295 | else |
296 | { | 296 | { |
297 | // Couldn't parse an avatar name, or couldn't find the avatar in the user server | 297 | // Couldn't parse an avatar name, or couldn't find the avatar in the user server |
298 | using (StreamWriter writer = new StreamWriter(response)) | 298 | using (StreamWriter writer = new StreamWriter(response)) |
299 | writer.Write(INVALID_OPENID_PAGE); | 299 | writer.Write(INVALID_OPENID_PAGE); |
300 | } | 300 | } |
301 | } | 301 | } |
302 | } | 302 | } |
303 | catch (Exception ex) | 303 | catch (Exception ex) |
304 | { | 304 | { |
305 | httpResponse.StatusCode = (int)HttpStatusCode.InternalServerError; | 305 | httpResponse.StatusCode = (int)HttpStatusCode.InternalServerError; |
306 | using (StreamWriter writer = new StreamWriter(response)) | 306 | using (StreamWriter writer = new StreamWriter(response)) |
307 | writer.Write(ex.Message); | 307 | writer.Write(ex.Message); |
308 | } | 308 | } |
309 | } | 309 | } |
310 | 310 | ||
311 | /// <summary> | 311 | /// <summary> |
312 | /// Parse a URL with a relative path of the form /users/First_Last and try to | 312 | /// Parse a URL with a relative path of the form /users/First_Last and try to |
313 | /// retrieve the profile matching that avatar name | 313 | /// retrieve the profile matching that avatar name |
314 | /// </summary> | 314 | /// </summary> |
315 | /// <param name="requestUrl">URL to parse for an avatar name</param> | 315 | /// <param name="requestUrl">URL to parse for an avatar name</param> |
316 | /// <param name="profile">Profile data for the avatar</param> | 316 | /// <param name="profile">Profile data for the avatar</param> |
317 | /// <returns>True if the parse and lookup were successful, otherwise false</returns> | 317 | /// <returns>True if the parse and lookup were successful, otherwise false</returns> |
318 | bool TryGetProfile(Uri requestUrl, out UserProfileData profile) | 318 | bool TryGetProfile(Uri requestUrl, out UserProfileData profile) |
319 | { | 319 | { |
320 | if (requestUrl.Segments.Length == 3 && requestUrl.Segments[1] == "users/") | 320 | if (requestUrl.Segments.Length == 3 && requestUrl.Segments[1] == "users/") |
321 | { | 321 | { |
322 | // Parse the avatar name from the path | 322 | // Parse the avatar name from the path |
323 | string username = requestUrl.Segments[requestUrl.Segments.Length - 1]; | 323 | string username = requestUrl.Segments[requestUrl.Segments.Length - 1]; |
324 | string[] name = username.Split('_'); | 324 | string[] name = username.Split('_'); |
325 | 325 | ||
326 | if (name.Length == 2) | 326 | if (name.Length == 2) |
327 | { | 327 | { |
328 | profile = m_loginService.GetTheUser(name[0], name[1]); | 328 | profile = m_loginService.GetTheUser(name[0], name[1]); |
329 | return (profile != null); | 329 | return (profile != null); |
330 | } | 330 | } |
331 | } | 331 | } |
332 | 332 | ||
333 | profile = null; | 333 | profile = null; |
334 | return false; | 334 | return false; |
335 | } | 335 | } |
336 | } | 336 | } |
337 | } | 337 | } |
diff --git a/OpenSim/Grid/UserServer.Modules/UserDataBaseService.cs b/OpenSim/Grid/UserServer.Modules/UserDataBaseService.cs index ef59cac..80f2f7b 100644 --- a/OpenSim/Grid/UserServer.Modules/UserDataBaseService.cs +++ b/OpenSim/Grid/UserServer.Modules/UserDataBaseService.cs | |||
@@ -1,111 +1,111 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using log4net; | 32 | using log4net; |
33 | using Nwc.XmlRpc; | 33 | using Nwc.XmlRpc; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Communications; | 36 | using OpenSim.Framework.Communications; |
37 | using OpenSim.Framework.Servers; | 37 | using OpenSim.Framework.Servers; |
38 | using OpenSim.Grid.Framework; | 38 | using OpenSim.Grid.Framework; |
39 | 39 | ||
40 | namespace OpenSim.Grid.UserServer.Modules | 40 | namespace OpenSim.Grid.UserServer.Modules |
41 | { | 41 | { |
42 | public class UserDataBaseService : UserManagerBase | 42 | public class UserDataBaseService : UserManagerBase |
43 | { | 43 | { |
44 | protected IUGAIMCore m_core; | 44 | protected IUGAIMCore m_core; |
45 | 45 | ||
46 | public UserDataBaseService() | 46 | public UserDataBaseService() |
47 | : base(null) | 47 | : base(null) |
48 | { | 48 | { |
49 | } | 49 | } |
50 | 50 | ||
51 | public UserDataBaseService(IInterServiceInventoryServices interServiceInventoryService) | 51 | public UserDataBaseService(IInterServiceInventoryServices interServiceInventoryService) |
52 | : base(interServiceInventoryService) | 52 | : base(interServiceInventoryService) |
53 | { | 53 | { |
54 | } | 54 | } |
55 | 55 | ||
56 | public void Initialise(IUGAIMCore core) | 56 | public void Initialise(IUGAIMCore core) |
57 | { | 57 | { |
58 | m_core = core; | 58 | m_core = core; |
59 | 59 | ||
60 | //we only need core components so we can request them from here | 60 | //we only need core components so we can request them from here |
61 | IInterServiceInventoryServices inventoryService; | 61 | IInterServiceInventoryServices inventoryService; |
62 | if (m_core.TryGet<IInterServiceInventoryServices>(out inventoryService)) | 62 | if (m_core.TryGet<IInterServiceInventoryServices>(out inventoryService)) |
63 | { | 63 | { |
64 | m_interServiceInventoryService = inventoryService; | 64 | m_interServiceInventoryService = inventoryService; |
65 | } | 65 | } |
66 | 66 | ||
67 | UserConfig cfg; | 67 | UserConfig cfg; |
68 | if (m_core.TryGet<UserConfig>(out cfg)) | 68 | if (m_core.TryGet<UserConfig>(out cfg)) |
69 | { | 69 | { |
70 | AddPlugin(cfg.DatabaseProvider, cfg.DatabaseConnect); | 70 | AddPlugin(cfg.DatabaseProvider, cfg.DatabaseConnect); |
71 | } | 71 | } |
72 | 72 | ||
73 | m_core.RegisterInterface<UserDataBaseService>(this); | 73 | m_core.RegisterInterface<UserDataBaseService>(this); |
74 | } | 74 | } |
75 | 75 | ||
76 | public void PostInitialise() | 76 | public void PostInitialise() |
77 | { | 77 | { |
78 | } | 78 | } |
79 | 79 | ||
80 | public void RegisterHandlers(BaseHttpServer httpServer) | 80 | public void RegisterHandlers(BaseHttpServer httpServer) |
81 | { | 81 | { |
82 | } | 82 | } |
83 | 83 | ||
84 | public UserAgentData GetUserAgentData(UUID AgentID) | 84 | public UserAgentData GetUserAgentData(UUID AgentID) |
85 | { | 85 | { |
86 | UserProfileData userProfile = GetUserProfile(AgentID); | 86 | UserProfileData userProfile = GetUserProfile(AgentID); |
87 | 87 | ||
88 | if (userProfile != null) | 88 | if (userProfile != null) |
89 | { | 89 | { |
90 | return userProfile.CurrentAgent; | 90 | return userProfile.CurrentAgent; |
91 | } | 91 | } |
92 | 92 | ||
93 | return null; | 93 | return null; |
94 | } | 94 | } |
95 | 95 | ||
96 | public override UserProfileData SetupMasterUser(string firstName, string lastName) | 96 | public override UserProfileData SetupMasterUser(string firstName, string lastName) |
97 | { | 97 | { |
98 | throw new Exception("The method or operation is not implemented."); | 98 | throw new Exception("The method or operation is not implemented."); |
99 | } | 99 | } |
100 | 100 | ||
101 | public override UserProfileData SetupMasterUser(string firstName, string lastName, string password) | 101 | public override UserProfileData SetupMasterUser(string firstName, string lastName, string password) |
102 | { | 102 | { |
103 | throw new Exception("The method or operation is not implemented."); | 103 | throw new Exception("The method or operation is not implemented."); |
104 | } | 104 | } |
105 | 105 | ||
106 | public override UserProfileData SetupMasterUser(UUID uuid) | 106 | public override UserProfileData SetupMasterUser(UUID uuid) |
107 | { | 107 | { |
108 | throw new Exception("The method or operation is not implemented."); | 108 | throw new Exception("The method or operation is not implemented."); |
109 | } | 109 | } |
110 | } | 110 | } |
111 | } | 111 | } |
diff --git a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs index 928753f..64ac463 100644 --- a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs +++ b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs | |||
@@ -1,600 +1,600 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Text.RegularExpressions; | 32 | using System.Text.RegularExpressions; |
33 | using log4net; | 33 | using log4net; |
34 | using Nwc.XmlRpc; | 34 | using Nwc.XmlRpc; |
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenSim.Data; | 36 | using OpenSim.Data; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Communications; | 38 | using OpenSim.Framework.Communications; |
39 | using OpenSim.Framework.Communications.Cache; | 39 | using OpenSim.Framework.Communications.Cache; |
40 | using OpenSim.Framework.Communications.Capabilities; | 40 | using OpenSim.Framework.Communications.Capabilities; |
41 | using OpenSim.Framework.Servers; | 41 | using OpenSim.Framework.Servers; |
42 | 42 | ||
43 | namespace OpenSim.Grid.UserServer.Modules | 43 | namespace OpenSim.Grid.UserServer.Modules |
44 | { | 44 | { |
45 | public delegate void UserLoggedInAtLocation(UUID agentID, UUID sessionID, UUID RegionID, | 45 | public delegate void UserLoggedInAtLocation(UUID agentID, UUID sessionID, UUID RegionID, |
46 | ulong regionhandle, float positionX, float positionY, float positionZ, | 46 | ulong regionhandle, float positionX, float positionY, float positionZ, |
47 | string firstname, string lastname); | 47 | string firstname, string lastname); |
48 | 48 | ||
49 | /// <summary> | 49 | /// <summary> |
50 | /// Login service used in grid mode. | 50 | /// Login service used in grid mode. |
51 | /// </summary> | 51 | /// </summary> |
52 | public class UserLoginService : LoginService | 52 | public class UserLoginService : LoginService |
53 | { | 53 | { |
54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
55 | 55 | ||
56 | protected IInterServiceInventoryServices m_inventoryService; | 56 | protected IInterServiceInventoryServices m_inventoryService; |
57 | 57 | ||
58 | public event UserLoggedInAtLocation OnUserLoggedInAtLocation; | 58 | public event UserLoggedInAtLocation OnUserLoggedInAtLocation; |
59 | 59 | ||
60 | private UserLoggedInAtLocation handlerUserLoggedInAtLocation; | 60 | private UserLoggedInAtLocation handlerUserLoggedInAtLocation; |
61 | 61 | ||
62 | public UserConfig m_config; | 62 | public UserConfig m_config; |
63 | private readonly IRegionProfileService m_regionProfileService; | 63 | private readonly IRegionProfileService m_regionProfileService; |
64 | 64 | ||
65 | protected BaseHttpServer m_httpServer; | 65 | protected BaseHttpServer m_httpServer; |
66 | 66 | ||
67 | public UserLoginService( | 67 | public UserLoginService( |
68 | UserManagerBase userManager, IInterServiceInventoryServices inventoryService, | 68 | UserManagerBase userManager, IInterServiceInventoryServices inventoryService, |
69 | LibraryRootFolder libraryRootFolder, | 69 | LibraryRootFolder libraryRootFolder, |
70 | UserConfig config, string welcomeMess, IRegionProfileService regionProfileService) | 70 | UserConfig config, string welcomeMess, IRegionProfileService regionProfileService) |
71 | : base(userManager, libraryRootFolder, welcomeMess) | 71 | : base(userManager, libraryRootFolder, welcomeMess) |
72 | { | 72 | { |
73 | m_config = config; | 73 | m_config = config; |
74 | m_inventoryService = inventoryService; | 74 | m_inventoryService = inventoryService; |
75 | m_regionProfileService = regionProfileService; | 75 | m_regionProfileService = regionProfileService; |
76 | } | 76 | } |
77 | 77 | ||
78 | public void RegisterHandlers(BaseHttpServer httpServer, bool registerLLSDHandler, bool registerOpenIDHandlers) | 78 | public void RegisterHandlers(BaseHttpServer httpServer, bool registerLLSDHandler, bool registerOpenIDHandlers) |
79 | { | 79 | { |
80 | m_httpServer = httpServer; | 80 | m_httpServer = httpServer; |
81 | 81 | ||
82 | m_httpServer.AddXmlRPCHandler("login_to_simulator", XmlRpcLoginMethod); | 82 | m_httpServer.AddXmlRPCHandler("login_to_simulator", XmlRpcLoginMethod); |
83 | m_httpServer.AddHTTPHandler("login", ProcessHTMLLogin); | 83 | m_httpServer.AddHTTPHandler("login", ProcessHTMLLogin); |
84 | m_httpServer.AddXmlRPCHandler("set_login_params", XmlRPCSetLoginParams); | 84 | m_httpServer.AddXmlRPCHandler("set_login_params", XmlRPCSetLoginParams); |
85 | 85 | ||
86 | if (registerLLSDHandler) | 86 | if (registerLLSDHandler) |
87 | { | 87 | { |
88 | m_httpServer.SetDefaultLLSDHandler(LLSDLoginMethod); | 88 | m_httpServer.SetDefaultLLSDHandler(LLSDLoginMethod); |
89 | } | 89 | } |
90 | 90 | ||
91 | if (registerOpenIDHandlers) | 91 | if (registerOpenIDHandlers) |
92 | { | 92 | { |
93 | // Handler for OpenID avatar identity pages | 93 | // Handler for OpenID avatar identity pages |
94 | m_httpServer.AddStreamHandler(new OpenIdStreamHandler("GET", "/users/", this)); | 94 | m_httpServer.AddStreamHandler(new OpenIdStreamHandler("GET", "/users/", this)); |
95 | // Handlers for the OpenID endpoint server | 95 | // Handlers for the OpenID endpoint server |
96 | m_httpServer.AddStreamHandler(new OpenIdStreamHandler("POST", "/openid/server/", this)); | 96 | m_httpServer.AddStreamHandler(new OpenIdStreamHandler("POST", "/openid/server/", this)); |
97 | m_httpServer.AddStreamHandler(new OpenIdStreamHandler("GET", "/openid/server/", this)); | 97 | m_httpServer.AddStreamHandler(new OpenIdStreamHandler("GET", "/openid/server/", this)); |
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | public void setloginlevel(int level) | 101 | public void setloginlevel(int level) |
102 | { | 102 | { |
103 | m_minLoginLevel = level; | 103 | m_minLoginLevel = level; |
104 | m_log.InfoFormat("[GRID]: Login Level set to {0} ", level); | 104 | m_log.InfoFormat("[GRID]: Login Level set to {0} ", level); |
105 | } | 105 | } |
106 | public void setwelcometext(string text) | 106 | public void setwelcometext(string text) |
107 | { | 107 | { |
108 | m_welcomeMessage = text; | 108 | m_welcomeMessage = text; |
109 | m_log.InfoFormat("[GRID]: Login text set to {0} ", text); | 109 | m_log.InfoFormat("[GRID]: Login text set to {0} ", text); |
110 | } | 110 | } |
111 | 111 | ||
112 | public override void LogOffUser(UserProfileData theUser, string message) | 112 | public override void LogOffUser(UserProfileData theUser, string message) |
113 | { | 113 | { |
114 | RegionProfileData SimInfo; | 114 | RegionProfileData SimInfo; |
115 | try | 115 | try |
116 | { | 116 | { |
117 | SimInfo = m_regionProfileService.RequestSimProfileData( | 117 | SimInfo = m_regionProfileService.RequestSimProfileData( |
118 | theUser.CurrentAgent.Handle, m_config.GridServerURL, | 118 | theUser.CurrentAgent.Handle, m_config.GridServerURL, |
119 | m_config.GridSendKey, m_config.GridRecvKey); | 119 | m_config.GridSendKey, m_config.GridRecvKey); |
120 | 120 | ||
121 | if (SimInfo == null) | 121 | if (SimInfo == null) |
122 | { | 122 | { |
123 | m_log.Error("[GRID]: Region user was in isn't currently logged in"); | 123 | m_log.Error("[GRID]: Region user was in isn't currently logged in"); |
124 | return; | 124 | return; |
125 | } | 125 | } |
126 | } | 126 | } |
127 | catch (Exception) | 127 | catch (Exception) |
128 | { | 128 | { |
129 | m_log.Error("[GRID]: Unable to look up region to log user off"); | 129 | m_log.Error("[GRID]: Unable to look up region to log user off"); |
130 | return; | 130 | return; |
131 | } | 131 | } |
132 | 132 | ||
133 | // Prepare notification | 133 | // Prepare notification |
134 | Hashtable SimParams = new Hashtable(); | 134 | Hashtable SimParams = new Hashtable(); |
135 | SimParams["agent_id"] = theUser.ID.ToString(); | 135 | SimParams["agent_id"] = theUser.ID.ToString(); |
136 | SimParams["region_secret"] = theUser.CurrentAgent.SecureSessionID.ToString(); | 136 | SimParams["region_secret"] = theUser.CurrentAgent.SecureSessionID.ToString(); |
137 | SimParams["region_secret2"] = SimInfo.regionSecret; | 137 | SimParams["region_secret2"] = SimInfo.regionSecret; |
138 | //m_log.Info(SimInfo.regionSecret); | 138 | //m_log.Info(SimInfo.regionSecret); |
139 | SimParams["regionhandle"] = theUser.CurrentAgent.Handle.ToString(); | 139 | SimParams["regionhandle"] = theUser.CurrentAgent.Handle.ToString(); |
140 | SimParams["message"] = message; | 140 | SimParams["message"] = message; |
141 | ArrayList SendParams = new ArrayList(); | 141 | ArrayList SendParams = new ArrayList(); |
142 | SendParams.Add(SimParams); | 142 | SendParams.Add(SimParams); |
143 | 143 | ||
144 | m_log.InfoFormat( | 144 | m_log.InfoFormat( |
145 | "[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}", | 145 | "[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}", |
146 | SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI, | 146 | SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI, |
147 | theUser.FirstName + " " + theUser.SurName); | 147 | theUser.FirstName + " " + theUser.SurName); |
148 | 148 | ||
149 | try | 149 | try |
150 | { | 150 | { |
151 | XmlRpcRequest GridReq = new XmlRpcRequest("logoff_user", SendParams); | 151 | XmlRpcRequest GridReq = new XmlRpcRequest("logoff_user", SendParams); |
152 | XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); | 152 | XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); |
153 | 153 | ||
154 | if (GridResp.IsFault) | 154 | if (GridResp.IsFault) |
155 | { | 155 | { |
156 | m_log.ErrorFormat( | 156 | m_log.ErrorFormat( |
157 | "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}, This is likely an old region revision.", | 157 | "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}, This is likely an old region revision.", |
158 | SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString); | 158 | SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString); |
159 | } | 159 | } |
160 | } | 160 | } |
161 | catch (Exception) | 161 | catch (Exception) |
162 | { | 162 | { |
163 | m_log.Error("[LOGIN]: Error telling region to logout user!"); | 163 | m_log.Error("[LOGIN]: Error telling region to logout user!"); |
164 | } | 164 | } |
165 | 165 | ||
166 | // Prepare notification | 166 | // Prepare notification |
167 | SimParams = new Hashtable(); | 167 | SimParams = new Hashtable(); |
168 | SimParams["agent_id"] = theUser.ID.ToString(); | 168 | SimParams["agent_id"] = theUser.ID.ToString(); |
169 | SimParams["region_secret"] = SimInfo.regionSecret; | 169 | SimParams["region_secret"] = SimInfo.regionSecret; |
170 | //m_log.Info(SimInfo.regionSecret); | 170 | //m_log.Info(SimInfo.regionSecret); |
171 | SimParams["regionhandle"] = theUser.CurrentAgent.Handle.ToString(); | 171 | SimParams["regionhandle"] = theUser.CurrentAgent.Handle.ToString(); |
172 | SimParams["message"] = message; | 172 | SimParams["message"] = message; |
173 | SendParams = new ArrayList(); | 173 | SendParams = new ArrayList(); |
174 | SendParams.Add(SimParams); | 174 | SendParams.Add(SimParams); |
175 | 175 | ||
176 | m_log.InfoFormat( | 176 | m_log.InfoFormat( |
177 | "[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}", | 177 | "[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}", |
178 | SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI, | 178 | SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI, |
179 | theUser.FirstName + " " + theUser.SurName); | 179 | theUser.FirstName + " " + theUser.SurName); |
180 | 180 | ||
181 | try | 181 | try |
182 | { | 182 | { |
183 | XmlRpcRequest GridReq = new XmlRpcRequest("logoff_user", SendParams); | 183 | XmlRpcRequest GridReq = new XmlRpcRequest("logoff_user", SendParams); |
184 | XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); | 184 | XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); |
185 | 185 | ||
186 | if (GridResp.IsFault) | 186 | if (GridResp.IsFault) |
187 | { | 187 | { |
188 | m_log.ErrorFormat( | 188 | m_log.ErrorFormat( |
189 | "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}, This is likely an old region revision.", | 189 | "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}, This is likely an old region revision.", |
190 | SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString); | 190 | SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString); |
191 | } | 191 | } |
192 | } | 192 | } |
193 | catch (Exception) | 193 | catch (Exception) |
194 | { | 194 | { |
195 | m_log.Error("[LOGIN]: Error telling region to logout user!"); | 195 | m_log.Error("[LOGIN]: Error telling region to logout user!"); |
196 | } | 196 | } |
197 | //base.LogOffUser(theUser); | 197 | //base.LogOffUser(theUser); |
198 | } | 198 | } |
199 | 199 | ||
200 | /// <summary> | 200 | /// <summary> |
201 | /// Customises the login response and fills in missing values. | 201 | /// Customises the login response and fills in missing values. |
202 | /// </summary> | 202 | /// </summary> |
203 | /// <param name="response">The existing response</param> | 203 | /// <param name="response">The existing response</param> |
204 | /// <param name="theUser">The user profile</param> | 204 | /// <param name="theUser">The user profile</param> |
205 | /// <param name="startLocationRequest">The requested start location</param> | 205 | /// <param name="startLocationRequest">The requested start location</param> |
206 | public override bool CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest) | 206 | public override bool CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest) |
207 | { | 207 | { |
208 | // add active gestures to login-response | 208 | // add active gestures to login-response |
209 | AddActiveGestures(response, theUser); | 209 | AddActiveGestures(response, theUser); |
210 | 210 | ||
211 | // HomeLocation | 211 | // HomeLocation |
212 | RegionProfileData homeInfo = null; | 212 | RegionProfileData homeInfo = null; |
213 | // use the homeRegionID if it is stored already. If not, use the regionHandle as before | 213 | // use the homeRegionID if it is stored already. If not, use the regionHandle as before |
214 | UUID homeRegionId = theUser.HomeRegionID; | 214 | UUID homeRegionId = theUser.HomeRegionID; |
215 | ulong homeRegionHandle = theUser.HomeRegion; | 215 | ulong homeRegionHandle = theUser.HomeRegion; |
216 | if (homeRegionId != UUID.Zero) | 216 | if (homeRegionId != UUID.Zero) |
217 | { | 217 | { |
218 | homeInfo = GetRegionInfo(homeRegionId); | 218 | homeInfo = GetRegionInfo(homeRegionId); |
219 | } | 219 | } |
220 | else | 220 | else |
221 | { | 221 | { |
222 | homeInfo = GetRegionInfo(homeRegionHandle); | 222 | homeInfo = GetRegionInfo(homeRegionHandle); |
223 | } | 223 | } |
224 | 224 | ||
225 | if (homeInfo != null) | 225 | if (homeInfo != null) |
226 | { | 226 | { |
227 | response.Home = | 227 | response.Home = |
228 | string.Format( | 228 | string.Format( |
229 | "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}", | 229 | "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}", |
230 | (homeInfo.regionLocX*Constants.RegionSize), | 230 | (homeInfo.regionLocX*Constants.RegionSize), |
231 | (homeInfo.regionLocY*Constants.RegionSize), | 231 | (homeInfo.regionLocY*Constants.RegionSize), |
232 | theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z, | 232 | theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z, |
233 | theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z); | 233 | theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z); |
234 | } | 234 | } |
235 | else | 235 | else |
236 | { | 236 | { |
237 | // Emergency mode: Home-region isn't available, so we can't request the region info. | 237 | // Emergency mode: Home-region isn't available, so we can't request the region info. |
238 | // Use the stored home regionHandle instead. | 238 | // Use the stored home regionHandle instead. |
239 | // NOTE: If the home-region moves, this will be wrong until the users update their user-profile again | 239 | // NOTE: If the home-region moves, this will be wrong until the users update their user-profile again |
240 | ulong regionX = homeRegionHandle >> 32; | 240 | ulong regionX = homeRegionHandle >> 32; |
241 | ulong regionY = homeRegionHandle & 0xffffffff; | 241 | ulong regionY = homeRegionHandle & 0xffffffff; |
242 | response.Home = | 242 | response.Home = |
243 | string.Format( | 243 | string.Format( |
244 | "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}", | 244 | "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}", |
245 | regionX, regionY, | 245 | regionX, regionY, |
246 | theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z, | 246 | theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z, |
247 | theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z); | 247 | theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z); |
248 | m_log.InfoFormat("[LOGIN] Home region of user {0} {1} is not available; using computed region position {2} {3}", | 248 | m_log.InfoFormat("[LOGIN] Home region of user {0} {1} is not available; using computed region position {2} {3}", |
249 | theUser.FirstName, theUser.SurName, | 249 | theUser.FirstName, theUser.SurName, |
250 | regionX, regionY); | 250 | regionX, regionY); |
251 | } | 251 | } |
252 | 252 | ||
253 | // StartLocation | 253 | // StartLocation |
254 | RegionProfileData regionInfo = null; | 254 | RegionProfileData regionInfo = null; |
255 | if (startLocationRequest == "home") | 255 | if (startLocationRequest == "home") |
256 | { | 256 | { |
257 | regionInfo = homeInfo; | 257 | regionInfo = homeInfo; |
258 | theUser.CurrentAgent.Position = theUser.HomeLocation; | 258 | theUser.CurrentAgent.Position = theUser.HomeLocation; |
259 | response.LookAt = "[r" + theUser.HomeLookAt.X.ToString() + ",r" + theUser.HomeLookAt.Y.ToString() + ",r" + theUser.HomeLookAt.Z.ToString() + "]"; | 259 | response.LookAt = "[r" + theUser.HomeLookAt.X.ToString() + ",r" + theUser.HomeLookAt.Y.ToString() + ",r" + theUser.HomeLookAt.Z.ToString() + "]"; |
260 | } | 260 | } |
261 | else if (startLocationRequest == "last") | 261 | else if (startLocationRequest == "last") |
262 | { | 262 | { |
263 | UUID lastRegion = theUser.CurrentAgent.Region; | 263 | UUID lastRegion = theUser.CurrentAgent.Region; |
264 | regionInfo = GetRegionInfo(lastRegion); | 264 | regionInfo = GetRegionInfo(lastRegion); |
265 | response.LookAt = "[r" + theUser.CurrentAgent.LookAt.X.ToString() + ",r" + theUser.CurrentAgent.LookAt.Y.ToString() + ",r" + theUser.CurrentAgent.LookAt.Z.ToString() + "]"; | 265 | response.LookAt = "[r" + theUser.CurrentAgent.LookAt.X.ToString() + ",r" + theUser.CurrentAgent.LookAt.Y.ToString() + ",r" + theUser.CurrentAgent.LookAt.Z.ToString() + "]"; |
266 | } | 266 | } |
267 | else | 267 | else |
268 | { | 268 | { |
269 | Regex reURI = new Regex(@"^uri:(?<region>[^&]+)&(?<x>\d+)&(?<y>\d+)&(?<z>\d+)$"); | 269 | Regex reURI = new Regex(@"^uri:(?<region>[^&]+)&(?<x>\d+)&(?<y>\d+)&(?<z>\d+)$"); |
270 | Match uriMatch = reURI.Match(startLocationRequest); | 270 | Match uriMatch = reURI.Match(startLocationRequest); |
271 | if (uriMatch == null) | 271 | if (uriMatch == null) |
272 | { | 272 | { |
273 | m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, but can't process it", startLocationRequest); | 273 | m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, but can't process it", startLocationRequest); |
274 | } | 274 | } |
275 | else | 275 | else |
276 | { | 276 | { |
277 | string region = uriMatch.Groups["region"].ToString(); | 277 | string region = uriMatch.Groups["region"].ToString(); |
278 | regionInfo = RequestClosestRegion(region); | 278 | regionInfo = RequestClosestRegion(region); |
279 | if (regionInfo == null) | 279 | if (regionInfo == null) |
280 | { | 280 | { |
281 | m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, can't locate region {1}", startLocationRequest, region); | 281 | m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, can't locate region {1}", startLocationRequest, region); |
282 | } | 282 | } |
283 | else | 283 | else |
284 | { | 284 | { |
285 | theUser.CurrentAgent.Position = new Vector3(float.Parse(uriMatch.Groups["x"].Value), | 285 | theUser.CurrentAgent.Position = new Vector3(float.Parse(uriMatch.Groups["x"].Value), |
286 | float.Parse(uriMatch.Groups["y"].Value), float.Parse(uriMatch.Groups["z"].Value)); | 286 | float.Parse(uriMatch.Groups["y"].Value), float.Parse(uriMatch.Groups["z"].Value)); |
287 | } | 287 | } |
288 | } | 288 | } |
289 | response.LookAt = "[r0,r1,r0]"; | 289 | response.LookAt = "[r0,r1,r0]"; |
290 | // can be: last, home, safe, url | 290 | // can be: last, home, safe, url |
291 | response.StartLocation = "url"; | 291 | response.StartLocation = "url"; |
292 | } | 292 | } |
293 | 293 | ||
294 | if ((regionInfo != null) && (PrepareLoginToRegion(regionInfo, theUser, response))) | 294 | if ((regionInfo != null) && (PrepareLoginToRegion(regionInfo, theUser, response))) |
295 | { | 295 | { |
296 | return true; | 296 | return true; |
297 | } | 297 | } |
298 | 298 | ||
299 | // StartLocation not available, send him to a nearby region instead | 299 | // StartLocation not available, send him to a nearby region instead |
300 | //regionInfo = RegionProfileData.RequestSimProfileData("", m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); | 300 | //regionInfo = RegionProfileData.RequestSimProfileData("", m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); |
301 | //m_log.InfoFormat("[LOGIN]: StartLocation not available sending to region {0}", regionInfo.regionName); | 301 | //m_log.InfoFormat("[LOGIN]: StartLocation not available sending to region {0}", regionInfo.regionName); |
302 | 302 | ||
303 | // Send him to default region instead | 303 | // Send him to default region instead |
304 | // Load information from the gridserver | 304 | // Load information from the gridserver |
305 | ulong defaultHandle = (((ulong) m_config.DefaultX * Constants.RegionSize) << 32) | | 305 | ulong defaultHandle = (((ulong) m_config.DefaultX * Constants.RegionSize) << 32) | |
306 | ((ulong) m_config.DefaultY * Constants.RegionSize); | 306 | ((ulong) m_config.DefaultY * Constants.RegionSize); |
307 | 307 | ||
308 | if ((regionInfo != null) && (defaultHandle == regionInfo.regionHandle)) | 308 | if ((regionInfo != null) && (defaultHandle == regionInfo.regionHandle)) |
309 | { | 309 | { |
310 | m_log.ErrorFormat("[LOGIN]: Not trying the default region since this is the same as the selected region"); | 310 | m_log.ErrorFormat("[LOGIN]: Not trying the default region since this is the same as the selected region"); |
311 | return false; | 311 | return false; |
312 | } | 312 | } |
313 | 313 | ||
314 | m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead"); | 314 | m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead"); |
315 | regionInfo = GetRegionInfo(defaultHandle); | 315 | regionInfo = GetRegionInfo(defaultHandle); |
316 | 316 | ||
317 | // Customise the response | 317 | // Customise the response |
318 | //response.Home = | 318 | //response.Home = |
319 | // string.Format( | 319 | // string.Format( |
320 | // "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}", | 320 | // "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}", |
321 | // (SimInfo.regionLocX * Constants.RegionSize), | 321 | // (SimInfo.regionLocX * Constants.RegionSize), |
322 | // (SimInfo.regionLocY*Constants.RegionSize), | 322 | // (SimInfo.regionLocY*Constants.RegionSize), |
323 | // theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z, | 323 | // theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z, |
324 | // theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z); | 324 | // theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z); |
325 | theUser.CurrentAgent.Position = new Vector3(128,128,0); | 325 | theUser.CurrentAgent.Position = new Vector3(128,128,0); |
326 | response.StartLocation = "safe"; | 326 | response.StartLocation = "safe"; |
327 | 327 | ||
328 | return PrepareLoginToRegion(regionInfo, theUser, response); | 328 | return PrepareLoginToRegion(regionInfo, theUser, response); |
329 | } | 329 | } |
330 | 330 | ||
331 | protected RegionProfileData RequestClosestRegion(string region) | 331 | protected RegionProfileData RequestClosestRegion(string region) |
332 | { | 332 | { |
333 | return m_regionProfileService.RequestSimProfileData(region, | 333 | return m_regionProfileService.RequestSimProfileData(region, |
334 | m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); | 334 | m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); |
335 | } | 335 | } |
336 | 336 | ||
337 | protected RegionProfileData GetRegionInfo(ulong homeRegionHandle) | 337 | protected RegionProfileData GetRegionInfo(ulong homeRegionHandle) |
338 | { | 338 | { |
339 | return m_regionProfileService.RequestSimProfileData(homeRegionHandle, | 339 | return m_regionProfileService.RequestSimProfileData(homeRegionHandle, |
340 | m_config.GridServerURL, m_config.GridSendKey, | 340 | m_config.GridServerURL, m_config.GridSendKey, |
341 | m_config.GridRecvKey); | 341 | m_config.GridRecvKey); |
342 | } | 342 | } |
343 | 343 | ||
344 | protected RegionProfileData GetRegionInfo(UUID homeRegionId) | 344 | protected RegionProfileData GetRegionInfo(UUID homeRegionId) |
345 | { | 345 | { |
346 | return m_regionProfileService.RequestSimProfileData(homeRegionId, | 346 | return m_regionProfileService.RequestSimProfileData(homeRegionId, |
347 | m_config.GridServerURL, m_config.GridSendKey, | 347 | m_config.GridServerURL, m_config.GridSendKey, |
348 | m_config.GridRecvKey); | 348 | m_config.GridRecvKey); |
349 | } | 349 | } |
350 | 350 | ||
351 | /// <summary> | 351 | /// <summary> |
352 | /// Add active gestures of the user to the login response. | 352 | /// Add active gestures of the user to the login response. |
353 | /// </summary> | 353 | /// </summary> |
354 | /// <param name="response"> | 354 | /// <param name="response"> |
355 | /// A <see cref="LoginResponse"/> | 355 | /// A <see cref="LoginResponse"/> |
356 | /// </param> | 356 | /// </param> |
357 | /// <param name="theUser"> | 357 | /// <param name="theUser"> |
358 | /// A <see cref="UserProfileData"/> | 358 | /// A <see cref="UserProfileData"/> |
359 | /// </param> | 359 | /// </param> |
360 | private void AddActiveGestures(LoginResponse response, UserProfileData theUser) | 360 | private void AddActiveGestures(LoginResponse response, UserProfileData theUser) |
361 | { | 361 | { |
362 | List<InventoryItemBase> gestures = m_inventoryService.GetActiveGestures(theUser.ID); | 362 | List<InventoryItemBase> gestures = m_inventoryService.GetActiveGestures(theUser.ID); |
363 | //m_log.DebugFormat("[LOGIN]: AddActiveGestures, found {0}", gestures == null ? 0 : gestures.Count); | 363 | //m_log.DebugFormat("[LOGIN]: AddActiveGestures, found {0}", gestures == null ? 0 : gestures.Count); |
364 | ArrayList list = new ArrayList(); | 364 | ArrayList list = new ArrayList(); |
365 | if (gestures != null) | 365 | if (gestures != null) |
366 | { | 366 | { |
367 | foreach (InventoryItemBase gesture in gestures) | 367 | foreach (InventoryItemBase gesture in gestures) |
368 | { | 368 | { |
369 | Hashtable item = new Hashtable(); | 369 | Hashtable item = new Hashtable(); |
370 | item["item_id"] = gesture.ID.ToString(); | 370 | item["item_id"] = gesture.ID.ToString(); |
371 | item["asset_id"] = gesture.AssetID.ToString(); | 371 | item["asset_id"] = gesture.AssetID.ToString(); |
372 | list.Add(item); | 372 | list.Add(item); |
373 | } | 373 | } |
374 | } | 374 | } |
375 | response.ActiveGestures = list; | 375 | response.ActiveGestures = list; |
376 | } | 376 | } |
377 | 377 | ||
378 | /// <summary> | 378 | /// <summary> |
379 | /// Prepare a login to the given region. This involves both telling the region to expect a connection | 379 | /// Prepare a login to the given region. This involves both telling the region to expect a connection |
380 | /// and appropriately customising the response to the user. | 380 | /// and appropriately customising the response to the user. |
381 | /// </summary> | 381 | /// </summary> |
382 | /// <param name="sim"></param> | 382 | /// <param name="sim"></param> |
383 | /// <param name="user"></param> | 383 | /// <param name="user"></param> |
384 | /// <param name="response"></param> | 384 | /// <param name="response"></param> |
385 | /// <returns>true if the region was successfully contacted, false otherwise</returns> | 385 | /// <returns>true if the region was successfully contacted, false otherwise</returns> |
386 | private bool PrepareLoginToRegion(RegionProfileData regionInfo, UserProfileData user, LoginResponse response) | 386 | private bool PrepareLoginToRegion(RegionProfileData regionInfo, UserProfileData user, LoginResponse response) |
387 | { | 387 | { |
388 | try | 388 | try |
389 | { | 389 | { |
390 | response.SimAddress = Util.GetHostFromURL(regionInfo.serverURI).ToString(); | 390 | response.SimAddress = Util.GetHostFromURL(regionInfo.serverURI).ToString(); |
391 | response.SimPort = uint.Parse(regionInfo.serverURI.Split(new char[] { '/', ':' })[4]); | 391 | response.SimPort = uint.Parse(regionInfo.serverURI.Split(new char[] { '/', ':' })[4]); |
392 | response.RegionX = regionInfo.regionLocX; | 392 | response.RegionX = regionInfo.regionLocX; |
393 | response.RegionY = regionInfo.regionLocY; | 393 | response.RegionY = regionInfo.regionLocY; |
394 | 394 | ||
395 | string capsPath = CapsUtil.GetRandomCapsObjectPath(); | 395 | string capsPath = CapsUtil.GetRandomCapsObjectPath(); |
396 | 396 | ||
397 | // Take off trailing / so that the caps path isn't //CAPS/someUUID | 397 | // Take off trailing / so that the caps path isn't //CAPS/someUUID |
398 | if (regionInfo.httpServerURI.EndsWith("/")) | 398 | if (regionInfo.httpServerURI.EndsWith("/")) |
399 | regionInfo.httpServerURI = regionInfo.httpServerURI.Substring(0, regionInfo.httpServerURI.Length - 1); | 399 | regionInfo.httpServerURI = regionInfo.httpServerURI.Substring(0, regionInfo.httpServerURI.Length - 1); |
400 | response.SeedCapability = regionInfo.httpServerURI + CapsUtil.GetCapsSeedPath(capsPath); | 400 | response.SeedCapability = regionInfo.httpServerURI + CapsUtil.GetCapsSeedPath(capsPath); |
401 | 401 | ||
402 | // Notify the target of an incoming user | 402 | // Notify the target of an incoming user |
403 | m_log.InfoFormat( | 403 | m_log.InfoFormat( |
404 | "[LOGIN]: Telling {0} @ {1},{2} ({3}) to prepare for client connection", | 404 | "[LOGIN]: Telling {0} @ {1},{2} ({3}) to prepare for client connection", |
405 | regionInfo.regionName, response.RegionX, response.RegionY, regionInfo.httpServerURI); | 405 | regionInfo.regionName, response.RegionX, response.RegionY, regionInfo.httpServerURI); |
406 | 406 | ||
407 | // Update agent with target sim | 407 | // Update agent with target sim |
408 | user.CurrentAgent.Region = regionInfo.UUID; | 408 | user.CurrentAgent.Region = regionInfo.UUID; |
409 | user.CurrentAgent.Handle = regionInfo.regionHandle; | 409 | user.CurrentAgent.Handle = regionInfo.regionHandle; |
410 | 410 | ||
411 | // Prepare notification | 411 | // Prepare notification |
412 | Hashtable loginParams = new Hashtable(); | 412 | Hashtable loginParams = new Hashtable(); |
413 | loginParams["session_id"] = user.CurrentAgent.SessionID.ToString(); | 413 | loginParams["session_id"] = user.CurrentAgent.SessionID.ToString(); |
414 | loginParams["secure_session_id"] = user.CurrentAgent.SecureSessionID.ToString(); | 414 | loginParams["secure_session_id"] = user.CurrentAgent.SecureSessionID.ToString(); |
415 | loginParams["firstname"] = user.FirstName; | 415 | loginParams["firstname"] = user.FirstName; |
416 | loginParams["lastname"] = user.SurName; | 416 | loginParams["lastname"] = user.SurName; |
417 | loginParams["agent_id"] = user.ID.ToString(); | 417 | loginParams["agent_id"] = user.ID.ToString(); |
418 | loginParams["circuit_code"] = (Int32) Convert.ToUInt32(response.CircuitCode); | 418 | loginParams["circuit_code"] = (Int32) Convert.ToUInt32(response.CircuitCode); |
419 | loginParams["startpos_x"] = user.CurrentAgent.Position.X.ToString(); | 419 | loginParams["startpos_x"] = user.CurrentAgent.Position.X.ToString(); |
420 | loginParams["startpos_y"] = user.CurrentAgent.Position.Y.ToString(); | 420 | loginParams["startpos_y"] = user.CurrentAgent.Position.Y.ToString(); |
421 | loginParams["startpos_z"] = user.CurrentAgent.Position.Z.ToString(); | 421 | loginParams["startpos_z"] = user.CurrentAgent.Position.Z.ToString(); |
422 | loginParams["regionhandle"] = user.CurrentAgent.Handle.ToString(); | 422 | loginParams["regionhandle"] = user.CurrentAgent.Handle.ToString(); |
423 | loginParams["caps_path"] = capsPath; | 423 | loginParams["caps_path"] = capsPath; |
424 | 424 | ||
425 | // Get appearance | 425 | // Get appearance |
426 | AvatarAppearance appearance = m_userManager.GetUserAppearance(user.ID); | 426 | AvatarAppearance appearance = m_userManager.GetUserAppearance(user.ID); |
427 | if (appearance != null) | 427 | if (appearance != null) |
428 | { | 428 | { |
429 | loginParams["appearance"] = appearance.ToHashTable(); | 429 | loginParams["appearance"] = appearance.ToHashTable(); |
430 | m_log.DebugFormat("[LOGIN]: Found appearance for {0} {1}", user.FirstName, user.SurName); | 430 | m_log.DebugFormat("[LOGIN]: Found appearance for {0} {1}", user.FirstName, user.SurName); |
431 | } | 431 | } |
432 | else | 432 | else |
433 | { | 433 | { |
434 | m_log.DebugFormat("[LOGIN]: Appearance not for {0} {1}. Creating default.", user.FirstName, user.SurName); | 434 | m_log.DebugFormat("[LOGIN]: Appearance not for {0} {1}. Creating default.", user.FirstName, user.SurName); |
435 | appearance = new AvatarAppearance(user.ID); | 435 | appearance = new AvatarAppearance(user.ID); |
436 | } | 436 | } |
437 | 437 | ||
438 | ArrayList SendParams = new ArrayList(); | 438 | ArrayList SendParams = new ArrayList(); |
439 | SendParams.Add(loginParams); | 439 | SendParams.Add(loginParams); |
440 | 440 | ||
441 | // Send | 441 | // Send |
442 | XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); | 442 | XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); |
443 | XmlRpcResponse GridResp = GridReq.Send(regionInfo.httpServerURI, 6000); | 443 | XmlRpcResponse GridResp = GridReq.Send(regionInfo.httpServerURI, 6000); |
444 | 444 | ||
445 | if (!GridResp.IsFault) | 445 | if (!GridResp.IsFault) |
446 | { | 446 | { |
447 | bool responseSuccess = true; | 447 | bool responseSuccess = true; |
448 | 448 | ||
449 | if (GridResp.Value != null) | 449 | if (GridResp.Value != null) |
450 | { | 450 | { |
451 | Hashtable resp = (Hashtable) GridResp.Value; | 451 | Hashtable resp = (Hashtable) GridResp.Value; |
452 | if (resp.ContainsKey("success")) | 452 | if (resp.ContainsKey("success")) |
453 | { | 453 | { |
454 | if ((string) resp["success"] == "FALSE") | 454 | if ((string) resp["success"] == "FALSE") |
455 | { | 455 | { |
456 | responseSuccess = false; | 456 | responseSuccess = false; |
457 | } | 457 | } |
458 | } | 458 | } |
459 | } | 459 | } |
460 | if (responseSuccess) | 460 | if (responseSuccess) |
461 | { | 461 | { |
462 | handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation; | 462 | handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation; |
463 | if (handlerUserLoggedInAtLocation != null) | 463 | if (handlerUserLoggedInAtLocation != null) |
464 | { | 464 | { |
465 | handlerUserLoggedInAtLocation(user.ID, user.CurrentAgent.SessionID, | 465 | handlerUserLoggedInAtLocation(user.ID, user.CurrentAgent.SessionID, |
466 | user.CurrentAgent.Region, | 466 | user.CurrentAgent.Region, |
467 | user.CurrentAgent.Handle, | 467 | user.CurrentAgent.Handle, |
468 | user.CurrentAgent.Position.X, | 468 | user.CurrentAgent.Position.X, |
469 | user.CurrentAgent.Position.Y, | 469 | user.CurrentAgent.Position.Y, |
470 | user.CurrentAgent.Position.Z, | 470 | user.CurrentAgent.Position.Z, |
471 | user.FirstName, user.SurName); | 471 | user.FirstName, user.SurName); |
472 | } | 472 | } |
473 | } | 473 | } |
474 | else | 474 | else |
475 | { | 475 | { |
476 | m_log.ErrorFormat("[LOGIN]: Region responded that it is not available to receive clients"); | 476 | m_log.ErrorFormat("[LOGIN]: Region responded that it is not available to receive clients"); |
477 | return false; | 477 | return false; |
478 | } | 478 | } |
479 | } | 479 | } |
480 | else | 480 | else |
481 | { | 481 | { |
482 | m_log.ErrorFormat("[LOGIN]: XmlRpc request to region failed with message {0}, code {1} ", GridResp.FaultString, GridResp.FaultCode); | 482 | m_log.ErrorFormat("[LOGIN]: XmlRpc request to region failed with message {0}, code {1} ", GridResp.FaultString, GridResp.FaultCode); |
483 | return false; | 483 | return false; |
484 | } | 484 | } |
485 | } | 485 | } |
486 | catch (Exception e) | 486 | catch (Exception e) |
487 | { | 487 | { |
488 | m_log.ErrorFormat("[LOGIN]: Region not available for login, {0}", e); | 488 | m_log.ErrorFormat("[LOGIN]: Region not available for login, {0}", e); |
489 | return false; | 489 | return false; |
490 | } | 490 | } |
491 | 491 | ||
492 | return true; | 492 | return true; |
493 | } | 493 | } |
494 | 494 | ||
495 | // See LoginService | 495 | // See LoginService |
496 | protected override InventoryData GetInventorySkeleton(UUID userID) | 496 | protected override InventoryData GetInventorySkeleton(UUID userID) |
497 | { | 497 | { |
498 | m_log.DebugFormat( | 498 | m_log.DebugFormat( |
499 | "[LOGIN]: Contacting inventory service at {0} for inventory skeleton of user {1}", | 499 | "[LOGIN]: Contacting inventory service at {0} for inventory skeleton of user {1}", |
500 | m_config.InventoryUrl, userID); | 500 | m_config.InventoryUrl, userID); |
501 | 501 | ||
502 | List<InventoryFolderBase> folders = m_inventoryService.GetInventorySkeleton(userID); | 502 | List<InventoryFolderBase> folders = m_inventoryService.GetInventorySkeleton(userID); |
503 | 503 | ||
504 | if (null == folders || folders.Count == 0) | 504 | if (null == folders || folders.Count == 0) |
505 | { | 505 | { |
506 | m_log.InfoFormat( | 506 | m_log.InfoFormat( |
507 | "[LOGIN]: A root inventory folder for user {0} was not found. Requesting creation.", userID); | 507 | "[LOGIN]: A root inventory folder for user {0} was not found. Requesting creation.", userID); |
508 | 508 | ||
509 | // Although the create user function creates a new agent inventory along with a new user profile, some | 509 | // Although the create user function creates a new agent inventory along with a new user profile, some |
510 | // tools are creating the user profile directly in the database without creating the inventory. At | 510 | // tools are creating the user profile directly in the database without creating the inventory. At |
511 | // this time we'll accomodate them by lazily creating the user inventory now if it doesn't already | 511 | // this time we'll accomodate them by lazily creating the user inventory now if it doesn't already |
512 | // exist. | 512 | // exist. |
513 | if (!m_inventoryService.CreateNewUserInventory(userID)) | 513 | if (!m_inventoryService.CreateNewUserInventory(userID)) |
514 | { | 514 | { |
515 | throw new Exception( | 515 | throw new Exception( |
516 | String.Format( | 516 | String.Format( |
517 | "The inventory creation request for user {0} did not succeed." | 517 | "The inventory creation request for user {0} did not succeed." |
518 | + " Please contact your inventory service provider for more information.", | 518 | + " Please contact your inventory service provider for more information.", |
519 | userID)); | 519 | userID)); |
520 | } | 520 | } |
521 | m_log.InfoFormat("[LOGIN]: A new inventory skeleton was successfully created for user {0}", userID); | 521 | m_log.InfoFormat("[LOGIN]: A new inventory skeleton was successfully created for user {0}", userID); |
522 | 522 | ||
523 | folders = m_inventoryService.GetInventorySkeleton(userID); | 523 | folders = m_inventoryService.GetInventorySkeleton(userID); |
524 | } | 524 | } |
525 | 525 | ||
526 | if (folders != null && folders.Count > 0) | 526 | if (folders != null && folders.Count > 0) |
527 | { | 527 | { |
528 | UUID rootID = UUID.Zero; | 528 | UUID rootID = UUID.Zero; |
529 | ArrayList AgentInventoryArray = new ArrayList(); | 529 | ArrayList AgentInventoryArray = new ArrayList(); |
530 | Hashtable TempHash; | 530 | Hashtable TempHash; |
531 | 531 | ||
532 | foreach (InventoryFolderBase InvFolder in folders) | 532 | foreach (InventoryFolderBase InvFolder in folders) |
533 | { | 533 | { |
534 | // m_log.DebugFormat("[LOGIN]: Received agent inventory folder {0}", InvFolder.name); | 534 | // m_log.DebugFormat("[LOGIN]: Received agent inventory folder {0}", InvFolder.name); |
535 | 535 | ||
536 | if (InvFolder.ParentID == UUID.Zero) | 536 | if (InvFolder.ParentID == UUID.Zero) |
537 | { | 537 | { |
538 | rootID = InvFolder.ID; | 538 | rootID = InvFolder.ID; |
539 | } | 539 | } |
540 | TempHash = new Hashtable(); | 540 | TempHash = new Hashtable(); |
541 | TempHash["name"] = InvFolder.Name; | 541 | TempHash["name"] = InvFolder.Name; |
542 | TempHash["parent_id"] = InvFolder.ParentID.ToString(); | 542 | TempHash["parent_id"] = InvFolder.ParentID.ToString(); |
543 | TempHash["version"] = (Int32) InvFolder.Version; | 543 | TempHash["version"] = (Int32) InvFolder.Version; |
544 | TempHash["type_default"] = (Int32) InvFolder.Type; | 544 | TempHash["type_default"] = (Int32) InvFolder.Type; |
545 | TempHash["folder_id"] = InvFolder.ID.ToString(); | 545 | TempHash["folder_id"] = InvFolder.ID.ToString(); |
546 | AgentInventoryArray.Add(TempHash); | 546 | AgentInventoryArray.Add(TempHash); |
547 | } | 547 | } |
548 | 548 | ||
549 | return new InventoryData(AgentInventoryArray, rootID); | 549 | return new InventoryData(AgentInventoryArray, rootID); |
550 | } | 550 | } |
551 | throw new Exception( | 551 | throw new Exception( |
552 | String.Format( | 552 | String.Format( |
553 | "A root inventory folder for user {0} could not be retrieved from the inventory service", | 553 | "A root inventory folder for user {0} could not be retrieved from the inventory service", |
554 | userID)); | 554 | userID)); |
555 | } | 555 | } |
556 | 556 | ||
557 | public XmlRpcResponse XmlRPCSetLoginParams(XmlRpcRequest request) | 557 | public XmlRpcResponse XmlRPCSetLoginParams(XmlRpcRequest request) |
558 | { | 558 | { |
559 | XmlRpcResponse response = new XmlRpcResponse(); | 559 | XmlRpcResponse response = new XmlRpcResponse(); |
560 | Hashtable requestData = (Hashtable) request.Params[0]; | 560 | Hashtable requestData = (Hashtable) request.Params[0]; |
561 | UserProfileData userProfile; | 561 | UserProfileData userProfile; |
562 | Hashtable responseData = new Hashtable(); | 562 | Hashtable responseData = new Hashtable(); |
563 | 563 | ||
564 | UUID uid; | 564 | UUID uid; |
565 | string pass = requestData["password"].ToString(); | 565 | string pass = requestData["password"].ToString(); |
566 | 566 | ||
567 | if (!UUID.TryParse((string) requestData["avatar_uuid"], out uid)) | 567 | if (!UUID.TryParse((string) requestData["avatar_uuid"], out uid)) |
568 | { | 568 | { |
569 | responseData["error"] = "No authorization"; | 569 | responseData["error"] = "No authorization"; |
570 | response.Value = responseData; | 570 | response.Value = responseData; |
571 | return response; | 571 | return response; |
572 | } | 572 | } |
573 | 573 | ||
574 | userProfile = m_userManager.GetUserProfile(uid); | 574 | userProfile = m_userManager.GetUserProfile(uid); |
575 | 575 | ||
576 | if (userProfile == null || | 576 | if (userProfile == null || |
577 | (!AuthenticateUser(userProfile, pass)) || | 577 | (!AuthenticateUser(userProfile, pass)) || |
578 | userProfile.GodLevel < 200) | 578 | userProfile.GodLevel < 200) |
579 | { | 579 | { |
580 | responseData["error"] = "No authorization"; | 580 | responseData["error"] = "No authorization"; |
581 | response.Value = responseData; | 581 | response.Value = responseData; |
582 | return response; | 582 | return response; |
583 | } | 583 | } |
584 | 584 | ||
585 | if (requestData.ContainsKey("login_level")) | 585 | if (requestData.ContainsKey("login_level")) |
586 | { | 586 | { |
587 | m_minLoginLevel = Convert.ToInt32(requestData["login_level"]); | 587 | m_minLoginLevel = Convert.ToInt32(requestData["login_level"]); |
588 | } | 588 | } |
589 | 589 | ||
590 | if (requestData.ContainsKey("login_motd")) | 590 | if (requestData.ContainsKey("login_motd")) |
591 | { | 591 | { |
592 | m_welcomeMessage = requestData["login_motd"].ToString(); | 592 | m_welcomeMessage = requestData["login_motd"].ToString(); |
593 | } | 593 | } |
594 | 594 | ||
595 | response.Value = responseData; | 595 | response.Value = responseData; |
596 | return response; | 596 | return response; |
597 | } | 597 | } |
598 | 598 | ||
599 | } | 599 | } |
600 | } | 600 | } |
diff --git a/OpenSim/Grid/UserServer.Modules/UserManager.cs b/OpenSim/Grid/UserServer.Modules/UserManager.cs index dd9f495..c6c3a1a 100644 --- a/OpenSim/Grid/UserServer.Modules/UserManager.cs +++ b/OpenSim/Grid/UserServer.Modules/UserManager.cs | |||
@@ -1,686 +1,686 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using log4net; | 32 | using log4net; |
33 | using Nwc.XmlRpc; | 33 | using Nwc.XmlRpc; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Communications; | 36 | using OpenSim.Framework.Communications; |
37 | using OpenSim.Framework.Servers; | 37 | using OpenSim.Framework.Servers; |
38 | 38 | ||
39 | namespace OpenSim.Grid.UserServer.Modules | 39 | namespace OpenSim.Grid.UserServer.Modules |
40 | { | 40 | { |
41 | public delegate void logOffUser(UUID AgentID); | 41 | public delegate void logOffUser(UUID AgentID); |
42 | 42 | ||
43 | public class UserManager | 43 | public class UserManager |
44 | { | 44 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 46 | ||
47 | public event logOffUser OnLogOffUser; | 47 | public event logOffUser OnLogOffUser; |
48 | private logOffUser handlerLogOffUser; | 48 | private logOffUser handlerLogOffUser; |
49 | 49 | ||
50 | private UserDataBaseService m_userDataBaseService; | 50 | private UserDataBaseService m_userDataBaseService; |
51 | private BaseHttpServer m_httpServer; | 51 | private BaseHttpServer m_httpServer; |
52 | 52 | ||
53 | /// <summary> | 53 | /// <summary> |
54 | /// | 54 | /// |
55 | /// </summary> | 55 | /// </summary> |
56 | /// <param name="userDataBaseService"></param> | 56 | /// <param name="userDataBaseService"></param> |
57 | public UserManager( UserDataBaseService userDataBaseService) | 57 | public UserManager( UserDataBaseService userDataBaseService) |
58 | { | 58 | { |
59 | m_userDataBaseService = userDataBaseService; | 59 | m_userDataBaseService = userDataBaseService; |
60 | } | 60 | } |
61 | 61 | ||
62 | public void Initialise() | 62 | public void Initialise() |
63 | { | 63 | { |
64 | 64 | ||
65 | } | 65 | } |
66 | 66 | ||
67 | public void PostInitialise() | 67 | public void PostInitialise() |
68 | { | 68 | { |
69 | 69 | ||
70 | } | 70 | } |
71 | 71 | ||
72 | public void RegisterHandlers(BaseHttpServer httpServer) | 72 | public void RegisterHandlers(BaseHttpServer httpServer) |
73 | { | 73 | { |
74 | m_httpServer = httpServer; | 74 | m_httpServer = httpServer; |
75 | 75 | ||
76 | m_httpServer.AddXmlRPCHandler("get_user_by_name", XmlRPCGetUserMethodName); | 76 | m_httpServer.AddXmlRPCHandler("get_user_by_name", XmlRPCGetUserMethodName); |
77 | m_httpServer.AddXmlRPCHandler("get_user_by_uuid", XmlRPCGetUserMethodUUID); | 77 | m_httpServer.AddXmlRPCHandler("get_user_by_uuid", XmlRPCGetUserMethodUUID); |
78 | m_httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", XmlRPCGetAvatarPickerAvatar); | 78 | m_httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", XmlRPCGetAvatarPickerAvatar); |
79 | 79 | ||
80 | m_httpServer.AddXmlRPCHandler("update_user_current_region", XmlRPCAtRegion); | 80 | m_httpServer.AddXmlRPCHandler("update_user_current_region", XmlRPCAtRegion); |
81 | m_httpServer.AddXmlRPCHandler("logout_of_simulator", XmlRPCLogOffUserMethodUUID); | 81 | m_httpServer.AddXmlRPCHandler("logout_of_simulator", XmlRPCLogOffUserMethodUUID); |
82 | m_httpServer.AddXmlRPCHandler("get_agent_by_uuid", XmlRPCGetAgentMethodUUID); | 82 | m_httpServer.AddXmlRPCHandler("get_agent_by_uuid", XmlRPCGetAgentMethodUUID); |
83 | m_httpServer.AddXmlRPCHandler("check_auth_session", XmlRPCCheckAuthSession); | 83 | m_httpServer.AddXmlRPCHandler("check_auth_session", XmlRPCCheckAuthSession); |
84 | 84 | ||
85 | m_httpServer.AddXmlRPCHandler("update_user_profile", XmlRpcResponseXmlRPCUpdateUserProfile); | 85 | m_httpServer.AddXmlRPCHandler("update_user_profile", XmlRpcResponseXmlRPCUpdateUserProfile); |
86 | 86 | ||
87 | m_httpServer.AddStreamHandler(new RestStreamHandler("DELETE", "/usersessions/", RestDeleteUserSessionMethod)); | 87 | m_httpServer.AddStreamHandler(new RestStreamHandler("DELETE", "/usersessions/", RestDeleteUserSessionMethod)); |
88 | } | 88 | } |
89 | 89 | ||
90 | /// <summary> | 90 | /// <summary> |
91 | /// Deletes an active agent session | 91 | /// Deletes an active agent session |
92 | /// </summary> | 92 | /// </summary> |
93 | /// <param name="request">The request</param> | 93 | /// <param name="request">The request</param> |
94 | /// <param name="path">The path (eg /bork/narf/test)</param> | 94 | /// <param name="path">The path (eg /bork/narf/test)</param> |
95 | /// <param name="param">Parameters sent</param> | 95 | /// <param name="param">Parameters sent</param> |
96 | /// <param name="httpRequest">HTTP request header object</param> | 96 | /// <param name="httpRequest">HTTP request header object</param> |
97 | /// <param name="httpResponse">HTTP response header object</param> | 97 | /// <param name="httpResponse">HTTP response header object</param> |
98 | /// <returns>Success "OK" else error</returns> | 98 | /// <returns>Success "OK" else error</returns> |
99 | public string RestDeleteUserSessionMethod(string request, string path, string param, | 99 | public string RestDeleteUserSessionMethod(string request, string path, string param, |
100 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 100 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
101 | { | 101 | { |
102 | // TODO! Important! | 102 | // TODO! Important! |
103 | 103 | ||
104 | return "OK"; | 104 | return "OK"; |
105 | } | 105 | } |
106 | 106 | ||
107 | /// <summary> | 107 | /// <summary> |
108 | /// Returns an error message that the user could not be found in the database | 108 | /// Returns an error message that the user could not be found in the database |
109 | /// </summary> | 109 | /// </summary> |
110 | /// <returns>XML string consisting of a error element containing individual error(s)</returns> | 110 | /// <returns>XML string consisting of a error element containing individual error(s)</returns> |
111 | public XmlRpcResponse CreateUnknownUserErrorResponse() | 111 | public XmlRpcResponse CreateUnknownUserErrorResponse() |
112 | { | 112 | { |
113 | XmlRpcResponse response = new XmlRpcResponse(); | 113 | XmlRpcResponse response = new XmlRpcResponse(); |
114 | Hashtable responseData = new Hashtable(); | 114 | Hashtable responseData = new Hashtable(); |
115 | responseData["error_type"] = "unknown_user"; | 115 | responseData["error_type"] = "unknown_user"; |
116 | responseData["error_desc"] = "The user requested is not in the database"; | 116 | responseData["error_desc"] = "The user requested is not in the database"; |
117 | 117 | ||
118 | response.Value = responseData; | 118 | response.Value = responseData; |
119 | return response; | 119 | return response; |
120 | } | 120 | } |
121 | 121 | ||
122 | public XmlRpcResponse AvatarPickerListtoXmlRPCResponse(UUID queryID, List<AvatarPickerAvatar> returnUsers) | 122 | public XmlRpcResponse AvatarPickerListtoXmlRPCResponse(UUID queryID, List<AvatarPickerAvatar> returnUsers) |
123 | { | 123 | { |
124 | XmlRpcResponse response = new XmlRpcResponse(); | 124 | XmlRpcResponse response = new XmlRpcResponse(); |
125 | Hashtable responseData = new Hashtable(); | 125 | Hashtable responseData = new Hashtable(); |
126 | // Query Result Information | 126 | // Query Result Information |
127 | responseData["queryid"] = queryID.ToString(); | 127 | responseData["queryid"] = queryID.ToString(); |
128 | responseData["avcount"] = returnUsers.Count.ToString(); | 128 | responseData["avcount"] = returnUsers.Count.ToString(); |
129 | 129 | ||
130 | for (int i = 0; i < returnUsers.Count; i++) | 130 | for (int i = 0; i < returnUsers.Count; i++) |
131 | { | 131 | { |
132 | responseData["avatarid" + i] = returnUsers[i].AvatarID.ToString(); | 132 | responseData["avatarid" + i] = returnUsers[i].AvatarID.ToString(); |
133 | responseData["firstname" + i] = returnUsers[i].firstName; | 133 | responseData["firstname" + i] = returnUsers[i].firstName; |
134 | responseData["lastname" + i] = returnUsers[i].lastName; | 134 | responseData["lastname" + i] = returnUsers[i].lastName; |
135 | } | 135 | } |
136 | response.Value = responseData; | 136 | response.Value = responseData; |
137 | 137 | ||
138 | return response; | 138 | return response; |
139 | } | 139 | } |
140 | 140 | ||
141 | /// <summary> | 141 | /// <summary> |
142 | /// Converts a user profile to an XML element which can be returned | 142 | /// Converts a user profile to an XML element which can be returned |
143 | /// </summary> | 143 | /// </summary> |
144 | /// <param name="profile">The user profile</param> | 144 | /// <param name="profile">The user profile</param> |
145 | /// <returns>A string containing an XML Document of the user profile</returns> | 145 | /// <returns>A string containing an XML Document of the user profile</returns> |
146 | public XmlRpcResponse ProfileToXmlRPCResponse(UserProfileData profile) | 146 | public XmlRpcResponse ProfileToXmlRPCResponse(UserProfileData profile) |
147 | { | 147 | { |
148 | XmlRpcResponse response = new XmlRpcResponse(); | 148 | XmlRpcResponse response = new XmlRpcResponse(); |
149 | Hashtable responseData = new Hashtable(); | 149 | Hashtable responseData = new Hashtable(); |
150 | 150 | ||
151 | // Account information | 151 | // Account information |
152 | responseData["firstname"] = profile.FirstName; | 152 | responseData["firstname"] = profile.FirstName; |
153 | responseData["lastname"] = profile.SurName; | 153 | responseData["lastname"] = profile.SurName; |
154 | responseData["uuid"] = profile.ID.ToString(); | 154 | responseData["uuid"] = profile.ID.ToString(); |
155 | // Server Information | 155 | // Server Information |
156 | responseData["server_inventory"] = profile.UserInventoryURI; | 156 | responseData["server_inventory"] = profile.UserInventoryURI; |
157 | responseData["server_asset"] = profile.UserAssetURI; | 157 | responseData["server_asset"] = profile.UserAssetURI; |
158 | // Profile Information | 158 | // Profile Information |
159 | responseData["profile_about"] = profile.AboutText; | 159 | responseData["profile_about"] = profile.AboutText; |
160 | responseData["profile_firstlife_about"] = profile.FirstLifeAboutText; | 160 | responseData["profile_firstlife_about"] = profile.FirstLifeAboutText; |
161 | responseData["profile_firstlife_image"] = profile.FirstLifeImage.ToString(); | 161 | responseData["profile_firstlife_image"] = profile.FirstLifeImage.ToString(); |
162 | responseData["profile_can_do"] = profile.CanDoMask.ToString(); | 162 | responseData["profile_can_do"] = profile.CanDoMask.ToString(); |
163 | responseData["profile_want_do"] = profile.WantDoMask.ToString(); | 163 | responseData["profile_want_do"] = profile.WantDoMask.ToString(); |
164 | responseData["profile_image"] = profile.Image.ToString(); | 164 | responseData["profile_image"] = profile.Image.ToString(); |
165 | responseData["profile_created"] = profile.Created.ToString(); | 165 | responseData["profile_created"] = profile.Created.ToString(); |
166 | responseData["profile_lastlogin"] = profile.LastLogin.ToString(); | 166 | responseData["profile_lastlogin"] = profile.LastLogin.ToString(); |
167 | // Home region information | 167 | // Home region information |
168 | responseData["home_coordinates_x"] = profile.HomeLocation.X.ToString(); | 168 | responseData["home_coordinates_x"] = profile.HomeLocation.X.ToString(); |
169 | responseData["home_coordinates_y"] = profile.HomeLocation.Y.ToString(); | 169 | responseData["home_coordinates_y"] = profile.HomeLocation.Y.ToString(); |
170 | responseData["home_coordinates_z"] = profile.HomeLocation.Z.ToString(); | 170 | responseData["home_coordinates_z"] = profile.HomeLocation.Z.ToString(); |
171 | 171 | ||
172 | responseData["home_region"] = profile.HomeRegion.ToString(); | 172 | responseData["home_region"] = profile.HomeRegion.ToString(); |
173 | responseData["home_region_id"] = profile.HomeRegionID.ToString(); | 173 | responseData["home_region_id"] = profile.HomeRegionID.ToString(); |
174 | 174 | ||
175 | responseData["home_look_x"] = profile.HomeLookAt.X.ToString(); | 175 | responseData["home_look_x"] = profile.HomeLookAt.X.ToString(); |
176 | responseData["home_look_y"] = profile.HomeLookAt.Y.ToString(); | 176 | responseData["home_look_y"] = profile.HomeLookAt.Y.ToString(); |
177 | responseData["home_look_z"] = profile.HomeLookAt.Z.ToString(); | 177 | responseData["home_look_z"] = profile.HomeLookAt.Z.ToString(); |
178 | 178 | ||
179 | responseData["user_flags"] = profile.UserFlags.ToString(); | 179 | responseData["user_flags"] = profile.UserFlags.ToString(); |
180 | responseData["god_level"] = profile.GodLevel.ToString(); | 180 | responseData["god_level"] = profile.GodLevel.ToString(); |
181 | responseData["custom_type"] = profile.CustomType; | 181 | responseData["custom_type"] = profile.CustomType; |
182 | responseData["partner"] = profile.Partner.ToString(); | 182 | responseData["partner"] = profile.Partner.ToString(); |
183 | response.Value = responseData; | 183 | response.Value = responseData; |
184 | 184 | ||
185 | return response; | 185 | return response; |
186 | } | 186 | } |
187 | 187 | ||
188 | #region XMLRPC User Methods | 188 | #region XMLRPC User Methods |
189 | 189 | ||
190 | public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request) | 190 | public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request) |
191 | { | 191 | { |
192 | // XmlRpcResponse response = new XmlRpcResponse(); | 192 | // XmlRpcResponse response = new XmlRpcResponse(); |
193 | Hashtable requestData = (Hashtable) request.Params[0]; | 193 | Hashtable requestData = (Hashtable) request.Params[0]; |
194 | List<AvatarPickerAvatar> returnAvatar = new List<AvatarPickerAvatar>(); | 194 | List<AvatarPickerAvatar> returnAvatar = new List<AvatarPickerAvatar>(); |
195 | UUID queryID = new UUID(UUID.Zero.ToString()); | 195 | UUID queryID = new UUID(UUID.Zero.ToString()); |
196 | 196 | ||
197 | if (requestData.Contains("avquery") && requestData.Contains("queryid")) | 197 | if (requestData.Contains("avquery") && requestData.Contains("queryid")) |
198 | { | 198 | { |
199 | queryID = new UUID((string) requestData["queryid"]); | 199 | queryID = new UUID((string) requestData["queryid"]); |
200 | returnAvatar = m_userDataBaseService.GenerateAgentPickerRequestResponse(queryID, (string) requestData["avquery"]); | 200 | returnAvatar = m_userDataBaseService.GenerateAgentPickerRequestResponse(queryID, (string) requestData["avquery"]); |
201 | } | 201 | } |
202 | 202 | ||
203 | m_log.InfoFormat("[AVATARINFO]: Servicing Avatar Query: " + (string) requestData["avquery"]); | 203 | m_log.InfoFormat("[AVATARINFO]: Servicing Avatar Query: " + (string) requestData["avquery"]); |
204 | return AvatarPickerListtoXmlRPCResponse(queryID, returnAvatar); | 204 | return AvatarPickerListtoXmlRPCResponse(queryID, returnAvatar); |
205 | } | 205 | } |
206 | 206 | ||
207 | public XmlRpcResponse XmlRPCAtRegion(XmlRpcRequest request) | 207 | public XmlRpcResponse XmlRPCAtRegion(XmlRpcRequest request) |
208 | { | 208 | { |
209 | XmlRpcResponse response = new XmlRpcResponse(); | 209 | XmlRpcResponse response = new XmlRpcResponse(); |
210 | Hashtable requestData = (Hashtable) request.Params[0]; | 210 | Hashtable requestData = (Hashtable) request.Params[0]; |
211 | Hashtable responseData = new Hashtable(); | 211 | Hashtable responseData = new Hashtable(); |
212 | string returnstring = "FALSE"; | 212 | string returnstring = "FALSE"; |
213 | 213 | ||
214 | if (requestData.Contains("avatar_id") && requestData.Contains("region_handle") && | 214 | if (requestData.Contains("avatar_id") && requestData.Contains("region_handle") && |
215 | requestData.Contains("region_uuid")) | 215 | requestData.Contains("region_uuid")) |
216 | { | 216 | { |
217 | // ulong cregionhandle = 0; | 217 | // ulong cregionhandle = 0; |
218 | UUID regionUUID; | 218 | UUID regionUUID; |
219 | UUID avatarUUID; | 219 | UUID avatarUUID; |
220 | 220 | ||
221 | UUID.TryParse((string) requestData["avatar_id"], out avatarUUID); | 221 | UUID.TryParse((string) requestData["avatar_id"], out avatarUUID); |
222 | UUID.TryParse((string) requestData["region_uuid"], out regionUUID); | 222 | UUID.TryParse((string) requestData["region_uuid"], out regionUUID); |
223 | 223 | ||
224 | if (avatarUUID != UUID.Zero) | 224 | if (avatarUUID != UUID.Zero) |
225 | { | 225 | { |
226 | UserProfileData userProfile = m_userDataBaseService.GetUserProfile(avatarUUID); | 226 | UserProfileData userProfile = m_userDataBaseService.GetUserProfile(avatarUUID); |
227 | userProfile.CurrentAgent.Region = regionUUID; | 227 | userProfile.CurrentAgent.Region = regionUUID; |
228 | userProfile.CurrentAgent.Handle = (ulong) Convert.ToInt64((string) requestData["region_handle"]); | 228 | userProfile.CurrentAgent.Handle = (ulong) Convert.ToInt64((string) requestData["region_handle"]); |
229 | //userProfile.CurrentAgent. | 229 | //userProfile.CurrentAgent. |
230 | m_userDataBaseService.CommitAgent(ref userProfile); | 230 | m_userDataBaseService.CommitAgent(ref userProfile); |
231 | //setUserProfile(userProfile); | 231 | //setUserProfile(userProfile); |
232 | 232 | ||
233 | 233 | ||
234 | returnstring = "TRUE"; | 234 | returnstring = "TRUE"; |
235 | } | 235 | } |
236 | } | 236 | } |
237 | responseData.Add("returnString", returnstring); | 237 | responseData.Add("returnString", returnstring); |
238 | response.Value = responseData; | 238 | response.Value = responseData; |
239 | return response; | 239 | return response; |
240 | } | 240 | } |
241 | 241 | ||
242 | public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request) | 242 | public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request) |
243 | { | 243 | { |
244 | // XmlRpcResponse response = new XmlRpcResponse(); | 244 | // XmlRpcResponse response = new XmlRpcResponse(); |
245 | Hashtable requestData = (Hashtable) request.Params[0]; | 245 | Hashtable requestData = (Hashtable) request.Params[0]; |
246 | UserProfileData userProfile; | 246 | UserProfileData userProfile; |
247 | if (requestData.Contains("avatar_name")) | 247 | if (requestData.Contains("avatar_name")) |
248 | { | 248 | { |
249 | string query = (string) requestData["avatar_name"]; | 249 | string query = (string) requestData["avatar_name"]; |
250 | 250 | ||
251 | // Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]"); | 251 | // Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]"); |
252 | 252 | ||
253 | string[] querysplit = query.Split(' '); | 253 | string[] querysplit = query.Split(' '); |
254 | 254 | ||
255 | if (querysplit.Length == 2) | 255 | if (querysplit.Length == 2) |
256 | { | 256 | { |
257 | userProfile = m_userDataBaseService.GetUserProfile(querysplit[0], querysplit[1]); | 257 | userProfile = m_userDataBaseService.GetUserProfile(querysplit[0], querysplit[1]); |
258 | if (userProfile == null) | 258 | if (userProfile == null) |
259 | { | 259 | { |
260 | return CreateUnknownUserErrorResponse(); | 260 | return CreateUnknownUserErrorResponse(); |
261 | } | 261 | } |
262 | } | 262 | } |
263 | else | 263 | else |
264 | { | 264 | { |
265 | return CreateUnknownUserErrorResponse(); | 265 | return CreateUnknownUserErrorResponse(); |
266 | } | 266 | } |
267 | } | 267 | } |
268 | else | 268 | else |
269 | { | 269 | { |
270 | return CreateUnknownUserErrorResponse(); | 270 | return CreateUnknownUserErrorResponse(); |
271 | } | 271 | } |
272 | 272 | ||
273 | return ProfileToXmlRPCResponse(userProfile); | 273 | return ProfileToXmlRPCResponse(userProfile); |
274 | } | 274 | } |
275 | 275 | ||
276 | public XmlRpcResponse XmlRPCGetUserMethodUUID(XmlRpcRequest request) | 276 | public XmlRpcResponse XmlRPCGetUserMethodUUID(XmlRpcRequest request) |
277 | { | 277 | { |
278 | // XmlRpcResponse response = new XmlRpcResponse(); | 278 | // XmlRpcResponse response = new XmlRpcResponse(); |
279 | Hashtable requestData = (Hashtable) request.Params[0]; | 279 | Hashtable requestData = (Hashtable) request.Params[0]; |
280 | UserProfileData userProfile; | 280 | UserProfileData userProfile; |
281 | //CFK: this clogs the UserServer log and is not necessary at this time. | 281 | //CFK: this clogs the UserServer log and is not necessary at this time. |
282 | //CFK: m_log.Debug("METHOD BY UUID CALLED"); | 282 | //CFK: m_log.Debug("METHOD BY UUID CALLED"); |
283 | if (requestData.Contains("avatar_uuid")) | 283 | if (requestData.Contains("avatar_uuid")) |
284 | { | 284 | { |
285 | try | 285 | try |
286 | { | 286 | { |
287 | UUID guess = new UUID((string) requestData["avatar_uuid"]); | 287 | UUID guess = new UUID((string) requestData["avatar_uuid"]); |
288 | 288 | ||
289 | userProfile = m_userDataBaseService.GetUserProfile(guess); | 289 | userProfile = m_userDataBaseService.GetUserProfile(guess); |
290 | } | 290 | } |
291 | catch (FormatException) | 291 | catch (FormatException) |
292 | { | 292 | { |
293 | return CreateUnknownUserErrorResponse(); | 293 | return CreateUnknownUserErrorResponse(); |
294 | } | 294 | } |
295 | 295 | ||
296 | if (userProfile == null) | 296 | if (userProfile == null) |
297 | { | 297 | { |
298 | return CreateUnknownUserErrorResponse(); | 298 | return CreateUnknownUserErrorResponse(); |
299 | } | 299 | } |
300 | } | 300 | } |
301 | else | 301 | else |
302 | { | 302 | { |
303 | return CreateUnknownUserErrorResponse(); | 303 | return CreateUnknownUserErrorResponse(); |
304 | } | 304 | } |
305 | 305 | ||
306 | return ProfileToXmlRPCResponse(userProfile); | 306 | return ProfileToXmlRPCResponse(userProfile); |
307 | } | 307 | } |
308 | 308 | ||
309 | public XmlRpcResponse XmlRPCGetAgentMethodUUID(XmlRpcRequest request) | 309 | public XmlRpcResponse XmlRPCGetAgentMethodUUID(XmlRpcRequest request) |
310 | { | 310 | { |
311 | XmlRpcResponse response = new XmlRpcResponse(); | 311 | XmlRpcResponse response = new XmlRpcResponse(); |
312 | Hashtable requestData = (Hashtable) request.Params[0]; | 312 | Hashtable requestData = (Hashtable) request.Params[0]; |
313 | UserProfileData userProfile; | 313 | UserProfileData userProfile; |
314 | //CFK: this clogs the UserServer log and is not necessary at this time. | 314 | //CFK: this clogs the UserServer log and is not necessary at this time. |
315 | //CFK: m_log.Debug("METHOD BY UUID CALLED"); | 315 | //CFK: m_log.Debug("METHOD BY UUID CALLED"); |
316 | if (requestData.Contains("avatar_uuid")) | 316 | if (requestData.Contains("avatar_uuid")) |
317 | { | 317 | { |
318 | UUID guess; | 318 | UUID guess; |
319 | 319 | ||
320 | UUID.TryParse((string) requestData["avatar_uuid"], out guess); | 320 | UUID.TryParse((string) requestData["avatar_uuid"], out guess); |
321 | 321 | ||
322 | if (guess == UUID.Zero) | 322 | if (guess == UUID.Zero) |
323 | { | 323 | { |
324 | return CreateUnknownUserErrorResponse(); | 324 | return CreateUnknownUserErrorResponse(); |
325 | } | 325 | } |
326 | 326 | ||
327 | userProfile = m_userDataBaseService.GetUserProfile(guess); | 327 | userProfile = m_userDataBaseService.GetUserProfile(guess); |
328 | 328 | ||
329 | if (userProfile == null) | 329 | if (userProfile == null) |
330 | { | 330 | { |
331 | return CreateUnknownUserErrorResponse(); | 331 | return CreateUnknownUserErrorResponse(); |
332 | } | 332 | } |
333 | 333 | ||
334 | // no agent??? | 334 | // no agent??? |
335 | if (userProfile.CurrentAgent == null) | 335 | if (userProfile.CurrentAgent == null) |
336 | { | 336 | { |
337 | return CreateUnknownUserErrorResponse(); | 337 | return CreateUnknownUserErrorResponse(); |
338 | } | 338 | } |
339 | Hashtable responseData = new Hashtable(); | 339 | Hashtable responseData = new Hashtable(); |
340 | 340 | ||
341 | responseData["handle"] = userProfile.CurrentAgent.Handle.ToString(); | 341 | responseData["handle"] = userProfile.CurrentAgent.Handle.ToString(); |
342 | responseData["session"] = userProfile.CurrentAgent.SessionID.ToString(); | 342 | responseData["session"] = userProfile.CurrentAgent.SessionID.ToString(); |
343 | if (userProfile.CurrentAgent.AgentOnline) | 343 | if (userProfile.CurrentAgent.AgentOnline) |
344 | responseData["agent_online"] = "TRUE"; | 344 | responseData["agent_online"] = "TRUE"; |
345 | else | 345 | else |
346 | responseData["agent_online"] = "FALSE"; | 346 | responseData["agent_online"] = "FALSE"; |
347 | 347 | ||
348 | response.Value = responseData; | 348 | response.Value = responseData; |
349 | } | 349 | } |
350 | else | 350 | else |
351 | { | 351 | { |
352 | return CreateUnknownUserErrorResponse(); | 352 | return CreateUnknownUserErrorResponse(); |
353 | } | 353 | } |
354 | 354 | ||
355 | return response; | 355 | return response; |
356 | } | 356 | } |
357 | 357 | ||
358 | public XmlRpcResponse XmlRPCCheckAuthSession(XmlRpcRequest request) | 358 | public XmlRpcResponse XmlRPCCheckAuthSession(XmlRpcRequest request) |
359 | { | 359 | { |
360 | XmlRpcResponse response = new XmlRpcResponse(); | 360 | XmlRpcResponse response = new XmlRpcResponse(); |
361 | Hashtable requestData = (Hashtable) request.Params[0]; | 361 | Hashtable requestData = (Hashtable) request.Params[0]; |
362 | UserProfileData userProfile; | 362 | UserProfileData userProfile; |
363 | 363 | ||
364 | string authed = "FALSE"; | 364 | string authed = "FALSE"; |
365 | if (requestData.Contains("avatar_uuid") && requestData.Contains("session_id")) | 365 | if (requestData.Contains("avatar_uuid") && requestData.Contains("session_id")) |
366 | { | 366 | { |
367 | UUID guess_aid; | 367 | UUID guess_aid; |
368 | UUID guess_sid; | 368 | UUID guess_sid; |
369 | 369 | ||
370 | UUID.TryParse((string) requestData["avatar_uuid"], out guess_aid); | 370 | UUID.TryParse((string) requestData["avatar_uuid"], out guess_aid); |
371 | if (guess_aid == UUID.Zero) | 371 | if (guess_aid == UUID.Zero) |
372 | { | 372 | { |
373 | return CreateUnknownUserErrorResponse(); | 373 | return CreateUnknownUserErrorResponse(); |
374 | } | 374 | } |
375 | UUID.TryParse((string) requestData["session_id"], out guess_sid); | 375 | UUID.TryParse((string) requestData["session_id"], out guess_sid); |
376 | if (guess_sid == UUID.Zero) | 376 | if (guess_sid == UUID.Zero) |
377 | { | 377 | { |
378 | return CreateUnknownUserErrorResponse(); | 378 | return CreateUnknownUserErrorResponse(); |
379 | } | 379 | } |
380 | userProfile = m_userDataBaseService.GetUserProfile(guess_aid); | 380 | userProfile = m_userDataBaseService.GetUserProfile(guess_aid); |
381 | if (userProfile != null && userProfile.CurrentAgent != null && | 381 | if (userProfile != null && userProfile.CurrentAgent != null && |
382 | userProfile.CurrentAgent.SessionID == guess_sid) | 382 | userProfile.CurrentAgent.SessionID == guess_sid) |
383 | { | 383 | { |
384 | authed = "TRUE"; | 384 | authed = "TRUE"; |
385 | } | 385 | } |
386 | m_log.InfoFormat("[UserManager]: CheckAuthSession TRUE for user {0}", guess_aid); | 386 | m_log.InfoFormat("[UserManager]: CheckAuthSession TRUE for user {0}", guess_aid); |
387 | } | 387 | } |
388 | else | 388 | else |
389 | { | 389 | { |
390 | m_log.InfoFormat("[UserManager]: CheckAuthSession FALSE"); | 390 | m_log.InfoFormat("[UserManager]: CheckAuthSession FALSE"); |
391 | return CreateUnknownUserErrorResponse(); | 391 | return CreateUnknownUserErrorResponse(); |
392 | } | 392 | } |
393 | Hashtable responseData = new Hashtable(); | 393 | Hashtable responseData = new Hashtable(); |
394 | responseData["auth_session"] = authed; | 394 | responseData["auth_session"] = authed; |
395 | response.Value = responseData; | 395 | response.Value = responseData; |
396 | return response; | 396 | return response; |
397 | } | 397 | } |
398 | 398 | ||
399 | public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserProfile(XmlRpcRequest request) | 399 | public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserProfile(XmlRpcRequest request) |
400 | { | 400 | { |
401 | m_log.Debug("[UserManager]: Got request to update user profile"); | 401 | m_log.Debug("[UserManager]: Got request to update user profile"); |
402 | XmlRpcResponse response = new XmlRpcResponse(); | 402 | XmlRpcResponse response = new XmlRpcResponse(); |
403 | Hashtable requestData = (Hashtable) request.Params[0]; | 403 | Hashtable requestData = (Hashtable) request.Params[0]; |
404 | Hashtable responseData = new Hashtable(); | 404 | Hashtable responseData = new Hashtable(); |
405 | 405 | ||
406 | if (!requestData.Contains("avatar_uuid")) | 406 | if (!requestData.Contains("avatar_uuid")) |
407 | { | 407 | { |
408 | return CreateUnknownUserErrorResponse(); | 408 | return CreateUnknownUserErrorResponse(); |
409 | } | 409 | } |
410 | 410 | ||
411 | UUID UserUUID = new UUID((string) requestData["avatar_uuid"]); | 411 | UUID UserUUID = new UUID((string) requestData["avatar_uuid"]); |
412 | UserProfileData userProfile = m_userDataBaseService.GetUserProfile(UserUUID); | 412 | UserProfileData userProfile = m_userDataBaseService.GetUserProfile(UserUUID); |
413 | if (null == userProfile) | 413 | if (null == userProfile) |
414 | { | 414 | { |
415 | return CreateUnknownUserErrorResponse(); | 415 | return CreateUnknownUserErrorResponse(); |
416 | } | 416 | } |
417 | // don't know how yet. | 417 | // don't know how yet. |
418 | if (requestData.Contains("AllowPublish")) | 418 | if (requestData.Contains("AllowPublish")) |
419 | { | 419 | { |
420 | } | 420 | } |
421 | if (requestData.Contains("FLImageID")) | 421 | if (requestData.Contains("FLImageID")) |
422 | { | 422 | { |
423 | userProfile.FirstLifeImage = new UUID((string) requestData["FLImageID"]); | 423 | userProfile.FirstLifeImage = new UUID((string) requestData["FLImageID"]); |
424 | } | 424 | } |
425 | if (requestData.Contains("ImageID")) | 425 | if (requestData.Contains("ImageID")) |
426 | { | 426 | { |
427 | userProfile.Image = new UUID((string) requestData["ImageID"]); | 427 | userProfile.Image = new UUID((string) requestData["ImageID"]); |
428 | } | 428 | } |
429 | // dont' know how yet | 429 | // dont' know how yet |
430 | if (requestData.Contains("MaturePublish")) | 430 | if (requestData.Contains("MaturePublish")) |
431 | { | 431 | { |
432 | } | 432 | } |
433 | if (requestData.Contains("AboutText")) | 433 | if (requestData.Contains("AboutText")) |
434 | { | 434 | { |
435 | userProfile.AboutText = (string) requestData["AboutText"]; | 435 | userProfile.AboutText = (string) requestData["AboutText"]; |
436 | } | 436 | } |
437 | if (requestData.Contains("FLAboutText")) | 437 | if (requestData.Contains("FLAboutText")) |
438 | { | 438 | { |
439 | userProfile.FirstLifeAboutText = (string) requestData["FLAboutText"]; | 439 | userProfile.FirstLifeAboutText = (string) requestData["FLAboutText"]; |
440 | } | 440 | } |
441 | // not in DB yet. | 441 | // not in DB yet. |
442 | if (requestData.Contains("ProfileURL")) | 442 | if (requestData.Contains("ProfileURL")) |
443 | { | 443 | { |
444 | } | 444 | } |
445 | if (requestData.Contains("home_region")) | 445 | if (requestData.Contains("home_region")) |
446 | { | 446 | { |
447 | try | 447 | try |
448 | { | 448 | { |
449 | userProfile.HomeRegion = Convert.ToUInt64((string) requestData["home_region"]); | 449 | userProfile.HomeRegion = Convert.ToUInt64((string) requestData["home_region"]); |
450 | } | 450 | } |
451 | catch (ArgumentException) | 451 | catch (ArgumentException) |
452 | { | 452 | { |
453 | m_log.Error("[PROFILE]:Failed to set home region, Invalid Argument"); | 453 | m_log.Error("[PROFILE]:Failed to set home region, Invalid Argument"); |
454 | } | 454 | } |
455 | catch (FormatException) | 455 | catch (FormatException) |
456 | { | 456 | { |
457 | m_log.Error("[PROFILE]:Failed to set home region, Invalid Format"); | 457 | m_log.Error("[PROFILE]:Failed to set home region, Invalid Format"); |
458 | } | 458 | } |
459 | catch (OverflowException) | 459 | catch (OverflowException) |
460 | { | 460 | { |
461 | m_log.Error("[PROFILE]:Failed to set home region, Value was too large"); | 461 | m_log.Error("[PROFILE]:Failed to set home region, Value was too large"); |
462 | } | 462 | } |
463 | } | 463 | } |
464 | if (requestData.Contains("home_region_id")) | 464 | if (requestData.Contains("home_region_id")) |
465 | { | 465 | { |
466 | UUID regionID; | 466 | UUID regionID; |
467 | UUID.TryParse((string) requestData["home_region_id"], out regionID); | 467 | UUID.TryParse((string) requestData["home_region_id"], out regionID); |
468 | userProfile.HomeRegionID = regionID; | 468 | userProfile.HomeRegionID = regionID; |
469 | } | 469 | } |
470 | if (requestData.Contains("home_pos_x")) | 470 | if (requestData.Contains("home_pos_x")) |
471 | { | 471 | { |
472 | try | 472 | try |
473 | { | 473 | { |
474 | userProfile.HomeLocationX = (float) Convert.ToDecimal((string) requestData["home_pos_x"]); | 474 | userProfile.HomeLocationX = (float) Convert.ToDecimal((string) requestData["home_pos_x"]); |
475 | } | 475 | } |
476 | catch (InvalidCastException) | 476 | catch (InvalidCastException) |
477 | { | 477 | { |
478 | m_log.Error("[PROFILE]:Failed to set home postion x"); | 478 | m_log.Error("[PROFILE]:Failed to set home postion x"); |
479 | } | 479 | } |
480 | } | 480 | } |
481 | if (requestData.Contains("home_pos_y")) | 481 | if (requestData.Contains("home_pos_y")) |
482 | { | 482 | { |
483 | try | 483 | try |
484 | { | 484 | { |
485 | userProfile.HomeLocationY = (float) Convert.ToDecimal((string) requestData["home_pos_y"]); | 485 | userProfile.HomeLocationY = (float) Convert.ToDecimal((string) requestData["home_pos_y"]); |
486 | } | 486 | } |
487 | catch (InvalidCastException) | 487 | catch (InvalidCastException) |
488 | { | 488 | { |
489 | m_log.Error("[PROFILE]:Failed to set home postion y"); | 489 | m_log.Error("[PROFILE]:Failed to set home postion y"); |
490 | } | 490 | } |
491 | } | 491 | } |
492 | if (requestData.Contains("home_pos_z")) | 492 | if (requestData.Contains("home_pos_z")) |
493 | { | 493 | { |
494 | try | 494 | try |
495 | { | 495 | { |
496 | userProfile.HomeLocationZ = (float) Convert.ToDecimal((string) requestData["home_pos_z"]); | 496 | userProfile.HomeLocationZ = (float) Convert.ToDecimal((string) requestData["home_pos_z"]); |
497 | } | 497 | } |
498 | catch (InvalidCastException) | 498 | catch (InvalidCastException) |
499 | { | 499 | { |
500 | m_log.Error("[PROFILE]:Failed to set home postion z"); | 500 | m_log.Error("[PROFILE]:Failed to set home postion z"); |
501 | } | 501 | } |
502 | } | 502 | } |
503 | if (requestData.Contains("home_look_x")) | 503 | if (requestData.Contains("home_look_x")) |
504 | { | 504 | { |
505 | try | 505 | try |
506 | { | 506 | { |
507 | userProfile.HomeLookAtX = (float) Convert.ToDecimal((string) requestData["home_look_x"]); | 507 | userProfile.HomeLookAtX = (float) Convert.ToDecimal((string) requestData["home_look_x"]); |
508 | } | 508 | } |
509 | catch (InvalidCastException) | 509 | catch (InvalidCastException) |
510 | { | 510 | { |
511 | m_log.Error("[PROFILE]:Failed to set home lookat x"); | 511 | m_log.Error("[PROFILE]:Failed to set home lookat x"); |
512 | } | 512 | } |
513 | } | 513 | } |
514 | if (requestData.Contains("home_look_y")) | 514 | if (requestData.Contains("home_look_y")) |
515 | { | 515 | { |
516 | try | 516 | try |
517 | { | 517 | { |
518 | userProfile.HomeLookAtY = (float) Convert.ToDecimal((string) requestData["home_look_y"]); | 518 | userProfile.HomeLookAtY = (float) Convert.ToDecimal((string) requestData["home_look_y"]); |
519 | } | 519 | } |
520 | catch (InvalidCastException) | 520 | catch (InvalidCastException) |
521 | { | 521 | { |
522 | m_log.Error("[PROFILE]:Failed to set home lookat y"); | 522 | m_log.Error("[PROFILE]:Failed to set home lookat y"); |
523 | } | 523 | } |
524 | } | 524 | } |
525 | if (requestData.Contains("home_look_z")) | 525 | if (requestData.Contains("home_look_z")) |
526 | { | 526 | { |
527 | try | 527 | try |
528 | { | 528 | { |
529 | userProfile.HomeLookAtZ = (float) Convert.ToDecimal((string) requestData["home_look_z"]); | 529 | userProfile.HomeLookAtZ = (float) Convert.ToDecimal((string) requestData["home_look_z"]); |
530 | } | 530 | } |
531 | catch (InvalidCastException) | 531 | catch (InvalidCastException) |
532 | { | 532 | { |
533 | m_log.Error("[PROFILE]:Failed to set home lookat z"); | 533 | m_log.Error("[PROFILE]:Failed to set home lookat z"); |
534 | } | 534 | } |
535 | } | 535 | } |
536 | if (requestData.Contains("user_flags")) | 536 | if (requestData.Contains("user_flags")) |
537 | { | 537 | { |
538 | try | 538 | try |
539 | { | 539 | { |
540 | userProfile.UserFlags = Convert.ToInt32((string) requestData["user_flags"]); | 540 | userProfile.UserFlags = Convert.ToInt32((string) requestData["user_flags"]); |
541 | } | 541 | } |
542 | catch (InvalidCastException) | 542 | catch (InvalidCastException) |
543 | { | 543 | { |
544 | m_log.Error("[PROFILE]:Failed to set user flags"); | 544 | m_log.Error("[PROFILE]:Failed to set user flags"); |
545 | } | 545 | } |
546 | } | 546 | } |
547 | if (requestData.Contains("god_level")) | 547 | if (requestData.Contains("god_level")) |
548 | { | 548 | { |
549 | try | 549 | try |
550 | { | 550 | { |
551 | userProfile.GodLevel = Convert.ToInt32((string) requestData["god_level"]); | 551 | userProfile.GodLevel = Convert.ToInt32((string) requestData["god_level"]); |
552 | } | 552 | } |
553 | catch (InvalidCastException) | 553 | catch (InvalidCastException) |
554 | { | 554 | { |
555 | m_log.Error("[PROFILE]:Failed to set god level"); | 555 | m_log.Error("[PROFILE]:Failed to set god level"); |
556 | } | 556 | } |
557 | } | 557 | } |
558 | if (requestData.Contains("custom_type")) | 558 | if (requestData.Contains("custom_type")) |
559 | { | 559 | { |
560 | try | 560 | try |
561 | { | 561 | { |
562 | userProfile.CustomType = (string) requestData["custom_type"]; | 562 | userProfile.CustomType = (string) requestData["custom_type"]; |
563 | } | 563 | } |
564 | catch (InvalidCastException) | 564 | catch (InvalidCastException) |
565 | { | 565 | { |
566 | m_log.Error("[PROFILE]:Failed to set custom type"); | 566 | m_log.Error("[PROFILE]:Failed to set custom type"); |
567 | } | 567 | } |
568 | } | 568 | } |
569 | if (requestData.Contains("partner")) | 569 | if (requestData.Contains("partner")) |
570 | { | 570 | { |
571 | try | 571 | try |
572 | { | 572 | { |
573 | userProfile.Partner = new UUID((string) requestData["partner"]); | 573 | userProfile.Partner = new UUID((string) requestData["partner"]); |
574 | } | 574 | } |
575 | catch (InvalidCastException) | 575 | catch (InvalidCastException) |
576 | { | 576 | { |
577 | m_log.Error("[PROFILE]:Failed to set partner"); | 577 | m_log.Error("[PROFILE]:Failed to set partner"); |
578 | } | 578 | } |
579 | } | 579 | } |
580 | else | 580 | else |
581 | { | 581 | { |
582 | userProfile.Partner = UUID.Zero; | 582 | userProfile.Partner = UUID.Zero; |
583 | } | 583 | } |
584 | 584 | ||
585 | // call plugin! | 585 | // call plugin! |
586 | bool ret = m_userDataBaseService.UpdateUserProfile(userProfile); | 586 | bool ret = m_userDataBaseService.UpdateUserProfile(userProfile); |
587 | responseData["returnString"] = ret.ToString(); | 587 | responseData["returnString"] = ret.ToString(); |
588 | response.Value = responseData; | 588 | response.Value = responseData; |
589 | return response; | 589 | return response; |
590 | } | 590 | } |
591 | 591 | ||
592 | public XmlRpcResponse XmlRPCLogOffUserMethodUUID(XmlRpcRequest request) | 592 | public XmlRpcResponse XmlRPCLogOffUserMethodUUID(XmlRpcRequest request) |
593 | { | 593 | { |
594 | XmlRpcResponse response = new XmlRpcResponse(); | 594 | XmlRpcResponse response = new XmlRpcResponse(); |
595 | Hashtable requestData = (Hashtable) request.Params[0]; | 595 | Hashtable requestData = (Hashtable) request.Params[0]; |
596 | 596 | ||
597 | if (requestData.Contains("avatar_uuid")) | 597 | if (requestData.Contains("avatar_uuid")) |
598 | { | 598 | { |
599 | try | 599 | try |
600 | { | 600 | { |
601 | UUID userUUID = new UUID((string)requestData["avatar_uuid"]); | 601 | UUID userUUID = new UUID((string)requestData["avatar_uuid"]); |
602 | UUID RegionID = new UUID((string)requestData["region_uuid"]); | 602 | UUID RegionID = new UUID((string)requestData["region_uuid"]); |
603 | ulong regionhandle = (ulong)Convert.ToInt64((string)requestData["region_handle"]); | 603 | ulong regionhandle = (ulong)Convert.ToInt64((string)requestData["region_handle"]); |
604 | Vector3 position = new Vector3( | 604 | Vector3 position = new Vector3( |
605 | (float)Convert.ToDecimal((string)requestData["region_pos_x"]), | 605 | (float)Convert.ToDecimal((string)requestData["region_pos_x"]), |
606 | (float)Convert.ToDecimal((string)requestData["region_pos_y"]), | 606 | (float)Convert.ToDecimal((string)requestData["region_pos_y"]), |
607 | (float)Convert.ToDecimal((string)requestData["region_pos_z"])); | 607 | (float)Convert.ToDecimal((string)requestData["region_pos_z"])); |
608 | Vector3 lookat = new Vector3( | 608 | Vector3 lookat = new Vector3( |
609 | (float)Convert.ToDecimal((string)requestData["lookat_x"]), | 609 | (float)Convert.ToDecimal((string)requestData["lookat_x"]), |
610 | (float)Convert.ToDecimal((string)requestData["lookat_y"]), | 610 | (float)Convert.ToDecimal((string)requestData["lookat_y"]), |
611 | (float)Convert.ToDecimal((string)requestData["lookat_z"])); | 611 | (float)Convert.ToDecimal((string)requestData["lookat_z"])); |
612 | 612 | ||
613 | handlerLogOffUser = OnLogOffUser; | 613 | handlerLogOffUser = OnLogOffUser; |
614 | if (handlerLogOffUser != null) | 614 | if (handlerLogOffUser != null) |
615 | handlerLogOffUser(userUUID); | 615 | handlerLogOffUser(userUUID); |
616 | 616 | ||
617 | m_userDataBaseService.LogOffUser(userUUID, RegionID, regionhandle, position, lookat); | 617 | m_userDataBaseService.LogOffUser(userUUID, RegionID, regionhandle, position, lookat); |
618 | } | 618 | } |
619 | catch (FormatException) | 619 | catch (FormatException) |
620 | { | 620 | { |
621 | m_log.Warn("[LOGOUT]: Error in Logout XMLRPC Params"); | 621 | m_log.Warn("[LOGOUT]: Error in Logout XMLRPC Params"); |
622 | return response; | 622 | return response; |
623 | } | 623 | } |
624 | } | 624 | } |
625 | else | 625 | else |
626 | { | 626 | { |
627 | return CreateUnknownUserErrorResponse(); | 627 | return CreateUnknownUserErrorResponse(); |
628 | } | 628 | } |
629 | 629 | ||
630 | return response; | 630 | return response; |
631 | } | 631 | } |
632 | 632 | ||
633 | #endregion | 633 | #endregion |
634 | 634 | ||
635 | 635 | ||
636 | public void HandleAgentLocation(UUID agentID, UUID regionID, ulong regionHandle) | 636 | public void HandleAgentLocation(UUID agentID, UUID regionID, ulong regionHandle) |
637 | { | 637 | { |
638 | UserProfileData userProfile = m_userDataBaseService.GetUserProfile(agentID); | 638 | UserProfileData userProfile = m_userDataBaseService.GetUserProfile(agentID); |
639 | if (userProfile != null) | 639 | if (userProfile != null) |
640 | { | 640 | { |
641 | userProfile.CurrentAgent.Region = regionID; | 641 | userProfile.CurrentAgent.Region = regionID; |
642 | userProfile.CurrentAgent.Handle = regionHandle; | 642 | userProfile.CurrentAgent.Handle = regionHandle; |
643 | m_userDataBaseService.CommitAgent(ref userProfile); | 643 | m_userDataBaseService.CommitAgent(ref userProfile); |
644 | } | 644 | } |
645 | } | 645 | } |
646 | 646 | ||
647 | public void HandleAgentLeaving(UUID agentID, UUID regionID, ulong regionHandle) | 647 | public void HandleAgentLeaving(UUID agentID, UUID regionID, ulong regionHandle) |
648 | { | 648 | { |
649 | UserProfileData userProfile = m_userDataBaseService.GetUserProfile(agentID); | 649 | UserProfileData userProfile = m_userDataBaseService.GetUserProfile(agentID); |
650 | if (userProfile != null) | 650 | if (userProfile != null) |
651 | { | 651 | { |
652 | if (userProfile.CurrentAgent.Region == regionID) | 652 | if (userProfile.CurrentAgent.Region == regionID) |
653 | { | 653 | { |
654 | UserAgentData userAgent = userProfile.CurrentAgent; | 654 | UserAgentData userAgent = userProfile.CurrentAgent; |
655 | if (userAgent != null && userAgent.AgentOnline) | 655 | if (userAgent != null && userAgent.AgentOnline) |
656 | { | 656 | { |
657 | userAgent.AgentOnline = false; | 657 | userAgent.AgentOnline = false; |
658 | userAgent.LogoutTime = Util.UnixTimeSinceEpoch(); | 658 | userAgent.LogoutTime = Util.UnixTimeSinceEpoch(); |
659 | if (regionID != UUID.Zero) | 659 | if (regionID != UUID.Zero) |
660 | { | 660 | { |
661 | userAgent.Region = regionID; | 661 | userAgent.Region = regionID; |
662 | } | 662 | } |
663 | userAgent.Handle = regionHandle; | 663 | userAgent.Handle = regionHandle; |
664 | userProfile.LastLogin = userAgent.LogoutTime; | 664 | userProfile.LastLogin = userAgent.LogoutTime; |
665 | 665 | ||
666 | m_userDataBaseService.CommitAgent(ref userProfile); | 666 | m_userDataBaseService.CommitAgent(ref userProfile); |
667 | 667 | ||
668 | handlerLogOffUser = OnLogOffUser; | 668 | handlerLogOffUser = OnLogOffUser; |
669 | if (handlerLogOffUser != null) | 669 | if (handlerLogOffUser != null) |
670 | handlerLogOffUser(agentID); | 670 | handlerLogOffUser(agentID); |
671 | } | 671 | } |
672 | } | 672 | } |
673 | } | 673 | } |
674 | } | 674 | } |
675 | 675 | ||
676 | public void HandleRegionStartup(UUID regionID) | 676 | public void HandleRegionStartup(UUID regionID) |
677 | { | 677 | { |
678 | m_userDataBaseService.LogoutUsers(regionID); | 678 | m_userDataBaseService.LogoutUsers(regionID); |
679 | } | 679 | } |
680 | 680 | ||
681 | public void HandleRegionShutdown(UUID regionID) | 681 | public void HandleRegionShutdown(UUID regionID) |
682 | { | 682 | { |
683 | m_userDataBaseService.LogoutUsers(regionID); | 683 | m_userDataBaseService.LogoutUsers(regionID); |
684 | } | 684 | } |
685 | } | 685 | } |
686 | } | 686 | } |
diff --git a/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs b/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs index 1c8c0c8..a1497b4 100644 --- a/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs +++ b/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs | |||
@@ -1,124 +1,124 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using log4net; | 32 | using log4net; |
33 | using Nwc.XmlRpc; | 33 | using Nwc.XmlRpc; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Communications; | 36 | using OpenSim.Framework.Communications; |
37 | using OpenSim.Framework.Servers; | 37 | using OpenSim.Framework.Servers; |
38 | 38 | ||
39 | namespace OpenSim.Grid.UserServer.Modules | 39 | namespace OpenSim.Grid.UserServer.Modules |
40 | { | 40 | { |
41 | public class UserServerAvatarAppearanceModule | 41 | public class UserServerAvatarAppearanceModule |
42 | { | 42 | { |
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
44 | 44 | ||
45 | private UserDataBaseService m_userDataBaseService; | 45 | private UserDataBaseService m_userDataBaseService; |
46 | private BaseHttpServer m_httpServer; | 46 | private BaseHttpServer m_httpServer; |
47 | 47 | ||
48 | public UserServerAvatarAppearanceModule(UserDataBaseService userDataBaseService) | 48 | public UserServerAvatarAppearanceModule(UserDataBaseService userDataBaseService) |
49 | { | 49 | { |
50 | m_userDataBaseService = userDataBaseService; | 50 | m_userDataBaseService = userDataBaseService; |
51 | } | 51 | } |
52 | 52 | ||
53 | public void Initialise() | 53 | public void Initialise() |
54 | { | 54 | { |
55 | 55 | ||
56 | } | 56 | } |
57 | 57 | ||
58 | public void PostInitialise() | 58 | public void PostInitialise() |
59 | { | 59 | { |
60 | 60 | ||
61 | } | 61 | } |
62 | 62 | ||
63 | public void RegisterHandlers(BaseHttpServer httpServer) | 63 | public void RegisterHandlers(BaseHttpServer httpServer) |
64 | { | 64 | { |
65 | m_httpServer = httpServer; | 65 | m_httpServer = httpServer; |
66 | 66 | ||
67 | m_httpServer.AddXmlRPCHandler("get_avatar_appearance", XmlRPCGetAvatarAppearance); | 67 | m_httpServer.AddXmlRPCHandler("get_avatar_appearance", XmlRPCGetAvatarAppearance); |
68 | m_httpServer.AddXmlRPCHandler("update_avatar_appearance", XmlRPCUpdateAvatarAppearance); | 68 | m_httpServer.AddXmlRPCHandler("update_avatar_appearance", XmlRPCUpdateAvatarAppearance); |
69 | } | 69 | } |
70 | 70 | ||
71 | public XmlRpcResponse XmlRPCGetAvatarAppearance(XmlRpcRequest request) | 71 | public XmlRpcResponse XmlRPCGetAvatarAppearance(XmlRpcRequest request) |
72 | { | 72 | { |
73 | XmlRpcResponse response = new XmlRpcResponse(); | 73 | XmlRpcResponse response = new XmlRpcResponse(); |
74 | Hashtable requestData = (Hashtable)request.Params[0]; | 74 | Hashtable requestData = (Hashtable)request.Params[0]; |
75 | AvatarAppearance appearance; | 75 | AvatarAppearance appearance; |
76 | Hashtable responseData; | 76 | Hashtable responseData; |
77 | if (requestData.Contains("owner")) | 77 | if (requestData.Contains("owner")) |
78 | { | 78 | { |
79 | appearance = m_userDataBaseService.GetUserAppearance(new UUID((string)requestData["owner"])); | 79 | appearance = m_userDataBaseService.GetUserAppearance(new UUID((string)requestData["owner"])); |
80 | if (appearance == null) | 80 | if (appearance == null) |
81 | { | 81 | { |
82 | responseData = new Hashtable(); | 82 | responseData = new Hashtable(); |
83 | responseData["error_type"] = "no appearance"; | 83 | responseData["error_type"] = "no appearance"; |
84 | responseData["error_desc"] = "There was no appearance found for this avatar"; | 84 | responseData["error_desc"] = "There was no appearance found for this avatar"; |
85 | } | 85 | } |
86 | else | 86 | else |
87 | { | 87 | { |
88 | responseData = appearance.ToHashTable(); | 88 | responseData = appearance.ToHashTable(); |
89 | } | 89 | } |
90 | } | 90 | } |
91 | else | 91 | else |
92 | { | 92 | { |
93 | responseData = new Hashtable(); | 93 | responseData = new Hashtable(); |
94 | responseData["error_type"] = "unknown_avatar"; | 94 | responseData["error_type"] = "unknown_avatar"; |
95 | responseData["error_desc"] = "The avatar appearance requested is not in the database"; | 95 | responseData["error_desc"] = "The avatar appearance requested is not in the database"; |
96 | } | 96 | } |
97 | 97 | ||
98 | response.Value = responseData; | 98 | response.Value = responseData; |
99 | return response; | 99 | return response; |
100 | } | 100 | } |
101 | 101 | ||
102 | public XmlRpcResponse XmlRPCUpdateAvatarAppearance(XmlRpcRequest request) | 102 | public XmlRpcResponse XmlRPCUpdateAvatarAppearance(XmlRpcRequest request) |
103 | { | 103 | { |
104 | XmlRpcResponse response = new XmlRpcResponse(); | 104 | XmlRpcResponse response = new XmlRpcResponse(); |
105 | Hashtable requestData = (Hashtable)request.Params[0]; | 105 | Hashtable requestData = (Hashtable)request.Params[0]; |
106 | Hashtable responseData; | 106 | Hashtable responseData; |
107 | if (requestData.Contains("owner")) | 107 | if (requestData.Contains("owner")) |
108 | { | 108 | { |
109 | AvatarAppearance appearance = new AvatarAppearance(requestData); | 109 | AvatarAppearance appearance = new AvatarAppearance(requestData); |
110 | m_userDataBaseService.UpdateUserAppearance(new UUID((string)requestData["owner"]), appearance); | 110 | m_userDataBaseService.UpdateUserAppearance(new UUID((string)requestData["owner"]), appearance); |
111 | responseData = new Hashtable(); | 111 | responseData = new Hashtable(); |
112 | responseData["returnString"] = "TRUE"; | 112 | responseData["returnString"] = "TRUE"; |
113 | } | 113 | } |
114 | else | 114 | else |
115 | { | 115 | { |
116 | responseData = new Hashtable(); | 116 | responseData = new Hashtable(); |
117 | responseData["error_type"] = "unknown_avatar"; | 117 | responseData["error_type"] = "unknown_avatar"; |
118 | responseData["error_desc"] = "The avatar appearance requested is not in the database"; | 118 | responseData["error_desc"] = "The avatar appearance requested is not in the database"; |
119 | } | 119 | } |
120 | response.Value = responseData; | 120 | response.Value = responseData; |
121 | return response; | 121 | return response; |
122 | } | 122 | } |
123 | } | 123 | } |
124 | } | 124 | } |
diff --git a/OpenSim/Grid/UserServer.Modules/UserServerFriendsModule.cs b/OpenSim/Grid/UserServer.Modules/UserServerFriendsModule.cs index fec2dc0..9711a4b 100644 --- a/OpenSim/Grid/UserServer.Modules/UserServerFriendsModule.cs +++ b/OpenSim/Grid/UserServer.Modules/UserServerFriendsModule.cs | |||
@@ -1,173 +1,173 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using log4net; | 32 | using log4net; |
33 | using Nwc.XmlRpc; | 33 | using Nwc.XmlRpc; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Communications; | 36 | using OpenSim.Framework.Communications; |
37 | using OpenSim.Framework.Servers; | 37 | using OpenSim.Framework.Servers; |
38 | 38 | ||
39 | namespace OpenSim.Grid.UserServer.Modules | 39 | namespace OpenSim.Grid.UserServer.Modules |
40 | { | 40 | { |
41 | public class UserServerFriendsModule | 41 | public class UserServerFriendsModule |
42 | { | 42 | { |
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
44 | 44 | ||
45 | private UserDataBaseService m_userDataBaseService; | 45 | private UserDataBaseService m_userDataBaseService; |
46 | 46 | ||
47 | private BaseHttpServer m_httpServer; | 47 | private BaseHttpServer m_httpServer; |
48 | 48 | ||
49 | public UserServerFriendsModule(UserDataBaseService userDataBaseService) | 49 | public UserServerFriendsModule(UserDataBaseService userDataBaseService) |
50 | { | 50 | { |
51 | m_userDataBaseService = userDataBaseService; | 51 | m_userDataBaseService = userDataBaseService; |
52 | } | 52 | } |
53 | 53 | ||
54 | public void Initialise() | 54 | public void Initialise() |
55 | { | 55 | { |
56 | 56 | ||
57 | } | 57 | } |
58 | 58 | ||
59 | public void PostInitialise() | 59 | public void PostInitialise() |
60 | { | 60 | { |
61 | 61 | ||
62 | } | 62 | } |
63 | 63 | ||
64 | public void RegisterHandlers(BaseHttpServer httpServer) | 64 | public void RegisterHandlers(BaseHttpServer httpServer) |
65 | { | 65 | { |
66 | m_httpServer = httpServer; | 66 | m_httpServer = httpServer; |
67 | 67 | ||
68 | m_httpServer.AddXmlRPCHandler("add_new_user_friend", XmlRpcResponseXmlRPCAddUserFriend); | 68 | m_httpServer.AddXmlRPCHandler("add_new_user_friend", XmlRpcResponseXmlRPCAddUserFriend); |
69 | m_httpServer.AddXmlRPCHandler("remove_user_friend", XmlRpcResponseXmlRPCRemoveUserFriend); | 69 | m_httpServer.AddXmlRPCHandler("remove_user_friend", XmlRpcResponseXmlRPCRemoveUserFriend); |
70 | m_httpServer.AddXmlRPCHandler("update_user_friend_perms", XmlRpcResponseXmlRPCUpdateUserFriendPerms); | 70 | m_httpServer.AddXmlRPCHandler("update_user_friend_perms", XmlRpcResponseXmlRPCUpdateUserFriendPerms); |
71 | m_httpServer.AddXmlRPCHandler("get_user_friend_list", XmlRpcResponseXmlRPCGetUserFriendList); | 71 | m_httpServer.AddXmlRPCHandler("get_user_friend_list", XmlRpcResponseXmlRPCGetUserFriendList); |
72 | } | 72 | } |
73 | 73 | ||
74 | public XmlRpcResponse FriendListItemListtoXmlRPCResponse(List<FriendListItem> returnUsers) | 74 | public XmlRpcResponse FriendListItemListtoXmlRPCResponse(List<FriendListItem> returnUsers) |
75 | { | 75 | { |
76 | XmlRpcResponse response = new XmlRpcResponse(); | 76 | XmlRpcResponse response = new XmlRpcResponse(); |
77 | Hashtable responseData = new Hashtable(); | 77 | Hashtable responseData = new Hashtable(); |
78 | // Query Result Information | 78 | // Query Result Information |
79 | 79 | ||
80 | responseData["avcount"] = returnUsers.Count.ToString(); | 80 | responseData["avcount"] = returnUsers.Count.ToString(); |
81 | 81 | ||
82 | for (int i = 0; i < returnUsers.Count; i++) | 82 | for (int i = 0; i < returnUsers.Count; i++) |
83 | { | 83 | { |
84 | responseData["ownerID" + i] = returnUsers[i].FriendListOwner.ToString(); | 84 | responseData["ownerID" + i] = returnUsers[i].FriendListOwner.ToString(); |
85 | responseData["friendID" + i] = returnUsers[i].Friend.ToString(); | 85 | responseData["friendID" + i] = returnUsers[i].Friend.ToString(); |
86 | responseData["ownerPerms" + i] = returnUsers[i].FriendListOwnerPerms.ToString(); | 86 | responseData["ownerPerms" + i] = returnUsers[i].FriendListOwnerPerms.ToString(); |
87 | responseData["friendPerms" + i] = returnUsers[i].FriendPerms.ToString(); | 87 | responseData["friendPerms" + i] = returnUsers[i].FriendPerms.ToString(); |
88 | } | 88 | } |
89 | response.Value = responseData; | 89 | response.Value = responseData; |
90 | 90 | ||
91 | return response; | 91 | return response; |
92 | } | 92 | } |
93 | 93 | ||
94 | public XmlRpcResponse XmlRpcResponseXmlRPCAddUserFriend(XmlRpcRequest request) | 94 | public XmlRpcResponse XmlRpcResponseXmlRPCAddUserFriend(XmlRpcRequest request) |
95 | { | 95 | { |
96 | XmlRpcResponse response = new XmlRpcResponse(); | 96 | XmlRpcResponse response = new XmlRpcResponse(); |
97 | Hashtable requestData = (Hashtable)request.Params[0]; | 97 | Hashtable requestData = (Hashtable)request.Params[0]; |
98 | Hashtable responseData = new Hashtable(); | 98 | Hashtable responseData = new Hashtable(); |
99 | string returnString = "FALSE"; | 99 | string returnString = "FALSE"; |
100 | // Query Result Information | 100 | // Query Result Information |
101 | 101 | ||
102 | if (requestData.Contains("ownerID") && requestData.Contains("friendID") && | 102 | if (requestData.Contains("ownerID") && requestData.Contains("friendID") && |
103 | requestData.Contains("friendPerms")) | 103 | requestData.Contains("friendPerms")) |
104 | { | 104 | { |
105 | // UserManagerBase.AddNewuserFriend | 105 | // UserManagerBase.AddNewuserFriend |
106 | m_userDataBaseService.AddNewUserFriend(new UUID((string)requestData["ownerID"]), | 106 | m_userDataBaseService.AddNewUserFriend(new UUID((string)requestData["ownerID"]), |
107 | new UUID((string)requestData["friendID"]), | 107 | new UUID((string)requestData["friendID"]), |
108 | (uint)Convert.ToInt32((string)requestData["friendPerms"])); | 108 | (uint)Convert.ToInt32((string)requestData["friendPerms"])); |
109 | returnString = "TRUE"; | 109 | returnString = "TRUE"; |
110 | } | 110 | } |
111 | responseData["returnString"] = returnString; | 111 | responseData["returnString"] = returnString; |
112 | response.Value = responseData; | 112 | response.Value = responseData; |
113 | return response; | 113 | return response; |
114 | } | 114 | } |
115 | 115 | ||
116 | public XmlRpcResponse XmlRpcResponseXmlRPCRemoveUserFriend(XmlRpcRequest request) | 116 | public XmlRpcResponse XmlRpcResponseXmlRPCRemoveUserFriend(XmlRpcRequest request) |
117 | { | 117 | { |
118 | XmlRpcResponse response = new XmlRpcResponse(); | 118 | XmlRpcResponse response = new XmlRpcResponse(); |
119 | Hashtable requestData = (Hashtable)request.Params[0]; | 119 | Hashtable requestData = (Hashtable)request.Params[0]; |
120 | Hashtable responseData = new Hashtable(); | 120 | Hashtable responseData = new Hashtable(); |
121 | string returnString = "FALSE"; | 121 | string returnString = "FALSE"; |
122 | // Query Result Information | 122 | // Query Result Information |
123 | 123 | ||
124 | if (requestData.Contains("ownerID") && requestData.Contains("friendID")) | 124 | if (requestData.Contains("ownerID") && requestData.Contains("friendID")) |
125 | { | 125 | { |
126 | // UserManagerBase.AddNewuserFriend | 126 | // UserManagerBase.AddNewuserFriend |
127 | m_userDataBaseService.RemoveUserFriend(new UUID((string)requestData["ownerID"]), | 127 | m_userDataBaseService.RemoveUserFriend(new UUID((string)requestData["ownerID"]), |
128 | new UUID((string)requestData["friendID"])); | 128 | new UUID((string)requestData["friendID"])); |
129 | returnString = "TRUE"; | 129 | returnString = "TRUE"; |
130 | } | 130 | } |
131 | responseData["returnString"] = returnString; | 131 | responseData["returnString"] = returnString; |
132 | response.Value = responseData; | 132 | response.Value = responseData; |
133 | return response; | 133 | return response; |
134 | } | 134 | } |
135 | 135 | ||
136 | public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserFriendPerms(XmlRpcRequest request) | 136 | public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserFriendPerms(XmlRpcRequest request) |
137 | { | 137 | { |
138 | XmlRpcResponse response = new XmlRpcResponse(); | 138 | XmlRpcResponse response = new XmlRpcResponse(); |
139 | Hashtable requestData = (Hashtable)request.Params[0]; | 139 | Hashtable requestData = (Hashtable)request.Params[0]; |
140 | Hashtable responseData = new Hashtable(); | 140 | Hashtable responseData = new Hashtable(); |
141 | string returnString = "FALSE"; | 141 | string returnString = "FALSE"; |
142 | 142 | ||
143 | if (requestData.Contains("ownerID") && requestData.Contains("friendID") && | 143 | if (requestData.Contains("ownerID") && requestData.Contains("friendID") && |
144 | requestData.Contains("friendPerms")) | 144 | requestData.Contains("friendPerms")) |
145 | { | 145 | { |
146 | m_userDataBaseService.UpdateUserFriendPerms(new UUID((string)requestData["ownerID"]), | 146 | m_userDataBaseService.UpdateUserFriendPerms(new UUID((string)requestData["ownerID"]), |
147 | new UUID((string)requestData["friendID"]), | 147 | new UUID((string)requestData["friendID"]), |
148 | (uint)Convert.ToInt32((string)requestData["friendPerms"])); | 148 | (uint)Convert.ToInt32((string)requestData["friendPerms"])); |
149 | // UserManagerBase. | 149 | // UserManagerBase. |
150 | returnString = "TRUE"; | 150 | returnString = "TRUE"; |
151 | } | 151 | } |
152 | responseData["returnString"] = returnString; | 152 | responseData["returnString"] = returnString; |
153 | response.Value = responseData; | 153 | response.Value = responseData; |
154 | return response; | 154 | return response; |
155 | } | 155 | } |
156 | 156 | ||
157 | public XmlRpcResponse XmlRpcResponseXmlRPCGetUserFriendList(XmlRpcRequest request) | 157 | public XmlRpcResponse XmlRpcResponseXmlRPCGetUserFriendList(XmlRpcRequest request) |
158 | { | 158 | { |
159 | // XmlRpcResponse response = new XmlRpcResponse(); | 159 | // XmlRpcResponse response = new XmlRpcResponse(); |
160 | Hashtable requestData = (Hashtable)request.Params[0]; | 160 | Hashtable requestData = (Hashtable)request.Params[0]; |
161 | // Hashtable responseData = new Hashtable(); | 161 | // Hashtable responseData = new Hashtable(); |
162 | 162 | ||
163 | List<FriendListItem> returndata = new List<FriendListItem>(); | 163 | List<FriendListItem> returndata = new List<FriendListItem>(); |
164 | 164 | ||
165 | if (requestData.Contains("ownerID")) | 165 | if (requestData.Contains("ownerID")) |
166 | { | 166 | { |
167 | returndata = m_userDataBaseService.GetUserFriendList(new UUID((string)requestData["ownerID"])); | 167 | returndata = m_userDataBaseService.GetUserFriendList(new UUID((string)requestData["ownerID"])); |
168 | } | 168 | } |
169 | 169 | ||
170 | return FriendListItemListtoXmlRPCResponse(returndata); | 170 | return FriendListItemListtoXmlRPCResponse(returndata); |
171 | } | 171 | } |
172 | } | 172 | } |
173 | } | 173 | } |
diff --git a/OpenSim/Grid/UserServer/UserServerCommandModule.cs b/OpenSim/Grid/UserServer/UserServerCommandModule.cs index 41a7eed..f35cfec 100644 --- a/OpenSim/Grid/UserServer/UserServerCommandModule.cs +++ b/OpenSim/Grid/UserServer/UserServerCommandModule.cs | |||
@@ -1,366 +1,366 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using log4net; | 32 | using log4net; |
33 | using log4net.Config; | 33 | using log4net.Config; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenSim.Data; | 35 | using OpenSim.Data; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Communications; | 37 | using OpenSim.Framework.Communications; |
38 | using OpenSim.Framework.Communications.Cache; | 38 | using OpenSim.Framework.Communications.Cache; |
39 | using OpenSim.Framework.Console; | 39 | using OpenSim.Framework.Console; |
40 | using OpenSim.Framework.Servers; | 40 | using OpenSim.Framework.Servers; |
41 | using OpenSim.Framework.Statistics; | 41 | using OpenSim.Framework.Statistics; |
42 | using OpenSim.Grid.Communications.OGS1; | 42 | using OpenSim.Grid.Communications.OGS1; |
43 | using OpenSim.Grid.Framework; | 43 | using OpenSim.Grid.Framework; |
44 | using OpenSim.Grid.UserServer.Modules; | 44 | using OpenSim.Grid.UserServer.Modules; |
45 | 45 | ||
46 | namespace OpenSim.Grid.UserServer | 46 | namespace OpenSim.Grid.UserServer |
47 | { | 47 | { |
48 | public class UserServerCommandModule | 48 | public class UserServerCommandModule |
49 | { | 49 | { |
50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | 51 | ||
52 | protected ConsoleBase m_console; | 52 | protected ConsoleBase m_console; |
53 | protected UserConfig m_cfg; | 53 | protected UserConfig m_cfg; |
54 | 54 | ||
55 | protected UserDataBaseService m_userDataBaseService; | 55 | protected UserDataBaseService m_userDataBaseService; |
56 | protected UserLoginService m_loginService; | 56 | protected UserLoginService m_loginService; |
57 | 57 | ||
58 | protected UUID m_lastCreatedUser = UUID.Random(); | 58 | protected UUID m_lastCreatedUser = UUID.Random(); |
59 | 59 | ||
60 | protected IUGAIMCore m_core; | 60 | protected IUGAIMCore m_core; |
61 | 61 | ||
62 | public UserServerCommandModule( UserLoginService loginService) | 62 | public UserServerCommandModule( UserLoginService loginService) |
63 | { | 63 | { |
64 | m_loginService = loginService; | 64 | m_loginService = loginService; |
65 | } | 65 | } |
66 | 66 | ||
67 | public void Initialise(IUGAIMCore core) | 67 | public void Initialise(IUGAIMCore core) |
68 | { | 68 | { |
69 | m_core = core; | 69 | m_core = core; |
70 | } | 70 | } |
71 | 71 | ||
72 | public void PostInitialise() | 72 | public void PostInitialise() |
73 | { | 73 | { |
74 | UserConfig cfg; | 74 | UserConfig cfg; |
75 | if (m_core.TryGet<UserConfig>(out cfg)) | 75 | if (m_core.TryGet<UserConfig>(out cfg)) |
76 | { | 76 | { |
77 | m_cfg = cfg; | 77 | m_cfg = cfg; |
78 | } | 78 | } |
79 | 79 | ||
80 | UserDataBaseService userDBservice; | 80 | UserDataBaseService userDBservice; |
81 | if (m_core.TryGet<UserDataBaseService>(out userDBservice)) | 81 | if (m_core.TryGet<UserDataBaseService>(out userDBservice)) |
82 | { | 82 | { |
83 | m_userDataBaseService = userDBservice; | 83 | m_userDataBaseService = userDBservice; |
84 | } | 84 | } |
85 | 85 | ||
86 | ConsoleBase console; | 86 | ConsoleBase console; |
87 | if ((m_core.TryGet<ConsoleBase>(out console)) && (m_cfg != null) && (m_userDataBaseService != null)) | 87 | if ((m_core.TryGet<ConsoleBase>(out console)) && (m_cfg != null) && (m_userDataBaseService != null)) |
88 | { | 88 | { |
89 | RegisterConsoleCommands(console); | 89 | RegisterConsoleCommands(console); |
90 | } | 90 | } |
91 | } | 91 | } |
92 | 92 | ||
93 | public void RegisterHandlers(BaseHttpServer httpServer) | 93 | public void RegisterHandlers(BaseHttpServer httpServer) |
94 | { | 94 | { |
95 | 95 | ||
96 | } | 96 | } |
97 | 97 | ||
98 | private void RegisterConsoleCommands(ConsoleBase console) | 98 | private void RegisterConsoleCommands(ConsoleBase console) |
99 | { | 99 | { |
100 | m_console = console; | 100 | m_console = console; |
101 | m_console.Commands.AddCommand("userserver", false, "create user", | 101 | m_console.Commands.AddCommand("userserver", false, "create user", |
102 | "create user [<first> [<last> [<x> <y> [email]]]]", | 102 | "create user [<first> [<last> [<x> <y> [email]]]]", |
103 | "Create a new user account", RunCommand); | 103 | "Create a new user account", RunCommand); |
104 | 104 | ||
105 | m_console.Commands.AddCommand("userserver", false, "reset user password", | 105 | m_console.Commands.AddCommand("userserver", false, "reset user password", |
106 | "reset user password [<first> [<last> [<new password>]]]", | 106 | "reset user password [<first> [<last> [<new password>]]]", |
107 | "Reset a user's password", RunCommand); | 107 | "Reset a user's password", RunCommand); |
108 | 108 | ||
109 | m_console.Commands.AddCommand("userserver", false, "login level", | 109 | m_console.Commands.AddCommand("userserver", false, "login level", |
110 | "login level <level>", | 110 | "login level <level>", |
111 | "Set the minimum user level to log in", HandleLoginCommand); | 111 | "Set the minimum user level to log in", HandleLoginCommand); |
112 | 112 | ||
113 | m_console.Commands.AddCommand("userserver", false, "login reset", | 113 | m_console.Commands.AddCommand("userserver", false, "login reset", |
114 | "login reset", | 114 | "login reset", |
115 | "Reset the login level to allow all users", | 115 | "Reset the login level to allow all users", |
116 | HandleLoginCommand); | 116 | HandleLoginCommand); |
117 | 117 | ||
118 | m_console.Commands.AddCommand("userserver", false, "login text", | 118 | m_console.Commands.AddCommand("userserver", false, "login text", |
119 | "login text <text>", | 119 | "login text <text>", |
120 | "Set the text users will see on login", HandleLoginCommand); | 120 | "Set the text users will see on login", HandleLoginCommand); |
121 | 121 | ||
122 | m_console.Commands.AddCommand("userserver", false, "test-inventory", | 122 | m_console.Commands.AddCommand("userserver", false, "test-inventory", |
123 | "test-inventory", | 123 | "test-inventory", |
124 | "Perform a test inventory transaction", RunCommand); | 124 | "Perform a test inventory transaction", RunCommand); |
125 | 125 | ||
126 | m_console.Commands.AddCommand("userserver", false, "logoff-user", | 126 | m_console.Commands.AddCommand("userserver", false, "logoff-user", |
127 | "logoff-user <first> <last> <message>", | 127 | "logoff-user <first> <last> <message>", |
128 | "Log off a named user", RunCommand); | 128 | "Log off a named user", RunCommand); |
129 | } | 129 | } |
130 | 130 | ||
131 | #region Console Command Handlers | 131 | #region Console Command Handlers |
132 | public void do_create(string[] args) | 132 | public void do_create(string[] args) |
133 | { | 133 | { |
134 | switch (args[0]) | 134 | switch (args[0]) |
135 | { | 135 | { |
136 | case "user": | 136 | case "user": |
137 | CreateUser(args); | 137 | CreateUser(args); |
138 | break; | 138 | break; |
139 | } | 139 | } |
140 | } | 140 | } |
141 | 141 | ||
142 | /// <summary> | 142 | /// <summary> |
143 | /// Execute switch for some of the reset commands | 143 | /// Execute switch for some of the reset commands |
144 | /// </summary> | 144 | /// </summary> |
145 | /// <param name="args"></param> | 145 | /// <param name="args"></param> |
146 | protected void Reset(string[] args) | 146 | protected void Reset(string[] args) |
147 | { | 147 | { |
148 | if (args.Length == 0) | 148 | if (args.Length == 0) |
149 | return; | 149 | return; |
150 | 150 | ||
151 | switch (args[0]) | 151 | switch (args[0]) |
152 | { | 152 | { |
153 | case "user": | 153 | case "user": |
154 | 154 | ||
155 | switch (args[1]) | 155 | switch (args[1]) |
156 | { | 156 | { |
157 | case "password": | 157 | case "password": |
158 | ResetUserPassword(args); | 158 | ResetUserPassword(args); |
159 | break; | 159 | break; |
160 | } | 160 | } |
161 | 161 | ||
162 | break; | 162 | break; |
163 | } | 163 | } |
164 | } | 164 | } |
165 | 165 | ||
166 | /// <summary> | 166 | /// <summary> |
167 | /// Create a new user | 167 | /// Create a new user |
168 | /// </summary> | 168 | /// </summary> |
169 | /// <param name="cmdparams">string array with parameters: firstname, lastname, password, locationX, locationY, email</param> | 169 | /// <param name="cmdparams">string array with parameters: firstname, lastname, password, locationX, locationY, email</param> |
170 | protected void CreateUser(string[] cmdparams) | 170 | protected void CreateUser(string[] cmdparams) |
171 | { | 171 | { |
172 | string firstName; | 172 | string firstName; |
173 | string lastName; | 173 | string lastName; |
174 | string password; | 174 | string password; |
175 | string email; | 175 | string email; |
176 | uint regX = 1000; | 176 | uint regX = 1000; |
177 | uint regY = 1000; | 177 | uint regY = 1000; |
178 | 178 | ||
179 | if (cmdparams.Length < 2) | 179 | if (cmdparams.Length < 2) |
180 | firstName = MainConsole.Instance.CmdPrompt("First name", "Default"); | 180 | firstName = MainConsole.Instance.CmdPrompt("First name", "Default"); |
181 | else firstName = cmdparams[1]; | 181 | else firstName = cmdparams[1]; |
182 | 182 | ||
183 | if (cmdparams.Length < 3) | 183 | if (cmdparams.Length < 3) |
184 | lastName = MainConsole.Instance.CmdPrompt("Last name", "User"); | 184 | lastName = MainConsole.Instance.CmdPrompt("Last name", "User"); |
185 | else lastName = cmdparams[2]; | 185 | else lastName = cmdparams[2]; |
186 | 186 | ||
187 | if (cmdparams.Length < 4) | 187 | if (cmdparams.Length < 4) |
188 | password = MainConsole.Instance.PasswdPrompt("Password"); | 188 | password = MainConsole.Instance.PasswdPrompt("Password"); |
189 | else password = cmdparams[3]; | 189 | else password = cmdparams[3]; |
190 | 190 | ||
191 | if (cmdparams.Length < 5) | 191 | if (cmdparams.Length < 5) |
192 | regX = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region X", regX.ToString())); | 192 | regX = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region X", regX.ToString())); |
193 | else regX = Convert.ToUInt32(cmdparams[4]); | 193 | else regX = Convert.ToUInt32(cmdparams[4]); |
194 | 194 | ||
195 | if (cmdparams.Length < 6) | 195 | if (cmdparams.Length < 6) |
196 | regY = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region Y", regY.ToString())); | 196 | regY = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region Y", regY.ToString())); |
197 | else regY = Convert.ToUInt32(cmdparams[5]); | 197 | else regY = Convert.ToUInt32(cmdparams[5]); |
198 | 198 | ||
199 | if (cmdparams.Length < 7) | 199 | if (cmdparams.Length < 7) |
200 | email = MainConsole.Instance.CmdPrompt("Email", ""); | 200 | email = MainConsole.Instance.CmdPrompt("Email", ""); |
201 | else email = cmdparams[6]; | 201 | else email = cmdparams[6]; |
202 | 202 | ||
203 | if (null == m_userDataBaseService.GetUserProfile(firstName, lastName)) | 203 | if (null == m_userDataBaseService.GetUserProfile(firstName, lastName)) |
204 | { | 204 | { |
205 | m_lastCreatedUser = m_userDataBaseService.AddUser(firstName, lastName, password, email, regX, regY); | 205 | m_lastCreatedUser = m_userDataBaseService.AddUser(firstName, lastName, password, email, regX, regY); |
206 | } | 206 | } |
207 | else | 207 | else |
208 | { | 208 | { |
209 | m_log.ErrorFormat("[USERS]: A user with the name {0} {1} already exists!", firstName, lastName); | 209 | m_log.ErrorFormat("[USERS]: A user with the name {0} {1} already exists!", firstName, lastName); |
210 | } | 210 | } |
211 | } | 211 | } |
212 | 212 | ||
213 | /// <summary> | 213 | /// <summary> |
214 | /// Reset a user password. | 214 | /// Reset a user password. |
215 | /// </summary> | 215 | /// </summary> |
216 | /// <param name="cmdparams"></param> | 216 | /// <param name="cmdparams"></param> |
217 | private void ResetUserPassword(string[] cmdparams) | 217 | private void ResetUserPassword(string[] cmdparams) |
218 | { | 218 | { |
219 | string firstName; | 219 | string firstName; |
220 | string lastName; | 220 | string lastName; |
221 | string newPassword; | 221 | string newPassword; |
222 | 222 | ||
223 | if (cmdparams.Length < 3) | 223 | if (cmdparams.Length < 3) |
224 | firstName = MainConsole.Instance.CmdPrompt("First name"); | 224 | firstName = MainConsole.Instance.CmdPrompt("First name"); |
225 | else firstName = cmdparams[2]; | 225 | else firstName = cmdparams[2]; |
226 | 226 | ||
227 | if (cmdparams.Length < 4) | 227 | if (cmdparams.Length < 4) |
228 | lastName = MainConsole.Instance.CmdPrompt("Last name"); | 228 | lastName = MainConsole.Instance.CmdPrompt("Last name"); |
229 | else lastName = cmdparams[3]; | 229 | else lastName = cmdparams[3]; |
230 | 230 | ||
231 | if (cmdparams.Length < 5) | 231 | if (cmdparams.Length < 5) |
232 | newPassword = MainConsole.Instance.PasswdPrompt("New password"); | 232 | newPassword = MainConsole.Instance.PasswdPrompt("New password"); |
233 | else newPassword = cmdparams[4]; | 233 | else newPassword = cmdparams[4]; |
234 | 234 | ||
235 | m_userDataBaseService.ResetUserPassword(firstName, lastName, newPassword); | 235 | m_userDataBaseService.ResetUserPassword(firstName, lastName, newPassword); |
236 | } | 236 | } |
237 | 237 | ||
238 | private void HandleTestCommand(string module, string[] cmd) | 238 | private void HandleTestCommand(string module, string[] cmd) |
239 | { | 239 | { |
240 | m_log.Info("test command received"); | 240 | m_log.Info("test command received"); |
241 | } | 241 | } |
242 | 242 | ||
243 | private void HandleLoginCommand(string module, string[] cmd) | 243 | private void HandleLoginCommand(string module, string[] cmd) |
244 | { | 244 | { |
245 | string subcommand = cmd[1]; | 245 | string subcommand = cmd[1]; |
246 | 246 | ||
247 | switch (subcommand) | 247 | switch (subcommand) |
248 | { | 248 | { |
249 | case "level": | 249 | case "level": |
250 | // Set the minimal level to allow login | 250 | // Set the minimal level to allow login |
251 | // Useful to allow grid update without worrying about users. | 251 | // Useful to allow grid update without worrying about users. |
252 | // or fixing critical issues | 252 | // or fixing critical issues |
253 | // | 253 | // |
254 | if (cmd.Length > 2) | 254 | if (cmd.Length > 2) |
255 | { | 255 | { |
256 | int level = Convert.ToInt32(cmd[2]); | 256 | int level = Convert.ToInt32(cmd[2]); |
257 | m_loginService.setloginlevel(level); | 257 | m_loginService.setloginlevel(level); |
258 | } | 258 | } |
259 | break; | 259 | break; |
260 | case "reset": | 260 | case "reset": |
261 | m_loginService.setloginlevel(0); | 261 | m_loginService.setloginlevel(0); |
262 | break; | 262 | break; |
263 | case "text": | 263 | case "text": |
264 | if (cmd.Length > 2) | 264 | if (cmd.Length > 2) |
265 | { | 265 | { |
266 | m_loginService.setwelcometext(cmd[2]); | 266 | m_loginService.setwelcometext(cmd[2]); |
267 | } | 267 | } |
268 | break; | 268 | break; |
269 | } | 269 | } |
270 | } | 270 | } |
271 | 271 | ||
272 | public void RunCommand(string module, string[] cmd) | 272 | public void RunCommand(string module, string[] cmd) |
273 | { | 273 | { |
274 | List<string> args = new List<string>(cmd); | 274 | List<string> args = new List<string>(cmd); |
275 | string command = cmd[0]; | 275 | string command = cmd[0]; |
276 | 276 | ||
277 | args.RemoveAt(0); | 277 | args.RemoveAt(0); |
278 | 278 | ||
279 | string[] cmdparams = args.ToArray(); | 279 | string[] cmdparams = args.ToArray(); |
280 | 280 | ||
281 | switch (command) | 281 | switch (command) |
282 | { | 282 | { |
283 | case "create": | 283 | case "create": |
284 | do_create(cmdparams); | 284 | do_create(cmdparams); |
285 | break; | 285 | break; |
286 | 286 | ||
287 | case "reset": | 287 | case "reset": |
288 | Reset(cmdparams); | 288 | Reset(cmdparams); |
289 | break; | 289 | break; |
290 | 290 | ||
291 | 291 | ||
292 | case "test-inventory": | 292 | case "test-inventory": |
293 | // RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>(); | 293 | // RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>(); |
294 | // requester.ReturnResponseVal = TestResponse; | 294 | // requester.ReturnResponseVal = TestResponse; |
295 | // requester.BeginPostObject<UUID>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser); | 295 | // requester.BeginPostObject<UUID>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser); |
296 | SynchronousRestObjectPoster.BeginPostObject<UUID, List<InventoryFolderBase>>( | 296 | SynchronousRestObjectPoster.BeginPostObject<UUID, List<InventoryFolderBase>>( |
297 | "POST", m_cfg.InventoryUrl + "RootFolders/", m_lastCreatedUser); | 297 | "POST", m_cfg.InventoryUrl + "RootFolders/", m_lastCreatedUser); |
298 | break; | 298 | break; |
299 | 299 | ||
300 | case "logoff-user": | 300 | case "logoff-user": |
301 | if (cmdparams.Length >= 3) | 301 | if (cmdparams.Length >= 3) |
302 | { | 302 | { |
303 | string firstname = cmdparams[0]; | 303 | string firstname = cmdparams[0]; |
304 | string lastname = cmdparams[1]; | 304 | string lastname = cmdparams[1]; |
305 | string message = ""; | 305 | string message = ""; |
306 | 306 | ||
307 | for (int i = 2; i < cmdparams.Length; i++) | 307 | for (int i = 2; i < cmdparams.Length; i++) |
308 | message += " " + cmdparams[i]; | 308 | message += " " + cmdparams[i]; |
309 | 309 | ||
310 | UserProfileData theUser = null; | 310 | UserProfileData theUser = null; |
311 | try | 311 | try |
312 | { | 312 | { |
313 | theUser = m_loginService.GetTheUser(firstname, lastname); | 313 | theUser = m_loginService.GetTheUser(firstname, lastname); |
314 | } | 314 | } |
315 | catch (Exception) | 315 | catch (Exception) |
316 | { | 316 | { |
317 | m_log.Error("[LOGOFF]: Error getting user data from the database."); | 317 | m_log.Error("[LOGOFF]: Error getting user data from the database."); |
318 | } | 318 | } |
319 | 319 | ||
320 | if (theUser != null) | 320 | if (theUser != null) |
321 | { | 321 | { |
322 | if (theUser.CurrentAgent != null) | 322 | if (theUser.CurrentAgent != null) |
323 | { | 323 | { |
324 | if (theUser.CurrentAgent.AgentOnline) | 324 | if (theUser.CurrentAgent.AgentOnline) |
325 | { | 325 | { |
326 | m_log.Info("[LOGOFF]: Logging off requested user!"); | 326 | m_log.Info("[LOGOFF]: Logging off requested user!"); |
327 | m_loginService.LogOffUser(theUser, message); | 327 | m_loginService.LogOffUser(theUser, message); |
328 | 328 | ||
329 | theUser.CurrentAgent.AgentOnline = false; | 329 | theUser.CurrentAgent.AgentOnline = false; |
330 | 330 | ||
331 | m_loginService.CommitAgent(ref theUser); | 331 | m_loginService.CommitAgent(ref theUser); |
332 | } | 332 | } |
333 | else | 333 | else |
334 | { | 334 | { |
335 | m_log.Info( | 335 | m_log.Info( |
336 | "[LOGOFF]: User Doesn't appear to be online, sending the logoff message anyway."); | 336 | "[LOGOFF]: User Doesn't appear to be online, sending the logoff message anyway."); |
337 | m_loginService.LogOffUser(theUser, message); | 337 | m_loginService.LogOffUser(theUser, message); |
338 | 338 | ||
339 | theUser.CurrentAgent.AgentOnline = false; | 339 | theUser.CurrentAgent.AgentOnline = false; |
340 | 340 | ||
341 | m_loginService.CommitAgent(ref theUser); | 341 | m_loginService.CommitAgent(ref theUser); |
342 | } | 342 | } |
343 | } | 343 | } |
344 | else | 344 | else |
345 | { | 345 | { |
346 | m_log.Error( | 346 | m_log.Error( |
347 | "[LOGOFF]: Unable to logoff-user. User doesn't have an agent record so I can't find the simulator to notify"); | 347 | "[LOGOFF]: Unable to logoff-user. User doesn't have an agent record so I can't find the simulator to notify"); |
348 | } | 348 | } |
349 | } | 349 | } |
350 | else | 350 | else |
351 | { | 351 | { |
352 | m_log.Info("[LOGOFF]: User doesn't exist in the database"); | 352 | m_log.Info("[LOGOFF]: User doesn't exist in the database"); |
353 | } | 353 | } |
354 | } | 354 | } |
355 | else | 355 | else |
356 | { | 356 | { |
357 | m_log.Error( | 357 | m_log.Error( |
358 | "[LOGOFF]: Invalid amount of parameters. logoff-user takes at least three. Firstname, Lastname, and message"); | 358 | "[LOGOFF]: Invalid amount of parameters. logoff-user takes at least three. Firstname, Lastname, and message"); |
359 | } | 359 | } |
360 | 360 | ||
361 | break; | 361 | break; |
362 | } | 362 | } |
363 | } | 363 | } |
364 | } | 364 | } |
365 | #endregion | 365 | #endregion |
366 | } | 366 | } |