Fix telegram notifications during read (toggle inform on)
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 21 Nov 2011 19:05:45 +0000 (20:05 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 29 Dec 2011 10:47:07 +0000 (11:47 +0100)
Reset number of pending telegrams before delete prompt instead of
after.

Before, the client claimed pending telegrams at that prompt, because
it wasn't C_INFORMed of the read, yet.  Worse, if more telegrams
arrived while sitting at the prompt, the reset clobbered their number
and sent a bogus clear C_INFORM message, effectively hiding the new
arrivals from the player.

src/lib/commands/rea.c

index 962abd8f7ea70e061040134be705372deabe2521..22df74e6bd3a5eb9ae3a6e5610004da69e16361f 100644 (file)
@@ -132,6 +132,14 @@ rea(void)
     if (res < 0)
        pr("\n> Mailbox corrupt, tell the deity.\n");
 
+    if (*kind != 'a') {
+       if (np->nat_flags & NF_INFORM) {
+           pr_inform(player, "\n");
+           np->nat_tgms = 0;
+           putnat(np);
+       }
+    }
+
     if (teles > 0 && player->cnum == num && may_delete) {
        pr("\n");
        if (teles == 1) {
@@ -174,13 +182,6 @@ rea(void)
            pr("No %ss for %s at the moment...\n", kind, cname(num));
     }
     (void)fclose(telfp);
-    if (*kind != 'a') {
-       if (np->nat_flags & NF_INFORM) {
-           pr_inform(player, "\n");
-           np->nat_tgms = 0;
-           putnat(np);
-       }
-    }
     return RET_OK;
 }