Exemple #1
0
        public MlCreator2(MlAddr mlAddr,List<string>docs)
        {
            this.mlAddr = mlAddr;
            this.docs = docs;

            //this.mlOption = mlOption;
        }
Exemple #2
0
        public Ml(Kernel kernel, Logger logger, MailSave mailSave, MlOption mlOption, string mlName, List <string> domainList)
        {
            Status = false;

            _kernel = kernel;
            _logger = logger;
            _mlName = mlName;
            //_mlOption = mlOption;

            _mlMailDb = new MlMailDb(logger, mlOption.ManageDir, mlName);
            if (!_mlMailDb.Status)
            {
                return;//初期化中断
            }

            _mlAddr     = new MlAddr(mlName, domainList);
            _mlUserList = new MlUserList(mlOption.MemberList);
            _mlSender   = new MlSender(mailSave, logger);
            var mlSubject = new MlSubject(mlOption.TitleKind, mlName);

            _mlDevivery       = new MlDelivery(mailSave, logger, _mlUserList, _mlAddr, _mlMailDb, mlSubject, mlOption.Docs, mlOption.MaxGet);
            _mlCreator2       = new MlCreator(_mlAddr, mlOption.Docs);
            _autoRegistration = mlOption.AutoRegistration;
            const double effectiveMsec = 120 * 1000;                                       //有効時間120秒

            _mlSubscribeDb = new MlSubscribeDb(mlOption.ManageDir, mlName, effectiveMsec); //confirm文字列データベース
            if (!_mlMailDb.Status)
            {
                return;    //初期化中断
            }
            Status = true; //ステータス
        }
Exemple #3
0
        public Ml(Kernel kernel, Logger logger, MailSave mailSave, MlOption mlOption,string mlName,List<string>domainList)
        {
            Status = false;

            _kernel = kernel;
            _logger = logger;
            _mlName = mlName;
            //_mlOption = mlOption;

            _mlMailDb = new MlMailDb(logger, mlOption.ManageDir, mlName);
            if (!_mlMailDb.Status) {
                return;//初期化中断
            }

            _mlAddr = new MlAddr(mlName, domainList);
            _mlUserList = new MlUserList(mlOption.MemberList);
            _mlSender = new MlSender(mailSave, logger);
            var mlSubject = new MlSubject(mlOption.TitleKind, mlName);
            _mlDevivery = new MlDelivery(mailSave, logger,_mlUserList, _mlAddr, _mlMailDb, mlSubject, mlOption.Docs,mlOption.MaxGet);
            _mlCreator2 = new MlCreator(_mlAddr,mlOption.Docs);
            _autoRegistration = mlOption.AutoRegistration;
            const double effectiveMsec = 120 * 1000; //有効時間120秒
            _mlSubscribeDb = new MlSubscribeDb(mlOption.ManageDir, mlName, effectiveMsec);//confirm文字列データベース
            if (!_mlMailDb.Status) {
                return;//初期化中断
            }
            Status = true;//ステータス
        }
Exemple #4
0
        public MlCreator2(MlAddr mlAddr, List <string> docs)
        {
            this.mlAddr = mlAddr;
            this.docs   = docs;

            //this.mlOption = mlOption;
        }
Exemple #5
0
 static public string ConvertAddr(string str, MlAddr mlAddr)
 {
     str = Util.SwapStr("$ML_NAME", mlAddr.Name, str);
     str = Util.SwapStr("$POST_ADDR", mlAddr.Post.ToString(), str);
     str = Util.SwapStr("$CTRL_ADDR", mlAddr.Ctrl.ToString(), str);
     str = Util.SwapStr("$ADMIN_ADDR", mlAddr.Admin.ToString(), str);
     return(str);
 }
Exemple #6
0
 public MlDoc(List<string> docs, MlAddr mlAddr)
 {
     foreach (var s in docs) {
         var buf = Util.SwapStr("$ML_NAME", mlAddr.Name, s);
         buf = Util.SwapStr("$POST_ADDR", mlAddr.Post.ToString(), buf);
         buf = Util.SwapStr("$CTRL_ADDR", mlAddr.Ctrl.ToString(), buf);
         buf = Util.SwapStr("$ADMIN_ADDR", mlAddr.Admin.ToString(), buf);
         ar.Add(buf);
     }
 }
Exemple #7
0
 public MlDelivery(MailSave mailSave, Logger logger, MlUserList mlUserList, MlAddr mlAddr, MlMailDb mlDb, MlSubject mlSubject, List <string> docs, int maxGet)
 {
     _mlUserList = mlUserList;
     _mlAddr     = mlAddr;
     _logger     = logger;
     _mlDb       = mlDb;
     _mlSubject  = mlSubject;
     _docs       = docs;
     _maxGet     = maxGet;
     _mlSender   = new MlSender(mailSave, logger);
 }
Exemple #8
0
 public MlDoc(List <string> docs, MlAddr mlAddr)
 {
     foreach (var s in docs)
     {
         var buf = Util.SwapStr("$ML_NAME", mlAddr.Name, s);
         buf = Util.SwapStr("$POST_ADDR", mlAddr.Post.ToString(), buf);
         buf = Util.SwapStr("$CTRL_ADDR", mlAddr.Ctrl.ToString(), buf);
         buf = Util.SwapStr("$ADMIN_ADDR", mlAddr.Admin.ToString(), buf);
         ar.Add(buf);
     }
 }
Exemple #9
0
 public MlDelivery(MailSave mailSave, Logger logger, MlUserList mlUserList, MlAddr mlAddr, MlMailDb mlDb, MlSubject mlSubject,List<string>docs,int maxGet)
 {
     _mlUserList = mlUserList;
     _mlAddr = mlAddr;
     _logger = logger;
     _mlDb = mlDb;
     _mlSubject = mlSubject;
     _docs = docs;
     _maxGet = maxGet;
     _mlSender = new MlSender(mailSave, logger);
 }
Exemple #10
0
 public void SetUp()
 {
     var mlAddr = new MlAddr("1ban", new List<string>{"example.com"});
     var docs = new List<string>();
     foreach (var docKind in Enum.GetValues(typeof(MlDocKind))) {
         var buf = docKind.ToString();
         if (buf.Length < 2 || buf[buf.Length - 2] != '\r' || buf[buf.Length - 1] != '\n') {
             buf = buf + "\r\n";
         }
         docs.Add(buf);
     }
     _mlCreator = new MlCreator(mlAddr, docs);
 }
Exemple #11
0
        public Initialization2()
        {
            var tsDir = new TsDir();
            //var tsOption = new TsOption(tsDir);
            //var manageDir = tsDir.Src + "\\TestDir";

            //TmpDir2 = string.Format("{0}/../../TestDir", Directory.GetCurrentDirectory());
            var optionDef = tsDir.Src + "\\Option.def";

            //Docs
            Docs = new List<string>();
            var lines = File.ReadAllLines(optionDef, Encoding.GetEncoding(932));
            foreach (MlDocKind docKind in Enum.GetValues(typeof(MlDocKind))) {
                var tag = string.Format("MEMO=Ml\b{0}Document=", docKind.ToString().ToLower());
                bool hit = false;
                foreach (var l in lines) {
                    if (l.IndexOf(tag) == 0) {
                        Docs.Add(l.Substring(tag.Length));
                        hit = true;
                        break;
                    }
                }
                if (!hit) {
                    Docs.Add("");
                }
            }

            Kernel = new Kernel(null, null, null, null);
            Logger = Kernel.CreateLogger("LOG", true, null);
            domainList = new List<string>() { "example.com" };
            MlAddr = new MlAddr(mlName, domainList);
            var mailQueue = new MailQueue(tsDir.Src + "TestDir");
            var oneOption = new Option(Kernel,"","");
            var mailBox = new MailBox(Kernel, oneOption);
            MailSave = new MailSave(Kernel,mailBox,Logger,mailQueue,"",domainList);
            MlOption = CreateMlOption();
            //MlUserList = CreateMlUsers();

            Ml = new Ml(Kernel, Logger, MailSave, MlOption, mlName, domainList);
            //30件のメールを保存
            for (int i = 0; i < 30; i++) {
                var mail = new Mail(null);
                mail.Init(Encoding.ASCII.GetBytes("\r\n"));//区切り行(ヘッダ終了)
                mail.AddHeader("subject", string.Format("[{0}:{1:D5}]TITLE", mlName, i + 1));
                mail.Init(Encoding.ASCII.GetBytes("1\r\n"));//本文
                mail.Init(Encoding.ASCII.GetBytes("2\r\n"));//本文
                mail.Init(Encoding.ASCII.GetBytes("3\r\n"));//本文

                Ml.Save(mail);
            }
        }
Exemple #12
0
 public void SetUp()
 {
     _mlAddr = new MlAddr("1ban", new List<string>{ "example.com" });
 }
Exemple #13
0
 public MlCreator(MlAddr mlAddr, List <string> docs)
 {
     _mlAddr = mlAddr;
     _docs   = docs;
 }
Exemple #14
0
 public MlCreator(MlAddr mlAddr,List<string>docs)
 {
     _mlAddr = mlAddr;
     _docs = docs;
 }
Exemple #15
0
 public void SetUp()
 {
     mlAddr = new MlAddr(name, domainList);
 }