diff options
| author | 2015-04-03 21:30:35 +0400 | |
|---|---|---|
| committer | 2015-04-03 21:30:35 +0400 | |
| commit | e50196505e05d4563e95bc154ef0942fe2da798a (patch) | |
| tree | 6f226679dae2c6b3dc1c1aed5ae60dbcd8df16fe /modules/event.pl | |
| parent | 6eec97b15cd517e61e8c31856ac4985ae317aaf5 (diff) | |
modules/event.pl: track our own nick
As it seems, Net::IRC changes its idea of what our nick is when we *try*
to change nicks, not when the server acknowledges the change. This also
means it'll miss nick changes not done via ->nick (such as /ns regain or
;sl NICK ...). Therefore we'll have to react to incoming NICK messages
manually ... it's still not foolproof (because Net::IRC), but should fix
some minor bugs with the bot suffering an identity crisis and acting
strangely.
Notably, this should hopefully fix the issue with having to ;sync a
channel manually if it was ;join'ed while the bot didn't know its nick
properly. Maybe it'll fix some other weird crap, too.
Diffstat (limited to 'modules/event.pl')
| -rw-r--r-- | modules/event.pl | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/event.pl b/modules/event.pl index bbc56e1..b1876cd 100644 --- a/modules/event.pl +++ b/modules/event.pl @@ -496,6 +496,12 @@ sub on_nick { push ( @channels, $chan ); } } + + # unfortunately Net::IRC sucks at IRC so we have to implement this ourselves + if ($oldnick eq lc $conn->{_nick}) { + $conn->{_nick} = $event->{args}[0]; + } + $::sn{$newnick} = $::sn{$oldnick} if ($oldnick ne $newnick); $::db->logg( $event ); delete( $::sn{$oldnick}) if ($oldnick ne $newnick); |
