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