Skip to content

Commit

Permalink
@mail message lists (And the default empty list) respect the current …
Browse files Browse the repository at this point in the history
…folder. Issue #77.
  • Loading branch information
shawnw committed Jul 6, 2018
1 parent 9fbcf80 commit 79b9be2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES.187.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ Fixes
* `sqlescape()` when using a sqlite3 connection no longer also requires MySQL.
* A number of issues in the handling UTF-8 text sent by clients have been fixed, as well as improvements in UTF-8 handling in general. [SW]
* Fix an off-by-one error in command switch initialization code. [SW]
* `@mail` without a message list respects the current folder instead of using folder 0. [77]

Documentation
-------------
Expand Down
5 changes: 4 additions & 1 deletion game/txt/hlp/pennmail.hlp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
A sender (ex: *paul)
An age of mail in days (ex: ~3 (exactly 3), <2, >1)
"days" here means 24-hour periods from the current time.
One of the following: "read", "unread", "cleared", "tagged", "urgent", "all" (all messages in all folders), "folder" (all messages in current folder)
One of the following: "read", "unread", "cleared", "tagged", "urgent", "folder" (all messages in the current folder), "all" (all messages in all folders).

Unless a folder is explicitly specified, or all is used, only messages in the current folder will be counted.

A <player-list> is a space-separated list of recipients, which may be:
Player names
Player dbref #'s
Expand Down
8 changes: 4 additions & 4 deletions src/extmail.c
Original file line number Diff line number Diff line change
Expand Up @@ -2896,7 +2896,7 @@ parse_msglist(const char *msglist, struct mail_selector *ms, dbref player)
/* Initialize the mail selector - this matches all messages */
ms->low = 0;
ms->high = 0;
ms->flags = 0x00FF | M_MSUNREAD;
ms->flags = 0x00FF | M_MSUNREAD | M_FOLDER;
ms->player = 0;
ms->days = -1;
ms->day_comp = 0;
Expand All @@ -2906,12 +2906,11 @@ parse_msglist(const char *msglist, struct mail_selector *ms, dbref player)
return 1;
}
/* Don't mess with msglist itself */
strncpy(tbuf1, msglist, BUFFER_LEN - 1);
mush_strncpy(tbuf1, msglist, BUFFER_LEN);
p = tbuf1;
while (p && *p && isspace(*p))
p++;
if (!p || !*p) {
ms->flags |= M_FOLDER;
return 1; /* all messages in current folder */
}
if (isdigit(*p) || *p == '-') {
Expand All @@ -2920,6 +2919,7 @@ parse_msglist(const char *msglist, struct mail_selector *ms, dbref player)
return 0;
}
/* remove current folder when other folder specified */
ms->flags &= ~M_FOLDER;
ms->flags |= FolderBit(folder);
} else if (*p == '~') {
/* exact # of days old */
Expand Down Expand Up @@ -3008,7 +3008,7 @@ parse_msglist(const char *msglist, struct mail_selector *ms, dbref player)
} else if (!strcasecmp(p, "clear") || !strcasecmp(p, "cleared")) {
ms->flags = M_CLEARED | M_FOLDER;
} else if (!strcasecmp(p, "tag") || !strcasecmp(p, "tagged")) {
ms->flags = M_TAG;
ms->flags = M_TAG | M_FOLDER;
} else if (!strcasecmp(p, "mass")) {
ms->flags = M_MASS;
} else if (!strcasecmp(p, "me")) {
Expand Down

0 comments on commit 79b9be2

Please sign in to comment.