/// <summary> /// Gets a control form. /// </summary> /// <param name="To">Full JID of remote actuator.</param> /// <param name="Language">Preferred language.</param> /// <param name="ServiceToken">Service token of original sender, if available.</param> /// <param name="DeviceToken">Device token of original sender, if available.</param> /// <param name="UserToken">User token of original sender, if available.</param> /// <param name="Callback">Method called when form is returned or when operation fails.</param> /// <param name="State">State object to pass on to the callback method.</param> /// <param name="Nodes">Node(s) to get the form from, if residing behind a concentrator.</param> public void GetForm(string To, string Language, string ServiceToken, string DeviceToken, string UserToken, DataFormResultEventHandler Callback, object State, params ThingReference[] Nodes) { StringBuilder Xml = this.CommandHeader("getForm", Language, ServiceToken, DeviceToken, UserToken, Nodes); Xml.Append("</getForm>"); this.client.SendIqGet(To, Xml.ToString(), this.GetFormResult, new object[] { Callback, State, Nodes }); }
public override void GetConfigurationForm(DataFormResultEventHandler Callback, object State) { DataForm Form = new DataForm(this.client, this.ChangePassword, this.CancelChangePassword, this.BareJID, this.BareJID, new TextPrivateField(null, "Password", "New password:"******"Enter new password here.", new StringDataType(), new PasswordValidation(), string.Empty, false, false, false), new TextPrivateField(null, "Password2", "Retype password:"******"Retype password here.", new StringDataType(), new Password2Validation(), string.Empty, false, false, false)) { Title = "Change password", Instructions = new string[] { "Enter the new password you wish to use." } }; Callback(this, new DataFormEventArgs(Form, new IqResultEventArgs(null, string.Empty, this.BareJID, this.BareJID, true, State))); }
public override void GetConfigurationForm(DataFormResultEventHandler Callback, object State) { XmppAccountNode XmppAccountNode = this.XmppAccountNode; ControlClient ControlClient; if (XmppAccountNode != null && (ControlClient = XmppAccountNode.ControlClient) != null) { ControlClient.GetForm(this.RosterItem.LastPresenceFullJid, "en", Callback, State); } else { throw new NotSupportedException(); } }
public override void GetConfigurationForm(DataFormResultEventHandler Callback, object State) { XmppConcentrator Concentrator = this.Concentrator; XmppAccountNode XmppAccountNode = Concentrator.XmppAccountNode; ControlClient ControlClient; if (XmppAccountNode != null && (ControlClient = XmppAccountNode.ControlClient) != null) { ControlClient.GetForm(Concentrator.RosterItem.LastPresenceFullJid, "en", Callback, State, new ThingReference(this.nodeInfo.NodeId, this.nodeInfo.SourceId, this.nodeInfo.Partition)); } else { throw new NotSupportedException(); } }
private async Task GetFormResult(object Sender, IqResultEventArgs e) { object[] P = (object[])e.State; DataFormResultEventHandler Callback = (DataFormResultEventHandler)P[0]; if (Callback is null) { return; } object State = P[1]; ThingReference[] Nodes = (ThingReference[])P[2]; DataForm Form = null; if (e.Ok) { foreach (XmlNode N in e.Response.ChildNodes) { if (N.LocalName == "x") { Form = new DataForm(this.client, (XmlElement)N, this.SubmitForm, this.CancelForm, e.From, e.To); break; } } if (!(Form is null)) { Form.State = Nodes; } } if (!(Callback is null)) { DataFormEventArgs e2 = new DataFormEventArgs(Form, e); try { e2.State = State; await Callback(this, e2); } catch (Exception ex) { Log.Critical(ex); } } }
/// <summary> /// Gets the configuration form for the node. /// </summary> /// <param name="Callback">Method called when form is returned or when operation fails.</param> /// <param name="State">State object to pass on to the callback method.</param> /// <exception cref="NotSupportedException">If the feature is not supported by the node.</exception> public virtual void GetConfigurationForm(DataFormResultEventHandler Callback, object State) { throw new NotSupportedException(); }
/// <summary> /// Gets a control form. /// </summary> /// <param name="To">Full JID of remote actuator.</param> /// <param name="Language">Preferred language.</param> /// <param name="Callback">Method called when form is returned or when operation fails.</param> /// <param name="State">State object to pass on to the callback method.</param> /// <param name="Nodes">Node(s) to get the form from, if residing behind a concentrator.</param> public void GetForm(string To, string Language, DataFormResultEventHandler Callback, object State, params ThingReference[] Nodes) { this.GetForm(To, Language, string.Empty, string.Empty, string.Empty, Callback, State, Nodes); }