示例#1
0
        private void GotIQ(object sender, IQ iq)
        {
            switch (iq.Type)
            {
            case IQType.get:
                if (iq.Query is DiscoInfo)
                {
                    DiscoInfoIQ outdisco = new DiscoInfoIQ(XmppGlobal.InternalClient.Document);
                    outdisco.Query = (XmlElement)disco_info.Clone();
                    outdisco.To    = iq.From;
                    outdisco.ID    = iq.ID;
                    outdisco.Type  = IQType.result;
                    XmppGlobal.Connection.SendPacket(outdisco);
                }
                break;

            case IQType.result:
                if (iq.Query is DiscoInfo)
                {
                    XmppGlobal.InternalQueryCache.DiscoInfo[iq.From.ToString() + "!!!!!" + (iq.Query as DiscoInfo).Node] = iq;
                }
                else if (iq.Query is DiscoItems)
                {
                    XmppGlobal.InternalQueryCache.DiscoItems[iq.From.ToString() + "!!!!!" + (iq.Query as DiscoItems).Node] = iq;
                }
                break;
            }

            //TODO: dataforms
            //if (CheckForFormData (iq)) {
            //        DataForm f = new DataForm ();
            //        f.LoadForm (iq);
            //        f.Show ();
            //}
        }
示例#2
0
        public DiscoInfoIQ CreateDiscoInfoQuery()
        {
            DiscoInfoIQ iq = new DiscoInfoIQ(XmppGlobal.InternalClient.Document);

            iq.Type = jabber.protocol.client.IQType.get;
            return(iq);
        }
示例#3
0
        /// <summary>
        /// Requests a list of agents from the XMPP server.
        /// </summary>
        public void GetAgents()
        {
            DiscoInfoIQ diq = new DiscoInfoIQ(Document);

            diq.Type = IQType.get;
            diq.To   = this.Server;
            Tracker.BeginIQ(diq, new IqCB(GotDiscoInfo), null);
        }
示例#4
0
        /// <summary>
        /// Creates a disco#info IQ packet.
        /// </summary>
        /// <param name="doc">XmlDocument to create the XML elements with.</param>
        /// <returns>XML representing the disco#info request.</returns>
        public IQ InfoIQ(System.Xml.XmlDocument doc)
        {
            m_pendingInfo = true;
            DiscoInfoIQ iiq = new DiscoInfoIQ(doc);

            iiq.To   = JID;
            iiq.Type = IQType.get;
            if (Node != null)
            {
                DiscoInfo info = iiq.Instruction;
                info.Node = Node;
            }

            return(iiq);
        }
示例#5
0
        public void DiscoInfoQuery(jabber.JID to, string node, bool refresh, QueryCallback callback, object state)
        {
            if (!refresh)
            {
                IQ cache_version = XmppGlobal.InternalQueryCache.DiscoInfo[to.ToString() + "!!!!!" + node];

                if (cache_version != null)
                {
                    callback.Invoke(this, cache_version, state);
                    return;
                }
            }

            DiscoInfoIQ iq = XmppGlobal.Queries.CreateDiscoInfoQuery();

            iq.To = to;

            if (!string.IsNullOrEmpty(node))
            {
                iq.Node = node;
            }

            XmppGlobal.Queries.SendQuery(iq, callback, state);
        }
示例#6
0
 /// <summary>
 /// Requests a list of agents from the XMPP server.
 /// </summary>
 public void GetAgents()
 {
     DiscoInfoIQ diq = new DiscoInfoIQ(Document) {Type = IQType.Get, To = Server};
     Tracker.BeginIQ(diq, GotDiscoInfo, null);
 }
示例#7
0
        private void GotIQ(object sender, IQ iq)
        {
            switch (iq.Type) {
                case IQType.get:
                    if (iq.Query is DiscoInfo) {
                        DiscoInfoIQ outdisco = new DiscoInfoIQ (XmppGlobal.InternalClient.Document);
                        outdisco.Query = (XmlElement)disco_info.Clone ();
                        outdisco.To = iq.From;
                        outdisco.ID = iq.ID;
                        outdisco.Type = IQType.result;
                        XmppGlobal.Connection.SendPacket (outdisco);
                    }
                    break;
                case IQType.result:
                    if (iq.Query is DiscoInfo)
                        XmppGlobal.InternalQueryCache.DiscoInfo[iq.From.ToString () + "!!!!!" + (iq.Query as DiscoInfo).Node] = iq;
                    else if (iq.Query is DiscoItems)
                        XmppGlobal.InternalQueryCache.DiscoItems[iq.From.ToString () + "!!!!!" + (iq.Query as DiscoItems).Node] = iq;
                    break;
            }

            //TODO: dataforms
            //if (CheckForFormData (iq)) {
            //        DataForm f = new DataForm ();
            //        f.LoadForm (iq);
            //        f.Show ();
            //}
        }
示例#8
0
        /// <summary>
        /// Creates a disco#info IQ packet.
        /// </summary>
        /// <param name="doc">XmlDocument to create the XML elements with.</param>
        /// <returns>XML representing the disco#info request.</returns>
        public IQ InfoIQ(System.Xml.XmlDocument doc)
        {
            m_pendingInfo = true;
            DiscoInfoIQ iiq = new DiscoInfoIQ(doc);
            iiq.To = JID;
            iiq.Type = IQType.get;
            if (Node != null)
            {
                DiscoInfo info = iiq.Instruction;
                info.Node = Node;
            }

            return iiq;
        }
示例#9
0
 /// <summary>
 /// Requests a list of agents from the XMPP server.
 /// </summary>
 public void GetAgents()
 {
     DiscoInfoIQ diq = new DiscoInfoIQ(Document);
     diq.Type = IQType.get;
     diq.To = this.Server;
     Tracker.BeginIQ(diq, new IqCB(GotDiscoInfo), null);
 }
示例#10
0
 public DiscoInfoIQ CreateDiscoInfoQuery()
 {
     DiscoInfoIQ iq = new DiscoInfoIQ (XmppGlobal.InternalClient.Document);
     iq.Type = jabber.protocol.client.IQType.get;
     return iq;
 }