aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors
diff options
context:
space:
mode:
authorMichael Heilmann2015-05-19 15:18:45 -0400
committerMichael Heilmann2015-05-19 15:18:45 -0400
commit140ea04b9d692344d803fc87364fb252561725c3 (patch)
treed503b7ae17baca374d704b548fc7da512f512388 /OpenSim/Services/Connectors
parentMerge pull request #7 from gamucf/moses.metricsPhase2 (diff)
parentresolve possible nullref when sending appearance packet. Thanks to zadark for... (diff)
downloadopensim-SC_OLD-140ea04b9d692344d803fc87364fb252561725c3.zip
opensim-SC_OLD-140ea04b9d692344d803fc87364fb252561725c3.tar.gz
opensim-SC_OLD-140ea04b9d692344d803fc87364fb252561725c3.tar.bz2
opensim-SC_OLD-140ea04b9d692344d803fc87364fb252561725c3.tar.xz
Merging Opensim upstream before generating patch
Diffstat (limited to 'OpenSim/Services/Connectors')
-rw-r--r--OpenSim/Services/Connectors/Estate/EstateDataConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs125
-rw-r--r--OpenSim/Services/Connectors/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs31
-rw-r--r--OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs35
5 files changed, 187 insertions, 8 deletions
diff --git a/OpenSim/Services/Connectors/Estate/EstateDataConnector.cs b/OpenSim/Services/Connectors/Estate/EstateDataConnector.cs
index 37f9374..6412bcd 100644
--- a/OpenSim/Services/Connectors/Estate/EstateDataConnector.cs
+++ b/OpenSim/Services/Connectors/Estate/EstateDataConnector.cs
@@ -40,7 +40,7 @@ using OpenSim.Services.Connectors;
40using OpenSim.Services.Interfaces; 40using OpenSim.Services.Interfaces;
41using OpenSim.Server.Base; 41using OpenSim.Server.Base;
42 42
43namespace OpenSim.Service.Connectors 43namespace OpenSim.Services.Connectors
44{ 44{
45 public class EstateDataRemoteConnector : BaseServiceConnector, IEstateDataService 45 public class EstateDataRemoteConnector : BaseServiceConnector, IEstateDataService
46 { 46 {
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs
index 574de89..db3c857 100644
--- a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs
@@ -205,7 +205,7 @@ namespace OpenSim.Services.Connectors
205 InventoryCollection inventory = new InventoryCollection(); 205 InventoryCollection inventory = new InventoryCollection();
206 inventory.Folders = new List<InventoryFolderBase>(); 206 inventory.Folders = new List<InventoryFolderBase>();
207 inventory.Items = new List<InventoryItemBase>(); 207 inventory.Items = new List<InventoryItemBase>();
208 inventory.UserID = principalID; 208 inventory.OwnerID = principalID;
209 209
210 try 210 try
211 { 211 {
@@ -235,6 +235,87 @@ namespace OpenSim.Services.Connectors
235 235
236 return inventory; 236 return inventory;
237 } 237 }
238
239 public virtual InventoryCollection[] GetMultipleFoldersContent(UUID principalID, UUID[] folderIDs)
240 {
241 InventoryCollection[] inventoryArr = new InventoryCollection[folderIDs.Length];
242 //m_log.DebugFormat("[XXX]: In GetMultipleFoldersContent {0}", folderIDs.Length);
243 try
244 {
245 Dictionary<string, object> resultSet = MakeRequest("GETMULTIPLEFOLDERSCONTENT",
246 new Dictionary<string, object> {
247 { "PRINCIPAL", principalID.ToString() },
248 { "FOLDERS", String.Join(",", folderIDs) },
249 { "COUNT", folderIDs.Length.ToString() }
250 });
251
252 if (!CheckReturn(resultSet))
253 return null;
254
255 int i = 0;
256 foreach (KeyValuePair<string, object> kvp in resultSet)
257 {
258 InventoryCollection inventory = new InventoryCollection();
259 if (kvp.Key.StartsWith("F_"))
260 {
261 UUID fid = UUID.Zero;
262 if (UUID.TryParse(kvp.Key.Substring(2), out fid) && fid == folderIDs[i])
263 {
264 inventory.Folders = new List<InventoryFolderBase>();
265 inventory.Items = new List<InventoryItemBase>();
266
267 Dictionary<string, object> ret = (Dictionary<string, object>)kvp.Value;
268
269 if (ret.ContainsKey("FID"))
270 {
271 if (!UUID.TryParse(ret["FID"].ToString(), out inventory.FolderID))
272 m_log.WarnFormat("[XINVENTORY SERVICES CONNECTOR]: Could not parse folder id {0}", ret["FID"].ToString());
273 }
274 else
275 m_log.WarnFormat("[XINVENTORY SERVICES CONNECTOR]: FID key not present in response");
276
277 inventory.Version = -1;
278 if (ret.ContainsKey("VERSION"))
279 Int32.TryParse(ret["VERSION"].ToString(), out inventory.Version);
280 if (ret.ContainsKey("OWNER"))
281 UUID.TryParse(ret["OWNER"].ToString(), out inventory.OwnerID);
282
283 //m_log.DebugFormat("[XXX]: Received {0} ({1}) {2} {3}", inventory.FolderID, fid, inventory.Version, inventory.OwnerID);
284
285 Dictionary<string, object> folders =
286 (Dictionary<string, object>)ret["FOLDERS"];
287 Dictionary<string, object> items =
288 (Dictionary<string, object>)ret["ITEMS"];
289
290 foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i
291 {
292 inventory.Folders.Add(BuildFolder((Dictionary<string, object>)o));
293 }
294 foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i
295 {
296 inventory.Items.Add(BuildItem((Dictionary<string, object>)o));
297 }
298
299 inventoryArr[i] = inventory;
300 }
301 else
302 {
303 m_log.WarnFormat("[XINVENTORY SERVICES CONNECTOR]: Folder id does not match. Expected {0} got {1}",
304 folderIDs[i], fid);
305 m_log.WarnFormat("[XINVENTORY SERVICES CONNECTOR]: {0} {1}", String.Join(",", folderIDs), String.Join(",", resultSet.Keys));
306 }
307
308 i += 1;
309 }
310 }
311 }
312 catch (Exception e)
313 {
314 m_log.WarnFormat("[XINVENTORY SERVICES CONNECTOR]: Exception in GetMultipleFoldersContent: {0}", e.Message);
315 }
316
317 return inventoryArr;
318 }
238 319
239 public List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID) 320 public List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID)
240 { 321 {
@@ -325,9 +406,13 @@ namespace OpenSim.Services.Connectors
325 406
326 public bool AddItem(InventoryItemBase item) 407 public bool AddItem(InventoryItemBase item)
327 { 408 {
409 if (item.Description == null)
410 item.Description = String.Empty;
328 if (item.CreatorData == null) 411 if (item.CreatorData == null)
329 item.CreatorData = String.Empty; 412 item.CreatorData = String.Empty;
330 Dictionary<string,object> ret = MakeRequest("ADDITEM", 413 if (item.CreatorId == null)
414 item.CreatorId = String.Empty;
415 Dictionary<string, object> ret = MakeRequest("ADDITEM",
331 new Dictionary<string,object> { 416 new Dictionary<string,object> {
332 { "AssetID", item.AssetID.ToString() }, 417 { "AssetID", item.AssetID.ToString() },
333 { "AssetType", item.AssetType.ToString() }, 418 { "AssetType", item.AssetType.ToString() },
@@ -446,6 +531,42 @@ namespace OpenSim.Services.Connectors
446 return null; 531 return null;
447 } 532 }
448 533
534 public virtual InventoryItemBase[] GetMultipleItems(UUID principalID, UUID[] itemIDs)
535 {
536 InventoryItemBase[] itemArr = new InventoryItemBase[itemIDs.Length];
537 try
538 {
539 Dictionary<string, object> resultSet = MakeRequest("GETMULTIPLEITEMS",
540 new Dictionary<string, object> {
541 { "PRINCIPAL", principalID.ToString() },
542 { "ITEMS", String.Join(",", itemIDs) },
543 { "COUNT", itemIDs.Length.ToString() }
544 });
545
546 if (!CheckReturn(resultSet))
547 return null;
548
549 int i = 0;
550 foreach (KeyValuePair<string, object> kvp in resultSet)
551 {
552 InventoryCollection inventory = new InventoryCollection();
553 if (kvp.Key.StartsWith("item_"))
554 {
555 if (kvp.Value is Dictionary<string, object>)
556 itemArr[i++] = BuildItem((Dictionary<string, object>)kvp.Value);
557 else
558 itemArr[i++] = null;
559 }
560 }
561 }
562 catch (Exception e)
563 {
564 m_log.WarnFormat("[XINVENTORY SERVICES CONNECTOR]: Exception in GetMultipleItems: {0}", e.Message);
565 }
566
567 return itemArr;
568 }
569
449 public InventoryFolderBase GetFolder(InventoryFolderBase folder) 570 public InventoryFolderBase GetFolder(InventoryFolderBase folder)
450 { 571 {
451 try 572 try
diff --git a/OpenSim/Services/Connectors/Properties/AssemblyInfo.cs b/OpenSim/Services/Connectors/Properties/AssemblyInfo.cs
index bb78cfd..2af2ec1 100644
--- a/OpenSim/Services/Connectors/Properties/AssemblyInfo.cs
+++ b/OpenSim/Services/Connectors/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.8.1.*")] 32[assembly: AssemblyVersion("0.8.2.*")]
33 33
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
index 9ded1c4..fdeea18 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
@@ -301,6 +301,21 @@ namespace OpenSim.Services.Connectors.SimianGrid
301 return null; 301 return null;
302 } 302 }
303 303
304 public InventoryItemBase[] GetMultipleItems(UUID principalID, UUID[] itemIDs)
305 {
306 InventoryItemBase[] result = new InventoryItemBase[itemIDs.Length];
307 int i = 0;
308 InventoryItemBase item = new InventoryItemBase();
309 item.Owner = principalID;
310 foreach (UUID id in itemIDs)
311 {
312 item.ID = id;
313 result[i++] = GetItem(item);
314 }
315
316 return result;
317 }
318
304 /// <summary> 319 /// <summary>
305 /// Get a folder, given by its UUID 320 /// Get a folder, given by its UUID
306 /// </summary> 321 /// </summary>
@@ -340,7 +355,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
340 public InventoryCollection GetFolderContent(UUID userID, UUID folderID) 355 public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
341 { 356 {
342 InventoryCollection inventory = new InventoryCollection(); 357 InventoryCollection inventory = new InventoryCollection();
343 inventory.UserID = userID; 358 inventory.OwnerID = userID;
344 359
345 NameValueCollection requestArgs = new NameValueCollection 360 NameValueCollection requestArgs = new NameValueCollection
346 { 361 {
@@ -371,6 +386,18 @@ namespace OpenSim.Services.Connectors.SimianGrid
371 return inventory; 386 return inventory;
372 } 387 }
373 388
389 public virtual InventoryCollection[] GetMultipleFoldersContent(UUID principalID, UUID[] folderIDs)
390 {
391 InventoryCollection[] invColl = new InventoryCollection[folderIDs.Length];
392 int i = 0;
393 foreach (UUID fid in folderIDs)
394 {
395 invColl[i++] = GetFolderContent(principalID, fid);
396 }
397
398 return invColl;
399 }
400
374 /// <summary> 401 /// <summary>
375 /// Gets the items inside a folder 402 /// Gets the items inside a folder
376 /// </summary> 403 /// </summary>
@@ -380,7 +407,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
380 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) 407 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
381 { 408 {
382 InventoryCollection inventory = new InventoryCollection(); 409 InventoryCollection inventory = new InventoryCollection();
383 inventory.UserID = userID; 410 inventory.OwnerID = userID;
384 411
385 NameValueCollection requestArgs = new NameValueCollection 412 NameValueCollection requestArgs = new NameValueCollection
386 { 413 {
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs
index 3f61d9a..560e6c4 100644
--- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs
+++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs
@@ -215,9 +215,39 @@ namespace OpenSim.Services.Connectors
215 sendData[kvp.Key] = kvp.Value.ToString(); 215 sendData[kvp.Key] = kvp.Value.ToString();
216 } 216 }
217 217
218 return SendAndGetBoolReply(sendData); 218 if (SendAndGetReply(sendData) != null)
219 return true;
220 else
221 return false;
219 } 222 }
220 223
224 /// <summary>
225 /// Create user remotely. Note this this is not part of the IUserAccountsService
226 /// </summary>
227 /// <param name="first"></param>
228 /// <param name="last"></param>
229 /// <param name="password"></param>
230 /// <param name="email"></param>
231 /// <param name="scopeID"></param>
232 /// <returns></returns>
233 public virtual UserAccount CreateUser(string first, string last, string password, string email, UUID scopeID)
234 {
235 Dictionary<string, object> sendData = new Dictionary<string, object>();
236 //sendData["SCOPEID"] = scopeID.ToString();
237 sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
238 sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
239 sendData["METHOD"] = "createuser";
240
241 sendData["FirstName"] = first;
242 sendData["LastName"] = last;
243 sendData["Password"] = password;
244 if (!string.IsNullOrEmpty(email))
245 sendData["Email"] = first;
246 sendData["ScopeID"] = scopeID.ToString();
247
248 return SendAndGetReply(sendData);
249 }
250
221 private UserAccount SendAndGetReply(Dictionary<string, object> sendData) 251 private UserAccount SendAndGetReply(Dictionary<string, object> sendData)
222 { 252 {
223 string reply = string.Empty; 253 string reply = string.Empty;
@@ -260,7 +290,7 @@ namespace OpenSim.Services.Connectors
260 { 290 {
261 string reqString = ServerUtils.BuildQueryString(sendData); 291 string reqString = ServerUtils.BuildQueryString(sendData);
262 string uri = m_ServerURI + "/accounts"; 292 string uri = m_ServerURI + "/accounts";
263 // m_log.DebugFormat("[ACCOUNTS CONNECTOR]: queryString = {0}", reqString); 293 //m_log.DebugFormat("[ACCOUNTS CONNECTOR]: queryString = {0}", reqString);
264 try 294 try
265 { 295 {
266 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 296 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
@@ -269,6 +299,7 @@ namespace OpenSim.Services.Connectors
269 m_Auth); 299 m_Auth);
270 if (reply != string.Empty) 300 if (reply != string.Empty)
271 { 301 {
302 //m_log.DebugFormat("[ACCOUNTS CONNECTOR]: reply = {0}", reply);
272 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 303 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
273 304
274 if (replyData.ContainsKey("result")) 305 if (replyData.ContainsKey("result"))