public bool ListExists(string maillistName) { Tree config = AMSHelper.GetMailListsConfig(); AmsMailList amsList = new AmsMailList(maillistName); return(amsList.Load(config)); }
public MailList GetList(string maillistName) { Tree config = AMSHelper.GetMailListsConfig(); AmsMailList amsList = new AmsMailList(maillistName); if (amsList.Load(config)) { amsList.LoadListConfig(); return(amsList.ToMailList()); } return(null); }
public MailList[] GetLists(string domainName) { List <MailList> lists = new List <MailList>(); Tree config = AMSHelper.GetMailListsConfig(); AmsMailList[] amsLists = AmsMailList.GetMailLists(config, domainName); foreach (AmsMailList amsList in amsLists) { lists.Add(amsList.ToMailList()); } return(lists.ToArray()); }
public void CreateList(MailList maillist) { Tree config = AMSHelper.GetMailListsConfig(); AmsMailList amsList = new AmsMailList(maillist.Name); if (amsList.Load(config)) { throw new Exception("Mail list is already exists."); } amsList.Read(maillist); if (!amsList.Save(config)) { throw new Exception("Couldn't create a mail list."); } }
public void DeleteList(string maillistName) { Tree config = AMSHelper.GetMailListsConfig(); AmsMailList amsList = new AmsMailList(maillistName); if (amsList.Load(config)) { if (!amsList.Delete(config)) { throw new Exception("Couldn't delete a mail list."); } } else { throw new Exception("Couldn't find specified mail list."); } }
public void UpdateList(MailList maillist) { Tree config = AMSHelper.GetMailListsConfig(); AmsMailList amsList = new AmsMailList(maillist.Name); if (amsList.Load(config)) { amsList.LoadListConfig(); amsList.Read(maillist); if (!amsList.Save(config)) { throw new Exception("Couldn't update specified mail list."); } } else { throw new Exception("Couldn't find specified mail list."); } }
public static AmsMailList[] GetMailLists(Tree config, string domainName) { List <AmsMailList> list = new List <AmsMailList>(); foreach (TreeNode node in config.ChildNodes) { string user = node["user"]; string domain = node["domain"]; if (string.Compare(domain, domainName, true) == 0) { AmsMailList ml = new AmsMailList(string.Concat(user, "@", domain)); ml.Load(node); ml.LoadListConfig(); list.Add(ml); } } return(list.ToArray()); }
public void UpdateList(MailList maillist) { Tree config = AMSHelper.GetMailListsConfig(); AmsMailList amsList = new AmsMailList(maillist.Name); if (amsList.Load(config)) { amsList.LoadListConfig(); amsList.Read(maillist); if (!amsList.Save(config)) throw new Exception("Couldn't update specified mail list."); } else { throw new Exception("Couldn't find specified mail list."); } }
public bool ListExists(string maillistName) { Tree config = AMSHelper.GetMailListsConfig(); AmsMailList amsList = new AmsMailList(maillistName); return amsList.Load(config); }
public MailList GetList(string maillistName) { Tree config = AMSHelper.GetMailListsConfig(); AmsMailList amsList = new AmsMailList(maillistName); if (amsList.Load(config)) { amsList.LoadListConfig(); return amsList.ToMailList(); } return null; }
public void DeleteList(string maillistName) { Tree config = AMSHelper.GetMailListsConfig(); AmsMailList amsList = new AmsMailList(maillistName); if (amsList.Load(config)) { if (!amsList.Delete(config)) throw new Exception("Couldn't delete a mail list."); } else { throw new Exception("Couldn't find specified mail list."); } }
public void CreateList(MailList maillist) { Tree config = AMSHelper.GetMailListsConfig(); AmsMailList amsList = new AmsMailList(maillist.Name); if (amsList.Load(config)) throw new Exception("Mail list is already exists."); amsList.Read(maillist); if (!amsList.Save(config)) throw new Exception("Couldn't create a mail list."); }
public static AmsMailList[] GetMailLists(Tree config, string domainName) { List<AmsMailList> list = new List<AmsMailList>(); foreach(TreeNode node in config.ChildNodes) { string user = node["user"]; string domain = node["domain"]; if (string.Compare(domain, domainName, true) == 0) { AmsMailList ml = new AmsMailList(string.Concat(user, "@", domain)); ml.Load(node); ml.LoadListConfig(); list.Add(ml); } } return list.ToArray(); }