diff options
author | Justin Clarke Casey | 2008-07-29 17:39:15 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-07-29 17:39:15 +0000 |
commit | e595959d97f35bf866801fff8b9ceb1ed35b3825 (patch) | |
tree | 5242eebee228c922d0a4624c212e19039ef54ccb /OpenSim/Region/Application | |
parent | adding copyright notice and help option to matrix.py. (diff) | |
download | opensim-SC_OLD-e595959d97f35bf866801fff8b9ceb1ed35b3825.zip opensim-SC_OLD-e595959d97f35bf866801fff8b9ceb1ed35b3825.tar.gz opensim-SC_OLD-e595959d97f35bf866801fff8b9ceb1ed35b3825.tar.bz2 opensim-SC_OLD-e595959d97f35bf866801fff8b9ceb1ed35b3825.tar.xz |
* refactor: move create user console command parsing down to OpenSim.cs from CommunicationsManager
Diffstat (limited to 'OpenSim/Region/Application')
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 71 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 2 |
2 files changed, 67 insertions, 6 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 66c7c48..71a941e 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -208,7 +208,6 @@ namespace OpenSim | |||
208 | } | 208 | } |
209 | } | 209 | } |
210 | 210 | ||
211 | |||
212 | /// <summary> | 211 | /// <summary> |
213 | /// Runs commands issued by the server console from the operator | 212 | /// Runs commands issued by the server console from the operator |
214 | /// </summary> | 213 | /// </summary> |
@@ -348,9 +347,7 @@ namespace OpenSim | |||
348 | break; | 347 | break; |
349 | 348 | ||
350 | case "create": | 349 | case "create": |
351 | if (m_sandbox) | 350 | Create(cmdparams); |
352 | CreateAccount(cmdparams); | ||
353 | |||
354 | break; | 351 | break; |
355 | 352 | ||
356 | case "create-region": | 353 | case "create-region": |
@@ -524,6 +521,23 @@ namespace OpenSim | |||
524 | break; | 521 | break; |
525 | } | 522 | } |
526 | } | 523 | } |
524 | |||
525 | /// <summary> | ||
526 | /// Execute switch for some of the create commands | ||
527 | /// </summary> | ||
528 | /// <param name="args"></param> | ||
529 | protected void Create(string[] args) | ||
530 | { | ||
531 | if (args.Length == 0) | ||
532 | return; | ||
533 | |||
534 | switch (args[0]) | ||
535 | { | ||
536 | case "user": | ||
537 | CreateUser(args); | ||
538 | break; | ||
539 | } | ||
540 | } | ||
527 | 541 | ||
528 | /// <summary> | 542 | /// <summary> |
529 | /// Turn on some debugging values for OpenSim. | 543 | /// Turn on some debugging values for OpenSim. |
@@ -653,6 +667,48 @@ namespace OpenSim | |||
653 | } | 667 | } |
654 | } | 668 | } |
655 | 669 | ||
670 | /// <summary> | ||
671 | /// Create a new user | ||
672 | /// </summary> | ||
673 | /// <param name="cmdparams"></param> | ||
674 | protected void CreateUser(string[] cmdparams) | ||
675 | { | ||
676 | string firstName; | ||
677 | string lastName; | ||
678 | string password; | ||
679 | uint regX = 1000; | ||
680 | uint regY = 1000; | ||
681 | |||
682 | if (cmdparams.Length < 2) | ||
683 | firstName = MainConsole.Instance.CmdPrompt("First name", "Default"); | ||
684 | else firstName = cmdparams[1]; | ||
685 | |||
686 | if ( cmdparams.Length < 3 ) | ||
687 | lastName = MainConsole.Instance.CmdPrompt("Last name", "User"); | ||
688 | else lastName = cmdparams[2]; | ||
689 | |||
690 | if ( cmdparams.Length < 4 ) | ||
691 | password = MainConsole.Instance.PasswdPrompt("Password"); | ||
692 | else password = cmdparams[3]; | ||
693 | |||
694 | if ( cmdparams.Length < 5 ) | ||
695 | regX = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region X", regX.ToString())); | ||
696 | else regX = Convert.ToUInt32(cmdparams[4]); | ||
697 | |||
698 | if ( cmdparams.Length < 6 ) | ||
699 | regY = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region Y", regY.ToString())); | ||
700 | else regY = Convert.ToUInt32(cmdparams[5]); | ||
701 | |||
702 | if (null == m_commsManager.UserService.GetUserProfile(firstName, lastName)) | ||
703 | { | ||
704 | m_commsManager.AddUser(firstName, lastName, password, regX, regY); | ||
705 | } | ||
706 | else | ||
707 | { | ||
708 | m_log.ErrorFormat("[CONSOLE]: A user with the name {0} {1} already exists!", firstName, lastName); | ||
709 | } | ||
710 | } | ||
711 | |||
656 | protected void SaveXml(string[] cmdparams) | 712 | protected void SaveXml(string[] cmdparams) |
657 | { | 713 | { |
658 | m_log.Error("[CONSOLE]: PLEASE NOTE, save-xml is DEPRECATED and may be REMOVED soon. If you are using this and there is some reason you can't use save-xml2, please file a mantis detailing the reason."); | 714 | m_log.Error("[CONSOLE]: PLEASE NOTE, save-xml is DEPRECATED and may be REMOVED soon. If you are using this and there is some reason you can't use save-xml2, please file a mantis detailing the reason."); |
@@ -773,6 +829,13 @@ namespace OpenSim | |||
773 | protected void SaveInv(string[] cmdparams) | 829 | protected void SaveInv(string[] cmdparams) |
774 | { | 830 | { |
775 | m_log.Error("[CONSOLE]: This has not been implemented yet!"); | 831 | m_log.Error("[CONSOLE]: This has not been implemented yet!"); |
832 | |||
833 | // CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(); | ||
834 | // if (userInfo == null) | ||
835 | // { | ||
836 | // m_log.Error("[AGENT INVENTORY]: Failed to find user " + oldAgentID.ToString()); | ||
837 | // return; | ||
838 | // } | ||
776 | } | 839 | } |
777 | 840 | ||
778 | private static string CombineParams(string[] commandParams, int pos) | 841 | private static string CombineParams(string[] commandParams, int pos) |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index a9351d3..8de7c58 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -393,8 +393,6 @@ namespace OpenSim | |||
393 | m_gridInfoService = new GridInfoService(); | 393 | m_gridInfoService = new GridInfoService(); |
394 | m_httpServer.AddXmlRPCHandler("get_grid_info", m_gridInfoService.XmlRpcGridInfoMethod); | 394 | m_httpServer.AddXmlRPCHandler("get_grid_info", m_gridInfoService.XmlRpcGridInfoMethod); |
395 | m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info", m_gridInfoService.RestGetGridInfoMethod)); | 395 | m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info", m_gridInfoService.RestGetGridInfoMethod)); |
396 | |||
397 | CreateAccount = localComms.doCreate; | ||
398 | } | 396 | } |
399 | else | 397 | else |
400 | { | 398 | { |