public UserFolder Add(string newFolder)
        {
            Guid.NewGuid().ToString();
            string text  = "";
            string text2 = newFolder;

            if (this.m_pFolder != null)
            {
                text  = this.m_pFolder.FolderFullPath;
                text2 = text + "/" + newFolder;
            }
            this.m_pUser.VirtualServer.Server.TCP_Client.TcpStream.WriteLine(string.Concat(new string[]
            {
                "AddUserFolder ",
                this.m_pUser.VirtualServer.VirtualServerID,
                " ",
                TextUtils.QuoteString(this.m_pUser.UserName),
                " ",
                TextUtils.QuoteString(text2)
            }));
            string text3 = this.m_pUser.VirtualServer.Server.ReadLine();

            if (!text3.ToUpper().StartsWith("+OK"))
            {
                throw new Exception(text3);
            }
            UserFolder userFolder = new UserFolder(this, this.m_pUser, this.m_pFolder, text, newFolder);

            this.m_pFolders.Add(userFolder);
            return(userFolder);
        }
Exemplo n.º 2
0
 internal UserFolderAcl(UserFolderAclCollection owner, UserFolder folder, string userOrGroup, IMAP_ACL_Flags permissions)
 {
     this.m_pOwner      = owner;
     this.m_pFolder     = folder;
     this.m_UserOrGroup = userOrGroup;
     this.m_Permissions = permissions;
 }
Exemplo n.º 3
0
 internal UserFolder(UserFolderCollection owner, User user, UserFolder parent, string folderPath, string folderName)
 {
     this.m_pOwner        = owner;
     this.m_pUser         = user;
     this.m_pParent       = parent;
     this.m_Path          = folderPath;
     this.m_FolderName    = folderName;
     this.m_pChildFolders = new UserFolderCollection(false, this, this.m_pUser);
 }
 internal UserFolderCollection(bool bind, UserFolder folder, User user)
 {
     this.m_pFolder  = folder;
     this.m_pUser    = user;
     this.m_pFolders = new List <UserFolder>();
     if (bind)
     {
         this.Bind();
     }
 }
 private void Bind()
 {
     lock (this.m_pUser.VirtualServer.Server.LockSynchronizer)
     {
         this.m_pUser.VirtualServer.Server.TCP_Client.TcpStream.WriteLine("GetUserFolders " + this.m_pUser.VirtualServer.VirtualServerID + " " + this.m_pUser.UserID);
         string text = this.m_pUser.VirtualServer.Server.ReadLine();
         if (!text.ToUpper().StartsWith("+OK"))
         {
             throw new Exception(text);
         }
         int num = Convert.ToInt32(text.Split(new char[]
         {
             ' '
         }, 2)[1]);
         MemoryStream memoryStream = new MemoryStream();
         this.m_pUser.VirtualServer.Server.TCP_Client.TcpStream.ReadFixedCount(memoryStream, (long)num);
         DataSet dataSet = Utils.DecompressDataSet(memoryStream);
         if (dataSet.Tables.Contains("Folders"))
         {
             foreach (DataRow dataRow in dataSet.Tables["Folders"].Rows)
             {
                 string[] array = dataRow["Folder"].ToString().Split(new char[]
                 {
                     '/'
                 });
                 UserFolderCollection userFolderCollection = this;
                 string   text2  = "";
                 string[] array2 = array;
                 for (int i = 0; i < array2.Length; i++)
                 {
                     string text3 = array2[i];
                     if (!userFolderCollection.Contains(text3))
                     {
                         UserFolder item = new UserFolder(userFolderCollection, this.m_pUser, userFolderCollection.Parent, text2, text3);
                         userFolderCollection.List.Add(item);
                     }
                     userFolderCollection = userFolderCollection[text3].ChildFolders;
                     if (text2 == "")
                     {
                         text2 = text3;
                     }
                     else
                     {
                         text2 = text2 + "/" + text3;
                     }
                 }
             }
         }
     }
 }
        public void Remove(UserFolder folder)
        {
            Guid.NewGuid().ToString();
            this.m_pUser.VirtualServer.Server.TCP_Client.TcpStream.WriteLine(string.Concat(new string[]
            {
                "DeleteUserFolder ",
                this.m_pUser.VirtualServer.VirtualServerID,
                " ",
                TextUtils.QuoteString(this.m_pUser.UserName),
                " ",
                TextUtils.QuoteString(folder.FolderFullPath)
            }));
            string text = this.m_pUser.VirtualServer.Server.ReadLine();

            if (!text.ToUpper().StartsWith("+OK"))
            {
                throw new Exception(text);
            }
            this.m_pFolders.Remove(folder);
        }
Exemplo n.º 7
0
 internal UserFolderAclCollection(UserFolder folder)
 {
     this.m_pFolder     = folder;
     this.m_pAclEntries = new List <UserFolderAcl>();
     this.Bind();
 }