aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2016-09-17 18:00:45 -0400
committerTeddy Wing2016-09-17 18:00:45 -0400
commitcabbb06d4f9b4d6a527698e17481402c2084a66c (patch)
treeec9babed2bf723d422f9d678796cddbce4a3e95c
parent735ffb157c4201b92ede11edd2fd1461cf8c8e85 (diff)
downloadirssi-slack-profile-cabbb06d4f9b4d6a527698e17481402c2084a66c.tar.bz2
update_user_profile: Use correct nick
Previously the subroutine tried to use a nonexistent `$server` variable to get the current user's nick. To fix that, we get the server nick in `cmd_set` where we have access to it and then pass the nick to `update_user_profile`.
-rw-r--r--slack_profile.pl9
1 files changed, 5 insertions, 4 deletions
diff --git a/slack_profile.pl b/slack_profile.pl
index 431b37e..5d3a60b 100644
--- a/slack_profile.pl
+++ b/slack_profile.pl
@@ -195,9 +195,9 @@ sub complete_profile_field {
}
sub update_user_profile {
- my ($key, $value) = @_;
+ my ($nick, $key, $value) = @_;
- my $user = find_user($server->{'nick'});
+ my $user = find_user($nick);
my @profile_fields = qw(first_name last_name email phone skype title);
@@ -222,11 +222,12 @@ sub update_user_profile {
}
sub cmd_set {
- my ($data) = @_;
+ my ($data, $server) = @_;
my ($key, $value) = split /\s+/, $data, 2;
+ my $nick = $server->{'nick'};
if ($key) {
- update_user_profile($key, $value);
+ update_user_profile($nick, $key, $value);
}
}