aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Services/AssetService/AssetService.cs17
-rw-r--r--OpenSim/Services/AssetService/AssetServiceBase.cs4
-rw-r--r--OpenSim/Services/AssetService/XAssetService.cs18
-rw-r--r--OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs8
-rw-r--r--OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs6
-rw-r--r--OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs9
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs8
-rw-r--r--OpenSim/Services/GridService/GridService.cs99
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs6
-rw-r--r--OpenSim/Services/HypergridService/GatekeeperService.cs93
-rw-r--r--OpenSim/Services/HypergridService/HGAssetService.cs26
-rw-r--r--OpenSim/Services/HypergridService/HGFriendsService.cs2
-rw-r--r--OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs76
-rw-r--r--OpenSim/Services/HypergridService/UserAgentService.cs105
-rw-r--r--OpenSim/Services/Interfaces/IAssetService.cs6
-rw-r--r--OpenSim/Services/Interfaces/IGridService.cs13
-rw-r--r--OpenSim/Services/Interfaces/IGridUserService.cs3
-rw-r--r--OpenSim/Services/Interfaces/IPresenceService.cs38
-rw-r--r--OpenSim/Services/InventoryService/XInventoryService.cs65
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs2
-rw-r--r--OpenSim/Services/UserAccountService/GridUserService.cs13
21 files changed, 153 insertions, 464 deletions
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs
index f1bffa4..96b430d 100644
--- a/OpenSim/Services/AssetService/AssetService.cs
+++ b/OpenSim/Services/AssetService/AssetService.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Services.AssetService
70 70
71 if (assetLoaderEnabled) 71 if (assetLoaderEnabled)
72 { 72 {
73 m_log.DebugFormat("[ASSET SERVICE]: Loading default asset set from {0}", loaderArgs); 73 m_log.DebugFormat("[ASSET]: Loading default asset set from {0}", loaderArgs);
74 74
75 m_AssetLoader.ForEachDefaultXmlAsset( 75 m_AssetLoader.ForEachDefaultXmlAsset(
76 loaderArgs, 76 loaderArgs,
@@ -200,7 +200,20 @@ namespace OpenSim.Services.AssetService
200 if (!UUID.TryParse(id, out assetID)) 200 if (!UUID.TryParse(id, out assetID))
201 return false; 201 return false;
202 202
203 return m_Database.Delete(id); 203 AssetBase asset = m_Database.GetAsset(assetID);
204 if (asset == null)
205 return false;
206
207 if ((int)(asset.Flags & AssetFlags.Maptile) != 0)
208 {
209 return m_Database.Delete(id);
210 }
211 else
212 {
213 m_log.DebugFormat("[ASSET SERVICE]: Request to delete asset {0}, but flags are not Maptile", id);
214 }
215
216 return false;
204 } 217 }
205 } 218 }
206} \ No newline at end of file 219} \ No newline at end of file
diff --git a/OpenSim/Services/AssetService/AssetServiceBase.cs b/OpenSim/Services/AssetService/AssetServiceBase.cs
index 58ab052..177c565 100644
--- a/OpenSim/Services/AssetService/AssetServiceBase.cs
+++ b/OpenSim/Services/AssetService/AssetServiceBase.cs
@@ -84,7 +84,7 @@ namespace OpenSim.Services.AssetService
84 84
85 m_Database = LoadPlugin<IAssetDataPlugin>(dllName); 85 m_Database = LoadPlugin<IAssetDataPlugin>(dllName);
86 if (m_Database == null) 86 if (m_Database == null)
87 throw new Exception(string.Format("Could not find a storage interface in the module {0}", dllName)); 87 throw new Exception("Could not find a storage interface in the given module");
88 88
89 m_Database.Initialise(connString); 89 m_Database.Initialise(connString);
90 90
@@ -96,7 +96,7 @@ namespace OpenSim.Services.AssetService
96 m_AssetLoader = LoadPlugin<IAssetLoader>(loaderName); 96 m_AssetLoader = LoadPlugin<IAssetLoader>(loaderName);
97 97
98 if (m_AssetLoader == null) 98 if (m_AssetLoader == null)
99 throw new Exception(string.Format("Asset loader could not be loaded from {0}", loaderName)); 99 throw new Exception("Asset loader could not be loaded");
100 } 100 }
101 } 101 }
102 } 102 }
diff --git a/OpenSim/Services/AssetService/XAssetService.cs b/OpenSim/Services/AssetService/XAssetService.cs
index a1d10ed..e62bcb5 100644
--- a/OpenSim/Services/AssetService/XAssetService.cs
+++ b/OpenSim/Services/AssetService/XAssetService.cs
@@ -194,7 +194,21 @@ namespace OpenSim.Services.AssetService
194 if (!UUID.TryParse(id, out assetID)) 194 if (!UUID.TryParse(id, out assetID))
195 return false; 195 return false;
196 196
197 return m_Database.Delete(id); 197 AssetBase asset = m_Database.GetAsset(assetID);
198 if (asset == null)
199 return false;
200
201 if ((int)(asset.Flags & AssetFlags.Maptile) != 0)
202 {
203 return m_Database.Delete(id);
204 }
205 else
206 {
207 m_log.DebugFormat("[XASSET SERVICE]: Request to delete asset {0}, but flags are not Maptile", id);
208 }
209
210 return false;
198 } 211 }
199 } 212 }
200} \ No newline at end of file 213}
214
diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
index 4b502b7..7f32ad3 100644
--- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
@@ -52,8 +52,6 @@ namespace OpenSim.Services.Connectors
52 private int m_retryCounter; 52 private int m_retryCounter;
53 private Dictionary<int, List<AssetBase>> m_retryQueue = new Dictionary<int, List<AssetBase>>(); 53 private Dictionary<int, List<AssetBase>> m_retryQueue = new Dictionary<int, List<AssetBase>>();
54 private System.Timers.Timer m_retryTimer; 54 private System.Timers.Timer m_retryTimer;
55 private int m_maxAssetRequestConcurrency = 30;
56
57 private delegate void AssetRetrievedEx(AssetBase asset); 55 private delegate void AssetRetrievedEx(AssetBase asset);
58 56
59 // Keeps track of concurrent requests for the same asset, so that it's only loaded once. 57 // Keeps track of concurrent requests for the same asset, so that it's only loaded once.
@@ -82,10 +80,6 @@ namespace OpenSim.Services.Connectors
82 80
83 public virtual void Initialise(IConfigSource source) 81 public virtual void Initialise(IConfigSource source)
84 { 82 {
85 IConfig netconfig = source.Configs["Network"];
86 if (netconfig != null)
87 m_maxAssetRequestConcurrency = netconfig.GetInt("MaxRequestConcurrency",m_maxAssetRequestConcurrency);
88
89 IConfig assetConfig = source.Configs["AssetService"]; 83 IConfig assetConfig = source.Configs["AssetService"];
90 if (assetConfig == null) 84 if (assetConfig == null)
91 { 85 {
@@ -210,7 +204,7 @@ namespace OpenSim.Services.Connectors
210 if (asset == null || asset.Data == null || asset.Data.Length == 0) 204 if (asset == null || asset.Data == null || asset.Data.Length == 0)
211 { 205 {
212 asset = SynchronousRestObjectRequester. 206 asset = SynchronousRestObjectRequester.
213 MakeRequest<int, AssetBase>("GET", uri, 0, m_maxAssetRequestConcurrency); 207 MakeRequest<int, AssetBase>("GET", uri, 0, 30);
214 208
215 if (m_Cache != null) 209 if (m_Cache != null)
216 m_Cache.Cache(asset); 210 m_Cache.Cache(asset);
diff --git a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs
index 45f4514..6cd21d1 100644
--- a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs
+++ b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs
@@ -128,7 +128,7 @@ namespace OpenSim.Services.Connectors.Friends
128 return Call(region, sendData); 128 return Call(region, sendData);
129 } 129 }
130 130
131 public bool StatusNotify(GridRegion region, UUID userID, string friendID, bool online) 131 public bool StatusNotify(GridRegion region, UUID userID, UUID friendID, bool online)
132 { 132 {
133 Dictionary<string, object> sendData = new Dictionary<string, object>(); 133 Dictionary<string, object> sendData = new Dictionary<string, object>();
134 //sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); 134 //sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
@@ -136,7 +136,7 @@ namespace OpenSim.Services.Connectors.Friends
136 sendData["METHOD"] = "status"; 136 sendData["METHOD"] = "status";
137 137
138 sendData["FromID"] = userID.ToString(); 138 sendData["FromID"] = userID.ToString();
139 sendData["ToID"] = friendID; 139 sendData["ToID"] = friendID.ToString();
140 sendData["Online"] = online.ToString(); 140 sendData["Online"] = online.ToString();
141 141
142 return Call(region, sendData); 142 return Call(region, sendData);
@@ -154,7 +154,7 @@ namespace OpenSim.Services.Connectors.Friends
154 if (!region.ServerURI.EndsWith("/")) 154 if (!region.ServerURI.EndsWith("/"))
155 path = "/" + path; 155 path = "/" + path;
156 string uri = region.ServerURI + path; 156 string uri = region.ServerURI + path;
157 // m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: calling {0}", uri); 157 m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: calling {0}", uri);
158 158
159 try 159 try
160 { 160 {
diff --git a/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs b/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs
index 94bda82..20d7eaf 100644
--- a/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs
+++ b/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs
@@ -207,7 +207,7 @@ namespace OpenSim.Services.Connectors
207 if ((replyData != null) && replyData.ContainsKey("result") && (replyData["result"] != null)) 207 if ((replyData != null) && replyData.ContainsKey("result") && (replyData["result"] != null))
208 { 208 {
209 if (replyData["result"] is Dictionary<string, object>) 209 if (replyData["result"] is Dictionary<string, object>)
210 guinfo = Create((Dictionary<string, object>)replyData["result"]); 210 guinfo = new GridUserInfo((Dictionary<string, object>)replyData["result"]);
211 } 211 }
212 212
213 return guinfo; 213 return guinfo;
@@ -273,7 +273,7 @@ namespace OpenSim.Services.Connectors
273 { 273 {
274 if (griduser is Dictionary<string, object>) 274 if (griduser is Dictionary<string, object>)
275 { 275 {
276 GridUserInfo pinfo = Create((Dictionary<string, object>)griduser); 276 GridUserInfo pinfo = new GridUserInfo((Dictionary<string, object>)griduser);
277 rinfos.Add(pinfo); 277 rinfos.Add(pinfo);
278 } 278 }
279 else 279 else
@@ -286,10 +286,5 @@ namespace OpenSim.Services.Connectors
286 286
287 return rinfos.ToArray(); 287 return rinfos.ToArray();
288 } 288 }
289
290 protected virtual GridUserInfo Create(Dictionary<string, object> griduser)
291 {
292 return new GridUserInfo(griduser);
293 }
294 } 289 }
295} 290}
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
index 20eaa3a..0e4d794 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
@@ -112,7 +112,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
112// m_log.Warn("Registering region " + regionInfo.RegionName + " (" + regionInfo.RegionID + ") that we are not tracking"); 112// m_log.Warn("Registering region " + regionInfo.RegionName + " (" + regionInfo.RegionID + ") that we are not tracking");
113 113
114 Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); 114 Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0);
115 Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); 115 Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0);
116 116
117 OSDMap extraData = new OSDMap 117 OSDMap extraData = new OSDMap
118 { 118 {
@@ -297,7 +297,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
297 List<GridRegion> foundRegions = new List<GridRegion>(); 297 List<GridRegion> foundRegions = new List<GridRegion>();
298 298
299 Vector3d minPosition = new Vector3d(xmin, ymin, 0.0); 299 Vector3d minPosition = new Vector3d(xmin, ymin, 0.0);
300 Vector3d maxPosition = new Vector3d(xmax, ymax, Constants.RegionHeight); 300 Vector3d maxPosition = new Vector3d(xmax, ymax, 4096.0);
301 301
302 NameValueCollection requestArgs = new NameValueCollection 302 NameValueCollection requestArgs = new NameValueCollection
303 { 303 {
@@ -395,8 +395,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
395 if (response["Success"].AsBoolean()) 395 if (response["Success"].AsBoolean())
396 { 396 {
397 OSDMap extraData = response["ExtraData"] as OSDMap; 397 OSDMap extraData = response["ExtraData"] as OSDMap;
398 int enabled = response["Enabled"].AsBoolean() ? (int)OpenSim.Framework.RegionFlags.RegionOnline : 0; 398 int enabled = response["Enabled"].AsBoolean() ? (int) OpenSim.Data.RegionFlags.RegionOnline : 0;
399 int hypergrid = extraData["HyperGrid"].AsBoolean() ? (int)OpenSim.Framework.RegionFlags.Hyperlink : 0; 399 int hypergrid = extraData["HyperGrid"].AsBoolean() ? (int) OpenSim.Data.RegionFlags.Hyperlink : 0;
400 int flags = enabled | hypergrid; 400 int flags = enabled | hypergrid;
401 m_log.DebugFormat("[SGGC] enabled - {0} hg - {1} flags - {2}", enabled, hypergrid, flags); 401 m_log.DebugFormat("[SGGC] enabled - {0} hg - {1} flags - {2}", enabled, hypergrid, flags);
402 return flags; 402 return flags;
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index ee3b858..aab403a 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -137,25 +137,20 @@ namespace OpenSim.Services.GridService
137 if (regionInfos.RegionID == UUID.Zero) 137 if (regionInfos.RegionID == UUID.Zero)
138 return "Invalid RegionID - cannot be zero UUID"; 138 return "Invalid RegionID - cannot be zero UUID";
139 139
140 // This needs better sanity testing. What if regionInfo is registering in
141 // overlapping coords?
140 RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); 142 RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID);
141 if ((region != null) && (region.RegionID != regionInfos.RegionID))
142 {
143 m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.",
144 regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID);
145 return "Region overlaps another region";
146 }
147
148 if (region != null) 143 if (region != null)
149 { 144 {
150 // There is a preexisting record 145 // There is a preexisting record
151 // 146 //
152 // Get it's flags 147 // Get it's flags
153 // 148 //
154 OpenSim.Framework.RegionFlags rflags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(region.Data["flags"]); 149 OpenSim.Data.RegionFlags rflags = (OpenSim.Data.RegionFlags)Convert.ToInt32(region.Data["flags"]);
155 150
156 // Is this a reservation? 151 // Is this a reservation?
157 // 152 //
158 if ((rflags & OpenSim.Framework.RegionFlags.Reservation) != 0) 153 if ((rflags & OpenSim.Data.RegionFlags.Reservation) != 0)
159 { 154 {
160 // Regions reserved for the null key cannot be taken. 155 // Regions reserved for the null key cannot be taken.
161 if ((string)region.Data["PrincipalID"] == UUID.Zero.ToString()) 156 if ((string)region.Data["PrincipalID"] == UUID.Zero.ToString())
@@ -166,10 +161,10 @@ namespace OpenSim.Services.GridService
166 // NOTE: Fudging the flags value here, so these flags 161 // NOTE: Fudging the flags value here, so these flags
167 // should not be used elsewhere. Don't optimize 162 // should not be used elsewhere. Don't optimize
168 // this with the later retrieval of the same flags! 163 // this with the later retrieval of the same flags!
169 rflags |= OpenSim.Framework.RegionFlags.Authenticate; 164 rflags |= OpenSim.Data.RegionFlags.Authenticate;
170 } 165 }
171 166
172 if ((rflags & OpenSim.Framework.RegionFlags.Authenticate) != 0) 167 if ((rflags & OpenSim.Data.RegionFlags.Authenticate) != 0)
173 { 168 {
174 // Can we authenticate at all? 169 // Can we authenticate at all?
175 // 170 //
@@ -181,36 +176,19 @@ namespace OpenSim.Services.GridService
181 } 176 }
182 } 177 }
183 178
184 // If we get here, the destination is clear. Now for the real check. 179 if ((region != null) && (region.RegionID != regionInfos.RegionID))
185
186 if (!m_AllowDuplicateNames)
187 { 180 {
188 List<RegionData> dupe = m_Database.Get(regionInfos.RegionName, scopeID); 181 m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.",
189 if (dupe != null && dupe.Count > 0) 182 regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID);
190 { 183 return "Region overlaps another region";
191 foreach (RegionData d in dupe)
192 {
193 if (d.RegionID != regionInfos.RegionID)
194 {
195 m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register duplicate name with ID {1}.",
196 regionInfos.RegionName, regionInfos.RegionID);
197 return "Duplicate region name";
198 }
199 }
200 }
201 } 184 }
202 185
203 // If there is an old record for us, delete it if it is elsewhere.
204 region = m_Database.Get(regionInfos.RegionID, scopeID);
205 if ((region != null) && (region.RegionID == regionInfos.RegionID) && 186 if ((region != null) && (region.RegionID == regionInfos.RegionID) &&
206 ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY))) 187 ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY)))
207 { 188 {
208 if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.NoMove) != 0) 189 if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Data.RegionFlags.NoMove) != 0)
209 return "Can't move this region"; 190 return "Can't move this region";
210 191
211 if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.LockedOut) != 0)
212 return "Region locked out";
213
214 // Region reregistering in other coordinates. Delete the old entry 192 // Region reregistering in other coordinates. Delete the old entry
215 m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) was previously registered at {2}-{3}. Deleting old entry.", 193 m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) was previously registered at {2}-{3}. Deleting old entry.",
216 regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY); 194 regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY);
@@ -225,6 +203,23 @@ namespace OpenSim.Services.GridService
225 } 203 }
226 } 204 }
227 205
206 if (!m_AllowDuplicateNames)
207 {
208 List<RegionData> dupe = m_Database.Get(regionInfos.RegionName, scopeID);
209 if (dupe != null && dupe.Count > 0)
210 {
211 foreach (RegionData d in dupe)
212 {
213 if (d.RegionID != regionInfos.RegionID)
214 {
215 m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register duplicate name with ID {1}.",
216 regionInfos.RegionName, regionInfos.RegionID);
217 return "Duplicate region name";
218 }
219 }
220 }
221 }
222
228 // Everything is ok, let's register 223 // Everything is ok, let's register
229 RegionData rdata = RegionInfo2RegionData(regionInfos); 224 RegionData rdata = RegionInfo2RegionData(regionInfos);
230 rdata.ScopeID = scopeID; 225 rdata.ScopeID = scopeID;
@@ -232,8 +227,10 @@ namespace OpenSim.Services.GridService
232 if (region != null) 227 if (region != null)
233 { 228 {
234 int oldFlags = Convert.ToInt32(region.Data["flags"]); 229 int oldFlags = Convert.ToInt32(region.Data["flags"]);
230 if ((oldFlags & (int)OpenSim.Data.RegionFlags.LockedOut) != 0)
231 return "Region locked out";
235 232
236 oldFlags &= ~(int)OpenSim.Framework.RegionFlags.Reservation; 233 oldFlags &= ~(int)OpenSim.Data.RegionFlags.Reservation;
237 234
238 rdata.Data["flags"] = oldFlags.ToString(); // Preserve flags 235 rdata.Data["flags"] = oldFlags.ToString(); // Preserve flags
239 } 236 }
@@ -252,7 +249,7 @@ namespace OpenSim.Services.GridService
252 } 249 }
253 250
254 int flags = Convert.ToInt32(rdata.Data["flags"]); 251 int flags = Convert.ToInt32(rdata.Data["flags"]);
255 flags |= (int)OpenSim.Framework.RegionFlags.RegionOnline; 252 flags |= (int)OpenSim.Data.RegionFlags.RegionOnline;
256 rdata.Data["flags"] = flags.ToString(); 253 rdata.Data["flags"] = flags.ToString();
257 254
258 try 255 try
@@ -283,9 +280,9 @@ namespace OpenSim.Services.GridService
283 280
284 int flags = Convert.ToInt32(region.Data["flags"]); 281 int flags = Convert.ToInt32(region.Data["flags"]);
285 282
286 if (!m_DeleteOnUnregister || (flags & (int)OpenSim.Framework.RegionFlags.Persistent) != 0) 283 if (!m_DeleteOnUnregister || (flags & (int)OpenSim.Data.RegionFlags.Persistent) != 0)
287 { 284 {
288 flags &= ~(int)OpenSim.Framework.RegionFlags.RegionOnline; 285 flags &= ~(int)OpenSim.Data.RegionFlags.RegionOnline;
289 region.Data["flags"] = flags.ToString(); 286 region.Data["flags"] = flags.ToString();
290 region.Data["last_seen"] = Util.UnixTimeSinceEpoch(); 287 region.Data["last_seen"] = Util.UnixTimeSinceEpoch();
291 try 288 try
@@ -320,7 +317,7 @@ namespace OpenSim.Services.GridService
320 if (rdata.RegionID != regionID) 317 if (rdata.RegionID != regionID)
321 { 318 {
322 int flags = Convert.ToInt32(rdata.Data["flags"]); 319 int flags = Convert.ToInt32(rdata.Data["flags"]);
323 if ((flags & (int)Framework.RegionFlags.Hyperlink) == 0) // no hyperlinks as neighbours 320 if ((flags & (int)Data.RegionFlags.Hyperlink) == 0) // no hyperlinks as neighbours
324 rinfos.Add(RegionData2RegionInfo(rdata)); 321 rinfos.Add(RegionData2RegionInfo(rdata));
325 } 322 }
326 } 323 }
@@ -470,7 +467,7 @@ namespace OpenSim.Services.GridService
470 467
471 foreach (RegionData r in regions) 468 foreach (RegionData r in regions)
472 { 469 {
473 if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.RegionOnline) != 0) 470 if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0)
474 ret.Add(RegionData2RegionInfo(r)); 471 ret.Add(RegionData2RegionInfo(r));
475 } 472 }
476 473
@@ -486,7 +483,7 @@ namespace OpenSim.Services.GridService
486 483
487 foreach (RegionData r in regions) 484 foreach (RegionData r in regions)
488 { 485 {
489 if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.RegionOnline) != 0) 486 if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0)
490 ret.Add(RegionData2RegionInfo(r)); 487 ret.Add(RegionData2RegionInfo(r));
491 } 488 }
492 489
@@ -502,7 +499,7 @@ namespace OpenSim.Services.GridService
502 499
503 foreach (RegionData r in regions) 500 foreach (RegionData r in regions)
504 { 501 {
505 if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.RegionOnline) != 0) 502 if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0)
506 ret.Add(RegionData2RegionInfo(r)); 503 ret.Add(RegionData2RegionInfo(r));
507 } 504 }
508 505
@@ -629,7 +626,7 @@ namespace OpenSim.Services.GridService
629 626
630 private void OutputRegionToConsole(RegionData r) 627 private void OutputRegionToConsole(RegionData r)
631 { 628 {
632 OpenSim.Framework.RegionFlags flags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(r.Data["flags"]); 629 OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]);
633 630
634 ConsoleDisplayList dispList = new ConsoleDisplayList(); 631 ConsoleDisplayList dispList = new ConsoleDisplayList();
635 dispList.AddRow("Region Name", r.RegionName); 632 dispList.AddRow("Region Name", r.RegionName);
@@ -659,7 +656,7 @@ namespace OpenSim.Services.GridService
659 656
660 foreach (RegionData r in regions) 657 foreach (RegionData r in regions)
661 { 658 {
662 OpenSim.Framework.RegionFlags flags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(r.Data["flags"]); 659 OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]);
663 dispTable.AddRow( 660 dispTable.AddRow(
664 r.RegionName, 661 r.RegionName,
665 r.RegionID.ToString(), 662 r.RegionID.ToString(),
@@ -673,7 +670,7 @@ namespace OpenSim.Services.GridService
673 670
674 private int ParseFlags(int prev, string flags) 671 private int ParseFlags(int prev, string flags)
675 { 672 {
676 OpenSim.Framework.RegionFlags f = (OpenSim.Framework.RegionFlags)prev; 673 OpenSim.Data.RegionFlags f = (OpenSim.Data.RegionFlags)prev;
677 674
678 string[] parts = flags.Split(new char[] {',', ' '}, StringSplitOptions.RemoveEmptyEntries); 675 string[] parts = flags.Split(new char[] {',', ' '}, StringSplitOptions.RemoveEmptyEntries);
679 676
@@ -685,18 +682,18 @@ namespace OpenSim.Services.GridService
685 { 682 {
686 if (p.StartsWith("+")) 683 if (p.StartsWith("+"))
687 { 684 {
688 val = (int)Enum.Parse(typeof(OpenSim.Framework.RegionFlags), p.Substring(1)); 685 val = (int)Enum.Parse(typeof(OpenSim.Data.RegionFlags), p.Substring(1));
689 f |= (OpenSim.Framework.RegionFlags)val; 686 f |= (OpenSim.Data.RegionFlags)val;
690 } 687 }
691 else if (p.StartsWith("-")) 688 else if (p.StartsWith("-"))
692 { 689 {
693 val = (int)Enum.Parse(typeof(OpenSim.Framework.RegionFlags), p.Substring(1)); 690 val = (int)Enum.Parse(typeof(OpenSim.Data.RegionFlags), p.Substring(1));
694 f &= ~(OpenSim.Framework.RegionFlags)val; 691 f &= ~(OpenSim.Data.RegionFlags)val;
695 } 692 }
696 else 693 else
697 { 694 {
698 val = (int)Enum.Parse(typeof(OpenSim.Framework.RegionFlags), p); 695 val = (int)Enum.Parse(typeof(OpenSim.Data.RegionFlags), p);
699 f |= (OpenSim.Framework.RegionFlags)val; 696 f |= (OpenSim.Data.RegionFlags)val;
700 } 697 }
701 } 698 }
702 catch (Exception) 699 catch (Exception)
@@ -728,7 +725,7 @@ namespace OpenSim.Services.GridService
728 int flags = Convert.ToInt32(r.Data["flags"]); 725 int flags = Convert.ToInt32(r.Data["flags"]);
729 flags = ParseFlags(flags, cmd[4]); 726 flags = ParseFlags(flags, cmd[4]);
730 r.Data["flags"] = flags.ToString(); 727 r.Data["flags"] = flags.ToString();
731 OpenSim.Framework.RegionFlags f = (OpenSim.Framework.RegionFlags)flags; 728 OpenSim.Data.RegionFlags f = (OpenSim.Data.RegionFlags)flags;
732 729
733 MainConsole.Instance.Output(String.Format("Set region {0} to {1}", r.RegionName, f)); 730 MainConsole.Instance.Output(String.Format("Set region {0} to {1}", r.RegionName, f));
734 m_Database.Store(r); 731 m_Database.Store(r);
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 743d089..78eab3d 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -390,8 +390,8 @@ namespace OpenSim.Services.GridService
390 List<RegionData> regions = m_Database.Get(mapName, m_ScopeID); 390 List<RegionData> regions = m_Database.Get(mapName, m_ScopeID);
391 if (regions != null && regions.Count > 0) 391 if (regions != null && regions.Count > 0)
392 { 392 {
393 OpenSim.Framework.RegionFlags rflags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(regions[0].Data["flags"]); 393 OpenSim.Data.RegionFlags rflags = (OpenSim.Data.RegionFlags)Convert.ToInt32(regions[0].Data["flags"]);
394 if ((rflags & OpenSim.Framework.RegionFlags.Hyperlink) != 0) 394 if ((rflags & OpenSim.Data.RegionFlags.Hyperlink) != 0)
395 { 395 {
396 regInfo = new GridRegion(); 396 regInfo = new GridRegion();
397 regInfo.RegionID = regions[0].RegionID; 397 regInfo.RegionID = regions[0].RegionID;
@@ -460,7 +460,7 @@ namespace OpenSim.Services.GridService
460 private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle) 460 private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle)
461 { 461 {
462 RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo); 462 RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo);
463 int flags = (int)OpenSim.Framework.RegionFlags.Hyperlink + (int)OpenSim.Framework.RegionFlags.NoDirectLogin + (int)OpenSim.Framework.RegionFlags.RegionOnline; 463 int flags = (int)OpenSim.Data.RegionFlags.Hyperlink + (int)OpenSim.Data.RegionFlags.NoDirectLogin + (int)OpenSim.Data.RegionFlags.RegionOnline;
464 rdata.Data["flags"] = flags.ToString(); 464 rdata.Data["flags"] = flags.ToString();
465 465
466 m_Database.Store(rdata); 466 m_Database.Store(rdata);
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs
index 004311f..47d22b9 100644
--- a/OpenSim/Services/HypergridService/GatekeeperService.cs
+++ b/OpenSim/Services/HypergridService/GatekeeperService.cs
@@ -57,13 +57,10 @@ namespace OpenSim.Services.HypergridService
57 private static IUserAccountService m_UserAccountService; 57 private static IUserAccountService m_UserAccountService;
58 private static IUserAgentService m_UserAgentService; 58 private static IUserAgentService m_UserAgentService;
59 private static ISimulationService m_SimulationService; 59 private static ISimulationService m_SimulationService;
60 private static IGridUserService m_GridUserService;
61 60
62 private static string m_AllowedClients = string.Empty; 61 protected string m_AllowedClients = string.Empty;
63 private static string m_DeniedClients = string.Empty; 62 protected string m_DeniedClients = string.Empty;
64 private static bool m_ForeignAgentsAllowed = true; 63 private static bool m_ForeignAgentsAllowed = true;
65 private static List<string> m_ForeignsAllowedExceptions = new List<string>();
66 private static List<string> m_ForeignsDisallowedExceptions = new List<string>();
67 64
68 private static UUID m_ScopeID; 65 private static UUID m_ScopeID;
69 private static bool m_AllowTeleportsToAnyRegion; 66 private static bool m_AllowTeleportsToAnyRegion;
@@ -85,9 +82,8 @@ namespace OpenSim.Services.HypergridService
85 string gridService = serverConfig.GetString("GridService", String.Empty); 82 string gridService = serverConfig.GetString("GridService", String.Empty);
86 string presenceService = serverConfig.GetString("PresenceService", String.Empty); 83 string presenceService = serverConfig.GetString("PresenceService", String.Empty);
87 string simulationService = serverConfig.GetString("SimulationService", String.Empty); 84 string simulationService = serverConfig.GetString("SimulationService", String.Empty);
88 string gridUserService = serverConfig.GetString("GridUserService", String.Empty);
89 85
90 // These are mandatory, the others aren't 86 // These 3 are mandatory, the others aren't
91 if (gridService == string.Empty || presenceService == string.Empty) 87 if (gridService == string.Empty || presenceService == string.Empty)
92 throw new Exception("Incomplete specifications, Gatekeeper Service cannot function."); 88 throw new Exception("Incomplete specifications, Gatekeeper Service cannot function.");
93 89
@@ -107,8 +103,6 @@ namespace OpenSim.Services.HypergridService
107 m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); 103 m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
108 if (homeUsersService != string.Empty) 104 if (homeUsersService != string.Empty)
109 m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args); 105 m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args);
110 if (gridUserService != string.Empty)
111 m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args);
112 106
113 if (simService != null) 107 if (simService != null)
114 m_SimulationService = simService; 108 m_SimulationService = simService;
@@ -119,9 +113,6 @@ namespace OpenSim.Services.HypergridService
119 m_DeniedClients = serverConfig.GetString("DeniedClients", string.Empty); 113 m_DeniedClients = serverConfig.GetString("DeniedClients", string.Empty);
120 m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true); 114 m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true);
121 115
122 LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_ForeignsAllowedExceptions);
123 LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_ForeignsDisallowedExceptions);
124
125 if (m_GridService == null || m_PresenceService == null || m_SimulationService == null) 116 if (m_GridService == null || m_PresenceService == null || m_SimulationService == null)
126 throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function."); 117 throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function.");
127 118
@@ -134,15 +125,6 @@ namespace OpenSim.Services.HypergridService
134 { 125 {
135 } 126 }
136 127
137 protected void LoadDomainExceptionsFromConfig(IConfig config, string variable, List<string> exceptions)
138 {
139 string value = config.GetString(variable, string.Empty);
140 string[] parts = value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
141
142 foreach (string s in parts)
143 exceptions.Add(s.Trim());
144 }
145
146 public bool LinkRegion(string regionName, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason) 128 public bool LinkRegion(string regionName, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason)
147 { 129 {
148 regionID = UUID.Zero; 130 regionID = UUID.Zero;
@@ -278,27 +260,18 @@ namespace OpenSim.Services.HypergridService
278 m_log.DebugFormat("[GATEKEEPER SERVICE]: User is ok"); 260 m_log.DebugFormat("[GATEKEEPER SERVICE]: User is ok");
279 261
280 // 262 //
281 // Foreign agents allowed? Exceptions? 263 // Foreign agents allowed
282 // 264 //
283 if (account == null) 265 if (account == null && !m_ForeignAgentsAllowed)
284 { 266 {
285 bool allowed = m_ForeignAgentsAllowed; 267 reason = "Unauthorized";
286 268 m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agents are not permitted {0} {1}. Refusing service.",
287 if (m_ForeignAgentsAllowed && IsException(aCircuit, m_ForeignsAllowedExceptions)) 269 aCircuit.firstname, aCircuit.lastname);
288 allowed = false; 270 return false;
289
290 if (!m_ForeignAgentsAllowed && IsException(aCircuit, m_ForeignsDisallowedExceptions))
291 allowed = true;
292
293 if (!allowed)
294 {
295 reason = "Destination does not allow visitors from your world";
296 m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agents are not permitted {0} {1} @ {2}. Refusing service.",
297 aCircuit.firstname, aCircuit.lastname, aCircuit.ServiceURLs["HomeURI"]);
298 return false;
299 }
300 } 271 }
301 272
273 // May want to authorize
274
302 bool isFirstLogin = false; 275 bool isFirstLogin = false;
303 // 276 //
304 // Login the presence, if it's not there yet (by the login service) 277 // Login the presence, if it's not there yet (by the login service)
@@ -307,8 +280,7 @@ namespace OpenSim.Services.HypergridService
307 if (presence != null) // it has been placed there by the login service 280 if (presence != null) // it has been placed there by the login service
308 isFirstLogin = true; 281 isFirstLogin = true;
309 282
310 else 283 else
311 {
312 if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID)) 284 if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID))
313 { 285 {
314 reason = "Unable to login presence"; 286 reason = "Unable to login presence";
@@ -318,26 +290,6 @@ namespace OpenSim.Services.HypergridService
318 } 290 }
319 m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence ok"); 291 m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence ok");
320 292
321 // Also login foreigners with GridUser service
322 if (m_GridUserService != null && account == null)
323 {
324 string userId = aCircuit.AgentID.ToString();
325 string first = aCircuit.firstname, last = aCircuit.lastname;
326 if (last.StartsWith("@"))
327 {
328 string[] parts = aCircuit.firstname.Split('.');
329 if (parts.Length >= 2)
330 {
331 first = parts[0];
332 last = parts[1];
333 }
334 }
335
336 userId += ";" + aCircuit.ServiceURLs["HomeURI"] + ";" + first + " " + last;
337 m_GridUserService.LoggedIn(userId);
338 }
339 }
340
341 // 293 //
342 // Get the region 294 // Get the region
343 // 295 //
@@ -441,27 +393,6 @@ namespace OpenSim.Services.HypergridService
441 393
442 #region Misc 394 #region Misc
443 395
444 private bool IsException(AgentCircuitData aCircuit, List<string> exceptions)
445 {
446 bool exception = false;
447 if (exceptions.Count > 0) // we have exceptions
448 {
449 // Retrieve the visitor's origin
450 string userURL = aCircuit.ServiceURLs["HomeURI"].ToString();
451 if (!userURL.EndsWith("/"))
452 userURL += "/";
453
454 if (exceptions.Find(delegate(string s)
455 {
456 if (!s.EndsWith("/"))
457 s += "/";
458 return s == userURL;
459 }) != null)
460 exception = true;
461 }
462
463 return exception;
464 }
465 396
466 #endregion 397 #endregion
467 } 398 }
diff --git a/OpenSim/Services/HypergridService/HGAssetService.cs b/OpenSim/Services/HypergridService/HGAssetService.cs
index 84dec8d..db98166 100644
--- a/OpenSim/Services/HypergridService/HGAssetService.cs
+++ b/OpenSim/Services/HypergridService/HGAssetService.cs
@@ -58,8 +58,6 @@ namespace OpenSim.Services.HypergridService
58 58
59 private UserAccountCache m_Cache; 59 private UserAccountCache m_Cache;
60 60
61 private AssetPermissions m_AssetPerms;
62
63 public HGAssetService(IConfigSource config, string configName) : base(config, configName) 61 public HGAssetService(IConfigSource config, string configName) : base(config, configName)
64 { 62 {
65 m_log.Debug("[HGAsset Service]: Starting"); 63 m_log.Debug("[HGAsset Service]: Starting");
@@ -82,10 +80,6 @@ namespace OpenSim.Services.HypergridService
82 m_HomeURL = assetConfig.GetString("HomeURI", m_HomeURL); 80 m_HomeURL = assetConfig.GetString("HomeURI", m_HomeURL);
83 81
84 m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); 82 m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService);
85
86 // Permissions
87 m_AssetPerms = new AssetPermissions(assetConfig);
88
89 } 83 }
90 84
91 #region IAssetService overrides 85 #region IAssetService overrides
@@ -96,9 +90,6 @@ namespace OpenSim.Services.HypergridService
96 if (asset == null) 90 if (asset == null)
97 return null; 91 return null;
98 92
99 if (!m_AssetPerms.AllowedExport(asset.Type))
100 return null;
101
102 if (asset.Metadata.Type == (sbyte)AssetType.Object) 93 if (asset.Metadata.Type == (sbyte)AssetType.Object)
103 asset.Data = AdjustIdentifiers(asset.Data); ; 94 asset.Data = AdjustIdentifiers(asset.Data); ;
104 95
@@ -121,27 +112,16 @@ namespace OpenSim.Services.HypergridService
121 112
122 public override byte[] GetData(string id) 113 public override byte[] GetData(string id)
123 { 114 {
124 AssetBase asset = Get(id); 115 byte[] data = base.GetData(id);
125
126 if (asset == null)
127 return null;
128 116
129 if (!m_AssetPerms.AllowedExport(asset.Type)) 117 if (data == null)
130 return null; 118 return null;
131 119
132 return asset.Data; 120 return AdjustIdentifiers(data);
133 } 121 }
134 122
135 //public virtual bool Get(string id, Object sender, AssetRetrieved handler) 123 //public virtual bool Get(string id, Object sender, AssetRetrieved handler)
136 124
137 public override string Store(AssetBase asset)
138 {
139 if (!m_AssetPerms.AllowedImport(asset.Type))
140 return string.Empty;
141
142 return base.Store(asset);
143 }
144
145 public override bool Delete(string id) 125 public override bool Delete(string id)
146 { 126 {
147 // NOGO 127 // NOGO
diff --git a/OpenSim/Services/HypergridService/HGFriendsService.cs b/OpenSim/Services/HypergridService/HGFriendsService.cs
index a8bcfb2..98423d7 100644
--- a/OpenSim/Services/HypergridService/HGFriendsService.cs
+++ b/OpenSim/Services/HypergridService/HGFriendsService.cs
@@ -397,7 +397,7 @@ namespace OpenSim.Services.HypergridService
397 if (region != null) 397 if (region != null)
398 { 398 {
399 m_log.DebugFormat("[HGFRIENDS SERVICE]: Remote Notify to region {0}, user {1} is {2}", region.RegionName, foreignUserID, (online ? "online" : "offline")); 399 m_log.DebugFormat("[HGFRIENDS SERVICE]: Remote Notify to region {0}, user {1} is {2}", region.RegionName, foreignUserID, (online ? "online" : "offline"));
400 m_FriendsSimConnector.StatusNotify(region, foreignUserID, userID.ToString(), online); 400 m_FriendsSimConnector.StatusNotify(region, foreignUserID, userID, online);
401 } 401 }
402 } 402 }
403 } 403 }
diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs
index 784f136..6e4b68c 100644
--- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs
+++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs
@@ -56,12 +56,10 @@ namespace OpenSim.Services.HypergridService
56 56
57 private string m_HomeURL; 57 private string m_HomeURL;
58 private IUserAccountService m_UserAccountService; 58 private IUserAccountService m_UserAccountService;
59 private IAvatarService m_AvatarService;
60 59
61// private UserAccountCache m_Cache; 60// private UserAccountCache m_Cache;
62 61
63 private ExpiringCache<UUID, List<XInventoryFolder>> m_SuitcaseTrees = new ExpiringCache<UUID, List<XInventoryFolder>>(); 62 private ExpiringCache<UUID, List<XInventoryFolder>> m_SuitcaseTrees = new ExpiringCache<UUID, List<XInventoryFolder>>();
64 private ExpiringCache<UUID, AvatarAppearance> m_Appearances = new ExpiringCache<UUID, AvatarAppearance>();
65 63
66 public HGSuitcaseInventoryService(IConfigSource config, string configName) 64 public HGSuitcaseInventoryService(IConfigSource config, string configName)
67 : base(config, configName) 65 : base(config, configName)
@@ -71,7 +69,7 @@ namespace OpenSim.Services.HypergridService
71 m_ConfigName = configName; 69 m_ConfigName = configName;
72 70
73 if (m_Database == null) 71 if (m_Database == null)
74 m_log.ErrorFormat("[HG SUITCASE INVENTORY SERVICE]: m_Database is null!"); 72 m_log.WarnFormat("[XXX]: m_Database is null!");
75 73
76 // 74 //
77 // Try reading the [InventoryService] section, if it exists 75 // Try reading the [InventoryService] section, if it exists
@@ -79,6 +77,7 @@ namespace OpenSim.Services.HypergridService
79 IConfig invConfig = config.Configs[m_ConfigName]; 77 IConfig invConfig = config.Configs[m_ConfigName];
80 if (invConfig != null) 78 if (invConfig != null)
81 { 79 {
80 // realm = authConfig.GetString("Realm", realm);
82 string userAccountsDll = invConfig.GetString("UserAccountsService", string.Empty); 81 string userAccountsDll = invConfig.GetString("UserAccountsService", string.Empty);
83 if (userAccountsDll == string.Empty) 82 if (userAccountsDll == string.Empty)
84 throw new Exception("Please specify UserAccountsService in HGInventoryService configuration"); 83 throw new Exception("Please specify UserAccountsService in HGInventoryService configuration");
@@ -88,14 +87,8 @@ namespace OpenSim.Services.HypergridService
88 if (m_UserAccountService == null) 87 if (m_UserAccountService == null)
89 throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); 88 throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll));
90 89
91 string avatarDll = invConfig.GetString("AvatarService", string.Empty); 90 // legacy configuration [obsolete]
92 if (avatarDll == string.Empty) 91 m_HomeURL = invConfig.GetString("ProfileServerURI", string.Empty);
93 throw new Exception("Please specify AvatarService in HGInventoryService configuration");
94
95 m_AvatarService = ServerUtils.LoadPlugin<IAvatarService>(avatarDll, args);
96 if (m_AvatarService == null)
97 throw new Exception(String.Format("Unable to create m_AvatarService from {0}", avatarDll));
98
99 // Preferred 92 // Preferred
100 m_HomeURL = invConfig.GetString("HomeURI", m_HomeURL); 93 m_HomeURL = invConfig.GetString("HomeURI", m_HomeURL);
101 94
@@ -301,7 +294,7 @@ namespace OpenSim.Services.HypergridService
301 294
302 public override bool AddFolder(InventoryFolderBase folder) 295 public override bool AddFolder(InventoryFolderBase folder)
303 { 296 {
304 //m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: AddFolder {0} {1}", folder.Name, folder.ParentID); 297 m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: AddFolder {0} {1}", folder.Name, folder.ParentID);
305 // Let's do a bit of sanity checking, more than the base service does 298 // Let's do a bit of sanity checking, more than the base service does
306 // make sure the given folder's parent folder exists under the suitcase tree of this user 299 // make sure the given folder's parent folder exists under the suitcase tree of this user
307 300
@@ -323,7 +316,7 @@ namespace OpenSim.Services.HypergridService
323 316
324 public override bool UpdateFolder(InventoryFolderBase folder) 317 public override bool UpdateFolder(InventoryFolderBase folder)
325 { 318 {
326 //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version); 319 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version);
327 if (!IsWithinSuitcaseTree(folder.Owner, folder.ID)) 320 if (!IsWithinSuitcaseTree(folder.Owner, folder.ID))
328 { 321 {
329 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: folder {0} not within Suitcase tree", folder.Name); 322 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: folder {0} not within Suitcase tree", folder.Name);
@@ -401,7 +394,7 @@ namespace OpenSim.Services.HypergridService
401 return null; 394 return null;
402 } 395 }
403 396
404 if (!IsWithinSuitcaseTree(it.Owner, it.Folder) && !IsPartOfAppearance(it.Owner, it.ID)) 397 if (!IsWithinSuitcaseTree(it.Owner, it.Folder))
405 { 398 {
406 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0} (folder {1}) is not within Suitcase", 399 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0} (folder {1}) is not within Suitcase",
407 it.Name, it.Folder); 400 it.Name, it.Folder);
@@ -460,15 +453,6 @@ namespace OpenSim.Services.HypergridService
460 453
461 if (folders != null && folders.Length > 0) 454 if (folders != null && folders.Length > 0)
462 return folders[0]; 455 return folders[0];
463
464 // OK, so the RootFolder type didn't work. Let's look for any type with parent UUID.Zero.
465 folders = m_Database.GetFolders(
466 new string[] { "agentID", "folderName", "parentFolderID" },
467 new string[] { principalID.ToString(), "My Inventory", UUID.Zero.ToString() });
468
469 if (folders != null && folders.Length > 0)
470 return folders[0];
471
472 return null; 456 return null;
473 } 457 }
474 458
@@ -565,52 +549,6 @@ namespace OpenSim.Services.HypergridService
565 else return true; 549 else return true;
566 } 550 }
567 #endregion 551 #endregion
568
569 #region Avatar Appearance
570
571 private AvatarAppearance GetAppearance(UUID principalID)
572 {
573 AvatarAppearance a = null;
574 if (m_Appearances.TryGetValue(principalID, out a))
575 return a;
576
577 a = m_AvatarService.GetAppearance(principalID);
578 m_Appearances.AddOrUpdate(principalID, a, 5 * 60); // 5minutes
579 return a;
580 }
581
582 private bool IsPartOfAppearance(UUID principalID, UUID itemID)
583 {
584 AvatarAppearance a = GetAppearance(principalID);
585
586 if (a == null)
587 return false;
588
589 // Check wearables (body parts and clothes)
590 for (int i = 0; i < a.Wearables.Length; i++)
591 {
592 for (int j = 0; j < a.Wearables[i].Count; j++)
593 {
594 if (a.Wearables[i][j].ItemID == itemID)
595 {
596 //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: item {0} is a wearable", itemID);
597 return true;
598 }
599 }
600 }
601
602 // Check attachments
603 if (a.GetAttachmentForItem(itemID) != null)
604 {
605 //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: item {0} is an attachment", itemID);
606 return true;
607 }
608
609 return false;
610 }
611
612 #endregion
613
614 } 552 }
615 553
616} 554}
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs
index 416ad16..a49993c 100644
--- a/OpenSim/Services/HypergridService/UserAgentService.cs
+++ b/OpenSim/Services/HypergridService/UserAgentService.cs
@@ -77,10 +77,6 @@ namespace OpenSim.Services.HypergridService
77 77
78 protected static bool m_BypassClientVerification; 78 protected static bool m_BypassClientVerification;
79 79
80 private static Dictionary<int, bool> m_ForeignTripsAllowed = new Dictionary<int, bool>();
81 private static Dictionary<int, List<string>> m_TripsAllowedExceptions = new Dictionary<int, List<string>>();
82 private static Dictionary<int, List<string>> m_TripsDisallowedExceptions = new Dictionary<int, List<string>>();
83
84 public UserAgentService(IConfigSource config) : this(config, null) 80 public UserAgentService(IConfigSource config) : this(config, null)
85 { 81 {
86 } 82 }
@@ -125,12 +121,6 @@ namespace OpenSim.Services.HypergridService
125 m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args); 121 m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);
126 m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(userAccountService, args); 122 m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(userAccountService, args);
127 123
128 m_LevelOutsideContacts = serverConfig.GetInt("LevelOutsideContacts", 0);
129
130 LoadTripPermissionsFromConfig(serverConfig, "ForeignTripsAllowed");
131 LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_TripsAllowedExceptions);
132 LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_TripsDisallowedExceptions);
133
134 m_GridName = serverConfig.GetString("ExternalName", string.Empty); 124 m_GridName = serverConfig.GetString("ExternalName", string.Empty);
135 if (m_GridName == string.Empty) 125 if (m_GridName == string.Empty)
136 { 126 {
@@ -140,43 +130,10 @@ namespace OpenSim.Services.HypergridService
140 if (!m_GridName.EndsWith("/")) 130 if (!m_GridName.EndsWith("/"))
141 m_GridName = m_GridName + "/"; 131 m_GridName = m_GridName + "/";
142 132
133 m_LevelOutsideContacts = serverConfig.GetInt("LevelOutsideContacts", 0);
143 } 134 }
144 } 135 }
145 136
146 protected void LoadTripPermissionsFromConfig(IConfig config, string variable)
147 {
148 foreach (string keyName in config.GetKeys())
149 {
150 if (keyName.StartsWith(variable + "_Level_"))
151 {
152 int level = 0;
153 if (Int32.TryParse(keyName.Replace(variable + "_Level_", ""), out level))
154 m_ForeignTripsAllowed.Add(level, config.GetBoolean(keyName, true));
155 }
156 }
157 }
158
159 protected void LoadDomainExceptionsFromConfig(IConfig config, string variable, Dictionary<int, List<string>> exceptions)
160 {
161 foreach (string keyName in config.GetKeys())
162 {
163 if (keyName.StartsWith(variable + "_Level_"))
164 {
165 int level = 0;
166 if (Int32.TryParse(keyName.Replace(variable + "_Level_", ""), out level) && !exceptions.ContainsKey(level))
167 {
168 exceptions.Add(level, new List<string>());
169 string value = config.GetString(keyName, string.Empty);
170 string[] parts = value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
171
172 foreach (string s in parts)
173 exceptions[level].Add(s.Trim());
174 }
175 }
176 }
177 }
178
179
180 public GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt) 137 public GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt)
181 { 138 {
182 position = new Vector3(128, 128, 0); lookAt = Vector3.UnitY; 139 position = new Vector3(128, 128, 0); lookAt = Vector3.UnitY;
@@ -209,39 +166,13 @@ namespace OpenSim.Services.HypergridService
209 m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", 166 m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}",
210 agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ServerURI); 167 agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ServerURI);
211 168
212 string gridName = gatekeeper.ServerURI; 169 if (m_UserAccountService.GetUserAccount(UUID.Zero, agentCircuit.AgentID) == null)
213
214 UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, agentCircuit.AgentID);
215 if (account == null)
216 { 170 {
217 m_log.WarnFormat("[USER AGENT SERVICE]: Someone attempted to lauch a foreign user from here {0} {1}", agentCircuit.firstname, agentCircuit.lastname); 171 m_log.WarnFormat("[USER AGENT SERVICE]: Someone attempted to lauch a foreign user from here {0} {1}", agentCircuit.firstname, agentCircuit.lastname);
218 reason = "Forbidden to launch your agents from here"; 172 reason = "Forbidden to launch your agents from here";
219 return false; 173 return false;
220 } 174 }
221 175
222 // Is this user allowed to go there?
223 if (m_GridName != gridName)
224 {
225 if (m_ForeignTripsAllowed.ContainsKey(account.UserLevel))
226 {
227 bool allowed = m_ForeignTripsAllowed[account.UserLevel];
228
229 if (m_ForeignTripsAllowed[account.UserLevel] && IsException(gridName, account.UserLevel, m_TripsAllowedExceptions))
230 allowed = false;
231
232 if (!m_ForeignTripsAllowed[account.UserLevel] && IsException(gridName, account.UserLevel, m_TripsDisallowedExceptions))
233 allowed = true;
234
235 if (!allowed)
236 {
237 reason = "Your world does not allow you to visit the destination";
238 m_log.InfoFormat("[USER AGENT SERVICE]: Agents not permitted to visit {0}. Refusing service.", gridName);
239 return false;
240 }
241 }
242 }
243
244
245 // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination 176 // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination
246 GridRegion region = new GridRegion(gatekeeper); 177 GridRegion region = new GridRegion(gatekeeper);
247 region.ServerURI = gatekeeper.ServerURI; 178 region.ServerURI = gatekeeper.ServerURI;
@@ -258,6 +189,7 @@ namespace OpenSim.Services.HypergridService
258 189
259 bool success = false; 190 bool success = false;
260 string myExternalIP = string.Empty; 191 string myExternalIP = string.Empty;
192 string gridName = gatekeeper.ServerURI;
261 193
262 m_log.DebugFormat("[USER AGENT SERVICE]: this grid: {0}, desired grid: {1}", m_GridName, gridName); 194 m_log.DebugFormat("[USER AGENT SERVICE]: this grid: {0}, desired grid: {1}", m_GridName, gridName);
263 195
@@ -502,7 +434,7 @@ namespace OpenSim.Services.HypergridService
502 if (region != null) 434 if (region != null)
503 { 435 {
504 m_log.DebugFormat("[USER AGENT SERVICE]: Remote Notify to region {0}, user {1} is {2}", region.RegionName, foreignUserID, (online ? "online" : "offline")); 436 m_log.DebugFormat("[USER AGENT SERVICE]: Remote Notify to region {0}, user {1} is {2}", region.RegionName, foreignUserID, (online ? "online" : "offline"));
505 m_FriendsSimConnector.StatusNotify(region, foreignUserID, userID.ToString(), online); 437 m_FriendsSimConnector.StatusNotify(region, foreignUserID, userID, online);
506 } 438 }
507 } 439 }
508 } 440 }
@@ -654,35 +586,6 @@ namespace OpenSim.Services.HypergridService
654 else 586 else
655 return UUID.Zero; 587 return UUID.Zero;
656 } 588 }
657
658 #region Misc
659
660 private bool IsException(string dest, int level, Dictionary<int, List<string>> exceptions)
661 {
662 if (!exceptions.ContainsKey(level))
663 return false;
664
665 bool exception = false;
666 if (exceptions[level].Count > 0) // we have exceptions
667 {
668 string destination = dest;
669 if (!destination.EndsWith("/"))
670 destination += "/";
671
672 if (exceptions[level].Find(delegate(string s)
673 {
674 if (!s.EndsWith("/"))
675 s += "/";
676 return s == destination;
677 }) != null)
678 exception = true;
679 }
680
681 return exception;
682 }
683
684 #endregion
685
686 } 589 }
687 590
688 class TravelingAgentInfo 591 class TravelingAgentInfo
diff --git a/OpenSim/Services/Interfaces/IAssetService.cs b/OpenSim/Services/Interfaces/IAssetService.cs
index 3c469c6..80494f1 100644
--- a/OpenSim/Services/Interfaces/IAssetService.cs
+++ b/OpenSim/Services/Interfaces/IAssetService.cs
@@ -68,11 +68,7 @@ namespace OpenSim.Services.Interfaces
68 /// </summary> 68 /// </summary>
69 /// <param name="id">The asset id</param> 69 /// <param name="id">The asset id</param>
70 /// <param name="sender">Represents the requester. Passed back via the handler</param> 70 /// <param name="sender">Represents the requester. Passed back via the handler</param>
71 /// <param name="handler"> 71 /// <param name="handler">The handler to call back once the asset has been retrieved</param>
72 /// The handler to call back once the asset has been retrieved. This will be called back with a null AssetBase
73 /// if the asset could not be found for some reason (e.g. if it does not exist, if a remote asset service
74 /// was not contactable, if it is not in the database, etc.).
75 /// </param>
76 /// <returns>True if the id was parseable, false otherwise</returns> 72 /// <returns>True if the id was parseable, false otherwise</returns>
77 bool Get(string id, Object sender, AssetRetrieved handler); 73 bool Get(string id, Object sender, AssetRetrieved handler);
78 74
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs
index 3f4c958..cdcb961 100644
--- a/OpenSim/Services/Interfaces/IGridService.cs
+++ b/OpenSim/Services/Interfaces/IGridService.cs
@@ -100,19 +100,6 @@ namespace OpenSim.Services.Interfaces
100 List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y); 100 List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y);
101 List<GridRegion> GetHyperlinks(UUID scopeID); 101 List<GridRegion> GetHyperlinks(UUID scopeID);
102 102
103 /// <summary>
104 /// Get internal OpenSimulator region flags.
105 /// </summary>
106 /// <remarks>
107 /// See OpenSimulator.Framework.RegionFlags. These are not returned in the GridRegion structure -
108 /// they currently need to be requested separately. Possibly this should change to avoid multiple service calls
109 /// in some situations.
110 /// </remarks>
111 /// <returns>
112 /// The region flags.
113 /// </returns>
114 /// <param name='scopeID'></param>
115 /// <param name='regionID'></param>
116 int GetRegionFlags(UUID scopeID, UUID regionID); 103 int GetRegionFlags(UUID scopeID, UUID regionID);
117 } 104 }
118 105
diff --git a/OpenSim/Services/Interfaces/IGridUserService.cs b/OpenSim/Services/Interfaces/IGridUserService.cs
index 2e7237e..0a52bfa 100644
--- a/OpenSim/Services/Interfaces/IGridUserService.cs
+++ b/OpenSim/Services/Interfaces/IGridUserService.cs
@@ -80,7 +80,7 @@ namespace OpenSim.Services.Interfaces
80 80
81 } 81 }
82 82
83 public virtual Dictionary<string, object> ToKeyValuePairs() 83 public Dictionary<string, object> ToKeyValuePairs()
84 { 84 {
85 Dictionary<string, object> result = new Dictionary<string, object>(); 85 Dictionary<string, object> result = new Dictionary<string, object>();
86 result["UserID"] = UserID; 86 result["UserID"] = UserID;
@@ -96,6 +96,7 @@ namespace OpenSim.Services.Interfaces
96 result["Online"] = Online.ToString(); 96 result["Online"] = Online.ToString();
97 result["Login"] = Login.ToString(); 97 result["Login"] = Login.ToString();
98 result["Logout"] = Logout.ToString(); 98 result["Logout"] = Logout.ToString();
99
99 100
100 return result; 101 return result;
101 } 102 }
diff --git a/OpenSim/Services/Interfaces/IPresenceService.cs b/OpenSim/Services/Interfaces/IPresenceService.cs
index 90f9842..8d583ff 100644
--- a/OpenSim/Services/Interfaces/IPresenceService.cs
+++ b/OpenSim/Services/Interfaces/IPresenceService.cs
@@ -61,49 +61,13 @@ namespace OpenSim.Services.Interfaces
61 61
62 public interface IPresenceService 62 public interface IPresenceService
63 { 63 {
64 /// <summary>
65 /// Store session information.
66 /// </summary>
67 /// <returns>/returns>
68 /// <param name='userID'></param>
69 /// <param name='sessionID'></param>
70 /// <param name='secureSessionID'></param>
71 bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID); 64 bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID);
72
73 /// <summary>
74 /// Remove session information.
75 /// </summary>
76 /// <returns></returns>
77 /// <param name='sessionID'></param>
78 bool LogoutAgent(UUID sessionID); 65 bool LogoutAgent(UUID sessionID);
79
80 /// <summary>
81 /// Remove session information for all agents in the given region.
82 /// </summary>
83 /// <returns></returns>
84 /// <param name='regionID'></param>
85 bool LogoutRegionAgents(UUID regionID); 66 bool LogoutRegionAgents(UUID regionID);
86 67
87 /// <summary>
88 /// Update data for an existing session.
89 /// </summary>
90 /// <returns></returns>
91 /// <param name='sessionID'></param>
92 /// <param name='regionID'></param>
93 bool ReportAgent(UUID sessionID, UUID regionID); 68 bool ReportAgent(UUID sessionID, UUID regionID);
94 69
95 /// <summary>
96 /// Get session information for a given session ID.
97 /// </summary>
98 /// <returns></returns>
99 /// <param name='sessionID'></param>
100 PresenceInfo GetAgent(UUID sessionID); 70 PresenceInfo GetAgent(UUID sessionID);
101
102 /// <summary>
103 /// Get session information for a collection of users.
104 /// </summary>
105 /// <returns>Session information for the users.</returns>
106 /// <param name='userIDs'></param>
107 PresenceInfo[] GetAgents(string[] userIDs); 71 PresenceInfo[] GetAgents(string[] userIDs);
108 } 72 }
109} \ No newline at end of file 73}
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs
index 309dab4..7518b86 100644
--- a/OpenSim/Services/InventoryService/XInventoryService.cs
+++ b/OpenSim/Services/InventoryService/XInventoryService.cs
@@ -94,7 +94,6 @@ namespace OpenSim.Services.InventoryService
94 94
95 m_Database = LoadPlugin<IXInventoryData>(dllName, 95 m_Database = LoadPlugin<IXInventoryData>(dllName,
96 new Object[] {connString, String.Empty}); 96 new Object[] {connString, String.Empty});
97
98 if (m_Database == null) 97 if (m_Database == null)
99 throw new Exception("Could not find a storage interface in the given module"); 98 throw new Exception("Could not find a storage interface in the given module");
100 } 99 }
@@ -230,28 +229,10 @@ namespace OpenSim.Services.InventoryService
230 public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) 229 public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type)
231 { 230 {
232// m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID); 231// m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID);
233
234 InventoryFolderBase rootFolder = GetRootFolder(principalID);
235
236 if (rootFolder == null)
237 {
238 m_log.WarnFormat(
239 "[XINVENTORY]: Found no root folder for {0} in GetFolderForType() when looking for {1}",
240 principalID, type);
241
242 return null;
243 }
244
245 return GetSystemFolderForType(rootFolder, type);
246 }
247
248 private InventoryFolderBase GetSystemFolderForType(InventoryFolderBase rootFolder, AssetType type)
249 {
250// m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID);
251 232
252 XInventoryFolder[] folders = m_Database.GetFolders( 233 XInventoryFolder[] folders = m_Database.GetFolders(
253 new string[] { "agentID", "parentFolderID", "type"}, 234 new string[] { "agentID", "type"},
254 new string[] { rootFolder.Owner.ToString(), rootFolder.ID.ToString(), ((int)type).ToString() }); 235 new string[] { principalID.ToString(), ((int)type).ToString() });
255 236
256 if (folders.Length == 0) 237 if (folders.Length == 0)
257 { 238 {
@@ -327,38 +308,22 @@ namespace OpenSim.Services.InventoryService
327 if (check != null) 308 if (check != null)
328 return false; 309 return false;
329 310
330 if (folder.Type != (short)AssetType.Folder && folder.Type != (short)AssetType.Unknown) 311 if (folder.Type == (short)AssetType.Folder
312 || folder.Type == (short)AssetType.Unknown
313 || folder.Type == (short)AssetType.OutfitFolder
314 || GetFolderForType(folder.Owner, (AssetType)(folder.Type)) == null)
331 { 315 {
332 InventoryFolderBase rootFolder = GetRootFolder(folder.Owner); 316 XInventoryFolder xFolder = ConvertFromOpenSim(folder);
333 317 return m_Database.StoreFolder(xFolder);
334 if (rootFolder == null) 318 }
335 { 319 else
336 m_log.WarnFormat( 320 {
337 "[XINVENTORY]: Found no root folder for {0} in AddFolder() when looking for {1}", 321 m_log.WarnFormat(
338 folder.Owner, folder.Type); 322 "[XINVENTORY]: Folder of type {0} already exists when tried to add {1} to {2} for {3}",
339 323 folder.Type, folder.Name, folder.ParentID, folder.Owner);
340 return false;
341 }
342
343 // Check we're not trying to add this as a system folder.
344 if (folder.ParentID == rootFolder.ID)
345 {
346 InventoryFolderBase existingSystemFolder
347 = GetSystemFolderForType(rootFolder, (AssetType)folder.Type);
348
349 if (existingSystemFolder != null)
350 {
351 m_log.WarnFormat(
352 "[XINVENTORY]: System folder of type {0} already exists when tried to add {1} to {2} for {3}",
353 folder.Type, folder.Name, folder.ParentID, folder.Owner);
354
355 return false;
356 }
357 }
358 } 324 }
359 325
360 XInventoryFolder xFolder = ConvertFromOpenSim(folder); 326 return false;
361 return m_Database.StoreFolder(xFolder);
362 } 327 }
363 328
364 public virtual bool UpdateFolder(InventoryFolderBase folder) 329 public virtual bool UpdateFolder(InventoryFolderBase folder)
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index cbb6e6c..988a9b9 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -300,7 +300,7 @@ namespace OpenSim.Services.LLLoginService
300 { 300 {
301 m_log.InfoFormat( 301 m_log.InfoFormat(
302 "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: user level is {2} but minimum login level is {3}", 302 "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: user level is {2} but minimum login level is {3}",
303 firstName, lastName, account.UserLevel, m_MinLoginLevel); 303 firstName, lastName, m_MinLoginLevel, account.UserLevel);
304 return LLFailedLoginResponse.LoginBlockedProblem; 304 return LLFailedLoginResponse.LoginBlockedProblem;
305 } 305 }
306 306
diff --git a/OpenSim/Services/UserAccountService/GridUserService.cs b/OpenSim/Services/UserAccountService/GridUserService.cs
index 43fa04b..ac3d8fd 100644
--- a/OpenSim/Services/UserAccountService/GridUserService.cs
+++ b/OpenSim/Services/UserAccountService/GridUserService.cs
@@ -49,7 +49,7 @@ namespace OpenSim.Services.UserAccountService
49 m_log.Debug("[USER GRID SERVICE]: Starting user grid service"); 49 m_log.Debug("[USER GRID SERVICE]: Starting user grid service");
50 } 50 }
51 51
52 public virtual GridUserInfo GetGridUserInfo(string userID) 52 public GridUserInfo GetGridUserInfo(string userID)
53 { 53 {
54 GridUserData d = m_Database.Get(userID); 54 GridUserData d = m_Database.Get(userID);
55 55
@@ -122,6 +122,17 @@ namespace OpenSim.Services.UserAccountService
122 return m_Database.Store(d); 122 return m_Database.Store(d);
123 } 123 }
124 124
125 protected bool StoreGridUserInfo(GridUserInfo info)
126 {
127 GridUserData d = new GridUserData();
128
129 d.Data["HomeRegionID"] = info.HomeRegionID.ToString();
130 d.Data["HomePosition"] = info.HomePosition.ToString();
131 d.Data["HomeLookAt"] = info.HomeLookAt.ToString();
132
133 return m_Database.Store(d);
134 }
135
125 public bool SetHome(string userID, UUID homeID, Vector3 homePosition, Vector3 homeLookAt) 136 public bool SetHome(string userID, UUID homeID, Vector3 homePosition, Vector3 homeLookAt)
126 { 137 {
127 GridUserData d = m_Database.Get(userID); 138 GridUserData d = m_Database.Get(userID);