예제 #1
0
        public void TestFindByTag()
        {
            var list = new PopCapabilityList(new[] {
            PopCapability.Uidl,
            PopCapability.Pipelining,
            new PopCapability("SASL", "CRAM-MD5"),
            new PopCapability("SASL", "PLAIN"),
              });

              Assert.AreEqual(PopCapability.Uidl, list.FindByTag(PopCapability.Uidl));
              Assert.AreEqual(PopCapability.Uidl, list.FindByTag("UIDL"));
              Assert.AreEqual(PopCapability.Uidl, list.FindByTag("uidl"));
              Assert.IsNotNull(list.FindByTag(PopCapability.Sasl));
              Assert.IsNull(list.FindByTag(PopCapability.Expire));
        }
예제 #2
0
        public void TestIsCapable()
        {
            var list = new PopCapabilityList(new[] {
            PopCapability.Uidl,
            PopCapability.Pipelining,
            new PopCapability("SASL", "CRAM-MD5"),
            new PopCapability("SASL", "PLAIN"),
              });

              Assert.IsTrue(list.IsCapable(PopCapability.Uidl));
              Assert.IsTrue(list.IsCapable(PopCapability.Sasl));
              Assert.IsTrue(list.IsCapable(new PopCapability("uidl")));
              Assert.IsTrue(list.IsCapable(new PopCapability("sasl")));
              Assert.IsFalse(list.IsCapable(new PopCapability("SASL", "DIGEST-MD5")));
              Assert.IsFalse(list.IsCapable(PopCapability.Expire));
        }
예제 #3
0
 /*
  * methods for internal state management
  */
 internal void SetServerCapabilities(PopCapabilityList newCapabilities)
 {
     serverCapabilities = new PopCapabilityList(true, newCapabilities);
 }
예제 #4
0
        /// <summary>sends CAPA command</summary>
        /// <remarks>valid in any state</remarks>
        public PopCommandResult Capa(out PopCapabilityList capabilities)
        {
            RejectNonConnectedState();

              capabilities = null;

              using (var t = new CapaTransaction(connection)) {
            if (ProcessTransaction(t).Succeeded) {
              SetServerCapabilities(t.Result.Value);
              capabilities = t.Result.Value;
            }

            return t.Result;
              }
        }
예제 #5
0
 internal void SetSessionInfo(PopSession session)
 {
     ServerCapabilities = new PopCapabilityList(true, session.ServerCapabilities);
 }
예제 #6
0
        /*
         * draft
         */
        /*
         * extended capabilities
         */
        static PopCapability()
        {
            var capabilities = new List<PopCapability>(GetDefinedConstants<PopCapability>());

              foreach (var saslMechansim in SaslMechanisms.AllMechanisms) {
            capabilities.Add(new PopCapability("SASL", saslMechansim));
              }

              AllCapabilities = new PopCapabilityList(true, capabilities);
        }