Re: News and mail added to prompt

From: George Greer (greerga@circlemud.org)
Date: 11/27/01


On Tue, 27 Nov 2001, Mike Breuer wrote:

>I would recommend also adding a PRF_DISPMAIL flag so that users can turn it
>off.  News would be similar, but I don't know offhand how you would
>determine whether there is "new" news.

Somewhere in the char_data structure or descendents:
+  time_t last_read_news;

Global somewhere (db.c?):
+time_t news_update;

ACMD(do_reboot)
{
  struct stat newstime;
  ...
    file_to_string_alloc(NEWS_FILE, &news);
+   stat(NEWS_FILE, &newstime);
+   news_update = newstime.st_mtime
  ...
}

char *make_prompt(struct descriptor_data *d)
{
  ...
+   if (d->character->last_read_news < news_update)
+     strcat(prompt, "(news) ");

    strcat(prompt, "> ");
  ...
}

You're going to want to error-check that stat() call, but that should give
the basic idea.  Don't forget to update "last_read_news" when they actually
read it.

BTW, stat() might not work in Windows.

--
George Greer
greerga@circlemud.org

(I was always annoyed when reading the news made you walk north, east,
west, and south.)

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST