コード例 #1
0
        /// <summary>
        /// Create a new ChangeFlag command
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="flag"></param>
        /// <param name="value"></param>
        /// <param name="callback"></param>
        public ChangeFlagCommand(IMessage msg, MessageFlag flag, bool value, CommandDataReceivedCallback callback)
            : base(callback)
        {
            //  UID STORE 4963 -FLAGS (\Seen)
            const string cmd = "UID STORE {0} {1}FLAGS (\\{2})";
            _parameters.Add(msg.UID.ToString());
            _parameters.Add(value ? "+":"-");
            _parameters.Add(flag.ToString());
            _parameterObjs.Add(msg);

            CommandString = String.Format(cmd, Parameters);
        }
コード例 #2
0
        /// <summary>
        /// Create a new ChangeFlag command
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="flag"></param>
        /// <param name="value"></param>
        /// <param name="callback"></param>
        public ChangeFlagCommand(IMessage msg, MessageFlag flag, bool value, CommandDataReceivedCallback callback)
            : base(callback)
        {
            //  UID STORE 4963 -FLAGS (\Seen)
            const string cmd = "UID STORE {0} {1}FLAGS (\\{2})";

            _parameters.Add(msg.UID.ToString());
            _parameters.Add(value ? "+":"-");
            _parameters.Add(flag.ToString());
            _parameterObjs.Add(msg);

            CommandString = String.Format(cmd, Parameters);
        }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="flag"></param>
        /// <param name="value"></param>
        /// <param name="localOnly">Indicates if the flag should be set only on the local object, and not on the server</param>
        public bool SetMessageFlag(IMessage msg, MessageFlag flag, bool value, bool localOnly)
        {
            bool currentValue = _client.DataManager.GetValue <Message, bool>((Message)msg, flag.ToString());

            if (currentValue == value)
            {
                return(true);
            }
            _client.DataManager.SetValue(msg, flag.ToString(), value);
            if (localOnly)
            {
                return(true);
            }
            ChangeFlagRequest cfr = new ChangeFlagRequest(msg, flag, value, null);

            _client.RequestManager.SubmitRequest(cfr, true);

            return(cfr.Result.Response == IMAPResponse.IMAP_SUCCESS_RESPONSE);
        }
コード例 #4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="flag"></param>
        /// <param name="value"></param>
        /// <param name="localOnly">Indicates if the flag should be set only on the local object, and not on the server</param>
        public bool SetMessageFlag(IMessage msg, MessageFlag flag, bool value, bool localOnly)
        {
            bool currentValue = _client.DataManager.GetValue<Message, bool>((Message)msg, flag.ToString());
            if (currentValue == value) return true;
            _client.DataManager.SetValue(msg, flag.ToString(), value);
            if (localOnly) return true;
            ChangeFlagRequest cfr = new ChangeFlagRequest(msg, flag, value, null);
            _client.RequestManager.SubmitRequest(cfr, true);

            return cfr.Result.Response == IMAPResponse.IMAP_SUCCESS_RESPONSE;
        }
コード例 #5
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="msg"></param>
 /// <param name="flag"></param>
 /// <param name="value"></param>
 /// <param name="localOnly">Indicates if the flag should be set only on the local object, and not on the server</param>
 public void SetMessageFlag(IMessage msg, MessageFlag flag, bool value, bool localOnly)
 {
     bool currentValue = _client.DataManager.GetValue<Message, bool>((Message)msg, flag.ToString());
     if (currentValue == value) return;
     _client.DataManager.SetValue(msg, flag.ToString(), value);
     if (localOnly) return;
     ChangeFlagRequest cfr = new ChangeFlagRequest(msg, flag, value, null);
     _client.RequestManager.SubmitRequest(cfr, true);
 }