diff options
| author | Teddy Wing | 2016-09-18 02:14:09 -0400 |
|---|---|---|
| committer | Teddy Wing | 2016-09-18 02:14:09 -0400 |
| commit | 670ccf53297b3ca398ef78b3c4b5cd5edbcdca6d (patch) | |
| tree | cce960f9877013e3d294a6604a82b6af8878cbb4 | |
| parent | fcd4f7f60b564543b0e1fd03e586e2fe1d670495 (diff) | |
| download | irssi-slack-profile-670ccf53297b3ca398ef78b3c4b5cd5edbcdca6d.tar.bz2 | |
swhois: Trim leading & trailing whitespace from nick argument
When the nick is tab completed, it will get a space appended to it which
is included in the `$username` argument passed to our command.
That caused `find_user` to fail because it does an exact string equal
match on the username.
Ensure surrounding spaces are trimmed so that the comparison can be
executed correctly.
| -rw-r--r-- | slack_profile.pl | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/slack_profile.pl b/slack_profile.pl index 1c6f1a7..88b1a66 100644 --- a/slack_profile.pl +++ b/slack_profile.pl @@ -479,6 +479,10 @@ sub swhois { # If $username starts with @, strip it $username =~ s/^@//; + # Trim leading and trailing whitespace + $username =~ s/^\s+//; + $username =~ s/\s+$//; + if (my $user = find_user($username)) { print_whois($user); } |
