Esempio n. 1
0
 public cResponseDataFetch(uint pMSN, fMessageCacheAttributes pAttributes, cFetchableFlags pFlags, cEnvelope pEnvelope, DateTime?pReceived, IList <byte> pRFC822, IList <byte> pRFC822Header, IList <byte> pRFC822Text, uint?pSize, cBodyPart pBody, cBodyPart pBodyStructure, IList <cBody> pBodies, uint?pUID, cHeaderFields pHeaderFields, IDictionary <string, uint> pBinarySizes, ulong?pModSeq)
 {
     MSN           = pMSN;
     Attributes    = pAttributes;
     Flags         = pFlags;
     Envelope      = pEnvelope;
     Received      = pReceived;
     RFC822        = pRFC822 == null ? null : new cBytes(pRFC822);
     RFC822Header  = pRFC822Header == null ? null : new cBytes(pRFC822Header);
     RFC822Text    = pRFC822Text == null ? null : new cBytes(pRFC822Text);
     Size          = pSize;
     Body          = pBody;
     BodyStructure = pBodyStructure;
     Bodies        = new ReadOnlyCollection <cBody>(pBodies);
     UID           = pUID;
     HeaderFields  = pHeaderFields;
     BinarySizes   = new cBinarySizes(pBinarySizes);
     ModSeq        = pModSeq;
 }
Esempio n. 2
0
                public void Update(cResponseDataFetch lFetch, out fMessageCacheAttributes rAttributesSet, out fMessageProperties rPropertiesChanged)
                {
                    rAttributesSet     = ~mAttributes & lFetch.Attributes;
                    rPropertiesChanged = 0;

                    if ((rAttributesSet & fMessageCacheAttributes.flags) != 0)
                    {
                        Flags = lFetch.Flags;
                    }
                    else if (lFetch.Flags != null)
                    {
                        foreach (var lFlag in Flags.SymmetricDifference(lFetch.Flags))
                        {
                            rAttributesSet     |= fMessageCacheAttributes.flags;
                            rPropertiesChanged |= fMessageProperties.flags | LMessageProperty(lFlag);
                        }

                        Flags = lFetch.Flags;
                    }

                    if ((rAttributesSet & fMessageCacheAttributes.envelope) != 0)
                    {
                        Envelope = lFetch.Envelope;
                    }
                    if ((rAttributesSet & fMessageCacheAttributes.received) != 0)
                    {
                        Received = lFetch.Received;
                    }
                    if ((rAttributesSet & fMessageCacheAttributes.size) != 0)
                    {
                        Size = lFetch.Size;
                    }
                    if ((rAttributesSet & fMessageCacheAttributes.body) != 0)
                    {
                        mBody = lFetch.Body;
                    }
                    if ((rAttributesSet & fMessageCacheAttributes.bodystructure) != 0)
                    {
                        BodyStructure = lFetch.BodyStructure;
                    }
                    if ((rAttributesSet & fMessageCacheAttributes.uid) != 0 && mMessageCache.UIDValidity != 0)
                    {
                        UID = new cUID(mMessageCache.UIDValidity, lFetch.UID.Value);
                    }

                    if (!mMessageCache.NoModSeq)
                    {
                        if ((rAttributesSet & fMessageCacheAttributes.modseq) != 0)
                        {
                            mModSeq = lFetch.ModSeq;
                        }
                        else if (lFetch.ModSeq != null && lFetch.ModSeq != mModSeq)
                        {
                            rAttributesSet     |= fMessageCacheAttributes.modseq;
                            rPropertiesChanged |= fMessageProperties.modseq;
                            mModSeq             = lFetch.ModSeq;
                        }
                    }

                    HeaderFields += lFetch.HeaderFields;
                    BinarySizes  += lFetch.BinarySizes;

                    mAttributes |= lFetch.Attributes;

                    fMessageProperties LMessageProperty(string pFlag)
                    {
                        if (pFlag.Equals(kMessageFlag.Answered, StringComparison.InvariantCultureIgnoreCase))
                        {
                            return(fMessageProperties.answered);
                        }
                        if (pFlag.Equals(kMessageFlag.Flagged, StringComparison.InvariantCultureIgnoreCase))
                        {
                            return(fMessageProperties.flagged);
                        }
                        if (pFlag.Equals(kMessageFlag.Deleted, StringComparison.InvariantCultureIgnoreCase))
                        {
                            return(fMessageProperties.deleted);
                        }
                        if (pFlag.Equals(kMessageFlag.Seen, StringComparison.InvariantCultureIgnoreCase))
                        {
                            return(fMessageProperties.seen);
                        }
                        if (pFlag.Equals(kMessageFlag.Draft, StringComparison.InvariantCultureIgnoreCase))
                        {
                            return(fMessageProperties.draft);
                        }
                        if (pFlag.Equals(kMessageFlag.Recent, StringComparison.InvariantCultureIgnoreCase))
                        {
                            return(fMessageProperties.recent);
                        }
                        // see comments elsewhere as to why this is commented out
                        //if (pFlag.Equals(kMessageFlagName.MDNSent, StringComparison.InvariantCultureIgnoreCase)) return fMessageProperties.mdnsent;
                        if (pFlag.Equals(kMessageFlag.Forwarded, StringComparison.InvariantCultureIgnoreCase))
                        {
                            return(fMessageProperties.forwarded);
                        }
                        if (pFlag.Equals(kMessageFlag.SubmitPending, StringComparison.InvariantCultureIgnoreCase))
                        {
                            return(fMessageProperties.submitpending);
                        }
                        if (pFlag.Equals(kMessageFlag.Submitted, StringComparison.InvariantCultureIgnoreCase))
                        {
                            return(fMessageProperties.submitted);
                        }
                        return(0);
                    }
                }