aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2016-09-17 06:51:09 -0400
committerTeddy Wing2016-09-17 06:51:09 -0400
commitfbcd0dce92f8fb57d85893b68cd85c9c7466ec6a (patch)
tree3bc927733408406b8991a3343662d7301c0e8de9
parent586fabf96c50c5aa8e6811dab136b8d7d0318054 (diff)
downloadirssi-slack-profile-fbcd0dce92f8fb57d85893b68cd85c9c7466ec6a.tar.bz2
cmd_set: Only call `update_user_profile` if `$key` is set
If the `/slack_profile_set` command is called with no arguments (in this case, no key), then don't call this subroutine because it requests the Slack API. We should only make remote requests when we have enough information.
-rw-r--r--slack_profile.pl4
1 files changed, 3 insertions, 1 deletions
diff --git a/slack_profile.pl b/slack_profile.pl
index 80e2501..7962e02 100644
--- a/slack_profile.pl
+++ b/slack_profile.pl
@@ -219,7 +219,9 @@ sub cmd_set {
my ($data) = @_;
my ($key, $value) = split /\s+/, $data, 2;
- update_user_profile($key, $value);
+ if ($key) {
+ update_user_profile($key, $value);
+ }
}
sub find_user {