Ejemplo n.º 1
0
        protected override void OnDataResponseReceived(ImapDataResponse data)
        {
            if (data.Type == ImapDataResponseType.Flags)
            selectingMailbox.ApplicableFlags = ImapDataResponseConverter.FromFlags(data);
              if (data.Type == ImapDataResponseType.Exists)
            selectingMailbox.ExistsMessage = ImapDataResponseConverter.FromExists(data);
              else if (data.Type == ImapDataResponseType.Recent)
            selectingMailbox.RecentMessage = ImapDataResponseConverter.FromRecent(data);

              base.OnDataResponseReceived(data);
        }
Ejemplo n.º 2
0
 protected override void OnDataResponseReceived(ImapDataResponse data)
 {
     FinishError(ImapCommandResultCode.ResponseError, "unexpected data response");
 }
Ejemplo n.º 3
0
        /// <summary>sends generic/undefined command</summary>
        public ImapCommandResult GenericCommand(string command, out ImapDataResponse[] dataResponses, params ImapString[] arguments)
        {
            RejectNonConnectedState();

              if (command == null)
            throw new ArgumentNullException("command");
              else if (command.Length == 0)
            throw new ArgumentException("command must be a non-empty string", "command");

              dataResponses = null;

              using (var t = new GenericCommandTransaction(connection, command)) {
            if (arguments != null && 0 < arguments.Length)
              t.RequestArguments["arguments"] = new ImapStringList(arguments);

            if (ProcessTransaction(t).Succeeded)
              dataResponses = t.Result.Value;

            return t.Result;
              }
        }
Ejemplo n.º 4
0
        protected override void OnDataResponseReceived(ImapDataResponse data)
        {
            // 3. Specification
              //   IDLE Command
              //   The IDLE command remains active until the client
              //   responds to the continuation, and as long as an IDLE command is
              //   active, the server is now free to send untagged EXISTS, EXPUNGE, and
              //   other messages at any time
              if (keepIdleCallback != null) {
            var updatedStatus = ImapUpdatedStatus.CreateFrom(data);

            if (updatedStatus != null && !keepIdleCallback(keepIdleState, updatedStatus))
              Done();
              }

              base.OnDataResponseReceived(data);
        }
Ejemplo n.º 5
0
        public static ImapUpdatedStatus CreateFrom(ImapDataResponse data)
        {
            if (data == null)
            throw new ArgumentNullException("data");

              if (data.Type == ImapDataResponseType.Fetch)
            return new ImapUpdatedStatus(null, ImapDataResponseConverter.FromFetch<ImapMessageDynamicAttribute>(data), null, null, null);
              else if (data.Type == ImapDataResponseType.Expunge)
            return new ImapUpdatedStatus(null, null, ImapDataResponseConverter.FromExpunge(data), null, null);
              else if (data.Type == ImapDataResponseType.Exists)
            return new ImapUpdatedStatus(null, null, null, ImapDataResponseConverter.FromExists(data), null);
              else if (data.Type == ImapDataResponseType.Recent)
            return new ImapUpdatedStatus(null, null, null, null, ImapDataResponseConverter.FromRecent(data));
              else if (data.Type == ImapDataResponseType.Flags)
            return new ImapUpdatedStatus(ImapDataResponseConverter.FromFlags(data), null, null, null, null);
              else
            return null;
        }