Here is a quick script that will lock messenger when you status is set to idle.
In order for this to work WLM has to be allowed to change your status to idle after X minutes of inacctivity.
js code:
function OnEvent_MyStatusChange (nStatus) {
if (nStatus === STATUS_IDLE) {
Messenger.LockMessenger = true;
}
}