Permalink
Browse files

Allow @mail/review to show all sent messages. Fixes issue 935.

git-svn-id: https://pennmush.googlecode.com/svn/trunk@1865 ba372814-4f39-11de-9ad6-1127a62b9fcd
  • Loading branch information...
1 parent 59df11c commit 4ae9447dc66f1866a7c6b27e8c2b62244be380cf mike@keyboardzombie.com committed Mar 25, 2014
Showing with 105 additions and 40 deletions.
  1. +5 −0 CHANGES.185
  2. +12 −1 HACKING.185
  3. +27 −10 game/txt/hlp/pennmail.hlp
  4. +5 −0 game/txt/hlp/pennv185.hlp
  5. +3 −2 hdrs/dbdefs.h
  6. +1 −1 hdrs/externs.h
  7. +1 −1 hdrs/svninfo.h
  8. +40 −20 src/extmail.c
  9. +2 −2 src/fundb.c
  10. +1 −1 src/parse.c
  11. +8 −2 src/utils.c
View
@@ -49,6 +49,11 @@ Minor changes:
pages. Suggested by [MG] and Trinsec. [SW]
* @success/@osuccess/@asuccess now get the old location of the moving object
in %0. Suggested by Riorgan. [SW]
+ * @mail/review with no args now lists all mail you've sent to everyone.
+ Suggested by Paige. [MG]
+ * @mail/review now shows the recipient in the message list, instead of the
+ sender. This is slightly more useful, since the person using the command
+ is always the sender. [MG]
Fixes:
* Windows compile fixes by ChaosMageX.
View
@@ -17,7 +17,18 @@ that have altered hardcode will appear here.
==========================================================================
-Version 1.8.5 patchlevel 5 ??? ??, 2013
+Version 1.8.5 patchlevel 6 ??? ??, 2014
+
+Monikers:
+ * ansi_name() now takes an additional arg, maxlen, to possibly trim (but not
+ pad) the name to be at most maxlen characters long. You probably don't want
+ to call ansi_name() directly, though; generally you'll want to use the
+ AName() or AaName() wrappers. If you need to make use of maxlen, use the
+ new AnsiNameWrapper() macro instead:
+ AnsiNameWrapper(dbref, accents?, AN_* flag, pointer, maxlen)
+ AName and AaName are now wrappers around this wrapper. Hardcode Inception.
+
+Version 1.8.5 patchlevel 5 Nov 20, 2013
Monikers:
* Many calls of Name() and accented_name() have been replaced with AName()
@@ -27,7 +27,9 @@
mail-folders mail-forward mail-other mail-admin
@malias mail-reviewing @mailquota
& mail-reading
-
+& @mail/read
+& @mail/list
+& @mail/cstats
@mail <msg #>
@mail/read <msg-list>
This displays messages which match the msg# or msg-list from
@@ -51,6 +53,8 @@
Shows how many messages you have, in the same format as the
automatic mail check when you connect.
& mail-sending
+& @mail/send
+& @mail/fwd
@mail[/switch] <player-list> = [<subject>]/<msg>
This sends the message <msg> to all players in <player-list>.
@@ -78,6 +82,13 @@
be "Forwarded".
& mail-other
+& @mail/clear
+& @mail/unclear
+& @mail/purge
+& @mail/tag
+& @mail/untag
+& @mail/unread
+& @mail/status
@mail/clear [<msg-list> | all]
@mail/unclear [<msg-list> | all]
These commands mark mail in the current folder as cleared or
@@ -112,6 +123,9 @@
@mail/tag, @mail/untag, @mail/clear, @mail/unclear and @mail/unread
respectively.
& mail-folders
+& @mail/folder
+& @mail/unfolder
+& @mail/file
The MUSH mail system allows each player 16 folders, numbered from 0
to 15. Mail can only be in 1 folder at a time. Folder 0 is the
"inbox" where new mail is received. Most @mail commands operate on
@@ -135,6 +149,18 @@
folder to a new folder, <folder#>.
See also: @mailfilter
+& mail-reviewing
+& @mail/review
+& @mail/retract
+ @mail/review [<player>]
+ Reviews the messages you have sent to <player>, or all messages you've
+ sent if no <player> is specified.
+
+ @mail/review <player>=<msglist>
+ Reads the messages you have sent to <player>.
+
+ @mail/retract <player>=<msglist>
+ Retracts (deletes) unread messages you have sent to <player>.
& @mailquota
@mailquota <player>[=<limit>]
@@ -273,15 +299,6 @@ See help @malias5 for more.
number of aliases and members of aliases in use.
@malias/chown is a wizard-only command that changes the owner of an alias.
@malias/nuke is a God-only command that destroys all aliases.
-& mail-reviewing
- @mail/review <player>
- Reviews the messages you have sent to <player>.
-
- @mail/review <player>=<msglist>
- Reads the messages you have sent to <player>.
-
- @mail/retract <player>=<msglist>
- Retracts (deletes) unread messages you have sent to <player>.
& Mail functions
Mail functions work with @mail.
@@ -47,6 +47,11 @@ Minor changes:
pages. Suggested by [MG] and Trinsec. [SW]
* @success/@osuccess/@asuccess now get the old location of the moving object
in %0. Suggested by Riorgan. [SW]
+ * @mail/review with no args now lists all mail you've sent to everyone.
+ Suggested by Paige. [MG]
+ * @mail/review now shows the recipient in the message list, instead of the
+ sender. This is slightly more useful, since the person using the command
+ is always the sender. [MG]
Fixes:
* Windows compile fixes by ChaosMageX.
View
@@ -354,7 +354,8 @@ extern const char EOD[];
(IsExit(x) && (options.monikers & AN_EXIT)) || \
has_flag_by_name(x, "MONIKER", NOTYPE))
-#define AName(x,level,p) ((moniker_type(x) && (options.monikers & level)) ? ansi_name(x, 0, p) : Name(x))
-#define AaName(x,level,p) ((moniker_type(x) && (options.monikers & level)) ? ansi_name(x, 1, p) : accented_name(x))
+#define AnsiNameWrapper(x,accents,level,p,len) ((moniker_type(x) && (options.monikers & level)) ? ansi_name(x, accents, p, len) : (accents ? accented_name(x) : Name(x)))
+#define AName(x,level,p) AnsiNameWrapper(x,0,level,p,0)
+#define AaName(x,level,p) AnsiNameWrapper(x,1,level,p,0)
#endif /* __DBDEFS_H */
View
@@ -458,7 +458,7 @@ char *shortname(dbref it);
dbref absolute_room(dbref it);
int can_interact(dbref from, dbref to, int type, NEW_PE_INFO *pe_info);
-char *ansi_name(dbref thing, bool accents, bool *had_moniker);
+char *ansi_name(dbref thing, bool accents, bool *had_moniker, int maxlen);
/* From warnings.c */
void run_topology(void);
void do_warnings(dbref player, const char *name, const char *warns);
View
@@ -1,3 +1,3 @@
#define SVNREVISION "$Rev$"
#define SVNDATE "$Date$"
-/* Built at 20140316053140 */
+/* Built at 20140325200732 */
View
@@ -879,13 +879,13 @@ void
do_mail_reviewlist(dbref player, dbref target)
{
char subj[30];
- char sender[BUFFER_LEN];
MAIL *mp;
char nbuff[BUFFER_LEN], *np;
int nlen;
struct mail_selector ms;
int i;
bool isplayer;
+ dbref last = NOTHING;
/* Initialize mail selector */
ms.low = 0;
@@ -900,36 +900,56 @@ do_mail_reviewlist(dbref player, dbref target)
notify_noenter(player, open_tag("SAMP"));
/* MG: I haven't ANSI'd this because I'm lazy, and it requires more than just
* replacing Name() with AName() */
- np = nbuff;
- safe_str(AName(target, AN_SYS, NULL), nbuff, &np);
- nlen = strlen(Name(target));
- if (nlen < 27)
- safe_fill(' ', 27 - nlen, nbuff, &np);
- *np = '\0';
+ if (target != NOTHING) {
+ np = nbuff;
+ safe_str(AName(target, AN_SYS, NULL), nbuff, &np);
+ nlen = strlen(Name(target));
+ if (nlen < 27)
+ safe_fill(' ', 27 - nlen, nbuff, &np);
+ *np = '\0';
+ mp = find_exact_starting_point(target);
+ } else {
+ np = nbuff;
+ safe_format(nbuff, &np, "%-27s", T("All"));
+ *np = '\0';
+ mp = HEAD;
+ }
notify_format(player,
T
("-------------------- MAIL: %s ------------------"),
nbuff);
- for (mp = find_exact_starting_point(target); mp && (mp->to == target);
+ for (; mp && ((target == NOTHING) || (mp->to == target));
mp = mp->next) {
+ if (last != mp->to) {
+ i = 0;
+ last = mp->to;
+ nbuff[0] = '\0';
+ }
if (mail_match(player, mp, ms, i)) {
/* list it */
i++;
if (SUPPORT_PUEBLO)
notify_noenter(player,
tprintf
("%c%cA XCH_CMD=\"@mail/review %s=%d\" XCH_HINT=\"Read message %d sent to %s\"%c",
- TAG_START, MARKUP_HTML, Name(target),
- i, i, Name(target), TAG_END));
+ TAG_START, MARKUP_HTML, Name(mp->to),
+ i, i, Name(mp->to), TAG_END));
strcpy(subj, chopstr(get_subject(mp), 28));
- strcpy(sender, get_sender(mp, 0, 12, &isplayer));
- safe_fill_to(' ', 12, sender);
- np = nbuff;
+ if (!nbuff[0]) {
+ np = nbuff;
+ safe_str(AnsiNameWrapper(mp->to, 0, AN_SYS, NULL, 12), nbuff, &np);
+ nlen = strlen(Name(mp->to));
+ if (nlen < 12) {
+ safe_fill(' ', 12 - nlen, nbuff, &np);
+ }
+ *np = '\0';
+ }
+ isplayer = IsPlayer(mp->to);
notify_format(player, "[%s] %-3d %c%-12s %-*s %s",
status_chars(mp), i,
- (isplayer && (Connected(mp->from) && (!hidden(mp->from)
+ (isplayer && (Connected(mp->to) && (!hidden(mp->to)
|| Priv_Who(player)))
- ? '*' : ' '), sender, 30, subj,
+ ? '*' : ' '), nbuff, 30, subj,
mail_list_time(show_time(mp->time, 0), 1));
if (SUPPORT_PUEBLO)
notify_noenter(player, tprintf("%c%c/A%c", TAG_START,
@@ -956,16 +976,16 @@ do_mail_review(dbref player, const char *name, const char *msglist)
dbref target;
if (!name || !*name) {
- notify(player,
- T("MAIL: I can't figure out whose mail you want to review."));
- return;
- }
- if ((target = lookup_player(name)) == NOTHING) {
+ target = NOTHING;
+ } else if ((target = lookup_player(name)) == NOTHING) {
notify(player, T("MAIL: I couldn't find that player."));
return;
}
if (!msglist || !*msglist) {
do_mail_reviewlist(player, target);
+ } else if (target == NOTHING) {
+ notify(player, T("MAIL: You must specify a player."));
+ return;
} else {
do_mail_reviewread(player, target, msglist);
}
View
@@ -1787,8 +1787,8 @@ FUNCTION(fun_moniker)
it = match_thing(executor, args[0]);
if (GoodObject(it)) {
- safe_str(ansi_name(it, 0, NULL), buff, bp);
- /*safe_str(ansi_name(it, accents, NULL), buff, bp); */
+ safe_str(ansi_name(it, 0, NULL, 0), buff, bp);
+ /*safe_str(ansi_name(it, accents, NULL, 0), buff, bp); */
} else
safe_str(T(e_notvis), buff, bp);
}
View
@@ -2279,7 +2279,7 @@ process_expression(char *buff, char **bp, char const **str,
case 'k':
case 'K': /* enactor moniker (ansi'd name) */
if (GoodObject(enactor))
- safe_str(ansi_name(enactor, 0, NULL), buff, bp);
+ safe_str(ansi_name(enactor, 0, NULL, 0), buff, bp);
else
safe_str(T(e_notvis), buff, bp);
break;
View
@@ -685,10 +685,12 @@ shortname(dbref it)
* \param had_moniker if non-null, set to 1 when the name is monikered,
* and 0 if it is returned without ANSI. Allows the caller to
* apply default ANSI for un-monikered names.
+ * \param maxlen the maximum number of visible (non-markup) characters to
+ copy, or 0 to copy the entire name
* \retval pointer to STATIC buffer containing the monikered name
*/
char *
-ansi_name(dbref thing, bool accents, bool *had_moniker)
+ansi_name(dbref thing, bool accents, bool *had_moniker, int maxlen)
{
static char name[BUFFER_LEN], *format, *np;
ATTR *a;
@@ -706,6 +708,10 @@ ansi_name(dbref thing, bool accents, bool *had_moniker)
else
strcpy(name, Name(thing));
+ if (maxlen > 0 && maxlen < BUFFER_LEN) {
+ name[maxlen] = '\0';
+ }
+
a = atr_get(thing, "MONIKER");
if (!a) {
set_mp(0);
@@ -722,7 +728,7 @@ ansi_name(dbref thing, bool accents, bool *had_moniker)
aname = parse_ansi_string(name);
ansi_string_replace(as, 0, BUFFER_LEN, aname);
np = name;
- safe_ansi_string(as, 0, as->len, name, &np);
+ safe_ansi_string(as, 0, (maxlen > 0 ? maxlen : as->len), name, &np);
*np = '\0';
free_ansi_string(as);
free_ansi_string(aname);

0 comments on commit 4ae9447

Please sign in to comment.