Search in sources :

Example 26 with IqPacket

use of de.pixart.messenger.xmpp.stanzas.IqPacket in project Pix-Art-Messenger by kriztan.

the class IqGenerator method retrieveBundlesForDevice.

public IqPacket retrieveBundlesForDevice(final Jid to, final int deviceid) {
    final IqPacket packet = retrieve(AxolotlService.PEP_BUNDLES + ":" + deviceid, null);
    packet.setTo(to);
    return packet;
}
Also used : IqPacket(de.pixart.messenger.xmpp.stanzas.IqPacket)

Example 27 with IqPacket

use of de.pixart.messenger.xmpp.stanzas.IqPacket in project Pix-Art-Messenger by kriztan.

the class IqGenerator method generateSetBlockRequest.

public IqPacket generateSetBlockRequest(final Jid jid, boolean reportSpam) {
    final IqPacket iq = new IqPacket(IqPacket.TYPE.SET);
    final Element block = iq.addChild("block", Namespace.BLOCKING);
    final Element item = block.addChild("item").setAttribute("jid", jid.toBareJid().toString());
    if (reportSpam) {
        item.addChild("report", "urn:xmpp:reporting:0").addChild("spam");
    }
    Log.d(Config.LOGTAG, iq.toString());
    return iq;
}
Also used : Element(de.pixart.messenger.xml.Element) IqPacket(de.pixart.messenger.xmpp.stanzas.IqPacket)

Example 28 with IqPacket

use of de.pixart.messenger.xmpp.stanzas.IqPacket in project Pix-Art-Messenger by kriztan.

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());
    }
    if (mam.getStart() != 0) {
        data.put("start", getTimestamp(mam.getStart()));
    }
    data.put("end", getTimestamp(mam.getEnd()));
    data.submit();
    query.addChild(data);
    Element set = query.addChild("set", "http://jabber.org/protocol/rsm");
    if (mam.getPagingOrder() == MessageArchiveService.PagingOrder.REVERSE) {
        set.addChild("before").setContent(mam.getReference());
    } else if (mam.getReference() != null) {
        set.addChild("after").setContent(mam.getReference());
    }
    set.addChild("max").setContent(String.valueOf(Config.PAGE_SIZE));
    return packet;
}
Also used : Element(de.pixart.messenger.xml.Element) Data(de.pixart.messenger.xmpp.forms.Data) IqPacket(de.pixart.messenger.xmpp.stanzas.IqPacket)

Example 29 with IqPacket

use of de.pixart.messenger.xmpp.stanzas.IqPacket in project Pix-Art-Messenger by kriztan.

the class IqGenerator method requestHttpUploadSlot.

public IqPacket requestHttpUploadSlot(Jid host, DownloadableFile file, String mime) {
    IqPacket packet = new IqPacket(IqPacket.TYPE.GET);
    packet.setTo(host);
    Element request = packet.addChild("request", Namespace.HTTP_UPLOAD);
    request.setAttribute("filename", convertFilename(file.getName()));
    request.setAttribute("size", file.getExpectedSize());
    request.setAttribute("content-type", mime);
    return packet;
}
Also used : Element(de.pixart.messenger.xml.Element) IqPacket(de.pixart.messenger.xmpp.stanzas.IqPacket)

Example 30 with IqPacket

use of de.pixart.messenger.xmpp.stanzas.IqPacket in project Pix-Art-Messenger by kriztan.

the class IqGenerator method generateSetUnblockRequest.

public IqPacket generateSetUnblockRequest(final Jid jid) {
    final IqPacket iq = new IqPacket(IqPacket.TYPE.SET);
    final Element block = iq.addChild("unblock", Namespace.BLOCKING);
    block.addChild("item").setAttribute("jid", jid.toBareJid().toString());
    return iq;
}
Also used : Element(de.pixart.messenger.xml.Element) IqPacket(de.pixart.messenger.xmpp.stanzas.IqPacket)

Aggregations

IqPacket (de.pixart.messenger.xmpp.stanzas.IqPacket)81 Element (de.pixart.messenger.xml.Element)48 Account (de.pixart.messenger.entities.Account)39 OnIqPacketReceived (de.pixart.messenger.xmpp.OnIqPacketReceived)31 Jid (de.pixart.messenger.xmpp.jid.Jid)15 ArrayList (java.util.ArrayList)7 Data (de.pixart.messenger.xmpp.forms.Data)6 InvalidJidException (de.pixart.messenger.xmpp.jid.InvalidJidException)6 PreKeyBundle (org.whispersystems.libsignal.state.PreKeyBundle)5 JinglePacket (de.pixart.messenger.xmpp.jingle.stanzas.JinglePacket)4 IOException (java.io.IOException)4 InvalidKeyException (org.whispersystems.libsignal.InvalidKeyException)4 Bundle (android.os.Bundle)3 Pair (android.util.Pair)3 Contact (de.pixart.messenger.entities.Contact)3 Conversation (de.pixart.messenger.entities.Conversation)3 FileNotFoundException (java.io.FileNotFoundException)3 InputStream (java.io.InputStream)3 HashSet (java.util.HashSet)3 List (java.util.List)3