aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Communications/Local
diff options
context:
space:
mode:
authorMW2007-08-14 13:54:46 +0000
committerMW2007-08-14 13:54:46 +0000
commita228b5984e6523456871f2f8e51aa086050acbf2 (patch)
treeb79888d4aa588c08fbb78bfcc78df3f47d7b5bea /OpenSim/Region/Communications/Local
parentDisabled ScriptEngine until I add error handling tomorrow (diff)
downloadopensim-SC_OLD-a228b5984e6523456871f2f8e51aa086050acbf2.zip
opensim-SC_OLD-a228b5984e6523456871f2f8e51aa086050acbf2.tar.gz
opensim-SC_OLD-a228b5984e6523456871f2f8e51aa086050acbf2.tar.bz2
opensim-SC_OLD-a228b5984e6523456871f2f8e51aa086050acbf2.tar.xz
Start of Inventory service, currently only (partially) functional in standalone mode and using sqlite).
In standalone mode, if you have account authenticate turned on (setting in opensim.ini) then when you create a new account, a set of inventory is created for that account and stored in database (currently only a set of empty folders). Then during login the database is search for that set and sent to the client in the login response. More functions will be added soon, like creating new folders (and a bit later items) from the client inventory window.
Diffstat (limited to 'OpenSim/Region/Communications/Local')
-rw-r--r--OpenSim/Region/Communications/Local/CommunicationsLocal.cs17
-rw-r--r--OpenSim/Region/Communications/Local/LocalInventoryService.cs51
-rw-r--r--OpenSim/Region/Communications/Local/LocalLoginService.cs49
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;
32using OpenSim.Framework.Communications.Caches; 32using OpenSim.Framework.Communications.Caches;
33using OpenSim.Framework.Console; 33using OpenSim.Framework.Console;
34using OpenSim.Framework.Utilities; 34using OpenSim.Framework.Utilities;
35using OpenSim.Framework.Data;
35 36
36namespace OpenSim.Region.Communications.Local 37namespace 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 @@
1using System;
2using System.Collections.Generic;
3using libsecondlife;
4using OpenSim.Framework.Communications;
5using OpenSim.Framework.Data;
6using OpenSim.Framework.Types;
7using OpenSim.Framework.UserManagement;
8using OpenSim.Framework.Utilities;
9using OpenSim.Framework.InventoryServiceBase;
10using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder;
11
12namespace 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 @@
1using System; 1using System;
2using System.Collections;
3using System.Collections.Generic;
2using libsecondlife; 4using libsecondlife;
3using OpenSim.Framework.Communications; 5using OpenSim.Framework.Communications;
4using OpenSim.Framework.Data; 6using OpenSim.Framework.Data;
5using OpenSim.Framework.Types; 7using OpenSim.Framework.Types;
6using OpenSim.Framework.UserManagement; 8using OpenSim.Framework.UserManagement;
7using OpenSim.Framework.Utilities; 9using OpenSim.Framework.Utilities;
10using OpenSim.Framework.Inventory;
8 11
9namespace OpenSim.Region.Communications.Local 12namespace 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}