Examples of PubSub


Examples of org.jivesoftware.smackx.pubsub.packet.PubSub

  public ConfigureForm getDefaultConfiguration()
    throws XMPPException
  {
    // Errors will cause exceptions in getReply, so it only returns
    // on success.
    PubSub reply = (PubSub)sendPubsubPacket(Type.GET, new NodeExtension(PubSubElementType.DEFAULT), PubSubElementType.DEFAULT.getNamespace());
    return NodeUtils.getFormFromPacket(reply, PubSubElementType.DEFAULT);
  }
View Full Code Here

Examples of org.jivesoftware.smackx.pubsub.packet.PubSub

    return createPubsubPacket(to, type, ext, null);
  }
 
  static PubSub createPubsubPacket(String to, Type type, PacketExtension ext, PubSubNamespace ns)
  {
    PubSub request = new PubSub();
    request.setTo(to);
    request.setType(type);
   
    if (ns != null)
    {
      request.setPubSubNamespace(ns);
    }
    request.addExtension(ext);
   
    return request;
  }
View Full Code Here

Examples of org.jivesoftware.smackx.pubsub.packet.PubSub

*/
public class PubSubProvider implements IQProvider
{
  public IQ parseIQ(XmlPullParser parser) throws Exception
  {
        PubSub pubsub = new PubSub();
        String namespace = parser.getNamespace();
        pubsub.setPubSubNamespace(PubSubNamespace.valueOfFromXmlns(namespace));
        boolean done = false;

        while (!done)
        {
            int eventType = parser.next();
           
            if (eventType == XmlPullParser.START_TAG)
            {
              PacketExtension ext = PacketParserUtils.parsePacketExtension(parser.getName(), namespace, parser);
             
              if (ext != null)
              {
                pubsub.addExtension(ext);
              }
            }
            else if (eventType == XmlPullParser.END_TAG)
            {
                if (parser.getName().equals("pubsub"))
View Full Code Here

Examples of rocks.xmpp.extensions.pubsub.model.PubSub

     * @throws rocks.xmpp.core.session.NoResponseException  If the entity did not respond.
     * @see <a href="http://xmpp.org/extensions/xep-0060.html#entity-subscriptions">5.6 Retrieve Subscriptions</a>
     */
    private List<Subscription> getSubscriptions() throws XmppException {
        IQ result = xmppSession.query(new IQ(service, IQ.Type.GET, PubSub.withSubscriptions()));
        PubSub pubSub = result.getExtension(PubSub.class);
        return pubSub.getSubscriptions();
    }
View Full Code Here

Examples of rocks.xmpp.extensions.pubsub.model.PubSub

     * @throws rocks.xmpp.core.session.NoResponseException  If the entity did not respond.
     * @see <a href="http://xmpp.org/extensions/xep-0060.html#entity-affiliations">5.7 Retrieve Affiliations</a>
     */
    private List<Affiliation> getAffiliations() throws XmppException {
        IQ result = xmppSession.query(new IQ(service, IQ.Type.GET, PubSub.withAffiliations()));
        PubSub pubSub = result.getExtension(PubSub.class);
        return pubSub.getAffiliations();
    }
View Full Code Here

Examples of rocks.xmpp.extensions.pubsub.model.PubSub

     * @throws rocks.xmpp.core.session.NoResponseException  If the entity did not respond.
     * @see <a href="http://xmpp.org/extensions/xep-0060.html#subscriber-configure-submit">6.4 Request Default Subscription Configuration Options</a>
     */
    private DataForm getDefaultSubscriptionOptions() throws XmppException {
        IQ result = xmppSession.query(new IQ(service, IQ.Type.GET, PubSub.withDefault()));
        PubSub pubSub = result.getExtension(PubSub.class);
        return pubSub.getDefault().getDataForm();
    }
View Full Code Here

Examples of rocks.xmpp.extensions.pubsub.model.PubSub

        super(IQ.class, PubSub.class);
    }

    @Test
    public void marshalPublish() throws JAXBException, XMLStreamException {
        PubSub pubSub = PubSub.withPublish("princely_musings", "bnd81g37d61f49fgn581", null);
        String xml = marshal(pubSub);
        Assert.assertEquals(xml, "<pubsub xmlns=\"http://jabber.org/protocol/pubsub\"><publish node=\"princely_musings\"><item id=\"bnd81g37d61f49fgn581\"></item></publish></pubsub>");
    }
View Full Code Here

Examples of rocks.xmpp.extensions.pubsub.model.PubSub

                "    </publish>\n" +
                "  </pubsub>\n" +
                "</iq>";

        IQ iq = unmarshal(xml, IQ.class);
        PubSub pubSub = iq.getExtension(PubSub.class);
        Assert.assertNotNull(pubSub);
        Assert.assertNotNull(pubSub.getPublish());
        Assert.assertEquals(pubSub.getPublish().getNode(), "princely_musings");
        Assert.assertNotNull(pubSub.getPublish().getItem());
    }
View Full Code Here

Examples of rocks.xmpp.extensions.pubsub.model.PubSub

        Assert.assertNotNull(pubSub.getPublish().getItem());
    }

    @Test
    public void marshalDeleteItem() throws JAXBException, XMLStreamException {
        PubSub pubSub = PubSub.withRetract("princely_musings", "ae890ac52d0df67ed7cfdf51b644e901", false);
        String xml = marshal(pubSub);
        Assert.assertEquals(xml, "<pubsub xmlns=\"http://jabber.org/protocol/pubsub\"><retract notify=\"false\" node=\"princely_musings\"><item id=\"ae890ac52d0df67ed7cfdf51b644e901\"></item></retract></pubsub>");
    }
View Full Code Here

Examples of rocks.xmpp.extensions.pubsub.model.PubSub

                "    </publish>\n" +
                "  </pubsub>\n" +
                "</iq>\n";
        IQ iq = unmarshal(xml, IQ.class);

        PubSub pubSub = iq.getExtension(PubSub.class);
        Assert.assertNotNull(pubSub);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.