Ejemplo n.º 1
0
 public void Test_Item()
 {
     AgentsIQ aiq = new AgentsIQ(doc);
     AgentsQuery q = (AgentsQuery)aiq.Query;
     Agent a = q.AddAgent();
     a.JID = new JID("*****@*****.**");
     Assert.AreEqual("<iq id=\"" + aiq.ID + "\" type=\"get\"><query xmlns=\"jabber:iq:agents\">" +
         "<agent jid=\"[email protected]\" /></query></iq>",
         aiq.ToString());
 }
Ejemplo n.º 2
0
        [Test] public void Test_Item()
        {
            AgentsIQ    aiq = new AgentsIQ(doc);
            AgentsQuery q   = (AgentsQuery)aiq.Query;
            Agent       a   = q.AddAgent();

            a.JID = new JID("*****@*****.**");
            Assert.AreEqual("<iq id=\"" + aiq.ID + "\" type=\"get\"><query xmlns=\"Jabber:iq:agents\">" +
                            "<agent jid=\"[email protected]\" /></query></iq>",
                            aiq.ToString());
        }
Ejemplo n.º 3
0
 public void Test_GetItems()
 {
     AgentsIQ aiq = new AgentsIQ(doc);
     AgentsQuery r = (AgentsQuery)aiq.Query;
     Agent a = r.AddAgent();
     a.JID = new JID("*****@*****.**");
     a = r.AddAgent();
     a.JID = new JID("*****@*****.**");
     Agent[] agents = r.GetAgents();
     Assert.AreEqual(agents.Length, 2);
     Assert.AreEqual(agents[0].JID, "*****@*****.**");
     Assert.AreEqual(agents[1].JID, "*****@*****.**");
 }
Ejemplo n.º 4
0
        [Test] public void Test_GetItems()
        {
            AgentsIQ    aiq = new AgentsIQ(doc);
            AgentsQuery r   = (AgentsQuery)aiq.Query;
            Agent       a   = r.AddAgent();

            a.JID = new JID("*****@*****.**");
            a     = r.AddAgent();
            a.JID = new JID("*****@*****.**");
            Agent[] agents = r.GetAgents();
            Assert.AreEqual(agents.Length, 2);
            Assert.AreEqual(agents[0].JID, "*****@*****.**");
            Assert.AreEqual(agents[1].JID, "*****@*****.**");
        }
Ejemplo n.º 5
0
 public void Test_Transport()
 {
     AgentsIQ aiq = new AgentsIQ(doc);
     aiq.Type = IQType.result;
     AgentsQuery r = (AgentsQuery)aiq.Query;
     Agent a = r.AddAgent();
     a.JID = new JID("*****@*****.**");
     a.Transport = true;
     Assert.AreEqual(a.Transport, true);
     Assert.AreEqual("<iq id=\"" + aiq.ID + "\" type=\"result\"><query xmlns=\"jabber:iq:agents\">" +
         "<agent jid=\"[email protected]\"><transport /></agent></query></iq>",
         aiq.ToString());
     a.Transport = false;
     Assert.AreEqual(a.Transport, false);
     a.Groupchat = true;
     Assert.AreEqual(a.Groupchat, true);
     Assert.AreEqual("<iq id=\"" + aiq.ID + "\" type=\"result\"><query xmlns=\"jabber:iq:agents\">" +
         "<agent jid=\"[email protected]\"><groupchat /></agent></query></iq>",
         aiq.ToString());
 }
Ejemplo n.º 6
0
        private void GotInfo(object sender, IQ iq, object onode)
        {
            DiscoNode dn = onode as DiscoNode;

            Debug.Assert(dn != null);

            if (iq.Type == IQType.error)
            {
                if (dn == m_root)
                {
                    // root node.
                    // Try agents.
                    Error err = iq.Error;
                    if (err != null)
                    {
                        string cond = err.Condition;
                        if ((cond == Error.FEATURE_NOT_IMPLEMENTED) ||
                            (cond == Error.SERVICE_UNAVAILABLE))
                        {
                            IQ aiq = new AgentsIQ(m_stream.Document);
                            BeginIQ(aiq, new jabber.connection.IqCB(GotAgents), m_root);
                            return;
                        }
                    }
                }
            }
            if (iq.Type != IQType.result)
            {
                // protocol error
                dn.AddInfo(null);
                return;
            }

            dn.AddInfo(iq.Query as DiscoInfo);

            if (dn == m_root)
            {
                RequestItems(m_root);
            }
        }
Ejemplo n.º 7
0
        [Test] public void Test_Transport()
        {
            AgentsIQ aiq = new AgentsIQ(doc);

            aiq.Type = IQType.result;
            AgentsQuery r = (AgentsQuery)aiq.Query;
            Agent       a = r.AddAgent();

            a.JID       = new JID("*****@*****.**");
            a.Transport = true;
            Assert.AreEqual(a.Transport, true);
            Assert.AreEqual("<iq id=\"" + aiq.ID + "\" type=\"result\"><query xmlns=\"Jabber:iq:agents\">" +
                            "<agent jid=\"[email protected]\"><transport /></agent></query></iq>",
                            aiq.ToString());
            a.Transport = false;
            Assert.AreEqual(a.Transport, false);
            a.Groupchat = true;
            Assert.AreEqual(a.Groupchat, true);
            Assert.AreEqual("<iq id=\"" + aiq.ID + "\" type=\"result\"><query xmlns=\"Jabber:iq:agents\">" +
                            "<agent jid=\"[email protected]\"><groupchat /></agent></query></iq>",
                            aiq.ToString());
        }
Ejemplo n.º 8
0
        private void GotInfo(object sender, IQ iq, object onode)
        {
            DiscoNode dn = onode as DiscoNode;
            Debug.Assert(dn != null);

            if (iq.Type == IQType.error)
            {
                if (dn == m_root)
                {
                    // root node.
                    // Try agents.
                    Error err = iq.Error;
                    if (err != null)
                    {
                        string cond = err.Condition;
                        if ((cond == Error.FEATURE_NOT_IMPLEMENTED) ||
                            (cond == Error.SERVICE_UNAVAILABLE))
                        {
                            IQ aiq = new AgentsIQ(m_stream.Document);
                            BeginIQ(aiq, new jabber.connection.IqCB(GotAgents), m_root);
                            return;
                        }
                    }
                }
            }
            if (iq.Type != IQType.result)
            {
                // protocol error
                dn.AddInfo(null);
                return;
            }

            dn.AddInfo(iq.Query as DiscoInfo);

            if (dn == m_root)
                RequestItems(m_root);
        }
Ejemplo n.º 9
0
        private void GotInfo(object sender, IQ iq, object onode)
        {
            DiscoNode dn = onode as DiscoNode;
            Debug.Assert(dn != null);

            if (iq.Type == IQType.Error)
            {
                if (dn == m_root)
                {
                    // root node.
                    // Try agents.
                    Error err = iq.Error;
                    if (err != null)
                    {
                        string cond = err.Condition;
                        if ((cond == Error.FeatureNotImplemented) ||
                            (cond == Error.ServiceUnavailable))
                        {
                            IQ aiq = new AgentsIQ(m_stream.Document);
                            BeginIQ(aiq, new jabber.connection.IqCB(GotAgents), m_root);
                            return;
                        }
                    }
                }
            }
            if (iq.Type != IQType.Result)
            {
                // protocol error
                dn.AddInfo(null);
                return;
            }

            dn.AddInfo(iq.Query as DiscoInfo);

            if (dn == m_root)
                RequestItems(m_root);
        }