Пример #1
0
        private Type GetStanzaType(Stanza stanza)
        {
            var iq = stanza as IQ;

            if (iq == null)
            {
                return(stanza.GetType());
            }

            Element iqInfo = iq.Query ?? (iq.Bind ?? (iq.Vcard ?? ((Element)iq.Session ?? (Element)iq.Blocklist)));

            if (iqInfo != null)
            {
                return(iqInfo.GetType());
            }

            foreach (var child in iq.ChildNodes)
            {
                if (child is Element)
                {
                    return(child.GetType());
                }
            }
            return(stanza.GetType());
        }
        private Type GetStanzaType(Stanza stanza)
        {
            var iq = stanza as IQ;
            if (iq == null) return stanza.GetType();

            Element iqInfo = iq.Query ?? (iq.Bind ?? (iq.Vcard ?? ((Element)iq.Session ?? (Element)iq.Blocklist)));
            if (iqInfo != null) return iqInfo.GetType();

            foreach (var child in iq.ChildNodes)
            {
                if (child is Element) return child.GetType();
            }
            return stanza.GetType();
        }