For example scripts, see the 'login.lua' script and the scripts in
Swiften/QA/ScriptedTests.