Disco feature
see: http://www.jabber.org/registrar/disco-features.html
Inheritance: Element
Exemplo n.º 1
0
        public DiscoFeature AddFeature()
        {
            DiscoFeature f = new DiscoFeature();

            AddChild(f);
            return(f);
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Gets all Features
        /// </summary>
        /// <returns></returns>
        public DiscoFeature[] GetFeatures()
        {
            var nl    = SelectElements(typeof(DiscoFeature));
            var items = new DiscoFeature[nl.Count];
            var i     = 0;

            foreach (Element e in nl)
            {
                items[i] = (DiscoFeature)e;
                i++;
            }
            return(items);
        }
Exemplo n.º 3
0
 public void AddFeature(DiscoFeature f)
 {
     AddChild(f);
 }
Exemplo n.º 4
0
            //SEND: 
            //<iq xmlns="jabber:client" id="agsXMPP_11" type="get" to="users.localhost">
            //  <query xmlns="http://jabber.org/protocol/disco#info" />
            //</iq>
            //
            //RECV: 
            //<iq xmlns="jabber:client" from="users.localhost" to="test@localhost/MF" type="result" id="agsXMPP_11">
            //  <query xmlns="http://jabber.org/protocol/disco#info">
            //      <feature var="jabber:iq:time" />
            //      <feature var="jabber:iq:search" />
            //      <feature var="http://jabber.org/protocol/disco#info" />
            //      <feature var="jabber:iq:version" />
            //      <feature var="soapbox:limits" />
            //      <feature var="http://jabber.org/protocol/disco#items" />
            //      <identity name="SoapBox User Directory" category="directory" type="user" />
            //  </query>
            //</iq>
            private void ProcessDiscoInfoIQ(IQ iq)
            {

                agsXMPP.protocol.iq.disco.DiscoInfoIq discoInfoIq = new DiscoInfoIq(IqType.result);
                discoInfoIq.Namespace = agsXMPP.Uri.CLIENT;
                discoInfoIq.Id = iq.Id;
                discoInfoIq.From = iq.To;
                discoInfoIq.To = this.m_ClientAccount.JID;


                ///*******此处为配置扩展******************
                ///当前仅实现服务查找
                ///***************************************
                //RECV: 
                //<iq xmlns="jabber:client" id="agsXMPP_8" type="get" to="[email protected]">
                //    <query xmlns="http://jabber.org/protocol/disco#info" />
                //</iq>

                //SEND: 
                //<iq xmlns="jabber:client" type="result" id="agsXMPP_6" from="Search.SiteView.com" to="[email protected]:SiteView">
                //    <query xmlns="http://jabber.org/protocol/disco#info">
                //        <feature var="jabber:iq:time"/>
                //        <feature var="jabber:iq:search"/>
                //        <feature var="http://jabber.org/protocol/disco#info"/>
                //        <feature var="jabber:iq:version"/>
                //        <feature var="http://jabber.org/protocol/disco#items"/>
                //        <identity type="user" name="Site View MF Directory" category="Search"/>
                //    </query>
                //</iq>


                // <iq from='proxy.cachet.myjabber.net' to='[email protected]/Exodus' type='result' id='jcl_19'>
                //  <query xmlns='http://jabber.org/protocol/disco#info'>
                //      <identity category='proxy' name='SOCKS5 Bytestreams Service' type='bytestreams'/>
                //      <feature var='http://jabber.org/protocol/bytestreams'/>
                //      <feature var='http://jabber.org/protocol/disco#info'/>
                //  </query>
                // </iq>

                System.Collections.Generic.List<string> vars = new System.Collections.Generic.List<string>();
                DiscoIdentity identity = null;

                foreach (BaseService service in this.m_Server.ServiceList)
                {
                    if (!iq.To.Bare.ToLower().Contains(service.JID.Bare.ToLower()))
                    {
                        continue;
                    }

                    identity = new DiscoIdentity(service.ServiceType.ToString(), service.Name, service.ServiceType.ToString());
                    if (service.ServiceType == ServiceType.ContactSearch)
                    {
                        vars.Add(agsXMPP.Uri.IQ_SEARCH);
                    }
                    else if (service.ServiceType == ServiceType.GroupChat)
                    {
                        vars.Add(agsXMPP.Uri.MUC);
                    }
                    else if (service.ServiceType == ServiceType.FileTransfer)
                    {
                        vars.Add(agsXMPP.Uri.BYTESTREAMS);
                    }
                    else
                    {

                    }

                    break;
                }

                DiscoFeature feature = null;
                foreach (string var in vars)
                {
                    feature = new DiscoFeature(var);
                    discoInfoIq.Query.AddFeature(feature);
                }

                discoInfoIq.Query.AddIdentity(identity);

                Send(discoInfoIq);

            }
Exemplo n.º 5
0
 /// <summary>
 /// Gets all Features
 /// </summary>
 /// <returns></returns>
 public DiscoFeature[] GetFeatures()
 {
     ElementList nl = SelectElements(typeof(DiscoFeature));
     DiscoFeature[] items = new DiscoFeature[nl.Count];
     int i = 0;
     foreach (Element e in nl)
     {
         items[i] = (DiscoFeature) e;
         i++;
     }
     return items;
 }
Exemplo n.º 6
0
 public void AddFeature(DiscoFeature f)
 {
     AddChild(f);
 }
Exemplo n.º 7
0
 public DiscoFeature AddFeature()
 {
     DiscoFeature f = new DiscoFeature();
     AddChild(f);
     return f;
 }