aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs
diff options
context:
space:
mode:
authorMelanie Thielker2014-06-21 00:39:55 +0200
committerMelanie Thielker2014-06-21 00:39:55 +0200
commit159fcbf150b7da0e229b29aa7b94793484543d12 (patch)
treeb8c0ff3b4c758a3fba8315b556c923ef4c02a185 /OpenSim/Server/Handlers/Login/LLLoginHandlers.cs
parentMerge commit '68c8633ba18f0a11cfc0ed04d1d0c7c59e6cec76' (diff)
parentMerge branch 'master' into careminster (diff)
downloadopensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.zip
opensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.tar.gz
opensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.tar.bz2
opensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.tar.xz
Merge branch 'master' of ssh://3dhosting.de/var/git/careminster
Conflicts: OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
Diffstat (limited to 'OpenSim/Server/Handlers/Login/LLLoginHandlers.cs')
-rw-r--r--OpenSim/Server/Handlers/Login/LLLoginHandlers.cs67
1 files changed, 67 insertions, 0 deletions
diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs
index f83a239..f2a5678 100644
--- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs
+++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs
@@ -53,6 +53,7 @@ namespace OpenSim.Server.Handlers.Login
53 53
54 private ILoginService m_LocalService; 54 private ILoginService m_LocalService;
55 private bool m_Proxy; 55 private bool m_Proxy;
56
56 57
57 public LLLoginHandlers(ILoginService service, bool hasProxy) 58 public LLLoginHandlers(ILoginService service, bool hasProxy)
58 { 59 {
@@ -144,6 +145,17 @@ namespace OpenSim.Server.Handlers.Login
144 return FailedXMLRPCResponse(); 145 return FailedXMLRPCResponse();
145 146
146 } 147 }
148 public XmlRpcResponse HandleXMLRPCLoginBlocked(XmlRpcRequest request, IPEndPoint client)
149 {
150 XmlRpcResponse response = new XmlRpcResponse();
151 Hashtable resp = new Hashtable();
152
153 resp["reason"] = "presence";
154 resp["message"] = "Logins are currently restricted. Please try again later.";
155 resp["login"] = "false";
156 response.Value = resp;
157 return response;
158 }
147 159
148 public XmlRpcResponse HandleXMLRPCSetLoginLevel(XmlRpcRequest request, IPEndPoint remoteClient) 160 public XmlRpcResponse HandleXMLRPCSetLoginLevel(XmlRpcRequest request, IPEndPoint remoteClient)
149 { 161 {
@@ -213,6 +225,61 @@ namespace OpenSim.Server.Handlers.Login
213 return FailedOSDResponse(); 225 return FailedOSDResponse();
214 } 226 }
215 227
228 public void HandleWebSocketLoginEvents(string path, WebSocketHttpServerHandler sock)
229 {
230 sock.MaxPayloadSize = 16384; //16 kb payload
231 sock.InitialMsgTimeout = 5000; //5 second first message to trigger at least one of these events
232 sock.NoDelay_TCP_Nagle = true;
233 sock.OnData += delegate(object sender, WebsocketDataEventArgs data) { sock.Close("fail"); };
234 sock.OnPing += delegate(object sender, PingEventArgs pingdata) { sock.Close("fail"); };
235 sock.OnPong += delegate(object sender, PongEventArgs pongdata) { sock.Close("fail"); };
236 sock.OnText += delegate(object sender, WebsocketTextEventArgs text)
237 {
238 OSD request = null;
239 try
240 {
241 request = OSDParser.DeserializeJson(text.Data);
242 if (!(request is OSDMap))
243 {
244 sock.SendMessage(OSDParser.SerializeJsonString(FailedOSDResponse()));
245 }
246 else
247 {
248 OSDMap req = request as OSDMap;
249 string first = req["firstname"].AsString();
250 string last = req["lastname"].AsString();
251 string passwd = req["passwd"].AsString();
252 string start = req["startlocation"].AsString();
253 string version = req["version"].AsString();
254 string channel = req["channel"].AsString();
255 string mac = req["mac"].AsString();
256 string id0 = req["id0"].AsString();
257 UUID scope = UUID.Zero;
258 IPEndPoint endPoint =
259 (sender as WebSocketHttpServerHandler).GetRemoteIPEndpoint();
260 LoginResponse reply = null;
261 reply = m_LocalService.Login(first, last, passwd, start, scope, version,
262 channel, mac, id0, endPoint);
263 sock.SendMessage(OSDParser.SerializeJsonString(reply.ToOSDMap()));
264
265 }
266
267 }
268 catch (Exception)
269 {
270 sock.SendMessage(OSDParser.SerializeJsonString(FailedOSDResponse()));
271 }
272 finally
273 {
274 sock.Close("success");
275 }
276 };
277
278 sock.HandshakeAndUpgrade();
279
280 }
281
282
216 private XmlRpcResponse FailedXMLRPCResponse() 283 private XmlRpcResponse FailedXMLRPCResponse()
217 { 284 {
218 Hashtable hash = new Hashtable(); 285 Hashtable hash = new Hashtable();