Search in sources :

Example 56 with IqPacket

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

the class IqGenerator method retrievePepAvatar.

public IqPacket retrievePepAvatar(final Avatar avatar) {
    final Element item = new Element("item");
    item.setAttribute("id", avatar.sha1sum);
    final IqPacket packet = retrieve("urn:xmpp:avatar:data", item);
    packet.setTo(avatar.owner);
    return packet;
}
Also used : Element(de.pixart.messenger.xml.Element) IqPacket(de.pixart.messenger.xmpp.stanzas.IqPacket)

Example 57 with IqPacket

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

the class IqGenerator method publish.

protected IqPacket publish(final String node, final Element item, final Bundle options) {
    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);
    if (options != null) {
        final Element publishOptions = pubsub.addChild("publish-options");
        publishOptions.addChild(Data.create(Namespace.PUBSUB_PUBLISH_OPTIONS, options));
    }
    return packet;
}
Also used : Element(de.pixart.messenger.xml.Element) IqPacket(de.pixart.messenger.xmpp.stanzas.IqPacket)

Example 58 with IqPacket

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

the class IqGenerator method changeAffiliation.

public IqPacket changeAffiliation(Conversation conference, List<Jid> jids, String affiliation) {
    IqPacket packet = new IqPacket(IqPacket.TYPE.SET);
    packet.setTo(conference.getJid().toBareJid());
    packet.setFrom(conference.getAccount().getJid());
    Element query = packet.query("http://jabber.org/protocol/muc#admin");
    for (Jid jid : jids) {
        Element item = query.addChild("item");
        item.setAttribute("jid", jid.toString());
        item.setAttribute("affiliation", affiliation);
    }
    return packet;
}
Also used : Jid(de.pixart.messenger.xmpp.jid.Jid) Element(de.pixart.messenger.xml.Element) IqPacket(de.pixart.messenger.xmpp.stanzas.IqPacket)

Example 59 with IqPacket

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

the class IqGenerator method versionResponse.

public IqPacket versionResponse(final IqPacket request) {
    final IqPacket packet = request.generateResponse(IqPacket.TYPE.RESULT);
    Element query = packet.query("jabber:iq:version");
    query.addChild("name").setContent(mXmppConnectionService.getString(R.string.app_name));
    query.addChild("version").setContent(getIdentityVersion());
    if ("chromium".equals(android.os.Build.BRAND)) {
        query.addChild("os").setContent("Chrome OS");
    } else {
        query.addChild("os").setContent("Android");
    }
    return packet;
}
Also used : Element(de.pixart.messenger.xml.Element) IqPacket(de.pixart.messenger.xmpp.stanzas.IqPacket)

Example 60 with IqPacket

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

the class IqGenerator method destroyConference.

public IqPacket destroyConference(Conversation conference) {
    IqPacket packet = new IqPacket(IqPacket.TYPE.SET);
    packet.setTo(conference.getJid().toBareJid());
    packet.setFrom(conference.getAccount().getJid());
    final Element query = packet.addChild("query", "http://jabber.org/protocol/muc#owner");
    final Element destroy = query.addChild("destroy");
    destroy.setAttribute("jid", conference.getJid().toBareJid().toString());
    Log.d(Config.LOGTAG, "Destroy: " + packet.toString());
    return packet;
}
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