Re: News and mail added to prompt

From: George Greer (
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;

  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

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

   | FAQ: |
   | Archives: |

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