/** * Checks the service discovery item returned from a server component to verify if it is a File * Transfer proxy or not. * * @param manager the service discovery manager which will be used to query the component * @param item the discovered item on the server relating * @return returns the JID of the proxy if it is a proxy or null if the item is not a proxy. */ private String checkIsProxy(ServiceDiscoveryManager manager, DiscoverItems.Item item) { DiscoverInfo info; try { info = manager.discoverInfo(item.getEntityID()); } catch (XMPPException e) { return null; } Iterator itx = info.getIdentities(); while (itx.hasNext()) { DiscoverInfo.Identity identity = (DiscoverInfo.Identity) itx.next(); if ("proxy".equalsIgnoreCase(identity.getCategory()) && "bytestreams".equalsIgnoreCase(identity.getType())) { return info.getFrom(); } } return null; }
RoomInfo(DiscoverInfo info) { super(); this.room = info.getFrom(); // Get the information based on the discovered features this.membersOnly = info.containsFeature("muc_membersonly"); this.moderated = info.containsFeature("muc_moderated"); this.nonanonymous = info.containsFeature("muc_nonanonymous"); this.passwordProtected = info.containsFeature("muc_passwordprotected"); this.persistent = info.containsFeature("muc_persistent"); // Get the information based on the discovered extended information Form form = Form.getFormFrom(info); if (form != null) { this.description = form.getField("muc#roominfo_description").getValues().next(); Iterator<String> values = form.getField("muc#roominfo_subject").getValues(); if (values.hasNext()) { this.subject = values.next(); } else { this.subject = ""; } this.occupantsCount = Integer.parseInt(form.getField("muc#roominfo_occupants").getValues().next()); } }