Subject: | no support for xmpp domains using SRV |
It's not possible to use Net::XMPP to connect a jabber server when the
server's hostname doesn't match the right side of the jid:
for example, for user@gmail.com
$Con = new Net::XMPP::Client();
$Con->Execute(hostname=>"gmail.com",
username=>"user",
password=>"password",
resource=>"Work");
will not work, because gmail.com isn't the jabber server.
the available servers can be fetched with a SRV DNS request:
host -t SRV _xmpp-client._tcp.gmail.com
_xmpp-client._tcp.gmail.com SRV 20 0 5222 talk4.l.google.com.
_xmpp-client._tcp.gmail.com SRV 5 0 5222 talk.l.google.com.
_xmpp-client._tcp.gmail.com SRV 20 0 5222 talk1.l.google.com.
_xmpp-client._tcp.gmail.com SRV 20 0 5222 talk2.l.google.com.
_xmpp-client._tcp.gmail.com SRV 20 0 5222 talk3.l.google.com.
but then using the server's hostname will not work since the resulting
jid user@hostname is not right.
the XMPP RFC suggest that the SRV request has to be done
(http://www.xmpp.org/specs/rfc3921.html):
If the hostname of the domain identifier portion of the address
contained in the 'to' attribute of an outbound stanza does not match a
hostname of the server itself, the server MUST attempt to route the
stanza to the foreign domain. The recommended order of actions is as
follows:
1. First attempt to resolve the foreign hostname using an
[SRV]Gulbrandsen, A., Vixie, P. and L. Esibov, A DNS RR for specifying
the location of services (DNS SRV), February 2000. Service of
"xmpp-server" and Proto of "tcp", resulting in resource records such as
"_xmpp-server._tcp.example.com.", as specified in
[XMPP-CORE]Saint-Andre, P., Extensible Messaging and Presence Protocol
(XMPP): Core, October 2004.