<html><head><title>
POO lib: Login and Logout
</title></head><body><center>
<h3>POO Library</h3>
<h1>Login and Logout functions</h1>
</center>

The implementor can define functions on object #0 which are 
automatically executed when a user logs in or out.  The functions
below may be useful for your POO, or can be easily adapted to
your needs.

<hr>
This login procedure prints a file called "welcome.txt" (located
in the <tt>poofiles</tt> subdirectory) if it exists, announces
the login, and causes the user to <b>look</b> at her surroundings.

<pre>@newfunc #0.login(self,who)
# print welcome message
try:
	file = open('welcome.txt')
	for line in file.readlines():
		print line[:-1]
except: pass

# announce the login to everyone
getObj('$universe').broadcast( who.name + " has connected.")

# look around
who.do_cmd("look")
.x</pre>

<hr>
This logout function prints poofiles/goodbye.txt (if it exists),
sends the user home if he's not already there, and announces the
logout.

<pre>@newfunc #0.logout(self,who)
# print goodbye message
try:
	file = open('goodbye.txt')
	for line in file.readlines():
		print line[:-1]
except: pass

# if not home, go home
if who.location != who.home:
	who.do_cmd("@home")

# announce the disconnect to everyone
getObj('$universe').broadcast( who.name + " has disconnected.")
.x
</pre>

<p><hr>
<address>
http://www.strout.net/python/poo/lib/loginout.html
<br>Last Updated:
6/28/97
. . . . . . <a href="http://www.strout.net/">Joe Strout</a>
</address>
</body></html>