Search in sources :

Example 21 with IqPacket

use of eu.siacs.conversations.xmpp.stanzas.IqPacket in project Conversations by siacs.

the class IqGenerator method changeRole.

public IqPacket changeRole(Conversation conference, String nick, String role) {
    IqPacket packet = new IqPacket(IqPacket.TYPE.SET);
    packet.setTo(conference.getJid().toBareJid());
    packet.setFrom(conference.getAccount().getJid());
    Element item = packet.query("http://jabber.org/protocol/muc#admin").addChild("item");
    item.setAttribute("nick", nick);
    item.setAttribute("role", role);
    return packet;
}
Also used : Element(eu.siacs.conversations.xml.Element) IqPacket(eu.siacs.conversations.xmpp.stanzas.IqPacket)

Example 22 with IqPacket

use of eu.siacs.conversations.xmpp.stanzas.IqPacket in project Conversations by siacs.

the class IqGenerator method queryMessageArchiveManagement.

public IqPacket queryMessageArchiveManagement(final MessageArchiveService.Query mam) {
    final IqPacket packet = new IqPacket(IqPacket.TYPE.SET);
    final Element query = packet.query(mam.isLegacy() ? Namespace.MAM_LEGACY : Namespace.MAM);
    query.setAttribute("queryid", mam.getQueryId());
    final Data data = new Data();
    data.setFormType(mam.isLegacy() ? Namespace.MAM_LEGACY : Namespace.MAM);
    if (mam.muc()) {
        packet.setTo(mam.getWith());
    } else if (mam.getWith() != null) {
        data.put("with", mam.getWith().toString());
    }
    data.put("start", getTimestamp(mam.getStart()));
    data.put("end", getTimestamp(mam.getEnd()));
    data.submit();
    query.addChild(data);
    if (mam.getPagingOrder() == MessageArchiveService.PagingOrder.REVERSE) {
        query.addChild("set", "http://jabber.org/protocol/rsm").addChild("before").setContent(mam.getReference());
    } else if (mam.getReference() != null) {
        query.addChild("set", "http://jabber.org/protocol/rsm").addChild("after").setContent(mam.getReference());
    }
    return packet;
}
Also used : Element(eu.siacs.conversations.xml.Element) Data(eu.siacs.conversations.xmpp.forms.Data) IqPacket(eu.siacs.conversations.xmpp.stanzas.IqPacket)

Example 23 with IqPacket

use of eu.siacs.conversations.xmpp.stanzas.IqPacket in project Conversations by siacs.

the class IqGenerator method pubsubConfiguration.

private IqPacket pubsubConfiguration(Jid jid, String node, Data data) {
    IqPacket packet = new IqPacket(data == null ? IqPacket.TYPE.GET : IqPacket.TYPE.SET);
    packet.setTo(jid);
    Element pubsub = packet.addChild("pubsub", "http://jabber.org/protocol/pubsub#owner");
    Element configure = pubsub.addChild("configure").setAttribute("node", node);
    if (data != null) {
        configure.addChild(data);
    }
    return packet;
}
Also used : Element(eu.siacs.conversations.xml.Element) IqPacket(eu.siacs.conversations.xmpp.stanzas.IqPacket)

Example 24 with IqPacket

use of eu.siacs.conversations.xmpp.stanzas.IqPacket in project Conversations by siacs.

the class IqGenerator method retrieve.

protected IqPacket retrieve(String node, Element item) {
    final IqPacket packet = new IqPacket(IqPacket.TYPE.GET);
    final Element pubsub = packet.addChild("pubsub", "http://jabber.org/protocol/pubsub");
    final Element items = pubsub.addChild("items");
    items.setAttribute("node", node);
    if (item != null) {
        items.addChild(item);
    }
    return packet;
}
Also used : Element(eu.siacs.conversations.xml.Element) IqPacket(eu.siacs.conversations.xmpp.stanzas.IqPacket)

Example 25 with IqPacket

use of eu.siacs.conversations.xmpp.stanzas.IqPacket in project Conversations by siacs.

the class IqGenerator method publish.

protected IqPacket publish(final String node, final Element item) {
    final IqPacket packet = new IqPacket(IqPacket.TYPE.SET);
    final Element pubsub = packet.addChild("pubsub", "http://jabber.org/protocol/pubsub");
    final Element publish = pubsub.addChild("publish");
    publish.setAttribute("node", node);
    publish.addChild(item);
    return packet;
}
Also used : Element(eu.siacs.conversations.xml.Element) IqPacket(eu.siacs.conversations.xmpp.stanzas.IqPacket)

Aggregations

IqPacket (eu.siacs.conversations.xmpp.stanzas.IqPacket)78 Element (eu.siacs.conversations.xml.Element)43 Account (eu.siacs.conversations.entities.Account)41 OnIqPacketReceived (eu.siacs.conversations.xmpp.OnIqPacketReceived)33 Jid (eu.siacs.conversations.xmpp.jid.Jid)14 Data (eu.siacs.conversations.xmpp.forms.Data)6 InvalidJidException (eu.siacs.conversations.xmpp.jid.InvalidJidException)6 ArrayList (java.util.ArrayList)6 JinglePacket (eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket)4 HashSet (java.util.HashSet)4 InvalidKeyException (org.whispersystems.libaxolotl.InvalidKeyException)4 PreKeyBundle (org.whispersystems.libaxolotl.state.PreKeyBundle)4 Pair (android.util.Pair)3 Conversation (eu.siacs.conversations.entities.Conversation)3 IOException (java.io.IOException)3 InputStream (java.io.InputStream)3 InvalidKeyIdException (org.whispersystems.libaxolotl.InvalidKeyIdException)3 Bundle (android.os.Bundle)2 Bookmark (eu.siacs.conversations.entities.Bookmark)2 Contact (eu.siacs.conversations.entities.Contact)2