Search in sources :

Example 76 with Element

use of de.pixart.messenger.xml.Element 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 77 with Element

use of de.pixart.messenger.xml.Element 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 78 with Element

use of de.pixart.messenger.xml.Element 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 79 with Element

use of de.pixart.messenger.xml.Element 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)

Example 80 with Element

use of de.pixart.messenger.xml.Element in project Pix-Art-Messenger by kriztan.

the class IqGenerator method discoResponse.

public IqPacket discoResponse(final IqPacket request) {
    final IqPacket packet = new IqPacket(IqPacket.TYPE.RESULT);
    packet.setId(request.getId());
    packet.setTo(request.getFrom());
    final Element query = packet.addChild("query", "http://jabber.org/protocol/disco#info");
    query.setAttribute("node", request.query().getAttribute("node"));
    final Element identity = query.addChild("identity");
    identity.setAttribute("category", "client");
    identity.setAttribute("type", getIdentityType());
    identity.setAttribute("name", getIdentityName());
    for (final String feature : getFeatures()) {
        query.addChild("feature").setAttribute("var", feature);
    }
    return packet;
}
Also used : Element(de.pixart.messenger.xml.Element) IqPacket(de.pixart.messenger.xmpp.stanzas.IqPacket)

Aggregations

Element (de.pixart.messenger.xml.Element)100 IqPacket (de.pixart.messenger.xmpp.stanzas.IqPacket)48 Account (de.pixart.messenger.entities.Account)23 Jid (de.pixart.messenger.xmpp.jid.Jid)19 OnIqPacketReceived (de.pixart.messenger.xmpp.OnIqPacketReceived)17 Contact (de.pixart.messenger.entities.Contact)9 MessagePacket (de.pixart.messenger.xmpp.stanzas.MessagePacket)8 ArrayList (java.util.ArrayList)7 Conversation (de.pixart.messenger.entities.Conversation)6 IOException (java.io.IOException)6 Data (de.pixart.messenger.xmpp.forms.Data)5 Avatar (de.pixart.messenger.xmpp.pep.Avatar)5 HashSet (java.util.HashSet)5 AxolotlService (de.pixart.messenger.crypto.axolotl.AxolotlService)4 MucOptions (de.pixart.messenger.entities.MucOptions)4 ECPublicKey (org.whispersystems.libsignal.ecc.ECPublicKey)4 PreKeyBundle (org.whispersystems.libsignal.state.PreKeyBundle)4 Pair (android.util.Pair)3 Bookmark (de.pixart.messenger.entities.Bookmark)3 Message (de.pixart.messenger.entities.Message)3