- p=NULL;
- if (teles > 0 && player->cnum == num) { /* } */
- pr("\n");
- if (teles == 1) {
- if (chance(0.25))
- p = "Forget this one? ";
- else
- p = "Shall I burn it? ";
- } else {
- if (chance(0.25))
- p = "Into the shredder, boss? ";
- 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);
- if (p && *p == 'y') {
- if ((filelen = fsize(fileno(telfp))) > size) {
- pr("Wait a sec! A new %s has arrived...\n", kind);
- /* force stdio to re-read tel file */
- (void) fflush(telfp);
+ header = 0;
+ if (tgm.tel_type != lasttype || tgm.tel_from != lastcnum)
+ header++;
+ if (abs((int)(tgm.tel_date - (long)lastdate)) > TEL_SECONDS)
+ header++;
+ if (header) {
+ pr("\n> ");
+ lastcnum = tgm.tel_from;
+ lasttype = tgm.tel_type;
+ pr("%s ", telnames[(int)tgm.tel_type]);
+ if ((tgm.tel_type == TEL_NORM) ||
+ (tgm.tel_type == TEL_ANNOUNCE)) {
+ pr("from %s, (#%d)", cname(tgm.tel_from), tgm.tel_from);
+ }
+ if (tgm.tel_type == TEL_BULLETIN) {
+ pr("from %s, (#%d)", cname(tgm.tel_from), tgm.tel_from);
+ }
+ pr(" dated %s", ctime(&tgm.tel_date));
+ lastdate = tgm.tel_date;
+ }
+ teles++;
+ skip:
+ while (tgm.tel_length > 0) {
+ nbytes = tgm.tel_length;
+ if (nbytes > sizeof(buf) - 1)
+ nbytes = sizeof(buf) - 1;
+ (void)fread(buf, sizeof(s_char), nbytes, telfp);
+ buf[nbytes] = 0;
+ if (readit)
+ prnf(buf);
+ tgm.tel_length -= nbytes;
+ }
+ }
+ p = NULL;
+ if (teles > 0 && player->cnum == num) { /* } */
+ pr("\n");
+ if (teles == 1) {
+ if (chance(0.25))
+ p = "Forget this one? ";
+ else
+ p = "Shall I burn it? ";
+ } else {
+ if (chance(0.25))
+ p = "Into the shredder, boss? ";
+ 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);
+ if (p && *p == 'y') {
+ if ((filelen = fsize(fileno(telfp))) > size) {
+ pr("Wait a sec! A new %s has arrived...\n", kind);
+ /* force stdio to re-read tel file */
+ (void)fflush(telfp);