powered by Jive Software

Urgent Need of Help regarding PEPManager

I need to use the PEPManager class. For that, I added the the following lines in the smack.providers file as follows::


event
http://jabber.org/protocol/pubsub#event
org.jivesoftware.smackx.provider.PEPProvider

To confirm, if the provider has been successfully added, I used the following code-snippet.
**
pepProvider = (PEPProvider)ProviderManager.getInstance().getExtensionProvider(“event”, “http://jabber.org/protocol/pubsub#event”);
pepProvider.registerPEPParserExtension(“http://jabber.org/protocol/tune”, new TuneProvider());
**
Since pepProvider is not null, I am assuming that the PEPProvider has been successfully added to the list of providers.

In the PEPManager class, In the processPacket() function

** packetListener = new PacketListener() {
public void processPacket(Packet packet) {
System.out.println(“packet received::” + packet.toXML());
Message message = (Message) packet;

                PEPEvent event = (PEPEvent) message.getExtension("event", "http://jabber.org/protocol/pubsub#event");
                 // Fire event for roster exchange listeners
                firePEPListeners(message.getFrom(), event);
        }
        };

    };
    connection.addPacketListener(packetListener, packetFilter);**

No packets are caught by this packet processor, which processes the packet for :: element name :: event and namespace :: “http://jabber.org/protocol/pubsub#event”.

I modified the function a little as follows ::

**packetListener = new PacketListener() {
public void processPacket(Packet packet) {
System.out.println(“packet received::” + packet.toXML());
Message message = (Message) packet;
if(message.getExtension(“event”, “http://jabber.org/protocol/pubsub#event”) == null);
else
{
System.out.println(“PEP packet received::” + packet.toXML());
PEPEvent event = (PEPEvent) message.getExtension(“event”, “http://jabber.org/protocol/pubsub#event”);
// Fire event for roster exchange listeners
firePEPListeners(message.getFrom(), event);
}
};

    };
    //connection.addPacketListener(packetListener, packetFilter);
     connection.addPacketListener(packetListener, null);

**
Now, I receive the following results in the output console::

**packet received::Beatles255Lady MadonnaLady Madonna1

packet received::Beatles255Lady MadonnaLady Madonna1**

As you can see, the packet received is malformed, in the sense, it doesnt have an element. That is why, i wasnt able to catch the packet in the processPacket() function in the original version of processPacket().

However, when i tried using the:: XMPPConnection.DEBUG_ENABLED = true mode, I found that the Raw XML packets which i receive are in proper format (with an element) as follows ::
**
Beatles255Lady MadonnaLady Madonna1**

What could be the problem here??
Kindly help. I have struggled a lot here.

Regards
Nishant