Search in sources :

Example 76 with Element

use of eu.siacs.conversations.xml.Element in project Conversations by siacs.

the class IqGenerator method publishDeviceIds.

public IqPacket publishDeviceIds(final Set<Integer> ids) {
    final Element item = new Element("item");
    final Element list = item.addChild("list", AxolotlService.PEP_PREFIX);
    for (Integer id : ids) {
        final Element device = new Element("device");
        device.setAttribute("id", id);
        list.addChild(device);
    }
    return publish(AxolotlService.PEP_DEVICE_LIST, item);
}
Also used : Element(eu.siacs.conversations.xml.Element)

Example 77 with Element

use of eu.siacs.conversations.xml.Element in project Conversations by siacs.

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

Example 78 with Element

use of eu.siacs.conversations.xml.Element in project Conversations by siacs.

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

Example 79 with Element

use of eu.siacs.conversations.xml.Element in project Conversations by siacs.

the class IqGenerator method publishNick.

public IqPacket publishNick(String nick) {
    final Element item = new Element("item");
    item.addChild("nick", "http://jabber.org/protocol/nick").setContent(nick);
    return publish("http://jabber.org/protocol/nick", item);
}
Also used : Element(eu.siacs.conversations.xml.Element)

Example 80 with Element

use of eu.siacs.conversations.xml.Element in project Conversations by siacs.

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

Aggregations

Element (eu.siacs.conversations.xml.Element)93 IqPacket (eu.siacs.conversations.xmpp.stanzas.IqPacket)43 Account (eu.siacs.conversations.entities.Account)21 Jid (eu.siacs.conversations.xmpp.jid.Jid)17 OnIqPacketReceived (eu.siacs.conversations.xmpp.OnIqPacketReceived)16 MessagePacket (eu.siacs.conversations.xmpp.stanzas.MessagePacket)8 Contact (eu.siacs.conversations.entities.Contact)7 Conversation (eu.siacs.conversations.entities.Conversation)6 ArrayList (java.util.ArrayList)6 Data (eu.siacs.conversations.xmpp.forms.Data)5 Avatar (eu.siacs.conversations.xmpp.pep.Avatar)5 IOException (java.io.IOException)5 MucOptions (eu.siacs.conversations.entities.MucOptions)4 PresencePacket (eu.siacs.conversations.xmpp.stanzas.PresencePacket)4 Pair (android.util.Pair)3 Bookmark (eu.siacs.conversations.entities.Bookmark)3 Message (eu.siacs.conversations.entities.Message)3 InvalidJidException (eu.siacs.conversations.xmpp.jid.InvalidJidException)3 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3