Esempio n. 1
0
        /// <summary>
        /// Raises <b>GetQuotaRoot</b> event.
        /// </summary>
        /// <param name="folder">Folder name with optional path.</param>
        /// <param name="response">Default IMAP server response.</param>
        /// <returns>Returns event args.</returns>
        private IMAP_e_GetQuotaRoot OnGetGuotaRoot(string folder,IMAP_r_ServerStatus response)
        {
            IMAP_e_GetQuotaRoot eArgs = new IMAP_e_GetQuotaRoot(folder,response);
            if(this.GetQuotaRoot != null){
                this.GetQuotaRoot(this,eArgs);
            }

            return eArgs;
        }
Esempio n. 2
0
        private void m_pImapServer_Session_GetQuotaRoot(object sender,IMAP_e_GetQuotaRoot e)
        {
            try{
                IMAP_Session ses = (IMAP_Session)sender;

                e.QuotaRootResponses.Add(new IMAP_r_u_QuotaRoot(e.Folder,new string[]{"root"}));

                foreach(DataRowView drv in m_pApi.GetUsers("ALL")){
                    if(drv["UserName"].ToString().ToLower() == ses.AuthenticatedUserIdentity.Name.ToLower()){
                        e.QuotaResponses.Add(new IMAP_r_u_Quota("root",new IMAP_Quota_Entry[]{
                            new IMAP_Quota_Entry("STORAGE",m_pApi.GetMailboxSize(ses.AuthenticatedUserIdentity.Name),(ConvertEx.ToInt32(drv["Mailbox_Size"]) * 1000 * 1000))
                        }));
                        break;
                    }
                }
            }
            catch(Exception x){
                e.Response = new IMAP_r_ServerStatus(e.Response.CommandTag,"NO","Error: " + x.Message);
            }
        }