I believe I suggested making a script earlier, but I assumed that the "lock" feature would also be needed so that the script could be "locked" (I figure it could refuse to be connected to or communicate with a server if an appropriate script is not loaded). Also, there are things other than filenames that could be checked, including:

-Are you on a common channel with the user attempting to send you a file?
-Does this user have op or voice on a specific channel (a lot of times the actual file servers are)?
-Do you have a file session with that user open or did you request a file from that user with !nickname or some other method that specifies a nickname?

How/if you would use these rules depends on the channels involved though...