/// <summary> /// Gets interoperability interfaces from an entity. /// </summary> /// <param name="Destination">JID of entity.</param> /// <param name="Timeout">Timeout in milliseconds.</param> /// <exception cref="TimeoutException">If timeout occurs.</exception> /// <returns>Array of Interfaces.</returns> public string[] GetInterfaces(string Destination, int Timeout) { ManualResetEvent Done = new ManualResetEvent(false); InteroperabilityClientEventArgs e = null; try { this.SendGetInterfacesRequest(Destination, (sender, e2) => { e = e2; Done.Set(); }, null); if (!Done.WaitOne(Timeout)) { throw new TimeoutException(); } } finally { Done.Dispose(); } if (!e.Ok) { throw e.StanzaError; } return(e.Interfaces); }
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); } } }