aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Communications/Local/LocalInventoryService.cs
blob: 35c2c8cf01b76b6103a1861776edbb1999d798c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Collections.Generic;
using libsecondlife;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Data;
using OpenSim.Framework.Types;
using OpenSim.Framework.UserManagement;
using OpenSim.Framework.Utilities;
using OpenSim.Framework.InventoryServiceBase;
using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder;

namespace OpenSim.Region.Communications.Local
{
    public class LocalInventoryService : InventoryServiceBase , IInventoryServices
    {

        public LocalInventoryService()
        {

        }

        public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack)
        {
            List<InventoryFolderBase> folders = this.RequestFirstLevelFolders(userID);
            InventoryFolder rootFolder = null;

            //need to make sure we send root folder first
            foreach (InventoryFolderBase folder in folders)
            {
                if (folder.parentID == libsecondlife.LLUUID.Zero)
                {
                    InventoryFolder newfolder = new InventoryFolder(folder);
                    rootFolder = newfolder;
                    folderCallBack(userID, newfolder);
                }
            }

            if (rootFolder != null)
            {
                foreach (InventoryFolderBase folder in folders)
                {
                    if (folder.folderID != rootFolder.folderID)
                    {
                        InventoryFolder newfolder = new InventoryFolder(folder);
                        folderCallBack(userID, newfolder);
                    }
                }
            }
        }
    }
}