/// <summary> /// Raises <b>GetQuota</b> event. /// </summary> /// <param name="quotaRoot">Quota root name.</param> /// <param name="response">Default IMAP server response.</param> /// <returns>Returns event args.</returns> private IMAP_e_GetQuota OnGetQuota(string quotaRoot,IMAP_r_ServerStatus response) { IMAP_e_GetQuota eArgs = new IMAP_e_GetQuota(quotaRoot,response); if(this.GetQuota != null){ this.GetQuota(this,eArgs); } return eArgs; }
private void m_pImapServer_Session_GetQuota(object sender,IMAP_e_GetQuota e) { try{ IMAP_Session ses = (IMAP_Session)sender; 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(e.QuotaRoot,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); } }