aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2010-03-30 21:34:27 +0100
committerMelanie2010-03-30 21:34:27 +0100
commit5693870fe26fae35a28f2d5103780434f4f40e57 (patch)
tree0e070fb6f11ab8763ac4f1f9a851a0061101d4d6
parentMerge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/ca... (diff)
parentminor: commented out code removal (diff)
downloadopensim-SC_OLD-5693870fe26fae35a28f2d5103780434f4f40e57.zip
opensim-SC_OLD-5693870fe26fae35a28f2d5103780434f4f40e57.tar.gz
opensim-SC_OLD-5693870fe26fae35a28f2d5103780434f4f40e57.tar.bz2
opensim-SC_OLD-5693870fe26fae35a28f2d5103780434f4f40e57.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to '')
-rw-r--r--.nant/local.include71
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs36
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs2
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs2
-rw-r--r--OpenSim/Data/MSSQL/MSSQLEstateData.cs48
-rw-r--r--OpenSim/Data/MySQL/MySQLEstateData.cs195
-rw-r--r--OpenSim/Data/MySQL/Resources/032_RegionStore.sql3
-rw-r--r--OpenSim/Data/Null/NullRegionData.cs4
-rw-r--r--OpenSim/Data/SQLite/SQLiteEstateData.cs91
-rw-r--r--OpenSim/Data/Tests/BasicEstateTest.cs24
-rw-r--r--OpenSim/Framework/EstateSettings.cs194
-rw-r--r--OpenSim/Framework/GroupData.cs2
-rw-r--r--OpenSim/Framework/IScene.cs2
-rw-r--r--OpenSim/Framework/MainServer.cs8
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs4
-rw-r--r--OpenSim/Framework/Servers/VersionInfo.cs2
-rw-r--r--OpenSim/Framework/WebUtil.cs8
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs50
-rw-r--r--OpenSim/Region/ClientStack/RegionApplicationBase.cs6
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs8
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs3
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs4
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs31
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs39
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs26
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Sound/SoundModule.cs34
-rw-r--r--OpenSim/Region/CoreModules/World/Sun/SunModule.cs9
-rw-r--r--OpenSim/Region/CoreModules/World/Wind/WindModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs91
-rw-r--r--OpenSim/Region/Examples/SimpleModule/RegionModule.cs10
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs8
-rw-r--r--OpenSim/Region/Framework/Interfaces/IGroupsModule.cs39
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs204
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs186
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneManager.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs58
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs41
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs34
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs1
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs12
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs4
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs25
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs38
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs20
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs93
-rw-r--r--OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs14
-rw-r--r--OpenSim/Server/Base/HttpServerBase.cs3
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs14
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs57
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs20
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs12
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs18
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs44
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs52
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs28
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs24
-rw-r--r--OpenSim/Services/Interfaces/IUserAccountService.cs4
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs25
-rw-r--r--bin/Mono.Security.dllbin289792 -> 0 bytes
-rw-r--r--bin/OpenMetaverse.Http.dllbin36864 -> 0 bytes
-rw-r--r--bin/OpenMetaverse.StructuredData.dllbin102400 -> 102400 bytes
-rw-r--r--bin/OpenMetaverse.dllbin1675264 -> 1691648 bytes
-rw-r--r--bin/OpenMetaverseTypes.dllbin106496 -> 106496 bytes
75 files changed, 1148 insertions, 1034 deletions
diff --git a/.nant/local.include b/.nant/local.include
index 114c12d..2591aba 100644
--- a/.nant/local.include
+++ b/.nant/local.include
@@ -1,8 +1,59 @@
1<!-- -*- xml -*- --> 1<!-- -*- xml -*- -->
2<!-- please leave the top comment for us emacs folks --> 2<!-- please leave the top comment for us emacs folks -->
3<property name="projectdir" value="opensim-0.5.5" />
4<property name="nunitcmd" value="nunit-console" /> 3<property name="nunitcmd" value="nunit-console" />
5 4
5<!-- For safety/laziness sake, we're going to take the approach of deleting known extraneous files here rather than
6 trying to copy across only the essential ones -->
7<property name="distbindir" value="distbin" />
8<target name="distbin">
9 <copy file="bin/OpenSim.ini.example" tofile="bin/OpenSim.ini"/>
10 <delete dir="${distbindir}"/>
11 <!-- <copy file="*" todir="${distbindir}"/> -->
12 <copy todir="${distbindir}">
13 <fileset>
14 <include name="**"/>
15 </fileset>
16 </copy>
17 <delete dir="${distbindir}/OpenSim"/>
18 <delete dir="${distbindir}/Prebuild"/>
19 <delete dir="${distbindir}/%temp%"/>
20 <delete dir="${distbindir}/.nant"/>
21 <delete>
22 <fileset basedir="${distbindir}">
23 <include name="Makefile"/>
24 <include name="nant-color"/>
25 <include name="OpenSim.*"/>
26 <include name="prebuild.xml"/>
27 <include name="runprebuild*"/>
28 <include name="TESTING.txt"/>
29 <include name="TestResult.xml"/>
30 <include name="bin/OpenSim.Server.ini"/>
31 <include name="bin/Regions/*"/>
32 <include name="bin/*.db"/>
33 <include name="**/.git/**"/>
34 <include name=".gitignore"/>
35 <include name=".hgignore"/>
36 </fileset>
37 </delete>
38
39</target>
40
41<!-- I don't think these targets are being actively used. But just in case, we'll just comment them out for now - justincc -->
42<!--
43<property name="projectdir" value="opensim-0.6.9" />
44<target name="dist" depends="distdir">
45 <zip zipfile="${projectdir}.zip">
46 <fileset basedir=".">
47 <include name="${projectdir}/**" />
48 </fileset>
49 </zip>
50 <tar destfile="${projectdir}.tar.gz" compression="GZip">
51 <fileset basedir=".">
52 <include name="${projectdir}/**" />
53 </fileset>
54 </tar>
55</target>
56
6<target name="distdir"> 57<target name="distdir">
7 <delete dir="${projectdir}" /> 58 <delete dir="${projectdir}" />
8 <copy todir="${projectdir}"> 59 <copy todir="${projectdir}">
@@ -21,14 +72,14 @@
21 <include name="bin/assets/**" /> 72 <include name="bin/assets/**" />
22 <include name="bin/data/**" /> 73 <include name="bin/data/**" />
23 <include name="bin/OpenSim*xml" /> 74 <include name="bin/OpenSim*xml" />
24 <!-- the next is to exclude built libs -->
25 <exclude name="bin/OpenSim.*dll" />
26 <include name="bin/OpenSim.ini" /> 75 <include name="bin/OpenSim.ini" />
27 <include name="bin/defaultstripe.png" /> 76 <include name="bin/defaultstripe.png" />
77 <exclude name="bin/OpenSim.*dll" />
28 </fileset> 78 </fileset>
29 </copy> 79 </copy>
30 <touch file="${projectdir}/bin/startup_commands.txt" /> 80 <touch file="${projectdir}/bin/startup_commands.txt" />
31</target> 81</target>
82-->
32 83
33<target name="test" depends="build, find-nunit"> 84<target name="test" depends="build, find-nunit">
34 <setenv name="MONO_THREADS_PER_CPU" value="100" /> 85 <setenv name="MONO_THREADS_PER_CPU" value="100" />
@@ -296,17 +347,3 @@
296<target name="doxygen"> 347<target name="doxygen">
297 <exec program="doxygen" workingdir="doc" commandline="doxygen.conf" /> 348 <exec program="doxygen" workingdir="doc" commandline="doxygen.conf" />
298</target> 349</target>
299
300
301<target name="dist" depends="distdir">
302 <zip zipfile="${projectdir}.zip">
303 <fileset basedir=".">
304 <include name="${projectdir}/**" />
305 </fileset>
306 </zip>
307 <tar destfile="${projectdir}.tar.gz" compression="GZip">
308 <fileset basedir=".">
309 <include name="${projectdir}/**" />
310 </fileset>
311 </tar>
312</target>
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs
index b15b337..4333ef1 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs
@@ -123,10 +123,15 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests
123 123
124 private void DoMove(RequestData rdata) 124 private void DoMove(RequestData rdata)
125 { 125 {
126 if (rdata.Parameters.Length >= 6) 126 if (rdata.Parameters.Length < 6)
127 {
128 Rest.Log.WarnFormat("{0} Move: No movement information provided", MsgId);
129 rdata.Fail(Rest.HttpStatusCodeBadRequest, "no movement information provided");
130 }
131 else
127 { 132 {
128 string[] names = rdata.Parameters[PARM_MOVE_AVATAR].Split(Rest.CA_SPACE); 133 string[] names = rdata.Parameters[PARM_MOVE_AVATAR].Split(Rest.CA_SPACE);
129 ScenePresence avatar = null; 134 ScenePresence presence = null;
130 Scene scene = null; 135 Scene scene = null;
131 136
132 if (names.Length != 2) 137 if (names.Length != 2)
@@ -141,21 +146,19 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests
141 // The first parameter should be an avatar name, look for the 146 // The first parameter should be an avatar name, look for the
142 // avatar in the known regions first. 147 // avatar in the known regions first.
143 148
144 foreach (Scene cs in Rest.main.SceneManager.Scenes) 149 Rest.main.SceneManager.ForEachScene(delegate(Scene s)
145 { 150 {
146 foreach (ScenePresence presence in cs.GetAvatars()) 151 s.ForEachScenePresence(delegate(ScenePresence sp)
147 { 152 {
148 if (presence.Firstname == names[0] && 153 if (sp.Firstname == names[0] && sp.Lastname == names[1])
149 presence.Lastname == names[1])
150 { 154 {
151 scene = cs; 155 scene = s;
152 avatar = presence; 156 presence = sp;
153 break;
154 } 157 }
155 } 158 });
156 } 159 });
157 160
158 if (avatar != null) 161 if (presence != null)
159 { 162 {
160 Rest.Log.DebugFormat("{0} Move : Avatar {1} located in region {2}", 163 Rest.Log.DebugFormat("{0} Move : Avatar {1} located in region {2}",
161 MsgId, rdata.Parameters[PARM_MOVE_AVATAR], scene.RegionInfo.RegionName); 164 MsgId, rdata.Parameters[PARM_MOVE_AVATAR], scene.RegionInfo.RegionName);
@@ -166,14 +169,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests
166 float y = Convert.ToSingle(rdata.Parameters[PARM_MOVE_Y]); 169 float y = Convert.ToSingle(rdata.Parameters[PARM_MOVE_Y]);
167 float z = Convert.ToSingle(rdata.Parameters[PARM_MOVE_Z]); 170 float z = Convert.ToSingle(rdata.Parameters[PARM_MOVE_Z]);
168 Vector3 vector = new Vector3(x,y,z); 171 Vector3 vector = new Vector3(x,y,z);
169 avatar.DoAutoPilot(0,vector,avatar.ControllingClient); 172 presence.DoAutoPilot(0,vector,presence.ControllingClient);
170 } 173 }
171 catch (Exception e) 174 catch (Exception e)
172 { 175 {
173 rdata.Fail(Rest.HttpStatusCodeBadRequest, 176 rdata.Fail(Rest.HttpStatusCodeBadRequest,
174 String.Format("invalid parameters: {0}", e.Message)); 177 String.Format("invalid parameters: {0}", e.Message));
175 } 178 }
176
177 } 179 }
178 else 180 else
179 { 181 {
@@ -183,12 +185,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests
183 185
184 rdata.Complete(); 186 rdata.Complete();
185 rdata.Respond("OK"); 187 rdata.Respond("OK");
186
187 }
188 else
189 {
190 Rest.Log.WarnFormat("{0} Move: No movement information provided", MsgId);
191 rdata.Fail(Rest.HttpStatusCodeBadRequest, "no movement information provided");
192 } 188 }
193 } 189 }
194 190
diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs
index ed18207..dea166d 100644
--- a/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs
@@ -192,7 +192,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
192 192
193 protected string RegionStats(OSHttpResponse httpResponse, Scene scene) 193 protected string RegionStats(OSHttpResponse httpResponse, Scene scene)
194 { 194 {
195 int users = scene.GetAvatars().Count; 195 int users = scene.GetRootAgentCount();
196 int objects = scene.Entities.Count - users; 196 int objects = scene.Entities.Count - users;
197 197
198 RestXmlWriter rxw = new RestXmlWriter(new StringWriter()); 198 RestXmlWriter rxw = new RestXmlWriter(new StringWriter());
diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs
index 734b668..279db4c 100644
--- a/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs
@@ -117,7 +117,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
117 rxw.WriteString(s.RegionInfo.InternalEndPoint.ToString()); 117 rxw.WriteString(s.RegionInfo.InternalEndPoint.ToString());
118 rxw.WriteEndAttribute(); 118 rxw.WriteEndAttribute();
119 119
120 int users = s.GetAvatars().Count; 120 int users = s.GetRootAgentCount();
121 rxw.WriteStartAttribute(String.Empty, "avatars", String.Empty); 121 rxw.WriteStartAttribute(String.Empty, "avatars", String.Empty);
122 rxw.WriteValue(users); 122 rxw.WriteValue(users);
123 rxw.WriteEndAttribute(); 123 rxw.WriteEndAttribute();
diff --git a/OpenSim/Data/MSSQL/MSSQLEstateData.cs b/OpenSim/Data/MSSQL/MSSQLEstateData.cs
index 6f6f076..474f706 100644
--- a/OpenSim/Data/MSSQL/MSSQLEstateData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLEstateData.cs
@@ -83,7 +83,7 @@ namespace OpenSim.Data.MSSQL
83 /// </summary> 83 /// </summary>
84 /// <param name="regionID">region ID.</param> 84 /// <param name="regionID">region ID.</param>
85 /// <returns></returns> 85 /// <returns></returns>
86 public EstateSettings LoadEstateSettings(UUID regionID) 86 public EstateSettings LoadEstateSettings(UUID regionID, bool create)
87 { 87 {
88 EstateSettings es = new EstateSettings(); 88 EstateSettings es = new EstateSettings();
89 89
@@ -127,7 +127,7 @@ namespace OpenSim.Data.MSSQL
127 } 127 }
128 128
129 129
130 if (insertEstate) 130 if (insertEstate && create)
131 { 131 {
132 List<string> names = new List<string>(FieldList); 132 List<string> names = new List<string>(FieldList);
133 133
@@ -173,25 +173,6 @@ namespace OpenSim.Data.MSSQL
173 } 173 }
174 } 174 }
175 175
176 // Munge and transfer the ban list
177
178 sql = string.Format("insert into estateban select {0}, bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = @UUID", es.EstateID);
179 using (SqlConnection conn = new SqlConnection(m_connectionString))
180 using (SqlCommand cmd = new SqlCommand(sql, conn))
181 {
182
183 cmd.Parameters.Add(_Database.CreateParameter("@UUID", regionID));
184 try
185 {
186 conn.Open();
187 cmd.ExecuteNonQuery();
188 }
189 catch (Exception)
190 {
191 _Log.Debug("[ESTATE DB]: Error setting up estateban from regionban");
192 }
193 }
194
195 //TODO check if this is needed?? 176 //TODO check if this is needed??
196 es.Save(); 177 es.Save();
197 } 178 }
@@ -365,6 +346,31 @@ namespace OpenSim.Data.MSSQL
365 } 346 }
366 } 347 }
367 } 348 }
349
350 public EstateSettings LoadEstateSettings(int estateID)
351 {
352 return new EstateSettings();
353 }
354
355 public List<int> GetEstates(string search)
356 {
357 return new List<int>();
358 }
359
360 public bool LinkRegion(UUID regionID, int estateID)
361 {
362 return false;
363 }
364
365 public List<UUID> GetRegions(int estateID)
366 {
367 return new List<UUID>();
368 }
369
370 public bool DeleteEstate(int estateID)
371 {
372 return false;
373 }
368 #endregion 374 #endregion
369 } 375 }
370} 376}
diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs
index 2eae2d8..d0c02f0 100644
--- a/OpenSim/Data/MySQL/MySQLEstateData.cs
+++ b/OpenSim/Data/MySQL/MySQLEstateData.cs
@@ -121,111 +121,110 @@ namespace OpenSim.Data.MySQL
121 } 121 }
122 } 122 }
123 123
124 public EstateSettings LoadEstateSettings(UUID regionID) 124 public EstateSettings LoadEstateSettings(UUID regionID, bool create)
125 { 125 {
126 EstateSettings es = new EstateSettings();
127 es.OnSave += StoreEstateSettings;
128
129 string sql = "select estate_settings." + String.Join(",estate_settings.", FieldList) + 126 string sql = "select estate_settings." + String.Join(",estate_settings.", FieldList) +
130 " from estate_map left join estate_settings on estate_map.EstateID = estate_settings.EstateID where estate_settings.EstateID is not null and RegionID = ?RegionID"; 127 " from estate_map left join estate_settings on estate_map.EstateID = estate_settings.EstateID where estate_settings.EstateID is not null and RegionID = ?RegionID";
131 128
132 bool migration = true; 129 using (MySqlCommand cmd = new MySqlCommand())
130 {
131 cmd.CommandText = sql;
132 cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
133
134 return DoLoad(cmd, regionID, create);
135 }
136 }
137
138 private EstateSettings DoLoad(MySqlCommand cmd, UUID regionID, bool create)
139 {
140 EstateSettings es = new EstateSettings();
141 es.OnSave += StoreEstateSettings;
133 142
134 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 143 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
135 { 144 {
136 dbcon.Open(); 145 dbcon.Open();
137 146
138 using (MySqlCommand cmd = dbcon.CreateCommand()) 147 cmd.Connection = dbcon;
139 {
140 cmd.CommandText = sql;
141 cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
142 148
143 using (IDataReader r = cmd.ExecuteReader()) 149 bool found = false;
150
151 using (IDataReader r = cmd.ExecuteReader())
152 {
153 if (r.Read())
144 { 154 {
145 if (r.Read()) 155 found = true;
146 {
147 migration = false;
148 156
149 foreach (string name in FieldList) 157 foreach (string name in FieldList)
158 {
159 if (m_FieldMap[name].GetValue(es) is bool)
150 { 160 {
151 if (m_FieldMap[name].GetValue(es) is bool) 161 int v = Convert.ToInt32(r[name]);
152 { 162 if (v != 0)
153 int v = Convert.ToInt32(r[name]); 163 m_FieldMap[name].SetValue(es, true);
154 if (v != 0)
155 m_FieldMap[name].SetValue(es, true);
156 else
157 m_FieldMap[name].SetValue(es, false);
158 }
159 else if (m_FieldMap[name].GetValue(es) is UUID)
160 {
161 UUID uuid = UUID.Zero;
162
163 UUID.TryParse(r[name].ToString(), out uuid);
164 m_FieldMap[name].SetValue(es, uuid);
165 }
166 else 164 else
167 { 165 m_FieldMap[name].SetValue(es, false);
168 m_FieldMap[name].SetValue(es, r[name]); 166 }
169 } 167 else if (m_FieldMap[name].GetValue(es) is UUID)
168 {
169 UUID uuid = UUID.Zero;
170
171 UUID.TryParse(r[name].ToString(), out uuid);
172 m_FieldMap[name].SetValue(es, uuid);
173 }
174 else
175 {
176 m_FieldMap[name].SetValue(es, r[name]);
170 } 177 }
171 } 178 }
172 } 179 }
173 } 180 }
174 181
175 if (migration) 182 if (!found && create)
176 { 183 {
177 // Migration case 184 // Migration case
178 List<string> names = new List<string>(FieldList); 185 List<string> names = new List<string>(FieldList);
179 186
180 names.Remove("EstateID"); 187 names.Remove("EstateID");
181 188
182 sql = "insert into estate_settings (" + String.Join(",", names.ToArray()) + ") values ( ?" + String.Join(", ?", names.ToArray()) + ")"; 189 string sql = "insert into estate_settings (" + String.Join(",", names.ToArray()) + ") values ( ?" + String.Join(", ?", names.ToArray()) + ")";
183 190
184 using (MySqlCommand cmd = dbcon.CreateCommand()) 191 using (MySqlCommand cmd2 = dbcon.CreateCommand())
185 { 192 {
186 cmd.CommandText = sql; 193 cmd2.CommandText = sql;
187 cmd.Parameters.Clear(); 194 cmd2.Parameters.Clear();
188 195
189 foreach (string name in FieldList) 196 foreach (string name in FieldList)
190 { 197 {
191 if (m_FieldMap[name].GetValue(es) is bool) 198 if (m_FieldMap[name].GetValue(es) is bool)
192 { 199 {
193 if ((bool)m_FieldMap[name].GetValue(es)) 200 if ((bool)m_FieldMap[name].GetValue(es))
194 cmd.Parameters.AddWithValue("?" + name, "1"); 201 cmd2.Parameters.AddWithValue("?" + name, "1");
195 else 202 else
196 cmd.Parameters.AddWithValue("?" + name, "0"); 203 cmd2.Parameters.AddWithValue("?" + name, "0");
197 } 204 }
198 else 205 else
199 { 206 {
200 cmd.Parameters.AddWithValue("?" + name, m_FieldMap[name].GetValue(es).ToString()); 207 cmd2.Parameters.AddWithValue("?" + name, m_FieldMap[name].GetValue(es).ToString());
201 } 208 }
202 } 209 }
203 210
204 cmd.ExecuteNonQuery(); 211 cmd2.ExecuteNonQuery();
205 212
206 cmd.CommandText = "select LAST_INSERT_ID() as id"; 213 cmd2.CommandText = "select LAST_INSERT_ID() as id";
207 cmd.Parameters.Clear(); 214 cmd2.Parameters.Clear();
208 215
209 using (IDataReader r = cmd.ExecuteReader()) 216 using (IDataReader r = cmd2.ExecuteReader())
210 { 217 {
211 r.Read(); 218 r.Read();
212 es.EstateID = Convert.ToUInt32(r["id"]); 219 es.EstateID = Convert.ToUInt32(r["id"]);
213 } 220 }
214 221
215 cmd.CommandText = "insert into estate_map values (?RegionID, ?EstateID)"; 222 cmd2.CommandText = "insert into estate_map values (?RegionID, ?EstateID)";
216 cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); 223 cmd2.Parameters.AddWithValue("?RegionID", regionID.ToString());
217 cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString()); 224 cmd2.Parameters.AddWithValue("?EstateID", es.EstateID.ToString());
218 225
219 // This will throw on dupe key 226 // This will throw on dupe key
220 try { cmd.ExecuteNonQuery(); } 227 try { cmd2.ExecuteNonQuery(); }
221 catch (Exception) { }
222
223 // Munge and transfer the ban list
224 cmd.Parameters.Clear();
225 cmd.CommandText = "insert into estateban select " + es.EstateID.ToString() + ", bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = ?UUID";
226 cmd.Parameters.AddWithValue("?UUID", regionID.ToString());
227
228 try { cmd.ExecuteNonQuery(); }
229 catch (Exception) { } 228 catch (Exception) { }
230 229
231 es.Save(); 230 es.Save();
@@ -398,5 +397,89 @@ namespace OpenSim.Data.MySQL
398 397
399 return uuids.ToArray(); 398 return uuids.ToArray();
400 } 399 }
400
401 public EstateSettings LoadEstateSettings(int estateID)
402 {
403 using (MySqlCommand cmd = new MySqlCommand())
404 {
405 string sql = "select estate_settings." + String.Join(",estate_settings.", FieldList) + " from estate_settings where EstateID = ?EstateID";
406
407 cmd.CommandText = sql;
408 cmd.Parameters.AddWithValue("?EstateID", estateID);
409
410 return DoLoad(cmd, UUID.Zero, false);
411 }
412 }
413
414 public List<int> GetEstates(string search)
415 {
416 List<int> result = new List<int>();
417
418 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
419 {
420 dbcon.Open();
421
422 using (MySqlCommand cmd = dbcon.CreateCommand())
423 {
424 cmd.CommandText = "select estateID from estate_settings where EstateName = ?EstateName";
425 cmd.Parameters.AddWithValue("?EstateName", search);
426
427 using (IDataReader reader = cmd.ExecuteReader())
428 {
429 while (reader.Read())
430 {
431 result.Add(Convert.ToInt32(reader["EstateID"]));
432 }
433 reader.Close();
434 }
435 }
436
437
438 dbcon.Close();
439 }
440
441 return result;
442 }
443
444 public bool LinkRegion(UUID regionID, int estateID)
445 {
446 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
447 {
448 dbcon.Open();
449
450 try
451 {
452 using (MySqlCommand cmd = dbcon.CreateCommand())
453 {
454 cmd.CommandText = "insert into estate_map values (?RegionID, ?EstateID)";
455 cmd.Parameters.AddWithValue("?RegionID", regionID);
456 cmd.Parameters.AddWithValue("?EstateID", estateID);
457
458 int ret = cmd.ExecuteNonQuery();
459 dbcon.Close();
460
461 return (ret != 0);
462 }
463 }
464 catch (MySqlException ex)
465 {
466 m_log.Error("[REGION DB]: LinkRegion failed: " + ex.Message);
467 }
468
469 dbcon.Close();
470 }
471
472 return false;
473 }
474
475 public List<UUID> GetRegions(int estateID)
476 {
477 return new List<UUID>();
478 }
479
480 public bool DeleteEstate(int estateID)
481 {
482 return false;
483 }
401 } 484 }
402} 485}
diff --git a/OpenSim/Data/MySQL/Resources/032_RegionStore.sql b/OpenSim/Data/MySQL/Resources/032_RegionStore.sql
index b10ffcf..02ac1f5 100644
--- a/OpenSim/Data/MySQL/Resources/032_RegionStore.sql
+++ b/OpenSim/Data/MySQL/Resources/032_RegionStore.sql
@@ -67,4 +67,5 @@ CREATE TABLE `regionwindlight` (
67 PRIMARY KEY (`region_id`) 67 PRIMARY KEY (`region_id`)
68); 68);
69 69
70COMMIT; \ No newline at end of file 70ALTER TABLE estate_settings AUTO_INCREMENT = 100;
71COMMIT;
diff --git a/OpenSim/Data/Null/NullRegionData.cs b/OpenSim/Data/Null/NullRegionData.cs
index 5b9898c..30ad747 100644
--- a/OpenSim/Data/Null/NullRegionData.cs
+++ b/OpenSim/Data/Null/NullRegionData.cs
@@ -40,7 +40,7 @@ namespace OpenSim.Data.Null
40 { 40 {
41 private static NullRegionData Instance = null; 41 private static NullRegionData Instance = null;
42 42
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 44
45 Dictionary<UUID, RegionData> m_regionData = new Dictionary<UUID, RegionData>(); 45 Dictionary<UUID, RegionData> m_regionData = new Dictionary<UUID, RegionData>();
46 46
@@ -192,4 +192,4 @@ namespace OpenSim.Data.Null
192 return ret; 192 return ret;
193 } 193 }
194 } 194 }
195} 195} \ No newline at end of file
diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs
index 1be99ee..bd6b776 100644
--- a/OpenSim/Data/SQLite/SQLiteEstateData.cs
+++ b/OpenSim/Data/SQLite/SQLiteEstateData.cs
@@ -80,11 +80,8 @@ namespace OpenSim.Data.SQLite
80 get { return new List<string>(m_FieldMap.Keys).ToArray(); } 80 get { return new List<string>(m_FieldMap.Keys).ToArray(); }
81 } 81 }
82 82
83 public EstateSettings LoadEstateSettings(UUID regionID) 83 public EstateSettings LoadEstateSettings(UUID regionID, bool create)
84 { 84 {
85 EstateSettings es = new EstateSettings();
86 es.OnSave += StoreEstateSettings;
87
88 string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_map left join estate_settings on estate_map.EstateID = estate_settings.EstateID where estate_settings.EstateID is not null and RegionID = :RegionID"; 85 string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_map left join estate_settings on estate_map.EstateID = estate_settings.EstateID where estate_settings.EstateID is not null and RegionID = :RegionID";
89 86
90 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); 87 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
@@ -92,6 +89,14 @@ namespace OpenSim.Data.SQLite
92 cmd.CommandText = sql; 89 cmd.CommandText = sql;
93 cmd.Parameters.Add(":RegionID", regionID.ToString()); 90 cmd.Parameters.Add(":RegionID", regionID.ToString());
94 91
92 return DoLoad(cmd, regionID, create);
93 }
94
95 private EstateSettings DoLoad(SqliteCommand cmd, UUID regionID, bool create)
96 {
97 EstateSettings es = new EstateSettings();
98 es.OnSave += StoreEstateSettings;
99
95 IDataReader r = cmd.ExecuteReader(); 100 IDataReader r = cmd.ExecuteReader();
96 101
97 if (r.Read()) 102 if (r.Read())
@@ -120,17 +125,15 @@ namespace OpenSim.Data.SQLite
120 } 125 }
121 r.Close(); 126 r.Close();
122 } 127 }
123 else 128 else if (create)
124 { 129 {
125 // Migration case
126 //
127 r.Close(); 130 r.Close();
128 131
129 List<string> names = new List<string>(FieldList); 132 List<string> names = new List<string>(FieldList);
130 133
131 names.Remove("EstateID"); 134 names.Remove("EstateID");
132 135
133 sql = "insert into estate_settings ("+String.Join(",", names.ToArray())+") values ( :"+String.Join(", :", names.ToArray())+")"; 136 string sql = "insert into estate_settings ("+String.Join(",", names.ToArray())+") values ( :"+String.Join(", :", names.ToArray())+")";
134 137
135 cmd.CommandText = sql; 138 cmd.CommandText = sql;
136 cmd.Parameters.Clear(); 139 cmd.Parameters.Clear();
@@ -176,20 +179,6 @@ namespace OpenSim.Data.SQLite
176 { 179 {
177 } 180 }
178 181
179 // Munge and transfer the ban list
180 //
181 cmd.Parameters.Clear();
182 cmd.CommandText = "insert into estateban select "+es.EstateID.ToString()+", bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = :UUID";
183 cmd.Parameters.Add(":UUID", regionID.ToString());
184
185 try
186 {
187 cmd.ExecuteNonQuery();
188 }
189 catch (Exception)
190 {
191 }
192
193 es.Save(); 182 es.Save();
194 } 183 }
195 184
@@ -336,5 +325,63 @@ namespace OpenSim.Data.SQLite
336 325
337 return uuids.ToArray(); 326 return uuids.ToArray();
338 } 327 }
328
329 public EstateSettings LoadEstateSettings(int estateID)
330 {
331 string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID :EstateID";
332
333 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
334
335 cmd.CommandText = sql;
336 cmd.Parameters.Add(":EstateID", estateID.ToString());
337
338 return DoLoad(cmd, UUID.Zero, false);
339 }
340
341 public List<int> GetEstates(string search)
342 {
343 List<int> result = new List<int>();
344
345 string sql = "select EstateID from estate_settings where estate_settings.EstateName :EstateName";
346
347 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
348
349 cmd.CommandText = sql;
350 cmd.Parameters.Add(":EstateName", search);
351
352 IDataReader r = cmd.ExecuteReader();
353
354 while (r.Read())
355 {
356 result.Add(Convert.ToInt32(r["EstateID"]));
357 }
358 r.Close();
359
360 return result;
361 }
362
363 public bool LinkRegion(UUID regionID, int estateID)
364 {
365 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
366
367 cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)";
368 cmd.Parameters.Add(":RegionID", regionID.ToString());
369 cmd.Parameters.Add(":EstateID", estateID.ToString());
370
371 if (cmd.ExecuteNonQuery() == 0)
372 return false;
373
374 return true;
375 }
376
377 public List<UUID> GetRegions(int estateID)
378 {
379 return new List<UUID>();
380 }
381
382 public bool DeleteEstate(int estateID)
383 {
384 return false;
385 }
339 } 386 }
340} 387}
diff --git a/OpenSim/Data/Tests/BasicEstateTest.cs b/OpenSim/Data/Tests/BasicEstateTest.cs
index 907bb38..d14d405 100644
--- a/OpenSim/Data/Tests/BasicEstateTest.cs
+++ b/OpenSim/Data/Tests/BasicEstateTest.cs
@@ -158,7 +158,7 @@ namespace OpenSim.Data.Tests
158 public void T012_EstateSettingsRandomStorage() 158 public void T012_EstateSettingsRandomStorage()
159 { 159 {
160 // Letting estate store generate rows to database for us 160 // Letting estate store generate rows to database for us
161 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID); 161 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
162 new PropertyScrambler<EstateSettings>() 162 new PropertyScrambler<EstateSettings>()
163 .DontScramble(x=>x.EstateID) 163 .DontScramble(x=>x.EstateID)
164 .Scramble(originalSettings); 164 .Scramble(originalSettings);
@@ -167,7 +167,7 @@ namespace OpenSim.Data.Tests
167 db.StoreEstateSettings(originalSettings); 167 db.StoreEstateSettings(originalSettings);
168 168
169 // Loading settings to another instance variable. 169 // Loading settings to another instance variable.
170 EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID); 170 EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID, true);
171 171
172 // Checking that loaded values are correct. 172 // Checking that loaded values are correct.
173 Assert.That(loadedSettings, Constraints.PropertyCompareConstraint(originalSettings)); 173 Assert.That(loadedSettings, Constraints.PropertyCompareConstraint(originalSettings));
@@ -177,7 +177,7 @@ namespace OpenSim.Data.Tests
177 public void T020_EstateSettingsManagerList() 177 public void T020_EstateSettingsManagerList()
178 { 178 {
179 // Letting estate store generate rows to database for us 179 // Letting estate store generate rows to database for us
180 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID); 180 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
181 181
182 originalSettings.EstateManagers = new UUID[] { MANAGER_ID_1, MANAGER_ID_2 }; 182 originalSettings.EstateManagers = new UUID[] { MANAGER_ID_1, MANAGER_ID_2 };
183 183
@@ -185,7 +185,7 @@ namespace OpenSim.Data.Tests
185 db.StoreEstateSettings(originalSettings); 185 db.StoreEstateSettings(originalSettings);
186 186
187 // Loading settings to another instance variable. 187 // Loading settings to another instance variable.
188 EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID); 188 EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID, true);
189 189
190 Assert.AreEqual(2, loadedSettings.EstateManagers.Length); 190 Assert.AreEqual(2, loadedSettings.EstateManagers.Length);
191 Assert.AreEqual(MANAGER_ID_1, loadedSettings.EstateManagers[0]); 191 Assert.AreEqual(MANAGER_ID_1, loadedSettings.EstateManagers[0]);
@@ -196,7 +196,7 @@ namespace OpenSim.Data.Tests
196 public void T021_EstateSettingsUserList() 196 public void T021_EstateSettingsUserList()
197 { 197 {
198 // Letting estate store generate rows to database for us 198 // Letting estate store generate rows to database for us
199 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID); 199 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
200 200
201 originalSettings.EstateAccess = new UUID[] { USER_ID_1, USER_ID_2 }; 201 originalSettings.EstateAccess = new UUID[] { USER_ID_1, USER_ID_2 };
202 202
@@ -204,7 +204,7 @@ namespace OpenSim.Data.Tests
204 db.StoreEstateSettings(originalSettings); 204 db.StoreEstateSettings(originalSettings);
205 205
206 // Loading settings to another instance variable. 206 // Loading settings to another instance variable.
207 EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID); 207 EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID, true);
208 208
209 Assert.AreEqual(2, loadedSettings.EstateAccess.Length); 209 Assert.AreEqual(2, loadedSettings.EstateAccess.Length);
210 Assert.AreEqual(USER_ID_1, loadedSettings.EstateAccess[0]); 210 Assert.AreEqual(USER_ID_1, loadedSettings.EstateAccess[0]);
@@ -215,7 +215,7 @@ namespace OpenSim.Data.Tests
215 public void T022_EstateSettingsGroupList() 215 public void T022_EstateSettingsGroupList()
216 { 216 {
217 // Letting estate store generate rows to database for us 217 // Letting estate store generate rows to database for us
218 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID); 218 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
219 219
220 originalSettings.EstateGroups = new UUID[] { GROUP_ID_1, GROUP_ID_2 }; 220 originalSettings.EstateGroups = new UUID[] { GROUP_ID_1, GROUP_ID_2 };
221 221
@@ -223,7 +223,7 @@ namespace OpenSim.Data.Tests
223 db.StoreEstateSettings(originalSettings); 223 db.StoreEstateSettings(originalSettings);
224 224
225 // Loading settings to another instance variable. 225 // Loading settings to another instance variable.
226 EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID); 226 EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID, true);
227 227
228 Assert.AreEqual(2, loadedSettings.EstateAccess.Length); 228 Assert.AreEqual(2, loadedSettings.EstateAccess.Length);
229 Assert.AreEqual(GROUP_ID_1, loadedSettings.EstateGroups[0]); 229 Assert.AreEqual(GROUP_ID_1, loadedSettings.EstateGroups[0]);
@@ -234,7 +234,7 @@ namespace OpenSim.Data.Tests
234 public void T022_EstateSettingsBanList() 234 public void T022_EstateSettingsBanList()
235 { 235 {
236 // Letting estate store generate rows to database for us 236 // Letting estate store generate rows to database for us
237 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID); 237 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
238 238
239 EstateBan estateBan1 = new EstateBan(); 239 EstateBan estateBan1 = new EstateBan();
240 estateBan1.BannedUserID = DataTestUtil.UUID_MIN; 240 estateBan1.BannedUserID = DataTestUtil.UUID_MIN;
@@ -248,7 +248,7 @@ namespace OpenSim.Data.Tests
248 db.StoreEstateSettings(originalSettings); 248 db.StoreEstateSettings(originalSettings);
249 249
250 // Loading settings to another instance variable. 250 // Loading settings to another instance variable.
251 EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID); 251 EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID, true);
252 252
253 Assert.AreEqual(2, loadedSettings.EstateBans.Length); 253 Assert.AreEqual(2, loadedSettings.EstateBans.Length);
254 Assert.AreEqual(DataTestUtil.UUID_MIN, loadedSettings.EstateBans[0].BannedUserID); 254 Assert.AreEqual(DataTestUtil.UUID_MIN, loadedSettings.EstateBans[0].BannedUserID);
@@ -290,7 +290,7 @@ namespace OpenSim.Data.Tests
290 { 290 {
291 291
292 // Letting estate store generate rows to database for us 292 // Letting estate store generate rows to database for us
293 EstateSettings originalSettings = db.LoadEstateSettings(regionId); 293 EstateSettings originalSettings = db.LoadEstateSettings(regionId, true);
294 294
295 SetEstateSettings( 295 SetEstateSettings(
296 originalSettings, 296 originalSettings,
@@ -347,7 +347,7 @@ namespace OpenSim.Data.Tests
347 db.StoreEstateSettings(originalSettings); 347 db.StoreEstateSettings(originalSettings);
348 348
349 // Loading settings to another instance variable. 349 // Loading settings to another instance variable.
350 EstateSettings loadedSettings = db.LoadEstateSettings(regionId); 350 EstateSettings loadedSettings = db.LoadEstateSettings(regionId, true);
351 351
352 // Checking that loaded values are correct. 352 // Checking that loaded values are correct.
353 ValidateEstateSettings( 353 ValidateEstateSettings(
diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs
index b4b5808..2a495b0 100644
--- a/OpenSim/Framework/EstateSettings.cs
+++ b/OpenSim/Framework/EstateSettings.cs
@@ -35,7 +35,6 @@ namespace OpenSim.Framework
35 public class EstateSettings 35 public class EstateSettings
36 { 36 {
37 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 37 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
38 private readonly ConfigurationMember configMember;
39 38
40 public delegate void SaveDelegate(EstateSettings rs); 39 public delegate void SaveDelegate(EstateSettings rs);
41 40
@@ -43,7 +42,7 @@ namespace OpenSim.Framework
43 42
44 // Only the client uses these 43 // Only the client uses these
45 // 44 //
46 private uint m_EstateID = 100; 45 private uint m_EstateID = 0;
47 46
48 public uint EstateID 47 public uint EstateID
49 { 48 {
@@ -51,7 +50,7 @@ namespace OpenSim.Framework
51 set { m_EstateID = value; } 50 set { m_EstateID = value; }
52 } 51 }
53 52
54 private string m_EstateName; 53 private string m_EstateName = "My Estate";
55 54
56 public string EstateName 55 public string EstateName
57 { 56 {
@@ -59,7 +58,7 @@ namespace OpenSim.Framework
59 set { m_EstateName = value; } 58 set { m_EstateName = value; }
60 } 59 }
61 60
62 private uint m_ParentEstateID = 100; 61 private uint m_ParentEstateID = 1;
63 62
64 public uint ParentEstateID 63 public uint ParentEstateID
65 { 64 {
@@ -67,7 +66,7 @@ namespace OpenSim.Framework
67 set { m_ParentEstateID = value; } 66 set { m_ParentEstateID = value; }
68 } 67 }
69 68
70 private float m_BillableFactor; 69 private float m_BillableFactor = 0.0f;
71 70
72 public float BillableFactor 71 public float BillableFactor
73 { 72 {
@@ -75,7 +74,7 @@ namespace OpenSim.Framework
75 set { m_BillableFactor = value; } 74 set { m_BillableFactor = value; }
76 } 75 }
77 76
78 private int m_PricePerMeter; 77 private int m_PricePerMeter = 1;
79 78
80 public int PricePerMeter 79 public int PricePerMeter
81 { 80 {
@@ -83,7 +82,7 @@ namespace OpenSim.Framework
83 set { m_PricePerMeter = value; } 82 set { m_PricePerMeter = value; }
84 } 83 }
85 84
86 private int m_RedirectGridX; 85 private int m_RedirectGridX = 0;
87 86
88 public int RedirectGridX 87 public int RedirectGridX
89 { 88 {
@@ -91,7 +90,7 @@ namespace OpenSim.Framework
91 set { m_RedirectGridX = value; } 90 set { m_RedirectGridX = value; }
92 } 91 }
93 92
94 private int m_RedirectGridY; 93 private int m_RedirectGridY = 0;
95 94
96 public int RedirectGridY 95 public int RedirectGridY
97 { 96 {
@@ -273,25 +272,6 @@ namespace OpenSim.Framework
273 272
274 public EstateSettings() 273 public EstateSettings()
275 { 274 {
276 if (configMember == null)
277 {
278 try
279 {
280 // Load legacy defaults
281 //
282 configMember =
283 new ConfigurationMember(Path.Combine(Util.configDir(),
284 "estate_settings.xml"), "ESTATE SETTINGS",
285 loadConfigurationOptions,
286 handleIncomingConfiguration, true);
287
288 l_EstateManagers.Clear();
289 configMember.performConfigurationRetrieve();
290 }
291 catch (Exception)
292 {
293 }
294 }
295 } 275 }
296 276
297 public void Save() 277 public void Save()
@@ -393,165 +373,5 @@ namespace OpenSim.Framework
393 373
394 return l_EstateAccess.Contains(user); 374 return l_EstateAccess.Contains(user);
395 } 375 }
396
397 public void loadConfigurationOptions()
398 {
399 configMember.addConfigurationOption("billable_factor",
400 ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
401 String.Empty, "0.0", true);
402
403// configMember.addConfigurationOption("estate_id",
404// ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
405// String.Empty, "100", true);
406
407// configMember.addConfigurationOption("parent_estate_id",
408// ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
409// String.Empty, "1", true);
410
411 configMember.addConfigurationOption("redirect_grid_x",
412 ConfigurationOption.ConfigurationTypes.TYPE_INT32,
413 String.Empty, "0", true);
414
415 configMember.addConfigurationOption("redirect_grid_y",
416 ConfigurationOption.ConfigurationTypes.TYPE_INT32,
417 String.Empty, "0", true);
418
419 configMember.addConfigurationOption("price_per_meter",
420 ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
421 String.Empty, "1", true);
422
423 configMember.addConfigurationOption("estate_name",
424 ConfigurationOption.ConfigurationTypes.TYPE_STRING,
425 String.Empty, "My Estate", true);
426
427 configMember.addConfigurationOption("estate_manager_0",
428 ConfigurationOption.ConfigurationTypes.TYPE_UUID,
429 String.Empty, "00000000-0000-0000-0000-000000000000", true);
430
431 configMember.addConfigurationOption("estate_manager_1",
432 ConfigurationOption.ConfigurationTypes.TYPE_UUID,
433 String.Empty, "00000000-0000-0000-0000-000000000000", true);
434
435 configMember.addConfigurationOption("estate_manager_2",
436 ConfigurationOption.ConfigurationTypes.TYPE_UUID,
437 String.Empty, "00000000-0000-0000-0000-000000000000", true);
438
439 configMember.addConfigurationOption("estate_manager_3",
440 ConfigurationOption.ConfigurationTypes.TYPE_UUID,
441 String.Empty, "00000000-0000-0000-0000-000000000000", true);
442
443 configMember.addConfigurationOption("estate_manager_4",
444 ConfigurationOption.ConfigurationTypes.TYPE_UUID,
445 String.Empty, "00000000-0000-0000-0000-000000000000", true);
446
447 configMember.addConfigurationOption("estate_manager_5",
448 ConfigurationOption.ConfigurationTypes.TYPE_UUID,
449 String.Empty, "00000000-0000-0000-0000-000000000000", true);
450
451 configMember.addConfigurationOption("estate_manager_6",
452 ConfigurationOption.ConfigurationTypes.TYPE_UUID,
453 String.Empty, "00000000-0000-0000-0000-000000000000", true);
454
455 configMember.addConfigurationOption("estate_manager_7",
456 ConfigurationOption.ConfigurationTypes.TYPE_UUID,
457 String.Empty, "00000000-0000-0000-0000-000000000000", true);
458
459 configMember.addConfigurationOption("estate_manager_8",
460 ConfigurationOption.ConfigurationTypes.TYPE_UUID,
461 String.Empty, "00000000-0000-0000-0000-000000000000", true);
462
463 configMember.addConfigurationOption("estate_manager_9",
464 ConfigurationOption.ConfigurationTypes.TYPE_UUID,
465 String.Empty, "00000000-0000-0000-0000-000000000000", true);
466
467 configMember.addConfigurationOption("region_flags",
468 ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
469 String.Empty, "336723974", true);
470 }
471
472 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
473 {
474 switch (configuration_key)
475 {
476 case "region_flags":
477 RegionFlags flags = (RegionFlags)(uint)configuration_result;
478 if ((flags & (RegionFlags)(1<<29)) != 0)
479 m_AllowVoice = true;
480 if ((flags & RegionFlags.AllowDirectTeleport) != 0)
481 m_AllowDirectTeleport = true;
482 if ((flags & RegionFlags.DenyAnonymous) != 0)
483 m_DenyAnonymous = true;
484 if ((flags & RegionFlags.DenyIdentified) != 0)
485 m_DenyIdentified = true;
486 if ((flags & RegionFlags.DenyTransacted) != 0)
487 m_DenyTransacted = true;
488 if ((flags & RegionFlags.AbuseEmailToEstateOwner) != 0)
489 m_AbuseEmailToEstateOwner = true;
490 if ((flags & RegionFlags.BlockDwell) != 0)
491 m_BlockDwell = true;
492 if ((flags & RegionFlags.EstateSkipScripts) != 0)
493 m_EstateSkipScripts = true;
494 if ((flags & RegionFlags.ResetHomeOnTeleport) != 0)
495 m_ResetHomeOnTeleport = true;
496 if ((flags & RegionFlags.TaxFree) != 0)
497 m_TaxFree = true;
498 if ((flags & RegionFlags.PublicAllowed) != 0)
499 m_PublicAccess = true;
500 break;
501 case "billable_factor":
502 m_BillableFactor = (float) configuration_result;
503 break;
504// case "estate_id":
505// m_EstateID = (uint) configuration_result;
506// break;
507// case "parent_estate_id":
508// m_ParentEstateID = (uint) configuration_result;
509// break;
510 case "redirect_grid_x":
511 m_RedirectGridX = (int) configuration_result;
512 break;
513 case "redirect_grid_y":
514 m_RedirectGridY = (int) configuration_result;
515 break;
516 case "price_per_meter":
517 m_PricePerMeter = Convert.ToInt32(configuration_result);
518 break;
519 case "estate_name":
520 m_EstateName = (string) configuration_result;
521 break;
522 case "estate_manager_0":
523 AddEstateManager((UUID)configuration_result);
524 break;
525 case "estate_manager_1":
526 AddEstateManager((UUID)configuration_result);
527 break;
528 case "estate_manager_2":
529 AddEstateManager((UUID)configuration_result);
530 break;
531 case "estate_manager_3":
532 AddEstateManager((UUID)configuration_result);
533 break;
534 case "estate_manager_4":
535 AddEstateManager((UUID)configuration_result);
536 break;
537 case "estate_manager_5":
538 AddEstateManager((UUID)configuration_result);
539 break;
540 case "estate_manager_6":
541 AddEstateManager((UUID)configuration_result);
542 break;
543 case "estate_manager_7":
544 AddEstateManager((UUID)configuration_result);
545 break;
546 case "estate_manager_8":
547 AddEstateManager((UUID)configuration_result);
548 break;
549 case "estate_manager_9":
550 AddEstateManager((UUID)configuration_result);
551 break;
552 }
553
554 return true;
555 }
556 } 376 }
557} 377}
diff --git a/OpenSim/Framework/GroupData.cs b/OpenSim/Framework/GroupData.cs
index e3b8626..815946c 100644
--- a/OpenSim/Framework/GroupData.cs
+++ b/OpenSim/Framework/GroupData.cs
@@ -48,7 +48,6 @@ namespace OpenSim.Framework
48 public class GroupMembershipData 48 public class GroupMembershipData
49 { 49 {
50 // Group base data 50 // Group base data
51 //
52 public UUID GroupID; 51 public UUID GroupID;
53 public string GroupName; 52 public string GroupName;
54 public bool AllowPublish = true; 53 public bool AllowPublish = true;
@@ -61,7 +60,6 @@ namespace OpenSim.Framework
61 public bool ShowInList = true; 60 public bool ShowInList = true;
62 61
63 // Per user data 62 // Per user data
64 //
65 public bool AcceptNotices = true; 63 public bool AcceptNotices = true;
66 public int Contribution = 0; 64 public int Contribution = 0;
67 public ulong GroupPowers = 0; 65 public ulong GroupPowers = 0;
diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs
index 86d63f8..19ab409 100644
--- a/OpenSim/Framework/IScene.cs
+++ b/OpenSim/Framework/IScene.cs
@@ -91,7 +91,7 @@ namespace OpenSim.Framework
91 /// </exception> 91 /// </exception>
92 bool PresenceChildStatus(UUID agentId); 92 bool PresenceChildStatus(UUID agentId);
93 93
94 bool TryGetAvatar(UUID agentID, out object scenePresence); 94 bool TryGetScenePresence(UUID agentID, out object scenePresence);
95 95
96 T RequestModuleInterface<T>(); 96 T RequestModuleInterface<T>();
97 T[] RequestModuleInterfaces<T>(); 97 T[] RequestModuleInterfaces<T>();
diff --git a/OpenSim/Framework/MainServer.cs b/OpenSim/Framework/MainServer.cs
index 84cc05e..1f5f208 100644
--- a/OpenSim/Framework/MainServer.cs
+++ b/OpenSim/Framework/MainServer.cs
@@ -25,13 +25,17 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using OpenSim.Framework.Servers.HttpServer;
29using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Reflection;
30using log4net;
31using OpenSim.Framework.Servers.HttpServer;
30 32
31namespace OpenSim.Framework 33namespace OpenSim.Framework
32{ 34{
33 public class MainServer 35 public class MainServer
34 { 36 {
37 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
38
35 private static BaseHttpServer instance = null; 39 private static BaseHttpServer instance = null;
36 private static Dictionary<uint, BaseHttpServer> m_Servers = 40 private static Dictionary<uint, BaseHttpServer> m_Servers =
37 new Dictionary<uint, BaseHttpServer>(); 41 new Dictionary<uint, BaseHttpServer>();
@@ -53,6 +57,8 @@ namespace OpenSim.Framework
53 return m_Servers[port]; 57 return m_Servers[port];
54 58
55 m_Servers[port] = new BaseHttpServer(port); 59 m_Servers[port] = new BaseHttpServer(port);
60
61 m_log.InfoFormat("[MAIN HTTP SERVER]: Starting main http server on port {0}", port);
56 m_Servers[port].Start(); 62 m_Servers[port].Start();
57 63
58 return m_Servers[port]; 64 return m_Servers[port];
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 350c041..a6e00c2 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -310,7 +310,7 @@ namespace OpenSim.Framework.Servers.HttpServer
310 } 310 }
311 catch (Exception e) 311 catch (Exception e)
312 { 312 {
313 m_log.ErrorFormat("[BASE HTTP SERVER]: OnRequest() failed with {0} {1}", e.Message, e.StackTrace); 313 m_log.Error(string.Format("[BASE HTTP SERVER]: OnRequest() failed with "), e);
314 } 314 }
315 } 315 }
316 316
@@ -1580,7 +1580,6 @@ namespace OpenSim.Framework.Servers.HttpServer
1580 1580
1581 public void Start() 1581 public void Start()
1582 { 1582 {
1583 m_log.Info("[BASE HTTP SERVER]: Starting up HTTP Server");
1584 StartHTTP(); 1583 StartHTTP();
1585 } 1584 }
1586 1585
@@ -1588,7 +1587,6 @@ namespace OpenSim.Framework.Servers.HttpServer
1588 { 1587 {
1589 try 1588 try
1590 { 1589 {
1591 m_log.Debug("[BASE HTTP SERVER]: Spawned main thread OK");
1592 //m_httpListener = new HttpListener(); 1590 //m_httpListener = new HttpListener();
1593 NotSocketErrors = 0; 1591 NotSocketErrors = 0;
1594 if (!m_ssl) 1592 if (!m_ssl)
diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs
index f618047..cd2f384 100644
--- a/OpenSim/Framework/Servers/VersionInfo.cs
+++ b/OpenSim/Framework/Servers/VersionInfo.cs
@@ -29,7 +29,7 @@ namespace OpenSim
29{ 29{
30 public class VersionInfo 30 public class VersionInfo
31 { 31 {
32 private const string VERSION_NUMBER = "0.6.8CM"; 32 private const string VERSION_NUMBER = "0.7CM";
33 private const Flavour VERSION_FLAVOUR = Flavour.Dev; 33 private const Flavour VERSION_FLAVOUR = Flavour.Dev;
34 public enum Flavour 34 public enum Flavour
35 { 35 {
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index 16e44af..2843e20 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -263,8 +263,12 @@ namespace OpenSim.Framework
263 263
264 foreach (string key in parameters.Keys) 264 foreach (string key in parameters.Keys)
265 { 265 {
266 foreach (string value in parameters.GetValues(key)) 266 string[] values = parameters.GetValues(key);
267 items.Add(String.Concat(key, "=", HttpUtility.UrlEncode(value ?? String.Empty))); 267 if (values != null)
268 {
269 foreach (string value in values)
270 items.Add(String.Concat(key, "=", HttpUtility.UrlEncode(value ?? String.Empty)));
271 }
268 } 272 }
269 273
270 return String.Join("&", items.ToArray()); 274 return String.Join("&", items.ToArray());
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 8cd47fb..0762ed0 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -40,7 +40,6 @@ using OpenMetaverse.Packets;
40using OpenMetaverse.StructuredData; 40using OpenMetaverse.StructuredData;
41using OpenSim.Framework; 41using OpenSim.Framework;
42using OpenSim.Framework.Client; 42using OpenSim.Framework.Client;
43
44using OpenSim.Framework.Statistics; 43using OpenSim.Framework.Statistics;
45using OpenSim.Region.Framework.Interfaces; 44using OpenSim.Region.Framework.Interfaces;
46using OpenSim.Region.Framework.Scenes; 45using OpenSim.Region.Framework.Scenes;
@@ -353,6 +352,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
353 protected PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_avatarTerseUpdates; 352 protected PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_avatarTerseUpdates;
354 private PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_primTerseUpdates; 353 private PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_primTerseUpdates;
355 private PriorityQueue<double, ObjectUpdatePacket.ObjectDataBlock> m_primFullUpdates; 354 private PriorityQueue<double, ObjectUpdatePacket.ObjectDataBlock> m_primFullUpdates;
355
356 /// <value>
357 /// List used in construction of data blocks for an object update packet. This is to stop us having to
358 /// continually recreate it.
359 /// </value>
360 protected List<ObjectUpdatePacket.ObjectDataBlock> m_fullUpdateDataBlocksBuilder;
361
362 /// <value>
363 /// Maintain a record of all the objects killed. This allows us to stop an update being sent from the
364 /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an
365 /// ownerless phantom.
366 ///
367 /// All manipulation of this set has to occur under a m_primFullUpdate.SyncRoot lock
368 ///
369 /// </value>
370 protected HashSet<uint> m_killRecord;
371
356 private int m_moneyBalance; 372 private int m_moneyBalance;
357 private int m_animationSequenceNumber = 1; 373 private int m_animationSequenceNumber = 1;
358 private bool m_SendLogoutPacketWhenClosing = true; 374 private bool m_SendLogoutPacketWhenClosing = true;
@@ -449,6 +465,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
449 m_avatarTerseUpdates = new PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(); 465 m_avatarTerseUpdates = new PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock>();
450 m_primTerseUpdates = new PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(); 466 m_primTerseUpdates = new PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock>();
451 m_primFullUpdates = new PriorityQueue<double, ObjectUpdatePacket.ObjectDataBlock>(m_scene.Entities.Count); 467 m_primFullUpdates = new PriorityQueue<double, ObjectUpdatePacket.ObjectDataBlock>(m_scene.Entities.Count);
468 m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>();
469 m_killRecord = new HashSet<uint>();
452 470
453 m_assetService = m_scene.RequestModuleInterface<IAssetService>(); 471 m_assetService = m_scene.RequestModuleInterface<IAssetService>();
454 m_hyperAssets = m_scene.RequestModuleInterface<IHyperAssetService>(); 472 m_hyperAssets = m_scene.RequestModuleInterface<IHyperAssetService>();
@@ -1474,7 +1492,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1474 kill.ObjectData[0].ID = localID; 1492 kill.ObjectData[0].ID = localID;
1475 kill.Header.Reliable = true; 1493 kill.Header.Reliable = true;
1476 kill.Header.Zerocoded = true; 1494 kill.Header.Zerocoded = true;
1477 OutPacket(kill, ThrottleOutPacketType.State); 1495
1496 lock (m_primFullUpdates.SyncRoot)
1497 {
1498 m_killRecord.Add(localID);
1499 OutPacket(kill, ThrottleOutPacketType.State);
1500 }
1478 } 1501 }
1479 1502
1480 /// <summary> 1503 /// <summary>
@@ -3521,21 +3544,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3521 if (count == 0) 3544 if (count == 0)
3522 return; 3545 return;
3523 3546
3524 outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[count]; 3547 m_fullUpdateDataBlocksBuilder.Clear();
3548
3525 for (int i = 0; i < count; i++) 3549 for (int i = 0; i < count; i++)
3526 { 3550 {
3527 outPacket.ObjectData[i] = m_primFullUpdates.Dequeue(); 3551 ObjectUpdatePacket.ObjectDataBlock block = m_primFullUpdates.Dequeue();
3528 3552
3553 if (!m_killRecord.Contains(block.ID))
3554 {
3555 m_fullUpdateDataBlocksBuilder.Add(block);
3556
3529// string text = Util.FieldToString(outPacket.ObjectData[i].Text); 3557// string text = Util.FieldToString(outPacket.ObjectData[i].Text);
3530// if (text.IndexOf("\n") >= 0) 3558// if (text.IndexOf("\n") >= 0)
3531// text = text.Remove(text.IndexOf("\n")); 3559// text = text.Remove(text.IndexOf("\n"));
3532// m_log.DebugFormat( 3560// m_log.DebugFormat(
3533// "[CLIENT]: Sending full info about prim {0} text {1} to client {2}", 3561// "[CLIENT]: Sending full info about prim {0} text {1} to client {2}",
3534// outPacket.ObjectData[i].ID, text, Name); 3562// outPacket.ObjectData[i].ID, text, Name);
3563 }
3564// else
3565// {
3566// m_log.WarnFormat(
3567// "[CLIENT]: Preventing full update for {0} after kill to {1}", block.ID, Name);
3568// }
3535 } 3569 }
3536 }
3537 3570
3538 OutPacket(outPacket, ThrottleOutPacketType.State); 3571 outPacket.ObjectData = m_fullUpdateDataBlocksBuilder.ToArray();
3572
3573 OutPacket(outPacket, ThrottleOutPacketType.State);
3574 }
3539 } 3575 }
3540 3576
3541 public void SendPrimTerseUpdate(SendPrimitiveTerseData data) 3577 public void SendPrimTerseUpdate(SendPrimitiveTerseData data)
@@ -5965,7 +6001,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5965 || avSetStartLocationRequestPacket.StartLocationData.LocationPos.Y == 255.5f) 6001 || avSetStartLocationRequestPacket.StartLocationData.LocationPos.Y == 255.5f)
5966 { 6002 {
5967 ScenePresence avatar = null; 6003 ScenePresence avatar = null;
5968 if (((Scene)m_scene).TryGetAvatar(AgentId, out avatar)) 6004 if (((Scene)m_scene).TryGetScenePresence(AgentId, out avatar))
5969 { 6005 {
5970 if (avSetStartLocationRequestPacket.StartLocationData.LocationPos.X == 255.5f) 6006 if (avSetStartLocationRequestPacket.StartLocationData.LocationPos.X == 255.5f)
5971 { 6007 {
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
index 0ec87e5..e683821 100644
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
@@ -98,10 +98,10 @@ namespace OpenSim.Region.ClientStack
98 98
99 if (m_networkServersInfo.HttpUsesSSL && (m_networkServersInfo.HttpListenerPort == m_networkServersInfo.httpSSLPort)) 99 if (m_networkServersInfo.HttpUsesSSL && (m_networkServersInfo.HttpListenerPort == m_networkServersInfo.httpSSLPort))
100 { 100 {
101 m_log.Error("[HTTP]: HTTP Server config failed. HTTP Server and HTTPS server must be on different ports"); 101 m_log.Error("[REGION SERVER]: HTTP Server config failed. HTTP Server and HTTPS server must be on different ports");
102 } 102 }
103 103
104 m_log.Info("[REGION]: Starting HTTP server"); 104 m_log.InfoFormat("[REGION SERVER]: Starting HTTP server on port {0}", m_httpServerPort);
105 m_httpServer.Start(); 105 m_httpServer.Start();
106 106
107 MainServer.Instance = m_httpServer; 107 MainServer.Instance = m_httpServer;
@@ -129,4 +129,4 @@ namespace OpenSim.Region.ClientStack
129 return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier); 129 return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier);
130 } 130 }
131 } 131 }
132} 132} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index f54e41a..23828ef 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -86,7 +86,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
86 86
87 // Save avatar attachment information 87 // Save avatar attachment information
88 ScenePresence presence; 88 ScenePresence presence;
89 if (m_scene.AvatarFactory != null && m_scene.TryGetAvatar(remoteClient.AgentId, out presence)) 89 if (m_scene.AvatarFactory != null && m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
90 { 90 {
91 m_log.Info( 91 m_log.Info(
92 "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId 92 "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
@@ -255,7 +255,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
255 AttachmentPt = att.RootPart.AttachmentPoint; 255 AttachmentPt = att.RootPart.AttachmentPoint;
256 256
257 ScenePresence presence; 257 ScenePresence presence;
258 if (m_scene.TryGetAvatar(remoteClient.AgentId, out presence)) 258 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
259 { 259 {
260 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); 260 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
261 item = m_scene.InventoryService.GetItem(item); 261 item = m_scene.InventoryService.GetItem(item);
@@ -299,7 +299,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
299 } 299 }
300 300
301 ScenePresence presence; 301 ScenePresence presence;
302 if (m_scene.TryGetAvatar(remoteClient.AgentId, out presence)) 302 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
303 { 303 {
304 // XXYY!! 304 // XXYY!!
305 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); 305 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
@@ -314,7 +314,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
314 public void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient) 314 public void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient)
315 { 315 {
316 ScenePresence presence; 316 ScenePresence presence;
317 if (m_scene.TryGetAvatar(remoteClient.AgentId, out presence)) 317 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
318 { 318 {
319 presence.Appearance.DetachAttachment(itemID); 319 presence.Appearance.DetachAttachment(itemID);
320 320
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index 71b3062..f570999 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -388,7 +388,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
388 388
389 try 389 try
390 { 390 {
391 if (m_aScene.AuthenticationService.Authenticate(account.PrincipalID, pass, 1) != string.Empty) 391 string encpass = Util.Md5Hash(pass);
392 if (m_aScene.AuthenticationService.Authenticate(account.PrincipalID, encpass, 1) != string.Empty)
392 { 393 {
393 return account; 394 return account;
394 } 395 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index 09552a8..7142442 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -358,7 +358,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
358 { 358 {
359 ScenePresence presence; 359 ScenePresence presence;
360 360
361 if (s.TryGetAvatar(agentID, out presence)) 361 if (s.TryGetScenePresence(agentID, out presence))
362 { 362 {
363 // If the agent is in this scene, then we 363 // If the agent is in this scene, then we
364 // are being called twice in a single 364 // are being called twice in a single
diff --git a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs
index 63a93aa..c011776 100644
--- a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs
+++ b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs
@@ -82,7 +82,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
82 responsedata["str_response_string"] = "Request wasn't what was expected"; 82 responsedata["str_response_string"] = "Request wasn't what was expected";
83 ScenePresence avatar; 83 ScenePresence avatar;
84 84
85 if (!m_scene.TryGetAvatar(AgentId, out avatar)) 85 if (!m_scene.TryGetScenePresence(AgentId, out avatar))
86 return responsedata; 86 return responsedata;
87 87
88 88
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
index 25f5154..93aeb94 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
@@ -190,7 +190,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
190 if (account == null) // foreign 190 if (account == null) // foreign
191 { 191 {
192 ScenePresence sp = null; 192 ScenePresence sp = null;
193 if (m_Scene.TryGetAvatar(userID, out sp)) 193 if (m_Scene.TryGetScenePresence(userID, out sp))
194 { 194 {
195 AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); 195 AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
196 if (aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) 196 if (aCircuit.ServiceURLs.ContainsKey("AssetServerURI"))
diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
index 8cf4619..e95d2f8 100644
--- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
+++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
@@ -1206,7 +1206,7 @@ namespace OpenSim.Region.CoreModules.InterGrid
1206 { 1206 {
1207 Scene homeScene = GetRootScene(); 1207 Scene homeScene = GetRootScene();
1208 ScenePresence avatar = null; 1208 ScenePresence avatar = null;
1209 if (homeScene.TryGetAvatar(avatarId,out avatar)) 1209 if (homeScene.TryGetScenePresence(avatarId,out avatar))
1210 { 1210 {
1211 KillAUser ku = new KillAUser(avatar,mod); 1211 KillAUser ku = new KillAUser(avatar,mod);
1212 Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true); 1212 Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true);
diff --git a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
index 27b64bf..40ffcb4 100644
--- a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
@@ -131,8 +131,8 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
131 { 131 {
132 // Start http server 132 // Start http server
133 // Attach xmlrpc handlers 133 // Attach xmlrpc handlers
134 m_log.Info("[REMOTE_DATA]: " + 134 m_log.Info("[XML RPC MODULE]: " +
135 "Starting XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands."); 135 "Starting up XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands.");
136 BaseHttpServer httpServer = new BaseHttpServer((uint) m_remoteDataPort); 136 BaseHttpServer httpServer = new BaseHttpServer((uint) m_remoteDataPort);
137 httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData); 137 httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData);
138 httpServer.Start(); 138 httpServer.Start();
@@ -192,7 +192,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
192 // This should no longer happen, but the check is reasonable anyway 192 // This should no longer happen, but the check is reasonable anyway
193 if (null == m_openChannels) 193 if (null == m_openChannels)
194 { 194 {
195 m_log.Warn("[RemoteDataReply] Attempt to open channel before initialization is complete"); 195 m_log.Warn("[XML RPC MODULE]: Attempt to open channel before initialization is complete");
196 return newChannel; 196 return newChannel;
197 } 197 }
198 198
@@ -279,7 +279,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
279 } 279 }
280 else 280 else
281 { 281 {
282 m_log.Warn("[RemoteDataReply]: Channel or message_id not found"); 282 m_log.Warn("[XML RPC MODULE]: Channel or message_id not found");
283 } 283 }
284 } 284 }
285 285
@@ -340,7 +340,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
340 } 340 }
341 else 341 else
342 { 342 {
343 m_log.Error("UNABLE TO REMOVE COMPLETED REQUEST"); 343 m_log.Error("[XML RPC MODULE]: UNABLE TO REMOVE COMPLETED REQUEST");
344 } 344 }
345 } 345 }
346 } 346 }
@@ -728,4 +728,4 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
728 return ReqID; 728 return ReqID;
729 } 729 }
730 } 730 }
731} 731} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index c6312e0..54508cc 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -502,7 +502,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
502 private UUID GetSessionID(UUID userID) 502 private UUID GetSessionID(UUID userID)
503 { 503 {
504 ScenePresence sp = null; 504 ScenePresence sp = null;
505 if (m_Scene.TryGetAvatar(userID, out sp)) 505 if (m_Scene.TryGetScenePresence(userID, out sp))
506 { 506 {
507 return sp.ControllingClient.SessionId; 507 return sp.ControllingClient.SessionId;
508 } 508 }
@@ -521,7 +521,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
521 if (account == null) // foreign user 521 if (account == null) // foreign user
522 { 522 {
523 ScenePresence sp = null; 523 ScenePresence sp = null;
524 m_Scene.TryGetAvatar(userID, out sp); 524 m_Scene.TryGetScenePresence(userID, out sp);
525 if (sp != null) 525 if (sp != null)
526 { 526 {
527 AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); 527 AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
index 3c3534f..5e06580 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
@@ -100,7 +100,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
100 ScenePresence sp = null; 100 ScenePresence sp = null;
101 foreach (Scene s in m_Scenes) 101 foreach (Scene s in m_Scenes)
102 { 102 {
103 s.TryGetAvatar(clientID, out sp); 103 s.TryGetScenePresence(clientID, out sp);
104 if ((sp != null) && !sp.IsChildAgent && (s != scene)) 104 if ((sp != null) && !sp.IsChildAgent && (s != scene))
105 { 105 {
106 m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, but user {1} still in sim. Keeping system folders in cache", 106 m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, but user {1} still in sim. Keeping system folders in cache",
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs
index e98df28..7a75a89 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs
@@ -88,7 +88,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
88 Vector3 position = new Vector3(128, 128, 0); 88 Vector3 position = new Vector3(128, 128, 0);
89 Vector3 lookat = new Vector3(0, 1, 0); 89 Vector3 lookat = new Vector3(0, 1, 0);
90 90
91 if (client.Scene.TryGetAvatar(client.AgentId, out sp)) 91 if (client.Scene.TryGetScenePresence(client.AgentId, out sp))
92 { 92 {
93 if (sp is ScenePresence) 93 if (sp is ScenePresence)
94 { 94 {
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 464d922..91d40ab 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -468,26 +468,20 @@ namespace OpenSim.Region.CoreModules.World.Estate
468 468
469 private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID) 469 private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID)
470 { 470 {
471 // Get a fresh list that will not change as people get teleported away 471 m_scene.ForEachScenePresence(delegate(ScenePresence sp)
472 List<ScenePresence> presences = m_scene.GetScenePresences();
473
474 foreach(ScenePresence p in presences)
475 { 472 {
476 if (p.UUID != senderID) 473 if (sp.UUID != senderID)
477 { 474 {
475 ScenePresence p = m_scene.GetScenePresence(sp.UUID);
478 // make sure they are still there, we could be working down a long list 476 // make sure they are still there, we could be working down a long list
479 ScenePresence s = m_scene.GetScenePresence(p.UUID); 477 // Also make sure they are actually in the region
480 if (s != null) 478 if (p != null && !p.IsChildAgent)
481 { 479 {
482 // Also make sure they are actually in the region 480 p.ControllingClient.SendTeleportLocationStart();
483 if (!s.IsChildAgent) 481 m_scene.TeleportClientHome(p.UUID, p.ControllingClient);
484 {
485 s.ControllingClient.SendTeleportLocationStart();
486 m_scene.TeleportClientHome(s.UUID, s.ControllingClient);
487 }
488 } 482 }
489 } 483 }
490 } 484 });
491 } 485 }
492 private void AbortTerrainXferHandler(IClientAPI remoteClient, ulong XferID) 486 private void AbortTerrainXferHandler(IClientAPI remoteClient, ulong XferID)
493 { 487 {
@@ -765,12 +759,11 @@ namespace OpenSim.Region.CoreModules.World.Estate
765 759
766 public void sendRegionInfoPacketToAll() 760 public void sendRegionInfoPacketToAll()
767 { 761 {
768 List<ScenePresence> avatars = m_scene.GetAvatars(); 762 m_scene.ForEachScenePresence(delegate(ScenePresence sp)
769
770 for (int i = 0; i < avatars.Count; i++)
771 { 763 {
772 HandleRegionInfoRequest(avatars[i].ControllingClient); 764 if (!sp.IsChildAgent)
773 } 765 HandleRegionInfoRequest(sp.ControllingClient);
766 });
774 } 767 }
775 768
776 public void sendRegionHandshake(IClientAPI remoteClient) 769 public void sendRegionHandshake(IClientAPI remoteClient)
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index bf856c8..b6afac6 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -199,9 +199,9 @@ namespace OpenSim.Region.CoreModules.World.Land
199 forcedPosition = null; 199 forcedPosition = null;
200 } 200 }
201 //if we are far away, teleport 201 //if we are far away, teleport
202 else if (Vector3.Distance(clientAvatar.AbsolutePosition,forcedPosition.Value) > 3) 202 else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition.Value) > 3)
203 { 203 {
204 Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}",forcedPosition.Value,clientAvatar.AbsolutePosition)); 204 Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition.Value, clientAvatar.AbsolutePosition));
205 clientAvatar.Teleport(forcedPosition.Value); 205 clientAvatar.Teleport(forcedPosition.Value);
206 forcedPosition = null; 206 forcedPosition = null;
207 } 207 }
@@ -382,30 +382,27 @@ namespace OpenSim.Region.CoreModules.World.Land
382 } 382 }
383 } 383 }
384 384
385 public void SendOutNearestBanLine(IClientAPI avatar) 385 public void SendOutNearestBanLine(IClientAPI client)
386 { 386 {
387 List<ScenePresence> avatars = m_scene.GetAvatars(); 387 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
388 foreach (ScenePresence presence in avatars) 388 if (sp == null || sp.IsChildAgent)
389 return;
390
391 List<ILandObject> checkLandParcels = ParcelsNearPoint(sp.AbsolutePosition);
392 foreach (ILandObject checkBan in checkLandParcels)
389 { 393 {
390 if (presence.UUID == avatar.AgentId) 394 if (checkBan.IsBannedFromLand(client.AgentId))
391 { 395 {
392 List<ILandObject> checkLandParcels = ParcelsNearPoint(presence.AbsolutePosition); 396 checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionBanned, false, (int)ParcelResult.Single, client);
393 foreach (ILandObject checkBan in checkLandParcels) 397 return; //Only send one
394 { 398 }
395 if (checkBan.IsBannedFromLand(avatar.AgentId)) 399 if (checkBan.IsRestrictedFromLand(client.AgentId))
396 { 400 {
397 checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionBanned, false, (int)ParcelResult.Single, avatar); 401 checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList, false, (int)ParcelResult.Single, client);
398 return; //Only send one 402 return; //Only send one
399 }
400 if (checkBan.IsRestrictedFromLand(avatar.AgentId))
401 {
402 checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList, false, (int)ParcelResult.Single, avatar);
403 return; //Only send one
404 }
405 }
406 return;
407 } 403 }
408 } 404 }
405 return;
409 } 406 }
410 407
411 public void SendLandUpdate(ScenePresence avatar, bool force) 408 public void SendLandUpdate(ScenePresence avatar, bool force)
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 331f183..aca5514 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -332,36 +332,38 @@ namespace OpenSim.Region.CoreModules.World.Land
332 332
333 public void SendLandUpdateToAvatarsOverMe(bool snap_selection) 333 public void SendLandUpdateToAvatarsOverMe(bool snap_selection)
334 { 334 {
335 List<ScenePresence> avatars = m_scene.GetAvatars(); 335 m_scene.ForEachScenePresence(delegate(ScenePresence avatar)
336 ILandObject over = null;
337 for (int i = 0; i < avatars.Count; i++)
338 { 336 {
337 if (avatar.IsChildAgent)
338 return;
339
340 ILandObject over = null;
339 try 341 try
340 { 342 {
341 over = 343 over =
342 m_scene.LandChannel.GetLandObject(Util.Clamp<int>((int)Math.Round(avatars[i].AbsolutePosition.X), 0, ((int)Constants.RegionSize - 1)), 344 m_scene.LandChannel.GetLandObject(Util.Clamp<int>((int)Math.Round(avatar.AbsolutePosition.X), 0, ((int)Constants.RegionSize - 1)),
343 Util.Clamp<int>((int)Math.Round(avatars[i].AbsolutePosition.Y), 0, ((int)Constants.RegionSize - 1))); 345 Util.Clamp<int>((int)Math.Round(avatar.AbsolutePosition.Y), 0, ((int)Constants.RegionSize - 1)));
344 } 346 }
345 catch (Exception) 347 catch (Exception)
346 { 348 {
347 m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatars[i].AbsolutePosition.X) + " y: " + 349 m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatar.AbsolutePosition.X) + " y: " +
348 Math.Round(avatars[i].AbsolutePosition.Y)); 350 Math.Round(avatar.AbsolutePosition.Y));
349 } 351 }
350 352
351 if (over != null) 353 if (over != null)
352 { 354 {
353 if (over.LandData.LocalID == LandData.LocalID) 355 if (over.LandData.LocalID == LandData.LocalID)
354 { 356 {
355 if (((over.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) && 357 if (((over.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) &&
356 m_scene.RegionInfo.RegionSettings.AllowDamage) 358 m_scene.RegionInfo.RegionSettings.AllowDamage)
357 avatars[i].Invulnerable = false; 359 avatar.Invulnerable = false;
358 else 360 else
359 avatars[i].Invulnerable = true; 361 avatar.Invulnerable = true;
360 362
361 SendLandUpdateToClient(snap_selection, avatars[i].ControllingClient); 363 SendLandUpdateToClient(snap_selection, avatar.ControllingClient);
362 } 364 }
363 } 365 }
364 } 366 });
365 } 367 }
366 368
367 #endregion 369 #endregion
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 4dbdb01..0f830e1 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -1324,9 +1324,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1324 1324
1325 // Group voodoo 1325 // Group voodoo
1326 // 1326 //
1327 if (land.LandData.IsGroupOwned) 1327 if (l.LandData.IsGroupOwned)
1328 { 1328 {
1329 powers = (GroupPowers)client.GetGroupPowers(land.LandData.GroupID); 1329 powers = (GroupPowers)client.GetGroupPowers(l.LandData.GroupID);
1330 // Not a group member, or no rights at all 1330 // Not a group member, or no rights at all
1331 // 1331 //
1332 if (powers == (GroupPowers)0) 1332 if (powers == (GroupPowers)0)
diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
index 1f5a4ff..a52fea4 100644
--- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
@@ -62,40 +62,46 @@ namespace OpenSim.Region.CoreModules.World.Sound
62 public virtual void PlayAttachedSound( 62 public virtual void PlayAttachedSound(
63 UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius) 63 UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius)
64 { 64 {
65 foreach (ScenePresence p in m_scene.GetAvatars()) 65 m_scene.ForEachScenePresence(delegate(ScenePresence sp)
66 { 66 {
67 double dis = Util.GetDistanceTo(p.AbsolutePosition, position); 67 if (sp.IsChildAgent)
68 return;
69
70 double dis = Util.GetDistanceTo(sp.AbsolutePosition, position);
68 if (dis > 100.0) // Max audio distance 71 if (dis > 100.0) // Max audio distance
69 continue; 72 return;
70 73
71 // Scale by distance 74 // Scale by distance
72 if (radius == 0) 75 if (radius == 0)
73 gain = (float)((double)gain * ((100.0 - dis) / 100.0)); 76 gain = (float)((double)gain * ((100.0 - dis) / 100.0));
74 else 77 else
75 gain = (float)((double)gain * ((radius - dis) / radius)); 78 gain = (float)((double)gain * ((radius - dis) / radius));
76 79
77 p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags); 80 sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags);
78 } 81 });
79 } 82 }
80 83
81 public virtual void TriggerSound( 84 public virtual void TriggerSound(
82 UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius) 85 UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius)
83 { 86 {
84 foreach (ScenePresence p in m_scene.GetAvatars()) 87 m_scene.ForEachScenePresence(delegate(ScenePresence sp)
85 { 88 {
86 double dis = Util.GetDistanceTo(p.AbsolutePosition, position); 89 if (sp.IsChildAgent)
90 return;
91
92 double dis = Util.GetDistanceTo(sp.AbsolutePosition, position);
87 if (dis > 100.0) // Max audio distance 93 if (dis > 100.0) // Max audio distance
88 continue; 94 return;
89 95
90 // Scale by distance 96 // Scale by distance
91 if (radius == 0) 97 if (radius == 0)
92 gain = (float)((double)gain * ((100.0 - dis) / 100.0)); 98 gain = (float)((double)gain * ((100.0 - dis) / 100.0));
93 else 99 else
94 gain = (float)((double)gain * ((radius - dis) / radius)); 100 gain = (float)((double)gain * ((radius - dis) / radius));
95 101
96 p.ControllingClient.SendTriggeredSound( 102 sp.ControllingClient.SendTriggeredSound(
97 soundId, ownerID, objectID, parentID, handle, position, (float)gain); 103 soundId, ownerID, objectID, parentID, handle, position, (float)gain);
98 } 104 });
99 } 105 }
100 } 106 }
101} 107}
diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
index 0712a7f..a6dc2ec 100644
--- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
@@ -509,14 +509,13 @@ namespace OpenSim.Region.CoreModules
509 509
510 private void SunUpdateToAllClients() 510 private void SunUpdateToAllClients()
511 { 511 {
512 List<ScenePresence> avatars = m_scene.GetAvatars(); 512 m_scene.ForEachScenePresence(delegate(ScenePresence sp)
513 foreach (ScenePresence avatar in avatars)
514 { 513 {
515 if (!avatar.IsChildAgent) 514 if (!sp.IsChildAgent)
516 { 515 {
517 SunToClient(avatar.ControllingClient); 516 SunToClient(sp.ControllingClient);
518 } 517 }
519 } 518 });
520 } 519 }
521 520
522 #region ISunModule Members 521 #region ISunModule Members
diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
index 3283c1f..9736b73 100644
--- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
+++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
@@ -425,9 +425,7 @@ namespace OpenSim.Region.CoreModules
425 { 425 {
426 if (m_ready) 426 if (m_ready)
427 { 427 {
428 List<ScenePresence> avatars = m_scene.GetAvatars(); 428 if(m_scene.GetRootAgentCount() > 0)
429
430 if (avatars.Count > 0)
431 { 429 {
432 // Ask wind plugin to generate a LL wind array to be cached locally 430 // Ask wind plugin to generate a LL wind array to be cached locally
433 // Try not to update this too often, as it may involve array copies 431 // Try not to update this too often, as it may involve array copies
@@ -437,11 +435,11 @@ namespace OpenSim.Region.CoreModules
437 m_frameLastUpdateClientArray = m_frame; 435 m_frameLastUpdateClientArray = m_frame;
438 } 436 }
439 437
440 foreach (ScenePresence avatar in avatars) 438 m_scene.ForEachScenePresence(delegate(ScenePresence sp)
441 { 439 {
442 if (!avatar.IsChildAgent) 440 if (!sp.IsChildAgent)
443 avatar.ControllingClient.SendWindData(windSpeeds); 441 sp.ControllingClient.SendWindData(windSpeeds);
444 } 442 });
445 } 443 }
446 } 444 }
447 } 445 }
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index b63d014..2b0e83f 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -210,7 +210,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
210 // this is here because CAPS map requests work even beyond the 10,000 limit. 210 // this is here because CAPS map requests work even beyond the 10,000 limit.
211 ScenePresence avatarPresence = null; 211 ScenePresence avatarPresence = null;
212 212
213 m_scene.TryGetAvatar(agentID, out avatarPresence); 213 m_scene.TryGetScenePresence(agentID, out avatarPresence);
214 214
215 if (avatarPresence != null) 215 if (avatarPresence != null)
216 { 216 {
@@ -304,25 +304,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
304 /// <param name="AgentId">AgentID that logged out</param> 304 /// <param name="AgentId">AgentID that logged out</param>
305 private void ClientLoggedOut(UUID AgentId, Scene scene) 305 private void ClientLoggedOut(UUID AgentId, Scene scene)
306 { 306 {
307 List<ScenePresence> presences = m_scene.GetAvatars();
308 int rootcount = 0;
309 for (int i=0;i<presences.Count;i++)
310 {
311 if (presences[i] != null)
312 {
313 if (!presences[i].IsChildAgent)
314 rootcount++;
315 }
316 }
317 if (rootcount <= 1)
318 StopThread();
319
320 lock (m_rootAgents) 307 lock (m_rootAgents)
321 { 308 {
322 if (m_rootAgents.Contains(AgentId)) 309 m_rootAgents.Remove(AgentId);
323 { 310 if(m_rootAgents.Count == 0)
324 m_rootAgents.Remove(AgentId); 311 StopThread();
325 }
326 } 312 }
327 } 313 }
328 #endregion 314 #endregion
@@ -375,11 +361,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
375 if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle) 361 if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle)
376 { 362 {
377 // Local Map Item Request 363 // Local Map Item Request
378 List<ScenePresence> avatars = m_scene.GetAvatars();
379 int tc = Environment.TickCount; 364 int tc = Environment.TickCount;
380 List<mapItemReply> mapitems = new List<mapItemReply>(); 365 List<mapItemReply> mapitems = new List<mapItemReply>();
381 mapItemReply mapitem = new mapItemReply(); 366 mapItemReply mapitem = new mapItemReply();
382 if (avatars.Count == 0 || avatars.Count == 1) 367 if (m_scene.GetRootAgentCount() <= 1)
383 { 368 {
384 mapitem = new mapItemReply(); 369 mapitem = new mapItemReply();
385 mapitem.x = (uint)(xstart + 1); 370 mapitem.x = (uint)(xstart + 1);
@@ -392,21 +377,21 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
392 } 377 }
393 else 378 else
394 { 379 {
395 foreach (ScenePresence av in avatars) 380 m_scene.ForEachScenePresence(delegate(ScenePresence sp)
396 { 381 {
397 // Don't send a green dot for yourself 382 // Don't send a green dot for yourself
398 if (av.UUID != remoteClient.AgentId) 383 if (!sp.IsChildAgent && sp.UUID != remoteClient.AgentId)
399 { 384 {
400 mapitem = new mapItemReply(); 385 mapitem = new mapItemReply();
401 mapitem.x = (uint)(xstart + av.AbsolutePosition.X); 386 mapitem.x = (uint)(xstart + sp.AbsolutePosition.X);
402 mapitem.y = (uint)(ystart + av.AbsolutePosition.Y); 387 mapitem.y = (uint)(ystart + sp.AbsolutePosition.Y);
403 mapitem.id = UUID.Zero; 388 mapitem.id = UUID.Zero;
404 mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()); 389 mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString());
405 mapitem.Extra = 1; 390 mapitem.Extra = 1;
406 mapitem.Extra2 = 0; 391 mapitem.Extra2 = 0;
407 mapitems.Add(mapitem); 392 mapitems.Add(mapitem);
408 } 393 }
409 } 394 });
410 } 395 }
411 remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags); 396 remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags);
412 } 397 }
@@ -504,7 +489,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
504 if (mrs.agentID != UUID.Zero) 489 if (mrs.agentID != UUID.Zero)
505 { 490 {
506 ScenePresence av = null; 491 ScenePresence av = null;
507 m_scene.TryGetAvatar(mrs.agentID, out av); 492 m_scene.TryGetScenePresence(mrs.agentID, out av);
508 if (av != null) 493 if (av != null)
509 { 494 {
510 if (response.ContainsKey(mrs.itemtype.ToString())) 495 if (response.ContainsKey(mrs.itemtype.ToString()))
@@ -981,51 +966,35 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
981 Utils.LongToUInts(m_scene.RegionInfo.RegionHandle,out xstart,out ystart); 966 Utils.LongToUInts(m_scene.RegionInfo.RegionHandle,out xstart,out ystart);
982 967
983 OSDMap responsemap = new OSDMap(); 968 OSDMap responsemap = new OSDMap();
984 List<ScenePresence> avatars = m_scene.GetAvatars();
985 OSDArray responsearr = new OSDArray(avatars.Count);
986 OSDMap responsemapdata = new OSDMap();
987 int tc = Environment.TickCount; 969 int tc = Environment.TickCount;
988 /* 970 if (m_scene.GetRootAgentCount() == 0)
989 foreach (ScenePresence av in avatars)
990 {
991 responsemapdata = new OSDMap();
992 responsemapdata["X"] = OSD.FromInteger((int)(xstart + av.AbsolutePosition.X));
993 responsemapdata["Y"] = OSD.FromInteger((int)(ystart + av.AbsolutePosition.Y));
994 responsemapdata["ID"] = OSD.FromUUID(UUID.Zero);
995 responsemapdata["Name"] = OSD.FromString("TH");
996 responsemapdata["Extra"] = OSD.FromInteger(0);
997 responsemapdata["Extra2"] = OSD.FromInteger(0);
998 responsearr.Add(responsemapdata);
999 }
1000 responsemap["1"] = responsearr;
1001 */
1002 if (avatars.Count == 0)
1003 { 971 {
1004 responsemapdata = new OSDMap(); 972 OSDMap responsemapdata = new OSDMap();
1005 responsemapdata["X"] = OSD.FromInteger((int)(xstart + 1)); 973 responsemapdata["X"] = OSD.FromInteger((int)(xstart + 1));
1006 responsemapdata["Y"] = OSD.FromInteger((int)(ystart + 1)); 974 responsemapdata["Y"] = OSD.FromInteger((int)(ystart + 1));
1007 responsemapdata["ID"] = OSD.FromUUID(UUID.Zero); 975 responsemapdata["ID"] = OSD.FromUUID(UUID.Zero);
1008 responsemapdata["Name"] = OSD.FromString(Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString())); 976 responsemapdata["Name"] = OSD.FromString(Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()));
1009 responsemapdata["Extra"] = OSD.FromInteger(0); 977 responsemapdata["Extra"] = OSD.FromInteger(0);
1010 responsemapdata["Extra2"] = OSD.FromInteger(0); 978 responsemapdata["Extra2"] = OSD.FromInteger(0);
979 OSDArray responsearr = new OSDArray();
1011 responsearr.Add(responsemapdata); 980 responsearr.Add(responsemapdata);
1012 981
1013 responsemap["6"] = responsearr; 982 responsemap["6"] = responsearr;
1014 } 983 }
1015 else 984 else
1016 { 985 {
1017 responsearr = new OSDArray(avatars.Count); 986 OSDArray responsearr = new OSDArray(m_scene.GetRootAgentCount());
1018 foreach (ScenePresence av in avatars) 987 m_scene.ForEachScenePresence(delegate(ScenePresence sp)
1019 { 988 {
1020 responsemapdata = new OSDMap(); 989 OSDMap responsemapdata = new OSDMap();
1021 responsemapdata["X"] = OSD.FromInteger((int)(xstart + av.AbsolutePosition.X)); 990 responsemapdata["X"] = OSD.FromInteger((int)(xstart + sp.AbsolutePosition.X));
1022 responsemapdata["Y"] = OSD.FromInteger((int)(ystart + av.AbsolutePosition.Y)); 991 responsemapdata["Y"] = OSD.FromInteger((int)(ystart + sp.AbsolutePosition.Y));
1023 responsemapdata["ID"] = OSD.FromUUID(UUID.Zero); 992 responsemapdata["ID"] = OSD.FromUUID(UUID.Zero);
1024 responsemapdata["Name"] = OSD.FromString(Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString())); 993 responsemapdata["Name"] = OSD.FromString(Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()));
1025 responsemapdata["Extra"] = OSD.FromInteger(1); 994 responsemapdata["Extra"] = OSD.FromInteger(1);
1026 responsemapdata["Extra2"] = OSD.FromInteger(0); 995 responsemapdata["Extra2"] = OSD.FromInteger(0);
1027 responsearr.Add(responsemapdata); 996 responsearr.Add(responsemapdata);
1028 } 997 });
1029 responsemap["6"] = responsearr; 998 responsemap["6"] = responsearr;
1030 } 999 }
1031 return responsemap; 1000 return responsemap;
@@ -1107,25 +1076,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1107 1076
1108 private void MakeChildAgent(ScenePresence avatar) 1077 private void MakeChildAgent(ScenePresence avatar)
1109 { 1078 {
1110 List<ScenePresence> presences = m_scene.GetAvatars();
1111 int rootcount = 0;
1112 for (int i = 0; i < presences.Count; i++)
1113 {
1114 if (presences[i] != null)
1115 {
1116 if (!presences[i].IsChildAgent)
1117 rootcount++;
1118 }
1119 }
1120 if (rootcount <= 1)
1121 StopThread();
1122
1123 lock (m_rootAgents) 1079 lock (m_rootAgents)
1124 { 1080 {
1125 if (m_rootAgents.Contains(avatar.UUID)) 1081 m_rootAgents.Remove(avatar.UUID);
1126 { 1082 if (m_rootAgents.Count == 0)
1127 m_rootAgents.Remove(avatar.UUID); 1083 StopThread();
1128 }
1129 } 1084 }
1130 } 1085 }
1131 1086
diff --git a/OpenSim/Region/Examples/SimpleModule/RegionModule.cs b/OpenSim/Region/Examples/SimpleModule/RegionModule.cs
index e1d5bdc..6da41db 100644
--- a/OpenSim/Region/Examples/SimpleModule/RegionModule.cs
+++ b/OpenSim/Region/Examples/SimpleModule/RegionModule.cs
@@ -88,12 +88,12 @@ namespace OpenSim.Region.Examples.SimpleModule
88 m_scene.AgentCrossing(m_character.AgentId, Vector3.Zero, false); 88 m_scene.AgentCrossing(m_character.AgentId, Vector3.Zero, false);
89 } 89 }
90 90
91 List<ScenePresence> avatars = m_scene.GetAvatars(); 91 m_scene.ForEachScenePresence(delegate(ScenePresence sp)
92 foreach (ScenePresence avatar in avatars)
93 { 92 {
94 avatar.AbsolutePosition = 93 if (!sp.IsChildAgent)
95 new Vector3((float)Util.RandomClass.Next(100, 200), (float)Util.RandomClass.Next(30, 200), 2); 94 sp.AbsolutePosition =
96 } 95 new Vector3((float)Util.RandomClass.Next(100, 200), (float)Util.RandomClass.Next(30, 200), 2);
96 });
97 } 97 }
98 98
99 // private void AddComplexObjects(RegionInfo regionInfo, Vector3 pos) 99 // private void AddComplexObjects(RegionInfo regionInfo, Vector3 pos)
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
index 668ff98..87c7a05 100644
--- a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
@@ -25,6 +25,7 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System.Collections.Generic;
28using OpenMetaverse; 29using OpenMetaverse;
29using OpenSim.Framework; 30using OpenSim.Framework;
30 31
@@ -34,7 +35,12 @@ namespace OpenSim.Region.Framework.Interfaces
34 { 35 {
35 void Initialise(string connectstring); 36 void Initialise(string connectstring);
36 37
37 EstateSettings LoadEstateSettings(UUID regionID); 38 EstateSettings LoadEstateSettings(UUID regionID, bool create);
39 EstateSettings LoadEstateSettings(int estateID);
38 void StoreEstateSettings(EstateSettings es); 40 void StoreEstateSettings(EstateSettings es);
41 List<int> GetEstates(string search);
42 bool LinkRegion(UUID regionID, int estateID);
43 List<UUID> GetRegions(int estateID);
44 bool DeleteEstate(int estateID);
39 } 45 }
40} 46}
diff --git a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs
index 8980b2d..2c091e7 100644
--- a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs
@@ -37,21 +37,51 @@ namespace OpenSim.Region.Framework.Interfaces
37 { 37 {
38 event NewGroupNotice OnNewGroupNotice; 38 event NewGroupNotice OnNewGroupNotice;
39 39
40 /// <summary>
41 /// Create a group
42 /// </summary>
43 /// <param name="remoteClient"></param>
44 /// <param name="name"></param>
45 /// <param name="charter"></param>
46 /// <param name="showInList"></param>
47 /// <param name="insigniaID"></param>
48 /// <param name="membershipFee"></param>
49 /// <param name="openEnrollment"></param>
50 /// <param name="allowPublish"></param>
51 /// <param name="maturePublish"></param>
52 /// <returns>The UUID of the created group</returns>
53 UUID CreateGroup(
54 IClientAPI remoteClient, string name, string charter, bool showInList, UUID insigniaID, int membershipFee,
55 bool openEnrollment, bool allowPublish, bool maturePublish);
56
57 /// <summary>
58 /// Get a group
59 /// </summary>
60 /// <param name="name">Name of the group</param>
61 /// <returns>The group's data. Null if there is no such group.</returns>
62 GroupRecord GetGroupRecord(string name);
63
64 /// <summary>
65 /// Get a group
66 /// </summary>
67 /// <param name="GroupID">ID of the group</param>
68 /// <returns>The group's data. Null if there is no such group.</returns>
69 GroupRecord GetGroupRecord(UUID GroupID);
70
40 void ActivateGroup(IClientAPI remoteClient, UUID groupID); 71 void ActivateGroup(IClientAPI remoteClient, UUID groupID);
41 List<GroupTitlesData> GroupTitlesRequest(IClientAPI remoteClient, UUID groupID); 72 List<GroupTitlesData> GroupTitlesRequest(IClientAPI remoteClient, UUID groupID);
42 List<GroupMembersData> GroupMembersRequest(IClientAPI remoteClient, UUID groupID); 73 List<GroupMembersData> GroupMembersRequest(IClientAPI remoteClient, UUID groupID);
43 List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID); 74 List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID);
44 List<GroupRoleMembersData> GroupRoleMembersRequest(IClientAPI remoteClient, UUID groupID); 75 List<GroupRoleMembersData> GroupRoleMembersRequest(IClientAPI remoteClient, UUID groupID);
45 GroupProfileData GroupProfileRequest(IClientAPI remoteClient, UUID groupID); 76 GroupProfileData GroupProfileRequest(IClientAPI remoteClient, UUID groupID);
46 GroupMembershipData[] GetMembershipData(UUID UserID); 77 GroupMembershipData[] GetMembershipData(UUID UserID);
47 GroupMembershipData GetMembershipData(UUID GroupID, UUID UserID); 78 GroupMembershipData GetMembershipData(UUID GroupID, UUID UserID);
48 79
49 void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish); 80 void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish);
50 81
51 void SetGroupAcceptNotices(IClientAPI remoteClient, UUID groupID, bool acceptNotices, bool listInProfile); 82 void SetGroupAcceptNotices(IClientAPI remoteClient, UUID groupID, bool acceptNotices, bool listInProfile);
52 83
53 void GroupTitleUpdate(IClientAPI remoteClient, UUID GroupID, UUID TitleRoleID); 84 void GroupTitleUpdate(IClientAPI remoteClient, UUID GroupID, UUID TitleRoleID);
54 UUID CreateGroup(IClientAPI remoteClient, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish);
55 85
56 GroupNoticeData[] GroupNoticesListRequest(IClientAPI remoteClient, UUID GroupID); 86 GroupNoticeData[] GroupNoticesListRequest(IClientAPI remoteClient, UUID GroupID);
57 string GetGroupTitle(UUID avatarID); 87 string GetGroupTitle(UUID avatarID);
@@ -64,7 +94,6 @@ namespace OpenSim.Region.Framework.Interfaces
64 void LeaveGroupRequest(IClientAPI remoteClient, UUID GroupID); 94 void LeaveGroupRequest(IClientAPI remoteClient, UUID GroupID);
65 void EjectGroupMemberRequest(IClientAPI remoteClient, UUID GroupID, UUID EjecteeID); 95 void EjectGroupMemberRequest(IClientAPI remoteClient, UUID GroupID, UUID EjecteeID);
66 void InviteGroupRequest(IClientAPI remoteClient, UUID GroupID, UUID InviteeID, UUID RoleID); 96 void InviteGroupRequest(IClientAPI remoteClient, UUID GroupID, UUID InviteeID, UUID RoleID);
67 GroupRecord GetGroupRecord(UUID GroupID);
68 void NotifyChange(UUID GroupID); 97 void NotifyChange(UUID GroupID);
69 } 98 }
70} 99} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index cadb858..1875c48 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -132,7 +132,7 @@ namespace OpenSim.Region.Framework.Scenes
132 { 132 {
133 ScenePresence avatar; 133 ScenePresence avatar;
134 134
135 if (TryGetAvatar(avatarId, out avatar)) 135 if (TryGetScenePresence(avatarId, out avatar))
136 { 136 {
137 IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); 137 IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>();
138 if (invAccess != null) 138 if (invAccess != null)
@@ -230,7 +230,7 @@ namespace OpenSim.Region.Framework.Scenes
230 { 230 {
231 ScenePresence avatar; 231 ScenePresence avatar;
232 232
233 if (TryGetAvatar(avatarId, out avatar)) 233 if (TryGetScenePresence(avatarId, out avatar))
234 { 234 {
235 return CapsUpdateTaskInventoryScriptAsset( 235 return CapsUpdateTaskInventoryScriptAsset(
236 avatar.ControllingClient, itemId, primId, isScriptRunning, data); 236 avatar.ControllingClient, itemId, primId, isScriptRunning, data);
@@ -683,7 +683,7 @@ namespace OpenSim.Region.Framework.Scenes
683 if (transactionID == UUID.Zero) 683 if (transactionID == UUID.Zero)
684 { 684 {
685 ScenePresence presence; 685 ScenePresence presence;
686 if (TryGetAvatar(remoteClient.AgentId, out presence)) 686 if (TryGetScenePresence(remoteClient.AgentId, out presence))
687 { 687 {
688 byte[] data = null; 688 byte[] data = null;
689 689
@@ -945,7 +945,7 @@ namespace OpenSim.Region.Framework.Scenes
945 { 945 {
946 ScenePresence avatar; 946 ScenePresence avatar;
947 947
948 if (TryGetAvatar(avatarId, out avatar)) 948 if (TryGetScenePresence(avatarId, out avatar))
949 { 949 {
950 return MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId); 950 return MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId);
951 } 951 }
@@ -1059,7 +1059,7 @@ namespace OpenSim.Region.Framework.Scenes
1059 1059
1060 ScenePresence avatar; 1060 ScenePresence avatar;
1061 1061
1062 if (TryGetAvatar(srcTaskItem.OwnerID, out avatar)) 1062 if (TryGetScenePresence(srcTaskItem.OwnerID, out avatar))
1063 { 1063 {
1064 destPart.GetProperties(avatar.ControllingClient); 1064 destPart.GetProperties(avatar.ControllingClient);
1065 } 1065 }
@@ -1087,7 +1087,7 @@ namespace OpenSim.Region.Framework.Scenes
1087 } 1087 }
1088 1088
1089 ScenePresence avatar = null; 1089 ScenePresence avatar = null;
1090 if (TryGetAvatar(destID, out avatar)) 1090 if (TryGetScenePresence(destID, out avatar))
1091 { 1091 {
1092 //profile.SendInventoryDecendents(avatar.ControllingClient, 1092 //profile.SendInventoryDecendents(avatar.ControllingClient,
1093 // profile.RootFolder.ID, true, false); 1093 // profile.RootFolder.ID, true, false);
@@ -1424,7 +1424,7 @@ namespace OpenSim.Region.Framework.Scenes
1424 1424
1425 ScenePresence avatar; 1425 ScenePresence avatar;
1426 1426
1427 if (TryGetAvatar(srcTaskItem.OwnerID, out avatar)) 1427 if (TryGetScenePresence(srcTaskItem.OwnerID, out avatar))
1428 { 1428 {
1429 destPart.GetProperties(avatar.ControllingClient); 1429 destPart.GetProperties(avatar.ControllingClient);
1430 } 1430 }
@@ -1865,7 +1865,7 @@ namespace OpenSim.Region.Framework.Scenes
1865 UUID inventoryID = part.ParentGroup.GetFromItemID(); 1865 UUID inventoryID = part.ParentGroup.GetFromItemID();
1866 1866
1867 ScenePresence presence; 1867 ScenePresence presence;
1868 if (TryGetAvatar(remoteClient.AgentId, out presence)) 1868 if (TryGetScenePresence(remoteClient.AgentId, out presence))
1869 { 1869 {
1870 if (!Permissions.CanRezObject(part.ParentGroup.Children.Count, remoteClient.AgentId, presence.AbsolutePosition)) 1870 if (!Permissions.CanRezObject(part.ParentGroup.Children.Count, remoteClient.AgentId, presence.AbsolutePosition))
1871 return; 1871 return;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index b2c8dfd..2b6f80b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -606,7 +606,46 @@ namespace OpenSim.Region.Framework.Scenes
606 606
607 if (m_storageManager.EstateDataStore != null) 607 if (m_storageManager.EstateDataStore != null)
608 { 608 {
609 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID); 609 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false);
610 if (m_regInfo.EstateSettings.EstateID == 0) // No record at all
611 {
612 MainConsole.Instance.Output("Your region is not part of an estate.");
613 while (true)
614 {
615 string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List<string>() {"yes", "no"});
616 if (response == "no")
617 {
618 // Create a new estate
619 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, true);
620
621 m_regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", m_regInfo.EstateSettings.EstateName);
622 m_regInfo.EstateSettings.Save();
623 break;
624 }
625 else
626 {
627 response = MainConsole.Instance.CmdPrompt("Estate name to join", "None");
628 if (response == "None")
629 continue;
630
631 List<int> estateIDs = m_storageManager.EstateDataStore.GetEstates(response);
632 if (estateIDs.Count < 1)
633 {
634 MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again");
635 continue;
636 }
637
638 int estateID = estateIDs[0];
639
640 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(estateID);
641
642 if (m_storageManager.EstateDataStore.LinkRegion(m_regInfo.RegionID, estateID))
643 break;
644
645 MainConsole.Instance.Output("Joining the estate failed. Please try again.");
646 }
647 }
648 }
610 } 649 }
611 650
612 //Bind Storage Manager functions to some land manager functions for this scene 651 //Bind Storage Manager functions to some land manager functions for this scene
@@ -1229,6 +1268,84 @@ namespace OpenSim.Region.Framework.Scenes
1229 m_dialogModule = RequestModuleInterface<IDialogModule>(); 1268 m_dialogModule = RequestModuleInterface<IDialogModule>();
1230 m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); 1269 m_capsModule = RequestModuleInterface<ICapabilitiesModule>();
1231 m_teleportModule = RequestModuleInterface<IEntityTransferModule>(); 1270 m_teleportModule = RequestModuleInterface<IEntityTransferModule>();
1271
1272 // Shoving this in here for now, because we have the needed
1273 // interfaces at this point
1274 //
1275 // TODO: Find a better place for this
1276 //
1277 while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
1278 {
1279 MainConsole.Instance.Output("The current estate has no owner set.");
1280 string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test");
1281 string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User");
1282
1283 UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last);
1284
1285 if (account == null)
1286 {
1287 // Create a new account
1288 account = new UserAccount(m_regInfo.ScopeID, first, last, String.Empty);
1289 if (account.ServiceURLs == null || (account.ServiceURLs != null && account.ServiceURLs.Count == 0))
1290 {
1291 account.ServiceURLs = new Dictionary<string, object>();
1292 account.ServiceURLs["HomeURI"] = string.Empty;
1293 account.ServiceURLs["GatekeeperURI"] = string.Empty;
1294 account.ServiceURLs["InventoryServerURI"] = string.Empty;
1295 account.ServiceURLs["AssetServerURI"] = string.Empty;
1296 }
1297
1298 if (UserAccountService.StoreUserAccount(account))
1299 {
1300 string password = MainConsole.Instance.PasswdPrompt("Password");
1301 string email = MainConsole.Instance.CmdPrompt("Email", "");
1302
1303 account.Email = email;
1304 UserAccountService.StoreUserAccount(account);
1305
1306 bool success = false;
1307 success = AuthenticationService.SetPassword(account.PrincipalID, password);
1308 if (!success)
1309 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set password for account {0} {1}.",
1310 first, last);
1311
1312 GridRegion home = null;
1313 if (GridService != null)
1314 {
1315 List<GridRegion> defaultRegions = GridService.GetDefaultRegions(UUID.Zero);
1316 if (defaultRegions != null && defaultRegions.Count >= 1)
1317 home = defaultRegions[0];
1318
1319 if (PresenceService != null && home != null)
1320 PresenceService.SetHomeLocation(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
1321 else
1322 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set home for account {0} {1}.",
1323 first, last);
1324
1325 }
1326 else
1327 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to retrieve home region for account {0} {1}.",
1328 first, last);
1329
1330 if (InventoryService != null)
1331 success = InventoryService.CreateUserInventory(account.PrincipalID);
1332 if (!success)
1333 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.",
1334 first, last);
1335
1336
1337 m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", first, last);
1338
1339 m_regInfo.EstateSettings.EstateOwner = account.PrincipalID;
1340 m_regInfo.EstateSettings.Save();
1341 }
1342 }
1343 else
1344 {
1345 m_regInfo.EstateSettings.EstateOwner = account.PrincipalID;
1346 m_regInfo.EstateSettings.Save();
1347 }
1348 }
1232 } 1349 }
1233 1350
1234 #endregion 1351 #endregion
@@ -3296,7 +3413,7 @@ namespace OpenSim.Region.Framework.Scenes
3296 } 3413 }
3297 } 3414 }
3298 3415
3299 ScenePresence sp = m_sceneGraph.GetScenePresence(agent.AgentID); 3416 ScenePresence sp = GetScenePresence(agent.AgentID);
3300 if (sp != null) 3417 if (sp != null)
3301 { 3418 {
3302 m_log.DebugFormat( 3419 m_log.DebugFormat(
@@ -3594,8 +3711,7 @@ namespace OpenSim.Region.Framework.Scenes
3594 /// <param name="message">message to display to the user. Reason for being logged off</param> 3711 /// <param name="message">message to display to the user. Reason for being logged off</param>
3595 public void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message) 3712 public void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message)
3596 { 3713 {
3597 ScenePresence loggingOffUser = null; 3714 ScenePresence loggingOffUser = GetScenePresence(AvatarID);
3598 loggingOffUser = GetScenePresence(AvatarID);
3599 if (loggingOffUser != null) 3715 if (loggingOffUser != null)
3600 { 3716 {
3601 UUID localRegionSecret = UUID.Zero; 3717 UUID localRegionSecret = UUID.Zero;
@@ -3631,8 +3747,8 @@ namespace OpenSim.Region.Framework.Scenes
3631 /// <param name="isFlying"></param> 3747 /// <param name="isFlying"></param>
3632 public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) 3748 public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying)
3633 { 3749 {
3634 ScenePresence presence; 3750 ScenePresence presence = GetScenePresence(agentID);
3635 if(m_sceneGraph.TryGetAvatar(agentID, out presence)) 3751 if(presence != null)
3636 { 3752 {
3637 try 3753 try
3638 { 3754 {
@@ -3806,8 +3922,8 @@ namespace OpenSim.Region.Framework.Scenes
3806 public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, Vector3 position, 3922 public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, Vector3 position,
3807 Vector3 lookAt, uint teleportFlags) 3923 Vector3 lookAt, uint teleportFlags)
3808 { 3924 {
3809 ScenePresence sp; 3925 ScenePresence sp = GetScenePresence(remoteClient.AgentId);
3810 if(m_sceneGraph.TryGetAvatar(remoteClient.AgentId, out sp)) 3926 if (sp != null)
3811 { 3927 {
3812 uint regionX = m_regInfo.RegionLocX; 3928 uint regionX = m_regInfo.RegionLocX;
3813 uint regionY = m_regInfo.RegionLocY; 3929 uint regionY = m_regInfo.RegionLocY;
@@ -3985,17 +4101,17 @@ namespace OpenSim.Region.Framework.Scenes
3985 m_log.ErrorFormat("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname", 4101 m_log.ErrorFormat("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname",
3986 "Agent ID", "Session ID", "Circuit", "IP", "World"); 4102 "Agent ID", "Session ID", "Circuit", "IP", "World");
3987 4103
3988 foreach (ScenePresence scenePresence in GetAvatars()) 4104 ForEachScenePresence(delegate(ScenePresence sp)
3989 { 4105 {
3990 m_log.ErrorFormat("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}", 4106 m_log.ErrorFormat("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}",
3991 scenePresence.Firstname, 4107 sp.Firstname,
3992 scenePresence.Lastname, 4108 sp.Lastname,
3993 scenePresence.UUID, 4109 sp.UUID,
3994 scenePresence.ControllingClient.AgentId, 4110 sp.ControllingClient.AgentId,
3995 "Unknown", 4111 "Unknown",
3996 "Unknown", 4112 "Unknown",
3997 RegionInfo.RegionName); 4113 RegionInfo.RegionName);
3998 } 4114 });
3999 4115
4000 break; 4116 break;
4001 } 4117 }
@@ -4161,72 +4277,42 @@ namespace OpenSim.Region.Framework.Scenes
4161 m_sceneGraph.RemovePhysicalPrim(num); 4277 m_sceneGraph.RemovePhysicalPrim(num);
4162 } 4278 }
4163 4279
4164 //The idea is to have a group of method that return a list of avatars meeting some requirement 4280 public int GetRootAgentCount()
4165 // ie it could be all m_scenePresences within a certain range of the calling prim/avatar.
4166 //
4167 // GetAvatars returns a new list of all root agent presences in the scene
4168 // GetScenePresences returns a new list of all presences in the scene or a filter may be passed.
4169 // GetScenePresence returns the presence with matching UUID or first/last name.
4170 // ForEachScenePresence requests the Scene to run a delegate function against all presences.
4171
4172 /// <summary>
4173 /// Return a list of all avatars in this region.
4174 /// This list is a new object, so it can be iterated over without locking.
4175 /// </summary>
4176 /// <returns></returns>
4177 public List<ScenePresence> GetAvatars()
4178 { 4281 {
4179 return m_sceneGraph.GetAvatars(); 4282 return m_sceneGraph.GetRootAgentCount();
4180 } 4283 }
4181 4284
4182 /// <summary> 4285 public int GetChildAgentCount()
4183 /// Return a list of all ScenePresences in this region. This returns child agents as well as root agents.
4184 /// This list is a new object, so it can be iterated over without locking.
4185 /// </summary>
4186 /// <returns></returns>
4187 public List<ScenePresence> GetScenePresences()
4188 { 4286 {
4189 return m_sceneGraph.GetScenePresences(); 4287 return m_sceneGraph.GetChildAgentCount();
4190 } 4288 }
4191 4289
4192 /// <summary> 4290 /// <summary>
4193 /// Request a filtered list of ScenePresences in this region. 4291 /// Request a scene presence by UUID. Fast, indexed lookup.
4194 /// This list is a new object, so it can be iterated over without locking.
4195 /// </summary> 4292 /// </summary>
4196 /// <param name="filter"></param> 4293 /// <param name="agentID"></param>
4197 /// <returns></returns> 4294 /// <returns>null if the presence was not found</returns>
4198 public List<ScenePresence> GetScenePresences(FilterAvatarList filter) 4295 public ScenePresence GetScenePresence(UUID agentID)
4199 {
4200 return m_sceneGraph.GetScenePresences(filter);
4201 }
4202
4203 /// <summary>
4204 /// Request a scene presence by UUID
4205 /// </summary>
4206 /// <param name="avatarID"></param>
4207 /// <returns></returns>
4208 public ScenePresence GetScenePresence(UUID avatarID)
4209 { 4296 {
4210 return m_sceneGraph.GetScenePresence(avatarID); 4297 return m_sceneGraph.GetScenePresence(agentID);
4211 } 4298 }
4212 4299
4213 /// <summary> 4300 /// <summary>
4214 /// Request the ScenePresence in this region by first/last name. 4301 /// Request the scene presence by name.
4215 /// Should normally only be a single match, but first is always returned
4216 /// </summary> 4302 /// </summary>
4217 /// <param name="firstName"></param> 4303 /// <param name="firstName"></param>
4218 /// <param name="lastName"></param> 4304 /// <param name="lastName"></param>
4219 /// <returns></returns> 4305 /// <returns>null if the presence was not found</returns>
4220 public ScenePresence GetScenePresence(string firstName, string lastName) 4306 public ScenePresence GetScenePresence(string firstName, string lastName)
4221 { 4307 {
4222 return m_sceneGraph.GetScenePresence(firstName, lastName); 4308 return m_sceneGraph.GetScenePresence(firstName, lastName);
4223 } 4309 }
4224 4310
4225 /// <summary> 4311 /// <summary>
4226 /// Request the ScenePresence in this region by localID. 4312 /// Request the scene presence by localID.
4227 /// </summary> 4313 /// </summary>
4228 /// <param name="localID"></param> 4314 /// <param name="localID"></param>
4229 /// <returns></returns> 4315 /// <returns>null if the presence was not found</returns>
4230 public ScenePresence GetScenePresence(uint localID) 4316 public ScenePresence GetScenePresence(uint localID)
4231 { 4317 {
4232 return m_sceneGraph.GetScenePresence(localID); 4318 return m_sceneGraph.GetScenePresence(localID);
@@ -4318,9 +4404,9 @@ namespace OpenSim.Region.Framework.Scenes
4318 return m_sceneGraph.GetGroupByPrim(localID); 4404 return m_sceneGraph.GetGroupByPrim(localID);
4319 } 4405 }
4320 4406
4321 public override bool TryGetAvatar(UUID avatarId, out ScenePresence avatar) 4407 public override bool TryGetScenePresence(UUID avatarId, out ScenePresence avatar)
4322 { 4408 {
4323 return m_sceneGraph.TryGetAvatar(avatarId, out avatar); 4409 return m_sceneGraph.TryGetScenePresence(avatarId, out avatar);
4324 } 4410 }
4325 4411
4326 public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) 4412 public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar)
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index 74476ed..3218dad 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -190,11 +190,11 @@ namespace OpenSim.Region.Framework.Scenes
190 /// <param name="agentID"></param> 190 /// <param name="agentID"></param>
191 public abstract void RemoveClient(UUID agentID); 191 public abstract void RemoveClient(UUID agentID);
192 192
193 public bool TryGetAvatar(UUID agentID, out object scenePresence) 193 public bool TryGetScenePresence(UUID agentID, out object scenePresence)
194 { 194 {
195 scenePresence = null; 195 scenePresence = null;
196 ScenePresence sp = null; 196 ScenePresence sp = null;
197 if (TryGetAvatar(agentID, out sp)) 197 if (TryGetScenePresence(agentID, out sp))
198 { 198 {
199 scenePresence = sp; 199 scenePresence = sp;
200 return true; 200 return true;
@@ -203,7 +203,7 @@ namespace OpenSim.Region.Framework.Scenes
203 return false; 203 return false;
204 } 204 }
205 205
206 public abstract bool TryGetAvatar(UUID agentID, out ScenePresence scenePresence); 206 public abstract bool TryGetScenePresence(UUID agentID, out ScenePresence scenePresence);
207 207
208 #endregion 208 #endregion
209 209
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 19298d2..3a1962c 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -723,116 +723,84 @@ namespace OpenSim.Region.Framework.Scenes
723 return null; 723 return null;
724 } 724 }
725 725
726 // The idea is to have a group of method that return a list of avatars meeting some requirement
727 // ie it could be all m_scenePresences within a certain range of the calling prim/avatar.
728 //
729 // GetAvatars returns a new list of all root agent presences in the scene
730 // GetScenePresences returns a new list of all presences in the scene or a filter may be passed.
731 // GetScenePresence returns the presence with matching UUID or the first presence matching the passed filter.
732 // ForEachScenePresence requests the Scene to run a delegate function against all presences.
733
734 /// <summary> 726 /// <summary>
735 /// Request a list of all avatars in this region (no child agents) 727 /// Request a copy of m_scenePresences in this World
736 /// This list is a new object, so it can be iterated over without locking. 728 /// There is no guarantee that presences will remain in the scene after the list is returned.
729 /// This list should remain private to SceneGraph. Callers wishing to iterate should instead
730 /// pass a delegate to ForEachScenePresence.
737 /// </summary> 731 /// </summary>
738 /// <returns></returns> 732 /// <returns></returns>
739 public List<ScenePresence> GetAvatars() 733 private List<ScenePresence> GetScenePresences()
740 { 734 {
741 return GetScenePresences(delegate(ScenePresence scenePresence) 735 lock (m_scenePresences)
742 { 736 return new List<ScenePresence>(m_scenePresenceArray);
743 return !scenePresence.IsChildAgent;
744 });
745 } 737 }
746 738
747 /// <summary> 739 /// <summary>
748 /// Request a list of m_scenePresences in this World 740 /// Request a scene presence by UUID. Fast, indexed lookup.
749 /// Returns a copy so it can be iterated without a lock.
750 /// There is no guarantee that presences will remain in the scene after the list is returned.
751 /// </summary> 741 /// </summary>
752 /// <returns></returns> 742 /// <param name="agentID"></param>
753 protected internal List<ScenePresence> GetScenePresences() 743 /// <returns>null if the presence was not found</returns>
744 protected internal ScenePresence GetScenePresence(UUID agentID)
754 { 745 {
755 List<ScenePresence> result; 746 ScenePresence sp;
756 lock (m_scenePresences) 747 lock (m_scenePresences)
757 { 748 {
758 result = new List<ScenePresence>(m_scenePresenceArray.Length); 749 m_scenePresences.TryGetValue(agentID, out sp);
759 result.AddRange(m_scenePresenceArray);
760 } 750 }
761 return result; 751 return sp;
762 } 752 }
763 753
764 /// <summary> 754 /// <summary>
765 /// Request a filtered list of m_scenePresences in this World 755 /// Request the scene presence by name.
766 /// Returns a copy so it can be iterated without a lock.
767 /// There is no guarantee that presences will remain in the scene after the list is returned.
768 /// </summary> 756 /// </summary>
769 /// <returns></returns> 757 /// <param name="firstName"></param>
770 protected internal List<ScenePresence> GetScenePresences(FilterAvatarList filter) 758 /// <param name="lastName"></param>
759 /// <returns>null if the presence was not found</returns>
760 protected internal ScenePresence GetScenePresence(string firstName, string lastName)
771 { 761 {
772 List<ScenePresence> result = new List<ScenePresence>(); 762 foreach (ScenePresence presence in GetScenePresences())
773 // Check each ScenePresence against the filter
774 ForEachScenePresence(delegate(ScenePresence presence)
775 { 763 {
776 if (filter(presence)) 764 if (presence.Firstname == firstName && presence.Lastname == lastName)
777 result.Add(presence); 765 return presence;
778 }); 766 }
779 return result; 767 return null;
780 } 768 }
781 769
782 /// <summary> 770 /// <summary>
783 /// Request the ScenePresence in this region matching filter. 771 /// Request the scene presence by localID.
784 /// Only the first match is returned.
785 ///
786 /// </summary> 772 /// </summary>
787 /// <param name="filter"></param> 773 /// <param name="localID"></param>
788 /// <returns></returns> 774 /// <returns>null if the presence was not found</returns>
789 protected internal ScenePresence GetScenePresence(FilterAvatarList filter) 775 protected internal ScenePresence GetScenePresence(uint localID)
790 { 776 {
791 ScenePresence result = null; 777 foreach (ScenePresence presence in GetScenePresences())
792 // Get all of the ScenePresences 778 if (presence.LocalId == localID)
793 List<ScenePresence> presences = GetScenePresences(); 779 return presence;
794 foreach (ScenePresence presence in presences) 780 return null;
795 {
796 if (filter(presence))
797 {
798 result = presence;
799 break;
800 }
801 }
802 return result;
803 } 781 }
804 782
805 protected internal ScenePresence GetScenePresence(string firstName, string lastName) 783 protected internal bool TryGetScenePresence(UUID agentID, out ScenePresence avatar)
806 { 784 {
807 return GetScenePresence(delegate(ScenePresence presence) 785 lock (m_scenePresences)
808 { 786 {
809 return(presence.Firstname == firstName && presence.Lastname == lastName); 787 m_scenePresences.TryGetValue(agentID, out avatar);
810 }); 788 }
811 } 789 return (avatar != null);
812
813 /// <summary>
814 /// Request a scene presence by UUID
815 /// </summary>
816 /// <param name="agentID"></param>
817 /// <returns>null if the agent was not found</returns>
818 protected internal ScenePresence GetScenePresence(UUID agentID)
819 {
820 ScenePresence sp;
821 TryGetAvatar(agentID, out sp);
822 return sp;
823 } 790 }
824 791
825 /// <summary> 792 protected internal bool TryGetAvatarByName(string name, out ScenePresence avatar)
826 /// Request the ScenePresence in this region by localID.
827 /// </summary>
828 /// <param name="localID"></param>
829 /// <returns></returns>
830 protected internal ScenePresence GetScenePresence(uint localID)
831 { 793 {
832 return GetScenePresence(delegate(ScenePresence presence) 794 avatar = null;
795 foreach (ScenePresence presence in GetScenePresences())
833 { 796 {
834 return (presence.LocalId == localID); 797 if (String.Compare(name, presence.ControllingClient.Name, true) == 0)
835 }); 798 {
799 avatar = presence;
800 break;
801 }
802 }
803 return (avatar != null);
836 } 804 }
837 805
838 /// <summary> 806 /// <summary>
@@ -986,24 +954,6 @@ namespace OpenSim.Region.Framework.Scenes
986 return group.GetChildPart(fullID); 954 return group.GetChildPart(fullID);
987 } 955 }
988 956
989 protected internal bool TryGetAvatar(UUID avatarId, out ScenePresence avatar)
990 {
991 lock (m_scenePresences)
992 {
993 m_scenePresences.TryGetValue(avatarId, out avatar);
994 }
995 return (avatar != null);
996 }
997
998 protected internal bool TryGetAvatarByName(string avatarName, out ScenePresence avatar)
999 {
1000 avatar = GetScenePresence(delegate(ScenePresence presence)
1001 {
1002 return (String.Compare(avatarName, presence.ControllingClient.Name, true) == 0);
1003 });
1004 return (avatar != null);
1005 }
1006
1007 /// <summary> 957 /// <summary>
1008 /// Returns a list of the entities in the scene. This is a new list so no locking is required to iterate over 958 /// Returns a list of the entities in the scene. This is a new list so no locking is required to iterate over
1009 /// it 959 /// it
@@ -1066,6 +1016,10 @@ namespace OpenSim.Region.Framework.Scenes
1066 return UUID.Zero; 1016 return UUID.Zero;
1067 } 1017 }
1068 1018
1019 /// <summary>
1020 /// Performs action on all scene object groups.
1021 /// </summary>
1022 /// <param name="action"></param>
1069 protected internal void ForEachSOG(Action<SceneObjectGroup> action) 1023 protected internal void ForEachSOG(Action<SceneObjectGroup> action)
1070 { 1024 {
1071 List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values); 1025 List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values);
@@ -1085,23 +1039,41 @@ namespace OpenSim.Region.Framework.Scenes
1085 1039
1086 1040
1087 /// <summary> 1041 /// <summary>
1088 /// Performs action on all scene presences. 1042 /// Performs action on all scene presences. This can ultimately run the actions in parallel but
1043 /// any delegates passed in will need to implement their own locking on data they reference and
1044 /// modify outside of the scope of the delegate.
1089 /// </summary> 1045 /// </summary>
1090 /// <param name="action"></param> 1046 /// <param name="action"></param>
1091 public void ForEachScenePresence(Action<ScenePresence> action) 1047 public void ForEachScenePresence(Action<ScenePresence> action)
1092 { 1048 {
1093 List<ScenePresence> presences = GetScenePresences(); 1049 // Once all callers have their delegates configured for parallelism, we can unleash this
1094 try 1050 /*
1051 Action<ScenePresence> protectedAction = new Action<ScenePresence>(delegate(ScenePresence sp)
1052 {
1053 try
1054 {
1055 action(sp);
1056 }
1057 catch (Exception e)
1058 {
1059 m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString());
1060 m_log.Info("[BUG] Stack Trace: " + e.StackTrace);
1061 }
1062 });
1063 Parallel.ForEach<ScenePresence>(GetScenePresences(), protectedAction);
1064 */
1065 // For now, perform actiona serially
1066 foreach (ScenePresence sp in GetScenePresences())
1095 { 1067 {
1096 foreach(ScenePresence presence in presences) 1068 try
1097 { 1069 {
1098 action(presence); 1070 action(sp);
1071 }
1072 catch (Exception e)
1073 {
1074 m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString());
1075 m_log.Info("[BUG] Stack Trace: " + e.StackTrace);
1099 } 1076 }
1100 }
1101 catch (Exception e)
1102 {
1103 m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString());
1104 m_log.Info("[BUG] Stack Trace: " + e.StackTrace);
1105 } 1077 }
1106 } 1078 }
1107 1079
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs
index a955532..3b84734 100644
--- a/OpenSim/Region/Framework/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs
@@ -454,8 +454,10 @@ namespace OpenSim.Region.Framework.Scenes
454 454
455 ForEachCurrentScene(delegate(Scene scene) 455 ForEachCurrentScene(delegate(Scene scene)
456 { 456 {
457 List<ScenePresence> scenePresences = scene.GetScenePresences(); 457 scene.ForEachScenePresence(delegate(ScenePresence sp)
458 presences.AddRange(scenePresences); 458 {
459 presences.Add(sp);
460 });
459 }); 461 });
460 462
461 return presences; 463 return presences;
@@ -484,11 +486,11 @@ namespace OpenSim.Region.Framework.Scenes
484 ForEachCurrentScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); }); 486 ForEachCurrentScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); });
485 } 487 }
486 488
487 public bool TryGetAvatar(UUID avatarId, out ScenePresence avatar) 489 public bool TryGetScenePresence(UUID avatarId, out ScenePresence avatar)
488 { 490 {
489 foreach (Scene scene in m_localScenes) 491 foreach (Scene scene in m_localScenes)
490 { 492 {
491 if (scene.TryGetAvatar(avatarId, out avatar)) 493 if (scene.TryGetScenePresence(avatarId, out avatar))
492 { 494 {
493 return true; 495 return true;
494 } 496 }
@@ -503,7 +505,7 @@ namespace OpenSim.Region.Framework.Scenes
503 ScenePresence avatar = null; 505 ScenePresence avatar = null;
504 foreach (Scene mScene in m_localScenes) 506 foreach (Scene mScene in m_localScenes)
505 { 507 {
506 if (mScene.TryGetAvatar(avatarId, out avatar)) 508 if (mScene.TryGetScenePresence(avatarId, out avatar))
507 { 509 {
508 scene = mScene; 510 scene = mScene;
509 return true; 511 return true;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 539f2b1..4b2641c 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -682,7 +682,7 @@ namespace OpenSim.Region.Framework.Scenes
682 if (m_parentGroup != null) // TODO can there be a SOP without a SOG? 682 if (m_parentGroup != null) // TODO can there be a SOP without a SOG?
683 { 683 {
684 ScenePresence avatar; 684 ScenePresence avatar;
685 if (m_parentGroup.Scene.TryGetAvatar(m_sitTargetAvatar, out avatar)) 685 if (m_parentGroup.Scene.TryGetScenePresence(m_sitTargetAvatar, out avatar))
686 { 686 {
687 avatar.ParentPosition = GetWorldPosition(); 687 avatar.ParentPosition = GetWorldPosition();
688 } 688 }
@@ -1332,11 +1332,11 @@ namespace OpenSim.Region.Framework.Scenes
1332 if (volume < 0) 1332 if (volume < 0)
1333 volume = 0; 1333 volume = 0;
1334 1334
1335 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); 1335 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp)
1336 foreach (ScenePresence p in avatarts)
1337 { 1336 {
1338 p.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume); 1337 if(!sp.IsChildAgent)
1339 } 1338 sp.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume);
1339 });
1340 } 1340 }
1341 1341
1342 /// <summary> 1342 /// <summary>
@@ -2626,12 +2626,13 @@ namespace OpenSim.Region.Framework.Scenes
2626 TaskInventory.LockItemsForRead(false); 2626 TaskInventory.LockItemsForRead(false);
2627 } 2627 }
2628 2628
2629 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); 2629 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp)
2630 foreach (ScenePresence p in avatarts)
2631 { 2630 {
2632 if (!(Util.GetDistanceTo(p.AbsolutePosition, AbsolutePosition) >= 100)) 2631 if (sp.IsChildAgent)
2633 p.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); 2632 return;
2634 } 2633 if (!(Util.GetDistanceTo(sp.AbsolutePosition, AbsolutePosition) >= 100))
2634 sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID);
2635 });
2635 } 2636 }
2636 2637
2637 public void RemFlag(PrimFlags flag) 2638 public void RemFlag(PrimFlags flag)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 1e530e1..5c54616 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2598,35 +2598,33 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
2598 2598
2599 List<Vector3> CoarseLocations = new List<Vector3>(); 2599 List<Vector3> CoarseLocations = new List<Vector3>();
2600 List<UUID> AvatarUUIDs = new List<UUID>(); 2600 List<UUID> AvatarUUIDs = new List<UUID>();
2601 List<ScenePresence> avatars = m_scene.GetAvatars(); 2601 m_scene.ForEachScenePresence(delegate(ScenePresence sp)
2602 for (int i = 0; i < avatars.Count; i++)
2603 { 2602 {
2604 // Requested by LibOMV. Send Course Location on self. 2603 if (sp.IsChildAgent)
2605 //if (avatars[i] != this) 2604 return;
2606 //{ 2605
2607 if (avatars[i].ParentID != 0) 2606 if (sp.ParentID != 0)
2607 {
2608 // sitting avatar
2609 SceneObjectPart sop = m_scene.GetSceneObjectPart(sp.ParentID);
2610 if (sop != null)
2608 { 2611 {
2609 // sitting avatar 2612 CoarseLocations.Add(sop.AbsolutePosition + sp.m_pos);
2610 SceneObjectPart sop = m_scene.GetSceneObjectPart(avatars[i].ParentID); 2613 AvatarUUIDs.Add(sp.UUID);
2611 if (sop != null)
2612 {
2613 CoarseLocations.Add(sop.AbsolutePosition + avatars[i].m_pos);
2614 AvatarUUIDs.Add(avatars[i].UUID);
2615 }
2616 else
2617 {
2618 // we can't find the parent.. ! arg!
2619 CoarseLocations.Add(avatars[i].m_pos);
2620 AvatarUUIDs.Add(avatars[i].UUID);
2621 }
2622 } 2614 }
2623 else 2615 else
2624 { 2616 {
2625 CoarseLocations.Add(avatars[i].m_pos); 2617 // we can't find the parent.. ! arg!
2626 AvatarUUIDs.Add(avatars[i].UUID); 2618 CoarseLocations.Add(sp.m_pos);
2619 AvatarUUIDs.Add(sp.UUID);
2627 } 2620 }
2628 //} 2621 }
2629 } 2622 else
2623 {
2624 CoarseLocations.Add(sp.m_pos);
2625 AvatarUUIDs.Add(sp.UUID);
2626 }
2627 });
2630 2628
2631 m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations); 2629 m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations);
2632 2630
@@ -2700,13 +2698,15 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
2700 m_perfMonMS = Util.EnvironmentTickCount(); 2698 m_perfMonMS = Util.EnvironmentTickCount();
2701 2699
2702 // only send update from root agents to other clients; children are only "listening posts" 2700 // only send update from root agents to other clients; children are only "listening posts"
2703 List<ScenePresence> avatars = m_scene.GetAvatars(); 2701 int count = 0;
2704 foreach (ScenePresence avatar in avatars) 2702 m_scene.ForEachScenePresence(delegate(ScenePresence sp)
2705 { 2703 {
2706 SendFullUpdateToOtherClient(avatar); 2704 if (sp.IsChildAgent)
2707 2705 return;
2708 } 2706 SendFullUpdateToOtherClient(sp);
2709 m_scene.StatsReporter.AddAgentUpdates(avatars.Count); 2707 ++count;
2708 });
2709 m_scene.StatsReporter.AddAgentUpdates(count);
2710 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); 2710 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
2711 2711
2712 Animator.SendAnimPack(); 2712 Animator.SendAnimPack();
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs
index 840039c..dd9f8f6 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs
@@ -66,7 +66,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
66 throw new NotImplementedException(); 66 throw new NotImplementedException();
67 } 67 }
68 68
69 public override bool TryGetAvatar(UUID agentID, out ScenePresence scenePresence) 69 public override bool TryGetScenePresence(UUID agentID, out ScenePresence scenePresence)
70 { 70 {
71 throw new NotImplementedException(); 71 throw new NotImplementedException();
72 } 72 }
diff --git a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs
index c864993..2fcc477 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs
@@ -318,9 +318,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge
318 { 318 {
319 Scene scene = client.Scene as Scene; 319 Scene scene = client.Scene as Scene;
320 m_log.DebugFormat("[Concierge]: {0} logs off from {1}", client.Name, scene.RegionInfo.RegionName); 320 m_log.DebugFormat("[Concierge]: {0} logs off from {1}", client.Name, scene.RegionInfo.RegionName);
321 List<ScenePresence> avs = scene.GetAvatars(); 321 AnnounceToAgentsRegion(scene, String.Format(m_announceLeaving, client.Name, scene.RegionInfo.RegionName, scene.GetRootAgentCount()));
322 AnnounceToAgentsRegion(scene, String.Format(m_announceLeaving, client.Name, scene.RegionInfo.RegionName, avs.Count)); 322 UpdateBroker(scene);
323 UpdateBroker(scene, avs);
324 } 323 }
325 } 324 }
326 325
@@ -331,11 +330,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge
331 { 330 {
332 Scene scene = agent.Scene; 331 Scene scene = agent.Scene;
333 m_log.DebugFormat("[Concierge]: {0} enters {1}", agent.Name, scene.RegionInfo.RegionName); 332 m_log.DebugFormat("[Concierge]: {0} enters {1}", agent.Name, scene.RegionInfo.RegionName);
334 List<ScenePresence> avs = scene.GetAvatars();
335 WelcomeAvatar(agent, scene); 333 WelcomeAvatar(agent, scene);
336 AnnounceToAgentsRegion(scene, String.Format(m_announceEntering, agent.Name, 334 AnnounceToAgentsRegion(scene, String.Format(m_announceEntering, agent.Name,
337 scene.RegionInfo.RegionName, avs.Count)); 335 scene.RegionInfo.RegionName, scene.GetRootAgentCount()));
338 UpdateBroker(scene, avs); 336 UpdateBroker(scene);
339 } 337 }
340 } 338 }
341 339
@@ -346,10 +344,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge
346 { 344 {
347 Scene scene = agent.Scene; 345 Scene scene = agent.Scene;
348 m_log.DebugFormat("[Concierge]: {0} leaves {1}", agent.Name, scene.RegionInfo.RegionName); 346 m_log.DebugFormat("[Concierge]: {0} leaves {1}", agent.Name, scene.RegionInfo.RegionName);
349 List<ScenePresence> avs = scene.GetAvatars();
350 AnnounceToAgentsRegion(scene, String.Format(m_announceLeaving, agent.Name, 347 AnnounceToAgentsRegion(scene, String.Format(m_announceLeaving, agent.Name,
351 scene.RegionInfo.RegionName, avs.Count)); 348 scene.RegionInfo.RegionName, scene.GetRootAgentCount()));
352 UpdateBroker(scene, avs); 349 UpdateBroker(scene);
353 } 350 }
354 } 351 }
355 352
@@ -368,7 +365,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge
368 } 365 }
369 } 366 }
370 367
371 protected void UpdateBroker(IScene scene, List<ScenePresence> avatars) 368 protected void UpdateBroker(Scene scene)
372 { 369 {
373 if (String.IsNullOrEmpty(m_brokerURI)) 370 if (String.IsNullOrEmpty(m_brokerURI))
374 return; 371 return;
@@ -377,24 +374,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge
377 374
378 // create XML sniplet 375 // create XML sniplet
379 StringBuilder list = new StringBuilder(); 376 StringBuilder list = new StringBuilder();
380 if (0 == avatars.Count) 377 list.Append(String.Format("<avatars count=\"{0}\" region_name=\"{1}\" region_uuid=\"{2}\" timestamp=\"{3}\">\n",
381 { 378 scene.GetRootAgentCount(), scene.RegionInfo.RegionName,
382 list.Append(String.Format("<avatars count=\"0\" region_name=\"{0}\" region_uuid=\"{1}\" timestamp=\"{2}\" />", 379 scene.RegionInfo.RegionID,
383 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
384 DateTime.UtcNow.ToString("s"))); 380 DateTime.UtcNow.ToString("s")));
385 } 381 scene.ForEachScenePresence(delegate(ScenePresence sp)
386 else
387 { 382 {
388 list.Append(String.Format("<avatars count=\"{0}\" region_name=\"{1}\" region_uuid=\"{2}\" timestamp=\"{3}\">\n", 383 if (!sp.IsChildAgent)
389 avatars.Count, scene.RegionInfo.RegionName,
390 scene.RegionInfo.RegionID,
391 DateTime.UtcNow.ToString("s")));
392 foreach (ScenePresence av in avatars)
393 { 384 {
394 list.Append(String.Format(" <avatar name=\"{0}\" uuid=\"{1}\" />\n", av.Name, av.UUID)); 385 list.Append(String.Format(" <avatar name=\"{0}\" uuid=\"{1}\" />\n", sp.Name, sp.UUID));
386 list.Append("</avatars>");
395 } 387 }
396 list.Append("</avatars>"); 388 });
397 }
398 string payload = list.ToString(); 389 string payload = list.ToString();
399 390
400 // post via REST to broker 391 // post via REST to broker
@@ -529,7 +520,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge
529 // protected void AnnounceToAgentsRegion(Scene scene, string msg) 520 // protected void AnnounceToAgentsRegion(Scene scene, string msg)
530 // { 521 // {
531 // ScenePresence agent = null; 522 // ScenePresence agent = null;
532 // if ((client.Scene is Scene) && (client.Scene as Scene).TryGetAvatar(client.AgentId, out agent)) 523 // if ((client.Scene is Scene) && (client.Scene as Scene).TryGetScenePresence(client.AgentId, out agent))
533 // AnnounceToAgentsRegion(agent, msg); 524 // AnnounceToAgentsRegion(agent, msg);
534 // else 525 // else
535 // m_log.DebugFormat("[Concierge]: could not find an agent for client {0}", client.Name); 526 // m_log.DebugFormat("[Concierge]: could not find an agent for client {0}", client.Name);
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index 68e6497..61c51e0 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -328,17 +328,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
328 } 328 }
329 */ 329 */
330 330
331
332 void OnDirFindQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, int queryStart) 331 void OnDirFindQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, int queryStart)
333 { 332 {
334 if (((DirFindFlags)queryFlags & DirFindFlags.Groups) == DirFindFlags.Groups) 333 if (((DirFindFlags)queryFlags & DirFindFlags.Groups) == DirFindFlags.Groups)
335 { 334 {
336 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called with queryText({1}) queryFlags({2}) queryStart({3})", System.Reflection.MethodBase.GetCurrentMethod().Name, queryText, (DirFindFlags)queryFlags, queryStart); 335 if (m_debugEnabled)
336 m_log.DebugFormat(
337 "[GROUPS]: {0} called with queryText({1}) queryFlags({2}) queryStart({3})",
338 System.Reflection.MethodBase.GetCurrentMethod().Name, queryText, (DirFindFlags)queryFlags, queryStart);
337 339
338 // TODO: This currently ignores pretty much all the query flags including Mature and sort order 340 // TODO: This currently ignores pretty much all the query flags including Mature and sort order
339 remoteClient.SendDirGroupsReply(queryID, m_groupData.FindGroups(GetClientGroupRequestID(remoteClient), queryText).ToArray()); 341 remoteClient.SendDirGroupsReply(
340 } 342 queryID, m_groupData.FindGroups(GetClientGroupRequestID(remoteClient), queryText).ToArray());
341 343 }
342 } 344 }
343 345
344 private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID) 346 private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID)
@@ -363,7 +365,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
363 SendScenePresenceUpdate(dataForAgentID, activeGroupTitle); 365 SendScenePresenceUpdate(dataForAgentID, activeGroupTitle);
364 } 366 }
365 367
366 private void HandleUUIDGroupNameRequest(UUID GroupID,IClientAPI remoteClient) 368 private void HandleUUIDGroupNameRequest(UUID GroupID, IClientAPI remoteClient)
367 { 369 {
368 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 370 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
369 371
@@ -593,6 +595,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
593 return m_groupData.GetGroupRecord(null, GroupID, null); 595 return m_groupData.GetGroupRecord(null, GroupID, null);
594 } 596 }
595 597
598 public GroupRecord GetGroupRecord(string name)
599 {
600 return m_groupData.GetGroupRecord(null, UUID.Zero, name);
601 }
602
596 public void ActivateGroup(IClientAPI remoteClient, UUID groupID) 603 public void ActivateGroup(IClientAPI remoteClient, UUID groupID)
597 { 604 {
598 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 605 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
@@ -652,7 +659,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
652 List<GroupRolesData> data = m_groupData.GetGroupRoles(GetClientGroupRequestID(remoteClient), groupID); 659 List<GroupRolesData> data = m_groupData.GetGroupRoles(GetClientGroupRequestID(remoteClient), groupID);
653 660
654 return data; 661 return data;
655
656 } 662 }
657 663
658 public List<GroupRoleMembersData> GroupRoleMembersRequest(IClientAPI remoteClient, UUID groupID) 664 public List<GroupRoleMembersData> GroupRoleMembersRequest(IClientAPI remoteClient, UUID groupID)
@@ -662,8 +668,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
662 List<GroupRoleMembersData> data = m_groupData.GetGroupRoleMembers(GetClientGroupRequestID(remoteClient), groupID); 668 List<GroupRoleMembersData> data = m_groupData.GetGroupRoleMembers(GetClientGroupRequestID(remoteClient), groupID);
663 669
664 return data; 670 return data;
665
666
667 } 671 }
668 672
669 public GroupProfileData GroupProfileRequest(IClientAPI remoteClient, UUID groupID) 673 public GroupProfileData GroupProfileRequest(IClientAPI remoteClient, UUID groupID)
@@ -712,7 +716,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
712 716
713 public GroupMembershipData GetMembershipData(UUID groupID, UUID agentID) 717 public GroupMembershipData GetMembershipData(UUID groupID, UUID agentID)
714 { 718 {
715 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 719 if (m_debugEnabled)
720 m_log.DebugFormat(
721 "[GROUPS]: {0} called with groupID={1}, agentID={2}",
722 System.Reflection.MethodBase.GetCurrentMethod().Name, groupID, agentID);
716 723
717 return m_groupData.GetAgentGroupMembership(null, agentID, groupID); 724 return m_groupData.GetAgentGroupMembership(null, agentID, groupID);
718 } 725 }
@@ -746,7 +753,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
746 return UUID.Zero; 753 return UUID.Zero;
747 } 754 }
748 // is there is a money module present ? 755 // is there is a money module present ?
749 IMoneyModule money=remoteClient.Scene.RequestModuleInterface<IMoneyModule>(); 756 IMoneyModule money = remoteClient.Scene.RequestModuleInterface<IMoneyModule>();
750 if (money != null) 757 if (money != null)
751 { 758 {
752 // do the transaction, that is if the agent has got sufficient funds 759 // do the transaction, that is if the agent has got sufficient funds
@@ -1166,8 +1173,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1166 else 1173 else
1167 { 1174 {
1168 string domain = string.Empty; //m_sceneList[0].CommsManager.NetworkServersInfo.UserURL; 1175 string domain = string.Empty; //m_sceneList[0].CommsManager.NetworkServersInfo.UserURL;
1169 if (account.ServiceURLs["HomeURI"] != null) 1176 object homeUriObj;
1170 domain = account.ServiceURLs["HomeURI"].ToString(); 1177 if (account.ServiceURLs.TryGetValue("HomeURI", out homeUriObj) && homeUriObj != null)
1178 domain = homeUriObj.ToString();
1171 // They're a local user, use this: 1179 // They're a local user, use this:
1172 info.RequestID.UserServiceURL = domain; 1180 info.RequestID.UserServiceURL = domain;
1173 } 1181 }
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs
index 9e0fa2d..621ab28 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs
@@ -55,7 +55,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
55 GroupInviteInfo GetAgentToGroupInvite(GroupRequestID requestID, UUID inviteID); 55 GroupInviteInfo GetAgentToGroupInvite(GroupRequestID requestID, UUID inviteID);
56 void RemoveAgentToGroupInvite(GroupRequestID requestID, UUID inviteID); 56 void RemoveAgentToGroupInvite(GroupRequestID requestID, UUID inviteID);
57 57
58
59 void AddAgentToGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID); 58 void AddAgentToGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID);
60 void RemoveAgentFromGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID); 59 void RemoveAgentFromGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID);
61 List<GroupRolesData> GetAgentGroupRoles(GroupRequestID requestID, UUID AgentID, UUID GroupID); 60 List<GroupRolesData> GetAgentGroupRoles(GroupRequestID requestID, UUID AgentID, UUID GroupID);
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
index 964d0bb..24ae4f7 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
@@ -47,9 +47,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
47 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 47 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
48 public class XmlRpcGroupsServicesConnectorModule : ISharedRegionModule, IGroupsServicesConnector 48 public class XmlRpcGroupsServicesConnectorModule : ISharedRegionModule, IGroupsServicesConnector
49 { 49 {
50 private static readonly ILog m_log = 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52
53 51
54 public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | 52 public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome |
55 GroupPowers.Accountable | 53 GroupPowers.Accountable |
@@ -354,11 +352,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
354 MemberGroupProfile.PowersMask = MemberInfo.GroupPowers; 352 MemberGroupProfile.PowersMask = MemberInfo.GroupPowers;
355 353
356 return MemberGroupProfile; 354 return MemberGroupProfile;
357
358 } 355 }
359 356
360
361
362 public void SetAgentActiveGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID) 357 public void SetAgentActiveGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID)
363 { 358 {
364 Hashtable param = new Hashtable(); 359 Hashtable param = new Hashtable();
@@ -470,7 +465,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
470 XmlRpcCall(requestID, "groups.removeAgentFromGroupRole", param); 465 XmlRpcCall(requestID, "groups.removeAgentFromGroupRole", param);
471 } 466 }
472 467
473
474 public List<DirGroupsReplyData> FindGroups(GroupRequestID requestID, string search) 468 public List<DirGroupsReplyData> FindGroups(GroupRequestID requestID, string search)
475 { 469 {
476 Hashtable param = new Hashtable(); 470 Hashtable param = new Hashtable();
@@ -531,7 +525,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
531 return HashTableToGroupMembershipData(respData); 525 return HashTableToGroupMembershipData(respData);
532 } 526 }
533 527
534
535 public List<GroupMembershipData> GetAgentGroupMemberships(GroupRequestID requestID, UUID AgentID) 528 public List<GroupMembershipData> GetAgentGroupMemberships(GroupRequestID requestID, UUID AgentID)
536 { 529 {
537 Hashtable param = new Hashtable(); 530 Hashtable param = new Hashtable();
@@ -778,7 +771,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
778 771
779 private GroupRecord GroupProfileHashtableToGroupRecord(Hashtable groupProfile) 772 private GroupRecord GroupProfileHashtableToGroupRecord(Hashtable groupProfile)
780 { 773 {
781
782 GroupRecord group = new GroupRecord(); 774 GroupRecord group = new GroupRecord();
783 group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); 775 group.GroupID = UUID.Parse((string)groupProfile["GroupID"]);
784 group.GroupName = groupProfile["Name"].ToString(); 776 group.GroupName = groupProfile["Name"].ToString();
@@ -797,6 +789,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
797 789
798 return group; 790 return group;
799 } 791 }
792
800 private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData) 793 private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData)
801 { 794 {
802 GroupMembershipData data = new GroupMembershipData(); 795 GroupMembershipData data = new GroupMembershipData();
@@ -829,6 +822,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
829 data.MembershipFee = int.Parse((string)respData["MembershipFee"]); 822 data.MembershipFee = int.Parse((string)respData["MembershipFee"]);
830 data.OpenEnrollment = ((string)respData["OpenEnrollment"] == "1"); 823 data.OpenEnrollment = ((string)respData["OpenEnrollment"] == "1");
831 data.ShowInList = ((string)respData["ShowInList"] == "1"); 824 data.ShowInList = ((string)respData["ShowInList"] == "1");
825
832 return data; 826 return data;
833 } 827 }
834 828
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 6e742f1..ab0be77 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -110,7 +110,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
110 if (m_avatars.ContainsKey(agentID)) 110 if (m_avatars.ContainsKey(agentID))
111 { 111 {
112 ScenePresence sp; 112 ScenePresence sp;
113 scene.TryGetAvatar(agentID, out sp); 113 scene.TryGetScenePresence(agentID, out sp);
114 sp.DoAutoPilot(0, pos, m_avatars[agentID]); 114 sp.DoAutoPilot(0, pos, m_avatars[agentID]);
115 } 115 }
116 } 116 }
@@ -165,7 +165,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
165 p_scene.AddNewClient(npcAvatar); 165 p_scene.AddNewClient(npcAvatar);
166 166
167 ScenePresence sp; 167 ScenePresence sp;
168 if (p_scene.TryGetAvatar(npcAvatar.AgentId, out sp)) 168 if (p_scene.TryGetScenePresence(npcAvatar.AgentId, out sp))
169 { 169 {
170 AvatarAppearance x = GetAppearance(p_cloneAppearanceFrom, p_scene); 170 AvatarAppearance x = GetAppearance(p_cloneAppearanceFrom, p_scene);
171 171
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
index 0b8771c..b42d3bf 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
@@ -625,36 +625,37 @@ namespace OpenSim.Region.RegionCombinerModule
625 return; 625 return;
626 } 626 }
627 627
628 List<ScenePresence> avatars = connectiondata.RegionScene.GetAvatars();
629 List<Vector3> CoarseLocations = new List<Vector3>(); 628 List<Vector3> CoarseLocations = new List<Vector3>();
630 List<UUID> AvatarUUIDs = new List<UUID>(); 629 List<UUID> AvatarUUIDs = new List<UUID>();
631 for (int i = 0; i < avatars.Count; i++) 630 connectiondata.RegionScene.ForEachScenePresence(delegate(ScenePresence sp)
632 { 631 {
633 if (avatars[i].UUID != presence.UUID) 632 if (sp.IsChildAgent)
633 return;
634 if (sp.UUID != presence.UUID)
634 { 635 {
635 if (avatars[i].ParentID != 0) 636 if (sp.ParentID != 0)
636 { 637 {
637 // sitting avatar 638 // sitting avatar
638 SceneObjectPart sop = connectiondata.RegionScene.GetSceneObjectPart(avatars[i].ParentID); 639 SceneObjectPart sop = connectiondata.RegionScene.GetSceneObjectPart(sp.ParentID);
639 if (sop != null) 640 if (sop != null)
640 { 641 {
641 CoarseLocations.Add(sop.AbsolutePosition + avatars[i].AbsolutePosition); 642 CoarseLocations.Add(sop.AbsolutePosition + sp.AbsolutePosition);
642 AvatarUUIDs.Add(avatars[i].UUID); 643 AvatarUUIDs.Add(sp.UUID);
643 } 644 }
644 else 645 else
645 { 646 {
646 // we can't find the parent.. ! arg! 647 // we can't find the parent.. ! arg!
647 CoarseLocations.Add(avatars[i].AbsolutePosition); 648 CoarseLocations.Add(sp.AbsolutePosition);
648 AvatarUUIDs.Add(avatars[i].UUID); 649 AvatarUUIDs.Add(sp.UUID);
649 } 650 }
650 } 651 }
651 else 652 else
652 { 653 {
653 CoarseLocations.Add(avatars[i].AbsolutePosition); 654 CoarseLocations.Add(sp.AbsolutePosition);
654 AvatarUUIDs.Add(avatars[i].UUID); 655 AvatarUUIDs.Add(sp.UUID);
655 } 656 }
656 } 657 }
657 } 658 });
658 DistributeCourseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence); 659 DistributeCourseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence);
659 } 660 }
660 661
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 0c373b9..3f630f4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -5293,7 +5293,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5293 public LSL_Integer llGetRegionAgentCount() 5293 public LSL_Integer llGetRegionAgentCount()
5294 { 5294 {
5295 m_host.AddScriptLPS(1); 5295 m_host.AddScriptLPS(1);
5296 return new LSL_Integer(World.GetAvatars().Count); 5296 return new LSL_Integer(World.GetRootAgentCount());
5297 } 5297 }
5298 5298
5299 public LSL_Vector llGetRegionCorner() 5299 public LSL_Vector llGetRegionCorner()
@@ -9096,17 +9096,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9096 landObject.SetMediaUrl(url); 9096 landObject.SetMediaUrl(url);
9097 9097
9098 // now send to all (non-child) agents 9098 // now send to all (non-child) agents
9099 List<ScenePresence> agents = World.GetAvatars(); 9099 World.ForEachScenePresence(delegate(ScenePresence sp)
9100 foreach (ScenePresence agent in agents)
9101 { 9100 {
9102 agent.ControllingClient.SendParcelMediaUpdate(landData.MediaURL, 9101 if (!sp.IsChildAgent)
9103 landData.MediaID, 9102 {
9104 landData.MediaAutoScale, 9103 sp.ControllingClient.SendParcelMediaUpdate(landData.MediaURL,
9105 mediaType, 9104 landData.MediaID,
9106 description, 9105 landData.MediaAutoScale,
9107 width, height, 9106 mediaType,
9108 loop); 9107 description,
9109 } 9108 width, height,
9109 loop);
9110 }
9111 });
9110 } 9112 }
9111 else if (!presence.IsChildAgent) 9113 else if (!presence.IsChildAgent)
9112 { 9114 {
@@ -9127,13 +9129,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9127 if (presence == null) 9129 if (presence == null)
9128 { 9130 {
9129 // send to all (non-child) agents 9131 // send to all (non-child) agents
9130 List<ScenePresence> agents = World.GetAvatars(); 9132 World.ForEachScenePresence(delegate(ScenePresence sp)
9131 foreach (ScenePresence agent in agents)
9132 { 9133 {
9133 agent.ControllingClient.SendParcelMediaCommand(0x4, // TODO what is this? 9134 if (!sp.IsChildAgent)
9134 (ParcelMediaCommandEnum)commandToSend, 9135 {
9135 time); 9136 sp.ControllingClient.SendParcelMediaCommand(0x4, // TODO what is this?
9136 } 9137 (ParcelMediaCommandEnum)commandToSend,
9138 time);
9139 }
9140 });
9137 } 9141 }
9138 else if (!presence.IsChildAgent) 9142 else if (!presence.IsChildAgent)
9139 { 9143 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 845834e..9474bab 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -697,10 +697,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
697 CheckThreatLevel(ThreatLevel.None, "osGetAgents"); 697 CheckThreatLevel(ThreatLevel.None, "osGetAgents");
698 698
699 LSL_List result = new LSL_List(); 699 LSL_List result = new LSL_List();
700 foreach (ScenePresence avatar in World.GetAvatars()) 700 World.ForEachScenePresence(delegate(ScenePresence sp)
701 { 701 {
702 result.Add(avatar.Name); 702 if (!sp.IsChildAgent)
703 } 703 result.Add(sp.Name);
704 });
704 return result; 705 return result;
705 } 706 }
706 707
@@ -1989,19 +1990,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1989 CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); 1990 CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar");
1990 if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) 1991 if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID))
1991 { 1992 {
1992 foreach (ScenePresence presence in World.GetAvatars()) 1993 World.ForEachScenePresence(delegate(ScenePresence sp)
1993 { 1994 {
1994 if ((presence.Firstname == FirstName) && 1995 if (!sp.IsChildAgent &&
1995 presence.Lastname == SurName) 1996 sp.Firstname == FirstName &&
1997 sp.Lastname == SurName)
1996 { 1998 {
1997 // kick client... 1999 // kick client...
1998 if (alert != null) 2000 if (alert != null)
1999 presence.ControllingClient.Kick(alert); 2001 sp.ControllingClient.Kick(alert);
2000 2002
2001 // ...and close on our side 2003 // ...and close on our side
2002 presence.Scene.IncomingCloseAgent(presence.UUID); 2004 sp.Scene.IncomingCloseAgent(sp.UUID);
2003 } 2005 }
2004 } 2006 });
2005 } 2007 }
2006 } 2008 }
2007 2009
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index 829fbb7..2296379 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -404,70 +404,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
404 404
405 private List<SensedEntity> doAgentSensor(SenseRepeatClass ts) 405 private List<SensedEntity> doAgentSensor(SenseRepeatClass ts)
406 { 406 {
407 List<ScenePresence> presences;
408 List<SensedEntity> sensedEntities = new List<SensedEntity>(); 407 List<SensedEntity> sensedEntities = new List<SensedEntity>();
409 408
410 // If this is an avatar sense by key try to get them directly
411 // rather than getting a list to scan through
412 if (ts.keyID != UUID.Zero)
413 {
414 ScenePresence p = m_CmdManager.m_ScriptEngine.World.GetScenePresence(ts.keyID);
415 if (p == null)
416 return sensedEntities;
417 presences = new List<ScenePresence>();
418 presences.Add(p);
419 }
420 else
421 {
422 presences = new List<ScenePresence>(m_CmdManager.m_ScriptEngine.World.GetScenePresences());
423 }
424
425 // If nobody about quit fast 409 // If nobody about quit fast
426 if (presences.Count == 0) 410 if(m_CmdManager.m_ScriptEngine.World.GetRootAgentCount() == 0)
427 return sensedEntities; 411 return sensedEntities;
428 412
429 SceneObjectPart SensePoint = ts.host; 413 SceneObjectPart SensePoint = ts.host;
430
431 Vector3 fromRegionPos = SensePoint.AbsolutePosition; 414 Vector3 fromRegionPos = SensePoint.AbsolutePosition;
432
433 Quaternion q = SensePoint.RotationOffset; 415 Quaternion q = SensePoint.RotationOffset;
434 LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); 416 LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W);
435 LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r); 417 LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r);
436 double mag_fwd = LSL_Types.Vector3.Mag(forward_dir); 418 double mag_fwd = LSL_Types.Vector3.Mag(forward_dir);
437
438 bool attached = (SensePoint.AttachmentPoint != 0); 419 bool attached = (SensePoint.AttachmentPoint != 0);
439 bool nameSearch = (ts.name != null && ts.name != "");
440 Vector3 toRegionPos; 420 Vector3 toRegionPos;
441 double dis; 421 double dis;
442 422
443 for (int i = 0; i < presences.Count; i++) 423 Action<ScenePresence> senseEntity = new Action<ScenePresence>(delegate(ScenePresence presence)
444 { 424 {
445 ScenePresence presence = presences[i]; 425 if (presence.IsDeleted || presence.IsChildAgent || presence.GodLevel > 0.0)
446 bool keep = true; 426 return;
427
428 // if the object the script is in is attached and the avatar is the owner
429 // then this one is not wanted
430 if (attached && presence.UUID == SensePoint.OwnerID)
431 return;
447 432
448 if (presence.IsDeleted)
449 continue;
450
451 if (presence.IsChildAgent)
452 keep = false;
453 toRegionPos = presence.AbsolutePosition; 433 toRegionPos = presence.AbsolutePosition;
454
455 dis = Math.Abs(Util.GetDistanceTo(toRegionPos, fromRegionPos)); 434 dis = Math.Abs(Util.GetDistanceTo(toRegionPos, fromRegionPos));
456 435
457 // are they in range 436 // are they in range
458 if (keep && dis <= ts.range) 437 if (dis <= ts.range)
459 { 438 {
460 // if the object the script is in is attached and the avatar is the owner
461 // then this one is not wanted
462 if (attached && presence.UUID == SensePoint.OwnerID)
463 keep = false;
464
465 // check the name if needed
466 if (keep && nameSearch && ts.name != presence.Name)
467 keep = false;
468
469 // Are they in the required angle of view 439 // Are they in the required angle of view
470 if (keep && ts.arc < Math.PI) 440 if (ts.arc < Math.PI)
471 { 441 {
472 // not omni-directional. Can you see it ? 442 // not omni-directional. Can you see it ?
473 // vec forward_dir = llRot2Fwd(llGetRot()) 443 // vec forward_dir = llRot2Fwd(llGetRot())
@@ -488,26 +458,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
488 catch 458 catch
489 { 459 {
490 } 460 }
491 if (ang_obj > ts.arc) keep = false; 461 if (ang_obj <= ts.arc)
462 {
463 sensedEntities.Add(new SensedEntity(dis, presence.UUID));
464 }
492 } 465 }
493 } 466 }
494 else 467 });
495 {
496 keep = false;
497 }
498 468
499 // Do not report gods, not even minor ones 469 // If this is an avatar sense by key try to get them directly
500 if (keep && presence.GodLevel > 0.0) 470 // rather than getting a list to scan through
501 keep = false; 471 if (ts.keyID != UUID.Zero)
502 472 {
503 if (keep) // add to list with distance 473 ScenePresence sp;
504 { 474 // Try direct lookup by UUID
505 sensedEntities.Add(new SensedEntity(dis, presence.UUID)); 475 if(!m_CmdManager.m_ScriptEngine.World.TryGetScenePresence(ts.keyID, out sp))
506 }
507
508 // If this is a search by name and we have just found it then no more to do
509 if (nameSearch && ts.name == presence.Name)
510 return sensedEntities; 476 return sensedEntities;
477 senseEntity(sp);
478 }
479 else if (ts.name != null && ts.name != "")
480 {
481 ScenePresence sp;
482 // Try lookup by name will return if/when found
483 if (!m_CmdManager.m_ScriptEngine.World.TryGetAvatarByName(ts.name, out sp))
484 return sensedEntities;
485 senseEntity(sp);
486 }
487 else
488 {
489 m_CmdManager.m_ScriptEngine.World.ForEachScenePresence(senseEntity);
511 } 490 }
512 return sensedEntities; 491 return sensedEntities;
513 } 492 }
diff --git a/OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs b/OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs
index a567413..dcbd717 100644
--- a/OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs
+++ b/OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs
@@ -68,17 +68,15 @@ namespace OpenSim.Region.UserStatistics
68 HTMLUtil.OL_O(ref output, ""); 68 HTMLUtil.OL_O(ref output, "");
69 foreach (Scene scene in all_scenes) 69 foreach (Scene scene in all_scenes)
70 { 70 {
71 List<ScenePresence> avatarInScene = scene.GetScenePresences();
72
73 HTMLUtil.LI_O(ref output, String.Empty); 71 HTMLUtil.LI_O(ref output, String.Empty);
74 output.Append(scene.RegionInfo.RegionName); 72 output.Append(scene.RegionInfo.RegionName);
75 HTMLUtil.OL_O(ref output, String.Empty); 73 HTMLUtil.OL_O(ref output, String.Empty);
76 foreach (ScenePresence av in avatarInScene) 74 scene.ForEachScenePresence(delegate(ScenePresence av)
77 { 75 {
78 Dictionary<string,string> queues = new Dictionary<string, string>(); 76 Dictionary<string, string> queues = new Dictionary<string, string>();
79 if (av.ControllingClient is IStatsCollector) 77 if (av.ControllingClient is IStatsCollector)
80 { 78 {
81 IStatsCollector isClient = (IStatsCollector) av.ControllingClient; 79 IStatsCollector isClient = (IStatsCollector)av.ControllingClient;
82 queues = decodeQueueReport(isClient.Report()); 80 queues = decodeQueueReport(isClient.Report());
83 } 81 }
84 HTMLUtil.LI_O(ref output, String.Empty); 82 HTMLUtil.LI_O(ref output, String.Empty);
@@ -92,8 +90,8 @@ namespace OpenSim.Region.UserStatistics
92 else 90 else
93 { 91 {
94 output.Append(string.Format("<br /><NOBR>Position: <{0},{1},{2}></NOBR>", (int)av.AbsolutePosition.X, 92 output.Append(string.Format("<br /><NOBR>Position: <{0},{1},{2}></NOBR>", (int)av.AbsolutePosition.X,
95 (int) av.AbsolutePosition.Y, 93 (int)av.AbsolutePosition.Y,
96 (int) av.AbsolutePosition.Z)); 94 (int)av.AbsolutePosition.Z));
97 } 95 }
98 Dictionary<string, int> throttles = DecodeClientThrottles(av.ControllingClient.GetThrottlesPacked(1)); 96 Dictionary<string, int> throttles = DecodeClientThrottles(av.ControllingClient.GetThrottlesPacked(1));
99 97
@@ -124,7 +122,7 @@ namespace OpenSim.Region.UserStatistics
124 122
125 HTMLUtil.UL_C(ref output); 123 HTMLUtil.UL_C(ref output);
126 HTMLUtil.LI_C(ref output); 124 HTMLUtil.LI_C(ref output);
127 } 125 });
128 HTMLUtil.OL_C(ref output); 126 HTMLUtil.OL_C(ref output);
129 } 127 }
130 HTMLUtil.OL_C(ref output); 128 HTMLUtil.OL_C(ref output);
diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs
index 77184a4..9e4593e 100644
--- a/OpenSim/Server/Base/HttpServerBase.cs
+++ b/OpenSim/Server/Base/HttpServerBase.cs
@@ -71,6 +71,8 @@ namespace OpenSim.Server.Base
71 return m_Servers[port]; 71 return m_Servers[port];
72 72
73 m_Servers[port] = new BaseHttpServer(port); 73 m_Servers[port] = new BaseHttpServer(port);
74
75 m_Log.InfoFormat("[SERVER]: Starting new HTTP server on port {0}", port);
74 m_Servers[port].Start(); 76 m_Servers[port].Start();
75 77
76 return m_Servers[port]; 78 return m_Servers[port];
@@ -109,6 +111,7 @@ namespace OpenSim.Server.Base
109 111
110 protected override void Initialise() 112 protected override void Initialise()
111 { 113 {
114 m_Log.InfoFormat("[SERVER]: Starting HTTP server on port {0}", m_HttpServer.Port);
112 m_HttpServer.Start(); 115 m_HttpServer.Start();
113 116
114 if (MainConsole.Instance is RemoteConsole) 117 if (MainConsole.Instance is RemoteConsole)
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
index c5fbc9e..27434ad 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
@@ -90,14 +90,14 @@ namespace OpenSim.Services.Connectors.SimianGrid
90 IConfig gridConfig = source.Configs["AssetService"]; 90 IConfig gridConfig = source.Configs["AssetService"];
91 if (gridConfig == null) 91 if (gridConfig == null)
92 { 92 {
93 m_log.Error("[ASSET CONNECTOR]: AssetService missing from OpenSim.ini"); 93 m_log.Error("[SIMIAN ASSET CONNECTOR]: AssetService missing from OpenSim.ini");
94 throw new Exception("Asset connector init error"); 94 throw new Exception("Asset connector init error");
95 } 95 }
96 96
97 string serviceUrl = gridConfig.GetString("AssetServerURI"); 97 string serviceUrl = gridConfig.GetString("AssetServerURI");
98 if (String.IsNullOrEmpty(serviceUrl)) 98 if (String.IsNullOrEmpty(serviceUrl))
99 { 99 {
100 m_log.Error("[ASSET CONNECTOR]: No AssetServerURI in section AssetService"); 100 m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI in section AssetService");
101 throw new Exception("Asset connector init error"); 101 throw new Exception("Asset connector init error");
102 } 102 }
103 103
@@ -162,7 +162,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
162 } 162 }
163 catch (Exception ex) 163 catch (Exception ex)
164 { 164 {
165 m_log.Warn("[ASSET CONNECTOR]: Asset GET from " + url + " failed: " + ex.Message); 165 m_log.Warn("[SIMIAN ASSET CONNECTOR]: Asset GET from " + url + " failed: " + ex.Message);
166 return null; 166 return null;
167 } 167 }
168 } 168 }
@@ -220,7 +220,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
220 } 220 }
221 catch (Exception ex) 221 catch (Exception ex)
222 { 222 {
223 m_log.Warn("[ASSET CONNECTOR]: Asset GET from " + url + " failed: " + ex.Message); 223 m_log.Warn("[SIMIAN ASSET CONNECTOR]: Asset GET from " + url + " failed: " + ex.Message);
224 } 224 }
225 225
226 return metadata; 226 return metadata;
@@ -356,7 +356,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
356 errorMessage = ex.Message; 356 errorMessage = ex.Message;
357 } 357 }
358 358
359 m_log.WarnFormat("[ASSET CONNECTOR]: Failed to store asset \"{0}\" ({1}, {2}): {3}", 359 m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: Failed to store asset \"{0}\" ({1}, {2}): {3}",
360 asset.Name, asset.ID, asset.Metadata.ContentType, errorMessage); 360 asset.Name, asset.ID, asset.Metadata.ContentType, errorMessage);
361 return null; 361 return null;
362 } 362 }
@@ -374,7 +374,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
374 374
375 if (asset == null) 375 if (asset == null)
376 { 376 {
377 m_log.Warn("[ASSET CONNECTOR]: Failed to fetch asset " + id + " for updating"); 377 m_log.Warn("[SIMIAN ASSET CONNECTOR]: Failed to fetch asset " + id + " for updating");
378 return false; 378 return false;
379 } 379 }
380 380
@@ -400,7 +400,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
400 if (response["Success"].AsBoolean()) 400 if (response["Success"].AsBoolean())
401 return true; 401 return true;
402 else 402 else
403 m_log.Warn("[ASSET CONNECTOR]: Failed to delete asset " + id + " from the asset service"); 403 m_log.Warn("[SIMIAN ASSET CONNECTOR]: Failed to delete asset " + id + " from the asset service");
404 404
405 return false; 405 return false;
406 } 406 }
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
index cc53d6c..e78429d 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
@@ -78,14 +78,14 @@ namespace OpenSim.Services.Connectors.SimianGrid
78 IConfig assetConfig = source.Configs["AuthenticationService"]; 78 IConfig assetConfig = source.Configs["AuthenticationService"];
79 if (assetConfig == null) 79 if (assetConfig == null)
80 { 80 {
81 m_log.Error("[AUTH CONNECTOR]: AuthenticationService missing from OpenSim.ini"); 81 m_log.Error("[SIMIAN AUTH CONNECTOR]: AuthenticationService missing from OpenSim.ini");
82 throw new Exception("Authentication connector init error"); 82 throw new Exception("Authentication connector init error");
83 } 83 }
84 84
85 string serviceURI = assetConfig.GetString("AuthenticationServerURI"); 85 string serviceURI = assetConfig.GetString("AuthenticationServerURI");
86 if (String.IsNullOrEmpty(serviceURI)) 86 if (String.IsNullOrEmpty(serviceURI))
87 { 87 {
88 m_log.Error("[AUTH CONNECTOR]: No Server URI named in section AuthenticationService"); 88 m_log.Error("[SIMIAN AUTH CONNECTOR]: No Server URI named in section AuthenticationService");
89 throw new Exception("Authentication connector init error"); 89 throw new Exception("Authentication connector init error");
90 } 90 }
91 91
@@ -114,17 +114,17 @@ namespace OpenSim.Services.Connectors.SimianGrid
114 { 114 {
115 string credential = identity["Credential"].AsString(); 115 string credential = identity["Credential"].AsString();
116 116
117 if (password == credential || Utils.MD5String(password) == credential) 117 if (password == credential || "$1$" + Utils.MD5String(password) == credential)
118 return Authorize(principalID); 118 return Authorize(principalID);
119 } 119 }
120 } 120 }
121 } 121 }
122 122
123 m_log.Warn("[AUTH CONNECTOR]: Authentication failed for " + principalID); 123 m_log.Warn("[SIMIAN AUTH CONNECTOR]: Authentication failed for " + principalID);
124 } 124 }
125 else 125 else
126 { 126 {
127 m_log.Warn("[AUTH CONNECTOR]: Failed to retrieve identities for " + principalID + ": " + 127 m_log.Warn("[SIMIAN AUTH CONNECTOR]: Failed to retrieve identities for " + principalID + ": " +
128 response["Message"].AsString()); 128 response["Message"].AsString());
129 } 129 }
130 130
@@ -146,7 +146,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
146 } 146 }
147 else 147 else
148 { 148 {
149 m_log.Warn("[AUTH CONNECTOR]: Could not verify session for " + principalID + ": " + 149 m_log.Warn("[SIMIAN AUTH CONNECTOR]: Could not verify session for " + principalID + ": " +
150 response["Message"].AsString()); 150 response["Message"].AsString());
151 } 151 }
152 152
@@ -168,7 +168,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
168 } 168 }
169 else 169 else
170 { 170 {
171 m_log.Warn("[AUTH CONNECTOR]: Failed to remove session for " + principalID + ": " + 171 m_log.Warn("[SIMIAN AUTH CONNECTOR]: Failed to remove session for " + principalID + ": " +
172 response["Message"].AsString()); 172 response["Message"].AsString());
173 } 173 }
174 174
@@ -177,9 +177,46 @@ namespace OpenSim.Services.Connectors.SimianGrid
177 177
178 public bool SetPassword(UUID principalID, string passwd) 178 public bool SetPassword(UUID principalID, string passwd)
179 { 179 {
180 // TODO: Use GetIdentities to find the md5hash identity for principalID 180 // Fetch the user name first
181 // and then update it with AddIdentity 181 NameValueCollection requestArgs = new NameValueCollection
182 m_log.Error("[AUTH CONNECTOR]: Changing passwords is not implemented yet"); 182 {
183 { "RequestMethod", "GetUser" },
184 { "UserID", principalID.ToString() }
185 };
186
187 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
188 if (response["Success"].AsBoolean() && response["User"] is OSDMap)
189 {
190 OSDMap userMap = (OSDMap)response["User"];
191 string identifier = userMap["Name"].AsString();
192
193 if (!String.IsNullOrEmpty(identifier))
194 {
195 // Add/update the md5hash identity
196 requestArgs = new NameValueCollection
197 {
198 { "RequestMethod", "AddIdentity" },
199 { "Identifier", identifier },
200 { "Credential", "$1$" + Utils.MD5String(passwd) },
201 { "Type", "md5hash" },
202 { "UserID", principalID.ToString() }
203 };
204
205 response = WebUtil.PostToService(m_serverUrl, requestArgs);
206 bool success = response["Success"].AsBoolean();
207
208 if (!success)
209 m_log.WarnFormat("[SIMIAN AUTH CONNECTOR]: Failed to set password for {0} ({1})", identifier, principalID);
210
211 return success;
212 }
213 }
214 else
215 {
216 m_log.Warn("[SIMIAN AUTH CONNECTOR]: Failed to retrieve identities for " + principalID + ": " +
217 response["Message"].AsString());
218 }
219
183 return false; 220 return false;
184 } 221 }
185 222
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
index 00f9f36..a47f32c 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
@@ -83,14 +83,14 @@ namespace OpenSim.Services.Connectors.SimianGrid
83 IConfig gridConfig = source.Configs["AvatarService"]; 83 IConfig gridConfig = source.Configs["AvatarService"];
84 if (gridConfig == null) 84 if (gridConfig == null)
85 { 85 {
86 m_log.Error("[AVATAR CONNECTOR]: AvatarService missing from OpenSim.ini"); 86 m_log.Error("[SIMIAN AVATAR CONNECTOR]: AvatarService missing from OpenSim.ini");
87 throw new Exception("Avatar connector init error"); 87 throw new Exception("Avatar connector init error");
88 } 88 }
89 89
90 string serviceUrl = gridConfig.GetString("AvatarServerURI"); 90 string serviceUrl = gridConfig.GetString("AvatarServerURI");
91 if (String.IsNullOrEmpty(serviceUrl)) 91 if (String.IsNullOrEmpty(serviceUrl))
92 { 92 {
93 m_log.Error("[AVATAR CONNECTOR]: No AvatarServerURI in section AvatarService"); 93 m_log.Error("[SIMIAN AVATAR CONNECTOR]: No AvatarServerURI in section AvatarService");
94 throw new Exception("Avatar connector init error"); 94 throw new Exception("Avatar connector init error");
95 } 95 }
96 96
@@ -156,14 +156,14 @@ namespace OpenSim.Services.Connectors.SimianGrid
156 } 156 }
157 else 157 else
158 { 158 {
159 m_log.Warn("[AVATAR CONNECTOR]: Failed to get user appearance for " + userID + 159 m_log.Warn("[SIMIAN AVATAR CONNECTOR]: Failed to get user appearance for " + userID +
160 ", LLAppearance is missing or invalid"); 160 ", LLAppearance is missing or invalid");
161 return null; 161 return null;
162 } 162 }
163 } 163 }
164 else 164 else
165 { 165 {
166 m_log.Warn("[AVATAR CONNECTOR]: Failed to get user appearance for " + userID + ": " + 166 m_log.Warn("[SIMIAN AVATAR CONNECTOR]: Failed to get user appearance for " + userID + ": " +
167 response["Message"].AsString()); 167 response["Message"].AsString());
168 } 168 }
169 169
@@ -172,7 +172,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
172 172
173 public bool SetAvatar(UUID userID, AvatarData avatar) 173 public bool SetAvatar(UUID userID, AvatarData avatar)
174 { 174 {
175 m_log.Debug("[AVATAR CONNECTOR]: SetAvatar called for " + userID); 175 m_log.Debug("[SIMIAN AVATAR CONNECTOR]: SetAvatar called for " + userID);
176 176
177 if (avatar.AvatarType == 1) // LLAvatar 177 if (avatar.AvatarType == 1) // LLAvatar
178 { 178 {
@@ -228,32 +228,32 @@ namespace OpenSim.Services.Connectors.SimianGrid
228 bool success = response["Success"].AsBoolean(); 228 bool success = response["Success"].AsBoolean();
229 229
230 if (!success) 230 if (!success)
231 m_log.Warn("[AVATAR CONNECTOR]: Failed saving appearance for " + userID + ": " + response["Message"].AsString()); 231 m_log.Warn("[SIMIAN AVATAR CONNECTOR]: Failed saving appearance for " + userID + ": " + response["Message"].AsString());
232 232
233 return success; 233 return success;
234 } 234 }
235 else 235 else
236 { 236 {
237 m_log.Error("[AVATAR CONNECTOR]: Can't save appearance for " + userID + ". Unhandled avatar type " + avatar.AvatarType); 237 m_log.Error("[SIMIAN AVATAR CONNECTOR]: Can't save appearance for " + userID + ". Unhandled avatar type " + avatar.AvatarType);
238 return false; 238 return false;
239 } 239 }
240 } 240 }
241 241
242 public bool ResetAvatar(UUID userID) 242 public bool ResetAvatar(UUID userID)
243 { 243 {
244 m_log.Error("[AVATAR CONNECTOR]: ResetAvatar called for " + userID + ", implement this"); 244 m_log.Error("[SIMIAN AVATAR CONNECTOR]: ResetAvatar called for " + userID + ", implement this");
245 return false; 245 return false;
246 } 246 }
247 247
248 public bool SetItems(UUID userID, string[] names, string[] values) 248 public bool SetItems(UUID userID, string[] names, string[] values)
249 { 249 {
250 m_log.Error("[AVATAR CONNECTOR]: SetItems called for " + userID + " with " + names.Length + " names and " + values.Length + " values, implement this"); 250 m_log.Error("[SIMIAN AVATAR CONNECTOR]: SetItems called for " + userID + " with " + names.Length + " names and " + values.Length + " values, implement this");
251 return false; 251 return false;
252 } 252 }
253 253
254 public bool RemoveItems(UUID userID, string[] names) 254 public bool RemoveItems(UUID userID, string[] names)
255 { 255 {
256 m_log.Error("[AVATAR CONNECTOR]: RemoveItems called for " + userID + " with " + names.Length + " names, implement this"); 256 m_log.Error("[SIMIAN AVATAR CONNECTOR]: RemoveItems called for " + userID + " with " + names.Length + " names, implement this");
257 return false; 257 return false;
258 } 258 }
259 259
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs
index 89eb72d..89f3594 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs
@@ -89,14 +89,14 @@ namespace OpenSim.Services.Connectors.SimianGrid
89 IConfig assetConfig = source.Configs["FriendsService"]; 89 IConfig assetConfig = source.Configs["FriendsService"];
90 if (assetConfig == null) 90 if (assetConfig == null)
91 { 91 {
92 m_log.Error("[FRIENDS CONNECTOR]: FriendsService missing from OpenSim.ini"); 92 m_log.Error("[SIMIAN FRIENDS CONNECTOR]: FriendsService missing from OpenSim.ini");
93 throw new Exception("Friends connector init error"); 93 throw new Exception("Friends connector init error");
94 } 94 }
95 95
96 string serviceURI = assetConfig.GetString("FriendsServerURI"); 96 string serviceURI = assetConfig.GetString("FriendsServerURI");
97 if (String.IsNullOrEmpty(serviceURI)) 97 if (String.IsNullOrEmpty(serviceURI))
98 { 98 {
99 m_log.Error("[FRIENDS CONNECTOR]: No Server URI named in section FriendsService"); 99 m_log.Error("[SIMIAN FRIENDS CONNECTOR]: No Server URI named in section FriendsService");
100 throw new Exception("Friends connector init error"); 100 throw new Exception("Friends connector init error");
101 } 101 }
102 102
@@ -169,7 +169,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
169 bool success = response["Success"].AsBoolean(); 169 bool success = response["Success"].AsBoolean();
170 170
171 if (!success) 171 if (!success)
172 m_log.Error("[FRIENDS CONNECTOR]: Failed to store friend " + friend + " for user " + principalID + ": " + response["Message"].AsString()); 172 m_log.Error("[SIMIAN FRIENDS CONNECTOR]: Failed to store friend " + friend + " for user " + principalID + ": " + response["Message"].AsString());
173 173
174 return success; 174 return success;
175 } 175 }
@@ -188,7 +188,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
188 bool success = response["Success"].AsBoolean(); 188 bool success = response["Success"].AsBoolean();
189 189
190 if (!success) 190 if (!success)
191 m_log.Error("[FRIENDS CONNECTOR]: Failed to remove friend " + friend + " for user " + principalID + ": " + response["Message"].AsString()); 191 m_log.Error("[SIMIAN FRIENDS CONNECTOR]: Failed to remove friend " + friend + " for user " + principalID + ": " + response["Message"].AsString());
192 192
193 return success; 193 return success;
194 } 194 }
@@ -211,7 +211,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
211 } 211 }
212 else 212 else
213 { 213 {
214 m_log.Warn("[FRIENDS CONNECTOR]: Failed to retrieve friends for user " + ownerID + ": " + response["Message"].AsString()); 214 m_log.Warn("[SIMIAN FRIENDS CONNECTOR]: Failed to retrieve friends for user " + ownerID + ": " + response["Message"].AsString());
215 return new OSDArray(0); 215 return new OSDArray(0);
216 } 216 }
217 } 217 }
@@ -232,7 +232,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
232 } 232 }
233 else 233 else
234 { 234 {
235 m_log.Warn("[FRIENDS CONNECTOR]: Failed to retrieve reverse friends for user " + ownerID + ": " + response["Message"].AsString()); 235 m_log.Warn("[SIMIAN FRIENDS CONNECTOR]: Failed to retrieve reverse friends for user " + ownerID + ": " + response["Message"].AsString());
236 return new OSDArray(0); 236 return new OSDArray(0);
237 } 237 }
238 } 238 }
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
index 071a481..3a61226 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
@@ -85,14 +85,14 @@ namespace OpenSim.Services.Connectors.SimianGrid
85 IConfig gridConfig = source.Configs["GridService"]; 85 IConfig gridConfig = source.Configs["GridService"];
86 if (gridConfig == null) 86 if (gridConfig == null)
87 { 87 {
88 m_log.Error("[GRID CONNECTOR]: GridService missing from OpenSim.ini"); 88 m_log.Error("[SIMIAN GRID CONNECTOR]: GridService missing from OpenSim.ini");
89 throw new Exception("Grid connector init error"); 89 throw new Exception("Grid connector init error");
90 } 90 }
91 91
92 string serviceUrl = gridConfig.GetString("GridServerURI"); 92 string serviceUrl = gridConfig.GetString("GridServerURI");
93 if (String.IsNullOrEmpty(serviceUrl)) 93 if (String.IsNullOrEmpty(serviceUrl))
94 { 94 {
95 m_log.Error("[GRID CONNECTOR]: No Server URI named in section GridService"); 95 m_log.Error("[SIMIAN GRID CONNECTOR]: No Server URI named in section GridService");
96 throw new Exception("Grid connector init error"); 96 throw new Exception("Grid connector init error");
97 } 97 }
98 98
@@ -155,7 +155,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
155 bool success = response["Success"].AsBoolean(); 155 bool success = response["Success"].AsBoolean();
156 156
157 if (!success) 157 if (!success)
158 m_log.Warn("[GRID CONNECTOR]: Region deregistration for " + regionID + " failed: " + response["Message"].AsString()); 158 m_log.Warn("[SIMIAN GRID CONNECTOR]: Region deregistration for " + regionID + " failed: " + response["Message"].AsString());
159 159
160 return success; 160 return success;
161 } 161 }
@@ -181,7 +181,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
181 } 181 }
182 } 182 }
183 183
184 m_log.Debug("[GRID CONNECTOR]: Found " + regions.Count + " neighbors for region " + regionID); 184 m_log.Debug("[SIMIAN GRID CONNECTOR]: Found " + regions.Count + " neighbors for region " + regionID);
185 return regions; 185 return regions;
186 } 186 }
187 187
@@ -203,7 +203,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
203 } 203 }
204 else 204 else
205 { 205 {
206 m_log.Warn("[GRID CONNECTOR]: Grid service did not find a match for region " + regionID); 206 m_log.Warn("[SIMIAN GRID CONNECTOR]: Grid service did not find a match for region " + regionID);
207 return null; 207 return null;
208 } 208 }
209 } 209 }
@@ -228,7 +228,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
228 } 228 }
229 else 229 else
230 { 230 {
231 //m_log.InfoFormat("[GRID CONNECTOR]: Grid service did not find a match for region at {0},{1}", 231 //m_log.InfoFormat("[SIMIAN GRID CONNECTOR]: Grid service did not find a match for region at {0},{1}",
232 // x / Constants.RegionSize, y / Constants.RegionSize); 232 // x / Constants.RegionSize, y / Constants.RegionSize);
233 return null; 233 return null;
234 } 234 }
@@ -238,7 +238,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
238 { 238 {
239 List<GridRegion> regions = GetRegionsByName(scopeID, regionName, 1); 239 List<GridRegion> regions = GetRegionsByName(scopeID, regionName, 1);
240 240
241 m_log.Debug("[GRID CONNECTOR]: Got " + regions.Count + " matches for region name " + regionName); 241 m_log.Debug("[SIMIAN GRID CONNECTOR]: Got " + regions.Count + " matches for region name " + regionName);
242 242
243 if (regions.Count > 0) 243 if (regions.Count > 0)
244 return regions[0]; 244 return regions[0];
@@ -349,7 +349,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
349 } 349 }
350 else 350 else
351 { 351 {
352 m_log.Warn("[GRID CONNECTOR]: Grid service did not find a match for region " + regionID + " during region flags check"); 352 m_log.Warn("[SIMIAN GRID CONNECTOR]: Grid service did not find a match for region " + regionID + " during region flags check");
353 return -1; 353 return -1;
354 } 354 }
355 } 355 }
@@ -374,7 +374,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
374 } 374 }
375 else 375 else
376 { 376 {
377 m_log.Warn("[GRID CONNECTOR]: Grid service did not find a match for region at " + position); 377 m_log.Warn("[SIMIAN GRID CONNECTOR]: Grid service did not find a match for region at " + position);
378 return null; 378 return null;
379 } 379 }
380 } 380 }
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
index 67f8e80..56e7475 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
@@ -97,14 +97,14 @@ namespace OpenSim.Services.Connectors.SimianGrid
97 IConfig gridConfig = source.Configs["InventoryService"]; 97 IConfig gridConfig = source.Configs["InventoryService"];
98 if (gridConfig == null) 98 if (gridConfig == null)
99 { 99 {
100 m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); 100 m_log.Error("[SIMIAN INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini");
101 throw new Exception("Inventory connector init error"); 101 throw new Exception("Inventory connector init error");
102 } 102 }
103 103
104 string serviceUrl = gridConfig.GetString("InventoryServerURI"); 104 string serviceUrl = gridConfig.GetString("InventoryServerURI");
105 if (String.IsNullOrEmpty(serviceUrl)) 105 if (String.IsNullOrEmpty(serviceUrl))
106 { 106 {
107 m_log.Error("[INVENTORY CONNECTOR]: No Server URI named in section InventoryService"); 107 m_log.Error("[SIMIAN INVENTORY CONNECTOR]: No Server URI named in section InventoryService");
108 throw new Exception("Inventory connector init error"); 108 throw new Exception("Inventory connector init error");
109 } 109 }
110 110
@@ -117,11 +117,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
117 if (!String.IsNullOrEmpty(serviceUrl)) 117 if (!String.IsNullOrEmpty(serviceUrl))
118 m_userServerUrl = serviceUrl; 118 m_userServerUrl = serviceUrl;
119 else 119 else
120 m_log.Info("[INVENTORY CONNECTOR]: No Server URI named in section UserAccountService"); 120 m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No Server URI named in section UserAccountService");
121 } 121 }
122 else 122 else
123 { 123 {
124 m_log.Warn("[INVENTORY CONNECTOR]: UserAccountService missing from OpenSim.ini"); 124 m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: UserAccountService missing from OpenSim.ini");
125 } 125 }
126 } 126 }
127 } 127 }
@@ -143,7 +143,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
143 bool success = response["Success"].AsBoolean(); 143 bool success = response["Success"].AsBoolean();
144 144
145 if (!success) 145 if (!success)
146 m_log.Warn("[INVENTORY CONNECTOR]: Inventory creation for " + userID + " failed: " + response["Message"].AsString()); 146 m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Inventory creation for " + userID + " failed: " + response["Message"].AsString());
147 147
148 return success; 148 return success;
149 } 149 }
@@ -173,7 +173,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
173 } 173 }
174 else 174 else
175 { 175 {
176 m_log.Warn("[INVENTORY CONNECTOR]: Failed to retrieve inventory skeleton for " + userID + ": " + 176 m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Failed to retrieve inventory skeleton for " + userID + ": " +
177 response["Message"].AsString()); 177 response["Message"].AsString());
178 return new List<InventoryFolderBase>(0); 178 return new List<InventoryFolderBase>(0);
179 } 179 }
@@ -187,7 +187,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
187 [Obsolete] 187 [Obsolete]
188 public InventoryCollection GetUserInventory(UUID userID) 188 public InventoryCollection GetUserInventory(UUID userID)
189 { 189 {
190 m_log.Error("[INVENTORY CONNECTOR]: Obsolete GetUserInventory called for " + userID); 190 m_log.Error("[SIMIAN INVENTORY CONNECTOR]: Obsolete GetUserInventory called for " + userID);
191 191
192 InventoryCollection inventory = new InventoryCollection(); 192 InventoryCollection inventory = new InventoryCollection();
193 inventory.UserID = userID; 193 inventory.UserID = userID;
@@ -206,7 +206,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
206 [Obsolete] 206 [Obsolete]
207 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) 207 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
208 { 208 {
209 m_log.Error("[INVENTORY CONNECTOR]: Obsolete GetUserInventory called for " + userID); 209 m_log.Error("[SIMIAN INVENTORY CONNECTOR]: Obsolete GetUserInventory called for " + userID);
210 callback(new List<InventoryFolderImpl>(0), new List<InventoryItemBase>(0)); 210 callback(new List<InventoryFolderImpl>(0), new List<InventoryItemBase>(0));
211 } 211 }
212 212
@@ -273,7 +273,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
273 } 273 }
274 else 274 else
275 { 275 {
276 m_log.Warn("[INVENTORY CONNECTOR]: Default folder not found for content type " + contentType); 276 m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Default folder not found for content type " + contentType + ": " + response["Message"].AsString());
277 return GetRootFolder(userID); 277 return GetRootFolder(userID);
278 } 278 }
279 } 279 }
@@ -311,7 +311,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
311 } 311 }
312 } 312 }
313 313
314 m_log.Warn("[INVENTORY CONNECTOR]: Item " + item.ID + " owned by " + item.Owner + " not found"); 314 m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Item " + item.ID + " owned by " + item.Owner + " not found");
315 return null; 315 return null;
316 } 316 }
317 317
@@ -376,7 +376,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
376 } 376 }
377 else 377 else
378 { 378 {
379 m_log.Warn("[INVENTORY CONNECTOR]: Error fetching folder " + folderID + " content for " + userID + ": " + 379 m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Error fetching folder " + folderID + " content for " + userID + ": " +
380 response["Message"].AsString()); 380 response["Message"].AsString());
381 inventory.Folders = new List<InventoryFolderBase>(0); 381 inventory.Folders = new List<InventoryFolderBase>(0);
382 inventory.Items = new List<InventoryItemBase>(0); 382 inventory.Items = new List<InventoryItemBase>(0);
@@ -414,7 +414,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
414 } 414 }
415 else 415 else
416 { 416 {
417 m_log.Warn("[INVENTORY CONNECTOR]: Error fetching folder " + folderID + " for " + userID + ": " + 417 m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Error fetching folder " + folderID + " for " + userID + ": " +
418 response["Message"].AsString()); 418 response["Message"].AsString());
419 return new List<InventoryItemBase>(0); 419 return new List<InventoryItemBase>(0);
420 } 420 }
@@ -442,7 +442,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
442 442
443 if (!success) 443 if (!success)
444 { 444 {
445 m_log.Warn("[INVENTORY CONNECTOR]: Error creating folder " + folder.Name + " for " + folder.Owner + ": " + 445 m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Error creating folder " + folder.Name + " for " + folder.Owner + ": " +
446 response["Message"].AsString()); 446 response["Message"].AsString());
447 } 447 }
448 448
@@ -506,7 +506,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
506 506
507 if (!success) 507 if (!success)
508 { 508 {
509 m_log.Warn("[INVENTORY CONNECTOR]: Error removing item " + itemID + " for " + userID + ": " + 509 m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Error removing item " + itemID + " for " + userID + ": " +
510 response["Message"].AsString()); 510 response["Message"].AsString());
511 allSuccess = false; 511 allSuccess = false;
512 } 512 }
@@ -534,7 +534,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
534 534
535 if (!success) 535 if (!success)
536 { 536 {
537 m_log.Warn("[INVENTORY CONNECTOR]: Error purging folder " + folder.ID + " for " + folder.Owner + ": " + 537 m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Error purging folder " + folder.ID + " for " + folder.Owner + ": " +
538 response["Message"].AsString()); 538 response["Message"].AsString());
539 } 539 }
540 540
@@ -562,7 +562,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
562 UpdateGesture(item.Owner, item.ID, item.Flags == 1); 562 UpdateGesture(item.Owner, item.ID, item.Flags == 1);
563 563
564 if (item.BasePermissions == 0) 564 if (item.BasePermissions == 0)
565 m_log.WarnFormat("[INVENTORY CONNECTOR]: Adding inventory item {0} ({1}) with no base permissions", item.Name, item.ID); 565 m_log.WarnFormat("[SIMIAN INVENTORY CONNECTOR]: Adding inventory item {0} ({1}) with no base permissions", item.Name, item.ID);
566 566
567 OSDMap permissions = new OSDMap 567 OSDMap permissions = new OSDMap
568 { 568 {
@@ -601,7 +601,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
601 601
602 if (!success) 602 if (!success)
603 { 603 {
604 m_log.Warn("[INVENTORY CONNECTOR]: Error creating item " + item.Name + " for " + item.Owner + ": " + 604 m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Error creating item " + item.Name + " for " + item.Owner + ": " +
605 response["Message"].AsString()); 605 response["Message"].AsString());
606 } 606 }
607 607
@@ -785,7 +785,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
785 785
786 if (invItem.BasePermissions == 0) 786 if (invItem.BasePermissions == 0)
787 { 787 {
788 m_log.InfoFormat("[INVENTORY CONNECTOR]: Forcing item permissions to full for item {0} ({1})", 788 m_log.InfoFormat("[SIMIAN INVENTORY CONNECTOR]: Forcing item permissions to full for item {0} ({1})",
789 invItem.Name, invItem.ID); 789 invItem.Name, invItem.ID);
790 invItem.BasePermissions = (uint)PermissionMask.All; 790 invItem.BasePermissions = (uint)PermissionMask.All;
791 invItem.CurrentPermissions = (uint)PermissionMask.All; 791 invItem.CurrentPermissions = (uint)PermissionMask.All;
@@ -820,7 +820,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
820 820
821 if (!success) 821 if (!success)
822 { 822 {
823 m_log.Warn("[INVENTORY CONNECTOR]: Failed to move " + items.Count + " items to " + 823 m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Failed to move " + items.Count + " items to " +
824 destFolderID + ": " + response["Message"].AsString()); 824 destFolderID + ": " + response["Message"].AsString());
825 } 825 }
826 826
@@ -863,12 +863,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
863 if (gestures != null && gestures is OSDArray) 863 if (gestures != null && gestures is OSDArray)
864 return (OSDArray)gestures; 864 return (OSDArray)gestures;
865 else 865 else
866 m_log.Error("[INVENTORY CONNECTOR]: Unrecognized active gestures data for " + userID); 866 m_log.Error("[SIMIAN INVENTORY CONNECTOR]: Unrecognized active gestures data for " + userID);
867 } 867 }
868 } 868 }
869 else 869 else
870 { 870 {
871 m_log.Warn("[INVENTORY CONNECTOR]: Failed to fetch active gestures for " + userID + ": " + 871 m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Failed to fetch active gestures for " + userID + ": " +
872 response["Message"].AsString()); 872 response["Message"].AsString());
873 } 873 }
874 874
@@ -887,7 +887,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
887 OSDMap response = WebUtil.PostToService(m_userServerUrl, requestArgs); 887 OSDMap response = WebUtil.PostToService(m_userServerUrl, requestArgs);
888 if (!response["Success"].AsBoolean()) 888 if (!response["Success"].AsBoolean())
889 { 889 {
890 m_log.Warn("[INVENTORY CONNECTOR]: Failed to save active gestures for " + userID + ": " + 890 m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Failed to save active gestures for " + userID + ": " +
891 response["Message"].AsString()); 891 response["Message"].AsString());
892 } 892 }
893 } 893 }
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
index 5e0f7c2..696be94 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
@@ -109,14 +109,14 @@ namespace OpenSim.Services.Connectors.SimianGrid
109 IConfig gridConfig = source.Configs["PresenceService"]; 109 IConfig gridConfig = source.Configs["PresenceService"];
110 if (gridConfig == null) 110 if (gridConfig == null)
111 { 111 {
112 m_log.Error("[PRESENCE CONNECTOR]: PresenceService missing from OpenSim.ini"); 112 m_log.Error("[SIMIAN PRESENCE CONNECTOR]: PresenceService missing from OpenSim.ini");
113 throw new Exception("Presence connector init error"); 113 throw new Exception("Presence connector init error");
114 } 114 }
115 115
116 string serviceUrl = gridConfig.GetString("PresenceServerURI"); 116 string serviceUrl = gridConfig.GetString("PresenceServerURI");
117 if (String.IsNullOrEmpty(serviceUrl)) 117 if (String.IsNullOrEmpty(serviceUrl))
118 { 118 {
119 m_log.Error("[PRESENCE CONNECTOR]: No PresenceServerURI in section PresenceService"); 119 m_log.Error("[SIMIAN PRESENCE CONNECTOR]: No PresenceServerURI in section PresenceService");
120 throw new Exception("Presence connector init error"); 120 throw new Exception("Presence connector init error");
121 } 121 }
122 122
@@ -128,7 +128,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
128 128
129 public bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID) 129 public bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID)
130 { 130 {
131 m_log.ErrorFormat("[PRESENCE CONNECTOR]: Login requested, UserID={0}, SessionID={1}, SecureSessionID={2}", 131 m_log.ErrorFormat("[SIMIAN PRESENCE CONNECTOR]: Login requested, UserID={0}, SessionID={1}, SecureSessionID={2}",
132 userID, sessionID, secureSessionID); 132 userID, sessionID, secureSessionID);
133 133
134 NameValueCollection requestArgs = new NameValueCollection 134 NameValueCollection requestArgs = new NameValueCollection
@@ -146,14 +146,14 @@ namespace OpenSim.Services.Connectors.SimianGrid
146 bool success = response["Success"].AsBoolean(); 146 bool success = response["Success"].AsBoolean();
147 147
148 if (!success) 148 if (!success)
149 m_log.Warn("[PRESENCE CONNECTOR]: Failed to login agent " + userID + ": " + response["Message"].AsString()); 149 m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to login agent " + userID + ": " + response["Message"].AsString());
150 150
151 return success; 151 return success;
152 } 152 }
153 153
154 public bool LogoutAgent(UUID sessionID, Vector3 position, Vector3 lookAt) 154 public bool LogoutAgent(UUID sessionID, Vector3 position, Vector3 lookAt)
155 { 155 {
156 m_log.InfoFormat("[PRESENCE CONNECTOR]: Logout requested for agent with sessionID " + sessionID); 156 m_log.InfoFormat("[SIMIAN PRESENCE CONNECTOR]: Logout requested for agent with sessionID " + sessionID);
157 157
158 NameValueCollection requestArgs = new NameValueCollection 158 NameValueCollection requestArgs = new NameValueCollection
159 { 159 {
@@ -165,14 +165,14 @@ namespace OpenSim.Services.Connectors.SimianGrid
165 bool success = response["Success"].AsBoolean(); 165 bool success = response["Success"].AsBoolean();
166 166
167 if (!success) 167 if (!success)
168 m_log.Warn("[PRESENCE CONNECTOR]: Failed to logout agent with sessionID " + sessionID + ": " + response["Message"].AsString()); 168 m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to logout agent with sessionID " + sessionID + ": " + response["Message"].AsString());
169 169
170 return success; 170 return success;
171 } 171 }
172 172
173 public bool LogoutRegionAgents(UUID regionID) 173 public bool LogoutRegionAgents(UUID regionID)
174 { 174 {
175 m_log.InfoFormat("[PRESENCE CONNECTOR]: Logout requested for all agents in region " + regionID); 175 m_log.InfoFormat("[SIMIAN PRESENCE CONNECTOR]: Logout requested for all agents in region " + regionID);
176 176
177 NameValueCollection requestArgs = new NameValueCollection 177 NameValueCollection requestArgs = new NameValueCollection
178 { 178 {
@@ -184,14 +184,14 @@ namespace OpenSim.Services.Connectors.SimianGrid
184 bool success = response["Success"].AsBoolean(); 184 bool success = response["Success"].AsBoolean();
185 185
186 if (!success) 186 if (!success)
187 m_log.Warn("[PRESENCE CONNECTOR]: Failed to logout agents from region " + regionID + ": " + response["Message"].AsString()); 187 m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to logout agents from region " + regionID + ": " + response["Message"].AsString());
188 188
189 return success; 189 return success;
190 } 190 }
191 191
192 public bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt) 192 public bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt)
193 { 193 {
194 //m_log.DebugFormat("[PRESENCE CONNECTOR]: Updating session data for agent with sessionID " + sessionID); 194 //m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Updating session data for agent with sessionID " + sessionID);
195 195
196 NameValueCollection requestArgs = new NameValueCollection 196 NameValueCollection requestArgs = new NameValueCollection
197 { 197 {
@@ -206,14 +206,14 @@ namespace OpenSim.Services.Connectors.SimianGrid
206 bool success = response["Success"].AsBoolean(); 206 bool success = response["Success"].AsBoolean();
207 207
208 if (!success) 208 if (!success)
209 m_log.Warn("[PRESENCE CONNECTOR]: Failed to update agent session " + sessionID + ": " + response["Message"].AsString()); 209 m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to update agent session " + sessionID + ": " + response["Message"].AsString());
210 210
211 return success; 211 return success;
212 } 212 }
213 213
214 public PresenceInfo GetAgent(UUID sessionID) 214 public PresenceInfo GetAgent(UUID sessionID)
215 { 215 {
216 m_log.DebugFormat("[PRESENCE CONNECTOR]: Requesting session data for agent with sessionID " + sessionID); 216 m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for agent with sessionID " + sessionID);
217 217
218 NameValueCollection requestArgs = new NameValueCollection 218 NameValueCollection requestArgs = new NameValueCollection
219 { 219 {
@@ -225,7 +225,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
225 if (sessionResponse["Success"].AsBoolean()) 225 if (sessionResponse["Success"].AsBoolean())
226 { 226 {
227 UUID userID = sessionResponse["UserID"].AsUUID(); 227 UUID userID = sessionResponse["UserID"].AsUUID();
228 m_log.DebugFormat("[PRESENCE CONNECTOR]: Requesting user data for " + userID); 228 m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting user data for " + userID);
229 229
230 requestArgs = new NameValueCollection 230 requestArgs = new NameValueCollection
231 { 231 {
@@ -237,11 +237,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
237 if (userResponse["Success"].AsBoolean()) 237 if (userResponse["Success"].AsBoolean())
238 return ResponseToPresenceInfo(sessionResponse, userResponse); 238 return ResponseToPresenceInfo(sessionResponse, userResponse);
239 else 239 else
240 m_log.Warn("[PRESENCE CONNECTOR]: Failed to retrieve user data for " + userID + ": " + userResponse["Message"].AsString()); 240 m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve user data for " + userID + ": " + userResponse["Message"].AsString());
241 } 241 }
242 else 242 else
243 { 243 {
244 m_log.Warn("[PRESENCE CONNECTOR]: Failed to retrieve session " + sessionID + ": " + sessionResponse["Message"].AsString()); 244 m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve session " + sessionID + ": " + sessionResponse["Message"].AsString());
245 } 245 }
246 246
247 return null; 247 return null;
@@ -263,7 +263,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
263 263
264 public bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt) 264 public bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt)
265 { 265 {
266 m_log.DebugFormat("[PRESENCE CONNECTOR]: Setting home location for user " + userID); 266 m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Setting home location for user " + userID);
267 267
268 NameValueCollection requestArgs = new NameValueCollection 268 NameValueCollection requestArgs = new NameValueCollection
269 { 269 {
@@ -276,7 +276,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
276 bool success = response["Success"].AsBoolean(); 276 bool success = response["Success"].AsBoolean();
277 277
278 if (!success) 278 if (!success)
279 m_log.Warn("[PRESENCE CONNECTOR]: Failed to set home location for " + userID + ": " + response["Message"].AsString()); 279 m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to set home location for " + userID + ": " + response["Message"].AsString());
280 280
281 return success; 281 return success;
282 } 282 }
@@ -301,7 +301,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
301 private void SignificantClientMovementHandler(IClientAPI client) 301 private void SignificantClientMovementHandler(IClientAPI client)
302 { 302 {
303 ScenePresence sp; 303 ScenePresence sp;
304 if (client.Scene is Scene && ((Scene)client.Scene).TryGetAvatar(client.AgentId, out sp)) 304 if (client.Scene is Scene && ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out sp))
305 ReportAgent(sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); 305 ReportAgent(sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
306 } 306 }
307 307
@@ -312,7 +312,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
312 client.OnConnectionClosed -= LogoutHandler; 312 client.OnConnectionClosed -= LogoutHandler;
313 313
314 object obj; 314 object obj;
315 if (client.Scene.TryGetAvatar(client.AgentId, out obj) && obj is ScenePresence) 315 if (client.Scene.TryGetScenePresence(client.AgentId, out obj) && obj is ScenePresence)
316 { 316 {
317 // The avatar is still in the scene, we can get the exact logout position 317 // The avatar is still in the scene, we can get the exact logout position
318 ScenePresence sp = (ScenePresence)obj; 318 ScenePresence sp = (ScenePresence)obj;
@@ -335,7 +335,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
335 335
336 private OSDMap GetUserData(UUID userID) 336 private OSDMap GetUserData(UUID userID)
337 { 337 {
338 m_log.DebugFormat("[PRESENCE CONNECTOR]: Requesting user data for " + userID); 338 m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting user data for " + userID);
339 339
340 NameValueCollection requestArgs = new NameValueCollection 340 NameValueCollection requestArgs = new NameValueCollection
341 { 341 {
@@ -347,14 +347,14 @@ namespace OpenSim.Services.Connectors.SimianGrid
347 if (response["Success"].AsBoolean() && response["User"] is OSDMap) 347 if (response["Success"].AsBoolean() && response["User"] is OSDMap)
348 return response; 348 return response;
349 else 349 else
350 m_log.Warn("[PRESENCE CONNECTOR]: Failed to retrieve user data for " + userID + ": " + response["Message"].AsString()); 350 m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve user data for " + userID + ": " + response["Message"].AsString());
351 351
352 return null; 352 return null;
353 } 353 }
354 354
355 private OSDMap GetSessionData(UUID sessionID) 355 private OSDMap GetSessionData(UUID sessionID)
356 { 356 {
357 m_log.DebugFormat("[PRESENCE CONNECTOR]: Requesting session data for session " + sessionID); 357 m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for session " + sessionID);
358 358
359 NameValueCollection requestArgs = new NameValueCollection 359 NameValueCollection requestArgs = new NameValueCollection
360 { 360 {
@@ -366,7 +366,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
366 if (response["Success"].AsBoolean()) 366 if (response["Success"].AsBoolean())
367 return response; 367 return response;
368 else 368 else
369 m_log.Warn("[PRESENCE CONNECTOR]: Failed to retrieve session data for session " + sessionID); 369 m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve session data for session " + sessionID);
370 370
371 return null; 371 return null;
372 } 372 }
@@ -378,7 +378,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
378 OSDMap userResponse = GetUserData(userID); 378 OSDMap userResponse = GetUserData(userID);
379 if (userResponse != null) 379 if (userResponse != null)
380 { 380 {
381 m_log.DebugFormat("[PRESENCE CONNECTOR]: Requesting sessions for " + userID); 381 m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting sessions for " + userID);
382 382
383 NameValueCollection requestArgs = new NameValueCollection 383 NameValueCollection requestArgs = new NameValueCollection
384 { 384 {
@@ -395,7 +395,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
395 } 395 }
396 else 396 else
397 { 397 {
398 m_log.Warn("[PRESENCE CONNECTOR]: Failed to retrieve sessions for " + userID + ": " + response["Message"].AsString()); 398 m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve sessions for " + userID + ": " + response["Message"].AsString());
399 } 399 }
400 } 400 }
401 401
@@ -428,7 +428,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
428 } 428 }
429 else 429 else
430 { 430 {
431 m_log.Warn("[PRESENCE CONNECTOR]: Failed to retrieve presence information for session " + sessionID + 431 m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve presence information for session " + sessionID +
432 " while saving last location: " + response["Message"].AsString()); 432 " while saving last location: " + response["Message"].AsString());
433 } 433 }
434 434
@@ -448,7 +448,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
448 bool success = response["Success"].AsBoolean(); 448 bool success = response["Success"].AsBoolean();
449 449
450 if (!success) 450 if (!success)
451 m_log.Warn("[PRESENCE CONNECTOR]: Failed to set last location for " + userID + ": " + response["Message"].AsString()); 451 m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to set last location for " + userID + ": " + response["Message"].AsString());
452 452
453 return success; 453 return success;
454 } 454 }
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
index 0a36ae5..fbf4648 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
@@ -93,14 +93,14 @@ namespace OpenSim.Services.Connectors.SimianGrid
93 IConfig gridConfig = source.Configs["UserAccountService"]; 93 IConfig gridConfig = source.Configs["UserAccountService"];
94 if (gridConfig == null) 94 if (gridConfig == null)
95 { 95 {
96 m_log.Error("[PROFILES]: UserAccountService missing from OpenSim.ini"); 96 m_log.Error("[SIMIAN PROFILES]: UserAccountService missing from OpenSim.ini");
97 throw new Exception("Profiles init error"); 97 throw new Exception("Profiles init error");
98 } 98 }
99 99
100 string serviceUrl = gridConfig.GetString("UserAccountServerURI"); 100 string serviceUrl = gridConfig.GetString("UserAccountServerURI");
101 if (String.IsNullOrEmpty(serviceUrl)) 101 if (String.IsNullOrEmpty(serviceUrl))
102 { 102 {
103 m_log.Error("[PROFILES]: No UserAccountServerURI in section UserAccountService"); 103 m_log.Error("[SIMIAN PROFILES]: No UserAccountServerURI in section UserAccountService");
104 throw new Exception("Profiles init error"); 104 throw new Exception("Profiles init error");
105 } 105 }
106 106
@@ -153,7 +153,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
153 UUID targetAvatarID; 153 UUID targetAvatarID;
154 if (args.Count < 1 || !UUID.TryParse(args[0], out targetAvatarID)) 154 if (args.Count < 1 || !UUID.TryParse(args[0], out targetAvatarID))
155 { 155 {
156 m_log.Error("[PROFILES]: Unrecognized arguments for " + method); 156 m_log.Error("[SIMIAN PROFILES]: Unrecognized arguments for " + method);
157 return; 157 return;
158 } 158 }
159 159
@@ -193,7 +193,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
193 UUID targetAvatarID; 193 UUID targetAvatarID;
194 if (args.Count < 1 || !UUID.TryParse(args[0], out targetAvatarID)) 194 if (args.Count < 1 || !UUID.TryParse(args[0], out targetAvatarID))
195 { 195 {
196 m_log.Error("[PROFILES]: Unrecognized arguments for " + method); 196 m_log.Error("[SIMIAN PROFILES]: Unrecognized arguments for " + method);
197 return; 197 return;
198 } 198 }
199 199
@@ -211,7 +211,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
211 UUID pickID; 211 UUID pickID;
212 if (args.Count < 2 || !UUID.TryParse(args[0], out avatarID) || !UUID.TryParse(args[1], out pickID)) 212 if (args.Count < 2 || !UUID.TryParse(args[0], out avatarID) || !UUID.TryParse(args[1], out pickID))
213 { 213 {
214 m_log.Error("[PROFILES]: Unrecognized arguments for " + method); 214 m_log.Error("[SIMIAN PROFILES]: Unrecognized arguments for " + method);
215 return; 215 return;
216 } 216 }
217 217
@@ -244,7 +244,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
244 UUID targetAvatarID; 244 UUID targetAvatarID;
245 if (args.Count < 1 || !UUID.TryParse(args[0], out targetAvatarID)) 245 if (args.Count < 1 || !UUID.TryParse(args[0], out targetAvatarID))
246 { 246 {
247 m_log.Error("[PROFILES]: Unrecognized arguments for " + method); 247 m_log.Error("[SIMIAN PROFILES]: Unrecognized arguments for " + method);
248 return; 248 return;
249 } 249 }
250 250
@@ -305,7 +305,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
305 } 305 }
306 else 306 else
307 { 307 {
308 m_log.Warn("[PROFILES]: Failed to fetch profile information for " + client.Name + ", returning default values"); 308 m_log.Warn("[SIMIAN PROFILES]: Failed to fetch profile information for " + client.Name + ", returning default values");
309 client.SendAvatarProperties(avatarID, String.Empty, "1/1/1970", Utils.EmptyBytes, 309 client.SendAvatarProperties(avatarID, String.Empty, "1/1/1970", Utils.EmptyBytes,
310 String.Empty, (uint)flags, UUID.Zero, UUID.Zero, String.Empty, UUID.Zero); 310 String.Empty, (uint)flags, UUID.Zero, UUID.Zero, String.Empty, UUID.Zero);
311 } 311 }
@@ -342,7 +342,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
342 342
343 private void UserInfoRequestHandler(IClientAPI client) 343 private void UserInfoRequestHandler(IClientAPI client)
344 { 344 {
345 m_log.Error("[PROFILES]: UserInfoRequestHandler"); 345 m_log.Error("[SIMIAN PROFILES]: UserInfoRequestHandler");
346 346
347 // Fetch this user's e-mail address 347 // Fetch this user's e-mail address
348 NameValueCollection requestArgs = new NameValueCollection 348 NameValueCollection requestArgs = new NameValueCollection
@@ -355,14 +355,14 @@ namespace OpenSim.Services.Connectors.SimianGrid
355 string email = response["Email"].AsString(); 355 string email = response["Email"].AsString();
356 356
357 if (!response["Success"].AsBoolean()) 357 if (!response["Success"].AsBoolean())
358 m_log.Warn("[PROFILES]: GetUser failed during a user info request for " + client.Name); 358 m_log.Warn("[SIMIAN PROFILES]: GetUser failed during a user info request for " + client.Name);
359 359
360 client.SendUserInfoReply(false, true, email); 360 client.SendUserInfoReply(false, true, email);
361 } 361 }
362 362
363 private void UpdateUserInfoHandler(bool imViaEmail, bool visible, IClientAPI client) 363 private void UpdateUserInfoHandler(bool imViaEmail, bool visible, IClientAPI client)
364 { 364 {
365 m_log.Info("[PROFILES]: Ignoring user info update from " + client.Name); 365 m_log.Info("[SIMIAN PROFILES]: Ignoring user info update from " + client.Name);
366 } 366 }
367 367
368 #endregion Profiles 368 #endregion Profiles
@@ -380,7 +380,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
380 UserAccount admin = scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, UUID.Zero); 380 UserAccount admin = scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, UUID.Zero);
381 if (admin != null) 381 if (admin != null)
382 { 382 {
383 m_log.InfoFormat("[PROFILES]: Setting estate {0} (ID: {1}) owner to {2}", estate.EstateName, 383 m_log.InfoFormat("[SIMIAN PROFILES]: Setting estate {0} (ID: {1}) owner to {2}", estate.EstateName,
384 estate.EstateID, admin.Name); 384 estate.EstateID, admin.Name);
385 385
386 estate.EstateOwner = admin.PrincipalID; 386 estate.EstateOwner = admin.PrincipalID;
@@ -388,7 +388,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
388 } 388 }
389 else 389 else
390 { 390 {
391 m_log.WarnFormat("[PROFILES]: Estate {0} (ID: {1}) does not have an owner", estate.EstateName, estate.EstateID); 391 m_log.WarnFormat("[SIMIAN PROFILES]: Estate {0} (ID: {1}) does not have an owner", estate.EstateName, estate.EstateID);
392 } 392 }
393 } 393 }
394 } 394 }
@@ -406,7 +406,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
406 bool success = response["Success"].AsBoolean(); 406 bool success = response["Success"].AsBoolean();
407 407
408 if (!success) 408 if (!success)
409 m_log.WarnFormat("[PROFILES]: Failed to add user data with key {0} for {1}: {2}", key, userID, response["Message"].AsString()); 409 m_log.WarnFormat("[SIMIAN PROFILES]: Failed to add user data with key {0} for {1}: {2}", key, userID, response["Message"].AsString());
410 410
411 return success; 411 return success;
412 } 412 }
@@ -426,7 +426,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
426 } 426 }
427 else 427 else
428 { 428 {
429 m_log.Error("[PROFILES]: Failed to fetch user data for " + userID + ": " + response["Message"].AsString()); 429 m_log.Error("[SIMIAN PROFILES]: Failed to fetch user data for " + userID + ": " + response["Message"].AsString());
430 } 430 }
431 431
432 return null; 432 return null;
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
index 491a9a2..874f1a2 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
@@ -82,14 +82,14 @@ namespace OpenSim.Services.Connectors.SimianGrid
82 IConfig assetConfig = source.Configs["UserAccountService"]; 82 IConfig assetConfig = source.Configs["UserAccountService"];
83 if (assetConfig == null) 83 if (assetConfig == null)
84 { 84 {
85 m_log.Error("[ACCOUNT CONNECTOR]: UserAccountService missing from OpenSim.ini"); 85 m_log.Error("[SIMIAN ACCOUNT CONNECTOR]: UserAccountService missing from OpenSim.ini");
86 throw new Exception("User account connector init error"); 86 throw new Exception("User account connector init error");
87 } 87 }
88 88
89 string serviceURI = assetConfig.GetString("UserAccountServerURI"); 89 string serviceURI = assetConfig.GetString("UserAccountServerURI");
90 if (String.IsNullOrEmpty(serviceURI)) 90 if (String.IsNullOrEmpty(serviceURI))
91 { 91 {
92 m_log.Error("[ACCOUNT CONNECTOR]: No UserAccountServerURI in section UserAccountService, skipping SimianUserAccountServiceConnector"); 92 m_log.Error("[SIMIAN ACCOUNT CONNECTOR]: No UserAccountServerURI in section UserAccountService, skipping SimianUserAccountServiceConnector");
93 throw new Exception("User account connector init error"); 93 throw new Exception("User account connector init error");
94 } 94 }
95 95
@@ -140,7 +140,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
140 { 140 {
141 List<UserAccount> accounts = new List<UserAccount>(); 141 List<UserAccount> accounts = new List<UserAccount>();
142 142
143 m_log.DebugFormat("[ACCOUNT CONNECTOR]: Searching for user accounts with name query " + query); 143 m_log.DebugFormat("[SIMIAN ACCOUNT CONNECTOR]: Searching for user accounts with name query " + query);
144 144
145 NameValueCollection requestArgs = new NameValueCollection 145 NameValueCollection requestArgs = new NameValueCollection
146 { 146 {
@@ -163,12 +163,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
163 } 163 }
164 else 164 else
165 { 165 {
166 m_log.Warn("[ACCOUNT CONNECTOR]: Account search failed, response data was in an invalid format"); 166 m_log.Warn("[SIMIAN ACCOUNT CONNECTOR]: Account search failed, response data was in an invalid format");
167 } 167 }
168 } 168 }
169 else 169 else
170 { 170 {
171 m_log.Warn("[ACCOUNT CONNECTOR]: Failed to search for account data by name " + query); 171 m_log.Warn("[SIMIAN ACCOUNT CONNECTOR]: Failed to search for account data by name " + query);
172 } 172 }
173 173
174 return accounts; 174 return accounts;
@@ -176,7 +176,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
176 176
177 public bool StoreUserAccount(UserAccount data) 177 public bool StoreUserAccount(UserAccount data)
178 { 178 {
179 m_log.InfoFormat("[ACCOUNT CONNECTOR]: Storing user account for " + data.Name); 179 m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account for " + data.Name);
180 180
181 NameValueCollection requestArgs = new NameValueCollection 181 NameValueCollection requestArgs = new NameValueCollection
182 { 182 {
@@ -191,7 +191,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
191 191
192 if (response["Success"].AsBoolean()) 192 if (response["Success"].AsBoolean())
193 { 193 {
194 m_log.InfoFormat("[ACCOUNT CONNECTOR]: Storing user account data for " + data.Name); 194 m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account data for " + data.Name);
195 195
196 requestArgs = new NameValueCollection 196 requestArgs = new NameValueCollection
197 { 197 {
@@ -212,14 +212,14 @@ namespace OpenSim.Services.Connectors.SimianGrid
212 } 212 }
213 else 213 else
214 { 214 {
215 m_log.Warn("[ACCOUNT CONNECTOR]: Failed to store user account data for " + data.Name + ": " + response["Message"].AsString()); 215 m_log.Warn("[SIMIAN ACCOUNT CONNECTOR]: Failed to store user account data for " + data.Name + ": " + response["Message"].AsString());
216 } 216 }
217 217
218 return success; 218 return success;
219 } 219 }
220 else 220 else
221 { 221 {
222 m_log.Warn("[ACCOUNT CONNECTOR]: Failed to store user account for " + data.Name + ": " + response["Message"].AsString()); 222 m_log.Warn("[SIMIAN ACCOUNT CONNECTOR]: Failed to store user account for " + data.Name + ": " + response["Message"].AsString());
223 } 223 }
224 224
225 return false; 225 return false;
@@ -233,7 +233,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
233 private UserAccount GetUser(NameValueCollection requestArgs) 233 private UserAccount GetUser(NameValueCollection requestArgs)
234 { 234 {
235 string lookupValue = (requestArgs.Count > 1) ? requestArgs[1] : "(Unknown)"; 235 string lookupValue = (requestArgs.Count > 1) ? requestArgs[1] : "(Unknown)";
236 m_log.DebugFormat("[ACCOUNT CONNECTOR]: Looking up user account with query: " + lookupValue); 236 m_log.DebugFormat("[SIMIAN ACCOUNT CONNECTOR]: Looking up user account with query: " + lookupValue);
237 237
238 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 238 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
239 if (response["Success"].AsBoolean()) 239 if (response["Success"].AsBoolean())
@@ -242,11 +242,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
242 if (user != null) 242 if (user != null)
243 return ResponseToUserAccount(user); 243 return ResponseToUserAccount(user);
244 else 244 else
245 m_log.Warn("[ACCOUNT CONNECTOR]: Account search failed, response data was in an invalid format"); 245 m_log.Warn("[SIMIAN ACCOUNT CONNECTOR]: Account search failed, response data was in an invalid format");
246 } 246 }
247 else 247 else
248 { 248 {
249 m_log.Warn("[ACCOUNT CONNECTOR]: Failed to lookup user account with query: " + lookupValue); 249 m_log.Warn("[SIMIAN ACCOUNT CONNECTOR]: Failed to lookup user account with query: " + lookupValue);
250 } 250 }
251 251
252 return null; 252 return null;
diff --git a/OpenSim/Services/Interfaces/IUserAccountService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs
index a45bf8c..befd14e 100644
--- a/OpenSim/Services/Interfaces/IUserAccountService.cs
+++ b/OpenSim/Services/Interfaces/IUserAccountService.cs
@@ -150,10 +150,10 @@ namespace OpenSim.Services.Interfaces
150 List<UserAccount> GetUserAccounts(UUID scopeID, string query); 150 List<UserAccount> GetUserAccounts(UUID scopeID, string query);
151 151
152 /// <summary> 152 /// <summary>
153 /// Store the data given, wich replaces the sotred data, therefore must be complete. 153 /// Store the data given, wich replaces the stored data, therefore must be complete.
154 /// </summary> 154 /// </summary>
155 /// <param name="data"></param> 155 /// <param name="data"></param>
156 /// <returns></returns> 156 /// <returns></returns>
157 bool StoreUserAccount(UserAccount data); 157 bool StoreUserAccount(UserAccount data);
158 } 158 }
159} \ No newline at end of file 159}
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 1eaf4d4..7b25274 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -339,9 +339,16 @@ namespace OpenSim.Services.LLLoginService
339 where = "safe"; 339 where = "safe";
340 } 340 }
341 else 341 else
342 m_log.WarnFormat( 342 {
343 "[LLOGIN SERVICE]: User {0} {1} does not have a valid home and this grid does not have default locations.", 343 m_log.WarnFormat("[LLOGIN SERVICE]: User {0} {1} does not have a valid home and this grid does not have default locations. Attempting to find random region",
344 account.FirstName, account.LastName); 344 account.FirstName, account.LastName);
345 defaults = m_GridService.GetRegionsByName(account.ScopeID, "", 1);
346 if (defaults != null && defaults.Count > 0)
347 {
348 region = defaults[0];
349 where = "safe";
350 }
351 }
345 } 352 }
346 353
347 return region; 354 return region;
@@ -364,6 +371,17 @@ namespace OpenSim.Services.LLLoginService
364 region = defaults[0]; 371 region = defaults[0];
365 where = "safe"; 372 where = "safe";
366 } 373 }
374 else
375 {
376 m_log.Info("[LLOGIN SERVICE]: Last Region Not Found Attempting to find random region");
377 defaults = m_GridService.GetRegionsByName(account.ScopeID, "", 1);
378 if (defaults != null && defaults.Count > 0)
379 {
380 region = defaults[0];
381 where = "safe";
382 }
383 }
384
367 } 385 }
368 else 386 else
369 { 387 {
@@ -396,7 +414,6 @@ namespace OpenSim.Services.LLLoginService
396 { 414 {
397 if (!regionName.Contains("@")) 415 if (!regionName.Contains("@"))
398 { 416 {
399
400 List<GridRegion> regions = m_GridService.GetRegionsByName(account.ScopeID, regionName, 1); 417 List<GridRegion> regions = m_GridService.GetRegionsByName(account.ScopeID, regionName, 1);
401 if ((regions == null) || (regions != null && regions.Count == 0)) 418 if ((regions == null) || (regions != null && regions.Count == 0))
402 { 419 {
@@ -429,6 +446,7 @@ namespace OpenSim.Services.LLLoginService
429 return null; 446 return null;
430 } 447 }
431 // Valid specification of a remote grid 448 // Valid specification of a remote grid
449
432 regionName = parts[0]; 450 regionName = parts[0];
433 string domainLocator = parts[1]; 451 string domainLocator = parts[1];
434 parts = domainLocator.Split(new char[] {':'}); 452 parts = domainLocator.Split(new char[] {':'});
@@ -436,6 +454,7 @@ namespace OpenSim.Services.LLLoginService
436 uint port = 0; 454 uint port = 0;
437 if (parts.Length > 1) 455 if (parts.Length > 1)
438 UInt32.TryParse(parts[1], out port); 456 UInt32.TryParse(parts[1], out port);
457
439 GridRegion region = FindForeignRegion(domainName, port, regionName, out gatekeeper); 458 GridRegion region = FindForeignRegion(domainName, port, regionName, out gatekeeper);
440 return region; 459 return region;
441 } 460 }
diff --git a/bin/Mono.Security.dll b/bin/Mono.Security.dll
deleted file mode 100644
index c027c19..0000000
--- a/bin/Mono.Security.dll
+++ /dev/null
Binary files differ
diff --git a/bin/OpenMetaverse.Http.dll b/bin/OpenMetaverse.Http.dll
deleted file mode 100644
index dbbe4d3..0000000
--- a/bin/OpenMetaverse.Http.dll
+++ /dev/null
Binary files differ
diff --git a/bin/OpenMetaverse.StructuredData.dll b/bin/OpenMetaverse.StructuredData.dll
index 0e571d8..f4992a2 100644
--- a/bin/OpenMetaverse.StructuredData.dll
+++ b/bin/OpenMetaverse.StructuredData.dll
Binary files differ
diff --git a/bin/OpenMetaverse.dll b/bin/OpenMetaverse.dll
index a35b5ae..8751bfc 100644
--- a/bin/OpenMetaverse.dll
+++ b/bin/OpenMetaverse.dll
Binary files differ
diff --git a/bin/OpenMetaverseTypes.dll b/bin/OpenMetaverseTypes.dll
index c5efaf4..6c6440e 100644
--- a/bin/OpenMetaverseTypes.dll
+++ b/bin/OpenMetaverseTypes.dll
Binary files differ