Search in sources :

Example 16 with Element

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

the class IqGenerator method publishAvatarMetadata.

public IqPacket publishAvatarMetadata(final Avatar avatar) {
    final Element item = new Element("item");
    item.setAttribute("id", avatar.sha1sum);
    final Element metadata = item.addChild("metadata", "urn:xmpp:avatar:metadata");
    final Element info = metadata.addChild("info");
    info.setAttribute("bytes", avatar.size);
    info.setAttribute("id", avatar.sha1sum);
    info.setAttribute("height", avatar.height);
    info.setAttribute("width", avatar.height);
    info.setAttribute("type", avatar.type);
    return publish("urn:xmpp:avatar:metadata", item);
}
Also used : Element(eu.siacs.conversations.xml.Element)

Example 17 with Element

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

the class IqGenerator method pubsubConfiguration.

private IqPacket pubsubConfiguration(Jid jid, String node, Data data) {
    IqPacket packet = new IqPacket(data == null ? IqPacket.TYPE.GET : IqPacket.TYPE.SET);
    packet.setTo(jid);
    Element pubsub = packet.addChild("pubsub", "http://jabber.org/protocol/pubsub#owner");
    Element configure = pubsub.addChild("configure").setAttribute("node", node);
    if (data != null) {
        configure.addChild(data);
    }
    return packet;
}
Also used : Element(eu.siacs.conversations.xml.Element) IqPacket(eu.siacs.conversations.xmpp.stanzas.IqPacket)

Example 18 with Element

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

the class IqGenerator method retrieve.

protected IqPacket retrieve(String node, Element item) {
    final IqPacket packet = new IqPacket(IqPacket.TYPE.GET);
    final Element pubsub = packet.addChild("pubsub", "http://jabber.org/protocol/pubsub");
    final Element items = pubsub.addChild("items");
    items.setAttribute("node", node);
    if (item != null) {
        items.addChild(item);
    }
    return packet;
}
Also used : Element(eu.siacs.conversations.xml.Element) IqPacket(eu.siacs.conversations.xmpp.stanzas.IqPacket)

Example 19 with Element

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

the class IqGenerator method publishAvatar.

public IqPacket publishAvatar(Avatar avatar) {
    final Element item = new Element("item");
    item.setAttribute("id", avatar.sha1sum);
    final Element data = item.addChild("data", "urn:xmpp:avatar:data");
    data.setContent(avatar.image);
    return publish("urn:xmpp:avatar:data", item);
}
Also used : Element(eu.siacs.conversations.xml.Element)

Example 20 with Element

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

the class IqGenerator method publish.

protected IqPacket publish(final String node, final Element item) {
    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);
    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