diff -urpN Net-XMPP-1.02~/lib/Net/XMPP/Connection.pm Net-XMPP-1.02/lib/Net/XMPP/Connection.pm --- Net-XMPP-1.02~/lib/Net/XMPP/Connection.pm 2007-03-29 17:51:44.000000000 +0530 +++ Net-XMPP-1.02/lib/Net/XMPP/Connection.pm 2010-05-27 16:41:31.000000000 +0530 @@ -92,6 +92,12 @@ sub init $self->{SERVER}->{tls} = $self->_arg("tls",0); $self->{SERVER}->{ssl} = $self->_arg("ssl",0); $self->{SERVER}->{connectiontype} = $self->_arg("connectiontype","tcpip"); + if (exists $self->{ARGS}->{servername}) { + $self->{SERVER}->{servername} = $self->{ARGS}->{servername}; + } + if (exists $self->{ARGS}->{srv}) { + $self->{SERVER}->{srv} = $self->{ARGS}->{srv}; + } $self->{CONNECTED} = 0; $self->{DISCONNECTED} = 0; @@ -141,6 +147,14 @@ sub Connect connectiontype => $self->{SERVER}->{connectiontype}, timeout => $self->{SERVER}->{timeout}, ssl => $self->{SERVER}->{ssl}, #LEGACY + (exists($self->{SERVER}->{servername}) ? + (servername => $self->{SERVER}->{servername} ) : + () + ), + (exists($self->{SERVER}->{srv}) ? + (srv => $self->{SERVER}->{srv} ) : + () + ), (defined($self->{SERVER}->{componentname}) ? (to => $self->{SERVER}->{componentname}) : () diff -urpN XML-Stream-1.23~/lib/XML/Stream.pm XML-Stream-1.23/lib/XML/Stream.pm --- XML-Stream-1.23~/lib/XML/Stream.pm 2010-01-08 09:11:33.000000000 +0530 +++ XML-Stream-1.23/lib/XML/Stream.pm 2010-05-27 16:42:45.000000000 +0530 @@ -676,7 +676,11 @@ sub Connect ""; $self->debug(4,"Connect: timeout($timeout)"); - + + if (not exists($self->{SIDS}->{newconnection}->{servername})) { + $self->{SIDS}->{newconnection}->{servername} = + $self->{SIDS}->{newconnection}->{hostname}; + } if (exists($self->{SIDS}->{newconnection}->{srv})) { @@ -688,9 +692,9 @@ sub Connect if ($query) { - $self->{SIDS}->{newconnection}->{hostname} = ($query->answer)[0]->target(); + $self->{SIDS}->{newconnection}->{servername} = ($query->answer)[0]->target(); $self->{SIDS}->{newconnection}->{port} = ($query->answer)[0]->port(); - $self->debug(1,"Connect: srv host: $self->{SIDS}->{newconnection}->{hostname}"); + $self->debug(1,"Connect: srv host: $self->{SIDS}->{newconnection}->{servername}"); $self->debug(1,"Connect: srv post: $self->{SIDS}->{newconnection}->{port}"); } else @@ -725,7 +729,7 @@ sub Connect # Check some things that we have to know in order get the connection up # and running. Server hostname, port number, namespace, etc... #----------------------------------------------------------------------- - if ($self->{SIDS}->{newconnection}->{hostname} eq "") + if ($self->{SIDS}->{newconnection}->{servername} eq "") { $self->SetErrorCode("newconnection","Server hostname not specified"); return; @@ -745,7 +749,7 @@ sub Connect # abort ourselves and let the user check $! on his own. #----------------------------------------------------------------------- $self->{SIDS}->{newconnection}->{sock} = - new IO::Socket::INET(PeerAddr=>$self->{SIDS}->{newconnection}->{hostname}, + new IO::Socket::INET(PeerAddr=>$self->{SIDS}->{newconnection}->{servername}, PeerPort=>$self->{SIDS}->{newconnection}->{port}, Proto=>"tcp", (($timeout ne "") ? ( Timeout=>$timeout ) : ()),