public IMAP_Search_Key_Uid(IMAP_SequenceSet seqSet) { if(seqSet == null){ throw new ArgumentNullException("seqSet"); } m_pSeqSet = IMAP_t_SeqSet.Parse(seqSet.ToSequenceSetString()); }
/// <summary> /// Default constructor. /// </summary> /// <param name="seqSet">IMAP sequence-set.</param> /// <exception cref="ArgumentNullException">Is raised when <b>seqSet</b> is null reference.</exception> public IMAP_Search_Key_Uid(IMAP_t_SeqSet seqSet) { if(seqSet == null){ throw new ArgumentNullException("seqSet"); } m_pSeqSet = seqSet; }
/// <summary> /// Default constructor. /// </summary> /// <param name="targetMailboxUid">Target folde UID value.</param> /// <param name="sourceSeqSet">Source messages UID's.</param> /// <param name="targetSeqSet">Target messages UID's.</param> /// <exception cref="ArgumentNullException">Is raised when <b>sourceSeqSet</b> or <b>targetSeqSet</b> is null reference.</exception> public IMAP_t_orc_CopyUid(long targetMailboxUid,IMAP_t_SeqSet sourceSeqSet,IMAP_t_SeqSet targetSeqSet) { if(sourceSeqSet == null){ throw new ArgumentNullException("sourceSeqSet"); } if(targetSeqSet == null){ throw new ArgumentNullException("targetSeqSet"); } m_TargetMailboxUid = targetMailboxUid; m_pSourceSeqSet = sourceSeqSet; m_pTargetSeqSet = targetSeqSet; }
/// <summary> /// Parses <b>sequense-set</b> from string. /// </summary> /// <param name="value">Sequence-set string.</param> /// <returns>Returns parse sequence set.</returns> /// <exception cref="ArgumentNullException">Is raised when <b>value</b> is null reference.</exception> public static IMAP_t_SeqSet Parse(string value) { if(value == null){ throw new ArgumentNullException("value"); } /* RFC 3501 seq-number = nz-number / "*" ; message sequence number (COPY, FETCH, STORE ; commands) or unique identifier (UID COPY, ; UID FETCH, UID STORE commands). ; * represents the largest number in use. In ; the case of message sequence numbers, it is ; the number of messages in a non-empty mailbox. ; In the case of unique identifiers, it is the ; unique identifier of the last message in the ; mailbox or, if the mailbox is empty, the ; mailbox's current UIDNEXT value. ; The server should respond with a tagged BAD ; response to a command that uses a message ; sequence number greater than the number of ; messages in the selected mailbox. This ; includes "*" if the selected mailbox is empty. seq-range = seq-number ":" seq-number ; two seq-number values and all values between ; these two regardless of order. ; Example: 2:4 and 4:2 are equivalent and indicate ; values 2, 3, and 4. ; Example: a unique identifier sequence range of ; 3291:* includes the UID of the last message in ; the mailbox, even if that value is less than 3291. sequence-set = (seq-number / seq-range) *("," sequence-set) ; set of seq-number values, regardless of order. ; Servers MAY coalesce overlaps and/or execute the ; sequence in any order. ; Example: a message sequence number set of ; 2,4:7,9,12:* for a mailbox with 15 messages is ; equivalent to 2,4,5,6,7,9,12,13,14,15 ; Example: a message sequence number set of *:4,5:7 ; for a mailbox with 10 messages is equivalent to ; 10,9,8,7,6,5,4,5,6,7 and MAY be reordered and ; overlap coalesced to be 4,5,6,7,8,9,10. */ long seqMaxValue = long.MaxValue; IMAP_t_SeqSet retVal = new IMAP_t_SeqSet(); //--- Validate sequence-set --------------------------------------------------------// string[] sequenceSets = value.Trim().Split(','); foreach(string sequenceSet in sequenceSets){ // seq-range if(sequenceSet.IndexOf(":") > -1){ string[] rangeParts = sequenceSet.Split(':'); if(rangeParts.Length == 2){ long start = retVal.Parse_Seq_Number(rangeParts[0],seqMaxValue); long end = retVal.Parse_Seq_Number(rangeParts[1],seqMaxValue); if(start <= end){ retVal.m_pSequenceParts.Add(new Range_long(start,end)); } else{ retVal.m_pSequenceParts.Add(new Range_long(end,start)); } } else{ throw new Exception("Invalid <seq-range> '" + sequenceSet + "' value !"); } } // seq-number else{ retVal.m_pSequenceParts.Add(new Range_long(retVal.Parse_Seq_Number(sequenceSet,seqMaxValue))); } } //-----------------------------------------------------------------------------------// retVal.m_SequenceString = value; return retVal; }