/** * Returns the first patcket extension that matches the specified element name and * namespace, or <tt>null</tt> if it doesn't exist. * * @param elementName the XML element name of the packet extension. * @param namespace the XML element namespace of the packet extension. * @return the extension, or <tt>null</tt> if it doesn't exist. */ public synchronized PacketExtension getExtension(String elementName, String namespace) { if (applicationExtensions == null || elementName == null || namespace == null) { return null; } for (PacketExtension ext : applicationExtensions) { if (elementName.equals(ext.getElementName()) && namespace.equals(ext.getNamespace())) { return ext; } } return null; }
/** * Returns the first patcket extension that matches the specified element name and * namespace, or <tt>null</tt> if it doesn't exist. * * @param elementName the XML element name of the packet extension. * @param namespace the XML element namespace of the packet extension. * @return the extension, or <tt>null</tt> if it doesn't exist. */ public synchronized PacketExtension getExtension(String elementName, String namespace) { if (applicationExtensions == null || elementName == null || namespace == null) { return null; } for (PacketExtension ext : applicationExtensions) { if (elementName.equals(ext.getElementName()) && namespace.equals(ext.getNamespace())) { return ext; } } return null; }
/** * Returns the first patcket extension that matches the specified element name and * namespace, or <tt>null</tt> if it doesn't exist. * * @param elementName the XML element name of the packet extension. * @param namespace the XML element namespace of the packet extension. * @return the extension, or <tt>null</tt> if it doesn't exist. */ public synchronized PacketExtension getExtension(String elementName, String namespace) { if (applicationExtensions == null || elementName == null || namespace == null) { return null; } for (PacketExtension ext : applicationExtensions) { if (elementName.equals(ext.getElementName()) && namespace.equals(ext.getNamespace())) { return ext; } } return null; }
/** * Returns the first packet extension that matches the specified element name and * namespace, or <tt>null</tt> if it doesn't exist. Packet extensions are * are arbitrary XML sub-documents in standard XMPP packets. By default, a * DefaultPacketExtension instance will be returned for each extension. However, * PacketExtensionProvider instances can be registered with the * {@link org.jivesoftware.smack.provider.ProviderManager ProviderManager} * class to handle custom parsing. In that case, the type of the Object * will be determined by the provider. * * @param elementName the XML element name of the packet extension. * @param namespace the XML element namespace of the packet extension. * @return the extension, or <tt>null</tt> if it doesn't exist. */ public synchronized PacketExtension getExtension(String elementName, String namespace) { if (packetExtensions == null || elementName == null || namespace == null) { return null; } for (Iterator i=packetExtensions.iterator(); i.hasNext(); ) { PacketExtension ext = (PacketExtension)i.next(); if (elementName.equals(ext.getElementName()) && namespace.equals(ext.getNamespace())) { return ext; } } return null; }
/** * Returns the first packet extension that matches the specified element name and * namespace, or <tt>null</tt> if it doesn't exist. If the provided elementName is null * than only the provided namespace is attempted to be matched. Packet extensions are * are arbitrary XML sub-documents in standard XMPP packets. By default, a * DefaultPacketExtension instance will be returned for each extension. However, * PacketExtensionProvider instances can be registered with the * {@link org.jivesoftware.smack.provider.ProviderManager ProviderManager} * class to handle custom parsing. In that case, the type of the Object * will be determined by the provider. * * @param elementName the XML element name of the packet extension. (May be null) * @param namespace the XML element namespace of the packet extension. * @return the extension, or <tt>null</tt> if it doesn't exist. */ public PacketExtension getExtension(String elementName, String namespace) { if (namespace == null) { return null; } for (PacketExtension ext : packetExtensions) { if ((elementName == null || elementName.equals(ext.getElementName())) && namespace.equals(ext.getNamespace())) { return ext; } } return null; }
/** * Returns the first packet extension that matches the specified element name and * namespace, or <tt>null</tt> if it doesn't exist. If the provided elementName is null * than only the provided namespace is attempted to be matched. Packet extensions are * are arbitrary XML sub-documents in standard XMPP packets. By default, a * DefaultPacketExtension instance will be returned for each extension. However, * PacketExtensionProvider instances can be registered with the * {@link org.jivesoftware.smack.provider.ProviderManager ProviderManager} * class to handle custom parsing. In that case, the type of the Object * will be determined by the provider. * * @param elementName the XML element name of the packet extension. (May be null) * @param namespace the XML element namespace of the packet extension. * @return the extension, or <tt>null</tt> if it doesn't exist. */ public PacketExtension getExtension(String elementName, String namespace) { if (namespace == null) { return null; } for (PacketExtension ext : packetExtensions) { if ((elementName == null || elementName.equals(ext.getElementName())) && namespace.equals(ext.getNamespace())) { return ext; } } return null; }
/** * Returns the first packet extension that matches the specified element name and * namespace, or <tt>null</tt> if it doesn't exist. If the provided elementName is null * than only the provided namespace is attempted to be matched. Packet extensions are * are arbitrary XML sub-documents in standard XMPP packets. By default, a * DefaultPacketExtension instance will be returned for each extension. However, * PacketExtensionProvider instances can be registered with the * {@link org.jivesoftware.smack.provider.ProviderManager ProviderManager} * class to handle custom parsing. In that case, the type of the Object * will be determined by the provider. * * @param elementName the XML element name of the packet extension. (May be null) * @param namespace the XML element namespace of the packet extension. * @return the extension, or <tt>null</tt> if it doesn't exist. */ public PacketExtension getExtension(String elementName, String namespace) { if (namespace == null) { return null; } for (PacketExtension ext : packetExtensions) { if ((elementName == null || elementName.equals(ext.getElementName())) && namespace.equals(ext.getNamespace())) { return ext; } } return null; }
/** * * @param info * @return true if the packet extensions is ill-formed */ protected static boolean verifyPacketExtensions(DiscoverInfo info) { List<FormField> foundFormTypes = new LinkedList<FormField>(); for (Iterator<PacketExtension> i = info.getExtensions().iterator(); i.hasNext();) { PacketExtension pe = i.next(); if (pe.getNamespace().equals(Form.NAMESPACE)) { DataForm df = (DataForm) pe; for (Iterator<FormField> it = df.getFields(); it.hasNext();) { FormField f = it.next(); if (f.getVariable().equals("FORM_TYPE")) { for (FormField fft : foundFormTypes) { if (f.equals(fft)) return true; } foundFormTypes.add(f); } } } } return false; }