예제 #1
0
        public bool ListExists(string maillistName)
        {
            Tree        config  = AMSHelper.GetMailListsConfig();
            AmsMailList amsList = new AmsMailList(maillistName);

            return(amsList.Load(config));
        }
예제 #2
0
        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);
        }
예제 #3
0
        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());
        }
예제 #4
0
        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.");
            }
        }
예제 #5
0
        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.");
            }
        }
예제 #6
0
        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.");
            }
        }
예제 #7
0
        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());
        }
예제 #8
0
		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.");
			}
		}
예제 #9
0
		public bool ListExists(string maillistName)
		{
			Tree config = AMSHelper.GetMailListsConfig();
			AmsMailList amsList = new AmsMailList(maillistName);

			return amsList.Load(config);
		}
예제 #10
0
		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;
		}
예제 #11
0
		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.");
			}
		}
예제 #12
0
		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.");
		}
예제 #13
0
		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();
		}