Example #1
0
        protected virtual bool _TryGetAllUIDMessages(out Pop3MessageUIDInfoCollection messageUIDInfo, out string errorMessage)
        {
            UIDL         command  = new UIDL();
            Pop3Response response = this.DoCommand(command);

            errorMessage = "";
            if (response.Type == EPop3ResponseType.OK)
            {
                messageUIDInfo = command.Messages;
                return(true);
            }
            messageUIDInfo = null;
            errorMessage   = response.Message;
            return(false);
        }
Example #2
0
        public virtual bool TryGetAllUIDMessages(out Pop3MessageUIDInfoCollection messageUIDInfo, out string errorMessage)
        {
            lock (this)
            {
                if (this.State != EPop3ClientState.Awaiting)
                {
                    messageUIDInfo = null;
                    errorMessage   = "Pop3Client doesn't allow executing multiple operations simulteneously in a few threads using one object";
                    return(false);
                }
                this.State = EPop3ClientState.Busy;
            }
            if (this.ConnectionState != EPop3ConnectionState.Authenticated)
            {
                messageUIDInfo = null;
                errorMessage   = "The command cannot be executed in this state";
                this.State     = EPop3ClientState.Awaiting;
                return(false);
            }
            bool flag = this._TryGetAllUIDMessages(out messageUIDInfo, out errorMessage);

            this.State = EPop3ClientState.Awaiting;
            return(flag);
        }