/// <summary> /// Build the response from a old jabber search form /// </summary> /// <returns></returns> public agsXMPP.protocol.iq.search.Search CreateSearchResponse() { agsXMPP.protocol.iq.search.Search search = new agsXMPP.protocol.iq.search.Search(); foreach (XDataFieldControl ctl in panelFields.Controls) { Type type = ctl.GetType(); if (type == typeof(XDataTextBox)) { XDataTextBox txt = ctl as XDataTextBox; if (txt.Value != null) { search.SetTag(txt.Var, txt.Value); } } else if (type == typeof(XDataHidden)) { XDataHidden hidden = ctl as XDataHidden; search.SetTag(hidden.Var, hidden.Value); } } return(search); }
public void CreateForm(agsXMPP.protocol.iq.search.Search search) { /* * Send: <iq xmlns="jabber:client" id="agsXMPP_9" type="get" to="users.jabber.org"><query xmlns="jabber:iq:search" /> * </iq> * Recv: <iq xmlns="jabber:client" to="[email protected]/SharpIM" type="result" id="agsXMPP_9" from="users.jabber.org"> * <query xmlns="jabber:iq:search"> * <instructions>Find a contact by entering the search criteria in the given fields. Note: Each field supports wild card searches (%)</instructions> * <first /> * <last /> * <nick /> * <email /> * </query></iq> */ this.SuspendLayout(); this.panelFields.SuspendLayout(); this.panelFields.Controls.Clear(); //lblTitle.Text = xdata.Title; lblInstructions.Text = search.Instructions; XDataControl_Resize(this, null); agsXMPP.Xml.Dom.ElementList list = new agsXMPP.Xml.Dom.ElementList(); foreach (agsXMPP.Xml.Dom.Node n in search.ChildNodes) { if (n.NodeType == agsXMPP.Xml.Dom.NodeType.Element) { list.Add(n as agsXMPP.Xml.Dom.Element); } } for (int i = list.Count - 1; i >= 0; i--) { agsXMPP.Xml.Dom.Element el = list.Item(i); if (el.TagName == "key") { CreateField(CreateDummyHiddenField(el.TagName, el.Value), i); } else if (el.TagName == "instructions") { } else { CreateField(CreateDummyTextField(el.TagName, el.TagName), i); } } this.panelFields.ResumeLayout(); this.ResumeLayout(); }
/// <summary> /// Build the response from a old jabber search form /// </summary> /// <returns></returns> public agsXMPP.protocol.iq.search.Search CreateSearchResponse() { agsXMPP.protocol.iq.search.Search search = new agsXMPP.protocol.iq.search.Search(); foreach (XDataFieldControl ctl in panelFields.Controls) { Type type = ctl.GetType(); if (type == typeof(XDataTextBox)) { XDataTextBox txt = ctl as XDataTextBox; if (txt.Value != null) { search.SetTag(txt.Var, txt.Value); } } else if (type == typeof(XDataHidden)) { XDataHidden hidden = ctl as XDataHidden; search.SetTag(hidden.Var, hidden.Value); } } return search; }
internal void Setup( Search search, Service service ) { Service = service ; _search = search ; _xData = ElementUtil.GetData( _search ) ; if ( _xData == null ) { SetupSimpleSearch() ; } else { SetupXData( _xData ) ; } }