Search in sources :

Example 66 with IqPacket

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

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(eu.siacs.conversations.xml.Element) IqPacket(eu.siacs.conversations.xmpp.stanzas.IqPacket)

Example 67 with IqPacket

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

the class IqGenerator method enablePush.

public IqPacket enablePush(Jid jid, String node, String secret) {
    IqPacket packet = new IqPacket(IqPacket.TYPE.SET);
    Element enable = packet.addChild("enable", "urn:xmpp:push:0");
    enable.setAttribute("jid", jid.toString());
    enable.setAttribute("node", node);
    Data data = new Data();
    data.setFormType("http://jabber.org/protocol/pubsub#publish-options");
    data.put("secret", secret);
    data.submit();
    enable.addChild(data);
    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 68 with IqPacket

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

the class IqGenerator method generateSetPassword.

public IqPacket generateSetPassword(final Account account, final String newPassword) {
    final IqPacket packet = new IqPacket(IqPacket.TYPE.SET);
    packet.setTo(account.getServer());
    final Element query = packet.addChild("query", Namespace.REGISTER);
    final Jid jid = account.getJid();
    query.addChild("username").setContent(jid.getLocalpart());
    query.addChild("password").setContent(newPassword);
    return packet;
}
Also used : Jid(eu.siacs.conversations.xmpp.jid.Jid) Element(eu.siacs.conversations.xml.Element) IqPacket(eu.siacs.conversations.xmpp.stanzas.IqPacket)

Example 69 with IqPacket

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

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(eu.siacs.conversations.xmpp.stanzas.IqPacket)

Example 70 with IqPacket

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

the class XmppConnection method sendEnableCarbons.

private void sendEnableCarbons() {
    final IqPacket iq = new IqPacket(IqPacket.TYPE.SET);
    iq.addChild("enable", "urn:xmpp:carbons:2");
    this.sendIqPacket(iq, new OnIqPacketReceived() {

        @Override
        public void onIqPacketReceived(final Account account, final IqPacket packet) {
            if (!packet.hasChild("error")) {
                Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": successfully enabled carbons");
                features.carbonsEnabled = true;
            } else {
                Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": error enableing carbons " + packet.toString());
            }
        }
    });
}
Also used : Account(eu.siacs.conversations.entities.Account) 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