use of eu.siacs.conversations.xml.Element in project Conversations by siacs.
the class XmppConnectionService method pushBookmarks.
public void pushBookmarks(Account account) {
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": pushing bookmarks");
IqPacket iqPacket = new IqPacket(IqPacket.TYPE.SET);
Element query = iqPacket.query("jabber:iq:private");
Element storage = query.addChild("storage", "storage:bookmarks");
for (Bookmark bookmark : account.getBookmarks()) {
storage.addChild(bookmark);
}
sendIqPacket(account, iqPacket, mDefaultIqHandler);
}
use of eu.siacs.conversations.xml.Element in project Conversations by siacs.
the class XmppAxolotlMessage method toElement.
public Element toElement() {
Element encryptionElement = new Element(CONTAINERTAG, AxolotlService.PEP_PREFIX);
Element headerElement = encryptionElement.addChild(HEADER);
headerElement.setAttribute(SOURCEID, sourceDeviceId);
for (Map.Entry<Integer, XmppAxolotlSession.AxolotlKey> keyEntry : keys.entrySet()) {
Element keyElement = new Element(KEYTAG);
keyElement.setAttribute(REMOTEID, keyEntry.getKey());
if (keyEntry.getValue().prekey) {
keyElement.setAttribute("prekey", "true");
}
keyElement.setContent(Base64.encodeToString(keyEntry.getValue().key, Base64.NO_WRAP));
headerElement.addChild(keyElement);
}
headerElement.addChild(IVTAG).setContent(Base64.encodeToString(iv, Base64.NO_WRAP));
if (ciphertext != null) {
Element payload = encryptionElement.addChild(PAYLOAD);
payload.setContent(Base64.encodeToString(ciphertext, Base64.NO_WRAP));
}
return encryptionElement;
}
use of eu.siacs.conversations.xml.Element in project Conversations by siacs.
the class IqGenerator method generateCreateAccountWithCaptcha.
public IqPacket generateCreateAccountWithCaptcha(Account account, String id, Data data) {
final IqPacket register = new IqPacket(IqPacket.TYPE.SET);
register.setFrom(account.getJid().toBareJid());
register.setTo(account.getServer());
register.setId(id);
Element query = register.query("jabber:iq:register");
if (data != null) {
query.addChild(data);
}
return register;
}
use of eu.siacs.conversations.xml.Element in project Conversations by siacs.
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;
}
use of eu.siacs.conversations.xml.Element in project Conversations by siacs.
the class IqGenerator method requestHttpUploadSlot.
public IqPacket requestHttpUploadSlot(Jid host, DownloadableFile file, String mime) {
IqPacket packet = new IqPacket(IqPacket.TYPE.GET);
packet.setTo(host);
Element request = packet.addChild("request", Namespace.HTTP_UPLOAD);
request.addChild("filename").setContent(convertFilename(file.getName()));
request.addChild("size").setContent(String.valueOf(file.getExpectedSize()));
if (mime != null) {
request.addChild("content-type").setContent(mime);
}
return packet;
}
Aggregations