コード例 #1
0
        private void RequestSearchFields()
        {
            //Example 1. Requesting Search Fields

            //<iq type='get'
            //    from='[email protected]/home'
            //    to='characters.shakespeare.lit'
            //    id='search1'
            //    xml:lang='en'>
            //  <query xmlns='jabber:iq:search'/>
            //</iq>

            // Disable the Search Button until we habe a Form to submit
            cmdSearch.Enabled = false;

            SearchIq siq = new SearchIq();

            siq.Type = agsXMPP.protocol.client.IqType.get;
            siq.To   = new Jid(cboServices.SelectedItem.ToString());

            // dicard the pending requests if there is one
            if (_IdFieldRequest != null)
            {
                m_XmppCon.IqGrabber.Remove(_IdFieldRequest);
            }

            // and cache the id of the new pending request
            _IdFieldRequest = siq.Id;

            // finally send the query
            m_XmppCon.IqGrabber.SendIq(siq, new IqCB(OnSearchFieldsResult), null);
        }
コード例 #2
0
ファイル: frrmFindUsers.cs プロジェクト: Br3nda/sfdocsamples
        /// <summary>
        ///
        /// *************BUSCAR CAMPOS********************
        /// Efectua una busqueda al server de los campos por los cuales buscar
        /// cboServices.SelectedItem.ToString()
        /// </summary>
        private void RequestSearchFields(string jidServiceName)
        {
            //Example 1. Requesting Search Fields

            //<iq type='get'
            //    from='[email protected]/home'
            //    to='characters.shakespeare.lit'
            //    id='search1'
            //    xml:lang='en'>
            //  <query xmlns='jabber:iq:search'/>
            //</iq>


            cmdSearch.Enabled = false;

            SearchIq siq = new SearchIq();

            siq.Type = agsXMPP.protocol.client.IqType.get;
            //siq.To = new Jid(cboServices.SelectedItem.ToString());
            siq.To = new Jid(jidServiceName);

            // Remuevo alguna consulta pendiente si hay
            if (_IdFieldRequest != null)
            {
                Util.XmppServices.XmppCon.IqGrabber.Remove(_IdFieldRequest);
            }

            //guardo el Id de la nueva consulta
            _IdFieldRequest = siq.Id;

            // Envio la consulta
            Util.XmppServices.XmppCon.IqGrabber.SendIq(siq, new IqCB(OnSearchFieldsResult), null);
        }
コード例 #3
0
        private void cmdSearch_Click(object sender, EventArgs e)
        {
            /*
             *
             * Example 8. Entity Submits Search Form
             *
             * <iq type='set'
             *   from='[email protected]/balcony'
             *   to='characters.shakespeare.lit'
             *   id='search4'
             *   xml:lang='en'>
             * <query xmlns='jabber:iq:search'>
             *   <x xmlns='jabber:x:data' type='submit'>
             *     <field type='hidden' var='FORM_TYPE'>
             *       <value>jabber:iq:search</value>
             *     </field>
             *     <field var='gender'>
             *       <value>male</value>
             *     </field>
             *   </x>
             * </query>
             * </iq>
             */

            IQ siq = null;

            if (!_IsOldSearch)
            {
                // Validate the Form before we submit it
                if (xDataControl.Validate())
                {
                    siq = new SearchIq();
                    //siq.To = xDataControl.From;
                    //siq.Type = IqType.set;
                    ((SearchIq)siq).Query.Data = xDataControl.CreateResponse();
                }
            }
            else
            {
                siq = new IQ();
                siq.GenerateId();
                siq.Query = xDataControl.CreateSearchResponse();
            }

            siq.To   = xDataControl.From;
            siq.Type = IqType.set;
            // dicard the pending requests if there is one
            if (_IdSearchRequest != null)
            {
                m_XmppCon.IqGrabber.Remove(_IdSearchRequest);
            }

            // and cache the id of the new pending request
            _IdSearchRequest = siq.Id;

            // finally send the query
            m_XmppCon.IqGrabber.SendIq(siq, new IqCB(OnSearchResult), null);
        }
コード例 #4
0
ファイル: frrmFindUsers.cs プロジェクト: Br3nda/sfdocsamples
        /// <summary>
        /// Efectuar consulta
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdSearch_Click(object sender, EventArgs e)
        {
            /*
             *
             * Ejemlo Entity Submits Search Form
             *
             * <iq type='set'
             *   from='[email protected]/balcony'
             *   to='characters.shakespeare.lit'
             *   id='search4'
             *   xml:lang='en'>
             * <query xmlns='jabber:iq:search'>
             *   <x xmlns='jabber:x:data' type='submit'>
             *     <field type='hidden' var='FORM_TYPE'>
             *       <value>jabber:iq:search</value>
             *     </field>
             *     <field var='gender'>
             *       <value>male</value>
             *     </field>
             *   </x>
             * </query>
             * </iq>
             */

            IQ searchIQ = null;

            if (!_IsOldSearch)
            {
                // validar entrada de datos
                if (xDataControl.Validate())
                {
                    searchIQ = new SearchIq();
                    //siq.To = xDataControl.From;
                    //siq.Type = IqType.set;
                    ((SearchIq)searchIQ).Query.Data = xDataControl.CreateResponse();
                }
            }
            else
            {
                searchIQ = new IQ();
                searchIQ.GenerateId();
                searchIQ.Query = xDataControl.CreateSearchResponse();
            }

            searchIQ.To   = xDataControl.From;
            searchIQ.Type = IqType.set;
            // Elimino alguna antigua si existe
            if (_IdSearchRequest != null)
            {
                Util.XmppServices.XmppCon.IqGrabber.Remove(_IdSearchRequest);
            }

            // Guardo la actual consulta
            _IdSearchRequest = searchIQ.Id;

            // Envio el Iq
            Util.XmppServices.XmppCon.IqGrabber.SendIq(searchIQ, new IqCB(OnSearchResult), null);
        }
コード例 #5
0
ファイル: FrmAddUser.cs プロジェクト: aile54/chatclient
        private void QueryUser()
        {
            SearchIq sIq = new SearchIq();

            sIq.To          = new Jid("search.vitenet1.net");
            sIq.Type        = IqType.Set;
            sIq.Search.Nick = txtName.Text;
            _xmppClient.Send(sIq);
        }
コード例 #6
0
ファイル: FrmAddUser.cs プロジェクト: aile54/chatclient
 private void QueryUser()
 {
     SearchIq sIq = new SearchIq();
     sIq.To = new Jid("search.vitenet1.net");
     sIq.Type = IqType.Set;
     sIq.Search.Nick = txtName.Text;
     _xmppClient.Send(sIq);
 }