@@ -30,25 +30,23 @@ sub init {
3030 );
3131
3232 $mod -> register_registration_command(
33- name => shift @$_ , code => shift @$_ ,
34- parameters => shift @$_ , with_data => shift @$_ ,
35- after_reg => shift @$_
33+ name => shift @$_ , code => shift @$_ ,
34+ parameters => shift @$_ , after_reg => shift @$_
3635 ) or return foreach (
3736 #
3837 # PARAMS = number of parameters
39- # DATA = true if include $data string
4038 # LATER = true if the command should be handled even after registration
4139 #
42- # [ NAME => \&sub PARAMS DATA LATER
43- [ PING => \&rcmd_ping, 1, undef , 1 ],
44- [ PONG => sub { 1 }, undef , undef , 1 ],
45- [ CAP => \&rcmd_cap, 1, undef , 1 ],
46- [ NICK => \&rcmd_nick, 1, undef , ],
47- [ USER => \&rcmd_user, 4, 1, 1 ],
48- [ SERVER => \&rcmd_server, 5, undef , ],
49- [ PASS => \&rcmd_pass, 1, undef , ],
50- [ QUIT => \&rcmd_quit, undef , 1, ],
51- [ ERROR => \&rcmd_error, 1, undef , 1 ],
40+ # [ NAME => \&sub PARAMS LATER
41+ [ PING => \&rcmd_ping, 1, 1 ],
42+ [ PONG => sub { 1 }, undef , 1 ],
43+ [ CAP => \&rcmd_cap, 1, 1 ],
44+ [ NICK => \&rcmd_nick, 1, ],
45+ [ USER => \&rcmd_user, 4, 1 ],
46+ [ SERVER => \&rcmd_server, 5, ],
47+ [ PASS => \&rcmd_pass, 1, ],
48+ [ QUIT => \&rcmd_quit, undef , ],
49+ [ ERROR => \&rcmd_error, 1, 1 ],
5250 );
5351
5452 return 1;
@@ -199,7 +197,7 @@ sub rcmd_nick {
199197}
200198
201199sub rcmd_user {
202- my ($connection , $event , $data , @args ) = @_ ;
200+ my ($connection , $event , @args ) = @_ ;
203201
204202 # already registered.
205203 if ($connection -> {type }) {
@@ -208,8 +206,8 @@ sub rcmd_user {
208206 }
209207
210208 $connection -> {ident } = $args [0];
211- $connection -> {real } = col(( split /\ s +/, $data , 5)[4]) ;
212- $connection -> fire_event(reg_user => @$connection { qw( ident real ) } );
209+ $connection -> {real } = $args [3] ;
210+ $connection -> fire_event(reg_user => @args [0,3] );
213211 $connection -> reg_continue(' id2' );
214212}
215213
@@ -264,8 +262,8 @@ sub rcmd_pass {
264262
265263# not used for registered users.
266264sub rcmd_quit {
267- my ($connection , $event , $data , $ arg ) = @_ ;
268- my $reason = defined $arg ? col(( split /\ s +/, $data , 2)[1]) : ' leaving' ;
265+ my ($connection , $event , $arg ) = @_ ;
266+ my $reason = $arg // ' leaving' ;
269267 $connection -> done(" ~ $reason " );
270268}
271269
0 commit comments