MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

Re: listen()




Heh, turns out I struggled through this last night. What Jeni said is all
true - copy the $user_connected, etc verbs to your new listening object and
set them to do what you want.

However, there's a further 'gotcha', at least in older cores, I don't know
about the new ones, and that's that lots of necessary verbs have terrible
things in them of the form "if (caller != #0)", and a lot of these are
things called in the login process like confuncs and disfuncs and parsing
things and so on. You have to chase these all down and fix them to permit
them to be called from the do_login_command and other verbs on your object 
too.


> >How does one set up a do_login_command for it to actually use the port set
> >up with listen()?
> 
> listen() has the syntax listen(obj, desc[, print-messages]).  desc is the
> port, print-messages you'll usually set to 1 and obj is the object on which
> the do_login_command should go to be used by connections to that port.
> 
> The usual example:
> #0:do_login_command is called for all commands coming in from normal users
> connected by telnet.  If you want port 9999 to be used in just the same way
> (another telnet port into the MOO), you use the command listen(#0, 9999, 1).
> 
> Another example:
> You want port 9000 to work as a port for a WWW system (say), and have an
> object called $web_system with a verb :do_login_command that you want all
> connections to be processed through.  You set that up with the command
> listen($web_system, 9000, 0) (don't want messages 'cos it confuses the WWW
> browser).
> 
> So in fact it's the listen() that sets up which do_login_command to use,
> not the other way around.  And in general, *all* the verbs that are defined
> on #0 usually can be defined on the object given in the listen() command
> and will work on that port.  So having $web_system:handle_uncaught_error
> will do the same as #0:handle_uncaught_error does for the startup port, but
> for connections through port 9000.
> 
> Hope this helps,
> 
> Jeni
> 
> Jeni Tennison
> Department of Psychology, University of Nottingham
> University Park, Nottingham NG7 2RD, UK
> tel: +44 (0) 115 951 5151 x8352
> fax: +44 (0) 115 951 5361
> url: http://www.psychology.nottingham.ac.uk/staff/Jenifer.Tennison/
> 
> 
> 
> 



Home | Subject Index | Thread Index