1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-06-11 22:24:50 +02:00

SMACK-272 Add support for XEP-0060 (pubsub)

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@11350 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
rcollier 2009-10-28 22:54:49 +00:00
parent c00e7e333d
commit 8dd8ec02a5
2 changed files with 43 additions and 4 deletions

View file

@ -543,7 +543,7 @@
<extensionProvider>
<elementName>options</elementName>
<namespace>http://jabber.org/protocol/pubsub</namespace>
<className>org.jivesoftware.smackx.provider.FormNodeProvider</className>
<className>org.jivesoftware.smackx.pubsub.provider.FormNodeProvider</className>
</extensionProvider>
<!-- XEP-0060 pubsub#owner -->
@ -556,13 +556,13 @@
<extensionProvider>
<elementName>configure</elementName>
<namespace>http://jabber.org/protocol/pubsub#owner</namespace>
<className>org.jivesoftware.smackx.provider.FormNodeProvider</className>
<className>org.jivesoftware.smackx.pubsub.provider.FormNodeProvider</className>
</extensionProvider>
<extensionProvider>
<elementName>default</elementName>
<namespace>http://jabber.org/protocol/pubsub#owner</namespace>
<className>org.jivesoftware.smackx.provider.FormNodeProvider</className>
<className>org.jivesoftware.smackx.pubsub.provider.FormNodeProvider</className>
</extensionProvider>
<!-- XEP-0060 pubsub#event -->
@ -587,7 +587,7 @@
<extensionProvider>
<elementName>options</elementName>
<namespace>http://jabber.org/protocol/pubsub#event</namespace>
<className>org.jivesoftware.smackx.provider.FormNodeProvider</className>
<className>org.jivesoftware.smackx.pubsub.provider.FormNodeProvider</className>
</extensionProvider>
<extensionProvider>

View file

@ -0,0 +1,39 @@
/**
* All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.pubsub.provider;
import java.util.List;
import java.util.Map;
import org.jivesoftware.smack.packet.PacketExtension;
import org.jivesoftware.smackx.Form;
import org.jivesoftware.smackx.packet.DataForm;
import org.jivesoftware.smackx.provider.EmbeddedExtensionProvider;
import org.jivesoftware.smackx.pubsub.FormNode;
import org.jivesoftware.smackx.pubsub.FormNodeType;
/**
* Parses one of several elements used in pubsub that contain a form of some kind as a child element. The
* elements and namespaces supported is defined in {@link FormNodeType}.
*
* @author Robin Collier
*/
public class FormNodeProvider extends EmbeddedExtensionProvider
{
@Override
protected PacketExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content)
{
return new FormNode(FormNodeType.valueOfFromElementName(currentElement, currentNamespace), attributeMap.get("node"), new Form((DataForm)content.iterator().next()));
}
}