Beispiel #1
0
        public bool UserLoad(bool others)
        {
            // reload user data
            ZIMapServer.Namespace ns = others ? server.NamespaceDataOther :
                                                server.NamespaceDataShared;
            //if(!ns.Valid) return false;

            // The "%" filter returns users even if they have in root mailbox!
            ZIMapApplication.MailBox[] users = application.Mailboxes(ns.Prefix, "%", 0, false);
            if(users == null) return false;

            if(!ns.Valid)
                MonitorInfo("Namespaces are disabled");
            // List of "other users", add current user
            else if(others)
            {   ZIMapApplication.MailBox[] oldu = users;
                users = new ZIMapApplication.MailBox[oldu.Length + 1];
                users[0].Name = server.NamespaceDataPersonal.Prefix + "INBOX";
                Array.Copy(oldu, 0, users, 1, oldu.Length);
            }
            // List of "shared folders", remove "user" folder and the current user
            else
                server.MailboxesFilter(ref users, ns.Index);

            server.MailboxSort(users);
            data.UpdateUsers(users, others);
            return true;
        }
Beispiel #2
0
        /// <summary>List subscribed mailboxes only</summary>
        public static bool ListSubscribed(CacheData.MBoxRef mailboxes,
                                          bool bDetail, bool bRights, bool bQuota)
        {
            if(mailboxes.IsNothing) return false;
            Cache.ListedFolders = mailboxes;

            // count subscriptions ...
            uint usub = 0;
            mailboxes.Reset();
            while(mailboxes.Next())
                if(mailboxes.Subscribed) usub++;
            if(usub == 0)
            {   Message(FormatFilter("No subscribed mailboxes"));
                return true;
            }

            // create subset ...
            if(usub != mailboxes.Count)
            {   ZIMapApplication.MailBox[] subs = new ZIMapApplication.MailBox[usub];
                usub = 0;
                mailboxes.Reset();
                while(mailboxes.Next())
                    if(mailboxes.Subscribed) subs[usub++] = mailboxes.Current;
                mailboxes = new CacheData.MBoxRef(subs);
            }

            return ListFolders(mailboxes, FormatFilter("Subscribed Mailboxes"),
                               false, bDetail, bRights, bQuota);
        }
Beispiel #3
0
 /// <summary>Remove one entry from the array.</summary>
 public bool Delete(MBoxRef mbox)
 {
     if(boxes == null || !mbox.IsValid) return false;
     uint index = mbox.Index;
     if(!object.ReferenceEquals(boxes, mbox.boxes)) index = Search(mbox.Name);
     if(length == 0 || index >= length) return false;
     ZIMapApplication.MailBox[] dest = new ZIMapApplication.MailBox[--length];
     if(index > 0) System.Array.Copy(boxes, dest, index);
     int tail = (int)(length - index);
     if(tail > 0) System.Array.Copy(boxes, index+1, dest, index, tail);
     boxes = dest;
     return true;
 }