Beispiel #1
0
 /// <summary>
 /// Retrieves an enumerable collection of XMPP extensions that the XMPP
 /// entity with the specified JID supports.
 /// </summary>
 /// <param name="jid">The JID of the XMPP entity to retrieve supported
 /// extensions for.</param>
 /// <returns>An enumerable collection of XMPP extensions supported by the
 /// XMPP entity with the specified JID.</returns>
 /// <exception cref="ArgumentNullException">The jid parameter is
 /// null.</exception>
 /// <exception cref="NotSupportedException">The XMPP entity with
 /// the specified JID does not support querying of feature
 /// information.</exception>
 public IEnumerable <Extension> GetExtensions(Jid jid)
 {
     jid.ThrowIfNull("jid");
     if (hashes.ContainsKey(jid))
     {
         string hash = hashes[jid];
         // If the feature set has already been cached, return it; Otherwise
         // request the feature set and subsequently cache it.
         // FIXME: Calculate hash of feature set and ensure it equals stored hash.
         if (!cachedFeatures.ContainsKey(hash))
         {
             cachedFeatures.Add(hash, sdisco.GetExtensions(jid));
         }
         return(cachedFeatures[hash]);
     }
     // If we don't have a hash for the jid, the XMPP entity probably does not
     // support 'caps' so resort to a normal SDisco request.
     return(sdisco.GetExtensions(jid));
 }