in_finger.c
snippets · 1.3 KB · 2010-03-30
in_finger.c: an intermud finger daemon for an LPMud mudlib.
Download « Back to the snippets list
#include <commands.h>
#include <daemons.h>
#include "/adm/net/inet.h"
mapping close_up;
void create() {
seteuid(getuid());
close_up = ([ ]);
} /* create() */
void read_callback(int fd, string mess) {
string str;
object ob;
sscanf(mess, "%s\n", mess);
if (mess != "EVERYONE" && mess != "") {
log_file("FIN", "mess = " + dump_variable(mess) + "\n");
if (find_fake_player(mess) || master() -> player_exists(mess))
str = (string) FINGER -> user_finger_display(mess);
if (!str) {
previous_object()->write_fd(fd, "No one called "+capitalize(mess)+" has ever "+
"entered The Realms of Tabor.\n");
} else {
previous_object()->write_fd(fd, str);
}
previous_object()->close_fd(fd); /* Close once flushed */
} else {
/*
* Ok... In here we need to get the long finger list.
*/
str = "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n";
str += "\tThe Realms of Tabor -- " + extract(Time(), 0, 15) + " -- ";
str += (string) FINGER -> general_finger_display(1);
if (!str) {
previous_object()->write_fd(fd, "Some sort of fun internal error "+
"occured. You are happy.\n");
} else {
previous_object()->write_fd(fd, str);
}
previous_object()->close_fd(fd);
}
} /* read_callback() */