[jdev] Namespace IRI handling when forwarding stanzas between c2s and s2s links
Matthias Wimmer
m at tthias.net
Wed Nov 30 05:36:47 CST 2005
Hi!
I am currently finishing namespace support for the next release of
jabberd14. One remaining thing that is not completely clear to me is the
handling of the different namespace IRIs on c2s- and s2s-links.
Currently I am just mapping all three namespaces 'jabber:client',
'jabber:server', and 'jabber:component:accept' to the same jabberd14
internal namespace. When I am serializing the stanzas, I check which
type of connection the stanza is serialized on and use the standard
namespace IRI for this type of connection.
The problem I have with that is the following:
Assume a client sends the following stanza:
<message xmlns='jabber:client' from='user1 at example.com'
to='user2 at example.com'>
<body>Some example stanza, that is not very useful, but should
demonstrate my problem</body>
<x xmlns='http://example.com/someStrangeExtension'>
<presence xmlns='jabber:server'/>
</x>
</message>
This stanza gets delivered to user2 as:
<message xmlns='jabber:client' from='user1 at example.com'
to='user2 at example.com'>
<body>Some example stanza, that is not very useful, but should
demonstrate my problem</body>
<x xmlns='http://example.com/someStrangeExtension'>
<presence xmlns='jabber:client'/>
</x>
</message>
(Note the namespace switch for the <presence/> element.)
Is this namespace change allowed, or is this an error?
In that simple case I could keep the namespace of the presence element
intact very easily by just switching namespaces, when resending from one
connection type to another. But it gets more complicated when user2 is
on another server and I have to use s2s. In that case <message/> and
<presence/> for sure are send as 'jabber:server' to the other server.
But how does the other server know, that only the namespace of the
<message/> element has to be mapped back to 'jabber:client' before delivery?
Tot kijk
Matthias
More information about the JDev
mailing list