private void GetInterfacesResult(object Sender, IqResultEventArgs e) { List <string> Interfaces = new List <string>(); object[] P = (object[])e.State; InteroperabilityInterfacesClientEventHandler Callback = (InteroperabilityInterfacesClientEventHandler)P[0]; object State = P[1]; if (e.Ok) { foreach (XmlNode N in e.Response.ChildNodes) { if (N.LocalName == "getInterfacesResponse") { foreach (XmlNode N2 in N.ChildNodes) { if (N2.LocalName == "interface") { Interfaces.Add(XML.Attribute((XmlElement)N2, "name")); } } } } } InteroperabilityClientEventArgs e2 = new InteroperabilityClientEventArgs(Interfaces.ToArray(), e); if (Callback != null) { try { Callback(this, e2); } catch (Exception ex) { Log.Critical(ex); } } }
/// <summary> /// Sends a request for interoperability interfaces from an entity. /// </summary> /// <param name="Destination">JID of entity.</param> /// <param name="Callback">Method to call when response or error is returned.</param> /// <param name="State">State object to pass on to callback method.</param> public void SendGetInterfacesRequest(string Destination, InteroperabilityInterfacesClientEventHandler Callback, object State) { this.client.SendIqGet(Destination, "<getInterfaces xmlns='" + InteroperabilityServer.NamespaceInteroperability + "'/>", this.GetInterfacesResult, new object[] { Callback, State }); }