コード例 #1
0
ファイル: Items.cs プロジェクト: BackupTheBerlios/zimap
 /*
 protected void UpdateHeaders(ZIMapApplication.MailInfo[] headers)
 {   this.headers = new MailRef(headers, "-");
 */
 protected void UpdateHeaders(MailRef headers)
 {
     this.headers = headers;
     info |= Info.Headers;
     headersTime = Second();
 }
コード例 #2
0
ファイル: Cache.cs プロジェクト: BackupTheBerlios/zimap
        public bool HeadersSort(MailRef headers, string field, bool reverse)
        {
            if(headers.IsNothing) return false;
            uint ulen = headers.Count;
            if(ulen == 0) return true;

            // no sort, do reverse?
            if(string.IsNullOrEmpty(field))
            {   if(reverse) Array.Reverse(headers.Array(0));
                return true;
            }

            // check the field name ...
            ZIMapMessage mail = null;
            switch(field)
            {   case "size":
                case "flags":
                case "id":
                case "uid":     break;                      // no mail parsing
                case "to":
                case "from":
                case "subject":
                case "date":    mail = new ZIMapMessage();  // must parse mail
                                break;
                default:        return false;               // bad field
            }

            // build sort array ...
            object[] keys = new object[ulen];
            for(uint urun=0; urun < ulen; urun++)
            {   // TODO: should use an iterator or Next()
                ZIMapApplication.MailInfo info = headers.Array(0)[urun];
                if(mail != null)
                {   progress.Update(urun, ulen);

                    mail.Parse(info.Literal, true);
                }
                switch(field)
                {   case "size":    keys[urun] = info.Size; break;
                    case "flags":   keys[urun] = string.Join(" ", info.Flags); break;
                    case "id":      keys[urun] = info.Index; break;
                    case "uid":     keys[urun] = info.UID; break;
                    case "to":      keys[urun] = mail.To; break;
                    case "from":    keys[urun] = mail.From; break;
                    case "subject": keys[urun] = mail.Subject; break;
                    case "date":    keys[urun] = mail.DateBinary; break;
                 }
            }

            // TODO: should use a sort method, this code is wrong!
            Array.Sort(keys, headers.Array(0));
            if(reverse) Array.Reverse(headers.Array(0));
            return true;
        }
コード例 #3
0
ファイル: Items.cs プロジェクト: BackupTheBerlios/zimap
            /// <summary>
            /// Clear cached data.
            /// </summary>
            /// <remarks>
            /// The method does not clear or close the current mailbox.
            /// </remarks>
            public bool Clear(Info what)
            {
                //if((what & (Info.Quota | Info.Rights)) != 0)
                //    what |= (Info.Details | Info.Quota | Info.Rights);

                if((what & Info.Details) != 0) info &= ~Info.Details;
                if((what & Info.Quota)   != 0) info &= ~Info.Quota;
                if((what & Info.Rights)  != 0) info &= ~Info.Rights;

                if((what & Info.Folders) != 0)
                {   boxes = MBoxRef.Nothing; boxesTime = 0;
                    info &= ~(Info.Folders | Info.Details | Info.Quota | Info.Rights);
                }
                if((what & (Info.Others | Info.Shared)) != 0)
                {   users = MBoxRef.Nothing; usersTime = 0;
                    info &= ~(Info.Others | Info.Shared);
                }
                if((what & Info.Headers) != 0)
                {   headers = MailRef.Nothing; headersTime = 0;
                    info &= ~(Info.Headers);
                }
                return false;
            }