Trim whitespace before checking if the nick is valid

This was reported as https://bugzilla.wikimedia.org/show_bug.cgi?id=49542
Merge pull request #3 from legoktm/patch-1

Trim whitespace before checking if the nick is valid