Exemplo n.º 1
0
        //public Agent(Server server, Kernel kernel, MailQueue mailQueue, SaveMail saveMail,bool always):base(kernel,"Agent") {
        public Agent(Kernel kernel, Server server,Conf conf, Logger logger,MailQueue mailQueue, bool always)
            : base(kernel.CreateLogger("Agent",true, null))
        {
            _conf = conf;
            _logger = logger;
            _mailQueue = mailQueue;

            _always = always;

            //�b��
            _kernel = kernel;
            _server = server;
        }
Exemplo n.º 2
0
        public OneAgent(Kernel kernel, Server server,Conf conf,Logger logger, MailQueue mailQueue, OneQueue oneQueue)
            : base(kernel.CreateLogger("OneAgent",true,null))
        {
            _conf = conf;
            _logger = logger;
            _mailQueue = mailQueue;
            _oneQueue = oneQueue;
            _smtpClient2 = new SmtpClient2();

            //暫定
            _kernel = kernel;
            _server = server;
        }
Exemplo n.º 3
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);
            }
        }
Exemplo n.º 4
0
        public MlList(Kernel kernel,Server server,MailSave mailSave, List<string> domainList)
        {
            var optionMl = kernel.ListOption.Get("Ml");

            //メーリングストの一覧を取得する
            var dat = (Dat) optionMl.GetValue("mlList");
            if (dat != null){
                foreach (var o2 in dat){
                    if (!o2.Enable)
                        continue;
                    //メーリングリスト名の読込
                    var mlName = o2.StrList[0];
                    var op = kernel.ListOption.Get("Ml-" + mlName);
                    var logger = kernel.CreateLogger(mlName, (bool) op.GetValue("useDetailsLog"), server);
                    var mlOption = new MlOption(kernel,op);
                    //無効なメンバ指定の確認と警告
                    foreach (var d in mlOption.MemberList){
                        var mailAddress = new MailAddress(d.StrList[1]); //メールアドレス
                        if (mailAddress.User != "" && mailAddress.Domain != "")
                            continue;
                        if (logger != null){
                            logger.Set(LogKind.Error, null, 53, string.Format("{0}", d.StrList[1]));
                        }
                    }
                    if (mlOption.MemberList.Count == 0){
                        logger.Set(LogKind.Error, null, 57, string.Format("{0}", mlName));
                        continue;
                    }
                    var ml = new Ml(kernel, logger, mailSave, mlOption, mlName, domainList);
                    //MLの管理領域の初期化に失敗している場合は、追加しない
                    if (!ml.Status)
                        continue;
                    _ar.Add(ml);
                    if (logger != null)
                        logger.Set(LogKind.Normal, null, 44, mlName);
                }
            }
        }