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 /OpenSim/Region | |
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.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Application/OpenSimMain.cs | 9 | ||||
-rw-r--r-- | OpenSim/Region/Communications/Local/CommunicationsLocal.cs | 64 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/Program.cs | 4 |
3 files changed, 13 insertions, 64 deletions
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 | ||