aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim.Framework/AgentInventory.cs59
-rw-r--r--OpenSim.Framework/IUserServer.cs1
-rw-r--r--OpenSim.Framework/UserProfile.cs1
-rw-r--r--OpenSim.Framework/UserProfileManager.cs12
-rw-r--r--OpenSim.Framework/UserProfileManagerBase.cs6
-rw-r--r--OpenSim.RegionServer/AgentAssetUpload.cs1
-rw-r--r--OpenSim.RegionServer/Assets/InventoryCache.cs27
-rw-r--r--OpenSim.RegionServer/CAPS/AdminWebFront.cs33
-rw-r--r--OpenSim.RegionServer/Grid.cs1
-rw-r--r--OpenSim.RegionServer/OpenSim.RegionServer.dll.build1
-rw-r--r--OpenSim.RegionServer/OpenSimMain.cs22
-rw-r--r--OpenSim.RegionServer/SimClient.cs48
-rw-r--r--OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs14
-rw-r--r--OpenSim.RegionServer/UserServer/LoginServer.cs17
-rw-r--r--OpenSim/RegionServer.cs6
15 files changed, 216 insertions, 33 deletions
diff --git a/OpenSim.Framework/AgentInventory.cs b/OpenSim.Framework/AgentInventory.cs
index 8ab2f3a..1abf59a 100644
--- a/OpenSim.Framework/AgentInventory.cs
+++ b/OpenSim.Framework/AgentInventory.cs
@@ -11,7 +11,7 @@ namespace OpenSim.Framework.Inventory
11 //Holds the local copy of Inventory info for a agent 11 //Holds the local copy of Inventory info for a agent
12 public Dictionary<LLUUID, InventoryFolder> InventoryFolders; 12 public Dictionary<LLUUID, InventoryFolder> InventoryFolders;
13 public Dictionary<LLUUID, InventoryItem> InventoryItems; 13 public Dictionary<LLUUID, InventoryItem> InventoryItems;
14 public InventoryFolder InventoryRoot; 14 public InventoryFolder InventoryRoot = new InventoryFolder();
15 public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server 15 public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server
16 public LLUUID AgentID; 16 public LLUUID AgentID;
17 public AvatarWearable[] Wearables; 17 public AvatarWearable[] Wearables;
@@ -30,14 +30,16 @@ namespace OpenSim.Framework.Inventory
30 { 30 {
31 Wearables[i] = new AvatarWearable(); 31 Wearables[i] = new AvatarWearable();
32 } 32 }
33 33
34 InventoryRoot = new InventoryFolder(); 34 InventoryRoot = new InventoryFolder();
35 InventoryRoot.FolderID = LLUUID.Random(); 35 InventoryRoot.FolderID = LLUUID.Random();
36 InventoryRoot.ParentID = new LLUUID(); 36 InventoryRoot.ParentID = new LLUUID();
37 InventoryRoot.Version = 1; 37 InventoryRoot.Version = 1;
38 InventoryRoot.DefaultType = 8; 38 InventoryRoot.DefaultType = 8;
39 InventoryRoot.OwnerID = this.AgentID;
39 InventoryRoot.FolderName = "My Inventory"; 40 InventoryRoot.FolderName = "My Inventory";
40 InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot); 41 InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot);
42
41 } 43 }
42 44
43 public bool CreateNewFolder(LLUUID folderID, ushort type) 45 public bool CreateNewFolder(LLUUID folderID, ushort type)
@@ -47,10 +49,61 @@ namespace OpenSim.Framework.Inventory
47 Folder.OwnerID = this.AgentID; 49 Folder.OwnerID = this.AgentID;
48 Folder.DefaultType = type; 50 Folder.DefaultType = type;
49 this.InventoryFolders.Add(Folder.FolderID, Folder); 51 this.InventoryFolders.Add(Folder.FolderID, Folder);
52 return (true);
53 }
54
55 public void CreateRootFolder(LLUUID newAgentID, bool createTextures)
56 {
57 this.AgentID = newAgentID;
58 /* InventoryRoot = new InventoryFolder();
59 InventoryRoot.FolderID = LLUUID.Random();
60 InventoryRoot.ParentID = new LLUUID();
61 InventoryRoot.Version = 1;
62 InventoryRoot.DefaultType = 8;
63 InventoryRoot.OwnerID = this.AgentID;
64 InventoryRoot.FolderName = "My Inventory-";
65 InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot);*/
66 InventoryRoot.OwnerID = this.AgentID;
67 if (createTextures)
68 {
69 this.CreateNewFolder(LLUUID.Random(), 0, "Textures", InventoryRoot.FolderID);
70 }
71 }
72
73 public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName)
74 {
75 InventoryFolder Folder = new InventoryFolder();
76 Folder.FolderID = folderID;
77 Folder.OwnerID = this.AgentID;
78 Folder.DefaultType = type;
79 Folder.FolderName = folderName;
80 this.InventoryFolders.Add(Folder.FolderID, Folder);
81
82 return (true);
83 }
84
85 public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parent)
86 {
87 InventoryFolder Folder = new InventoryFolder();
88 Folder.FolderID = folderID;
89 Folder.OwnerID = this.AgentID;
90 Folder.DefaultType = type;
91 Folder.FolderName = folderName;
92 Folder.ParentID = parent;
93 this.InventoryFolders.Add(Folder.FolderID, Folder);
50 94
51 return (true); 95 return (true);
52 } 96 }
53 97
98 public bool HasFolder(LLUUID folderID)
99 {
100 if (this.InventoryFolders.ContainsKey(folderID))
101 {
102 return true;
103 }
104 return false;
105 }
106
54 public bool UpdateItem(LLUUID itemID, AssetBase asset) 107 public bool UpdateItem(LLUUID itemID, AssetBase asset)
55 { 108 {
56 if(this.InventoryItems.ContainsKey(itemID)) 109 if(this.InventoryItems.ContainsKey(itemID))
@@ -96,7 +149,7 @@ namespace OpenSim.Framework.Inventory
96 //public List<InventoryFolder> Subfolders; 149 //public List<InventoryFolder> Subfolders;
97 public LLUUID FolderID; 150 public LLUUID FolderID;
98 public LLUUID OwnerID; 151 public LLUUID OwnerID;
99 public LLUUID ParentID; 152 public LLUUID ParentID = LLUUID.Zero;
100 public string FolderName; 153 public string FolderName;
101 public ushort DefaultType; 154 public ushort DefaultType;
102 public ushort Version; 155 public ushort Version;
diff --git a/OpenSim.Framework/IUserServer.cs b/OpenSim.Framework/IUserServer.cs
index bb2b668..21f2721 100644
--- a/OpenSim.Framework/IUserServer.cs
+++ b/OpenSim.Framework/IUserServer.cs
@@ -10,5 +10,6 @@ namespace OpenSim.Framework.Interfaces
10 { 10 {
11 AgentInventory RequestAgentsInventory(LLUUID agentID); 11 AgentInventory RequestAgentsInventory(LLUUID agentID);
12 void SetServerInfo(string ServerUrl, string SendKey, string RecvKey); 12 void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
13 bool UpdateAgentsInventory(LLUUID agentID, AgentInventory inventory);
13 } 14 }
14} 15}
diff --git a/OpenSim.Framework/UserProfile.cs b/OpenSim.Framework/UserProfile.cs
index 2c264c5..215f7da 100644
--- a/OpenSim.Framework/UserProfile.cs
+++ b/OpenSim.Framework/UserProfile.cs
@@ -32,6 +32,7 @@ namespace OpenSim.Framework.User
32 Circuits = new Dictionary<LLUUID, uint>(); 32 Circuits = new Dictionary<LLUUID, uint>();
33 Inventory = new AgentInventory(); 33 Inventory = new AgentInventory();
34 homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256)); ; 34 homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256)); ;
35
35 } 36 }
36 37
37 public void InitSessionData() 38 public void InitSessionData()
diff --git a/OpenSim.Framework/UserProfileManager.cs b/OpenSim.Framework/UserProfileManager.cs
index f77ca4c..d6304d0 100644
--- a/OpenSim.Framework/UserProfileManager.cs
+++ b/OpenSim.Framework/UserProfileManager.cs
@@ -68,6 +68,7 @@ namespace OpenSim.Framework.User
68 68
69 UserProfile TheUser = GetProfileByName(firstname, lastname); 69 UserProfile TheUser = GetProfileByName(firstname, lastname);
70 70
71 /*
71 if (!((TheUser.CurrentSessionID == null) && (TheUser.CurrentSecureSessionID == null))) 72 if (!((TheUser.CurrentSessionID == null) && (TheUser.CurrentSecureSessionID == null)))
72 { 73 {
73 XmlRpcResponse PresenceErrorResp = new XmlRpcResponse(); 74 XmlRpcResponse PresenceErrorResp = new XmlRpcResponse();
@@ -78,7 +79,7 @@ namespace OpenSim.Framework.User
78 PresenceErrorResp.Value = PresenceErrorRespData; 79 PresenceErrorResp.Value = PresenceErrorRespData;
79 return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(PresenceErrorResp), " encoding=\"utf-16\"", "")); 80 return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(PresenceErrorResp), " encoding=\"utf-16\"", ""));
80 81
81 } 82 }*/
82 83
83 try 84 try
84 { 85 {
@@ -116,6 +117,7 @@ namespace OpenSim.Framework.User
116 ArrayList ClassifiedCategories = new ArrayList(); 117 ArrayList ClassifiedCategories = new ArrayList();
117 ClassifiedCategories.Add(ClassifiedCategoriesHash); 118 ClassifiedCategories.Add(ClassifiedCategoriesHash);
118 119
120 Console.WriteLine("copying inventory data to response");
119 ArrayList AgentInventory = new ArrayList(); 121 ArrayList AgentInventory = new ArrayList();
120 foreach (InventoryFolder InvFolder in TheUser.Inventory.InventoryFolders.Values) 122 foreach (InventoryFolder InvFolder in TheUser.Inventory.InventoryFolders.Values)
121 { 123 {
@@ -142,7 +144,7 @@ namespace OpenSim.Framework.User
142 uint circode = (uint)(Util.RandomClass.Next()); 144 uint circode = (uint)(Util.RandomClass.Next());
143 //TheUser.AddSimCircuit(circode, SimInfo.UUID); 145 //TheUser.AddSimCircuit(circode, SimInfo.UUID);
144 146
145 LoginGoodData["last_name"] = "\"" + TheUser.firstname + "\""; 147 LoginGoodData["last_name"] = "\"" + TheUser.lastname + "\"";
146 LoginGoodData["ui-config"] = ui_config; 148 LoginGoodData["ui-config"] = ui_config;
147 LoginGoodData["sim_ip"] = "127.0.0.1"; //SimInfo.sim_ip.ToString(); 149 LoginGoodData["sim_ip"] = "127.0.0.1"; //SimInfo.sim_ip.ToString();
148 LoginGoodData["login-flags"] = LoginFlags; 150 LoginGoodData["login-flags"] = LoginFlags;
@@ -160,7 +162,7 @@ namespace OpenSim.Framework.User
160 LoginGoodData["start_location"] = "last"; 162 LoginGoodData["start_location"] = "last";
161 LoginGoodData["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + TheUser.homepos.X.ToString() + ",r" + TheUser.homepos.Y.ToString() + ",r" + TheUser.homepos.Z.ToString() + "], 'look_at':[r" + TheUser.homelookat.X.ToString() + ",r" + TheUser.homelookat.Y.ToString() + ",r" + TheUser.homelookat.Z.ToString() + "]}"; 163 LoginGoodData["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + TheUser.homepos.X.ToString() + ",r" + TheUser.homepos.Y.ToString() + ",r" + TheUser.homepos.Z.ToString() + "], 'look_at':[r" + TheUser.homelookat.X.ToString() + ",r" + TheUser.homelookat.Y.ToString() + ",r" + TheUser.homelookat.Z.ToString() + "]}";
162 LoginGoodData["message"] = DefaultStartupMsg; 164 LoginGoodData["message"] = DefaultStartupMsg;
163 LoginGoodData["first_name"] = "\"" + firstname + "\""; 165 LoginGoodData["first_name"] = "\"" + TheUser.firstname + "\"";
164 LoginGoodData["circuit_code"] = (Int32)circode; 166 LoginGoodData["circuit_code"] = (Int32)circode;
165 LoginGoodData["sim_port"] = 9000; //(Int32)SimInfo.sim_port; 167 LoginGoodData["sim_port"] = 9000; //(Int32)SimInfo.sim_port;
166 LoginGoodData["secure_session_id"] = TheUser.CurrentSecureSessionID.ToStringHyphenated(); 168 LoginGoodData["secure_session_id"] = TheUser.CurrentSecureSessionID.ToStringHyphenated();
@@ -196,8 +198,8 @@ namespace OpenSim.Framework.User
196 SimProfile SimInfo = new SimProfile(); 198 SimProfile SimInfo = new SimProfile();
197 //get siminfo from grid server 199 //get siminfo from grid server
198 SimInfo = SimInfo.LoadFromGrid(theUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey); 200 SimInfo = SimInfo.LoadFromGrid(theUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey);
199 uint circode = (uint)response["circuit_code"]; 201 Int32 circode = (Int32)response["circuit_code"];
200 theUser.AddSimCircuit(circode, SimInfo.UUID); 202 theUser.AddSimCircuit((uint)circode, SimInfo.UUID);
201 response["home"] = "{'region_handle':[r" + (SimInfo.RegionLocX * 256).ToString() + ",r" + (SimInfo.RegionLocY * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}"; 203 response["home"] = "{'region_handle':[r" + (SimInfo.RegionLocX * 256).ToString() + ",r" + (SimInfo.RegionLocY * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}";
202 response["sim_ip"] = SimInfo.sim_ip.ToString(); 204 response["sim_ip"] = SimInfo.sim_ip.ToString();
203 response["sim_port"] = (Int32)SimInfo.sim_port; 205 response["sim_port"] = (Int32)SimInfo.sim_port;
diff --git a/OpenSim.Framework/UserProfileManagerBase.cs b/OpenSim.Framework/UserProfileManagerBase.cs
index ad03bc2..218a98c 100644
--- a/OpenSim.Framework/UserProfileManagerBase.cs
+++ b/OpenSim.Framework/UserProfileManagerBase.cs
@@ -41,19 +41,23 @@ namespace OpenSim.Framework.User
41 public virtual bool AuthenticateUser(string firstname, string lastname, string passwd) 41 public virtual bool AuthenticateUser(string firstname, string lastname, string passwd)
42 { 42 {
43 UserProfile TheUser = GetProfileByName(firstname, lastname); 43 UserProfile TheUser = GetProfileByName(firstname, lastname);
44 passwd = passwd.Remove(0, 3); //remove $1$
44 if (TheUser != null) 45 if (TheUser != null)
45 { 46 {
46 if (TheUser.MD5passwd == passwd) 47 if (TheUser.MD5passwd == passwd)
47 { 48 {
49 Console.WriteLine("UserProfile - authorised ");
48 return true; 50 return true;
49 } 51 }
50 else 52 else
51 { 53 {
54 Console.WriteLine("UserProfile - not authorised, password not match "+ TheUser.MD5passwd +" and "+ passwd);
52 return false; 55 return false;
53 } 56 }
54 } 57 }
55 else 58 else
56 { 59 {
60 Console.WriteLine("UserProfile - not authorised , unkown: "+ firstname +" , " + lastname);
57 return false; 61 return false;
58 } 62 }
59 63
@@ -66,12 +70,14 @@ namespace OpenSim.Framework.User
66 70
67 public virtual UserProfile CreateNewProfile(string firstname, string lastname, string MD5passwd) 71 public virtual UserProfile CreateNewProfile(string firstname, string lastname, string MD5passwd)
68 { 72 {
73 Console.WriteLine("creating new profile for : " + firstname + " , " + lastname);
69 UserProfile newprofile = new UserProfile(); 74 UserProfile newprofile = new UserProfile();
70 newprofile.homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256)); 75 newprofile.homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256));
71 newprofile.firstname = firstname; 76 newprofile.firstname = firstname;
72 newprofile.lastname = lastname; 77 newprofile.lastname = lastname;
73 newprofile.MD5passwd = MD5passwd; 78 newprofile.MD5passwd = MD5passwd;
74 newprofile.UUID = LLUUID.Random(); 79 newprofile.UUID = LLUUID.Random();
80 newprofile.Inventory.CreateRootFolder(newprofile.UUID, true);
75 this.UserProfiles.Add(newprofile.UUID, newprofile); 81 this.UserProfiles.Add(newprofile.UUID, newprofile);
76 return newprofile; 82 return newprofile;
77 } 83 }
diff --git a/OpenSim.RegionServer/AgentAssetUpload.cs b/OpenSim.RegionServer/AgentAssetUpload.cs
index 9f85598..d346647 100644
--- a/OpenSim.RegionServer/AgentAssetUpload.cs
+++ b/OpenSim.RegionServer/AgentAssetUpload.cs
@@ -201,6 +201,7 @@ namespace OpenSim
201 { 201 {
202 //already complete so we can add it to the inventory 202 //already complete so we can add it to the inventory
203 m_assetCache.AddAsset(trans.Asset); 203 m_assetCache.AddAsset(trans.Asset);
204 Console.WriteLine("creating inventory item");
204 Console.WriteLine( "ITem created is " +m_inventoryCache.AddNewInventoryItem(this.ourClient, packet.InventoryBlock.FolderID, trans.Asset).ToStringHyphenated()); 205 Console.WriteLine( "ITem created is " +m_inventoryCache.AddNewInventoryItem(this.ourClient, packet.InventoryBlock.FolderID, trans.Asset).ToStringHyphenated());
205 } 206 }
206 else 207 else
diff --git a/OpenSim.RegionServer/Assets/InventoryCache.cs b/OpenSim.RegionServer/Assets/InventoryCache.cs
index 3a4aa36..1090940 100644
--- a/OpenSim.RegionServer/Assets/InventoryCache.cs
+++ b/OpenSim.RegionServer/Assets/InventoryCache.cs
@@ -33,6 +33,7 @@ using libsecondlife.Packets;
33//using OpenSim.GridServers; 33//using OpenSim.GridServers;
34using OpenSim.Framework.Inventory; 34using OpenSim.Framework.Inventory;
35using OpenSim.Framework.Assets; 35using OpenSim.Framework.Assets;
36using OpenSim.Framework.Interfaces;
36 37
37namespace OpenSim.Assets 38namespace OpenSim.Assets
38{ 39{
@@ -54,7 +55,21 @@ namespace OpenSim.Assets
54 55
55 public void AddNewAgentsInventory(AgentInventory agentInventory) 56 public void AddNewAgentsInventory(AgentInventory agentInventory)
56 { 57 {
57 this._agentsInventory.Add(agentInventory.AgentID, agentInventory); 58 if (!this._agentsInventory.ContainsKey(agentInventory.AgentID))
59 {
60 this._agentsInventory.Add(agentInventory.AgentID, agentInventory);
61 }
62 }
63
64 public AgentInventory FetchAgentsInventory(LLUUID agentID, IUserServer userserver)
65 {
66 AgentInventory res = null;
67 if (!this._agentsInventory.ContainsKey(agentID))
68 {
69 res = userserver.RequestAgentsInventory(agentID);
70 this._agentsInventory.Add(agentID,res);
71 }
72 return res;
58 } 73 }
59 74
60 public AgentInventory GetAgentsInventory(LLUUID agentID) 75 public AgentInventory GetAgentsInventory(LLUUID agentID)
@@ -67,13 +82,16 @@ namespace OpenSim.Assets
67 return null; 82 return null;
68 } 83 }
69 84
70 public void ClientLeaving(LLUUID clientID) 85 public void ClientLeaving(LLUUID clientID, IUserServer userserver)
71 { 86 {
72 if (this._agentsInventory.ContainsKey(clientID)) 87 if (this._agentsInventory.ContainsKey(clientID))
73 { 88 {
89 if (userserver != null)
90 {
91 userserver.UpdateAgentsInventory(clientID, this._agentsInventory[clientID]);
92 }
74 this._agentsInventory.Remove(clientID); 93 this._agentsInventory.Remove(clientID);
75 } 94 }
76
77 } 95 }
78 96
79 public bool CreateNewInventoryFolder(SimClient remoteClient, LLUUID folderID) 97 public bool CreateNewInventoryFolder(SimClient remoteClient, LLUUID folderID)
@@ -171,6 +189,7 @@ namespace OpenSim.Assets
171 Descend.ItemData[i].Type = Item.Type; 189 Descend.ItemData[i].Type = Item.Type;
172 Descend.ItemData[i].CRC = libsecondlife.Helpers.InventoryCRC(1000, 0, Descend.ItemData[i].InvType, Descend.ItemData[i].Type, Descend.ItemData[i].AssetID, Descend.ItemData[i].GroupID, 100, Descend.ItemData[i].OwnerID, Descend.ItemData[i].CreatorID, Descend.ItemData[i].ItemID, Descend.ItemData[i].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); 190 Descend.ItemData[i].CRC = libsecondlife.Helpers.InventoryCRC(1000, 0, Descend.ItemData[i].InvType, Descend.ItemData[i].Type, Descend.ItemData[i].AssetID, Descend.ItemData[i].GroupID, 100, Descend.ItemData[i].OwnerID, Descend.ItemData[i].CreatorID, Descend.ItemData[i].ItemID, Descend.ItemData[i].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS);
173 } 191 }
192
174 userInfo.OutPacket(Descend); 193 userInfo.OutPacket(Descend);
175 194
176 } 195 }
diff --git a/OpenSim.RegionServer/CAPS/AdminWebFront.cs b/OpenSim.RegionServer/CAPS/AdminWebFront.cs
index 03f8692..8224050 100644
--- a/OpenSim.RegionServer/CAPS/AdminWebFront.cs
+++ b/OpenSim.RegionServer/CAPS/AdminWebFront.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using System.IO; 4using System.IO;
5using OpenSim.world; 5using OpenSim.world;
6using OpenSim.UserServer;
6 7
7namespace OpenSim.CAPS 8namespace OpenSim.CAPS
8{ 9{
@@ -13,9 +14,11 @@ namespace OpenSim.CAPS
13 private string LoginForm; 14 private string LoginForm;
14 private string passWord = "Admin"; 15 private string passWord = "Admin";
15 private World m_world; 16 private World m_world;
17 private LoginServer _userServer;
16 18
17 public AdminWebFront(string password, World world) 19 public AdminWebFront(string password, World world, LoginServer userserver)
18 { 20 {
21 _userServer = userserver;
19 m_world = world; 22 m_world = world;
20 passWord = password; 23 passWord = password;
21 LoadAdminPage(); 24 LoadAdminPage();
@@ -63,8 +66,12 @@ namespace OpenSim.CAPS
63 case "/Admin/NewAccount": 66 case "/Admin/NewAccount":
64 if (requestMethod == "POST") 67 if (requestMethod == "POST")
65 { 68 {
66 string[] comp = new string[10]; 69 string firstName = "";
67 string[] passw = new string[3]; 70 string secondName = "";
71 string userPasswd = "";
72 string[] comp;
73 string[] passw;
74 string[] line;
68 string delimStr = "&"; 75 string delimStr = "&";
69 char[] delimiter = delimStr.ToCharArray(); 76 char[] delimiter = delimStr.ToCharArray();
70 string delimStr2 = "="; 77 string delimStr2 = "=";
@@ -75,6 +82,26 @@ namespace OpenSim.CAPS
75 passw = comp[3].Split(delimiter2); 82 passw = comp[3].Split(delimiter2);
76 if (passw[1] == passWord) 83 if (passw[1] == passWord)
77 { 84 {
85
86 line = comp[0].Split(delimiter2); //split firstname
87 if (line.Length > 1)
88 {
89 firstName = line[1];
90 }
91 line = comp[1].Split(delimiter2); //split secondname
92 if (line.Length > 1)
93 {
94 secondName = line[1];
95 }
96 line = comp[2].Split(delimiter2); //split user password
97 if (line.Length > 1)
98 {
99 userPasswd = line[1];
100 }
101 if (this._userServer != null)
102 {
103 this._userServer.CreateUserAccount(firstName, secondName, userPasswd);
104 }
78 responseString = "<p> New Account created </p>"; 105 responseString = "<p> New Account created </p>";
79 } 106 }
80 else 107 else
diff --git a/OpenSim.RegionServer/Grid.cs b/OpenSim.RegionServer/Grid.cs
index b0df6a8..db5b8fe 100644
--- a/OpenSim.RegionServer/Grid.cs
+++ b/OpenSim.RegionServer/Grid.cs
@@ -11,6 +11,7 @@ namespace OpenSim
11 { 11 {
12 public IAssetServer AssetServer; 12 public IAssetServer AssetServer;
13 public IGridServer GridServer; 13 public IGridServer GridServer;
14 public IUserServer UserServer;
14 public string AssetDll = ""; 15 public string AssetDll = "";
15 public string GridDll = ""; 16 public string GridDll = "";
16 17
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
index b67db54..ef7dce9 100644
--- a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
+++ b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
@@ -16,7 +16,6 @@
16 <include name="Grid.cs" /> 16 <include name="Grid.cs" />
17 <include name="OpenSimMain.cs" /> 17 <include name="OpenSimMain.cs" />
18 <include name="OpenSimNetworkHandler.cs" /> 18 <include name="OpenSimNetworkHandler.cs" />
19 <include name="OpenSimRoot.cs" />
20 <include name="QueItem.cs" /> 19 <include name="QueItem.cs" />
21 <include name="SimClient.cs" /> 20 <include name="SimClient.cs" />
22 <include name="SimConsole.cs" /> 21 <include name="SimConsole.cs" />
diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs
index ed3e732..07a2d6d 100644
--- a/OpenSim.RegionServer/OpenSimMain.cs
+++ b/OpenSim.RegionServer/OpenSimMain.cs
@@ -75,6 +75,7 @@ namespace OpenSim
75 public string m_physicsEngine; 75 public string m_physicsEngine;
76 public bool m_sandbox = false; 76 public bool m_sandbox = false;
77 public bool m_loginserver; 77 public bool m_loginserver;
78 public bool user_accounts = false;
78 79
79 protected ConsoleBase m_console; 80 protected ConsoleBase m_console;
80 81
@@ -145,12 +146,22 @@ namespace OpenSim
145 146
146 m_console.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server"); 147 m_console.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server");
147 HttpServer = new SimCAPSHTTPServer(GridServers.GridServer, Cfg.IPListenPort); 148 HttpServer = new SimCAPSHTTPServer(GridServers.GridServer, Cfg.IPListenPort);
148 HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin", LocalWorld));
149 149
150 if ( m_loginserver && m_sandbox) 150 LoginServer loginServer = null;
151 if (m_loginserver && m_sandbox)
151 { 152 {
152 LoginServer loginServer = new LoginServer(GridServers.GridServer, Cfg.IPListenAddr, Cfg.IPListenPort); 153 loginServer = new LoginServer(GridServers.GridServer, Cfg.IPListenAddr, Cfg.IPListenPort, this.user_accounts);
153 loginServer.Startup(); 154 loginServer.Startup();
155
156 }
157 if((m_loginserver) && (m_sandbox) && (user_accounts))
158 {
159 this.GridServers.UserServer = loginServer;
160 HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin", LocalWorld, loginServer));
161 }
162 else
163 {
164 HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin", LocalWorld, null));
154 } 165 }
155 166
156 MainServerListener(); 167 MainServerListener();
@@ -210,6 +221,11 @@ namespace OpenSim
210 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet; 221 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet;
211 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); 222 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
212 SimClient newuser = new SimClient(epSender, useCircuit, LocalWorld, ClientThreads, AssetCache, GridServers.GridServer, this, InventoryCache, m_sandbox); 223 SimClient newuser = new SimClient(epSender, useCircuit, LocalWorld, ClientThreads, AssetCache, GridServers.GridServer, this, InventoryCache, m_sandbox);
224 if ((this.GridServers.UserServer != null) && (user_accounts))
225 {
226 Console.WriteLine("setting userserver");
227 newuser.UserServer = this.GridServers.UserServer;
228 }
213 //OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser); 229 //OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser);
214 ClientThreads.Add(useCircuit.CircuitCode.Code, newuser); 230 ClientThreads.Add(useCircuit.CircuitCode.Code, newuser);
215 } 231 }
diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs
index e013b63..6eb48fb 100644
--- a/OpenSim.RegionServer/SimClient.cs
+++ b/OpenSim.RegionServer/SimClient.cs
@@ -75,10 +75,20 @@ namespace OpenSim
75 private Dictionary<uint, SimClient> m_clientThreads; 75 private Dictionary<uint, SimClient> m_clientThreads;
76 private AssetCache m_assetCache; 76 private AssetCache m_assetCache;
77 private IGridServer m_gridServer; 77 private IGridServer m_gridServer;
78 private IUserServer m_userServer = null;
78 private OpenSimNetworkHandler m_application; 79 private OpenSimNetworkHandler m_application;
79 private InventoryCache m_inventoryCache; 80 private InventoryCache m_inventoryCache;
80 private bool m_sandboxMode; 81 private bool m_sandboxMode;
81 82
83
84 public IUserServer UserServer
85 {
86 set
87 {
88 this.m_userServer = value;
89 }
90 }
91
82 private void ack_pack(Packet Pack) 92 private void ack_pack(Packet Pack)
83 { 93 {
84 //libsecondlife.Packets.PacketAckPacket ack_it = new PacketAckPacket(); 94 //libsecondlife.Packets.PacketAckPacket ack_it = new PacketAckPacket();
@@ -241,6 +251,15 @@ namespace OpenSim
241 { 251 {
242 client.OutPacket(kill); 252 client.OutPacket(kill);
243 } 253 }
254 if (this.m_userServer != null)
255 {
256 this.m_inventoryCache.ClientLeaving(this.AgentID, this.m_userServer);
257 }
258 else
259 {
260 this.m_inventoryCache.ClientLeaving(this.AgentID, null);
261 }
262
244 m_gridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode); 263 m_gridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode);
245 lock (m_world.Entities) 264 lock (m_world.Entities)
246 { 265 {
@@ -657,12 +676,16 @@ namespace OpenSim
657 // Create Inventory, currently only works for sandbox mode 676 // Create Inventory, currently only works for sandbox mode
658 if (m_sandboxMode) 677 if (m_sandboxMode)
659 { 678 {
679 AgentInventory inventory = null;
660 if (sessionInfo.LoginInfo.InventoryFolder != null) 680 if (sessionInfo.LoginInfo.InventoryFolder != null)
661 { 681 {
662 this.CreateInventory(sessionInfo.LoginInfo.InventoryFolder); 682 inventory = this.CreateInventory(sessionInfo.LoginInfo.InventoryFolder);
663 if (sessionInfo.LoginInfo.BaseFolder != null) 683 if (sessionInfo.LoginInfo.BaseFolder != null)
664 { 684 {
665 m_inventoryCache.CreateNewInventoryFolder(this, sessionInfo.LoginInfo.BaseFolder); 685 if (!inventory.HasFolder(sessionInfo.LoginInfo.BaseFolder))
686 {
687 m_inventoryCache.CreateNewInventoryFolder(this, sessionInfo.LoginInfo.BaseFolder);
688 }
666 this.newAssetFolder = sessionInfo.LoginInfo.BaseFolder; 689 this.newAssetFolder = sessionInfo.LoginInfo.BaseFolder;
667 AssetBase[] inventorySet = m_assetCache.CreateNewInventorySet(this.AgentID); 690 AssetBase[] inventorySet = m_assetCache.CreateNewInventorySet(this.AgentID);
668 if (inventorySet != null) 691 if (inventorySet != null)
@@ -683,12 +706,23 @@ namespace OpenSim
683 } 706 }
684 } 707 }
685 708
686 private void CreateInventory(LLUUID baseFolder) 709 private AgentInventory CreateInventory(LLUUID baseFolder)
687 { 710 {
688 AgentInventory inventory = new AgentInventory(); 711 AgentInventory inventory = null;
689 inventory.AgentID = this.AgentID; 712 if (this.m_userServer != null)
690 m_inventoryCache.AddNewAgentsInventory(inventory); 713 {
691 m_inventoryCache.CreateNewInventoryFolder(this, baseFolder); 714 // a user server is set so request the inventory from it
715 inventory = m_inventoryCache.FetchAgentsInventory(this.AgentID, m_userServer);
716 }
717 else
718 {
719 inventory = new AgentInventory();
720 inventory.AgentID = this.AgentID;
721 inventory.CreateRootFolder(this.AgentID, false);
722 m_inventoryCache.AddNewAgentsInventory(inventory);
723 m_inventoryCache.CreateNewInventoryFolder(this, baseFolder);
724 }
725 return inventory;
692 } 726 }
693 } 727 }
694} 728}
diff --git a/OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs b/OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs
index eee1c3a..b31feda 100644
--- a/OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs
+++ b/OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs
@@ -30,8 +30,8 @@ namespace OpenSim.UserServer
30 30
31 public override void CustomiseResponse(ref System.Collections.Hashtable response, UserProfile theUser) 31 public override void CustomiseResponse(ref System.Collections.Hashtable response, UserProfile theUser)
32 { 32 {
33 uint circode = (uint)response["circuit_code"]; 33 Int32 circode = (Int32)response["circuit_code"];
34 theUser.AddSimCircuit(circode, LLUUID.Random()); 34 theUser.AddSimCircuit((uint)circode, LLUUID.Random());
35 response["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}"; 35 response["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}";
36 response["sim_port"] = m_port; 36 response["sim_port"] = m_port;
37 response["sim_ip"] = m_ipAddr; 37 response["sim_ip"] = m_ipAddr;
@@ -40,18 +40,18 @@ namespace OpenSim.UserServer
40 40
41 string first; 41 string first;
42 string last; 42 string last;
43 if (response.Contains("first")) 43 if (response.Contains("first_name"))
44 { 44 {
45 first = (string)response["first"]; 45 first = (string)response["first_name"];
46 } 46 }
47 else 47 else
48 { 48 {
49 first = "test"; 49 first = "test";
50 } 50 }
51 51
52 if (response.Contains("last")) 52 if (response.Contains("last_name"))
53 { 53 {
54 last = (string)response["last"]; 54 last = (string)response["last_name"];
55 } 55 }
56 else 56 else
57 { 57 {
@@ -67,12 +67,14 @@ namespace OpenSim.UserServer
67 _login.Last = last; 67 _login.Last = last;
68 _login.Agent = new LLUUID((string)response["agent_id"]) ; 68 _login.Agent = new LLUUID((string)response["agent_id"]) ;
69 _login.Session = new LLUUID((string)response["session_id"]); 69 _login.Session = new LLUUID((string)response["session_id"]);
70 _login.SecureSession = new LLUUID((string)response["secure_session_id"]);
70 _login.BaseFolder = null; 71 _login.BaseFolder = null;
71 _login.InventoryFolder = new LLUUID((string)Inventory1["folder_id"]); 72 _login.InventoryFolder = new LLUUID((string)Inventory1["folder_id"]);
72 73
73 //working on local computer if so lets add to the gridserver's list of sessions? 74 //working on local computer if so lets add to the gridserver's list of sessions?
74 if (m_gridServer.GetName() == "Local") 75 if (m_gridServer.GetName() == "Local")
75 { 76 {
77 Console.WriteLine("adding login data to gridserver");
76 ((LocalGridBase)this.m_gridServer).AddNewSession(_login); 78 ((LocalGridBase)this.m_gridServer).AddNewSession(_login);
77 } 79 }
78 } 80 }
diff --git a/OpenSim.RegionServer/UserServer/LoginServer.cs b/OpenSim.RegionServer/UserServer/LoginServer.cs
index 0bbe0b0..7b4c1f0 100644
--- a/OpenSim.RegionServer/UserServer/LoginServer.cs
+++ b/OpenSim.RegionServer/UserServer/LoginServer.cs
@@ -66,11 +66,12 @@ namespace OpenSim.UserServer
66 private int m_simPort; 66 private int m_simPort;
67 private string m_simAddr; 67 private string m_simAddr;
68 68
69 public LoginServer(IGridServer gridServer, string simAddr, int simPort) 69 public LoginServer(IGridServer gridServer, string simAddr, int simPort , bool useAccounts)
70 { 70 {
71 m_gridServer = gridServer; 71 m_gridServer = gridServer;
72 m_simPort = simPort; 72 m_simPort = simPort;
73 m_simAddr = simAddr; 73 m_simAddr = simAddr;
74 this.userAccounts = useAccounts;
74 } 75 }
75 76
76 // InitializeLogin: initialize the login 77 // InitializeLogin: initialize the login
@@ -395,6 +396,15 @@ namespace OpenSim.UserServer
395 return Regex.Replace(BitConverter.ToString(encodedBytes), "-", "").ToLower(); 396 return Regex.Replace(BitConverter.ToString(encodedBytes), "-", "").ToLower();
396 } 397 }
397 398
399 public bool CreateUserAccount(string firstName, string lastName, string password)
400 {
401 Console.WriteLine("creating new user account");
402 string mdPassword = EncodePassword(password);
403 Console.WriteLine("with password: " + mdPassword);
404 this.userManager.CreateNewProfile(firstName, lastName, mdPassword);
405 return true;
406 }
407
398 //IUserServer implementation 408 //IUserServer implementation
399 public AgentInventory RequestAgentsInventory(LLUUID agentID) 409 public AgentInventory RequestAgentsInventory(LLUUID agentID)
400 { 410 {
@@ -407,6 +417,11 @@ namespace OpenSim.UserServer
407 return aInventory; 417 return aInventory;
408 } 418 }
409 419
420 public bool UpdateAgentsInventory(LLUUID agentID, AgentInventory inventory)
421 {
422 return true;
423 }
424
410 public void SetServerInfo(string ServerUrl, string SendKey, string RecvKey) 425 public void SetServerInfo(string ServerUrl, string SendKey, string RecvKey)
411 { 426 {
412 427
diff --git a/OpenSim/RegionServer.cs b/OpenSim/RegionServer.cs
index 0244116..db70203 100644
--- a/OpenSim/RegionServer.cs
+++ b/OpenSim/RegionServer.cs
@@ -18,6 +18,7 @@ namespace OpenSim
18 bool startLoginServer = false; 18 bool startLoginServer = false;
19 string physicsEngine = "basicphysics"; 19 string physicsEngine = "basicphysics";
20 bool allowFlying = false; 20 bool allowFlying = false;
21 bool userAccounts = false;
21 22
22 for (int i = 0; i < args.Length; i++) 23 for (int i = 0; i < args.Length; i++)
23 { 24 {
@@ -30,6 +31,10 @@ namespace OpenSim
30 { 31 {
31 startLoginServer = true; 32 startLoginServer = true;
32 } 33 }
34 if (args[i] == "-accounts")
35 {
36 userAccounts = true;
37 }
33 if (args[i] == "-realphysx") 38 if (args[i] == "-realphysx")
34 { 39 {
35 physicsEngine = "RealPhysX"; 40 physicsEngine = "RealPhysX";
@@ -44,6 +49,7 @@ namespace OpenSim
44 OpenSimMain sim = new OpenSimMain( sandBoxMode, startLoginServer, physicsEngine ); 49 OpenSimMain sim = new OpenSimMain( sandBoxMode, startLoginServer, physicsEngine );
45 // OpenSimRoot.Instance.Application = sim; 50 // OpenSimRoot.Instance.Application = sim;
46 sim.m_sandbox = sandBoxMode; 51 sim.m_sandbox = sandBoxMode;
52 sim.user_accounts = userAccounts;
47 OpenSim.world.Avatar.PhysicsEngineFlying = allowFlying; 53 OpenSim.world.Avatar.PhysicsEngineFlying = allowFlying;
48 54
49 sim.StartUp(); 55 sim.StartUp();