Exemplo n.º 1
0
 public void SimpleGenerationExample()
 {
     CapsManager cm = new CapsManager();
     cm.AddIdentity("client", "pc", null, "Exodus 0.9.1");
     cm.AddFeature("http://jabber.org/protocol/muc");
     cm.AddFeature("http://jabber.org/protocol/disco#info");
     cm.AddFeature("http://jabber.org/protocol/disco#items");
     Assert.AreEqual("SrFo9ar2CCk2EnOH4q4QANeuxLQ=", cm.Ver);
 }
Exemplo n.º 2
0
        public void TestCaps()
        {
            PresenceManager pp = new PresenceManager();
            Presence pres = new Presence(doc);
            pres.From = baz;

            CapsManager cm = new CapsManager();
            pp.CapsManager = cm;

            cm.FileName = "caps.xml";
            cm.Node = "http://cursive.net/clients/PresenceManagerTest";
            cm.AddFeature(URI.DISCO_INFO);
            cm.AddFeature(URI.DELAY);
            cm.AddIdentity("client", "pc", null, "Presence Manager Test");

            DiscoInfo info = new DiscoInfo(doc);
            cm.FillInInfo(info);
            cm[cm.Ver] = info;

            pres.AddChild(cm.GetCaps(pres.OwnerDocument));
            pp.AddPresence(pres);

            JID dij = pp.GetFeatureJID(bare, URI.DISCO_INFO);
            Assert.AreEqual(baz, dij);
            dij = pp.GetFeatureJID(bare, URI.DISCO_ITEMS);
            Assert.IsNull(dij);
            dij = pp.GetFeatureJID(baz, URI.DISCO_INFO);
            Assert.AreEqual(baz, dij);

            StringSet fs = pp.GetFeatures(bare);
            Assert.IsTrue(fs[URI.DISCO_INFO]);
            Assert.IsFalse(fs[URI.DISCO_ITEMS]);
        }