/// <summary> /// Create an x:data form from the given iq stanza. /// </summary> /// <param name="parent">Original stanza</param> public XDataForm(Kixeye.Jabber.Protocol.Client.IQ parent) : this(FindData(parent)) { m_stanza = (Packet) parent.CloneNode(true); Data d = FindData(m_stanza); m_parent = (Element)d.ParentNode; m_parent.RemoveChild(d); }
/// <summary> /// Create an x:data form from the given message stanza. /// </summary> /// <param name="parent">Original stanza</param> public XDataForm(Kixeye.Jabber.Protocol.Client.Message parent) : this(FindData(parent) as Kixeye.Jabber.Protocol.X.Data) { m_stanza = (Packet) parent.CloneNode(true); Data d = FindData(m_stanza); Debug.Assert(d != null); m_parent = (Element)d.ParentNode; m_parent.RemoveChild(d); }
[Test] public void Test_Create() { Packet p = new Packet("foo", doc); Assert.AreEqual("<foo />", p.ToString()); p.To = "one"; Assert.AreEqual("<foo to=\"one\" />", p.ToString()); p.From = "two"; Assert.AreEqual("<foo to=\"one\" from=\"two\" />", p.ToString()); p.Swap(); Assert.AreEqual("<foo to=\"two\" from=\"one\" />", p.ToString()); }