public override void ParseInnerXML(System.Xml.Linq.XElement elem) { XElement si = elem.FirstNode as XElement; if (si == null) return; if (si.Name != "{http://jabber.org/protocol/si}si") return; if (si.Attribute("id") != null) sid = si.Attribute("id").Value; if (si.Attribute("mime-type") != null) mimetype = si.Attribute("mime-type").Value; if (si.Attribute("profile") != null) profile = si.Attribute("profile").Value; StreamOptions = StreamOptions.none; foreach (XElement nextelem in si.Descendants()) { if (nextelem.Name == "{http://jabber.org/protocol/si/profile/file-transfer}file") { if (nextelem.Attribute("name") != null) filename = nextelem.Attribute("name").Value; if (nextelem.Attribute("size") != null) filesize = Convert.ToInt32(nextelem.Attribute("size").Value); if (nextelem.Attribute("hash") != null) filehash = nextelem.Attribute("hash").Value; if (nextelem.Attribute("date") != null) filedate = nextelem.Attribute("date").Value; if (nextelem.Element("{http://jabber.org/protocol/si/profile/file-transfer}desc") != null) filedesc = nextelem.Element("{http://jabber.org/protocol/si/profile/file-transfer}desc").Value; } else if (nextelem.Name == "{http://jabber.org/protocol/feature-neg}feature") { XElement x = nextelem.Element("{jabber:x:data}x"); if (x != null) { if (x.Attribute("type") != null) { if (x.Attribute("type").Value == "form") StreamInitIQType = StreamInitIQType.Offer; else if (x.Attribute("type").Value == "submit") StreamInitIQType = StreamInitIQType.Result; } XElement field = x.Element("{jabber:x:data}field"); if (field != null) { /// This may work for both form and submits, because the values are there in both cases, just wrapped in an option in form foreach (XElement nextopt in field.Descendants("{jabber:x:data}value")) { if (nextopt.Value == "http://jabber.org/protocol/bytestreams") StreamOptions |= StreamOptions.bytestreams; else if (nextopt.Value == "http://jabber.org/protocol/ibb") StreamOptions |= StreamOptions.ibb; } } } } } base.ParseInnerXML(elem); }
public StreamInitIQ(StreamInitIQType type) : base() { StreamInitIQType = type; }