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);
}
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;
}
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;
}
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);
}
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;
}
Aggregations