Example #1
0
void
do_motd(dbref player, char *text)
{
    time_t lt;
    char buf[BUFFER_LEN];

    if (!*text || !Wizard(OWNER(player))) {
	spit_file(player, tp_file_motd);
	return;
    }
    if (!strcasecmp(text, "clear")) {
	unlink(tp_file_motd);
	log2file(tp_file_motd, "%s %s", "- - - - - - - - - - - - - - - - - - -",
		 "- - - - - - - - - - - - - - - - - - -");
	notify(player, "MOTD cleared.");
	return;
    }

    lt = time(NULL);
    strftime(buf, sizeof(buf), "%a %b %d %T %Z %Y", localtime(&lt));
    log2file(tp_file_motd, "%s", buf);
    add_motd_text_fmt(text);
    log2file(tp_file_motd, "%s %s", "- - - - - - - - - - - - - - - - - - -",
	     "- - - - - - - - - - - - - - - - - - -");
    notify(player, "MOTD updated.");
}
Example #2
0
void
do_motd(dbref player, char *text)
{
	time_t lt;

	if (!*text || !Wizard(OWNER(player))) {
		spit_file(player, MOTD_FILE);
		return;
	}
	if (!string_compare(text, "clear")) {
		unlink(MOTD_FILE);
		log2file(MOTD_FILE, "%s %s", "- - - - - - - - - - - - - - - - - - -",
				 "- - - - - - - - - - - - - - - - - - -");
		notify(player, "MOTD cleared.");
		return;
	}
	lt = time(NULL);
	log2file(MOTD_FILE, "%.16s", ctime(&lt));
	add_motd_text_fmt(text);
	log2file(MOTD_FILE, "%s %s", "- - - - - - - - - - - - - - - - - - -",
			 "- - - - - - - - - - - - - - - - - - -");
	notify(player, "MOTD updated.");
}