diff options
Diffstat (limited to 'OpenSim/Region/Communications')
3 files changed, 116 insertions, 1 deletions
diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs index 3ad33f4..e2a953c 100644 --- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs +++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs | |||
@@ -32,23 +32,32 @@ using OpenSim.Framework.Servers; | |||
32 | using OpenSim.Framework.Communications.Caches; | 32 | using OpenSim.Framework.Communications.Caches; |
33 | using OpenSim.Framework.Console; | 33 | using OpenSim.Framework.Console; |
34 | using OpenSim.Framework.Utilities; | 34 | using OpenSim.Framework.Utilities; |
35 | using OpenSim.Framework.Data; | ||
35 | 36 | ||
36 | namespace OpenSim.Region.Communications.Local | 37 | namespace OpenSim.Region.Communications.Local |
37 | { | 38 | { |
38 | public class CommunicationsLocal : CommunicationsManager | 39 | public class CommunicationsLocal : CommunicationsManager |
39 | { | 40 | { |
40 | public LocalBackEndServices InstanceServices = new LocalBackEndServices(); | 41 | public LocalBackEndServices InstanceServices; |
41 | public LocalUserServices UserServices; | 42 | public LocalUserServices UserServices; |
42 | public LocalLoginService LoginServices; | 43 | public LocalLoginService LoginServices; |
44 | public LocalInventoryService InvenServices; | ||
43 | 45 | ||
44 | public CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, bool accountsAuthenticate, string welcomeMessage ) | 46 | public CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, bool accountsAuthenticate, string welcomeMessage ) |
45 | : base(serversInfo, httpServer, assetCache) | 47 | : base(serversInfo, httpServer, assetCache) |
46 | { | 48 | { |
49 | InvenServices = new LocalInventoryService(); | ||
50 | InvenServices.AddPlugin("OpenSim.Framework.Data.SQLite.dll"); | ||
51 | InventoryServer = InvenServices; | ||
52 | |||
47 | UserServices = new LocalUserServices(this, serversInfo); | 53 | UserServices = new LocalUserServices(this, serversInfo); |
48 | UserServices.AddPlugin("OpenSim.Framework.Data.DB4o.dll"); | 54 | UserServices.AddPlugin("OpenSim.Framework.Data.DB4o.dll"); |
49 | UserServer = UserServices; | 55 | UserServer = UserServices; |
56 | |||
57 | InstanceServices = new LocalBackEndServices(); | ||
50 | GridServer = InstanceServices; | 58 | GridServer = InstanceServices; |
51 | InterRegion = InstanceServices; | 59 | InterRegion = InstanceServices; |
60 | |||
52 | LoginServices = new LocalLoginService(UserServices, welcomeMessage, this, serversInfo, accountsAuthenticate); | 61 | LoginServices = new LocalLoginService(UserServices, welcomeMessage, this, serversInfo, accountsAuthenticate); |
53 | httpServer.AddXmlRPCHandler("login_to_simulator", LoginServices.XmlRpcLoginMethod); | 62 | httpServer.AddXmlRPCHandler("login_to_simulator", LoginServices.XmlRpcLoginMethod); |
54 | } | 63 | } |
@@ -78,6 +87,12 @@ namespace OpenSim.Region.Communications.Local | |||
78 | tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); | 87 | tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); |
79 | 88 | ||
80 | this.UserServices.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); | 89 | this.UserServices.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); |
90 | UserProfileData userProf = this.UserServer.GetUserProfile(tempfirstname, templastname); | ||
91 | if (userProf != null) | ||
92 | { | ||
93 | this.InvenServices.CreateNewUserInventory(userProf.UUID); | ||
94 | Console.WriteLine("created new inventory set for " + tempfirstname + " " + templastname); | ||
95 | } | ||
81 | break; | 96 | break; |
82 | } | 97 | } |
83 | } | 98 | } |
diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs new file mode 100644 index 0000000..35c2c8c --- /dev/null +++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs | |||
@@ -0,0 +1,51 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using libsecondlife; | ||
4 | using OpenSim.Framework.Communications; | ||
5 | using OpenSim.Framework.Data; | ||
6 | using OpenSim.Framework.Types; | ||
7 | using OpenSim.Framework.UserManagement; | ||
8 | using OpenSim.Framework.Utilities; | ||
9 | using OpenSim.Framework.InventoryServiceBase; | ||
10 | using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder; | ||
11 | |||
12 | namespace OpenSim.Region.Communications.Local | ||
13 | { | ||
14 | public class LocalInventoryService : InventoryServiceBase , IInventoryServices | ||
15 | { | ||
16 | |||
17 | public LocalInventoryService() | ||
18 | { | ||
19 | |||
20 | } | ||
21 | |||
22 | public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack) | ||
23 | { | ||
24 | List<InventoryFolderBase> folders = this.RequestFirstLevelFolders(userID); | ||
25 | InventoryFolder rootFolder = null; | ||
26 | |||
27 | //need to make sure we send root folder first | ||
28 | foreach (InventoryFolderBase folder in folders) | ||
29 | { | ||
30 | if (folder.parentID == libsecondlife.LLUUID.Zero) | ||
31 | { | ||
32 | InventoryFolder newfolder = new InventoryFolder(folder); | ||
33 | rootFolder = newfolder; | ||
34 | folderCallBack(userID, newfolder); | ||
35 | } | ||
36 | } | ||
37 | |||
38 | if (rootFolder != null) | ||
39 | { | ||
40 | foreach (InventoryFolderBase folder in folders) | ||
41 | { | ||
42 | if (folder.folderID != rootFolder.folderID) | ||
43 | { | ||
44 | InventoryFolder newfolder = new InventoryFolder(folder); | ||
45 | folderCallBack(userID, newfolder); | ||
46 | } | ||
47 | } | ||
48 | } | ||
49 | } | ||
50 | } | ||
51 | } | ||
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs index 19a1e8c..661fbbe 100644 --- a/OpenSim/Region/Communications/Local/LocalLoginService.cs +++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs | |||
@@ -1,10 +1,13 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections; | ||
3 | using System.Collections.Generic; | ||
2 | using libsecondlife; | 4 | using libsecondlife; |
3 | using OpenSim.Framework.Communications; | 5 | using OpenSim.Framework.Communications; |
4 | using OpenSim.Framework.Data; | 6 | using OpenSim.Framework.Data; |
5 | using OpenSim.Framework.Types; | 7 | using OpenSim.Framework.Types; |
6 | using OpenSim.Framework.UserManagement; | 8 | using OpenSim.Framework.UserManagement; |
7 | using OpenSim.Framework.Utilities; | 9 | using OpenSim.Framework.Utilities; |
10 | using OpenSim.Framework.Inventory; | ||
8 | 11 | ||
9 | namespace OpenSim.Region.Communications.Local | 12 | namespace OpenSim.Region.Communications.Local |
10 | { | 13 | { |
@@ -109,5 +112,51 @@ namespace OpenSim.Region.Communications.Local | |||
109 | } | 112 | } |
110 | 113 | ||
111 | } | 114 | } |
115 | |||
116 | protected override InventoryData CreateInventoryData(LLUUID userID) | ||
117 | { | ||
118 | List<InventoryFolderBase> folders = this.m_Parent.InvenServices.RequestFirstLevelFolders(userID); | ||
119 | if (folders.Count > 0) | ||
120 | { | ||
121 | LLUUID rootID = LLUUID.Zero; | ||
122 | ArrayList AgentInventoryArray = new ArrayList(); | ||
123 | Hashtable TempHash; | ||
124 | foreach (InventoryFolderBase InvFolder in folders) | ||
125 | { | ||
126 | if (InvFolder.parentID == LLUUID.Zero) | ||
127 | { | ||
128 | rootID = InvFolder.folderID; | ||
129 | } | ||
130 | TempHash = new Hashtable(); | ||
131 | TempHash["name"] = InvFolder.name; | ||
132 | TempHash["parent_id"] = InvFolder.parentID.ToStringHyphenated(); | ||
133 | TempHash["version"] = (Int32)InvFolder.version; | ||
134 | TempHash["type_default"] = (Int32)InvFolder.type; | ||
135 | TempHash["folder_id"] = InvFolder.folderID.ToStringHyphenated(); | ||
136 | AgentInventoryArray.Add(TempHash); | ||
137 | } | ||
138 | return new InventoryData(AgentInventoryArray, rootID); | ||
139 | } | ||
140 | else | ||
141 | { | ||
142 | AgentInventory userInventory = new AgentInventory(); | ||
143 | userInventory.CreateRootFolder(userID, false); | ||
144 | |||
145 | ArrayList AgentInventoryArray = new ArrayList(); | ||
146 | Hashtable TempHash; | ||
147 | foreach (OpenSim.Framework.Inventory.InventoryFolder InvFolder in userInventory.InventoryFolders.Values) | ||
148 | { | ||
149 | TempHash = new Hashtable(); | ||
150 | TempHash["name"] = InvFolder.FolderName; | ||
151 | TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); | ||
152 | TempHash["version"] = (Int32)InvFolder.Version; | ||
153 | TempHash["type_default"] = (Int32)InvFolder.DefaultType; | ||
154 | TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); | ||
155 | AgentInventoryArray.Add(TempHash); | ||
156 | } | ||
157 | |||
158 | return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID); | ||
159 | } | ||
160 | } | ||
112 | } | 161 | } |
113 | } | 162 | } |