Exemple #1
0
        public void GetTest(int no)
        {
            const string mlName = "1ban";

            for(var kind =0 ; kind<7 ; kind++){
                var mlSubject = new MlSubject(kind,mlName);
                var s = mlSubject.Get(no);
                switch(kind){
                    case 0: Assert.AreEqual(s,string.Format("({0})",mlName));
                            break;
                    case 1: Assert.AreEqual(s,string.Format("[{0}]",mlName));
                            break;
                    case 2: Assert.AreEqual(s,string.Format("({0:D5})",no));
                            break;
                    case 3: Assert.AreEqual(s,string.Format("[{0:D5}]",no));
                            break;
                    case 4: Assert.AreEqual(s,string.Format("({0}:{1:D5})",mlName,no));
                            break;
                    case 5: Assert.AreEqual(s,string.Format("[{0}:{1:D5}]",mlName,no));
                            break;
                    case 6: Assert.AreEqual(s,string.Format(""));
                            break;
                }
            }
        }
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 Mail Summary(MlMailDb mlDb, MlSubject mlSubject, int start, int end)
        {
            //ライブラリからの取得
            Encoding      encoding = null;
            StringBuilder sb       = new StringBuilder();

            for (int i = start; i <= end; i++)
            {
                var mail = mlDb.Read(i);
                if (mail == null)
                {
                    sb.Append(mlSubject.Get(i) + " library no't found.\r\n");
                }
                else
                {
                    string str = mail.GetHeader("subject");
                    if (str != null)
                    {
                        str = Subject.Decode(ref encoding, str);
                        sb.Append(string.Format("{0}\r\n", str));
                    }
                    else
                    {
                        sb.Append(mlSubject.Get(i) + " subject no't found.\r\n");
                    }
                }
            }
            string subject = string.Format("result for summary [{0}-{1}] ({2} ML)", start, end, mlAddr.Name);

            return(Create(ContentTyep.Sjis, subject, sb.ToString()));
        }
Exemple #4
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 #5
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 #6
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 #7
0
 public void Get2Test(int no, string subject, string mlName, int kind, string ansStr)
 {
     var mlSubject = new MlSubject(kind,mlName);
     //連番を付加したSubjectの生成
     Assert.AreEqual(ansStr, mlSubject.Get(subject, no));
 }
Exemple #8
0
 public Mail Summary(MlMailDb mlDb, MlSubject mlSubject, int start, int end)
 {
     //ライブラリからの取得
     Encoding encoding = null;
     StringBuilder sb = new StringBuilder();
     for (int i = start; i <= end; i++) {
         var mail = mlDb.Read(i);
         if (mail == null) {
             sb.Append(mlSubject.Get(i) + " library no't found.\r\n");
         } else {
             string str = mail.GetHeader("subject");
             if (str != null) {
                 str = Subject.Decode(ref encoding, str);
                 sb.Append(string.Format("{0}\r\n", str));
             } else {
                 sb.Append(mlSubject.Get(i) + " subject no't found.\r\n");
             }
         }
     }
     string subject = string.Format("result for summary [{0}-{1}] ({2} ML)", start, end, mlAddr.Name);
     return Create(ContentTyep.Sjis, subject, sb.ToString());
 }