public WebExceptionEventArgs(WebException e, string url, string postData,
     PostSubmitter.PostTypeEnum method)
 {
     this.Exception = e;
     this.Url = url;
     this.PostData = postData;
     this.Method = method;
 }
        /// <summary>
        /// Notifies the Server that the user has finished typing.
        /// </summary>
        public void StopTyping()
        {
            PostSubmitter sendPost = new PostSubmitter();
            sendPost.Url = String.Format("http://{0}.omegle.com/stoppedtyping", Server);
            sendPost.PostItems.Add("id", Id);
            sendPost.Type = PostSubmitter.PostTypeEnum.Post;

            if (!Throws)
                sendPost.WebExceptionEvent += WebException;

            sendPost.Post();
        }
        /// <summary>
        /// Checks the Server for a new response.
        /// </summary>
        private void Listen()
        {
            PostSubmitter eventlisten = new PostSubmitter();
            eventlisten.Url = String.Format("http://{0}.omegle.com/events", Server);
            eventlisten.PostItems.Add("id", Id);
            eventlisten.Type = PostSubmitter.PostTypeEnum.Post;

            eventlisten.WebExceptionEvent += WebException;

            Parse(eventlisten.Post());
        }
        /// <summary>
        /// Sends a message to the connected stranger. This version does not html-encode the message.
        /// </summary>
        /// <param name="message">The message to be sent</param>
        /// <returns></returns>
        public string SendMessageRaw(string message)
        {
            //Send Message format: [url]http://bajor.omegle.com/send?id=Id&msg=MSG[/url]

            PostSubmitter sendPost = new PostSubmitter();
            sendPost.Url = String.Format("http://{0}.omegle.com/send", Server);
            sendPost.PostItems.Add("id", Id);
            sendPost.PostItems.Add("msg", message);
            sendPost.Type = PostSubmitter.PostTypeEnum.Post;

            if (!Throws)
                sendPost.WebExceptionEvent += WebException;

            return sendPost.Post();
        }
        /// <summary>
        /// Sends a message from the specified Id.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="ownID">The ID.</param>
        /// <returns></returns>
        public string SendMessageAsID(string message, string ownID)
        {
            //This method could potentially be used to send messages from another user.
            //One would have to acquire said users Id first.
            //TODO: Find a way to get a strangers Id
            message = HttpUtility.UrlEncode(message);

            PostSubmitter sendPost = new PostSubmitter();
            sendPost.Url = String.Format("http://{0}.omegle.com/send", Server);
            sendPost.PostItems.Add("id", ownID);
            sendPost.PostItems.Add("msg", message);
            sendPost.Type = PostSubmitter.PostTypeEnum.Post;

            if (!Throws)
                sendPost.WebExceptionEvent += WebException;

            return sendPost.Post();
        }
        /// <summary>
        /// Sends a disconnect message to the server, ending the conversation.
        /// </summary>
        /// <returns></returns>
        public string SendDisconnect()
        {
            PostSubmitter sendPost = new PostSubmitter();
            sendPost.Url = String.Format("http://{0}.omegle.com/disconnect", Server);
            sendPost.PostItems.Add("id", Id);
            sendPost.Type = PostSubmitter.PostTypeEnum.Post;

            if (!Throws)
                sendPost.WebExceptionEvent += WebException;

            return sendPost.Post();
        }
        /// <summary>
        /// Sends a captcha response to the Server.
        /// </summary>
        /// <param name="challenge">The challenge value</param>
        /// <param name="response">The response string</param>
        /// <returns></returns>
        public string SendCaptcha(string challenge, string response)
        {
            PostSubmitter sendPost = new PostSubmitter();
            sendPost.Url = String.Format("http://{0}.omegle.com/recaptcha", Server);
            sendPost.PostItems.Add("id", Id);
            sendPost.PostItems.Add("challenge", challenge);
            sendPost.PostItems.Add("response", response);
            sendPost.Type = PostSubmitter.PostTypeEnum.Post;

            if (!Throws)
                sendPost.WebExceptionEvent += WebException;

            return sendPost.Post();
        }
        /// <summary>
        /// Gets a new Id from the Omegle service.
        /// </summary>
        public void GetID()
        {
            do
            {
                PostSubmitter sendPost = new PostSubmitter();
                sendPost.Url = String.Format("http://{0}.omegle.com/start", Server);
                sendPost.PostItems.Add("rcs", "1");
                sendPost.Type = PostSubmitter.PostTypeEnum.Post;

                if (!Throws)
                    sendPost.WebExceptionEvent += WebException;

                Id = sendPost.Post();
            } while (Id == null);

            Id = Id.TrimStart('"'); //gets rid of " at the start and end
            Id = Id.TrimEnd('"');
        }