Fix minor issue in CapsManager.
authorDa Risk <darisk972@gmail.com>
Tue, 08 Feb 2011 21:07:58 +0100
changeset 873 e0aa4b3c5d17
parent 872 1a0caf61fc7c
child 874 4dd9fe4d0a3e
Fix minor issue in CapsManager. The service discovery request must include the node attribute. Fix #341
src/com/beem/project/beem/smack/caps/CapsManager.java
--- a/src/com/beem/project/beem/smack/caps/CapsManager.java	Sat Feb 05 21:25:11 2011 +0100
+++ b/src/com/beem/project/beem/smack/caps/CapsManager.java	Tue Feb 08 21:07:58 2011 +0100
@@ -178,7 +178,7 @@
 		PacketExtension p = packet.getExtension("c", "http://jabber.org/protocol/caps");
 		CapsExtension caps = (CapsExtension) p;
 		if (!isInCache(caps.getVer())) {
-		    validate(packet.getFrom(), caps.getVer(), caps.getHash());
+		    validate(packet.getFrom(), caps.getNode(), caps.getVer(), caps.getHash());
 		}
 	    }
 	}, filter);
@@ -204,13 +204,14 @@
      * Validate the ver attribute of a received capability.
      *
      * @param jid the jid of the sender of the capability.
+     * @param node the node attribute of the capability.
      * @param ver the ver attribute of the capability.
      * @param hashMethod the hash algorithm to use to calculate ver
      * @return true if the ver attribute is valid false otherwise.
      */
-    private boolean validate(String jid, String ver, String hashMethod) {
+    private boolean validate(String jid, String node, String ver, String hashMethod) {
 	try {
-	    DiscoverInfo info = mSdm.discoverInfo(jid);
+	    DiscoverInfo info = mSdm.discoverInfo(jid, node + "#" + ver);
 	    if (!mSupportedAlgorithm.contains(hashMethod)) {
 		mJidCache.put(jid, info);
 		return false;