public void HandleRequest(ChatroomServerProtocol protocol, PropertyDictionary request)
        {
            if (!request.HasValueFor(ChatroomKeys.MessageType) || !(request.StringFor(ChatroomKeys.MessageType) == Key))
            {
                protocol.SendMalformedRequestResponse();
                return;
            }

            lock (_lockObject)
            {
                string sender = protocol.Parent.ResolveSenderName(request);

                if (sender != null)
                {
                    request[ChatroomKeys.SenderName] = sender;

                    protocol.Parent.Broadcast(request);
                }
                else
                {
                    protocol.SendMalformedRequestResponse();
                }
            }
        }
        public void HandleRequest(ChatroomServerProtocol protocol, PropertyDictionary request)
        {
            if (!request.HasValueFor(ChatroomKeys.MessageType) || request.StringFor(ChatroomKeys.MessageType) != Key)
            {
                protocol.SendMalformedRequestResponse();
                return;
            }

            object connected = null;

            lock (_lockObject)
            {
                connected = protocol.Parent.RequestLogin(protocol, request);
                request.SetValueFor(ChatroomKeys.Message, connected);
            }

            if (connected.ToString() == ChatroomKeys.LoginSuccess)
            {
                protocol.Parent.BroadcastServerMessage("{0} has joined.", protocol.Username);
                protocol.SendWelcomeMessage();
            }

            protocol.SendTerm(Atom.From(request.PersistToString()));
        }