Search in sources :

Example 61 with IqPacket

use of de.pixart.messenger.xmpp.stanzas.IqPacket in project Pix-Art-Messenger by kriztan.

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(de.pixart.messenger.xml.Element) IqPacket(de.pixart.messenger.xmpp.stanzas.IqPacket)

Example 62 with IqPacket

use of de.pixart.messenger.xmpp.stanzas.IqPacket in project Pix-Art-Messenger by kriztan.

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(de.pixart.messenger.xml.Element) IqPacket(de.pixart.messenger.xmpp.stanzas.IqPacket)

Example 63 with IqPacket

use of de.pixart.messenger.xmpp.stanzas.IqPacket in project Pix-Art-Messenger by kriztan.

the class IqGenerator method changeRole.

public IqPacket changeRole(Conversation conference, String nick, String role) {
    IqPacket packet = new IqPacket(IqPacket.TYPE.SET);
    packet.setTo(conference.getJid().toBareJid());
    packet.setFrom(conference.getAccount().getJid());
    Element item = packet.query("http://jabber.org/protocol/muc#admin").addChild("item");
    item.setAttribute("nick", nick);
    item.setAttribute("role", role);
    return packet;
}
Also used : Element(de.pixart.messenger.xml.Element) IqPacket(de.pixart.messenger.xmpp.stanzas.IqPacket)

Example 64 with IqPacket

use of de.pixart.messenger.xmpp.stanzas.IqPacket in project Pix-Art-Messenger by kriztan.

the class IqGenerator method pushTokenToAppServer.

public IqPacket pushTokenToAppServer(Jid appServer, String token, String deviceId) {
    IqPacket packet = new IqPacket(IqPacket.TYPE.SET);
    packet.setTo(appServer);
    Element command = packet.addChild("command", "http://jabber.org/protocol/commands");
    command.setAttribute("node", "register-push-gcm");
    command.setAttribute("action", "execute");
    Data data = new Data();
    data.put("token", token);
    data.put("device-id", deviceId);
    data.submit();
    command.addChild(data);
    return packet;
}
Also used : Element(de.pixart.messenger.xml.Element) Data(de.pixart.messenger.xmpp.forms.Data) IqPacket(de.pixart.messenger.xmpp.stanzas.IqPacket)

Example 65 with IqPacket

use of de.pixart.messenger.xmpp.stanzas.IqPacket in project Pix-Art-Messenger by kriztan.

the class IqGenerator method retrieveVcardAvatar.

public IqPacket retrieveVcardAvatar(final Avatar avatar) {
    final IqPacket packet = new IqPacket(IqPacket.TYPE.GET);
    packet.setTo(avatar.owner);
    packet.addChild("vCard", "vcard-temp");
    return packet;
}
Also used : IqPacket(de.pixart.messenger.xmpp.stanzas.IqPacket)

Aggregations

IqPacket (de.pixart.messenger.xmpp.stanzas.IqPacket)81 Element (de.pixart.messenger.xml.Element)48 Account (de.pixart.messenger.entities.Account)39 OnIqPacketReceived (de.pixart.messenger.xmpp.OnIqPacketReceived)31 Jid (de.pixart.messenger.xmpp.jid.Jid)15 ArrayList (java.util.ArrayList)7 Data (de.pixart.messenger.xmpp.forms.Data)6 InvalidJidException (de.pixart.messenger.xmpp.jid.InvalidJidException)6 PreKeyBundle (org.whispersystems.libsignal.state.PreKeyBundle)5 JinglePacket (de.pixart.messenger.xmpp.jingle.stanzas.JinglePacket)4 IOException (java.io.IOException)4 InvalidKeyException (org.whispersystems.libsignal.InvalidKeyException)4 Bundle (android.os.Bundle)3 Pair (android.util.Pair)3 Contact (de.pixart.messenger.entities.Contact)3 Conversation (de.pixart.messenger.entities.Conversation)3 FileNotFoundException (java.io.FileNotFoundException)3 InputStream (java.io.InputStream)3 HashSet (java.util.HashSet)3 List (java.util.List)3