UserProfileCacheService.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSim Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using System.Collections.Generic;
  29. using System.Reflection;
  30. using System.Threading;
  31. using libsecondlife;
  32. using log4net;
  33. namespace OpenSim.Framework.Communications.Cache
  34. {
  35. internal delegate void CreateInventoryFolderDelegate(
  36. IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID);
  37. internal delegate void MoveInventoryFolderDelegate(IClientAPI remoteClient, LLUUID folderID, LLUUID parentID);
  38. internal delegate void PurgeInventoryDescendentsDelegate(IClientAPI remoteClient, LLUUID folderID);
  39. internal delegate void UpdateInventoryFolderDelegate(
  40. IClientAPI remoteClient, LLUUID folderID, ushort type, string name, LLUUID parentID);
  41. /// <summary>
  42. /// Holds user profile information and retrieves it from backend services.
  43. /// </summary>
  44. public class UserProfileCacheService
  45. {
  46. private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  47. /// <summary>
  48. /// The comms manager holds references to services (user, grid, inventory, etc.)
  49. /// </summary>
  50. private readonly CommunicationsManager m_commsManager;
  51. /// <summary>
  52. /// Each user has a cached profile.
  53. /// </summary>
  54. private readonly Dictionary<LLUUID, CachedUserInfo> m_userProfiles = new Dictionary<LLUUID, CachedUserInfo>();
  55. public readonly LibraryRootFolder libraryRoot = new LibraryRootFolder();
  56. // Methods
  57. public UserProfileCacheService(CommunicationsManager commsManager)
  58. {
  59. m_commsManager = commsManager;
  60. }
  61. /// <summary>
  62. /// A new user has moved into a region in this instance so retrieve their profile from the user service.
  63. /// </summary>
  64. /// <param name="userID"></param>
  65. public void AddNewUser(LLUUID userID)
  66. {
  67. // Potential fix - Multithreading issue.
  68. lock (m_userProfiles)
  69. {
  70. if (!m_userProfiles.ContainsKey(userID))
  71. {
  72. UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(userID);
  73. CachedUserInfo userInfo = new CachedUserInfo(m_commsManager, userProfile);
  74. if (userInfo.UserProfile != null)
  75. {
  76. // The inventory for the user will be populated when they actually enter the scene
  77. m_userProfiles.Add(userID, userInfo);
  78. }
  79. else
  80. {
  81. m_log.ErrorFormat("[USER CACHE]: User profile for user {0} not found.", userID);
  82. }
  83. }
  84. }
  85. }
  86. /// <summary>
  87. /// Remove this user's profile cache.
  88. /// </summary>
  89. /// <param name="userID"></param>
  90. /// <returns>true if the user was successfully removed, false otherwise</returns>
  91. public bool RemoveUser(LLUUID userID)
  92. {
  93. lock (m_userProfiles)
  94. {
  95. if (m_userProfiles.ContainsKey(userID))
  96. {
  97. m_userProfiles.Remove(userID);
  98. return true;
  99. }
  100. else
  101. {
  102. m_log.WarnFormat("[USER CACHE]: Tried to remove the profile of user {0}, but this was not in the scene", userID);
  103. }
  104. }
  105. return false;
  106. }
  107. /// <summary>
  108. /// Request the inventory data for the given user. This will occur asynchronously if running on a grid
  109. /// </summary>
  110. /// <param name="userID"></param>
  111. /// <param name="userInfo"></param>
  112. public void RequestInventoryForUser(LLUUID userID)
  113. {
  114. CachedUserInfo userInfo = GetUserDetails(userID);
  115. if (userInfo != null)
  116. {
  117. m_commsManager.InventoryService.RequestInventoryForUser(userID, userInfo.InventoryReceive);
  118. }
  119. else
  120. {
  121. m_log.ErrorFormat("[USER CACHE]: RequestInventoryForUser() - user profile for user {0} not found", userID);
  122. }
  123. }
  124. /// <summary>
  125. /// Get the details of the given user.
  126. /// </summary>
  127. /// <param name="userID"></param>
  128. /// <returns>null if no user details are found</returns>
  129. public CachedUserInfo GetUserDetails(LLUUID userID)
  130. {
  131. if (m_userProfiles.ContainsKey(userID))
  132. return m_userProfiles[userID];
  133. else
  134. return null;
  135. }
  136. /// <summary>
  137. /// Handle an inventory folder creation request from the client.
  138. /// </summary>
  139. /// <param name="remoteClient"></param>
  140. /// <param name="folderID"></param>
  141. /// <param name="folderType"></param>
  142. /// <param name="folderName"></param>
  143. /// <param name="parentID"></param>
  144. public void HandleCreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType,
  145. string folderName, LLUUID parentID)
  146. {
  147. // m_log.DebugFormat(
  148. // "[AGENT INVENTORY]: Creating inventory folder {0} {1} for {2} {3}", folderID, folderName, remoteClient.Name, remoteClient.AgentId);
  149. CachedUserInfo userProfile;
  150. if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
  151. {
  152. if (userProfile.HasInventory)
  153. {
  154. if (userProfile.RootFolder.ID == parentID)
  155. {
  156. InventoryFolderImpl createdFolder =
  157. userProfile.RootFolder.CreateNewSubFolder(folderID, folderName, folderType);
  158. if (createdFolder != null)
  159. {
  160. InventoryFolderBase createdBaseFolder = new InventoryFolderBase();
  161. createdBaseFolder.Owner = createdFolder.Owner;
  162. createdBaseFolder.ID = createdFolder.ID;
  163. createdBaseFolder.Name = createdFolder.Name;
  164. createdBaseFolder.ParentID = createdFolder.ParentID;
  165. createdBaseFolder.Type = createdFolder.Type;
  166. createdBaseFolder.Version = createdFolder.Version;
  167. m_commsManager.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdBaseFolder);
  168. }
  169. else
  170. {
  171. m_log.WarnFormat(
  172. "[INVENTORY CACHE]: Tried to create folder {0} {1} for user {2} {3} but the folder already exists",
  173. folderName, folderID, remoteClient.Name, remoteClient.AgentId);
  174. }
  175. }
  176. else
  177. {
  178. InventoryFolderImpl folder = userProfile.RootFolder.GetDescendentFolder(parentID);
  179. if (folder != null)
  180. {
  181. InventoryFolderImpl createdFolder = folder.CreateNewSubFolder(folderID, folderName, folderType);
  182. if (createdFolder != null)
  183. {
  184. InventoryFolderBase createdBaseFolder = new InventoryFolderBase();
  185. createdBaseFolder.Owner = createdFolder.Owner;
  186. createdBaseFolder.ID = createdFolder.ID;
  187. createdBaseFolder.Name = createdFolder.Name;
  188. createdBaseFolder.ParentID = createdFolder.ParentID;
  189. createdBaseFolder.Type = createdFolder.Type;
  190. createdBaseFolder.Version = createdFolder.Version;
  191. m_commsManager.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdBaseFolder);
  192. }
  193. else
  194. {
  195. m_log.WarnFormat(
  196. "[INVENTORY CACHE]: Tried to create folder {0} {1} for user {2} {3} but the folder already exists",
  197. folderName, folderID, remoteClient.Name, remoteClient.AgentId);
  198. }
  199. }
  200. else
  201. {
  202. m_log.WarnFormat(
  203. "[INVENTORY CACHE]: Could not find parent folder with id {0} in order to create folder {1} {2} for user {3} {4}",
  204. parentID, folderName, folderID, remoteClient.Name, remoteClient.AgentId);
  205. }
  206. }
  207. }
  208. else
  209. {
  210. userProfile.AddRequest(
  211. new InventoryRequest(
  212. Delegate.CreateDelegate(typeof(CreateInventoryFolderDelegate), this, "HandleCreateInventoryFolder"),
  213. new object[] { remoteClient, folderID, folderType, folderName, parentID }));
  214. }
  215. }
  216. }
  217. /// <summary>
  218. /// Handle a client request to update the inventory folder
  219. ///
  220. /// FIXME: We call add new inventory folder because in the data layer, we happen to use an SQL REPLACE
  221. /// so this will work to rename an existing folder. Needless to say, to rely on this is very confusing,
  222. /// and needs to be changed.
  223. /// </summary>
  224. /// <param name="remoteClient"></param>
  225. /// <param name="folderID"></param>
  226. /// <param name="type"></param>
  227. /// <param name="name"></param>
  228. /// <param name="parentID"></param>
  229. public void HandleUpdateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort type, string name,
  230. LLUUID parentID)
  231. {
  232. // m_log.DebugFormat(
  233. // "[AGENT INVENTORY]: Updating inventory folder {0} {1} for {2} {3}", folderID, name, remoteClient.Name, remoteClient.AgentId);
  234. CachedUserInfo userProfile;
  235. if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
  236. {
  237. if (userProfile.HasInventory)
  238. {
  239. InventoryFolderBase baseFolder = new InventoryFolderBase();
  240. baseFolder.Owner = remoteClient.AgentId;
  241. baseFolder.ID = folderID;
  242. baseFolder.Name = name;
  243. baseFolder.ParentID = parentID;
  244. baseFolder.Type = (short) type;
  245. baseFolder.Version = userProfile.RootFolder.Version;
  246. m_commsManager.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, baseFolder);
  247. }
  248. else
  249. {
  250. userProfile.AddRequest(
  251. new InventoryRequest(
  252. Delegate.CreateDelegate(typeof(UpdateInventoryFolderDelegate), this, "HandleUpdateInventoryFolder"),
  253. new object[] { remoteClient, folderID, type, name, parentID }));
  254. }
  255. }
  256. }
  257. /// <summary>
  258. /// Handle an inventory folder move request from the client.
  259. /// </summary>
  260. /// <param name="remoteClient"></param>
  261. /// <param name="folderID"></param>
  262. /// <param name="parentID"></param>
  263. public void HandleMoveInventoryFolder(IClientAPI remoteClient, LLUUID folderID, LLUUID parentID)
  264. {
  265. // m_log.DebugFormat(
  266. // "[AGENT INVENTORY]: Moving inventory folder {0} into folder {1} for {2} {3}",
  267. // parentID, remoteClient.Name, remoteClient.Name, remoteClient.AgentId);
  268. CachedUserInfo userProfile;
  269. if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
  270. {
  271. if (userProfile.HasInventory)
  272. {
  273. InventoryFolderBase baseFolder = new InventoryFolderBase();
  274. baseFolder.Owner = remoteClient.AgentId;
  275. baseFolder.ID = folderID;
  276. baseFolder.ParentID = parentID;
  277. m_commsManager.InventoryService.MoveInventoryFolder(remoteClient.AgentId, baseFolder);
  278. }
  279. else
  280. {
  281. userProfile.AddRequest(
  282. new InventoryRequest(
  283. Delegate.CreateDelegate(typeof(MoveInventoryFolderDelegate), this, "HandleMoveInventoryFolder"),
  284. new object[] { remoteClient, folderID, parentID }));
  285. }
  286. }
  287. }
  288. /// <summary>
  289. /// Tell the client about the various child items and folders contained in the requested folder.
  290. /// </summary>
  291. /// <param name="remoteClient"></param>
  292. /// <param name="folderID"></param>
  293. /// <param name="ownerID"></param>
  294. /// <param name="fetchFolders"></param>
  295. /// <param name="fetchItems"></param>
  296. /// <param name="sortOrder"></param>
  297. public void HandleFetchInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID,
  298. bool fetchFolders, bool fetchItems, int sortOrder)
  299. {
  300. // XXX We're not handling sortOrder yet!
  301. InventoryFolderImpl fold = null;
  302. if (folderID == libraryRoot.ID)
  303. {
  304. remoteClient.SendInventoryFolderDetails(
  305. libraryRoot.Owner, libraryRoot.ID, libraryRoot.RequestListOfItems(),
  306. libraryRoot.RequestListOfFolders(), fetchFolders, fetchItems);
  307. return;
  308. }
  309. if ((fold = libraryRoot.GetDescendentFolder(folderID)) != null)
  310. {
  311. remoteClient.SendInventoryFolderDetails(
  312. libraryRoot.Owner, folderID, fold.RequestListOfItems(),
  313. fold.RequestListOfFolders(), fetchFolders, fetchItems);
  314. return;
  315. }
  316. CachedUserInfo userProfile;
  317. if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
  318. {
  319. // XXX: When a client crosses into a scene, their entire inventory is fetched
  320. // asynchronously. However, if the client is logging on and does not have a cached root
  321. // folder, then the root folder request usually comes in *before* the async completes, leading to
  322. // inventory failure.
  323. //
  324. // This is a crude way of dealing with that by retrying the lookup.
  325. if (!userProfile.HasInventory)
  326. {
  327. int attempts = 5;
  328. while (attempts-- > 0)
  329. {
  330. Thread.Sleep(3000);
  331. if (userProfile.HasInventory)
  332. {
  333. break;
  334. }
  335. }
  336. }
  337. if (userProfile.HasInventory)
  338. {
  339. if (userProfile.RootFolder.ID == folderID)
  340. {
  341. // m_log.DebugFormat(
  342. // "[AGENT INVENTORY]: Found root folder {0} for client {1}",
  343. // folderID, remoteClient.AgentId);
  344. remoteClient.SendInventoryFolderDetails(
  345. remoteClient.AgentId, folderID, userProfile.RootFolder.RequestListOfItems(),
  346. userProfile.RootFolder.RequestListOfFolders(),
  347. fetchFolders, fetchItems);
  348. return;
  349. }
  350. else
  351. {
  352. if ((fold = userProfile.RootFolder.GetDescendentFolder(folderID)) != null)
  353. {
  354. // m_log.DebugFormat(
  355. // "[AGENT INVENTORY]: Found folder {0} for client {1}",
  356. // folderID, remoteClient.AgentId);
  357. remoteClient.SendInventoryFolderDetails(
  358. remoteClient.AgentId, folderID, fold.RequestListOfItems(),
  359. fold.RequestListOfFolders(), fetchFolders, fetchItems);
  360. return;
  361. }
  362. }
  363. }
  364. else
  365. {
  366. m_log.ErrorFormat("[INVENTORY CACHE]: Could not find root folder for user {0}", remoteClient.Name);
  367. return;
  368. }
  369. }
  370. else
  371. {
  372. m_log.ErrorFormat(
  373. "[USER CACHE]: HandleFetchInventoryDescendents() could not find user profile {0}, {1}",
  374. remoteClient.Name, remoteClient.AgentId);
  375. return;
  376. }
  377. // If we've reached this point then we couldn't find the folder, even though the client thinks
  378. // it exists
  379. m_log.ErrorFormat("[INVENTORY CACHE]: Could not find folder {0} for user {1}",
  380. folderID, remoteClient.Name);
  381. }
  382. /// <summary>
  383. /// Handle the caps inventory descendents fetch.
  384. ///
  385. /// Since the folder structure is sent to the client on login, I believe we only need to handle items.
  386. /// </summary>
  387. /// <param name="agentID"></param>
  388. /// <param name="folderID"></param>
  389. /// <param name="ownerID"></param>
  390. /// <param name="fetchFolders"></param>
  391. /// <param name="fetchItems"></param>
  392. /// <param name="sortOrder"></param>
  393. /// <returns>null if the inventory look up failed</returns>
  394. public List<InventoryItemBase> HandleFetchInventoryDescendentsCAPS(LLUUID agentID, LLUUID folderID, LLUUID ownerID,
  395. bool fetchFolders, bool fetchItems, int sortOrder)
  396. {
  397. //m_log.DebugFormat("[INVENTORY CACHE]: Fetching folders/items from {0} for agent {1}", folderID, agentID);
  398. // XXX We're not handling sortOrder yet!
  399. InventoryFolderImpl fold = null;
  400. if (folderID == libraryRoot.ID)
  401. {
  402. return libraryRoot.RequestListOfItems();
  403. }
  404. if ((fold = libraryRoot.GetDescendentFolder(folderID)) != null)
  405. {
  406. return fold.RequestListOfItems();
  407. }
  408. CachedUserInfo userProfile;
  409. if (m_userProfiles.TryGetValue(agentID, out userProfile))
  410. {
  411. // XXX: When a client crosses into a scene, their entire inventory is fetched
  412. // asynchronously. If the client makes a request before the inventory is received, we need
  413. // to give the inventory a chance to come in.
  414. //
  415. // This is a crude way of dealing with that by retrying the lookup. It's not quite as bad
  416. // in CAPS as doing this with the udp request, since here it won't hold up other packets.
  417. // In fact, here we'll be generous and try for longer.
  418. if (!userProfile.HasInventory)
  419. {
  420. int attempts = 0;
  421. while (attempts++ < 20)
  422. {
  423. m_log.DebugFormat(
  424. "[INVENTORY CACHE]: Poll number {0} for inventory items in folder {1} for user {2}",
  425. attempts, folderID, agentID);
  426. Thread.Sleep(3000);
  427. if (userProfile.HasInventory)
  428. {
  429. break;
  430. }
  431. }
  432. }
  433. if (userProfile.HasInventory)
  434. {
  435. if (userProfile.RootFolder.ID == folderID)
  436. {
  437. return userProfile.RootFolder.RequestListOfItems();
  438. }
  439. else
  440. {
  441. if ((fold = userProfile.RootFolder.GetDescendentFolder(folderID)) != null)
  442. {
  443. return fold.RequestListOfItems();
  444. }
  445. }
  446. }
  447. else
  448. {
  449. m_log.ErrorFormat("[INVENTORY CACHE]: Could not find root folder for user {0}", agentID.ToString());
  450. return null;
  451. }
  452. }
  453. else
  454. {
  455. m_log.ErrorFormat(
  456. "[USER CACHE]: HandleFetchInventoryDescendentsCAPS() Could not find user profile for {0}",
  457. agentID);
  458. return null;
  459. }
  460. // If we've reached this point then we couldn't find the folder, even though the client thinks
  461. // it exists
  462. m_log.ErrorFormat("[INVENTORY CACHE]: " +
  463. "Could not find folder {0} for user {1}",
  464. folderID, agentID.ToString());
  465. return new List<InventoryItemBase>();
  466. }
  467. /// <summary>
  468. /// This should delete all the items and folders in the given directory.
  469. /// </summary>
  470. /// <param name="remoteClient"></param>
  471. /// <param name="folderID"></param>
  472. public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, LLUUID folderID)
  473. {
  474. // m_log.InfoFormat("[AGENT INVENTORY]: Purging folder {0} for {1} uuid {2}",
  475. // folderID, remoteClient.Name, remoteClient.AgentId);
  476. CachedUserInfo userProfile;
  477. if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
  478. {
  479. if (userProfile.HasInventory)
  480. {
  481. InventoryFolderImpl purgedFolder = userProfile.RootFolder.GetDescendentFolder(folderID);
  482. if (purgedFolder != null)
  483. {
  484. // XXX Nasty - have to create a new object to hold details we already have
  485. InventoryFolderBase purgedBaseFolder = new InventoryFolderBase();
  486. purgedBaseFolder.Owner = purgedFolder.Owner;
  487. purgedBaseFolder.ID = purgedFolder.ID;
  488. purgedBaseFolder.Name = purgedFolder.Name;
  489. purgedBaseFolder.ParentID = purgedFolder.ParentID;
  490. purgedBaseFolder.Type = purgedFolder.Type;
  491. purgedBaseFolder.Version = purgedFolder.Version;
  492. m_commsManager.InventoryService.PurgeInventoryFolder(remoteClient.AgentId, purgedBaseFolder);
  493. purgedFolder.Purge();
  494. }
  495. }
  496. else
  497. {
  498. userProfile.AddRequest(
  499. new InventoryRequest(
  500. Delegate.CreateDelegate(typeof(PurgeInventoryDescendentsDelegate), this, "HandlePurgeInventoryDescendents"),
  501. new object[] { remoteClient, folderID }));
  502. }
  503. }
  504. }
  505. public void HandleFetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID)
  506. {
  507. if (ownerID == libraryRoot.Owner)
  508. {
  509. //Console.WriteLine("request info for library item");
  510. return;
  511. }
  512. CachedUserInfo userProfile;
  513. if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
  514. {
  515. if (userProfile.HasInventory)
  516. {
  517. InventoryItemBase item = userProfile.RootFolder.HasItem(itemID);
  518. if (item != null)
  519. {
  520. remoteClient.SendInventoryItemDetails(ownerID, item);
  521. }
  522. }
  523. }
  524. }
  525. }
  526. }