powered by Jive Software

CVS for Smack

Hey Matt,

I was wondering if there’'s a CVS repository for Smack? I have added my own stuff to it (i.e. jabber:iq:version support) and it would be really nice if I could update to the current daily build and still keep my changes with CVS.

If not, that’'s cool

Adam,

Unfortunately, we can only provide CVS access to Smack developers. So, if you’‘re interested in doing long-term Smack development, perhaps that’‘s an option? Otherwise, if your changes are ones that others might want as well then I’'d encourage you to contribute them, which would also solve your need to constanstly update the source.

Regards,

Matt

Matt,

I would like to contribute the code… but who knows if it’‘s done in a way that’'s most efficient.

For the jabber:iq:version, I just created a Version packet, and then modified PacketReader so that sees the jabber:iq:version namespace and puts the information into the packet.

I was a little stuck as to how to handle it after that, though.

What happens is that an IQ get packet will be sent to me, and I should respond with the appropriate IQ result packet. I was a little unsure of what to do in my IQPacketListener to be most efficient. So, I did something like this:

public void processPacket( Packet packet )
{
    IQ iq = (IQ)packet;
    if( iq.getType() == IQ.Type.GET )
    {
        try {
            Version version = (Version)packet;
            // send a version back to the requester
        }
        catch( ClassCastException e ){ /* It wasn''t a version packet */ }
    }
}

It was the only way I could think of to find out if it was actually a version packet instead of a different type IQ packet.

Anyway, if you are interested, how do I go about contributed code?

Adam

Adam,

Check out the provider architecture. It’'s meant to handle this exact scenario so that you can implement the feature as a Smack extension (in another JAR without modifying the core source code). Once you read through the Javadocs, let me know if you have questions.

Regards,

Matt