The general idea
As of version 4.0a, MudNet will no longer directly execute any relay commands such as +finger. Instead the bot will use a softcoded trigger that gives the "victim" an opportunity to refuse the request. If you're interested in doing this, you will need to place some softcode in your mnlock attribute and set it visual.
&mnlock me=<code>
@set me/mnlock=visual
MNLock parameters
The mnlock attribute will be evaluated as a u-function, with the following arguments (the names in parentheses are descriptive only and are not used in the mnlock code):
- %0 (pid)
- a random number which must be used to send back the results; not usually needed in mnlocks
- %1 (command)
- one of the following, indicating what the person is trying to do: chan, cwho, cwhoall, finger, search, who2, mail, page; see below for more info
- %2 (owdbref)
- dbref of enactor's owner on the originating world
- %3 (odbref)
- dbref of enactor on the originating world
- %4 (oname)
- name of enactor on the originating world
- %5 (oworld)
- name of the originating world
- %6, %7, %8 (args)
- any additional comma-delimited arguments used by a particular command
MNLock return value
Whatever code is evaluated in your mnlock, it must return a value of 0 in order to actually deny a request. If you return any other value including the empty string, the command will be allowed to execute.
Command-specific parameters
- chan
- Someone is sending a message to a channel you're listening on. %6 is the channel name, %7 is the first character of the message, and %8 is the rest of the message.
- cwho
- Someone is asking who is listening on a certain channel on your MU*. %6 is the channel name.
- cwhoall
- Someone is asking who is listening on a certain channel on all worlds. %6 is the channel name,
- finger
- Someone is requesting +finger or +id info about you. %6 is the victim's name.
- search
- Someone is searching for everyone with a certain name. %6 is the victim's name.
- who2
- Someone is requesting WHO or DOING information about you in particular. %6 is the victim's name.
- Someone is trying to send you mnmail. %6 is the recipient's name, %7 is the subject of the mail, and %8 is the body of the mail. (mnlock examines the message before it has been edited by mnmail, so the subject and body are just what the sender entered).
- page
- Someone is trying to mnpage you. %6 is the recipient's name, %7 is the first character of the message, and %8 is the rest of the message.
Examples
- &mnlock me=0
- Blocks all the relay commands.
- &mnlock me=not(and(strmatch(%1,mail), strmatch(%2,#37), strmatch(%5,SpamMUSH)))
- Blocks all mnmails from #37@SpamMUSH's possessions.
- &mnlock me=not(switch(%1, page, or(strmatch(v(mn_haven),1), switch(v(mn_pagelock), %[*, u(mn_pagelock,%4@%5), match(v(mn_pagelock),%4@%5))), mail, or(strmatch(v(mn_haven),1), strmatch(v(mn_maillock),*@*))))
- Emulates the feeble locking functionality of MudNet 3.3b and earlier, not that you'd really want to.
- &mnlock me=or(squish(iter(v(mn_allow),
strmatch(%%1-%%2-%%5, ##))), not(squish(iter(v(mn_deny),
strmatch(%%1-%%2-%%5, ##)))))
&mn_allow me=*-*-NiceMUSH page-*-OkayMUSH cwho*-*-*
&mn_deny me=page-*-* chan-*-SpamMUSH *-*-EvilMUSH- Javelin's suggestion is to keep a list of patterns for commands you'd allow, and patterns for commands you'd deny.
Global locking
If you're a wizard, you can also set the mnlock_world attribute on the MudNet player. All incoming relay commands (including those that are not player-specific, such as mninfo) will go thru this lock before being processed. For commands that are player-specific, denial by mnlock_world overrides the victim's own mnlock.
&mnlock_world *MudNet=<code>
In addition to the possible values of %1 (commands) described above, %1 can take on the following values in mnlock_world (these commands do not have additional arguments beyond %5):
- info
- Someone is requesting your world's mninfo description.
- pwho
- Someone is requesting a +who listing from your world.
- staff
- Someone is requesting a +staff or +admin listing from your world.
- who
- Someone is requesting a WHO or DOING listing from your world.