Search in sources :

Example 6 with PacketExtension

use of org.jivesoftware.smack.packet.PacketExtension in project intellij-plugins by JetBrains.

the class JabberTransport method processResponse.

private static void processResponse(XmlMessage xmlMessage, PacketCollector collector) {
    boolean gotResponse = false;
    while (!gotResponse) {
        Message response = (Message) collector.nextResult(RESPONSE_TIMEOUT);
        if (response == null)
            break;
        final Collection<PacketExtension> extensions = response.getExtensions();
        for (PacketExtension o : extensions) {
            if (o instanceof JDOMExtension) {
                JDOMExtension extension = (JDOMExtension) o;
                if (RESPONSE.equals(extension.getElement().getName())) {
                    xmlMessage.processResponse(extension.getElement());
                    gotResponse = true;
                    break;
                }
            }
        }
    }
}
Also used : PacketExtension(org.jivesoftware.smack.packet.PacketExtension) Message(org.jivesoftware.smack.packet.Message)

Example 7 with PacketExtension

use of org.jivesoftware.smack.packet.PacketExtension in project ecf by eclipse.

the class ItemsExtension method toXML.

@Override
public String toXML() {
    if ((items == null) || (items.size() == 0)) {
        return super.toXML();
    } else {
        StringBuilder builder = new StringBuilder("<");
        builder.append(getElementName());
        builder.append(" node='");
        builder.append(getNode());
        if (notify != null) {
            builder.append("' ");
            builder.append(type.getElementAttribute());
            builder.append("='");
            builder.append(notify.equals(Boolean.TRUE) ? 1 : 0);
            builder.append("'>");
        } else {
            builder.append("'>");
            for (PacketExtension item : items) {
                builder.append(item.toXML());
            }
        }
        builder.append("</");
        builder.append(getElementName());
        builder.append(">");
        return builder.toString();
    }
}
Also used : PacketExtension(org.jivesoftware.smack.packet.PacketExtension)

Aggregations

PacketExtension (org.jivesoftware.smack.packet.PacketExtension)7 DefaultPacketExtension (org.jivesoftware.smack.packet.DefaultPacketExtension)2 Message (org.jivesoftware.smack.packet.Message)2 PubSub (org.jivesoftware.smackx.pubsub.packet.PubSub)2 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Avatar (net.sf.kraken.avatars.Avatar)1 AttentionExtension (net.sf.kraken.protocols.xmpp.packet.AttentionExtension)1 IQWithPacketExtension (net.sf.kraken.protocols.xmpp.packet.IQWithPacketExtension)1 ChatStateType (net.sf.kraken.type.ChatStateType)1 Connection (org.jivesoftware.smack.Connection)1 XMPPConnection (org.jivesoftware.smack.XMPPConnection)1 XMPPException (org.jivesoftware.smack.XMPPException)1 Presence (org.jivesoftware.smack.packet.Presence)1 NodeInformationProvider (org.jivesoftware.smackx.NodeInformationProvider)1 JivePropertiesExtension (org.jivesoftware.smackx.jiveproperties.packet.JivePropertiesExtension)1 ChatStateExtension (org.jivesoftware.smackx.packet.ChatStateExtension)1 DelayInformation (org.jivesoftware.smackx.packet.DelayInformation)1 DiscoverInfo (org.jivesoftware.smackx.packet.DiscoverInfo)1