.TH Command READ
.NA read "Read your telegrams"
.LV Basic
-.SY "read"
+.SY "read [yes|no|<CNUM/CNAME>]"
The read command is used to read the telegrams sent you
by other countries and by the game,
(e.g. when you make a sale or are attacked).
.sp
+After reading all your telegrams you may delete them by
+specifying \*Qyes\*U or not by specifying \*Qno\*U as an argument.
+If an argument is not supplied then you will be prompted
+to either answer \*Qyes\*U or \*Qno\*U to delete the telegrams.
+If you supply or answer \*Qno\*U, the telegrams will remain
+pending but you will not be reminded of them.
+.sp
+Deities can specify a <CNUM/CNAME> argument which
+selects a country's telegrams to read.
+If the <CNUM/CNAME> argument is supplied, the telegrams can not be deleted.
+.sp
When telegrams arrive you are informed with:
.NF
\*QYou have a new telegram waiting ...\*U if there is just one new one, or
\*QYou have ten new telegrams waiting ...\*U if there are ten of them, or
\*QYou have several new telegrams waiting ...\*U if there are very many.
.FI
-After reading all your telegrams you may discard them by answering \*Qyes\*U to
-the question posed. If you answer \*Qno\*U the telegrams will remain
-pending but you will not be reminded of them.
.s1
This command reads only
telegrams & bulletins, use the 'wire' command to read announcements.
#include "tel.h"
#include "commands.h"
#include "optlist.h"
+#include "match.h"
#include <stdio.h>
#include <fcntl.h>
time_t delta;
int first = 1;
int readit;
+ int may_delete = 1; /* may messages be deleted? */
memset(kind, 0, sizeof(kind));
now = time(NULL);
if (*player->argp[0] == 'w') {
- sprintf(kind, "announcement");
+ strcpy(kind, "announcement");
if (player->argp[1] && isdigit(*player->argp[1])) {
delta = days(atoi(player->argp[1]));
then = now - delta;
+ may_delete = 0;
} else
then = np->nat_annotim;
mbox = annfil;
} else {
- sprintf(kind, "telegram");
- if (player->god && player->argp[1] != 0) {
+ strcpy(kind, "telegram");
+ if (player->god && player->argp[1] &&
+ (mineq(player->argp[1], "yes") == ME_MISMATCH) &&
+ (mineq(player->argp[1], "no") == ME_MISMATCH)) {
if ((n = natarg(player->argp[1], "")) < 0)
return RET_SYN;
num = n;
+ may_delete = 0;
}
mbox = mailbox(mbox_buf, num);
clear_telegram_is_new(player->cnum);
}
}
p = NULL;
- if (teles > 0 && player->cnum == num) { /* } */
+ if (teles > 0 && player->cnum == num && may_delete) {
pr("\n");
if (teles == 1) {
if (chance(0.25))
else
p = "Can I throw away these old love letters? ";
}
- if (player->god && *kind == 't')
- p = getstarg(player->argp[2], p, buf);
- else
- p = getstarg(player->argp[1], p, buf);
+ p = getstarg(player->argp[1], p, buf);
if (p && *p == 'y') {
if ((filelen = fsize(fileno(telfp))) > size) {
pr("Wait a sec! A new %s has arrived...\n", kind);
{"quit", 0, quit, 0, VIS},
{"radar <SHIPS | SECTS>", 1, rada, 0, NORM + CAP},
{"range <PLANES> <range>", 1, range, C_MOD, NORM + CAP},
- {"read", 0, rea, C_MOD, VIS},
+ {"read [yes|no|<CNUM/CNAME>]", 0, rea, C_MOD, VIS},
{"realm <number> [<SECTS>]", 0, real, C_MOD, NORM},
{"recon <spy-PLANES> <fighter-PLANES> <ap-SECT> <PATH|DESTINATION>", 3,
reco, C_MOD, NORM + MONEY + CAP},