Hi. I was planning to add the extension JEP-0093:
Roster Item Exchange to Smack as an exercise to learn
Smack & XMPP. My idea is to share with the community
this extension. But first I have a few questions.
We’‘d love to have smack users contribute code. I’‘ll warn that I’'m not one of the primary smack developers but my opinion is below:
- What are your plans with the JEPs? Are you
planning to add some JEPs to Smack?
I think everything outside of the ‘‘core’’ functionality will probably not be in Smack’'s core library. However, I it would be very nice to have an ‘‘smack-optional.jar’’ to augment the core smack library with support for other JEPs. That way people that only want a simple library for simple IM can work with core, but we can support as much as possible using the optional package.
I’‘m not sure how much we’‘ll be contributing to the optional protocol support but this would be an area that the community can make a huge difference by contributing code. It’'s also nice for community code because each protocol can be relatively separate from the core and other extension protocol support.
- Are you interested in this particular extension or
do you prefer another extension? (just consider
simple extensions…I’'m just learning Smack & XMPP)
Whatever is most interesting to you should be your first target. Roster item exchange seems like a great place to start.
- Checking my approach: Smack currently supports a
way to add new extensions (PacketExtensionProvider,
PacketExtension, etc.) but currently implements none
(just a DefaultPacketExtension that it’'s not enough
for JEP-93). The RosterPacket it’'s no good for JEP-93
since it’'s an IQ Packet. Therefore, I was thinking
a) Creating a new class RosterExchange that
implements PacketExtension (similar to RosterPacket
in some way)
b) Creating a new class
RosterExchangeExtensionProvider that implements
PacketExtensionProvider and register it in the
c) I have to still think how to process the Message
when it’'s received on the other side. But first I
want to check if I’'m fine up to this point.
You’‘ve got the right start. Once the roster is exchanged, you’'ll need some way for the recipient to respond to the roster item (display to user for acceptance), then use it to add the item to your roster. Since this is library code, the ‘‘allow receipient to respond to roster item’’ should probably use an event listener so people can plug in their own roster item exchange listener and code the appropriate response when they receive an item.
BTW, it would be nice to add to the Smack Debug
Window the possibility to clear its contents.
Good suggestion. I’'ll file a feature request in the bug tracker.