Skip to content

Commit

Permalink
Prevent undef from being an event parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
hinrik committed Oct 3, 2010
1 parent be10e43 commit bc4f0cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Revision history for Perl extension POE::Component::IRC.
send commands with multiple arguments through the Console plugin.
- Add support for CAP command/replies. We use it to enable the server's
identify-msg feature when we connect.
- State.pm: In disconnected/error/socketerr events when no info is
available, make ARG1 an empty hash reference instead of undef.

6.46 Wed Sep 29 04:57:42 UTC 2010
- Document the 'debug' parameter.
Expand Down
9 changes: 4 additions & 5 deletions lib/POE/Component/IRC/State.pm
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ sub S_disconnected {
shift @_;

my $nickinfo = $self->nick_info($self->nick_name());
$nickinfo = {} if !defined $nickinfo;
my $channels = $self->channels();
push @{ $_[-1] }, $nickinfo, $channels;
return PCI_EAT_NONE;
Expand All @@ -42,6 +43,7 @@ sub S_error {
shift @_;

my $nickinfo = $self->nick_info($self->nick_name());
$nickinfo = {} if !defined $nickinfo;
my $channels = $self->channels();
push @{ $_[-1] }, $nickinfo, $channels;
return PCI_EAT_NONE;
Expand All @@ -50,6 +52,7 @@ sub S_error {
sub S_socketerr {
my ($self, undef) = splice @_, 0, 2;
my $nickinfo = $self->nick_info($self->nick_name());
$nickinfo = {} if !defined $nickinfo;
my $channels = $self->channels();
push @{ $_[-1] }, $nickinfo, $channels;
return PCI_EAT_NONE;
Expand Down Expand Up @@ -167,11 +170,7 @@ sub S_quit {
# Check if it is a netsplit
$netsplit = 1 if _is_netsplit( $msg );

if ($unick eq u_irc($self->nick_name(), $map)) {
delete $self->{STATE};
delete $self->{NETSPLIT};
}
else {
if ($unick ne u_irc($self->nick_name(), $map)) {
for my $uchan ( keys %{ $self->{STATE}{Nicks}{ $unick }{CHANS} } ) {
delete $self->{STATE}{Chans}{ $uchan }{Nicks}{ $unick };
# No don't stash the channel state.
Expand Down

0 comments on commit bc4f0cd

Please sign in to comment.