diff options
author | Justin Clark-Casey (justincc) | 2009-09-07 18:26:53 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2009-09-07 18:26:53 +0100 |
commit | 116933bee5adfa4a3c1815fb7f3866bdaa584c41 (patch) | |
tree | b1aaf689ad7c9ef07e495e94d64f5978a1d5c9c3 /OpenSim | |
parent | T012_EstateSettingsRandomStorage() which wasn't being run because the method ... (diff) | |
parent | Merge branch 'master' of ssh://MyConnection/var/git/opensim (diff) | |
download | opensim-SC-116933bee5adfa4a3c1815fb7f3866bdaa584c41.zip opensim-SC-116933bee5adfa4a3c1815fb7f3866bdaa584c41.tar.gz opensim-SC-116933bee5adfa4a3c1815fb7f3866bdaa584c41.tar.bz2 opensim-SC-116933bee5adfa4a3c1815fb7f3866bdaa584c41.tar.xz |
Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim')
29 files changed, 1593 insertions, 345 deletions
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs index dff4d48..6fd3d30 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs | |||
@@ -94,14 +94,24 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
94 | regionLoader = new RegionLoaderWebServer(); | 94 | regionLoader = new RegionLoaderWebServer(); |
95 | } | 95 | } |
96 | 96 | ||
97 | m_log.Info("[LOADREGIONSPLUGIN]: Loading region configurations..."); | ||
98 | |||
97 | regionLoader.SetIniConfigSource(m_openSim.ConfigSource.Source); | 99 | regionLoader.SetIniConfigSource(m_openSim.ConfigSource.Source); |
98 | RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); | 100 | RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); |
99 | 101 | ||
102 | m_log.Info("[LOADREGIONSPLUGIN]: Loading specific shared modules..."); | ||
103 | m_log.Info("[LOADREGIONSPLUGIN]: DynamicTextureModule..."); | ||
100 | m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule()); | 104 | m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule()); |
105 | m_log.Info("[LOADREGIONSPLUGIN]: InstantMessageModule..."); | ||
101 | m_openSim.ModuleLoader.LoadDefaultSharedModule(new InstantMessageModule()); | 106 | m_openSim.ModuleLoader.LoadDefaultSharedModule(new InstantMessageModule()); |
107 | m_log.Info("[LOADREGIONSPLUGIN]: LoadImageURLModule..."); | ||
102 | m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule()); | 108 | m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule()); |
109 | m_log.Info("[LOADREGIONSPLUGIN]: XMLRPCModule..."); | ||
103 | m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule()); | 110 | m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule()); |
111 | m_log.Info("[LOADREGIONSPLUGIN]: AssetTransactionModule..."); | ||
104 | m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule()); | 112 | m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule()); |
113 | m_log.Info("[LOADREGIONSPLUGIN]: Done."); | ||
114 | |||
105 | if (!CheckRegionsForSanity(regionsToLoad)) | 115 | if (!CheckRegionsForSanity(regionsToLoad)) |
106 | { | 116 | { |
107 | m_log.Error("[LOADREGIONS]: Halting startup due to conflicts in region configurations"); | 117 | m_log.Error("[LOADREGIONS]: Halting startup due to conflicts in region configurations"); |
diff --git a/OpenSim/Data/IUserAccountData.cs b/OpenSim/Data/IUserAccountData.cs new file mode 100644 index 0000000..6bec188 --- /dev/null +++ b/OpenSim/Data/IUserAccountData.cs | |||
@@ -0,0 +1,55 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
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 | ||
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 | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | using OpenSim.Framework; | ||
32 | |||
33 | namespace OpenSim.Data | ||
34 | { | ||
35 | public class UserAccountData | ||
36 | { | ||
37 | public UUID PrincipalID; | ||
38 | public UUID ScopeID; | ||
39 | public Dictionary<string, object> Data; | ||
40 | } | ||
41 | |||
42 | /// <summary> | ||
43 | /// An interface for connecting to the authentication datastore | ||
44 | /// </summary> | ||
45 | public interface IUserAccountData | ||
46 | { | ||
47 | UserAccountData Get(UUID principalID, UUID ScopeID); | ||
48 | |||
49 | List<UserAccountData> Query(UUID principalID, UUID ScopeID, string query); | ||
50 | |||
51 | bool Store(UserAccountData data); | ||
52 | |||
53 | bool SetDataItem(UUID principalID, string item, string value); | ||
54 | } | ||
55 | } | ||
diff --git a/OpenSim/Data/MSSQL/MSSQLAuthenticationData.cs b/OpenSim/Data/MSSQL/MSSQLAuthenticationData.cs new file mode 100644 index 0000000..78fc22c --- /dev/null +++ b/OpenSim/Data/MSSQL/MSSQLAuthenticationData.cs | |||
@@ -0,0 +1,222 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ''AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
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 | ||
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 | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Data; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | using System.Data.SqlClient; | ||
35 | using System.Reflection; | ||
36 | using System.Text; | ||
37 | |||
38 | namespace OpenSim.Data.MSSQL | ||
39 | { | ||
40 | public class MSSQLAuthenticationData : IAuthenticationData | ||
41 | { | ||
42 | private string m_Realm; | ||
43 | private List<string> m_ColumnNames = null; | ||
44 | private int m_LastExpire = 0; | ||
45 | private string m_ConnectionString; | ||
46 | |||
47 | public MSSQLAuthenticationData(string connectionString, string realm) | ||
48 | { | ||
49 | m_Realm = realm; | ||
50 | m_ConnectionString = connectionString; | ||
51 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
52 | { | ||
53 | conn.Open(); | ||
54 | Migration m = new Migration(conn, GetType().Assembly, "AuthStore"); | ||
55 | m.Update(); | ||
56 | } | ||
57 | } | ||
58 | |||
59 | public AuthenticationData Get(UUID principalID) | ||
60 | { | ||
61 | AuthenticationData ret = new AuthenticationData(); | ||
62 | ret.Data = new Dictionary<string, object>(); | ||
63 | |||
64 | string sql = string.Format("select * from '{0}' where UUID = @principalID", m_Realm); | ||
65 | |||
66 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
67 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
68 | { | ||
69 | cmd.Parameters.AddWithValue("@principalID", principalID.ToString()); | ||
70 | conn.Open(); | ||
71 | using (SqlDataReader result = cmd.ExecuteReader()) | ||
72 | { | ||
73 | if (result.Read()) | ||
74 | { | ||
75 | ret.PrincipalID = principalID; | ||
76 | |||
77 | if (m_ColumnNames == null) | ||
78 | { | ||
79 | m_ColumnNames = new List<string>(); | ||
80 | |||
81 | DataTable schemaTable = result.GetSchemaTable(); | ||
82 | foreach (DataRow row in schemaTable.Rows) | ||
83 | m_ColumnNames.Add(row["ColumnName"].ToString()); | ||
84 | } | ||
85 | |||
86 | foreach (string s in m_ColumnNames) | ||
87 | { | ||
88 | if (s == "UUID") | ||
89 | continue; | ||
90 | |||
91 | ret.Data[s] = result[s].ToString(); | ||
92 | } | ||
93 | return ret; | ||
94 | } | ||
95 | } | ||
96 | } | ||
97 | return null; | ||
98 | } | ||
99 | |||
100 | public bool Store(AuthenticationData data) | ||
101 | { | ||
102 | if (data.Data.ContainsKey("UUID")) | ||
103 | data.Data.Remove("UUID"); | ||
104 | |||
105 | string[] fields = new List<string>(data.Data.Keys).ToArray(); | ||
106 | StringBuilder updateBuilder = new StringBuilder(); | ||
107 | |||
108 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
109 | using (SqlCommand cmd = new SqlCommand()) | ||
110 | { | ||
111 | updateBuilder.AppendFormat("update '{0}' set ", m_Realm); | ||
112 | |||
113 | bool first = true; | ||
114 | foreach (string field in fields) | ||
115 | { | ||
116 | if (!first) | ||
117 | updateBuilder.Append(", "); | ||
118 | updateBuilder.AppendFormat("'{0}' = @{0}",field); | ||
119 | |||
120 | first = false; | ||
121 | |||
122 | cmd.Parameters.AddWithValue("@" + field, data.Data[field]); | ||
123 | } | ||
124 | |||
125 | updateBuilder.Append(" where UUID = @principalID"); | ||
126 | |||
127 | cmd.CommandText = updateBuilder.ToString(); | ||
128 | cmd.Connection = conn; | ||
129 | |||
130 | cmd.Parameters.AddWithValue("@principalID", data.PrincipalID.ToString()); | ||
131 | conn.Open(); | ||
132 | if (cmd.ExecuteNonQuery() < 1) | ||
133 | { | ||
134 | StringBuilder insertBuilder = new StringBuilder(); | ||
135 | |||
136 | insertBuilder.AppendFormat("insert into '{0}' ('UUID', '", m_Realm); | ||
137 | insertBuilder.Append(String.Join("', '", fields)); | ||
138 | insertBuilder.Append("') values ( @principalID, @"); | ||
139 | insertBuilder.Append(String.Join(", @", fields)); | ||
140 | insertBuilder.Append(")"); | ||
141 | |||
142 | cmd.CommandText = insertBuilder.ToString(); | ||
143 | |||
144 | if (cmd.ExecuteNonQuery() < 1) | ||
145 | { | ||
146 | return false; | ||
147 | } | ||
148 | } | ||
149 | } | ||
150 | return true; | ||
151 | } | ||
152 | |||
153 | public bool SetDataItem(UUID principalID, string item, string value) | ||
154 | { | ||
155 | string sql = string.Format("update '{0}' set '{1}' = @{1} where UUID = @UUID", m_Realm, item); | ||
156 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
157 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
158 | { | ||
159 | cmd.Parameters.AddWithValue("@" + item, value); | ||
160 | cmd.Parameters.AddWithValue("@UUID", principalID.ToString()); | ||
161 | conn.Open(); | ||
162 | if (cmd.ExecuteNonQuery() > 0) | ||
163 | return true; | ||
164 | } | ||
165 | return false; | ||
166 | } | ||
167 | |||
168 | public bool SetToken(UUID principalID, string token, int lifetime) | ||
169 | { | ||
170 | if (System.Environment.TickCount - m_LastExpire > 30000) | ||
171 | DoExpire(); | ||
172 | string sql = "insert into tokens (UUID, token, validity) values (@principalID, @token, date_add(now(), interval @lifetime minute))"; | ||
173 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
174 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
175 | { | ||
176 | cmd.Parameters.AddWithValue("@principalID", principalID.ToString()); | ||
177 | cmd.Parameters.AddWithValue("@token", token); | ||
178 | cmd.Parameters.AddWithValue("@lifetime", lifetime.ToString()); | ||
179 | conn.Open(); | ||
180 | |||
181 | if (cmd.ExecuteNonQuery() > 0) | ||
182 | { | ||
183 | return true; | ||
184 | } | ||
185 | } | ||
186 | return false; | ||
187 | } | ||
188 | |||
189 | public bool CheckToken(UUID principalID, string token, int lifetime) | ||
190 | { | ||
191 | if (System.Environment.TickCount - m_LastExpire > 30000) | ||
192 | DoExpire(); | ||
193 | string sql = "update tokens set validity = date_add(now(), interval @lifetime minute) where UUID = @principalID and token = @token and validity > now()"; | ||
194 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
195 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
196 | { | ||
197 | cmd.Parameters.AddWithValue("@principalID", principalID.ToString()); | ||
198 | cmd.Parameters.AddWithValue("@token", token); | ||
199 | cmd.Parameters.AddWithValue("@lifetime", lifetime.ToString()); | ||
200 | conn.Open(); | ||
201 | |||
202 | if (cmd.ExecuteNonQuery() > 0) | ||
203 | { | ||
204 | return true; | ||
205 | } | ||
206 | } | ||
207 | return false; | ||
208 | } | ||
209 | |||
210 | private void DoExpire() | ||
211 | { | ||
212 | string sql = "delete from tokens where validity < now()"; | ||
213 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
214 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
215 | { | ||
216 | conn.Open(); | ||
217 | cmd.ExecuteNonQuery(); | ||
218 | } | ||
219 | m_LastExpire = System.Environment.TickCount; | ||
220 | } | ||
221 | } | ||
222 | } | ||
diff --git a/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs b/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs new file mode 100644 index 0000000..1520888 --- /dev/null +++ b/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs | |||
@@ -0,0 +1,186 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ''AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
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 | ||
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 | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Data; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | using System.Data.SqlClient; | ||
35 | using System.Text; | ||
36 | |||
37 | namespace OpenSim.Data.MSSQL | ||
38 | { | ||
39 | public class MSSQLUserAccountData : IUserAccountData | ||
40 | { | ||
41 | private string m_Realm; | ||
42 | private List<string> m_ColumnNames = null; | ||
43 | private int m_LastExpire = 0; | ||
44 | private string m_ConnectionString; | ||
45 | |||
46 | public MSSQLUserAccountData(string connectionString, string realm) | ||
47 | { | ||
48 | m_Realm = realm; | ||
49 | m_ConnectionString = connectionString; | ||
50 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
51 | { | ||
52 | conn.Open(); | ||
53 | Migration m = new Migration(conn, GetType().Assembly, "UserStore"); | ||
54 | m.Update(); | ||
55 | } | ||
56 | } | ||
57 | |||
58 | public List<UserAccountData> Query(UUID principalID, UUID scopeID, string query) | ||
59 | { | ||
60 | return null; | ||
61 | } | ||
62 | |||
63 | public UserAccountData Get(UUID principalID, UUID scopeID) | ||
64 | { | ||
65 | UserAccountData ret = new UserAccountData(); | ||
66 | ret.Data = new Dictionary<string, object>(); | ||
67 | |||
68 | string sql = string.Format("select * from '{0}' where UUID = @principalID", m_Realm); | ||
69 | if (scopeID != UUID.Zero) | ||
70 | sql += " and ScopeID = @scopeID"; | ||
71 | |||
72 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
73 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
74 | { | ||
75 | |||
76 | cmd.Parameters.AddWithValue("@principalID", principalID); | ||
77 | cmd.Parameters.AddWithValue("@scopeID", scopeID); | ||
78 | conn.Open(); | ||
79 | using (SqlDataReader result = cmd.ExecuteReader()) | ||
80 | { | ||
81 | if (result.Read()) | ||
82 | { | ||
83 | ret.PrincipalID = principalID; | ||
84 | UUID scope; | ||
85 | UUID.TryParse(result["ScopeID"].ToString(), out scope); | ||
86 | ret.ScopeID = scope; | ||
87 | |||
88 | if (m_ColumnNames == null) | ||
89 | { | ||
90 | m_ColumnNames = new List<string>(); | ||
91 | |||
92 | DataTable schemaTable = result.GetSchemaTable(); | ||
93 | foreach (DataRow row in schemaTable.Rows) | ||
94 | m_ColumnNames.Add(row["ColumnName"].ToString()); | ||
95 | } | ||
96 | |||
97 | foreach (string s in m_ColumnNames) | ||
98 | { | ||
99 | if (s == "UUID") | ||
100 | continue; | ||
101 | if (s == "ScopeID") | ||
102 | continue; | ||
103 | |||
104 | ret.Data[s] = result[s].ToString(); | ||
105 | } | ||
106 | return ret; | ||
107 | } | ||
108 | } | ||
109 | } | ||
110 | return null; | ||
111 | } | ||
112 | |||
113 | public bool Store(UserAccountData data) | ||
114 | { | ||
115 | if (data.Data.ContainsKey("UUID")) | ||
116 | data.Data.Remove("UUID"); | ||
117 | if (data.Data.ContainsKey("ScopeID")) | ||
118 | data.Data.Remove("ScopeID"); | ||
119 | |||
120 | string[] fields = new List<string>(data.Data.Keys).ToArray(); | ||
121 | |||
122 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
123 | using (SqlCommand cmd = new SqlCommand()) | ||
124 | { | ||
125 | StringBuilder updateBuilder = new StringBuilder(); | ||
126 | updateBuilder.AppendFormat("update '{0}' set ", m_Realm); | ||
127 | bool first = true; | ||
128 | foreach (string field in fields) | ||
129 | { | ||
130 | if (!first) | ||
131 | updateBuilder.Append(", "); | ||
132 | updateBuilder.AppendFormat("'{0}' = @{0}", field); | ||
133 | |||
134 | first = false; | ||
135 | |||
136 | cmd.Parameters.AddWithValue("@" + field, data.Data[field]); | ||
137 | } | ||
138 | |||
139 | updateBuilder.Append(" where UUID = @principalID"); | ||
140 | |||
141 | if (data.ScopeID != UUID.Zero) | ||
142 | updateBuilder.Append(" and ScopeID = @scopeID"); | ||
143 | |||
144 | cmd.CommandText = updateBuilder.ToString(); | ||
145 | cmd.Connection = conn; | ||
146 | cmd.Parameters.AddWithValue("@principalID", data.PrincipalID); | ||
147 | cmd.Parameters.AddWithValue("@scopeID", data.ScopeID); | ||
148 | conn.Open(); | ||
149 | |||
150 | if (cmd.ExecuteNonQuery() < 1) | ||
151 | { | ||
152 | StringBuilder insertBuilder = new StringBuilder(); | ||
153 | insertBuilder.AppendFormat("insert into '{0}' ('UUID', 'ScopeID', '", m_Realm); | ||
154 | insertBuilder.Append(String.Join("', '", fields)); | ||
155 | insertBuilder.Append("') values ( @principalID, @scopeID, @"); | ||
156 | insertBuilder.Append(String.Join(", @", fields)); | ||
157 | insertBuilder.Append(")"); | ||
158 | |||
159 | cmd.CommandText = insertBuilder.ToString(); | ||
160 | |||
161 | if (cmd.ExecuteNonQuery() < 1) | ||
162 | { | ||
163 | return false; | ||
164 | } | ||
165 | } | ||
166 | } | ||
167 | return true; | ||
168 | } | ||
169 | |||
170 | public bool SetDataItem(UUID principalID, string item, string value) | ||
171 | { | ||
172 | string sql = string.Format("update '{0}' set '{1}' = @{1} where UUID = @UUID", m_Realm, item); | ||
173 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
174 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
175 | { | ||
176 | cmd.Parameters.AddWithValue("@" + item, value); | ||
177 | cmd.Parameters.AddWithValue("@UUID", principalID); | ||
178 | conn.Open(); | ||
179 | |||
180 | if (cmd.ExecuteNonQuery() > 0) | ||
181 | return true; | ||
182 | } | ||
183 | return false; | ||
184 | } | ||
185 | } | ||
186 | } | ||
diff --git a/OpenSim/Data/MSSQL/Resources/011_UserStore.sql b/OpenSim/Data/MSSQL/Resources/011_UserStore.sql new file mode 100644 index 0000000..5aa064f --- /dev/null +++ b/OpenSim/Data/MSSQL/Resources/011_UserStore.sql | |||
@@ -0,0 +1,5 @@ | |||
1 | BEGIN TRANSACTION | ||
2 | |||
3 | ALTER TABLE users ADD scopeID uniqueidentifier not null default '00000000-0000-0000-0000-000000000000' | ||
4 | |||
5 | COMMIT | ||
diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs new file mode 100644 index 0000000..39d60ca --- /dev/null +++ b/OpenSim/Data/MySQL/MySQLUserAccountData.cs | |||
@@ -0,0 +1,180 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
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 | ||
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 | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Data; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | using MySql.Data.MySqlClient; | ||
35 | |||
36 | namespace OpenSim.Data.MySQL | ||
37 | { | ||
38 | public class MySqlUserAccountData : MySqlFramework, IUserAccountData | ||
39 | { | ||
40 | private string m_Realm; | ||
41 | private List<string> m_ColumnNames = null; | ||
42 | private int m_LastExpire = 0; | ||
43 | |||
44 | public MySqlUserAccountData(string connectionString, string realm) | ||
45 | : base(connectionString) | ||
46 | { | ||
47 | m_Realm = realm; | ||
48 | |||
49 | Migration m = new Migration(m_Connection, GetType().Assembly, "UserStore"); | ||
50 | m.Update(); | ||
51 | } | ||
52 | |||
53 | public List<UserAccountData> Query(UUID principalID, UUID scopeID, string query) | ||
54 | { | ||
55 | return null; | ||
56 | } | ||
57 | |||
58 | public UserAccountData Get(UUID principalID, UUID scopeID) | ||
59 | { | ||
60 | UserAccountData ret = new UserAccountData(); | ||
61 | ret.Data = new Dictionary<string, object>(); | ||
62 | |||
63 | string command = "select * from `"+m_Realm+"` where UUID = ?principalID"; | ||
64 | if (scopeID != UUID.Zero) | ||
65 | command += " and ScopeID = ?scopeID"; | ||
66 | |||
67 | MySqlCommand cmd = new MySqlCommand(command); | ||
68 | |||
69 | cmd.Parameters.AddWithValue("?principalID", principalID.ToString()); | ||
70 | cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); | ||
71 | |||
72 | IDataReader result = ExecuteReader(cmd); | ||
73 | |||
74 | if (result.Read()) | ||
75 | { | ||
76 | ret.PrincipalID = principalID; | ||
77 | UUID scope; | ||
78 | UUID.TryParse(result["ScopeID"].ToString(), out scope); | ||
79 | ret.ScopeID = scope; | ||
80 | |||
81 | if (m_ColumnNames == null) | ||
82 | { | ||
83 | m_ColumnNames = new List<string>(); | ||
84 | |||
85 | DataTable schemaTable = result.GetSchemaTable(); | ||
86 | foreach (DataRow row in schemaTable.Rows) | ||
87 | m_ColumnNames.Add(row["ColumnName"].ToString()); | ||
88 | } | ||
89 | |||
90 | foreach (string s in m_ColumnNames) | ||
91 | { | ||
92 | if (s == "UUID") | ||
93 | continue; | ||
94 | if (s == "ScopeID") | ||
95 | continue; | ||
96 | |||
97 | ret.Data[s] = result[s].ToString(); | ||
98 | } | ||
99 | |||
100 | result.Close(); | ||
101 | CloseReaderCommand(cmd); | ||
102 | |||
103 | return ret; | ||
104 | } | ||
105 | |||
106 | result.Close(); | ||
107 | CloseReaderCommand(cmd); | ||
108 | |||
109 | return null; | ||
110 | } | ||
111 | |||
112 | public bool Store(UserAccountData data) | ||
113 | { | ||
114 | if (data.Data.ContainsKey("UUID")) | ||
115 | data.Data.Remove("UUID"); | ||
116 | if (data.Data.ContainsKey("ScopeID")) | ||
117 | data.Data.Remove("ScopeID"); | ||
118 | |||
119 | string[] fields = new List<string>(data.Data.Keys).ToArray(); | ||
120 | |||
121 | MySqlCommand cmd = new MySqlCommand(); | ||
122 | |||
123 | string update = "update `"+m_Realm+"` set "; | ||
124 | bool first = true; | ||
125 | foreach (string field in fields) | ||
126 | { | ||
127 | if (!first) | ||
128 | update += ", "; | ||
129 | update += "`" + field + "` = ?"+field; | ||
130 | |||
131 | first = false; | ||
132 | |||
133 | cmd.Parameters.AddWithValue("?"+field, data.Data[field]); | ||
134 | } | ||
135 | |||
136 | update += " where UUID = ?principalID"; | ||
137 | |||
138 | if (data.ScopeID != UUID.Zero) | ||
139 | update += " and ScopeID = ?scopeID"; | ||
140 | |||
141 | cmd.CommandText = update; | ||
142 | cmd.Parameters.AddWithValue("?principalID", data.PrincipalID.ToString()); | ||
143 | cmd.Parameters.AddWithValue("?scopeID", data.ScopeID.ToString()); | ||
144 | |||
145 | if (ExecuteNonQuery(cmd) < 1) | ||
146 | { | ||
147 | string insert = "insert into `" + m_Realm + "` (`UUID`, `ScopeID`, `" + | ||
148 | String.Join("`, `", fields) + | ||
149 | "`) values ( ?principalID, ?scopeID, ?" + String.Join(", ?", fields) + ")"; | ||
150 | |||
151 | cmd.CommandText = insert; | ||
152 | |||
153 | if (ExecuteNonQuery(cmd) < 1) | ||
154 | { | ||
155 | cmd.Dispose(); | ||
156 | return false; | ||
157 | } | ||
158 | } | ||
159 | |||
160 | cmd.Dispose(); | ||
161 | |||
162 | return true; | ||
163 | } | ||
164 | |||
165 | public bool SetDataItem(UUID principalID, string item, string value) | ||
166 | { | ||
167 | MySqlCommand cmd = new MySqlCommand("update `" + m_Realm + | ||
168 | "` set `" + item + "` = ?" + item + " where UUID = ?UUID"); | ||
169 | |||
170 | |||
171 | cmd.Parameters.AddWithValue("?"+item, value); | ||
172 | cmd.Parameters.AddWithValue("?UUID", principalID.ToString()); | ||
173 | |||
174 | if (ExecuteNonQuery(cmd) > 0) | ||
175 | return true; | ||
176 | |||
177 | return false; | ||
178 | } | ||
179 | } | ||
180 | } | ||
diff --git a/OpenSim/Data/MySQL/Resources/008_UserStore.sql b/OpenSim/Data/MySQL/Resources/008_UserStore.sql new file mode 100644 index 0000000..4500bd5 --- /dev/null +++ b/OpenSim/Data/MySQL/Resources/008_UserStore.sql | |||
@@ -0,0 +1,5 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | ALTER TABLE users add scopeID char(36) not null default '00000000-0000-0000-0000-000000000000'; | ||
4 | |||
5 | COMMIT; | ||
diff --git a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs b/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs index 44f44fe..63e09ae 100644 --- a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs +++ b/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs | |||
@@ -78,6 +78,7 @@ namespace OpenSim.Framework.RegionLoader.Filesystem | |||
78 | 78 | ||
79 | foreach (IConfig config in source.Configs) | 79 | foreach (IConfig config in source.Configs) |
80 | { | 80 | { |
81 | //m_log.Info("[REGIONLOADERFILESYSTEM]: Creating RegionInfo for " + config.Name); | ||
81 | RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource, config.Name); | 82 | RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource, config.Name); |
82 | regionInfos.Add(regionInfo); | 83 | regionInfos.Add(regionInfo); |
83 | i++; | 84 | i++; |
diff --git a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs index 381070e..80f2e79 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs | |||
@@ -59,7 +59,7 @@ namespace OpenSim.Region.Communications.Hypergrid | |||
59 | HGUserServices userServices = new HGUserServices(this); | 59 | HGUserServices userServices = new HGUserServices(this); |
60 | // This plugin arrangement could eventually be configurable rather than hardcoded here. | 60 | // This plugin arrangement could eventually be configurable rather than hardcoded here. |
61 | userServices.AddPlugin(new TemporaryUserProfilePlugin()); | 61 | userServices.AddPlugin(new TemporaryUserProfilePlugin()); |
62 | userServices.AddPlugin(new OGS1UserDataPlugin(this)); | 62 | userServices.AddPlugin(new HGUserDataPlugin(this, userServices)); |
63 | 63 | ||
64 | m_userService = userServices; | 64 | m_userService = userServices; |
65 | m_messageService = userServices; | 65 | m_messageService = userServices; |
diff --git a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs index 568437d..e4e12d4 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs | |||
@@ -57,7 +57,7 @@ namespace OpenSim.Region.Communications.Hypergrid | |||
57 | HGUserServices hgUserService = new HGUserServices(this, localUserService); | 57 | HGUserServices hgUserService = new HGUserServices(this, localUserService); |
58 | // This plugin arrangement could eventually be configurable rather than hardcoded here. | 58 | // This plugin arrangement could eventually be configurable rather than hardcoded here. |
59 | hgUserService.AddPlugin(new TemporaryUserProfilePlugin()); | 59 | hgUserService.AddPlugin(new TemporaryUserProfilePlugin()); |
60 | hgUserService.AddPlugin(new OGS1UserDataPlugin(this)); | 60 | hgUserService.AddPlugin(new HGUserDataPlugin(this, hgUserService)); |
61 | 61 | ||
62 | m_userService = hgUserService; | 62 | m_userService = hgUserService; |
63 | m_userAdminService = hgUserService; | 63 | m_userAdminService = hgUserService; |
diff --git a/OpenSim/Region/Communications/Hypergrid/HGUserDataPlugin.cs b/OpenSim/Region/Communications/Hypergrid/HGUserDataPlugin.cs new file mode 100644 index 0000000..4b8fc26 --- /dev/null +++ b/OpenSim/Region/Communications/Hypergrid/HGUserDataPlugin.cs | |||
@@ -0,0 +1,72 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
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 | ||
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 | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Net; | ||
32 | using System.Reflection; | ||
33 | using System.Text.RegularExpressions; | ||
34 | using System.Xml.Serialization; | ||
35 | using log4net; | ||
36 | using Nwc.XmlRpc; | ||
37 | using OpenMetaverse; | ||
38 | using OpenSim.Data; | ||
39 | using OpenSim.Framework; | ||
40 | using OpenSim.Framework.Communications; | ||
41 | using OpenSim.Framework.Communications.Clients; | ||
42 | using OpenSim.Region.Communications.OGS1; | ||
43 | |||
44 | namespace OpenSim.Region.Communications.Hypergrid | ||
45 | { | ||
46 | public class HGUserDataPlugin : OGS1UserDataPlugin | ||
47 | { | ||
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
49 | |||
50 | HGUserServices m_UserServices; | ||
51 | |||
52 | public HGUserDataPlugin() | ||
53 | { | ||
54 | } | ||
55 | |||
56 | public HGUserDataPlugin(CommunicationsManager commsManager, HGUserServices userServices) | ||
57 | { | ||
58 | m_log.DebugFormat("[HG USER SERVICES]: {0} initialized", Name); | ||
59 | m_commsManager = commsManager; | ||
60 | m_UserServices = userServices; | ||
61 | } | ||
62 | |||
63 | protected override string GetUserServerURL(UUID userID) | ||
64 | { | ||
65 | string url = string.Empty; | ||
66 | if (m_UserServices.IsForeignUser(userID, out url)) | ||
67 | return url; | ||
68 | return m_commsManager.NetworkServersInfo.UserURL; | ||
69 | } | ||
70 | |||
71 | } | ||
72 | } | ||
diff --git a/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs b/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs index 68a9076..f1a56ef 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs | |||
@@ -311,9 +311,9 @@ namespace OpenSim.Region.Communications.Hypergrid | |||
311 | return m_commsManager.NetworkServersInfo.UserURL; | 311 | return m_commsManager.NetworkServersInfo.UserURL; |
312 | } | 312 | } |
313 | 313 | ||
314 | private bool IsForeignUser(UUID userID, out string userServerURL) | 314 | public bool IsForeignUser(UUID userID, out string userServerURL) |
315 | { | 315 | { |
316 | userServerURL = string.Empty; | 316 | userServerURL = m_commsManager.NetworkServersInfo.UserURL; |
317 | CachedUserInfo uinfo = m_commsManager.UserProfileCacheService.GetUserDetails(userID); | 317 | CachedUserInfo uinfo = m_commsManager.UserProfileCacheService.GetUserDetails(userID); |
318 | if (uinfo != null) | 318 | if (uinfo != null) |
319 | { | 319 | { |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs b/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs index 9f234be..ec8512a 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs | |||
@@ -48,6 +48,10 @@ namespace OpenSim.Region.Communications.OGS1 | |||
48 | 48 | ||
49 | protected CommunicationsManager m_commsManager; | 49 | protected CommunicationsManager m_commsManager; |
50 | 50 | ||
51 | public OGS1UserDataPlugin() | ||
52 | { | ||
53 | } | ||
54 | |||
51 | public OGS1UserDataPlugin(CommunicationsManager commsManager) | 55 | public OGS1UserDataPlugin(CommunicationsManager commsManager) |
52 | { | 56 | { |
53 | m_log.DebugFormat("[OGS1 USER SERVICES]: {0} initialized", Name); | 57 | m_log.DebugFormat("[OGS1 USER SERVICES]: {0} initialized", Name); |
@@ -108,7 +112,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
108 | parameters.Add(param); | 112 | parameters.Add(param); |
109 | XmlRpcRequest req = new XmlRpcRequest("get_agent_by_uuid", parameters); | 113 | XmlRpcRequest req = new XmlRpcRequest("get_agent_by_uuid", parameters); |
110 | 114 | ||
111 | XmlRpcResponse resp = req.Send(GetUserServerURL(userId), 6000); | 115 | XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 6000); |
112 | Hashtable respData = (Hashtable)resp.Value; | 116 | Hashtable respData = (Hashtable)resp.Value; |
113 | if (respData.Contains("error_type")) | 117 | if (respData.Contains("error_type")) |
114 | { | 118 | { |
@@ -603,7 +607,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
603 | { | 607 | { |
604 | if ((string)respData["returnString"] == "TRUE") | 608 | if ((string)respData["returnString"] == "TRUE") |
605 | { | 609 | { |
606 | 610 | m_log.DebugFormat("[OGS1 USER SERVICES]: Updated user appearance in {0}", GetUserServerURL(user)); | |
607 | } | 611 | } |
608 | else | 612 | else |
609 | { | 613 | { |
@@ -622,8 +626,8 @@ namespace OpenSim.Region.Communications.OGS1 | |||
622 | } | 626 | } |
623 | catch (WebException e) | 627 | catch (WebException e) |
624 | { | 628 | { |
625 | m_log.Warn("[OGS1 USER SERVICES]: Error when trying to update Avatar's appearance: " + | 629 | m_log.WarnFormat("[OGS1 USER SERVICES]: Error when trying to update Avatar's appearance in {0}: {1}", |
626 | e.Message); | 630 | GetUserServerURL(user), e.Message); |
627 | // Return Empty list (no friends) | 631 | // Return Empty list (no friends) |
628 | } | 632 | } |
629 | } | 633 | } |
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs index a5894c6..613dbe9 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs | |||
@@ -34,6 +34,7 @@ using System.Text.RegularExpressions; | |||
34 | using log4net; | 34 | using log4net; |
35 | using Nini.Config; | 35 | using Nini.Config; |
36 | using OpenMetaverse; | 36 | using OpenMetaverse; |
37 | using Nwc.XmlRpc; | ||
37 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Communications; | 39 | using OpenSim.Framework.Communications; |
39 | using OpenSim.Framework.Communications.Services; | 40 | using OpenSim.Framework.Communications.Services; |
@@ -115,6 +116,8 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
115 | 116 | ||
116 | httpServer.AddXmlRPCHandler("hg_login", m_loginService.XmlRpcLoginMethod); | 117 | httpServer.AddXmlRPCHandler("hg_login", m_loginService.XmlRpcLoginMethod); |
117 | httpServer.AddXmlRPCHandler("check_auth_session", m_loginService.XmlRPCCheckAuthSession, false); | 118 | httpServer.AddXmlRPCHandler("check_auth_session", m_loginService.XmlRPCCheckAuthSession, false); |
119 | httpServer.AddXmlRPCHandler("get_avatar_appearance", XmlRPCGetAvatarAppearance); | ||
120 | httpServer.AddXmlRPCHandler("update_avatar_appearance", XmlRPCUpdateAvatarAppearance); | ||
118 | 121 | ||
119 | } | 122 | } |
120 | } | 123 | } |
@@ -256,5 +259,64 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
256 | scene = null; | 259 | scene = null; |
257 | return false; | 260 | return false; |
258 | } | 261 | } |
262 | |||
263 | public XmlRpcResponse XmlRPCGetAvatarAppearance(XmlRpcRequest request, IPEndPoint remoteClient) | ||
264 | { | ||
265 | XmlRpcResponse response = new XmlRpcResponse(); | ||
266 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
267 | AvatarAppearance appearance; | ||
268 | Hashtable responseData; | ||
269 | if (requestData.Contains("owner")) | ||
270 | { | ||
271 | appearance = m_firstScene.CommsManager.AvatarService.GetUserAppearance(new UUID((string)requestData["owner"])); | ||
272 | if (appearance == null) | ||
273 | { | ||
274 | responseData = new Hashtable(); | ||
275 | responseData["error_type"] = "no appearance"; | ||
276 | responseData["error_desc"] = "There was no appearance found for this avatar"; | ||
277 | } | ||
278 | else | ||
279 | { | ||
280 | responseData = appearance.ToHashTable(); | ||
281 | } | ||
282 | } | ||
283 | else | ||
284 | { | ||
285 | responseData = new Hashtable(); | ||
286 | responseData["error_type"] = "unknown_avatar"; | ||
287 | responseData["error_desc"] = "The avatar appearance requested is not in the database"; | ||
288 | } | ||
289 | |||
290 | response.Value = responseData; | ||
291 | return response; | ||
292 | } | ||
293 | |||
294 | public XmlRpcResponse XmlRPCUpdateAvatarAppearance(XmlRpcRequest request, IPEndPoint remoteClient) | ||
295 | { | ||
296 | XmlRpcResponse response = new XmlRpcResponse(); | ||
297 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
298 | Hashtable responseData; | ||
299 | if (requestData.Contains("owner")) | ||
300 | { | ||
301 | AvatarAppearance appearance = new AvatarAppearance(requestData); | ||
302 | |||
303 | // TODO: Sometime in the future we may have a database layer that is capable of updating appearance when | ||
304 | // the TextureEntry is null. When that happens, this check can be removed | ||
305 | if (appearance.Texture != null) | ||
306 | m_firstScene.CommsManager.AvatarService.UpdateUserAppearance(new UUID((string)requestData["owner"]), appearance); | ||
307 | |||
308 | responseData = new Hashtable(); | ||
309 | responseData["returnString"] = "TRUE"; | ||
310 | } | ||
311 | else | ||
312 | { | ||
313 | responseData = new Hashtable(); | ||
314 | responseData["error_type"] = "unknown_avatar"; | ||
315 | responseData["error_desc"] = "The avatar appearance requested is not in the database"; | ||
316 | } | ||
317 | response.Value = responseData; | ||
318 | return response; | ||
319 | } | ||
259 | } | 320 | } |
321 | |||
260 | } | 322 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserServiceConnector.cs index fcd0304..cca5bb4 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserServiceConnector.cs | |||
@@ -42,7 +42,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User | |||
42 | LogManager.GetLogger( | 42 | LogManager.GetLogger( |
43 | MethodBase.GetCurrentMethod().DeclaringType); | 43 | MethodBase.GetCurrentMethod().DeclaringType); |
44 | 44 | ||
45 | private IUserAccountDataService m_UserService; | 45 | private IUserAccountService m_UserService; |
46 | 46 | ||
47 | private bool m_Enabled = false; | 47 | private bool m_Enabled = false; |
48 | 48 | ||
@@ -82,7 +82,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User | |||
82 | 82 | ||
83 | Object[] args = new Object[] { source }; | 83 | Object[] args = new Object[] { source }; |
84 | m_UserService = | 84 | m_UserService = |
85 | ServerUtils.LoadPlugin<IUserAccountDataService>(serviceDll, | 85 | ServerUtils.LoadPlugin<IUserAccountService>(serviceDll, |
86 | args); | 86 | args); |
87 | 87 | ||
88 | if (m_UserService == null) | 88 | if (m_UserService == null) |
@@ -113,7 +113,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User | |||
113 | if (!m_Enabled) | 113 | if (!m_Enabled) |
114 | return; | 114 | return; |
115 | 115 | ||
116 | scene.RegisterModuleInterface<IUserAccountDataService>(m_UserService); | 116 | scene.RegisterModuleInterface<IUserAccountService>(m_UserService); |
117 | } | 117 | } |
118 | 118 | ||
119 | public void RemoveRegion(Scene scene) | 119 | public void RemoveRegion(Scene scene) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserServiceConnector.cs index a2b854b..cef9129 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserServiceConnector.cs | |||
@@ -37,7 +37,7 @@ using OpenSim.Services.Connectors; | |||
37 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User | 37 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User |
38 | { | 38 | { |
39 | public class RemoteUserServicesConnector : UserServicesConnector, | 39 | public class RemoteUserServicesConnector : UserServicesConnector, |
40 | ISharedRegionModule, IUserAccountDataService | 40 | ISharedRegionModule, IUserAccountService |
41 | { | 41 | { |
42 | private static readonly ILog m_log = | 42 | private static readonly ILog m_log = |
43 | LogManager.GetLogger( | 43 | LogManager.GetLogger( |
@@ -96,7 +96,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User | |||
96 | if (!m_Enabled) | 96 | if (!m_Enabled) |
97 | return; | 97 | return; |
98 | 98 | ||
99 | scene.RegisterModuleInterface<IUserAccountDataService>(this); | 99 | scene.RegisterModuleInterface<IUserAccountService>(this); |
100 | } | 100 | } |
101 | 101 | ||
102 | public void RemoveRegion(Scene scene) | 102 | public void RemoveRegion(Scene scene) |
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs index 5c5f164..9da869c 100644 --- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs | |||
@@ -32,6 +32,7 @@ using log4net; | |||
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Client; | ||
35 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
36 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
37 | 38 | ||
@@ -71,6 +72,18 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
71 | public void AddRegion(Scene scene) | 72 | public void AddRegion(Scene scene) |
72 | { | 73 | { |
73 | 74 | ||
75 | |||
76 | |||
77 | } | ||
78 | |||
79 | public void RemoveRegion(Scene scene) | ||
80 | { | ||
81 | |||
82 | |||
83 | } | ||
84 | |||
85 | public void RegionLoaded(Scene scene) | ||
86 | { | ||
74 | if (!enabledYN) | 87 | if (!enabledYN) |
75 | return; | 88 | return; |
76 | 89 | ||
@@ -295,8 +308,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
295 | m_log.DebugFormat("Scene: {0} to the west of Scene{1} Offset: {2}. Extents:{3}", | 308 | m_log.DebugFormat("Scene: {0} to the west of Scene{1} Offset: {2}. Extents:{3}", |
296 | conn.RegionScene.RegionInfo.RegionName, | 309 | conn.RegionScene.RegionInfo.RegionName, |
297 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); | 310 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); |
298 | 311 | ||
299 | 312 | ||
300 | scene.BordersLocked = true; | 313 | scene.BordersLocked = true; |
301 | conn.RegionScene.BordersLocked = true; | 314 | conn.RegionScene.BordersLocked = true; |
302 | 315 | ||
@@ -325,9 +338,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
325 | // | 338 | // |
326 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); | 339 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); |
327 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); | 340 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); |
328 | 341 | ||
329 | conn.RegionScene.BordersLocked = false; | 342 | conn.RegionScene.BordersLocked = false; |
330 | scene.BordersLocked = false; | 343 | scene.BordersLocked = false; |
344 | if (conn.ClientEventForwarder != null) | ||
345 | conn.ClientEventForwarder.AddSceneToEventForwarding(scene); | ||
331 | connectedYN = true; | 346 | connectedYN = true; |
332 | break; | 347 | break; |
333 | } | 348 | } |
@@ -367,7 +382,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
367 | m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}", | 382 | m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}", |
368 | conn.RegionScene.RegionInfo.RegionName, | 383 | conn.RegionScene.RegionInfo.RegionName, |
369 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); | 384 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); |
370 | conn.RegionScene.PhysicsScene.Combine(null,Vector3.Zero,extents); | 385 | conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); |
371 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); | 386 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); |
372 | 387 | ||
373 | lock (conn.RegionScene.NorthBorders) | 388 | lock (conn.RegionScene.NorthBorders) |
@@ -386,7 +401,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
386 | 401 | ||
387 | scene.BordersLocked = false; | 402 | scene.BordersLocked = false; |
388 | conn.RegionScene.BordersLocked = false; | 403 | conn.RegionScene.BordersLocked = false; |
389 | 404 | if (conn.ClientEventForwarder != null) | |
405 | conn.ClientEventForwarder.AddSceneToEventForwarding(scene); | ||
390 | connectedYN = true; | 406 | connectedYN = true; |
391 | break; | 407 | break; |
392 | } | 408 | } |
@@ -424,52 +440,52 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
424 | m_log.DebugFormat("Scene: {0} to the NorthEast of Scene{1} Offset: {2}. Extents:{3}", | 440 | m_log.DebugFormat("Scene: {0} to the NorthEast of Scene{1} Offset: {2}. Extents:{3}", |
425 | conn.RegionScene.RegionInfo.RegionName, | 441 | conn.RegionScene.RegionInfo.RegionName, |
426 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); | 442 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); |
427 | 443 | ||
428 | conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); | 444 | conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); |
429 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); | 445 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); |
430 | lock (conn.RegionScene.NorthBorders) | 446 | lock (conn.RegionScene.NorthBorders) |
431 | if (conn.RegionScene.NorthBorders.Count == 1)// && 2) | 447 | if (conn.RegionScene.NorthBorders.Count == 1)// && 2) |
432 | { | 448 | { |
433 | //compound border | 449 | //compound border |
434 | // already locked above | 450 | // already locked above |
435 | conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; | 451 | conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; |
436 | 452 | ||
437 | lock (conn.RegionScene.EastBorders) | 453 | lock (conn.RegionScene.EastBorders) |
438 | conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; | 454 | conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; |
439 | lock (conn.RegionScene.WestBorders) | 455 | lock (conn.RegionScene.WestBorders) |
440 | conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; | 456 | conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; |
441 | 457 | ||
442 | |||
443 | 458 | ||
444 | } | 459 | |
460 | } | ||
445 | lock (scene.SouthBorders) | 461 | lock (scene.SouthBorders) |
446 | scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south | 462 | scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south |
447 | 463 | ||
448 | lock (conn.RegionScene.EastBorders) | 464 | lock (conn.RegionScene.EastBorders) |
449 | if (conn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2) | 465 | if (conn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2) |
450 | { | 466 | { |
451 | 467 | ||
452 | conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize; | 468 | conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize; |
453 | lock (conn.RegionScene.NorthBorders) | 469 | lock (conn.RegionScene.NorthBorders) |
454 | conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize; | 470 | conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize; |
455 | lock (conn.RegionScene.SouthBorders) | 471 | lock (conn.RegionScene.SouthBorders) |
456 | conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize; | 472 | conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize; |
457 | 473 | ||
458 | 474 | ||
459 | } | 475 | } |
460 | 476 | ||
461 | lock (scene.WestBorders) | 477 | lock (scene.WestBorders) |
462 | scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West | 478 | scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West |
463 | /* | 479 | /* |
464 | else | 480 | else |
465 | { | 481 | { |
466 | conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; | 482 | conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; |
467 | conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; | 483 | conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; |
468 | conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; | 484 | conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; |
469 | scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south | 485 | scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south |
470 | } | 486 | } |
471 | */ | 487 | */ |
472 | 488 | ||
473 | 489 | ||
474 | // Reset Terrain.. since terrain normally loads first. | 490 | // Reset Terrain.. since terrain normally loads first. |
475 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); | 491 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); |
@@ -478,6 +494,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
478 | scene.BordersLocked = false; | 494 | scene.BordersLocked = false; |
479 | conn.RegionScene.BordersLocked = false; | 495 | conn.RegionScene.BordersLocked = false; |
480 | 496 | ||
497 | if (conn.ClientEventForwarder != null) | ||
498 | conn.ClientEventForwarder.AddSceneToEventForwarding(scene); | ||
499 | |||
481 | connectedYN = true; | 500 | connectedYN = true; |
482 | 501 | ||
483 | //scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents); | 502 | //scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents); |
@@ -495,7 +514,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
495 | rdata.RegionScene = scene; | 514 | rdata.RegionScene = scene; |
496 | regionConnections.RegionLandChannel = scene.LandChannel; | 515 | regionConnections.RegionLandChannel = scene.LandChannel; |
497 | 516 | ||
498 | RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata,scene.LandChannel,regionConnections.ConnectedRegions); | 517 | RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata, scene.LandChannel, |
518 | regionConnections.ConnectedRegions); | ||
499 | scene.LandChannel = lnd; | 519 | scene.LandChannel = lnd; |
500 | lock (m_regions) | 520 | lock (m_regions) |
501 | { | 521 | { |
@@ -504,24 +524,157 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
504 | ForwardPermissionRequests(regionConnections, r.RegionScene); | 524 | ForwardPermissionRequests(regionConnections, r.RegionScene); |
505 | } | 525 | } |
506 | } | 526 | } |
507 | 527 | ||
508 | m_regions.Add(scene.RegionInfo.originRegionID,regionConnections); | 528 | regionConnections.ClientEventForwarder = new RegionCombinerClientEventForwarder(regionConnections); |
529 | scene.EventManager.OnNewPresence += SetCourseLocationDelegate; | ||
530 | m_regions.Add(scene.RegionInfo.originRegionID, regionConnections); | ||
531 | |||
509 | } | 532 | } |
510 | 533 | ||
511 | } | 534 | } |
512 | AdjustLargeRegionBounds(); | 535 | AdjustLargeRegionBounds(); |
513 | |||
514 | } | 536 | } |
515 | 537 | ||
516 | public void RemoveRegion(Scene scene) | 538 | private void SetCourseLocationDelegate(ScenePresence presence) |
517 | { | 539 | { |
518 | 540 | presence.SetSendCourseLocationMethod(SendCourseLocationUpdates); | |
519 | |||
520 | } | 541 | } |
521 | 542 | ||
522 | public void RegionLoaded(Scene scene) | 543 | private void SendCourseLocationUpdates(UUID sceneId, ScenePresence presence) |
523 | { | 544 | { |
545 | RegionConnections connectiondata = null; | ||
546 | lock (m_regions) | ||
547 | { | ||
548 | if (m_regions.ContainsKey(sceneId)) | ||
549 | connectiondata = m_regions[sceneId]; | ||
550 | else | ||
551 | return; | ||
552 | } | ||
553 | |||
554 | List<ScenePresence> avatars = connectiondata.RegionScene.GetAvatars(); | ||
555 | List<Vector3> CoarseLocations = new List<Vector3>(); | ||
556 | List<UUID> AvatarUUIDs = new List<UUID>(); | ||
557 | for (int i = 0; i < avatars.Count; i++) | ||
558 | { | ||
559 | if (avatars[i].UUID != presence.UUID) | ||
560 | { | ||
561 | if (avatars[i].ParentID != 0) | ||
562 | { | ||
563 | // sitting avatar | ||
564 | SceneObjectPart sop = connectiondata.RegionScene.GetSceneObjectPart(avatars[i].ParentID); | ||
565 | if (sop != null) | ||
566 | { | ||
567 | CoarseLocations.Add(sop.AbsolutePosition + avatars[i].AbsolutePosition); | ||
568 | AvatarUUIDs.Add(avatars[i].UUID); | ||
569 | } | ||
570 | else | ||
571 | { | ||
572 | // we can't find the parent.. ! arg! | ||
573 | CoarseLocations.Add(avatars[i].AbsolutePosition); | ||
574 | AvatarUUIDs.Add(avatars[i].UUID); | ||
575 | } | ||
576 | } | ||
577 | else | ||
578 | { | ||
579 | CoarseLocations.Add(avatars[i].AbsolutePosition); | ||
580 | AvatarUUIDs.Add(avatars[i].UUID); | ||
581 | } | ||
582 | } | ||
583 | } | ||
584 | DistributeCourseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence); | ||
585 | } | ||
586 | |||
587 | private void DistributeCourseLocationUpdates(List<Vector3> locations, List<UUID> uuids, | ||
588 | RegionConnections connectiondata, ScenePresence rootPresence) | ||
589 | { | ||
590 | RegionData[] rdata = connectiondata.ConnectedRegions.ToArray(); | ||
591 | List<IClientAPI> clients = new List<IClientAPI>(); | ||
592 | Dictionary<Vector2, RegionCourseLocationStruct> updates = new Dictionary<Vector2, RegionCourseLocationStruct>(); | ||
524 | 593 | ||
594 | |||
595 | // Root Region entry | ||
596 | RegionCourseLocationStruct rootupdatedata = new RegionCourseLocationStruct(); | ||
597 | rootupdatedata.Locations = new List<Vector3>(); | ||
598 | rootupdatedata.Uuids = new List<UUID>(); | ||
599 | rootupdatedata.Offset = Vector2.Zero; | ||
600 | |||
601 | rootupdatedata.UserAPI = rootPresence.ControllingClient; | ||
602 | |||
603 | if (rootupdatedata.UserAPI != null) | ||
604 | updates.Add(Vector2.Zero, rootupdatedata); | ||
605 | |||
606 | //Each Region needs an entry or we will end up with dead minimap dots | ||
607 | foreach (RegionData regiondata in rdata) | ||
608 | { | ||
609 | Vector2 offset = new Vector2(regiondata.Offset.X, regiondata.Offset.Y); | ||
610 | RegionCourseLocationStruct updatedata = new RegionCourseLocationStruct(); | ||
611 | updatedata.Locations = new List<Vector3>(); | ||
612 | updatedata.Uuids = new List<UUID>(); | ||
613 | updatedata.Offset = offset; | ||
614 | |||
615 | if (offset == Vector2.Zero) | ||
616 | updatedata.UserAPI = rootPresence.ControllingClient; | ||
617 | else | ||
618 | updatedata.UserAPI = LocateUsersChildAgentIClientAPI(offset, rootPresence.UUID, rdata); | ||
619 | |||
620 | if (updatedata.UserAPI != null) | ||
621 | updates.Add(offset, updatedata); | ||
622 | } | ||
623 | |||
624 | // go over the locations and assign them to an IClientAPI | ||
625 | for (int i = 0; i < locations.Count;i++ ) | ||
626 | //{locations[i]/(int) Constants.RegionSize; | ||
627 | { | ||
628 | Vector3 pPosition = new Vector3((int)locations[i].X / (int)Constants.RegionSize, | ||
629 | (int)locations[i].Y / (int)Constants.RegionSize, locations[i].Z); | ||
630 | Vector2 offset = new Vector2(pPosition.X*(int) Constants.RegionSize, | ||
631 | pPosition.Y*(int) Constants.RegionSize); | ||
632 | |||
633 | if (!updates.ContainsKey(offset)) | ||
634 | { | ||
635 | // This shouldn't happen | ||
636 | RegionCourseLocationStruct updatedata = new RegionCourseLocationStruct(); | ||
637 | updatedata.Locations = new List<Vector3>(); | ||
638 | updatedata.Uuids = new List<UUID>(); | ||
639 | updatedata.Offset = offset; | ||
640 | |||
641 | if (offset == Vector2.Zero) | ||
642 | updatedata.UserAPI = rootPresence.ControllingClient; | ||
643 | else | ||
644 | updatedata.UserAPI = LocateUsersChildAgentIClientAPI(offset, rootPresence.UUID, rdata); | ||
645 | |||
646 | updates.Add(offset,updatedata); | ||
647 | |||
648 | } | ||
649 | |||
650 | updates[offset].Locations.Add(locations[i]); | ||
651 | updates[offset].Uuids.Add(uuids[i]); | ||
652 | |||
653 | } | ||
654 | |||
655 | // Send out the CoarseLocationupdates from their respective client connection based on where the avatar is | ||
656 | foreach (Vector2 offset in updates.Keys) | ||
657 | { | ||
658 | if (updates[offset].UserAPI != null) | ||
659 | { | ||
660 | updates[offset].UserAPI.SendCoarseLocationUpdate(updates[offset].Uuids,updates[offset].Locations); | ||
661 | } | ||
662 | } | ||
663 | |||
664 | } | ||
665 | |||
666 | private IClientAPI LocateUsersChildAgentIClientAPI(Vector2 offset, UUID uUID, RegionData[] rdata) | ||
667 | { | ||
668 | IClientAPI returnclient = null; | ||
669 | foreach (RegionData r in rdata) | ||
670 | { | ||
671 | if (r.Offset.X == offset.X && r.Offset.Y == offset.Y) | ||
672 | { | ||
673 | return r.RegionScene.SceneGraph.GetControllingClient(uUID); | ||
674 | } | ||
675 | } | ||
676 | |||
677 | return returnclient; | ||
525 | } | 678 | } |
526 | 679 | ||
527 | public void PostInitialise() | 680 | public void PostInitialise() |
@@ -529,6 +682,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
529 | 682 | ||
530 | } | 683 | } |
531 | 684 | ||
685 | |||
686 | |||
532 | public void UnCombineRegion(RegionData rdata) | 687 | public void UnCombineRegion(RegionData rdata) |
533 | { | 688 | { |
534 | lock (m_regions) | 689 | lock (m_regions) |
@@ -733,6 +888,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
733 | public int YEnd; | 888 | public int YEnd; |
734 | public List<RegionData> ConnectedRegions; | 889 | public List<RegionData> ConnectedRegions; |
735 | public RegionCombinerPermissionModule PermissionModule; | 890 | public RegionCombinerPermissionModule PermissionModule; |
891 | public RegionCombinerClientEventForwarder ClientEventForwarder; | ||
736 | public void UpdateExtents(Vector3 extents) | 892 | public void UpdateExtents(Vector3 extents) |
737 | { | 893 | { |
738 | XEnd = (int)extents.X; | 894 | XEnd = (int)extents.X; |
@@ -748,6 +904,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
748 | public Vector3 Offset; | 904 | public Vector3 Offset; |
749 | 905 | ||
750 | } | 906 | } |
907 | struct RegionCourseLocationStruct | ||
908 | { | ||
909 | public List<Vector3> Locations; | ||
910 | public List<UUID> Uuids; | ||
911 | public IClientAPI UserAPI; | ||
912 | public Vector2 Offset; | ||
913 | } | ||
751 | 914 | ||
752 | public class RegionCombinerLargeLandChannel : ILandChannel | 915 | public class RegionCombinerLargeLandChannel : ILandChannel |
753 | { | 916 | { |
@@ -759,7 +922,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
759 | 922 | ||
760 | #region ILandChannel Members | 923 | #region ILandChannel Members |
761 | 924 | ||
762 | public RegionCombinerLargeLandChannel(RegionData regData, ILandChannel rootRegionLandChannel,List<RegionData> regionConnections) | 925 | public RegionCombinerLargeLandChannel(RegionData regData, ILandChannel rootRegionLandChannel, |
926 | List<RegionData> regionConnections) | ||
763 | { | 927 | { |
764 | RegData = regData; | 928 | RegData = regData; |
765 | RootRegionLandChannel = rootRegionLandChannel; | 929 | RootRegionLandChannel = rootRegionLandChannel; |
@@ -790,7 +954,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
790 | else | 954 | else |
791 | { | 955 | { |
792 | int offsetX = (x / (int)Constants.RegionSize); | 956 | int offsetX = (x / (int)Constants.RegionSize); |
793 | int offsetY = (x / (int)Constants.RegionSize); | 957 | int offsetY = (y / (int)Constants.RegionSize); |
794 | offsetX *= (int)Constants.RegionSize; | 958 | offsetX *= (int)Constants.RegionSize; |
795 | offsetY *= (int)Constants.RegionSize; | 959 | offsetY *= (int)Constants.RegionSize; |
796 | 960 | ||
@@ -823,7 +987,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
823 | else | 987 | else |
824 | { | 988 | { |
825 | int offsetX = (int)(x/(int) Constants.RegionSize); | 989 | int offsetX = (int)(x/(int) Constants.RegionSize); |
826 | int offsetY = (int)(x/(int) Constants.RegionSize); | 990 | int offsetY = (int)(y/(int) Constants.RegionSize); |
827 | offsetX *= (int) Constants.RegionSize; | 991 | offsetX *= (int) Constants.RegionSize; |
828 | offsetY *= (int) Constants.RegionSize; | 992 | offsetY *= (int) Constants.RegionSize; |
829 | 993 | ||
@@ -886,6 +1050,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
886 | m_rootScene = RootScene; | 1050 | m_rootScene = RootScene; |
887 | } | 1051 | } |
888 | 1052 | ||
1053 | #region Permission Override | ||
889 | public bool BypassPermissions() | 1054 | public bool BypassPermissions() |
890 | { | 1055 | { |
891 | return m_rootScene.Permissions.BypassPermissions(); | 1056 | return m_rootScene.Permissions.BypassPermissions(); |
@@ -1110,5 +1275,137 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1110 | { | 1275 | { |
1111 | return m_rootScene.Permissions.CanUseObjectReturn(landdata, type, client, retlist); | 1276 | return m_rootScene.Permissions.CanUseObjectReturn(landdata, type, client, retlist); |
1112 | } | 1277 | } |
1278 | #endregion | ||
1279 | } | ||
1280 | |||
1281 | public class RegionCombinerClientEventForwarder | ||
1282 | { | ||
1283 | private Scene m_rootScene; | ||
1284 | private Dictionary<UUID, Scene> m_virtScene = new Dictionary<UUID, Scene>(); | ||
1285 | private Dictionary<UUID,RegionCombinerModuleIndividualForwarder> m_forwarders = new Dictionary<UUID, | ||
1286 | RegionCombinerModuleIndividualForwarder>(); | ||
1287 | public RegionCombinerClientEventForwarder(RegionConnections rootScene) | ||
1288 | { | ||
1289 | m_rootScene = rootScene.RegionScene; | ||
1290 | |||
1291 | |||
1292 | } | ||
1293 | |||
1294 | public void AddSceneToEventForwarding( Scene virtualScene ) | ||
1295 | { | ||
1296 | lock (m_virtScene) | ||
1297 | { | ||
1298 | if (m_virtScene.ContainsKey(virtualScene.RegionInfo.originRegionID)) | ||
1299 | { | ||
1300 | m_virtScene[virtualScene.RegionInfo.originRegionID] = virtualScene; | ||
1301 | } | ||
1302 | else | ||
1303 | { | ||
1304 | m_virtScene.Add(virtualScene.RegionInfo.originRegionID, virtualScene); | ||
1305 | } | ||
1306 | } | ||
1307 | |||
1308 | lock (m_forwarders) | ||
1309 | { | ||
1310 | // TODO: Fix this to unregister if this happens | ||
1311 | if (m_forwarders.ContainsKey(virtualScene.RegionInfo.originRegionID)) | ||
1312 | m_forwarders.Remove(virtualScene.RegionInfo.originRegionID); | ||
1313 | |||
1314 | RegionCombinerModuleIndividualForwarder forwarder = | ||
1315 | new RegionCombinerModuleIndividualForwarder(m_rootScene, virtualScene); | ||
1316 | m_forwarders.Add(virtualScene.RegionInfo.originRegionID, forwarder); | ||
1317 | |||
1318 | virtualScene.EventManager.OnNewClient += forwarder.ClientConnect; | ||
1319 | virtualScene.EventManager.OnClientClosed += forwarder.ClientClosed; | ||
1320 | } | ||
1321 | } | ||
1322 | |||
1323 | public void RemoveSceneFromEventForwarding (Scene virtualScene) | ||
1324 | { | ||
1325 | lock (m_forwarders) | ||
1326 | { | ||
1327 | RegionCombinerModuleIndividualForwarder forwarder = m_forwarders[virtualScene.RegionInfo.originRegionID]; | ||
1328 | virtualScene.EventManager.OnNewClient -= forwarder.ClientConnect; | ||
1329 | virtualScene.EventManager.OnClientClosed -= forwarder.ClientClosed; | ||
1330 | m_forwarders.Remove(virtualScene.RegionInfo.originRegionID); | ||
1331 | } | ||
1332 | lock (m_virtScene) | ||
1333 | { | ||
1334 | if (m_virtScene.ContainsKey(virtualScene.RegionInfo.originRegionID)) | ||
1335 | { | ||
1336 | m_virtScene.Remove(virtualScene.RegionInfo.originRegionID); | ||
1337 | } | ||
1338 | } | ||
1339 | } | ||
1340 | } | ||
1341 | |||
1342 | public class RegionCombinerModuleIndividualForwarder | ||
1343 | { | ||
1344 | private Scene m_rootScene; | ||
1345 | private Scene m_virtScene; | ||
1346 | public RegionCombinerModuleIndividualForwarder(Scene rootScene, Scene virtScene) | ||
1347 | { | ||
1348 | m_rootScene = rootScene; | ||
1349 | m_virtScene = virtScene; | ||
1350 | } | ||
1351 | |||
1352 | public void ClientConnect(IClientAPI client) | ||
1353 | { | ||
1354 | |||
1355 | m_virtScene.UnSubscribeToClientPrimEvents(client); | ||
1356 | m_virtScene.UnSubscribeToClientPrimRezEvents(client); | ||
1357 | m_virtScene.UnSubscribeToClientInventoryEvents(client); | ||
1358 | m_virtScene.UnSubscribeToClientAttachmentEvents(client); | ||
1359 | m_virtScene.UnSubscribeToClientTeleportEvents(client); | ||
1360 | m_virtScene.UnSubscribeToClientScriptEvents(client); | ||
1361 | m_virtScene.UnSubscribeToClientGodEvents(client); | ||
1362 | m_virtScene.UnSubscribeToClientNetworkEvents(client); | ||
1363 | |||
1364 | m_rootScene.SubscribeToClientPrimEvents(client); | ||
1365 | client.OnAddPrim += LocalAddNewPrim; | ||
1366 | client.OnRezObject += LocalRezObject; | ||
1367 | m_rootScene.SubscribeToClientInventoryEvents(client); | ||
1368 | m_rootScene.SubscribeToClientAttachmentEvents(client); | ||
1369 | m_rootScene.SubscribeToClientTeleportEvents(client); | ||
1370 | m_rootScene.SubscribeToClientScriptEvents(client); | ||
1371 | m_rootScene.SubscribeToClientGodEvents(client); | ||
1372 | m_rootScene.SubscribeToClientNetworkEvents(client); | ||
1373 | } | ||
1374 | public void ClientClosed(UUID clientid, Scene scene) | ||
1375 | { | ||
1376 | |||
1377 | } | ||
1378 | |||
1379 | |||
1380 | private void LocalRezObject(IClientAPI remoteclient, UUID itemid, Vector3 rayend, Vector3 raystart, | ||
1381 | UUID raytargetid, byte bypassraycast, bool rayendisintersection, bool rezselected, bool removeitem, | ||
1382 | UUID fromtaskid) | ||
1383 | { | ||
1384 | int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX; | ||
1385 | int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY; | ||
1386 | rayend.X += differenceX * (int)Constants.RegionSize; | ||
1387 | rayend.Y += differenceY * (int)Constants.RegionSize; | ||
1388 | raystart.X += differenceX * (int)Constants.RegionSize; | ||
1389 | raystart.Y += differenceY * (int)Constants.RegionSize; | ||
1390 | |||
1391 | m_rootScene.RezObject(remoteclient, itemid, rayend, raystart, raytargetid, bypassraycast, | ||
1392 | rayendisintersection, rezselected, removeitem, fromtaskid); | ||
1393 | |||
1394 | } | ||
1395 | |||
1396 | private void LocalAddNewPrim(UUID ownerid, UUID groupid, Vector3 rayend, Quaternion rot, | ||
1397 | PrimitiveBaseShape shape, byte bypassraycast, Vector3 raystart, UUID raytargetid, | ||
1398 | byte rayendisintersection) | ||
1399 | { | ||
1400 | int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX; | ||
1401 | int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY; | ||
1402 | rayend.X += differenceX * (int)Constants.RegionSize; | ||
1403 | rayend.Y += differenceY * (int)Constants.RegionSize; | ||
1404 | raystart.X += differenceX * (int)Constants.RegionSize; | ||
1405 | raystart.Y += differenceY * (int)Constants.RegionSize; | ||
1406 | m_rootScene.AddNewPrim(ownerid, groupid, rayend, rot, shape, bypassraycast, raystart, raytargetid, | ||
1407 | rayendisintersection); | ||
1408 | |||
1409 | } | ||
1113 | } | 1410 | } |
1114 | } | 1411 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs index dd6928f..8fe3565 100644 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs | |||
@@ -113,26 +113,26 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid | |||
113 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, | 113 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, |
114 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) | 114 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) |
115 | { | 115 | { |
116 | //m_log.DebugFormat("[HGScene] RezObject itemID={0} fromTaskID={1}", itemID, fromTaskID); | 116 | m_log.DebugFormat("[HGScene] RezObject itemID={0} fromTaskID={1}", itemID, fromTaskID); |
117 | 117 | ||
118 | if (fromTaskID.Equals(UUID.Zero)) | 118 | //if (fromTaskID.Equals(UUID.Zero)) |
119 | //{ | ||
120 | InventoryItemBase item = new InventoryItemBase(itemID); | ||
121 | item.Owner = remoteClient.AgentId; | ||
122 | item = InventoryService.GetItem(item); | ||
123 | //if (item == null) | ||
124 | //{ // Fetch the item | ||
125 | // item = new InventoryItemBase(); | ||
126 | // item.Owner = remoteClient.AgentId; | ||
127 | // item.ID = itemID; | ||
128 | // item = m_assMapper.Get(item, userInfo.RootFolder.ID, userInfo); | ||
129 | //} | ||
130 | if (item != null) | ||
119 | { | 131 | { |
120 | InventoryItemBase item = new InventoryItemBase(itemID); | 132 | m_assMapper.Get(item.AssetID, remoteClient.AgentId); |
121 | item.Owner = remoteClient.AgentId; | 133 | |
122 | item = InventoryService.GetItem(item); | ||
123 | //if (item == null) | ||
124 | //{ // Fetch the item | ||
125 | // item = new InventoryItemBase(); | ||
126 | // item.Owner = remoteClient.AgentId; | ||
127 | // item.ID = itemID; | ||
128 | // item = m_assMapper.Get(item, userInfo.RootFolder.ID, userInfo); | ||
129 | //} | ||
130 | if (item != null) | ||
131 | { | ||
132 | m_assMapper.Get(item.AssetID, remoteClient.AgentId); | ||
133 | |||
134 | } | ||
135 | } | 134 | } |
135 | //} | ||
136 | 136 | ||
137 | // OK, we're done fetching. Pass it up to the default RezObject | 137 | // OK, we're done fetching. Pass it up to the default RezObject |
138 | return base.RezObject(remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, | 138 | return base.RezObject(remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 1d0da4c..3b91dd0 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -220,11 +220,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
220 | private bool m_scripts_enabled = true; | 220 | private bool m_scripts_enabled = true; |
221 | private string m_defaultScriptEngine; | 221 | private string m_defaultScriptEngine; |
222 | private int m_LastLogin = 0; | 222 | private int m_LastLogin = 0; |
223 | private Thread HeartbeatThread; | 223 | private Thread HeartbeatThread = null; |
224 | private volatile bool shuttingdown = false; | 224 | private volatile bool shuttingdown = false; |
225 | 225 | ||
226 | private int m_lastUpdate = Environment.TickCount; | 226 | private int m_lastUpdate = Environment.TickCount; |
227 | private int m_maxPrimsPerFrame = 200; | 227 | private int m_maxPrimsPerFrame = 200; |
228 | private bool m_firstHeartbeat = true; | ||
228 | 229 | ||
229 | private object m_deleting_scene_object = new object(); | 230 | private object m_deleting_scene_object = new object(); |
230 | 231 | ||
@@ -876,6 +877,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
876 | //m_heartbeatTimer.Enabled = true; | 877 | //m_heartbeatTimer.Enabled = true; |
877 | //m_heartbeatTimer.Interval = (int)(m_timespan * 1000); | 878 | //m_heartbeatTimer.Interval = (int)(m_timespan * 1000); |
878 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); | 879 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); |
880 | if (HeartbeatThread != null) | ||
881 | { | ||
882 | ThreadTracker.Remove(HeartbeatThread); | ||
883 | HeartbeatThread.Abort(); | ||
884 | HeartbeatThread = null; | ||
885 | } | ||
886 | m_lastUpdate = Environment.TickCount; | ||
879 | HeartbeatThread = new Thread(new ParameterizedThreadStart(Heartbeat)); | 887 | HeartbeatThread = new Thread(new ParameterizedThreadStart(Heartbeat)); |
880 | HeartbeatThread.SetApartmentState(ApartmentState.MTA); | 888 | HeartbeatThread.SetApartmentState(ApartmentState.MTA); |
881 | HeartbeatThread.Name = string.Format("Heartbeat for region {0}", RegionInfo.RegionName); | 889 | HeartbeatThread.Name = string.Format("Heartbeat for region {0}", RegionInfo.RegionName); |
@@ -912,9 +920,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
912 | /// <param name="e"></param> | 920 | /// <param name="e"></param> |
913 | private void Heartbeat(object sender) | 921 | private void Heartbeat(object sender) |
914 | { | 922 | { |
915 | Update(); | 923 | try |
924 | { | ||
925 | Update(); | ||
916 | 926 | ||
917 | m_lastUpdate = Environment.TickCount; | 927 | m_lastUpdate = Environment.TickCount; |
928 | m_firstHeartbeat = false; | ||
929 | } | ||
930 | catch (ThreadAbortException) | ||
931 | { | ||
932 | } | ||
918 | } | 933 | } |
919 | 934 | ||
920 | /// <summary> | 935 | /// <summary> |
@@ -2307,6 +2322,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2307 | /// <param name="client"></param> | 2322 | /// <param name="client"></param> |
2308 | public override void AddNewClient(IClientAPI client) | 2323 | public override void AddNewClient(IClientAPI client) |
2309 | { | 2324 | { |
2325 | CheckHeartbeat(); | ||
2310 | SubscribeToClientEvents(client); | 2326 | SubscribeToClientEvents(client); |
2311 | ScenePresence presence; | 2327 | ScenePresence presence; |
2312 | 2328 | ||
@@ -2365,14 +2381,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
2365 | EventManager.TriggerOnNewClient(client); | 2381 | EventManager.TriggerOnNewClient(client); |
2366 | } | 2382 | } |
2367 | 2383 | ||
2384 | |||
2385 | |||
2368 | /// <summary> | 2386 | /// <summary> |
2369 | /// Register for events from the client | 2387 | /// Register for events from the client |
2370 | /// </summary> | 2388 | /// </summary> |
2371 | /// <param name="client">The IClientAPI of the connected client</param> | 2389 | /// <param name="client">The IClientAPI of the connected client</param> |
2372 | protected virtual void SubscribeToClientEvents(IClientAPI client) | 2390 | public virtual void SubscribeToClientEvents(IClientAPI client) |
2391 | { | ||
2392 | SubscribeToClientTerrainEvents(client); | ||
2393 | SubscribeToClientPrimEvents(client); | ||
2394 | SubscribeToClientPrimRezEvents(client); | ||
2395 | SubscribeToClientInventoryEvents(client); | ||
2396 | SubscribeToClientAttachmentEvents(client); | ||
2397 | SubscribeToClientTeleportEvents(client); | ||
2398 | SubscribeToClientScriptEvents(client); | ||
2399 | SubscribeToClientParcelEvents(client); | ||
2400 | SubscribeToClientGridEvents(client); | ||
2401 | SubscribeToClientGodEvents(client); | ||
2402 | |||
2403 | SubscribeToClientNetworkEvents(client); | ||
2404 | |||
2405 | |||
2406 | // EventManager.TriggerOnNewClient(client); | ||
2407 | } | ||
2408 | |||
2409 | public virtual void SubscribeToClientTerrainEvents(IClientAPI client) | ||
2373 | { | 2410 | { |
2374 | client.OnRegionHandShakeReply += SendLayerData; | 2411 | client.OnRegionHandShakeReply += SendLayerData; |
2375 | client.OnAddPrim += AddNewPrim; | 2412 | client.OnUnackedTerrain += TerrainUnAcked; |
2413 | } | ||
2414 | |||
2415 | public virtual void SubscribeToClientPrimEvents(IClientAPI client) | ||
2416 | { | ||
2417 | |||
2376 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition; | 2418 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition; |
2377 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; | 2419 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; |
2378 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation; | 2420 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation; |
@@ -2384,8 +2426,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2384 | client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam; | 2426 | client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam; |
2385 | client.OnUpdatePrimShape += m_sceneGraph.UpdatePrimShape; | 2427 | client.OnUpdatePrimShape += m_sceneGraph.UpdatePrimShape; |
2386 | client.OnUpdatePrimTexture += m_sceneGraph.UpdatePrimTexture; | 2428 | client.OnUpdatePrimTexture += m_sceneGraph.UpdatePrimTexture; |
2387 | client.OnTeleportLocationRequest += RequestTeleportLocation; | ||
2388 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; | ||
2389 | client.OnObjectRequest += RequestPrim; | 2429 | client.OnObjectRequest += RequestPrim; |
2390 | client.OnObjectSelect += SelectPrim; | 2430 | client.OnObjectSelect += SelectPrim; |
2391 | client.OnObjectDeselect += DeselectPrim; | 2431 | client.OnObjectDeselect += DeselectPrim; |
@@ -2393,15 +2433,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2393 | client.OnSpinStart += m_sceneGraph.SpinStart; | 2433 | client.OnSpinStart += m_sceneGraph.SpinStart; |
2394 | client.OnSpinUpdate += m_sceneGraph.SpinObject; | 2434 | client.OnSpinUpdate += m_sceneGraph.SpinObject; |
2395 | client.OnDeRezObject += DeRezObject; | 2435 | client.OnDeRezObject += DeRezObject; |
2396 | client.OnRezObject += RezObject; | 2436 | |
2397 | client.OnRezSingleAttachmentFromInv += RezSingleAttachment; | ||
2398 | client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments; | ||
2399 | client.OnDetachAttachmentIntoInv += DetachSingleAttachmentToInv; | ||
2400 | client.OnObjectAttach += m_sceneGraph.AttachObject; | ||
2401 | client.OnObjectDetach += m_sceneGraph.DetachObject; | ||
2402 | client.OnObjectDrop += m_sceneGraph.DropObject; | ||
2403 | client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest; | ||
2404 | client.OnObjectDescription += m_sceneGraph.PrimDescription; | ||
2405 | client.OnObjectName += m_sceneGraph.PrimName; | 2437 | client.OnObjectName += m_sceneGraph.PrimName; |
2406 | client.OnObjectClickAction += m_sceneGraph.PrimClickAction; | 2438 | client.OnObjectClickAction += m_sceneGraph.PrimClickAction; |
2407 | client.OnObjectMaterial += m_sceneGraph.PrimMaterial; | 2439 | client.OnObjectMaterial += m_sceneGraph.PrimMaterial; |
@@ -2412,7 +2444,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2412 | client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; | 2444 | client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; |
2413 | client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; | 2445 | client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; |
2414 | client.OnObjectPermissions += HandleObjectPermissionsUpdate; | 2446 | client.OnObjectPermissions += HandleObjectPermissionsUpdate; |
2447 | client.OnGrabObject += ProcessObjectGrab; | ||
2448 | client.OnDeGrabObject += ProcessObjectDeGrab; | ||
2449 | client.OnUndo += m_sceneGraph.HandleUndo; | ||
2450 | client.OnObjectDescription += m_sceneGraph.PrimDescription; | ||
2451 | client.OnObjectDrop += m_sceneGraph.DropObject; | ||
2452 | client.OnObjectSaleInfo += ObjectSaleInfo; | ||
2453 | client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable; | ||
2454 | client.OnObjectOwner += ObjectOwner; | ||
2455 | } | ||
2456 | |||
2457 | public virtual void SubscribeToClientPrimRezEvents(IClientAPI client) | ||
2458 | { | ||
2459 | client.OnAddPrim += AddNewPrim; | ||
2460 | client.OnRezObject += RezObject; | ||
2461 | } | ||
2415 | 2462 | ||
2463 | public virtual void SubscribeToClientInventoryEvents(IClientAPI client) | ||
2464 | { | ||
2416 | client.OnCreateNewInventoryItem += CreateNewInventoryItem; | 2465 | client.OnCreateNewInventoryItem += CreateNewInventoryItem; |
2417 | client.OnCreateNewInventoryFolder += HandleCreateInventoryFolder; | 2466 | client.OnCreateNewInventoryFolder += HandleCreateInventoryFolder; |
2418 | client.OnUpdateInventoryFolder += HandleUpdateInventoryFolder; | 2467 | client.OnUpdateInventoryFolder += HandleUpdateInventoryFolder; |
@@ -2430,36 +2479,217 @@ namespace OpenSim.Region.Framework.Scenes | |||
2430 | client.OnRemoveTaskItem += RemoveTaskInventory; | 2479 | client.OnRemoveTaskItem += RemoveTaskInventory; |
2431 | client.OnUpdateTaskInventory += UpdateTaskInventory; | 2480 | client.OnUpdateTaskInventory += UpdateTaskInventory; |
2432 | client.OnMoveTaskItem += ClientMoveTaskInventoryItem; | 2481 | client.OnMoveTaskItem += ClientMoveTaskInventoryItem; |
2482 | } | ||
2433 | 2483 | ||
2434 | client.OnGrabObject += ProcessObjectGrab; | 2484 | public virtual void SubscribeToClientAttachmentEvents(IClientAPI client) |
2435 | client.OnDeGrabObject += ProcessObjectDeGrab; | 2485 | { |
2436 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; | 2486 | client.OnRezSingleAttachmentFromInv += RezSingleAttachment; |
2437 | client.OnParcelBuy += ProcessParcelBuy; | 2487 | client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments; |
2438 | client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; | 2488 | client.OnDetachAttachmentIntoInv += DetachSingleAttachmentToInv; |
2439 | client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable; | 2489 | client.OnObjectAttach += m_sceneGraph.AttachObject; |
2490 | client.OnObjectDetach += m_sceneGraph.DetachObject; | ||
2491 | } | ||
2492 | |||
2493 | public virtual void SubscribeToClientTeleportEvents(IClientAPI client) | ||
2494 | { | ||
2495 | client.OnTeleportLocationRequest += RequestTeleportLocation; | ||
2496 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; | ||
2440 | client.OnTeleportHomeRequest += TeleportClientHome; | 2497 | client.OnTeleportHomeRequest += TeleportClientHome; |
2441 | client.OnSetStartLocationRequest += SetHomeRezPoint; | 2498 | } |
2442 | client.OnUndo += m_sceneGraph.HandleUndo; | 2499 | |
2443 | client.OnObjectGroupRequest += m_sceneGraph.HandleObjectGroupUpdate; | 2500 | public virtual void SubscribeToClientScriptEvents(IClientAPI client) |
2444 | client.OnParcelReturnObjectsRequest += LandChannel.ReturnObjectsInParcel; | 2501 | { |
2445 | client.OnParcelSetOtherCleanTime += LandChannel.SetParcelOtherCleanTime; | ||
2446 | client.OnObjectSaleInfo += ObjectSaleInfo; | ||
2447 | client.OnScriptReset += ProcessScriptReset; | 2502 | client.OnScriptReset += ProcessScriptReset; |
2448 | client.OnGetScriptRunning += GetScriptRunning; | 2503 | client.OnGetScriptRunning += GetScriptRunning; |
2449 | client.OnSetScriptRunning += SetScriptRunning; | 2504 | client.OnSetScriptRunning += SetScriptRunning; |
2505 | } | ||
2506 | |||
2507 | public virtual void SubscribeToClientParcelEvents(IClientAPI client) | ||
2508 | { | ||
2509 | client.OnObjectGroupRequest += m_sceneGraph.HandleObjectGroupUpdate; | ||
2510 | client.OnParcelReturnObjectsRequest += LandChannel.ReturnObjectsInParcel; | ||
2511 | client.OnParcelSetOtherCleanTime += LandChannel.SetParcelOtherCleanTime; | ||
2512 | client.OnParcelBuy += ProcessParcelBuy; | ||
2513 | } | ||
2514 | |||
2515 | public virtual void SubscribeToClientGridEvents(IClientAPI client) | ||
2516 | { | ||
2517 | client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest; | ||
2518 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; | ||
2519 | client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; | ||
2520 | client.OnSetStartLocationRequest += SetHomeRezPoint; | ||
2450 | client.OnRegionHandleRequest += RegionHandleRequest; | 2521 | client.OnRegionHandleRequest += RegionHandleRequest; |
2451 | client.OnUnackedTerrain += TerrainUnAcked; | 2522 | } |
2452 | client.OnObjectOwner += ObjectOwner; | ||
2453 | 2523 | ||
2524 | public virtual void SubscribeToClientGodEvents(IClientAPI client) | ||
2525 | { | ||
2454 | IGodsModule godsModule = RequestModuleInterface<IGodsModule>(); | 2526 | IGodsModule godsModule = RequestModuleInterface<IGodsModule>(); |
2455 | client.OnGodKickUser += godsModule.KickUser; | 2527 | client.OnGodKickUser += godsModule.KickUser; |
2456 | client.OnRequestGodlikePowers += godsModule.RequestGodlikePowers; | 2528 | client.OnRequestGodlikePowers += godsModule.RequestGodlikePowers; |
2529 | } | ||
2457 | 2530 | ||
2531 | public virtual void SubscribeToClientNetworkEvents(IClientAPI client) | ||
2532 | { | ||
2458 | client.OnNetworkStatsUpdate += StatsReporter.AddPacketsStats; | 2533 | client.OnNetworkStatsUpdate += StatsReporter.AddPacketsStats; |
2534 | } | ||
2535 | |||
2536 | protected virtual void UnsubscribeToClientEvents(IClientAPI client) | ||
2537 | { | ||
2538 | |||
2539 | } | ||
2540 | |||
2541 | /// <summary> | ||
2542 | /// Register for events from the client | ||
2543 | /// </summary> | ||
2544 | /// <param name="client">The IClientAPI of the connected client</param> | ||
2545 | public virtual void UnSubscribeToClientEvents(IClientAPI client) | ||
2546 | { | ||
2547 | UnSubscribeToClientTerrainEvents(client); | ||
2548 | UnSubscribeToClientPrimEvents(client); | ||
2549 | UnSubscribeToClientPrimRezEvents(client); | ||
2550 | UnSubscribeToClientInventoryEvents(client); | ||
2551 | UnSubscribeToClientAttachmentEvents(client); | ||
2552 | UnSubscribeToClientTeleportEvents(client); | ||
2553 | UnSubscribeToClientScriptEvents(client); | ||
2554 | UnSubscribeToClientParcelEvents(client); | ||
2555 | UnSubscribeToClientGridEvents(client); | ||
2556 | UnSubscribeToClientGodEvents(client); | ||
2557 | |||
2558 | UnSubscribeToClientNetworkEvents(client); | ||
2559 | |||
2459 | 2560 | ||
2460 | // EventManager.TriggerOnNewClient(client); | 2561 | // EventManager.TriggerOnNewClient(client); |
2461 | } | 2562 | } |
2462 | 2563 | ||
2564 | public virtual void UnSubscribeToClientTerrainEvents(IClientAPI client) | ||
2565 | { | ||
2566 | client.OnRegionHandShakeReply -= SendLayerData; | ||
2567 | client.OnUnackedTerrain -= TerrainUnAcked; | ||
2568 | } | ||
2569 | |||
2570 | public virtual void UnSubscribeToClientPrimEvents(IClientAPI client) | ||
2571 | { | ||
2572 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimPosition; | ||
2573 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; | ||
2574 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimRotation; | ||
2575 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimRotation; | ||
2576 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; | ||
2577 | client.OnUpdatePrimSingleRotationPosition -= m_sceneGraph.UpdatePrimSingleRotationPosition; | ||
2578 | client.OnUpdatePrimScale -= m_sceneGraph.UpdatePrimScale; | ||
2579 | client.OnUpdatePrimGroupScale -= m_sceneGraph.UpdatePrimGroupScale; | ||
2580 | client.OnUpdateExtraParams -= m_sceneGraph.UpdateExtraParam; | ||
2581 | client.OnUpdatePrimShape -= m_sceneGraph.UpdatePrimShape; | ||
2582 | client.OnUpdatePrimTexture -= m_sceneGraph.UpdatePrimTexture; | ||
2583 | client.OnObjectRequest -= RequestPrim; | ||
2584 | client.OnObjectSelect -= SelectPrim; | ||
2585 | client.OnObjectDeselect -= DeselectPrim; | ||
2586 | client.OnGrabUpdate -= m_sceneGraph.MoveObject; | ||
2587 | client.OnSpinStart -= m_sceneGraph.SpinStart; | ||
2588 | client.OnSpinUpdate -= m_sceneGraph.SpinObject; | ||
2589 | client.OnDeRezObject -= DeRezObject; | ||
2590 | client.OnObjectName -= m_sceneGraph.PrimName; | ||
2591 | client.OnObjectClickAction -= m_sceneGraph.PrimClickAction; | ||
2592 | client.OnObjectMaterial -= m_sceneGraph.PrimMaterial; | ||
2593 | client.OnLinkObjects -= m_sceneGraph.LinkObjects; | ||
2594 | client.OnDelinkObjects -= m_sceneGraph.DelinkObjects; | ||
2595 | client.OnObjectDuplicate -= m_sceneGraph.DuplicateObject; | ||
2596 | client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay; | ||
2597 | client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags; | ||
2598 | client.OnRequestObjectPropertiesFamily -= m_sceneGraph.RequestObjectPropertiesFamily; | ||
2599 | client.OnObjectPermissions -= HandleObjectPermissionsUpdate; | ||
2600 | client.OnGrabObject -= ProcessObjectGrab; | ||
2601 | client.OnDeGrabObject -= ProcessObjectDeGrab; | ||
2602 | client.OnUndo -= m_sceneGraph.HandleUndo; | ||
2603 | client.OnObjectDescription -= m_sceneGraph.PrimDescription; | ||
2604 | client.OnObjectDrop -= m_sceneGraph.DropObject; | ||
2605 | client.OnObjectSaleInfo -= ObjectSaleInfo; | ||
2606 | client.OnObjectIncludeInSearch -= m_sceneGraph.MakeObjectSearchable; | ||
2607 | client.OnObjectOwner -= ObjectOwner; | ||
2608 | } | ||
2609 | |||
2610 | public virtual void UnSubscribeToClientPrimRezEvents(IClientAPI client) | ||
2611 | { | ||
2612 | client.OnAddPrim -= AddNewPrim; | ||
2613 | client.OnRezObject -= RezObject; | ||
2614 | } | ||
2615 | |||
2616 | |||
2617 | public virtual void UnSubscribeToClientInventoryEvents(IClientAPI client) | ||
2618 | { | ||
2619 | client.OnCreateNewInventoryItem -= CreateNewInventoryItem; | ||
2620 | client.OnCreateNewInventoryFolder -= HandleCreateInventoryFolder; | ||
2621 | client.OnUpdateInventoryFolder -= HandleUpdateInventoryFolder; | ||
2622 | client.OnMoveInventoryFolder -= HandleMoveInventoryFolder; // 2; //!! | ||
2623 | client.OnFetchInventoryDescendents -= HandleFetchInventoryDescendents; | ||
2624 | client.OnPurgeInventoryDescendents -= HandlePurgeInventoryDescendents; // 2; //!! | ||
2625 | client.OnFetchInventory -= HandleFetchInventory; | ||
2626 | client.OnUpdateInventoryItem -= UpdateInventoryItemAsset; | ||
2627 | client.OnCopyInventoryItem -= CopyInventoryItem; | ||
2628 | client.OnMoveInventoryItem -= MoveInventoryItem; | ||
2629 | client.OnRemoveInventoryItem -= RemoveInventoryItem; | ||
2630 | client.OnRemoveInventoryFolder -= RemoveInventoryFolder; | ||
2631 | client.OnRezScript -= RezScript; | ||
2632 | client.OnRequestTaskInventory -= RequestTaskInventory; | ||
2633 | client.OnRemoveTaskItem -= RemoveTaskInventory; | ||
2634 | client.OnUpdateTaskInventory -= UpdateTaskInventory; | ||
2635 | client.OnMoveTaskItem -= ClientMoveTaskInventoryItem; | ||
2636 | } | ||
2637 | |||
2638 | public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client) | ||
2639 | { | ||
2640 | client.OnRezSingleAttachmentFromInv -= RezSingleAttachment; | ||
2641 | client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachments; | ||
2642 | client.OnDetachAttachmentIntoInv -= DetachSingleAttachmentToInv; | ||
2643 | client.OnObjectAttach -= m_sceneGraph.AttachObject; | ||
2644 | client.OnObjectDetach -= m_sceneGraph.DetachObject; | ||
2645 | } | ||
2646 | |||
2647 | public virtual void UnSubscribeToClientTeleportEvents(IClientAPI client) | ||
2648 | { | ||
2649 | client.OnTeleportLocationRequest -= RequestTeleportLocation; | ||
2650 | client.OnTeleportLandmarkRequest -= RequestTeleportLandmark; | ||
2651 | client.OnTeleportHomeRequest -= TeleportClientHome; | ||
2652 | } | ||
2653 | |||
2654 | public virtual void UnSubscribeToClientScriptEvents(IClientAPI client) | ||
2655 | { | ||
2656 | client.OnScriptReset -= ProcessScriptReset; | ||
2657 | client.OnGetScriptRunning -= GetScriptRunning; | ||
2658 | client.OnSetScriptRunning -= SetScriptRunning; | ||
2659 | } | ||
2660 | |||
2661 | public virtual void UnSubscribeToClientParcelEvents(IClientAPI client) | ||
2662 | { | ||
2663 | client.OnObjectGroupRequest -= m_sceneGraph.HandleObjectGroupUpdate; | ||
2664 | client.OnParcelReturnObjectsRequest -= LandChannel.ReturnObjectsInParcel; | ||
2665 | client.OnParcelSetOtherCleanTime -= LandChannel.SetParcelOtherCleanTime; | ||
2666 | client.OnParcelBuy -= ProcessParcelBuy; | ||
2667 | } | ||
2668 | |||
2669 | public virtual void UnSubscribeToClientGridEvents(IClientAPI client) | ||
2670 | { | ||
2671 | client.OnNameFromUUIDRequest -= CommsManager.HandleUUIDNameRequest; | ||
2672 | client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest; | ||
2673 | client.OnAvatarPickerRequest -= ProcessAvatarPickerRequest; | ||
2674 | client.OnSetStartLocationRequest -= SetHomeRezPoint; | ||
2675 | client.OnRegionHandleRequest -= RegionHandleRequest; | ||
2676 | } | ||
2677 | |||
2678 | public virtual void UnSubscribeToClientGodEvents(IClientAPI client) | ||
2679 | { | ||
2680 | IGodsModule godsModule = RequestModuleInterface<IGodsModule>(); | ||
2681 | client.OnGodKickUser -= godsModule.KickUser; | ||
2682 | client.OnRequestGodlikePowers -= godsModule.RequestGodlikePowers; | ||
2683 | } | ||
2684 | |||
2685 | public virtual void UnSubscribeToClientNetworkEvents(IClientAPI client) | ||
2686 | { | ||
2687 | client.OnNetworkStatsUpdate -= StatsReporter.AddPacketsStats; | ||
2688 | } | ||
2689 | |||
2690 | |||
2691 | |||
2692 | |||
2463 | /// <summary> | 2693 | /// <summary> |
2464 | /// Teleport an avatar to their home region | 2694 | /// Teleport an avatar to their home region |
2465 | /// </summary> | 2695 | /// </summary> |
@@ -2617,6 +2847,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2617 | /// <returns></returns> | 2847 | /// <returns></returns> |
2618 | protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client) | 2848 | protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client) |
2619 | { | 2849 | { |
2850 | CheckHeartbeat(); | ||
2620 | AvatarAppearance appearance = null; | 2851 | AvatarAppearance appearance = null; |
2621 | GetAvatarAppearance(client, out appearance); | 2852 | GetAvatarAppearance(client, out appearance); |
2622 | 2853 | ||
@@ -2659,6 +2890,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2659 | /// <param name="agentID"></param> | 2890 | /// <param name="agentID"></param> |
2660 | public override void RemoveClient(UUID agentID) | 2891 | public override void RemoveClient(UUID agentID) |
2661 | { | 2892 | { |
2893 | CheckHeartbeat(); | ||
2662 | bool childagentYN = false; | 2894 | bool childagentYN = false; |
2663 | ScenePresence avatar = GetScenePresence(agentID); | 2895 | ScenePresence avatar = GetScenePresence(agentID); |
2664 | if (avatar != null) | 2896 | if (avatar != null) |
@@ -2926,11 +3158,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2926 | 3158 | ||
2927 | if (!agent.child) | 3159 | if (!agent.child) |
2928 | { | 3160 | { |
2929 | if (agent.startpos.X > (int)Constants.RegionSize - 1) | 3161 | if (TestBorderCross(agent.startpos,Cardinals.E)) |
2930 | agent.startpos.X = (int)Constants.RegionSize - 1; | 3162 | { |
3163 | Border crossedBorder = GetCrossedBorder(agent.startpos, Cardinals.E); | ||
3164 | agent.startpos.X = crossedBorder.BorderLine.Z - 1; | ||
3165 | } | ||
2931 | 3166 | ||
2932 | if (agent.startpos.Y > (int)Constants.RegionSize - 1) | 3167 | if (TestBorderCross(agent.startpos, Cardinals.N)) |
2933 | agent.startpos.Y = (int)Constants.RegionSize - 1; | 3168 | { |
3169 | Border crossedBorder = GetCrossedBorder(agent.startpos, Cardinals.N); | ||
3170 | agent.startpos.Y = crossedBorder.BorderLine.Z - 1; | ||
3171 | } | ||
2934 | 3172 | ||
2935 | // Honor parcel landing type and position. | 3173 | // Honor parcel landing type and position. |
2936 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | 3174 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); |
@@ -4160,6 +4398,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4160 | else | 4398 | else |
4161 | return health; | 4399 | return health; |
4162 | 4400 | ||
4401 | CheckHeartbeat(); | ||
4402 | |||
4163 | return health; | 4403 | return health; |
4164 | } | 4404 | } |
4165 | 4405 | ||
@@ -4345,5 +4585,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
4345 | 4585 | ||
4346 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; | 4586 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; |
4347 | } | 4587 | } |
4588 | |||
4589 | private void CheckHeartbeat() | ||
4590 | { | ||
4591 | if (m_firstHeartbeat) | ||
4592 | return; | ||
4593 | |||
4594 | if (System.Environment.TickCount - m_lastUpdate > 2000) | ||
4595 | StartTimer(); | ||
4596 | } | ||
4348 | } | 4597 | } |
4349 | } | 4598 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index c6b3f30..0827672 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -367,6 +367,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
367 | string reason = String.Empty; | 367 | string reason = String.Empty; |
368 | 368 | ||
369 | //bool regionAccepted = m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, a); | 369 | //bool regionAccepted = m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, a); |
370 | |||
370 | bool regionAccepted = m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, a, out reason); | 371 | bool regionAccepted = m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, a, out reason); |
371 | 372 | ||
372 | if (regionAccepted && newAgent) | 373 | if (regionAccepted && newAgent) |
@@ -384,7 +385,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
384 | 385 | ||
385 | eq.EnableSimulator(reg.RegionHandle, endPoint, avatar.UUID); | 386 | eq.EnableSimulator(reg.RegionHandle, endPoint, avatar.UUID); |
386 | eq.EstablishAgentCommunication(avatar.UUID, endPoint, capsPath); | 387 | eq.EstablishAgentCommunication(avatar.UUID, endPoint, capsPath); |
387 | m_log.DebugFormat("[CAPS]: Sending new CAPS seed url {0} to client {1} in region {2}", | 388 | m_log.DebugFormat("[CAPS]: Sending new CAPS seed url {0} to client {1} in region {2}", |
388 | capsPath, avatar.UUID, avatar.Scene.RegionInfo.RegionName); | 389 | capsPath, avatar.UUID, avatar.Scene.RegionInfo.RegionName); |
389 | } | 390 | } |
390 | else | 391 | else |
@@ -394,7 +395,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
394 | } | 395 | } |
395 | 396 | ||
396 | m_log.Info("[INTERGRID]: Completed inform client about neighbour " + endPoint.ToString()); | 397 | m_log.Info("[INTERGRID]: Completed inform client about neighbour " + endPoint.ToString()); |
398 | |||
397 | } | 399 | } |
400 | |||
398 | } | 401 | } |
399 | 402 | ||
400 | public void RequestNeighbors(RegionInfo region) | 403 | public void RequestNeighbors(RegionInfo region) |
@@ -407,6 +410,65 @@ namespace OpenSim.Region.Framework.Scenes | |||
407 | //blah.Port = region.RemotingPort; | 410 | //blah.Port = region.RemotingPort; |
408 | } | 411 | } |
409 | 412 | ||
413 | public List<SimpleRegionInfo> RequestNeighbors(Scene pScene, uint pRegionLocX, uint pRegionLocY) | ||
414 | { | ||
415 | Border[] northBorders = pScene.NorthBorders.ToArray(); | ||
416 | Border[] southBorders = pScene.SouthBorders.ToArray(); | ||
417 | Border[] eastBorders = pScene.EastBorders.ToArray(); | ||
418 | Border[] westBorders = pScene.WestBorders.ToArray(); | ||
419 | |||
420 | // Legacy one region. Provided for simplicity while testing the all inclusive method in the else statement. | ||
421 | if (northBorders.Length <= 1 && southBorders.Length <= 1 && eastBorders.Length <= 1 && westBorders.Length <= 1) | ||
422 | { | ||
423 | return m_commsProvider.GridService.RequestNeighbours(pRegionLocX, pRegionLocY); | ||
424 | } | ||
425 | else | ||
426 | { | ||
427 | Vector2 extent = Vector2.Zero; | ||
428 | for (int i=0;i<eastBorders.Length;i++) | ||
429 | { | ||
430 | extent.X = (eastBorders[i].BorderLine.Z > extent.X) ? eastBorders[i].BorderLine.Z : extent.X; | ||
431 | } | ||
432 | for (int i=0;i<northBorders.Length;i++) | ||
433 | { | ||
434 | extent.Y = (northBorders[i].BorderLine.Z > extent.Y) ? northBorders[i].BorderLine.Z : extent.Y; | ||
435 | } | ||
436 | |||
437 | List<SimpleRegionInfo> neighbourList = new List<SimpleRegionInfo>(); | ||
438 | |||
439 | // Loss of fraction on purpose | ||
440 | extent.X = ((int)extent.X / (int)Constants.RegionSize) + 1; | ||
441 | extent.Y = ((int)extent.Y / (int)Constants.RegionSize) + 1; | ||
442 | |||
443 | int startX = (int) pRegionLocX - 1; | ||
444 | int startY = (int) pRegionLocY - 1; | ||
445 | |||
446 | int endX = (int) pRegionLocX + (int)extent.X + 1; | ||
447 | int endY = (int) pRegionLocY + (int)extent.Y + 1; | ||
448 | |||
449 | for (int i=startX;i<endX;i++) | ||
450 | { | ||
451 | for (int j=startY;j<endY;j++) | ||
452 | { | ||
453 | // Skip CurrentRegion | ||
454 | if (i == (int)pRegionLocX && j == (int)pRegionLocY) | ||
455 | continue; | ||
456 | |||
457 | ulong regionHandle = Util.UIntsToLong((uint)(i * Constants.RegionSize), | ||
458 | (uint)(j * Constants.RegionSize)); | ||
459 | RegionInfo neighborreg = m_commsProvider.GridService.RequestNeighbourInfo(regionHandle); | ||
460 | if (neighborreg != null) | ||
461 | { | ||
462 | neighbourList.Add(neighborreg); | ||
463 | } | ||
464 | } | ||
465 | } | ||
466 | return neighbourList; | ||
467 | //SimpleRegionInfo regionData = m_commsProvider.GridService.RequestNeighbourInfo() | ||
468 | //return m_commsProvider.GridService.RequestNeighbours(pRegionLocX, pRegionLocY); | ||
469 | } | ||
470 | } | ||
471 | |||
410 | /// <summary> | 472 | /// <summary> |
411 | /// This informs all neighboring regions about agent "avatar". | 473 | /// This informs all neighboring regions about agent "avatar". |
412 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. | 474 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. |
@@ -429,7 +491,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
429 | if (m_regionInfo != null) | 491 | if (m_regionInfo != null) |
430 | { | 492 | { |
431 | neighbours = | 493 | neighbours = |
432 | m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); | 494 | RequestNeighbors(avatar.Scene,m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); |
433 | } | 495 | } |
434 | else | 496 | else |
435 | { | 497 | { |
@@ -536,6 +598,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
536 | InformClientOfNeighbourCompleted, | 598 | InformClientOfNeighbourCompleted, |
537 | d); | 599 | d); |
538 | } | 600 | } |
601 | |||
602 | catch (ArgumentOutOfRangeException) | ||
603 | { | ||
604 | m_log.ErrorFormat( | ||
605 | "[REGIONINFO]: Neighbour Regions response included the current region in the neighbor list. The following region will not display to the client: {0} for region {1} ({2}, {3}).", | ||
606 | neighbour.ExternalHostName, | ||
607 | neighbour.RegionHandle, | ||
608 | neighbour.RegionLocX, | ||
609 | neighbour.RegionLocY); | ||
610 | } | ||
539 | catch (Exception e) | 611 | catch (Exception e) |
540 | { | 612 | { |
541 | m_log.ErrorFormat( | 613 | m_log.ErrorFormat( |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 857dc11..1024857 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -62,6 +62,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
62 | public ScriptControlled eventControls; | 62 | public ScriptControlled eventControls; |
63 | } | 63 | } |
64 | 64 | ||
65 | public delegate void SendCourseLocationsMethod(UUID scene, ScenePresence presence); | ||
66 | |||
65 | public class ScenePresence : EntityBase | 67 | public class ScenePresence : EntityBase |
66 | { | 68 | { |
67 | // ~ScenePresence() | 69 | // ~ScenePresence() |
@@ -87,12 +89,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
87 | public Vector3 lastKnownAllowedPosition; | 89 | public Vector3 lastKnownAllowedPosition; |
88 | public bool sentMessageAboutRestrictedParcelFlyingDown; | 90 | public bool sentMessageAboutRestrictedParcelFlyingDown; |
89 | 91 | ||
92 | |||
93 | |||
90 | private bool m_updateflag; | 94 | private bool m_updateflag; |
91 | private byte m_movementflag; | 95 | private byte m_movementflag; |
92 | private readonly List<NewForce> m_forcesList = new List<NewForce>(); | 96 | private readonly List<NewForce> m_forcesList = new List<NewForce>(); |
93 | private short m_updateCount; | 97 | private short m_updateCount; |
94 | private uint m_requestedSitTargetID; | 98 | private uint m_requestedSitTargetID; |
95 | private UUID m_requestedSitTargetUUID = UUID.Zero; | 99 | private UUID m_requestedSitTargetUUID = UUID.Zero; |
100 | private SendCourseLocationsMethod m_sendCourseLocationsMethod; | ||
96 | 101 | ||
97 | private bool m_startAnimationSet; | 102 | private bool m_startAnimationSet; |
98 | 103 | ||
@@ -616,6 +621,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
616 | 621 | ||
617 | private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) | 622 | private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) |
618 | { | 623 | { |
624 | m_sendCourseLocationsMethod = SendCoarseLocationsDefault; | ||
619 | CreateSceneViewer(); | 625 | CreateSceneViewer(); |
620 | m_regionHandle = reginfo.RegionHandle; | 626 | m_regionHandle = reginfo.RegionHandle; |
621 | m_controllingClient = client; | 627 | m_controllingClient = client; |
@@ -2458,6 +2464,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
2458 | 2464 | ||
2459 | public void SendCoarseLocations() | 2465 | public void SendCoarseLocations() |
2460 | { | 2466 | { |
2467 | SendCourseLocationsMethod d = m_sendCourseLocationsMethod; | ||
2468 | if (d != null) | ||
2469 | { | ||
2470 | d.Invoke(m_scene.RegionInfo.originRegionID, this); | ||
2471 | } | ||
2472 | } | ||
2473 | |||
2474 | public void SetSendCourseLocationMethod(SendCourseLocationsMethod d) | ||
2475 | { | ||
2476 | if (d != null) | ||
2477 | m_sendCourseLocationsMethod = d; | ||
2478 | } | ||
2479 | |||
2480 | public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p) | ||
2481 | { | ||
2461 | m_perfMonMS = Environment.TickCount; | 2482 | m_perfMonMS = Environment.TickCount; |
2462 | 2483 | ||
2463 | List<Vector3> CoarseLocations = new List<Vector3>(); | 2484 | List<Vector3> CoarseLocations = new List<Vector3>(); |
@@ -3302,6 +3323,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3302 | { | 3323 | { |
3303 | Primitive.TextureEntry textu = AvatarAppearance.GetDefaultTexture(); | 3324 | Primitive.TextureEntry textu = AvatarAppearance.GetDefaultTexture(); |
3304 | DefaultTexture = textu.GetBytes(); | 3325 | DefaultTexture = textu.GetBytes(); |
3326 | |||
3305 | } | 3327 | } |
3306 | 3328 | ||
3307 | public class NewForce | 3329 | public class NewForce |
@@ -3431,6 +3453,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3431 | Primitive.TextureEntry textu = AvatarAppearance.GetDefaultTexture(); | 3453 | Primitive.TextureEntry textu = AvatarAppearance.GetDefaultTexture(); |
3432 | DefaultTexture = textu.GetBytes(); | 3454 | DefaultTexture = textu.GetBytes(); |
3433 | } | 3455 | } |
3456 | m_sendCourseLocationsMethod = SendCoarseLocationsDefault; | ||
3434 | CreateSceneViewer(); | 3457 | CreateSceneViewer(); |
3435 | } | 3458 | } |
3436 | 3459 | ||
diff --git a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs index 2ed177c..8904461 100644 --- a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs +++ b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs | |||
@@ -90,31 +90,16 @@ namespace OpenSim.Services.AuthenticationService | |||
90 | throw new Exception("Could not find a storage interface in the given module"); | 90 | throw new Exception("Could not find a storage interface in the given module"); |
91 | } | 91 | } |
92 | 92 | ||
93 | public virtual byte[] GetPublicKey() | ||
94 | { | ||
95 | return new byte[0]; | ||
96 | } | ||
97 | |||
98 | public bool Verify(UUID principalID, string token, int lifetime) | 93 | public bool Verify(UUID principalID, string token, int lifetime) |
99 | { | 94 | { |
100 | return m_Database.CheckToken(principalID, token, lifetime); | 95 | return m_Database.CheckToken(principalID, token, lifetime); |
101 | } | 96 | } |
102 | 97 | ||
103 | public bool VerifyEncrypted(byte[] cyphertext, byte[] key) | ||
104 | { | ||
105 | return false; | ||
106 | } | ||
107 | |||
108 | public virtual bool Release(UUID principalID, string token) | 98 | public virtual bool Release(UUID principalID, string token) |
109 | { | 99 | { |
110 | return m_Database.CheckToken(principalID, token, 0); | 100 | return m_Database.CheckToken(principalID, token, 0); |
111 | } | 101 | } |
112 | 102 | ||
113 | public virtual bool ReleaseEncrypted(byte[] cyphertext, byte[] key) | ||
114 | { | ||
115 | return false; | ||
116 | } | ||
117 | |||
118 | protected string GetToken(UUID principalID, int lifetime) | 103 | protected string GetToken(UUID principalID, int lifetime) |
119 | { | 104 | { |
120 | UUID token = UUID.Random(); | 105 | UUID token = UUID.Random(); |
diff --git a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs index 7fdbbf6..6c99b66 100644 --- a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs | |||
@@ -76,10 +76,5 @@ namespace OpenSim.Services.AuthenticationService | |||
76 | 76 | ||
77 | return String.Empty; | 77 | return String.Empty; |
78 | } | 78 | } |
79 | |||
80 | public byte[] AuthenticateEncrypted(byte[] cyphertext, byte[] key) | ||
81 | { | ||
82 | return new byte[0]; | ||
83 | } | ||
84 | } | 79 | } |
85 | } | 80 | } |
diff --git a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs index 0118c91..8831c8a 100644 --- a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs | |||
@@ -56,10 +56,5 @@ namespace OpenSim.Services.AuthenticationService | |||
56 | { | 56 | { |
57 | return String.Empty; | 57 | return String.Empty; |
58 | } | 58 | } |
59 | |||
60 | public byte[] AuthenticateEncrypted(byte[] cyphertext, byte[] key) | ||
61 | { | ||
62 | return new byte[0]; | ||
63 | } | ||
64 | } | 59 | } |
65 | } | 60 | } |
diff --git a/OpenSim/Services/Connectors/User/UserServiceConnector.cs b/OpenSim/Services/Connectors/User/UserServiceConnector.cs index fb03844..d418938 100644 --- a/OpenSim/Services/Connectors/User/UserServiceConnector.cs +++ b/OpenSim/Services/Connectors/User/UserServiceConnector.cs | |||
@@ -39,7 +39,7 @@ using OpenMetaverse; | |||
39 | 39 | ||
40 | namespace OpenSim.Services.Connectors | 40 | namespace OpenSim.Services.Connectors |
41 | { | 41 | { |
42 | public class UserServicesConnector : IUserAccountDataService | 42 | public class UserServicesConnector : IUserAccountService |
43 | { | 43 | { |
44 | private static readonly ILog m_log = | 44 | private static readonly ILog m_log = |
45 | LogManager.GetLogger( | 45 | LogManager.GetLogger( |
@@ -81,153 +81,34 @@ namespace OpenSim.Services.Connectors | |||
81 | m_ServerURI = serviceURI; | 81 | m_ServerURI = serviceURI; |
82 | } | 82 | } |
83 | 83 | ||
84 | public UserAccountData GetUserAccountData(UUID scopeID, string firstName, string lastName) | 84 | public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) |
85 | { | 85 | { |
86 | string uri = m_ServerURI + "/users/"; | 86 | return null; |
87 | UserAccountData data = new UserAccountData(); | ||
88 | data.FirstName = firstName; | ||
89 | data.LastName = lastName; | ||
90 | data.ScopeID = scopeID; | ||
91 | data.UserID = UUID.Zero; | ||
92 | |||
93 | try | ||
94 | { | ||
95 | data = SynchronousRestObjectRequester. | ||
96 | MakeRequest<UserAccountData, UserAccountData>("POST", uri, data); | ||
97 | } | ||
98 | catch (Exception e) | ||
99 | { | ||
100 | m_log.WarnFormat("[USER CONNECTOR]: Unable to send request to user server. Reason: {1}", e.Message); | ||
101 | return null; | ||
102 | } | ||
103 | |||
104 | if (data.UserID == UUID.Zero) | ||
105 | return null; | ||
106 | |||
107 | return data; | ||
108 | } | 87 | } |
109 | 88 | ||
110 | public UserAccountData GetUserAccountData(UUID scopeID, UUID userID) | 89 | public UserAccount GetUserAccount(UUID scopeID, UUID userID) |
111 | { | 90 | { |
112 | string uri = m_ServerURI + "/users/"; | 91 | return null; |
113 | UserAccountData data = new UserAccountData(); | ||
114 | data.FirstName = String.Empty; | ||
115 | data.LastName = String.Empty; | ||
116 | data.ScopeID = scopeID; | ||
117 | data.UserID = userID; | ||
118 | |||
119 | try | ||
120 | { | ||
121 | data = SynchronousRestObjectRequester. | ||
122 | MakeRequest<UserAccountData, UserAccountData>("POST", uri, data); | ||
123 | } | ||
124 | catch (Exception e) | ||
125 | { | ||
126 | m_log.WarnFormat("[USER CONNECTOR]: Unable to send request to user server. Reason: {1}", e.Message); | ||
127 | return null; | ||
128 | } | ||
129 | |||
130 | if (data.UserID == UUID.Zero) | ||
131 | return null; | ||
132 | |||
133 | return data; | ||
134 | } | 92 | } |
135 | 93 | ||
136 | public bool SetHomePosition(UserAccountData data, UUID regionID, UUID regionSecret) | 94 | public bool SetHomePosition(UserAccount data, UUID regionID, UUID regionSecret) |
137 | { | 95 | { |
138 | string uri = m_ServerURI + "/user/"; | 96 | return false; |
139 | bool result = false; | ||
140 | |||
141 | UserAccountDataMessage msg = new UserAccountDataMessage(); | ||
142 | |||
143 | msg.Data = data; | ||
144 | msg.RegionID = regionID; | ||
145 | msg.RegionSecret = regionSecret; | ||
146 | |||
147 | try | ||
148 | { | ||
149 | result = SynchronousRestObjectRequester. | ||
150 | MakeRequest<UserAccountDataMessage, bool>("POST", uri, msg); | ||
151 | } | ||
152 | catch (Exception e) | ||
153 | { | ||
154 | m_log.WarnFormat("[USER CONNECTOR]: Unable to send request to user server. Reason: {1}", e.Message); | ||
155 | return false; | ||
156 | } | ||
157 | |||
158 | return result; | ||
159 | } | 97 | } |
160 | 98 | ||
161 | public bool SetUserAccountData(UserAccountData data, UUID principalID, UUID sessionID) | 99 | public bool SetUserAccount(UserAccount data, UUID principalID, string token) |
162 | { | 100 | { |
163 | string uri = m_ServerURI + "/user/"; | 101 | return false; |
164 | bool result = false; | ||
165 | |||
166 | UserAccountDataMessage msg = new UserAccountDataMessage(); | ||
167 | |||
168 | msg.Data = data; | ||
169 | msg.PrincipalID = principalID; | ||
170 | msg.SessionID = sessionID; | ||
171 | |||
172 | try | ||
173 | { | ||
174 | result = SynchronousRestObjectRequester. | ||
175 | MakeRequest<UserAccountDataMessage, bool>("POST", uri, msg); | ||
176 | } | ||
177 | catch (Exception e) | ||
178 | { | ||
179 | m_log.WarnFormat("[USER CONNECTOR]: Unable to send request to user server. Reason: {1}", e.Message); | ||
180 | return false; | ||
181 | } | ||
182 | |||
183 | return result; | ||
184 | } | 102 | } |
185 | 103 | ||
186 | public bool CreateUserAccountData(UserAccountData data, UUID principalID, UUID sessionID) | 104 | public bool CreateUserAccount(UserAccount data, UUID principalID, string token) |
187 | { | 105 | { |
188 | string uri = m_ServerURI + "/newuser/"; | 106 | return false; |
189 | bool result = false; | ||
190 | |||
191 | UserAccountDataMessage msg = new UserAccountDataMessage(); | ||
192 | |||
193 | msg.Data = data; | ||
194 | msg.PrincipalID = principalID; | ||
195 | msg.SessionID = sessionID; | ||
196 | |||
197 | try | ||
198 | { | ||
199 | result = SynchronousRestObjectRequester. | ||
200 | MakeRequest<UserAccountDataMessage, bool>("POST", uri, msg); | ||
201 | } | ||
202 | catch (Exception e) | ||
203 | { | ||
204 | m_log.WarnFormat("[USER CONNECTOR]: Unable to send request to user server. Reason: {1}", e.Message); | ||
205 | return false; | ||
206 | } | ||
207 | |||
208 | return result; | ||
209 | } | 107 | } |
210 | 108 | ||
211 | public List<UserAccountData> GetUserAccountData(UUID scopeID, string query) | 109 | public List<UserAccount> GetUserAccount(UUID scopeID, string query) |
212 | { | 110 | { |
213 | string uri = m_ServerURI + "/userlist/"; | 111 | return null; |
214 | UserAccountData data = new UserAccountData(); | ||
215 | data.FirstName = query; | ||
216 | data.ScopeID = scopeID; | ||
217 | List<UserAccountData> result; | ||
218 | |||
219 | try | ||
220 | { | ||
221 | result = SynchronousRestObjectRequester. | ||
222 | MakeRequest<UserAccountData, List<UserAccountData>>("POST", uri, data); | ||
223 | } | ||
224 | catch (Exception e) | ||
225 | { | ||
226 | m_log.WarnFormat("[USER CONNECTOR]: Unable to send request to user server. Reason: {1}", e.Message); | ||
227 | return null; | ||
228 | } | ||
229 | |||
230 | return result; | ||
231 | } | 112 | } |
232 | } | 113 | } |
233 | } | 114 | } |
diff --git a/OpenSim/Services/Interfaces/IAuthenticationService.cs b/OpenSim/Services/Interfaces/IAuthenticationService.cs index b448a14..9225773 100644 --- a/OpenSim/Services/Interfaces/IAuthenticationService.cs +++ b/OpenSim/Services/Interfaces/IAuthenticationService.cs | |||
@@ -39,39 +39,12 @@ namespace OpenSim.Services.Interfaces | |||
39 | public interface IAuthenticationService | 39 | public interface IAuthenticationService |
40 | { | 40 | { |
41 | ////////////////////////////////////////////////////// | 41 | ////////////////////////////////////////////////////// |
42 | // PKI Zone! | ||
43 | // | ||
44 | // HG2 authentication works by using a cryptographic | ||
45 | // exchange. | ||
46 | // This method must provide a public key, the other | ||
47 | // crypto methods must understand hoow to deal with | ||
48 | // messages encrypted to it. | ||
49 | // | ||
50 | // If the public key is of zero length, you will | ||
51 | // get NO encryption and NO security. | ||
52 | // | ||
53 | // For non-HG installations, this is not relevant | ||
54 | // | ||
55 | // Implementors who are not using PKI can treat the | ||
56 | // cyphertext as a string and provide a zero-length | ||
57 | // key. Encryptionless implementations will not | ||
58 | // interoperate with implementations using encryption. | ||
59 | // If one side uses encryption, both must do so. | ||
60 | // | ||
61 | byte[] GetPublicKey(); | ||
62 | |||
63 | ////////////////////////////////////////////////////// | ||
64 | // Authentication | 42 | // Authentication |
65 | // | 43 | // |
66 | // These methods will return a token, which can be used to access | 44 | // These methods will return a token, which can be used to access |
67 | // various services. | 45 | // various services. |
68 | // | 46 | // |
69 | // The encrypted versions take the received cyphertext and | ||
70 | // the public key of the peer, which the connector must have | ||
71 | // obtained using a remote GetPublicKey call. | ||
72 | // | ||
73 | string Authenticate(UUID principalID, string password, int lifetime); | 47 | string Authenticate(UUID principalID, string password, int lifetime); |
74 | byte[] AuthenticateEncrypted(byte[] cyphertext, byte[] key); | ||
75 | 48 | ||
76 | ////////////////////////////////////////////////////// | 49 | ////////////////////////////////////////////////////// |
77 | // Verification | 50 | // Verification |
@@ -81,12 +54,7 @@ namespace OpenSim.Services.Interfaces | |||
81 | // Tokens expire after 30 minutes and can be refreshed by | 54 | // Tokens expire after 30 minutes and can be refreshed by |
82 | // re-verifying. | 55 | // re-verifying. |
83 | // | 56 | // |
84 | // If encrypted authentication was used, encrypted verification | ||
85 | // must be used to refresh. Unencrypted verification is still | ||
86 | // performed, but doesn't refresh token lifetime. | ||
87 | // | ||
88 | bool Verify(UUID principalID, string token, int lifetime); | 57 | bool Verify(UUID principalID, string token, int lifetime); |
89 | bool VerifyEncrypted(byte[] cyphertext, byte[] key); | ||
90 | 58 | ||
91 | ////////////////////////////////////////////////////// | 59 | ////////////////////////////////////////////////////// |
92 | // Teardown | 60 | // Teardown |
@@ -95,11 +63,7 @@ namespace OpenSim.Services.Interfaces | |||
95 | // invalidates it and it can not subsequently be used | 63 | // invalidates it and it can not subsequently be used |
96 | // or refreshed. | 64 | // or refreshed. |
97 | // | 65 | // |
98 | // Tokens created by encrypted authentication must | ||
99 | // be returned by encrypted release calls; | ||
100 | // | ||
101 | bool Release(UUID principalID, string token); | 66 | bool Release(UUID principalID, string token); |
102 | bool ReleaseEncrypted(byte[] cyphertext, byte[] key); | ||
103 | 67 | ||
104 | ////////////////////////////////////////////////////// | 68 | ////////////////////////////////////////////////////// |
105 | // Grid | 69 | // Grid |
diff --git a/OpenSim/Services/Interfaces/IUserService.cs b/OpenSim/Services/Interfaces/IUserService.cs index 35254a1..92bd8ef 100644 --- a/OpenSim/Services/Interfaces/IUserService.cs +++ b/OpenSim/Services/Interfaces/IUserService.cs | |||
@@ -30,13 +30,13 @@ using OpenMetaverse; | |||
30 | 30 | ||
31 | namespace OpenSim.Services.Interfaces | 31 | namespace OpenSim.Services.Interfaces |
32 | { | 32 | { |
33 | public class UserAccountData | 33 | public class UserAccount |
34 | { | 34 | { |
35 | public UserAccountData() | 35 | public UserAccount() |
36 | { | 36 | { |
37 | } | 37 | } |
38 | 38 | ||
39 | public UserAccountData(UUID userID, UUID homeRegionID, float homePositionX, | 39 | public UserAccount(UUID userID, UUID homeRegionID, float homePositionX, |
40 | float homePositionY, float homePositionZ, float homeLookAtX, | 40 | float homePositionY, float homePositionZ, float homeLookAtX, |
41 | float homeLookAtY, float homeLookAtZ) | 41 | float homeLookAtY, float homeLookAtZ) |
42 | { | 42 | { |
@@ -78,41 +78,26 @@ namespace OpenSim.Services.Interfaces | |||
78 | 78 | ||
79 | }; | 79 | }; |
80 | 80 | ||
81 | public class UserAccountDataMessage | 81 | public interface IUserAccountService |
82 | { | 82 | { |
83 | public UserAccountData Data; | 83 | UserAccount GetUserAccount(UUID scopeID, UUID userID); |
84 | 84 | UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName); | |
85 | // Set to the region's ID and secret when updating home location | ||
86 | // | ||
87 | public UUID RegionID; | ||
88 | public UUID RegionSecret; | ||
89 | |||
90 | // Set to the auth info of the user requesting creation/update | ||
91 | // | ||
92 | public UUID PrincipalID; | ||
93 | public UUID SessionID; | ||
94 | }; | ||
95 | |||
96 | public interface IUserAccountDataService | ||
97 | { | ||
98 | UserAccountData GetUserAccountData(UUID scopeID, UUID userID); | ||
99 | UserAccountData GetUserAccountData(UUID scopeID, string FirstName, string LastName); | ||
100 | // Returns the list of avatars that matches both the search | 85 | // Returns the list of avatars that matches both the search |
101 | // criterion and the scope ID passed | 86 | // criterion and the scope ID passed |
102 | // | 87 | // |
103 | List<UserAccountData> GetUserAccountData(UUID scopeID, string query); | 88 | List<UserAccount> GetUserAccount(UUID scopeID, string query); |
104 | 89 | ||
105 | 90 | ||
106 | // This will set only the home region portion of the data! | 91 | // This will set only the home region portion of the data! |
107 | // Can't be used to set god level, flags, type or change the name! | 92 | // Can't be used to set god level, flags, type or change the name! |
108 | // | 93 | // |
109 | bool SetHomePosition(UserAccountData data, UUID RegionID, UUID RegionSecret); | 94 | bool SetHomePosition(UserAccount data, UUID RegionID, UUID RegionSecret); |
110 | 95 | ||
111 | // Update all updatable fields | 96 | // Update all updatable fields |
112 | // | 97 | // |
113 | bool SetUserAccountData(UserAccountData data, UUID PrincipalID, UUID SessionID); | 98 | bool SetUserAccount(UserAccount data, UUID PrincipalID, string token); |
114 | 99 | ||
115 | // Creates a user data record | 100 | // Creates a user data record |
116 | bool CreateUserAccountData(UserAccountData data, UUID PrincipalID, UUID SessionID); | 101 | bool CreateUserAccount(UserAccount data, UUID PrincipalID, string token); |
117 | } | 102 | } |
118 | } | 103 | } |
diff --git a/OpenSim/Services/UserService/UserService.cs b/OpenSim/Services/UserService/UserService.cs index 78793657..e8b9fc3 100644 --- a/OpenSim/Services/UserService/UserService.cs +++ b/OpenSim/Services/UserService/UserService.cs | |||
@@ -35,39 +35,39 @@ using OpenMetaverse; | |||
35 | 35 | ||
36 | namespace OpenSim.Services.UserAccountService | 36 | namespace OpenSim.Services.UserAccountService |
37 | { | 37 | { |
38 | public class UserAccountService : UserAccountServiceBase, IUserAccountDataService | 38 | public class UserAccountService : UserAccountServiceBase, IUserAccountService |
39 | { | 39 | { |
40 | public UserAccountService(IConfigSource config) : base(config) | 40 | public UserAccountService(IConfigSource config) : base(config) |
41 | { | 41 | { |
42 | } | 42 | } |
43 | 43 | ||
44 | public UserAccountData GetUserAccountData(UUID scopeID, string firstName, | 44 | public UserAccount GetUserAccount(UUID scopeID, string firstName, |
45 | string lastName) | 45 | string lastName) |
46 | { | 46 | { |
47 | return null; | 47 | return null; |
48 | } | 48 | } |
49 | 49 | ||
50 | public UserAccountData GetUserAccountData(UUID scopeID, UUID userID) | 50 | public UserAccount GetUserAccount(UUID scopeID, UUID userID) |
51 | { | 51 | { |
52 | return null; | 52 | return null; |
53 | } | 53 | } |
54 | 54 | ||
55 | public bool SetHomePosition(UserAccountData data, UUID regionID, UUID regionSecret) | 55 | public bool SetHomePosition(UserAccount data, UUID regionID, UUID regionSecret) |
56 | { | 56 | { |
57 | return false; | 57 | return false; |
58 | } | 58 | } |
59 | 59 | ||
60 | public bool SetUserAccountData(UserAccountData data, UUID principalID, UUID sessionID) | 60 | public bool SetUserAccount(UserAccount data, UUID principalID, string token) |
61 | { | 61 | { |
62 | return false; | 62 | return false; |
63 | } | 63 | } |
64 | 64 | ||
65 | public bool CreateUserAccountData(UserAccountData data, UUID principalID, UUID sessionID) | 65 | public bool CreateUserAccount(UserAccount data, UUID principalID, string token) |
66 | { | 66 | { |
67 | return false; | 67 | return false; |
68 | } | 68 | } |
69 | 69 | ||
70 | public List<UserAccountData> GetUserAccountData(UUID scopeID, | 70 | public List<UserAccount> GetUserAccount(UUID scopeID, |
71 | string query) | 71 | string query) |
72 | { | 72 | { |
73 | return null; | 73 | return null; |
diff --git a/OpenSim/Services/UserService/UserServiceBase.cs b/OpenSim/Services/UserService/UserServiceBase.cs index c982c1a..fea8b01 100644 --- a/OpenSim/Services/UserService/UserServiceBase.cs +++ b/OpenSim/Services/UserService/UserServiceBase.cs | |||
@@ -36,7 +36,7 @@ namespace OpenSim.Services.UserAccountService | |||
36 | { | 36 | { |
37 | public class UserAccountServiceBase: ServiceBase | 37 | public class UserAccountServiceBase: ServiceBase |
38 | { | 38 | { |
39 | protected IUserDataPlugin m_Database = null; | 39 | protected IUserAccountData m_Database = null; |
40 | 40 | ||
41 | public UserAccountServiceBase(IConfigSource config) : base(config) | 41 | public UserAccountServiceBase(IConfigSource config) : base(config) |
42 | { | 42 | { |
@@ -53,12 +53,12 @@ namespace OpenSim.Services.UserAccountService | |||
53 | string connString = userConfig.GetString("ConnectionString", | 53 | string connString = userConfig.GetString("ConnectionString", |
54 | String.Empty); | 54 | String.Empty); |
55 | 55 | ||
56 | m_Database = LoadPlugin<IUserDataPlugin>(dllName); | 56 | string realm = userConfig.GetString("Realm", "users"); |
57 | |||
58 | m_Database = LoadPlugin<IUserAccountData>(dllName, new Object[] {connString, realm}); | ||
57 | 59 | ||
58 | if (m_Database == null) | 60 | if (m_Database == null) |
59 | throw new Exception("Could not find a storage interface in the given module"); | 61 | throw new Exception("Could not find a storage interface in the given module"); |
60 | |||
61 | m_Database.Initialise(connString); | ||
62 | } | 62 | } |
63 | } | 63 | } |
64 | } | 64 | } |