moo.sdk.mail

Mail SDK for verb authors.

Functions here are re-exported via moo.sdk and are available in verb code as top-level names. The underlying Message / MessageRecipient models are NOT exposed — verbs receive plain Python values, not querysets.

Security properties: - No dunder or type() exposure. - send_message validates recipients via is_a($player) before writing. - get_message returns None for out-of-range indices (no IndexError leakage). - Ownership enforced by query: players only see their own MessageRecipient rows. - Raw querysets are never returned; all functions return list or scalar values.

Functions

count_unread(player)

Return the count of unread, non-deleted messages for the player.

delete_message(player, n)

Soft-delete message n.

get_mail_stats(player)

Return a dict with total, unread, and deleted message counts for the player.

get_mailbox(player[, include_deleted])

Return player's received messages as a list of MessageRecipient rows, newest first.

get_message(player, n)

Return the nth message (1-based) in the player's non-deleted mailbox, or None.

mark_read(player, n)

Mark message n as read.

send_message(sender, recipients, subject, body)

Create a message and deliver it to all recipients.

undelete_message(player, n)

Restore the nth deleted message (1-based among deleted-only list).