コード例 #1
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="response">IMAP server response.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>response</b> is null reference.</exception>
        internal IMAP_e_Started(IMAP_r_u_ServerStatus response)
        {
            if(response == null){
                throw new ArgumentNullException("response");
            }

            m_pResponse = response;
        }
コード例 #2
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="response">IMAP server response.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>response</b> is null reference.</exception>
        internal IMAP_e_Started(IMAP_r_u_ServerStatus response)
        {
            if (response == null)
            {
                throw new ArgumentNullException("response");
            }

            m_pResponse = response;
        }
コード例 #3
0
        /// <summary>
        /// Starts session processing.
        /// </summary>
        protected override void Start()
        {
            base.Start();

            /* RFC 3501 7.1.1. Greeting text.
                The untagged form is also used as one of three possible greetings
                at connection startup.  It indicates that the connection is not
                yet authenticated and that a LOGIN command is needed.

                Example:    S: * OK IMAP4rev1 server ready
                            C: A001 LOGIN fred blurdybloop
                            S: * OK [ALERT] System shutdown in 10 minutes
                            S: A001 OK LOGIN Completed
            */
      
            try{
                IMAP_r_u_ServerStatus response = null;
                if(string.IsNullOrEmpty(this.Server.GreetingText)){
                    response = new IMAP_r_u_ServerStatus("OK","<" + Net_Utils.GetLocalHostName(this.LocalHostName) + "> IMAP4rev1 server ready.");
                }
                else{
                    response = new IMAP_r_u_ServerStatus("OK",this.Server.GreetingText);
                }
                
                IMAP_e_Started e = OnStarted(response);

                if(e.Response != null){
                    m_pResponseSender.SendResponseAsync(e.Response);
                }

                // Setup rejected flag, so we respond "* NO Session rejected." any command except LOGOUT.
                if(e.Response == null || e.Response.ResponseCode.Equals("NO",StringComparison.InvariantCultureIgnoreCase)){
                    m_SessionRejected = true;
                }
                               
                BeginReadCmd();
            }
            catch(Exception x){
                OnError(x);
            }
        }
コード例 #4
0
        /// <summary>
        /// Raises <b>Started</b> event.
        /// </summary>
        /// <param name="response">Default IMAP server response.</param>
        /// <returns>Returns event args.</returns>
        private IMAP_e_Started OnStarted(IMAP_r_u_ServerStatus response)
        {
            IMAP_e_Started eArgs = new IMAP_e_Started(response);            
            if(this.Started != null){                
                this.Started(this,eArgs);
            }

            return eArgs;
        }