Beispiel #1
0
        public bool CommandFlag(uint[] items, bool useUID, bool bSet, bool bDeleted, 
                                bool bSeen, bool bFlagged, string[] custom)
        {
            if(items == null || items.Length < 1 || data.Current.IsNothing)
            {   MonitorError("No matching mail found");
                return false;
            }
            progress.Update(0);
            data.Current.Reset();

            // make sure that our current mailbox is open ...
            if(!data.Current.Open(application, false))
                return false;                       // could not reopen
            data.Clear(Info.Details|Info.Headers);  // message count, flags changed
            progress.Update(20);

            using(ZIMapCommand.Store cmd = new ZIMapCommand.Store(factory))
            {   if(cmd == null) return false;
                cmd.UidCommand = useUID;

                cmd.AddSequence(items);
                cmd.AddDirect(bSet ? "+FLAGS.SILENT" : "-FLAGS.SILENT");
                cmd.AddBeginList();
                if(bDeleted) cmd.AddDirect("\\Deleted");
                if(bSeen)    cmd.AddDirect("\\Seen");
                if(bFlagged) cmd.AddDirect("\\Flagged");
                if(custom != null)
                    foreach(string cust in custom) cmd.AddName(cust);
                cmd.Queue();
                progress.Update(30);
                bool bok = cmd.CheckSuccess(":");
                progress.Done();
                return bok;
            }
        }
        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;
        }