Esempio n. 1
0
        public XmppVCard(XmppJid jid, XmppIQ stream)
        {
            Jid = jid;

            XmppIQ xFN = stream.FindDescendant("FN", ns);

            if (xFN != null)
            {
                FN = xFN.Text;
            }

            XmppIQ xPhoto = stream.FindDescendant("PHOTO", ns);

            if (xPhoto != null)
            {
                XmppIQ xPhotoType = xPhoto.FindChild("TYPE", ns);
                if (xPhotoType != null)
                {
                    PhotoType = xPhotoType.Text;
                }
                XmppIQ xPhotoBin = xPhoto.FindChild("BINVAL", ns);
                if (xPhotoBin != null)
                {
                    PhotoBinVal = xPhotoBin.Text;
                }
            }
        }
Esempio n. 2
0
        public static void Parse(XmppIQ xStream, out string tag, out string message)
        {
            tag     = string.Empty;
            message = string.Empty;

            // sasl auth error
            if (xStream.Equal("failure", "urn:ietf:params:xml:ns:xmpp-sasl"))
            {
                XmppIQ xTag = xStream.Children().FirstOrDefault();
                if (xTag != null)
                {
                    tag     = xTag.Name;
                    message = xTag.Text;
                    return;
                }
            }

            // stream error

            /* from messenger
             * <stream:error xmlns:stream="http://etherx.jabber.org/streams">
             *      <not-well-formed xmlns="urn:ietf:params:xml:ns:xmpp-streams" />
             *      <text xmlns="urn:ietf:params:xml:ns:xmpp-streams">XmlException due to: Unexpected end of file has occurred. The following elements are not closed: BINVAL, PHOTO, vCard, iq. Line 1, position 16344.</text>
             * </stream:error>
             */
            if (xStream.Equal("error", "http://etherx.jabber.org/streams"))
            {
                XmppIQ xTag = xStream.Children().FirstOrDefault();
                if (xTag != null)
                {
                    tag = xTag.Name;
                }
                XmppIQ xText = xStream.FindDescendant("text", "urn:ietf:params:xml:ns:xmpp-streams");
                if (xText != null)
                {
                    message = xText.Text;
                }
                return;
            }

            // stanza error
            XmppIQ xError = xStream.FindDescendant("error");

            if (xError != null)
            {
                XmppIQ xTag = xError.Children().FirstOrDefault();
                if (xTag != null)
                {
                    tag = xTag.Name;
                }
                XmppIQ xText = xStream.FindDescendant("text", "urn:ietf:params:xml:ns:xmpp-streams");
                if (xText != null)
                {
                    message = xText.Text;
                }
                return;
            }
        }
Esempio n. 3
0
 public XmppIqSignalEventArgs(int id, XmppIqType type, XmppIQ xStream)
 {
     this.ID      = id;
     this.Type    = type;
     this.xStream = xStream;
 }