Login and Join Room Example

Sean O' Shea sean at eye.fi
Tue Apr 20 02:11:54 UTC 2010


Hi all,

I've set up my djabberd instance with the following (very basic) config:

OldSSL  enable
AdminPort 5200
ClientPort 5222
ServerPort 5269

<VHost jabber.api.eye.fi>
   S2S yes
   RequireSSL no
   <Plugin DJabberd::Authen::AllowedUsers>
      Policy accept
      AllowedUsers 001856000021 server
   </Plugin>
   <Plugin DJabberd::Authen::StaticPassword>
       Password password
   </Plugin>
</VHost>

My /etc/hosts has the following entry:

127.0.0.1       *.jabber.api.eye.fi jabber.api.eye.fi

When I start my djabberd server, this is what I see:

7883 INFO  DJabberd.Log                             Started logging  
using 'BUILT-IN-DEFAULTS'
7883 INFO  DJabberd.VHost                           Addding plugins...
7883 INFO  DJabberd.VHost                           Adding plugin:  
DJabberd::Authen::AllowedUsers=HASH(0xa73054)
7883 INFO  DJabberd.VHost                           Adding plugin:  
DJabberd::Authen::StaticPassword=HASH(0xa7b878)
7883 WARN  DJabberd.VHost                           Adding implicit  
plugin DJabberd::Delivery::Local
Adding implicit plugin DJabberd::Delivery::Local at /Users/seanoshea/ 
perl/lib/perl5/site_perl/Log/Log4perl/Logger.pm line 866
7883 INFO  DJabberd.VHost                           Adding plugin:  
DJabberd::Delivery::Local=HASH(0xa7b8d8)
7883 WARN  DJabberd.VHost                           Adding implicit  
plugin DJabberd::Delivery::S2S
Adding implicit plugin DJabberd::Delivery::S2S at /Users/seanoshea/ 
perl/lib/perl5/site_perl/Log/Log4perl/Logger.pm line 866
7883 INFO  DJabberd.VHost                           Adding plugin:  
DJabberd::Delivery::S2S=HASH(0xa7c128)
7883 INFO  DJabberd.VHost                           Adding plugin:  
DJabberd::PresenceChecker::Local=HASH(0xa7c20c)
7883 DEBUG DJabberd                                 Opening TCP listen  
socket on 0.0.0.0:5222
7883 DEBUG DJabberd                                 Opening TCP listen  
socket on 0.0.0.0:5223
7883 DEBUG DJabberd                                 Opening TCP listen  
socket on 0.0.0.0:5269
7883 DEBUG DJabberd                                 Opening TCP listen  
socket on 0.0.0.0:5200

So, it seems to start up fine. When I try to connect a client to this  
server this is what I see:

7883 DEBUG DJabberd.Connection.XML.ClientIn         1 > <?xml  
version="1.0" encoding="UTF-8"?><stream:stream  
from='jabber.api.eye.fi' id="d25d7e809bb355a95feadd839a1a49cb99d4103f"  
version='1.0'  xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client 
"><stream:features><auth xmlns='http://jabber.org/features/iq-auth'/></ 
stream:features>
7883 DEBUG DJabberd.Connection.XML.ClientIn         1 < <iq type='get'  
id='log_user_1'><query xmlns='jabber:iq:auth'><username>001856000021</ 
username></query></iq>
7883 INFO  DJabberd.Connection.XML.ClientIn         <iq type='result'  
id='log_user_1'><query xmlns='jabber:iq:auth'><username>001856000021</ 
username><digest/><resource/></query></iq>
7883 DEBUG DJabberd.Connection.XML.ClientIn         1 < <iq type='set'  
id='log_user2_3'><query xmlns='jabber:iq:auth'><password>password</ 
password><username>001856000021</username><resource>001856000021</ 
resource></query></iq>
7883 DEBUG DJabberd.VHost                           For phase  
[GetPassword] invoking hook 1 of 2 defined at: /Users/seanoshea/perl/ 
lib/perl5/site_perl/DJabberd/Authen.pm:14
7883 DEBUG DJabberd.Callback                        $callback- 
 >set( password ) has been called from /Users/seanoshea/perl/lib/perl5/ 
site_perl/DJabberd/Authen/StaticPassword.pm:14
7883 INFO  DJabberd.VHost                           Registering '001856000021 at jabber.api.eye.fi 
/001856000021' to connection '1'
7883 DEBUG DJabberd.Callback                        $callback- 
 >registered(  ) has been called from /Users/seanoshea/perl/lib/perl5/ 
site_perl/DJabberd/VHost.pm:380
7883 INFO  DJabberd.Connection.XML.ClientIn         <iq to='001856000021 at jabber.api.eye.fi 
/001856000021' type='result' id='log_user2_3'></iq>
7883 DEBUG DJabberd.Connection.XML.ClientIn         1 < <presence to='001856000021 at jabber.api.eye.fi 
/001856000021'><priority>0</priority><x xmlns='http://jabber.org/protocol/muc'/ 
 ></presence>
7883 DEBUG DJabberd.VHost                           For phase  
[deliver] invoking hook 1 of 3 defined at: /Users/seanoshea/perl/lib/ 
perl5/site_perl/DJabberd/Delivery.pm:17
7883 DEBUG DJabberd.Callback                        $callback- 
 >declined(  ) has been called from /Users/seanoshea/perl/lib/perl5/ 
site_perl/DJabberd/Delivery/Local.pm:28
7883 DEBUG DJabberd.VHost                           For phase  
[deliver] invoking hook 2 of 3 defined at: /Users/seanoshea/perl/lib/ 
perl5/site_perl/DJabberd/Delivery.pm:17
7883 DEBUG DJabberd.Callback                        $callback- 
 >declined(  ) has been called from /Users/seanoshea/perl/lib/perl5/ 
site_perl/DJabberd/Delivery/S2S.pm:34
7883 DEBUG DJabberd.VHost                           For phase  
[deliver] invoking hook 3 of 3 defined at: /Users/seanoshea/perl/lib/ 
perl5/site_perl/DJabberd/Stanza.pm:85

So - it looks like my login for 001856000021 succeeds, but joining a  
room is failing for me. Looking at the source code, it looks like the  
@dbcons is not being set in Local.pm (on line 28). I tried a little  
debugging and it looks like the find_bares function is being invoked  
in the following else clause

     if ($to->is_bare) {
         $find_bares->();
     } else {
         my $dest;
         if (($dest = $vhost->find_jid($to)) && ($dest->is_available  
|| $stanza->deliver_when_unavailable)) {
             push @dconns, $dest;
         } else {
             $find_bares->();
         }
     }

Looking at the S2S.pm code, it looks like the following statement is  
getting executed:

     # don't initiate outgoing connections back to ourself
     my $domain = $to->domain;
     if ($vhost->handles_domain($domain)) {
         return $cb->declined;
     }

I'm running the client and the server on the same machine - from the  
comments in the code, my setup seems to be unsupported or at least its  
ill-advised. Is this correct? If this is the case, could you suggest a  
way for me to get the client and server running on the same machine?

Please excuse me if I'm missing something simple in my setup - I'm new  
to XMPP, perl and djabberd. If you have any handy tips on how to get  
up and running with djabbered please send them on. Any help would be  
greatly appreciated.

Sean

PS - I'm running the latest djabberd code available via cpan. 


More information about the Djabberd mailing list