AS3 Patch Thread

I’‘ve found numerous places in the XIFF AS3 Port beta where I’‘ve made some alterations to fix some rough spots. I think that these types of things would be better tracked in JIRA to encourage more community support, but for now I’‘ll just keep a running thread of patches that I’'ve made and want to contribute back.

This patch fixes an issue in the recognition of extension handlers. The old code assumed that the namespace for the given extension would always be handled by the xmlns attribute of the root element. However, you are not guarunteed that the namespace attribute will not be prefixed by some servers and clients. The more reliable way in to rely on the Actionscript XML API to get the namespace.

I might slowly work towards using the AS3 XML stuff anyhow, but this patch fixes this issue for now.

Cheers.

Ryan

Index: C:/Documents and Settings/rn996/workspace/xiff_as3_flexlib_beta1/src/org/jivesoftware/xiff/data/XMPPStanza.as
===================================================================
--- C:/Documents and Settings/rn996/workspace/xiff_as3_flexlib_beta1/src/org/jivesoftware/xiff/data/XMPPStanza.as     (revision 5480)
+++ C:/Documents and Settings/rn996/workspace/xiff_as3_flexlib_beta1/src/org/jivesoftware/xiff/data/XMPPStanza.as     (working copy)
@@ -141,8 +141,12 @@
{

var nName:String = children[i].nodeName;

-                    var nNamespace:String = children[i].attributes.xmlns;
  •                // Namespace handling should be done by using AS2''s XML api. 
    
+                    // Assuming XML attribute names will break against servers that
+                    // prefix namespaces in the generated XML.
+                    var nNamespace:String = XMLNode(children[i]).namespaceURI;
+
nNamespace = exists( nNamespace ) ? nNamespace : CLIENT_NS;

if( nName == “error” ) {

Message was edited by: RyanNorris

Thanks for this. I’'m adding to JIRA now.