powered by Jive Software

Xiff 3 Beta Extension Implementation

I wanted to start off saying that I think Xiff is and will continue to be a great library, however I’'ve noticed some issues with the latest beta in subversion (primarily with extensions) -

It appears as though the XMPPStanza assumes that every extension implements ISerializable, even though there isn’‘t anything enforcing this contract, and I’'ve noticed that even the included XHTMLExtension not only does not implement this interface, it does not contain a proper default constructor to be successfully created as an extension (both of which are easily fixed, however).

From what I can gather, even if an extension inherits from the Extension class, it still must implement the IExtension and ISerializable interfaces to become a valid extension, which seems a little counter-intuitive to me. I would expect that if I am inheriting from a class named Extension that it would implement any necessary interfaces to allow my code to be considered a valid extension as well - and any additional interface implemented beyond that is considered optional.

If I am to understand the purpose behind Extensions (allowing developers a mechanism for developing custom data handlers to extend the supplied XMPP implementation), I can see great value in allowing an extension to register to multiple namespaces and/or multiple element names. An example of this scenario is a (very) simple XEP State extension I wrote, which uses the same namespace (jabber:x:states I believe) with multiple element names (since gaim does not transmit the state information wtih full conformance to the spec).

Thanks for all your hard work! I’'m looking forward to having full AS3 XML support and would be more than happy to help out in any way!

Another concept I think might be both interesting and useful would be the ability to register event handlers to extensions to allow notification when an incoming and/or outgoing packet is available. Currently, it appears as though one has to obtain all (or a specific) extension from a packet and perform a series of casts, which can force unnecessary processing time, whereas an event-based approach could allow for a slight increase in efficiency and a relatively large increase in ease-of-development.

I completely agree with your assessment. There are a LOT of changes that could be made thanks to the new E4X support. However, right now we’‘re just focused on getting the AS2 version ported properly. We’'ll likely do away with the IExtension interface and just force extensions to inherit from the Extension base class.