/// <summary>
        /// Queries the client's server for a list of SOCKS5 proxies.
        /// </summary>
        /// <returns>An enumerable collection of SOCKS5 proxies available to
        /// the client.</returns>
        /// <exception cref="NotSupportedException">The client's XMPP server
        /// does not support querying for proxy information.</exception>
        /// <exception cref="XmppErrorException">The server returned an XMPP error code.
        /// Use the Error property of the XmppErrorException to obtain the specific
        /// error condition.</exception>
        /// <exception cref="XmppException">The server returned invalid data or another
        /// unspecified XMPP error occurred.</exception>
        IEnumerable <Streamhost> GetProxyList()
        {
            ISet <Streamhost> set = new HashSet <Streamhost>();

            foreach (var item in sdisco.GetItems(im.Jid.Domain))
            {
                // Query each item for its identities and look for a 'proxy' identity.
                foreach (var ident in sdisco.GetIdentities(item.Jid))
                {
                    // It's a SOCKS5 proxy.
                    if (ident.Category == "proxy" && ident.Type == "bytestreams")
                    {
                        // Get the full network address.
                        var address = GetNetworkAddress(item.Jid);
                        set.Add(address);
                    }
                }
            }
            return(set);
        }
Esempio n. 2
0
 /// <summary>
 /// Queries the XMPP entity with the specified JID for identity information.
 /// </summary>
 /// <param name="jid">The JID of the XMPP entity to query.</param>
 /// <returns>An enumerable collection of identities of the XMPP entity
 /// with the specified JID.</returns>
 /// <exception cref="ArgumentNullException">The jid parameter
 /// is null.</exception>
 /// <exception cref="NotSupportedException">The query could not be
 /// performed or the response was invalid.</exception>
 public IEnumerable <Identity> GetIdentities(Jid jid)
 {
     return(sdisco.GetIdentities(jid));
 }