public void UpdateGroup(MailGroup group) { Tree config = AMSHelper.GetUsersConfig(); AmsMailbox amsGroup = new AmsMailbox(group.Name); if (amsGroup.Load(config)) { amsGroup.LoadAccountConfig(); amsGroup.Read(group); if (!amsGroup.Save(config)) { throw new Exception("Couldn't update specified mail group."); } } else { throw new Exception("Couldn't find specified mail group."); } }
public void UpdateAccount(MailAccount mailbox) { Tree config = AMSHelper.GetUsersConfig(); AmsMailbox amsMailbox = new AmsMailbox(mailbox.Name); if (amsMailbox.Load(config)) { amsMailbox.LoadAccountConfig(); amsMailbox.Read(mailbox); if (!amsMailbox.Save(config)) { throw new Exception("Couldn't update specified mailbox."); } } else { throw new Exception("Couldn't find specified mailbox."); } }
public static AmsMailbox[] GetMailGroups(Tree config, string domainName) { List <AmsMailbox> groups = new List <AmsMailbox>(); foreach (TreeNode node in config.ChildNodes) { string account = node["user"]; string amsDomain = node["domain"]; if (string.Compare(amsDomain, domainName, true) == 0) { AmsMailbox mb = new AmsMailbox(string.Concat(account, "@", amsDomain)); mb.Load(node); mb.LoadAccountConfig(); if (mb.IsMailGroup()) { groups.Add(mb); } } } return(groups.ToArray()); }
public static AmsMailbox[] GetMailGroups(Tree config, string domainName) { List<AmsMailbox> groups = new List<AmsMailbox>(); foreach (TreeNode node in config.ChildNodes) { string account = node["user"]; string amsDomain = node["domain"]; if (string.Compare(amsDomain, domainName, true) == 0) { AmsMailbox mb = new AmsMailbox(string.Concat(account, "@", amsDomain)); mb.Load(node); mb.LoadAccountConfig(); if (mb.IsMailGroup()) groups.Add(mb); } } return groups.ToArray(); }
public void UpdateGroup(MailGroup group) { Tree config = AMSHelper.GetUsersConfig(); AmsMailbox amsGroup = new AmsMailbox(group.Name); if (amsGroup.Load(config)) { amsGroup.LoadAccountConfig(); amsGroup.Read(group); if (!amsGroup.Save(config)) throw new Exception("Couldn't update specified mail group."); } else { throw new Exception("Couldn't find specified mail group."); } }
public void UpdateAccount(MailAccount mailbox) { Tree config = AMSHelper.GetUsersConfig(); AmsMailbox amsMailbox = new AmsMailbox(mailbox.Name); if (amsMailbox.Load(config)) { amsMailbox.LoadAccountConfig(); amsMailbox.Read(mailbox); if (!amsMailbox.Save(config)) throw new Exception("Couldn't update specified mailbox."); } else { throw new Exception("Couldn't find specified mailbox."); } }
public bool GroupExists(string groupName) { Tree config = AMSHelper.GetUsersConfig(); AmsMailbox amsGroup = new AmsMailbox(groupName); if (amsGroup.Load(config)) { amsGroup.LoadAccountConfig(); return amsGroup.IsMailGroup(); } return false; }
public MailGroup GetGroup(string groupName) { Tree config = AMSHelper.GetUsersConfig(); AmsMailbox amsGroup = new AmsMailbox(groupName); if (amsGroup.Load(config)) { amsGroup.LoadAccountConfig(); return amsGroup.ToMailGroup(); } return null; }
public MailAccount GetAccount(string mailboxName) { Tree config = AMSHelper.GetUsersConfig(); AmsMailbox amsMailbox = new AmsMailbox(mailboxName); if (amsMailbox.Load(config)) { amsMailbox.LoadAccountConfig(); return amsMailbox.ToMailAccount(); } return null; }