couple of modifications for disco discovery

This commit is contained in:
iNPUTmice 2014-06-30 11:43:00 +02:00
parent 9a239f6589
commit dcb21cb9e6

View file

@ -924,16 +924,25 @@ public class XmppConnection implements Runnable {
return disco.get(server).contains(feature); return disco.get(server).contains(feature);
} }
public String findDiscoItemByFeature(String feature) { public List<String> findDiscoItemsByFeature(String feature) {
List<String> items = new ArrayList<String>();
Iterator<Entry<String, List<String>>> it = this.disco.entrySet() Iterator<Entry<String, List<String>>> it = this.disco.entrySet()
.iterator(); .iterator();
while (it.hasNext()) { while (it.hasNext()) {
Entry<String, List<String>> pairs = it.next(); Entry<String, List<String>> pairs = it.next();
if (pairs.getValue().contains(feature)&&pairs.getValue().size()==1) { if (pairs.getValue().contains(feature)) {
return pairs.getKey(); items.add(pairs.getKey());
} }
it.remove(); it.remove();
} }
return items;
}
public String findDiscoItemByFeature(String feature) {
List<String> items = findDiscoItemsByFeature(feature);
if (items.size()>=1) {
return items.get(0);
}
return null; return null;
} }