Beispiel #1
0
        public uint CommandExpunge()
        {
            // make sure that our current mailbox is open ...
            progress.Update(0);
            if(!data.Current.Open(application, false))
                return uint.MaxValue;                   // could not reopen

            using(ZIMapCommand.Expunge exp = new ZIMapCommand.Expunge(factory))
            {   if(exp == null) return uint.MaxValue;

                exp.Queue();
                progress.Update(30);
                if(!exp.CheckSuccess(":")) return uint.MaxValue;
                uint[] expu = exp.Expunged;
                if(expu == null) return 0;
                uint cnt = (uint)expu.Length;
                if(cnt > 0)                             // message count changes
                    data.Clear(Info.Headers|Info.Details);
                progress.Done();
                return cnt;
            }
        }
        public uint MailDelete(uint[] items, bool expunge)
        {
            if(items == null)     return 0;
            if(items.Length <= 0) return 0;

            ZIMapCommand.Store store = new ZIMapCommand.Store(factory);
            ZIMapCommand disp = store;
            if(store == null)     return 0;
            store.UidCommand = enableUid;

            bool bok = store.Queue(items, "+FLAGS (/Deleted)");
            uint count = 0;
            if(bok && expunge)
            {   ZIMapCommand.Expunge expu = new ZIMapCommand.Expunge(factory);
                if(expu != null)
                {   uint[] resu = expu.Expunged;
                    if(resu != null) count = (uint)resu.Length;
                    disp = expu;
                }
            }
            disp.Dispose();
            return count;
        }