While XEP 298 does say:
The namespace of the forwarded stanza MUST be preserved (this is typically 
'jabber:client'). If no 'xmlns' is set for the stanza then as per XML 
namespacing rules it would inherit the 'urn:xmpp:forward:0' namespace, which is 
wrong.

This, by itself, is insufficient to ensure all relevant namespaces of the 
original stanza are preserved.  Any namespaces of the stream which the original 
message was received on, as well those of the original stanza need to preserved 
if used in the original stanza, need to preserved.    Also, lang tags should 
preserved.

One way to do this is for the forwarded to copy all the name space declarations 
of the stream the original message was received into the forward element, use a 
prefix for the 'urn:xmpp:forward:0' which doesn't clash, and copy all prefixes 
of the original message with the original message, using the same prefixes as 
on the stream it was received on.

So, for instance, if one received:

   <stream:stream
       from='[email protected]'
       to='im.example.com'
       version='1.0'
       xml:lang='en'
       xmlns='jabber:client'
       xmlns:stream='http://etherx.jabber.org/streams'>
     <message>
       <body>foo</body>
     </message>
   </stream:stream>


The element to be forwarded (inside a suitable message element) would be:

   <forwarded:forwarded xmlns:forwarded='urn:xmpp:forward:0
       xml:lang='en'
       xmlns='jabber:client'
       xmlns:stream='http://etherx.jabber.org/streams'>
     <message>
       <body>foo</body>
     </message>
   </forwarded:forwarded>

Or if one received:

   <stream
       from='[email protected]'
       to='im.example.com'
       version='1.0'
       xml:lang='en'
       xmlns='http://etherx.jabber.org/streams'>
     <message xmlns='jabber:client'>
       <body>foo</body>
     </message>
   </stream>

   <forwarded:forwarded xmlns:forwarded='urn:xmpp:forward:0'xml:lang='en'
       xml:lang='en'
       xmlns='http://etherx.jabber.org/streams'>
     <message xmlns='jabber:client'>
       <body>foo</body>
     </message>
   </forwarded:forwarded>


Reply via email to