diff options
author | MW | 2007-10-03 06:20:00 +0000 |
---|---|---|
committer | MW | 2007-10-03 06:20:00 +0000 |
commit | 9b1eefbcdeb21e42e0feb5336c0a084def2b4aa8 (patch) | |
tree | d204137ab678095e2636decf1067cf00074691c1 | |
parent | Droppin da fyzyx bomb on ya (diff) | |
download | opensim-SC-9b1eefbcdeb21e42e0feb5336c0a084def2b4aa8.zip opensim-SC-9b1eefbcdeb21e42e0feb5336c0a084def2b4aa8.tar.gz opensim-SC-9b1eefbcdeb21e42e0feb5336c0a084def2b4aa8.tar.bz2 opensim-SC-9b1eefbcdeb21e42e0feb5336c0a084def2b4aa8.tar.xz |
Some continuation of lbsa71's refactoring of the CommunicationsManager.
4 files changed, 68 insertions, 64 deletions
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index 6ea3c29..cd5d901 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs | |||
@@ -25,6 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | ||
28 | using libsecondlife; | 29 | using libsecondlife; |
29 | using OpenSim.Framework.Communications.Cache; | 30 | using OpenSim.Framework.Communications.Cache; |
30 | using OpenSim.Framework.Communications.Caches; | 31 | using OpenSim.Framework.Communications.Caches; |
@@ -32,6 +33,8 @@ using OpenSim.Framework.Data; | |||
32 | using OpenSim.Framework.Interfaces; | 33 | using OpenSim.Framework.Interfaces; |
33 | using OpenSim.Framework.Servers; | 34 | using OpenSim.Framework.Servers; |
34 | using OpenSim.Framework.Types; | 35 | using OpenSim.Framework.Types; |
36 | using OpenSim.Framework.Console; | ||
37 | using OpenSim.Framework.Utilities; | ||
35 | 38 | ||
36 | namespace OpenSim.Framework.Communications | 39 | namespace OpenSim.Framework.Communications |
37 | { | 40 | { |
@@ -93,6 +96,58 @@ namespace OpenSim.Framework.Communications | |||
93 | m_transactionsManager = new AssetTransactionManager(this); | 96 | m_transactionsManager = new AssetTransactionManager(this); |
94 | } | 97 | } |
95 | 98 | ||
99 | public void doCreate(string[] cmmdParams) | ||
100 | { | ||
101 | switch (cmmdParams[0]) | ||
102 | { | ||
103 | case "user": | ||
104 | string firstName; | ||
105 | string lastName; | ||
106 | string password; | ||
107 | uint regX = 1000; | ||
108 | uint regY = 1000; | ||
109 | |||
110 | if (cmmdParams.Length < 2) | ||
111 | { | ||
112 | |||
113 | firstName = MainLog.Instance.CmdPrompt("First name", "Default"); | ||
114 | lastName = MainLog.Instance.CmdPrompt("Last name", "User"); | ||
115 | password = MainLog.Instance.PasswdPrompt("Password"); | ||
116 | regX = Convert.ToUInt32(MainLog.Instance.CmdPrompt("Start Region X", "1000")); | ||
117 | regY = Convert.ToUInt32(MainLog.Instance.CmdPrompt("Start Region Y", "1000")); | ||
118 | } | ||
119 | else | ||
120 | { | ||
121 | firstName = cmmdParams[1]; | ||
122 | lastName = cmmdParams[2]; | ||
123 | password = cmmdParams[3]; | ||
124 | regX = Convert.ToUInt32(cmmdParams[4]); | ||
125 | regY = Convert.ToUInt32(cmmdParams[5]); | ||
126 | |||
127 | } | ||
128 | |||
129 | AddUser(firstName, lastName, password, regX, regY); | ||
130 | break; | ||
131 | } | ||
132 | } | ||
133 | |||
134 | public LLUUID AddUser(string firstName, string lastName, string password, uint regX, uint regY) | ||
135 | { | ||
136 | string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + ""); | ||
137 | |||
138 | m_userService.AddUserProfile(firstName, lastName, md5PasswdHash, regX, regY); | ||
139 | UserProfileData userProf = UserService.GetUserProfile(firstName, lastName); | ||
140 | if (userProf == null) | ||
141 | { | ||
142 | return LLUUID.Zero; | ||
143 | } | ||
144 | else | ||
145 | { | ||
146 | this.m_inventoryService.CreateNewUserInventory(userProf.UUID); | ||
147 | System.Console.WriteLine("Created new inventory set for " + firstName + " " + lastName); | ||
148 | return userProf.UUID; | ||
149 | } | ||
150 | } | ||
96 | 151 | ||
97 | #region Packet Handlers | 152 | #region Packet Handlers |
98 | 153 | ||
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index e0ea212..04b8dce 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -108,6 +108,7 @@ namespace OpenSim | |||
108 | } | 108 | } |
109 | 109 | ||
110 | ReadConfigSettings(startupSource); | 110 | ReadConfigSettings(startupSource); |
111 | |||
111 | } | 112 | } |
112 | 113 | ||
113 | protected void ReadConfigSettings(IConfigSource configSource) | 114 | protected void ReadConfigSettings(IConfigSource configSource) |
@@ -145,6 +146,7 @@ namespace OpenSim | |||
145 | /// </summary> | 146 | /// </summary> |
146 | public override void StartUp() | 147 | public override void StartUp() |
147 | { | 148 | { |
149 | |||
148 | if (!Directory.Exists(Util.logDir())) | 150 | if (!Directory.Exists(Util.logDir())) |
149 | { | 151 | { |
150 | Directory.CreateDirectory(Util.logDir()); | 152 | Directory.CreateDirectory(Util.logDir()); |
@@ -157,14 +159,17 @@ namespace OpenSim | |||
157 | 159 | ||
158 | if (m_sandbox) | 160 | if (m_sandbox) |
159 | { | 161 | { |
160 | CommunicationsLocal.LocalSettings settings = new CommunicationsLocal.LocalSettings(standaloneWelcomeMessage, standaloneAuthenticate, standaloneInventoryPlugin); | 162 | CommunicationsLocal.LocalSettings settings = new CommunicationsLocal.LocalSettings(standaloneWelcomeMessage, standaloneAuthenticate); |
161 | 163 | ||
162 | LocalInventoryService inventoryService = new LocalInventoryService(); | 164 | LocalInventoryService inventoryService = new LocalInventoryService(); |
165 | inventoryService.AddPlugin(standaloneInventoryPlugin); | ||
166 | |||
163 | LocalUserServices userService = new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, m_networkServersInfo.DefaultHomeLocY, inventoryService ); | 167 | LocalUserServices userService = new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, m_networkServersInfo.DefaultHomeLocY, inventoryService ); |
164 | userService.AddPlugin( standaloneUserPlugin ); | 168 | userService.AddPlugin( standaloneUserPlugin ); |
165 | 169 | ||
166 | CommunicationsLocal localComms = new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache, settings, userService); | 170 | CommunicationsLocal localComms = new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache, settings, userService, inventoryService); |
167 | m_commsManager = localComms; | 171 | m_commsManager = localComms; |
172 | |||
168 | if (standaloneAuthenticate) | 173 | if (standaloneAuthenticate) |
169 | { | 174 | { |
170 | this.CreateAccount = localComms.doCreate; | 175 | this.CreateAccount = localComms.doCreate; |
diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs index 76814cf..f51f564 100644 --- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs +++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs | |||
@@ -38,14 +38,11 @@ using OpenSim.Framework.Utilities; | |||
38 | namespace OpenSim.Region.Communications.Local | 38 | namespace OpenSim.Region.Communications.Local |
39 | { | 39 | { |
40 | public class CommunicationsLocal : CommunicationsManager | 40 | public class CommunicationsLocal : CommunicationsManager |
41 | { | 41 | { |
42 | public CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, LocalSettings settings, LocalUserServices userService) | 42 | public CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, LocalSettings settings, LocalUserServices userService, LocalInventoryService inventoryService) |
43 | : base(serversInfo, httpServer, assetCache) | 43 | : base(serversInfo, httpServer, assetCache) |
44 | { | 44 | { |
45 | LocalInventoryService inventoryService = new LocalInventoryService(); | ||
46 | inventoryService.AddPlugin(settings.InventoryPlugin); | ||
47 | m_inventoryService = inventoryService; | 45 | m_inventoryService = inventoryService; |
48 | |||
49 | m_userService = userService; | 46 | m_userService = userService; |
50 | 47 | ||
51 | LocalBackEndServices backendService = new LocalBackEndServices(); | 48 | LocalBackEndServices backendService = new LocalBackEndServices(); |
@@ -58,70 +55,17 @@ namespace OpenSim.Region.Communications.Local | |||
58 | httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod); | 55 | httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod); |
59 | } | 56 | } |
60 | 57 | ||
61 | public void doCreate(string[] cmmdParams) | 58 | |
62 | { | ||
63 | switch (cmmdParams[0]) | ||
64 | { | ||
65 | case "user": | ||
66 | string firstName; | ||
67 | string lastName; | ||
68 | string password; | ||
69 | uint regX = 1000; | ||
70 | uint regY = 1000; | ||
71 | |||
72 | if (cmmdParams.Length < 2) | ||
73 | { | ||
74 | |||
75 | firstName = MainLog.Instance.CmdPrompt("First name", "Default"); | ||
76 | lastName = MainLog.Instance.CmdPrompt("Last name", "User"); | ||
77 | password = MainLog.Instance.PasswdPrompt("Password"); | ||
78 | regX = Convert.ToUInt32(MainLog.Instance.CmdPrompt("Start Region X", "1000")); | ||
79 | regY = Convert.ToUInt32(MainLog.Instance.CmdPrompt("Start Region Y", "1000")); | ||
80 | } | ||
81 | else | ||
82 | { | ||
83 | firstName = cmmdParams[1]; | ||
84 | lastName = cmmdParams[2]; | ||
85 | password = cmmdParams[3]; | ||
86 | regX = Convert.ToUInt32(cmmdParams[4]); | ||
87 | regY = Convert.ToUInt32(cmmdParams[5]); | ||
88 | |||
89 | } | ||
90 | |||
91 | AddUser(firstName, lastName, password, regX, regY); | ||
92 | break; | ||
93 | } | ||
94 | } | ||
95 | |||
96 | public LLUUID AddUser(string firstName, string lastName, string password, uint regX, uint regY) | ||
97 | { | ||
98 | string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + ""); | ||
99 | |||
100 | m_userService.AddUserProfile(firstName, lastName, md5PasswdHash, regX, regY); | ||
101 | UserProfileData userProf = this.UserService.GetUserProfile(firstName, lastName); | ||
102 | if (userProf == null) | ||
103 | { | ||
104 | return LLUUID.Zero; | ||
105 | } | ||
106 | else | ||
107 | { | ||
108 | this.m_inventoryService.CreateNewUserInventory(userProf.UUID); | ||
109 | Console.WriteLine("Created new inventory set for " + firstName + " " + lastName); | ||
110 | return userProf.UUID; | ||
111 | } | ||
112 | } | ||
113 | 59 | ||
114 | public class LocalSettings | 60 | public class LocalSettings |
115 | { | 61 | { |
116 | public string WelcomeMessage; | 62 | public string WelcomeMessage; |
117 | public bool AccountAuthentication = false; | 63 | public bool AccountAuthentication = false; |
118 | public string InventoryPlugin; | ||
119 | 64 | ||
120 | public LocalSettings(string welcomeMessage, bool accountsAuthenticate, string inventoryPlugin) | 65 | public LocalSettings(string welcomeMessage, bool accountsAuthenticate) |
121 | { | 66 | { |
122 | WelcomeMessage = welcomeMessage; | 67 | WelcomeMessage = welcomeMessage; |
123 | AccountAuthentication = accountsAuthenticate; | 68 | AccountAuthentication = accountsAuthenticate; |
124 | InventoryPlugin = inventoryPlugin; | ||
125 | } | 69 | } |
126 | } | 70 | } |
127 | 71 | ||
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index eafa500..5f39413 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs | |||
@@ -41,12 +41,12 @@ namespace SimpleApp | |||
41 | { | 41 | { |
42 | base.StartUp(); | 42 | base.StartUp(); |
43 | 43 | ||
44 | CommunicationsLocal.LocalSettings settings = new CommunicationsLocal.LocalSettings("", false, ""); | 44 | CommunicationsLocal.LocalSettings settings = new CommunicationsLocal.LocalSettings("", false); |
45 | 45 | ||
46 | LocalInventoryService inventoryService = new LocalInventoryService(); | 46 | LocalInventoryService inventoryService = new LocalInventoryService(); |
47 | LocalUserServices userService = new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, m_networkServersInfo.DefaultHomeLocY, inventoryService); | 47 | LocalUserServices userService = new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, m_networkServersInfo.DefaultHomeLocY, inventoryService); |
48 | 48 | ||
49 | m_commsManager = new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache, settings, userService ); | 49 | m_commsManager = new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache, settings, userService, inventoryService ); |
50 | 50 | ||
51 | m_log.Notice(m_log.LineInfo); | 51 | m_log.Notice(m_log.LineInfo); |
52 | 52 | ||