// finger.js

// A simple finger client

if(argc>0 && argv[0].indexOf('@')!=-1)
	dest = argv[0];
else if((dest = prompt("User (user@hostname)"))==null)
	exit();
if((hp = dest.indexOf('@'))==-1) {
	alert("Invalid user");
	exit();
}
host = dest.slice(hp+1);
sock = new Socket(2);
sock.debug = true;
if(!sock.connect(host,79)) 
	alert("Connection to " + host + " failed with error " + sock.last_error);
else {
	sock.send(dest.slice(0,hp)+"\r\n");
	if(sock.poll(1)==1) {
		while(bbs.online && client.socket.is_connected && sock.is_connected) {
			str = sock.read();
			if(str == null || str == undefined)
				break;
			printf(str);
		}
	}
}
sock.close();
