Example #1
0
        protected virtual bool _TryGetMessageInfo(uint number, out Pop3MessageInfo messageInfo, out string errorMessage)
        {
            errorMessage = "";
            LIST         command  = new LIST(number);
            Pop3Response response = this.DoCommand(command);

            if (command.Messages.Count > 0)
            {
                messageInfo = command.Messages[0];
            }
            else
            {
                errorMessage = response.Message;
                messageInfo  = null;
            }
            return(response.Type == EPop3ResponseType.OK);
        }
Example #2
0
        public virtual bool TryGetMessageInfo(uint number, out Pop3MessageInfo messageInfo, out string errorMessage)
        {
            lock (this)
            {
                if (this.State != EPop3ClientState.Awaiting)
                {
                    messageInfo  = 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)
            {
                messageInfo  = null;
                errorMessage = "The command cannot be executed in this state";
                this.State   = EPop3ClientState.Awaiting;
                return(false);
            }
            bool flag = this._TryGetMessageInfo(number, out messageInfo, out errorMessage);

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