diff options
author | lbsa71 | 2007-10-30 09:05:31 +0000 |
---|---|---|
committer | lbsa71 | 2007-10-30 09:05:31 +0000 |
commit | 67e12b95ea7b68f4904a7484d77ecfd787d16d0c (patch) | |
tree | 20b00d24c8a7617017960432ec044852e3ad5fa9 /OpenSim/Grid/UserServer | |
parent | * Deleted .user file (diff) | |
download | opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.zip opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.gz opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.bz2 opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.xz |
* Optimized usings
* Shortened type references
* Removed redundant 'this' qualifier
Diffstat (limited to 'OpenSim/Grid/UserServer')
-rw-r--r-- | OpenSim/Grid/UserServer/Main.cs | 27 | ||||
-rw-r--r-- | OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs | 31 | ||||
-rw-r--r-- | OpenSim/Grid/UserServer/UserLoginService.cs | 39 | ||||
-rw-r--r-- | OpenSim/Grid/UserServer/UserManager.cs | 17 |
4 files changed, 59 insertions, 55 deletions
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 492f67f..779a72b 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs | |||
@@ -27,28 +27,23 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.IO; | 30 | using System.IO; |
32 | using System.Reflection; | 31 | using OpenSim.Framework; |
33 | using libsecondlife; | ||
34 | using OpenSim.Framework.Console; | 32 | using OpenSim.Framework.Console; |
35 | using OpenSim.Framework.Interfaces; | ||
36 | using OpenSim.Framework.Servers; | 33 | using OpenSim.Framework.Servers; |
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework; | ||
39 | 34 | ||
40 | namespace OpenSim.Grid.UserServer | 35 | namespace OpenSim.Grid.UserServer |
41 | { | 36 | { |
42 | /// <summary> | 37 | /// <summary> |
43 | /// </summary> | 38 | /// </summary> |
44 | public class OpenUser_Main : conscmd_callback | 39 | public class OpenUser_Main : conscmd_callback |
45 | { | 40 | { |
46 | private UserConfig Cfg; | 41 | private UserConfig Cfg; |
47 | 42 | ||
48 | public UserManager m_userManager; | 43 | public UserManager m_userManager; |
49 | public UserLoginService m_loginService; | 44 | public UserLoginService m_loginService; |
50 | 45 | ||
51 | LogBase m_console; | 46 | private LogBase m_console; |
52 | 47 | ||
53 | [STAThread] | 48 | [STAThread] |
54 | public static void Main(string[] args) | 49 | public static void Main(string[] args) |
@@ -67,7 +62,8 @@ namespace OpenSim.Grid.UserServer | |||
67 | { | 62 | { |
68 | Directory.CreateDirectory(Util.logDir()); | 63 | Directory.CreateDirectory(Util.logDir()); |
69 | } | 64 | } |
70 | m_console = new LogBase((Path.Combine(Util.logDir(), "opengrid-userserver-console.log")), "OpenUser", this, true); | 65 | m_console = |
66 | new LogBase((Path.Combine(Util.logDir(), "opengrid-userserver-console.log")), "OpenUser", this, true); | ||
71 | MainLog.Instance = m_console; | 67 | MainLog.Instance = m_console; |
72 | } | 68 | } |
73 | 69 | ||
@@ -83,7 +79,7 @@ namespace OpenSim.Grid.UserServer | |||
83 | 79 | ||
84 | public void Startup() | 80 | public void Startup() |
85 | { | 81 | { |
86 | this.Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml"))); | 82 | Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml"))); |
87 | 83 | ||
88 | MainLog.Instance.Verbose("Main.cs:Startup() - Establishing data connection"); | 84 | MainLog.Instance.Verbose("Main.cs:Startup() - Establishing data connection"); |
89 | m_userManager = new UserManager(); | 85 | m_userManager = new UserManager(); |
@@ -93,15 +89,16 @@ namespace OpenSim.Grid.UserServer | |||
93 | m_loginService = new UserLoginService(m_userManager, Cfg, Cfg.DefaultStartupMsg); | 89 | m_loginService = new UserLoginService(m_userManager, Cfg, Cfg.DefaultStartupMsg); |
94 | 90 | ||
95 | MainLog.Instance.Verbose("Main.cs:Startup() - Starting HTTP process"); | 91 | MainLog.Instance.Verbose("Main.cs:Startup() - Starting HTTP process"); |
96 | BaseHttpServer httpServer = new BaseHttpServer((int)Cfg.HttpPort); | 92 | BaseHttpServer httpServer = new BaseHttpServer((int) Cfg.HttpPort); |
97 | 93 | ||
98 | httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); | 94 | httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); |
99 | 95 | ||
100 | httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName); | 96 | httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName); |
101 | httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID); | 97 | httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID); |
102 | 98 | ||
103 | httpServer.AddStreamHandler( new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod )); | 99 | httpServer.AddStreamHandler( |
104 | 100 | new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod)); | |
101 | |||
105 | httpServer.Start(); | 102 | httpServer.Start(); |
106 | m_console.Status("SERVER", "Userserver 0.4 - Startup complete"); | 103 | m_console.Status("SERVER", "Userserver 0.4 - Startup complete"); |
107 | } | 104 | } |
@@ -126,7 +123,7 @@ namespace OpenSim.Grid.UserServer | |||
126 | 123 | ||
127 | tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); | 124 | tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); |
128 | 125 | ||
129 | m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); | 126 | m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); |
130 | break; | 127 | break; |
131 | } | 128 | } |
132 | } | 129 | } |
@@ -178,4 +175,4 @@ namespace OpenSim.Grid.UserServer | |||
178 | { | 175 | { |
179 | } | 176 | } |
180 | } | 177 | } |
181 | } | 178 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs index 877f02f..079e05e 100644 --- a/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs +++ b/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs | |||
@@ -1,24 +1,28 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.InteropServices; | 2 | using System.Runtime.InteropServices; |
3 | |||
3 | // General Information about an assembly is controlled through the following | 4 | // General Information about an assembly is controlled through the following |
4 | // set of attributes. Change these attribute values to modify the information | 5 | // set of attributes. Change these attribute values to modify the information |
5 | // associated with an assembly. | 6 | // associated with an assembly. |
6 | [assembly: AssemblyTitle("OGS-UserServer")] | 7 | |
7 | [assembly: AssemblyDescription("")] | 8 | [assembly : AssemblyTitle("OGS-UserServer")] |
8 | [assembly: AssemblyConfiguration("")] | 9 | [assembly : AssemblyDescription("")] |
9 | [assembly: AssemblyCompany("")] | 10 | [assembly : AssemblyConfiguration("")] |
10 | [assembly: AssemblyProduct("OGS-UserServer")] | 11 | [assembly : AssemblyCompany("")] |
11 | [assembly: AssemblyCopyright("Copyright © 2007")] | 12 | [assembly : AssemblyProduct("OGS-UserServer")] |
12 | [assembly: AssemblyTrademark("")] | 13 | [assembly : AssemblyCopyright("Copyright © 2007")] |
13 | [assembly: AssemblyCulture("")] | 14 | [assembly : AssemblyTrademark("")] |
15 | [assembly : AssemblyCulture("")] | ||
14 | 16 | ||
15 | // Setting ComVisible to false makes the types in this assembly not visible | 17 | // Setting ComVisible to false makes the types in this assembly not visible |
16 | // to COM components. If you need to access a type in this assembly from | 18 | // to COM components. If you need to access a type in this assembly from |
17 | // COM, set the ComVisible attribute to true on that type. | 19 | // COM, set the ComVisible attribute to true on that type. |
18 | [assembly: ComVisible(false)] | 20 | |
21 | [assembly : ComVisible(false)] | ||
19 | 22 | ||
20 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
21 | [assembly: Guid("e266513a-090b-4d38-80f6-8599eef68c8c")] | 24 | |
25 | [assembly : Guid("e266513a-090b-4d38-80f6-8599eef68c8c")] | ||
22 | 26 | ||
23 | // Version information for an assembly consists of the following four values: | 27 | // Version information for an assembly consists of the following four values: |
24 | // | 28 | // |
@@ -27,5 +31,6 @@ using System.Runtime.InteropServices; | |||
27 | // Build Number | 31 | // Build Number |
28 | // Revision | 32 | // Revision |
29 | // | 33 | // |
30 | [assembly: AssemblyVersion("1.0.0.0")] | 34 | |
31 | [assembly: AssemblyFileVersion("1.0.0.0")] | 35 | [assembly : AssemblyVersion("1.0.0.0")] |
36 | [assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file | ||
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs index 1523f81..bbef4b2 100644 --- a/OpenSim/Grid/UserServer/UserLoginService.cs +++ b/OpenSim/Grid/UserServer/UserLoginService.cs | |||
@@ -30,12 +30,10 @@ using System; | |||
30 | using System.Collections; | 30 | using System.Collections; |
31 | using System.Net; | 31 | using System.Net; |
32 | using Nwc.XmlRpc; | 32 | using Nwc.XmlRpc; |
33 | using OpenSim.Framework.Data; | ||
34 | using OpenSim.Framework.UserManagement; | ||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Console; | 34 | using OpenSim.Framework.Console; |
35 | using OpenSim.Framework.Data; | ||
36 | using OpenSim.Framework.UserManagement; | ||
39 | 37 | ||
40 | namespace OpenSim.Grid.UserServer | 38 | namespace OpenSim.Grid.UserServer |
41 | { | 39 | { |
@@ -58,18 +56,24 @@ namespace OpenSim.Grid.UserServer | |||
58 | { | 56 | { |
59 | // Load information from the gridserver | 57 | // Load information from the gridserver |
60 | RegionProfileData SimInfo = new RegionProfileData(); | 58 | RegionProfileData SimInfo = new RegionProfileData(); |
61 | SimInfo = SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); | 59 | SimInfo = |
60 | SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, m_config.GridServerURL, | ||
61 | m_config.GridSendKey, m_config.GridRecvKey); | ||
62 | 62 | ||
63 | // Customise the response | 63 | // Customise the response |
64 | // Home Location | 64 | // Home Location |
65 | response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + (SimInfo.regionLocY * 256).ToString() + "], " + | 65 | response.Home = "{'region_handle':[r" + (SimInfo.regionLocX*256).ToString() + ",r" + |
66 | "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + | 66 | (SimInfo.regionLocY*256).ToString() + "], " + |
67 | "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; | 67 | "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + |
68 | theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + | ||
69 | "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + | ||
70 | theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; | ||
68 | 71 | ||
69 | // Destination | 72 | // Destination |
70 | MainLog.Instance.Verbose("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY); | 73 | MainLog.Instance.Verbose("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + |
74 | SimInfo.regionLocY); | ||
71 | response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString(); | 75 | response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString(); |
72 | response.SimPort = (Int32)SimInfo.serverPort; | 76 | response.SimPort = (Int32) SimInfo.serverPort; |
73 | response.RegionX = SimInfo.regionLocX; | 77 | response.RegionX = SimInfo.regionLocX; |
74 | response.RegionY = SimInfo.regionLocY; | 78 | response.RegionY = SimInfo.regionLocY; |
75 | 79 | ||
@@ -87,7 +91,7 @@ namespace OpenSim.Grid.UserServer | |||
87 | SimParams["firstname"] = theUser.username; | 91 | SimParams["firstname"] = theUser.username; |
88 | SimParams["lastname"] = theUser.surname; | 92 | SimParams["lastname"] = theUser.surname; |
89 | SimParams["agent_id"] = theUser.UUID.ToString(); | 93 | SimParams["agent_id"] = theUser.UUID.ToString(); |
90 | SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode); | 94 | SimParams["circuit_code"] = (Int32) Convert.ToUInt32(response.CircuitCode); |
91 | SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString(); | 95 | SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString(); |
92 | SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString(); | 96 | SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString(); |
93 | SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString(); | 97 | SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString(); |
@@ -107,21 +111,20 @@ namespace OpenSim.Grid.UserServer | |||
107 | XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); | 111 | XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); |
108 | XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); | 112 | XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); |
109 | } | 113 | } |
110 | catch( WebException e ) | 114 | catch (WebException e) |
111 | { | 115 | { |
112 | switch( e.Status ) | 116 | switch (e.Status) |
113 | { | 117 | { |
114 | case WebExceptionStatus.Timeout: | 118 | case WebExceptionStatus.Timeout: |
115 | //TODO: Send him to nearby or default region instead | 119 | //TODO: Send him to nearby or default region instead |
116 | MainLog.Instance.Verbose("Unable to connect to " + SimInfo.regionName + " (" + SimInfo.serverURI + ")"); | 120 | MainLog.Instance.Verbose("Unable to connect to " + SimInfo.regionName + " (" + SimInfo.serverURI + |
121 | ")"); | ||
117 | break; | 122 | break; |
118 | 123 | ||
119 | default: | 124 | default: |
120 | throw; | 125 | throw; |
121 | } | 126 | } |
122 | } | 127 | } |
123 | } | 128 | } |
124 | } | 129 | } |
125 | } | 130 | } \ No newline at end of file |
126 | |||
127 | |||
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs index 2b2bf72..96cdfb3 100644 --- a/OpenSim/Grid/UserServer/UserManager.cs +++ b/OpenSim/Grid/UserServer/UserManager.cs | |||
@@ -27,12 +27,10 @@ | |||
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Net; | 30 | using libsecondlife; |
31 | using Nwc.XmlRpc; | 31 | using Nwc.XmlRpc; |
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Framework.UserManagement; | 33 | using OpenSim.Framework.UserManagement; |
34 | using OpenSim.Framework; | ||
35 | using libsecondlife; | ||
36 | 34 | ||
37 | namespace OpenSim.Grid.UserServer | 35 | namespace OpenSim.Grid.UserServer |
38 | { | 36 | { |
@@ -118,11 +116,11 @@ namespace OpenSim.Grid.UserServer | |||
118 | public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request) | 116 | public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request) |
119 | { | 117 | { |
120 | XmlRpcResponse response = new XmlRpcResponse(); | 118 | XmlRpcResponse response = new XmlRpcResponse(); |
121 | Hashtable requestData = (Hashtable)request.Params[0]; | 119 | Hashtable requestData = (Hashtable) request.Params[0]; |
122 | UserProfileData userProfile; | 120 | UserProfileData userProfile; |
123 | if (requestData.Contains("avatar_name")) | 121 | if (requestData.Contains("avatar_name")) |
124 | { | 122 | { |
125 | userProfile = GetUserProfile((string)requestData["avatar_name"]); | 123 | userProfile = GetUserProfile((string) requestData["avatar_name"]); |
126 | if (userProfile == null) | 124 | if (userProfile == null) |
127 | { | 125 | { |
128 | return CreateUnknownUserErrorResponse(); | 126 | return CreateUnknownUserErrorResponse(); |
@@ -139,12 +137,12 @@ namespace OpenSim.Grid.UserServer | |||
139 | public XmlRpcResponse XmlRPCGetUserMethodUUID(XmlRpcRequest request) | 137 | public XmlRpcResponse XmlRPCGetUserMethodUUID(XmlRpcRequest request) |
140 | { | 138 | { |
141 | XmlRpcResponse response = new XmlRpcResponse(); | 139 | XmlRpcResponse response = new XmlRpcResponse(); |
142 | Hashtable requestData = (Hashtable)request.Params[0]; | 140 | Hashtable requestData = (Hashtable) request.Params[0]; |
143 | UserProfileData userProfile; | 141 | UserProfileData userProfile; |
144 | System.Console.WriteLine("METHOD BY UUID CALLED"); | 142 | Console.WriteLine("METHOD BY UUID CALLED"); |
145 | if (requestData.Contains("avatar_uuid")) | 143 | if (requestData.Contains("avatar_uuid")) |
146 | { | 144 | { |
147 | userProfile = GetUserProfile((LLUUID)(string)requestData["avatar_uuid"]); | 145 | userProfile = GetUserProfile((LLUUID) (string) requestData["avatar_uuid"]); |
148 | if (userProfile == null) | 146 | if (userProfile == null) |
149 | { | 147 | { |
150 | return CreateUnknownUserErrorResponse(); | 148 | return CreateUnknownUserErrorResponse(); |
@@ -158,6 +156,7 @@ namespace OpenSim.Grid.UserServer | |||
158 | 156 | ||
159 | return ProfileToXmlRPCResponse(userProfile); | 157 | return ProfileToXmlRPCResponse(userProfile); |
160 | } | 158 | } |
159 | |||
161 | #endregion | 160 | #endregion |
162 | 161 | ||
163 | public override UserProfileData SetupMasterUser(string firstName, string lastName) | 162 | public override UserProfileData SetupMasterUser(string firstName, string lastName) |
@@ -170,4 +169,4 @@ namespace OpenSim.Grid.UserServer | |||
170 | throw new Exception("The method or operation is not implemented."); | 169 | throw new Exception("The method or operation is not implemented."); |
171 | } | 170 | } |
172 | } | 171 | } |
173 | } | 172 | } \ No newline at end of file |