Skip to content

Commit ffbf8d6

Browse files
committed
9.99: updated TIME and ADMIN commands to use the same global command
mechanism used by VERSION, UPDATE, RELOAD...
1 parent e8a1c7d commit ffbf8d6

File tree

8 files changed

+21
-54
lines changed

8 files changed

+21
-54
lines changed

INDEV

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2879,4 +2879,6 @@ CHANGES:
28792879
98. VERSION command now accurately displays version info for remote servers.
28802880
improved reliablity of commands which take a remote server argument like VERSION, TIME, RELOAD, etc.
28812881
commands which take a server mask parameter that can only match one server will now always match the local server if the query is "*".
2882-
2882+
2883+
99. updated TIME and ADMIN commands to use the same global command mechanism used by VERSION, UPDATE, RELOAD...
2884+

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9.98
1+
9.99

modules/Core/UserCommands.module/UserCommands.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
"description" : "the core set of user commands",
1010
"name" : "Core::UserCommands",
1111
"package" : "M::Core::UserCommands",
12-
"version" : "9.98"
12+
"version" : "9.99"
1313
}

modules/Core/UserCommands.module/UserCommands.pm

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ our %user_commands = (
6060
VERSION => {
6161
code => \&version,
6262
desc => 'view server version information',
63-
params => 'server(opt)'
63+
params => 'server_mask(opt)'
6464
},
6565
LINKS => {
6666
code => \&links,
@@ -182,8 +182,10 @@ our %user_commands = (
182182
);
183183

184184
sub init {
185-
$mod->register_global_command(name => 'version') or return;
186-
185+
$mod->register_global_command(name => $_) || return foreach qw(
186+
version time admin
187+
);
188+
187189
&add_join_callbacks;
188190
&add_whois_callbacks;
189191

@@ -1158,7 +1160,7 @@ sub version {
11581160

11591161
# if the server isn't me, forward it.
11601162
if ($server != $me) {
1161-
$server->{location}->fire_command_data(version => $user, "\$$$server{sid}");
1163+
$server->{location}->fire_command(version => $user, $server);
11621164
return 1;
11631165
}
11641166

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"author" : {
3-
"website" : "https://github.com/cooper",
4-
"name" : "Mitchell Cooper"
3+
"name" : "Mitchell Cooper",
4+
"website" : "https://github.com/cooper"
55
},
6-
"description" : "basic set of JELP command handlers",
76
"depends" : {
87
"modules" : "JELP::Base"
98
},
9+
"description" : "basic set of JELP command handlers",
10+
"name" : "JELP::Incoming",
1011
"package" : "M::JELP::Incoming",
11-
"version" : "15.73",
12-
"name" : "JELP::Incoming"
12+
"version" : "15.93"
1313
}

modules/JELP/Incoming.module/Incoming.pm

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,6 @@ my %scommands = (
145145
params => '-tag.for(server) -source(user) user',
146146
code => \&whois
147147
},
148-
ADMIN => { # @for=sid :uid ADMIN
149-
params => '-tag.for(server) -source(user)',
150-
code => \&admin
151-
},
152-
TIME => { # @for=sid :uid TIME
153-
params => '-tag.for(server) -source(user)',
154-
code => \&_time
155-
},
156148
SNOTICE => { # :sid SNOTICE flag :message
157149
params => '-source(server) any :rest',
158150
code => \&snotice
@@ -793,34 +785,6 @@ sub whois {
793785
return 1;
794786
}
795787

796-
sub admin {
797-
my ($server, $msg, $t_server, $user) = @_;
798-
799-
# this message is for me.
800-
if ($t_server->is_local) {
801-
return $user->handle_unsafe('ADMIN');
802-
}
803-
804-
# === Forward ===
805-
$msg->forward_to($t_server, admin => $user, $t_server);
806-
807-
return 1;
808-
}
809-
810-
sub _time {
811-
my ($server, $msg, $t_server, $user) = @_;
812-
813-
# this message is for me.
814-
if ($t_server->is_local) {
815-
return $user->handle_unsafe('TIME');
816-
}
817-
818-
# === Forward ===
819-
$msg->forward_to($t_server, time => $user, $t_server);
820-
821-
return 1;
822-
}
823-
824788
sub snotice {
825789
my ($server, $msg, $s_serv, $notice, $message) = @_;
826790
(my $pretty = ucfirst $notice) =~ s/_/ /g;

modules/JELP/Outgoing.module/Outgoing.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
"description" : "basic set of JELP outgoing commands",
1010
"name" : "JELP::Outgoing",
1111
"package" : "M::JELP::Outgoing",
12-
"version" : "15.15"
12+
"version" : "15.35"
1313
}

modules/JELP/Outgoing.module/Outgoing.pm

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,13 +412,12 @@ sub join_with_modes {
412412

413413
sub admin {
414414
my ($to_server, $user, $t_server) = @_;
415-
"\@for=$$t_server{sid} :$$user{uid} ADMIN"
415+
":$$user{uid} ADMIN \$$$t_server{sid}"
416416
}
417417

418-
419418
sub _time {
420419
my ($to_server, $user, $t_server) = @_;
421-
"\@for=$$t_server{sid} :$$user{uid} TIME"
420+
":$$user{uid} TIME \$$$t_server{sid}"
422421
}
423422

424423
sub snotice {
@@ -427,8 +426,8 @@ sub snotice {
427426
}
428427

429428
sub version {
430-
my ($to_server, $user, $target_server) = @_;
431-
":$$user{uid} VERSION \$$$target_server{sid}"
429+
my ($to_server, $user, $t_server) = @_;
430+
":$$user{uid} VERSION \$$$t_server{sid}"
432431
}
433432

434433
$mod

0 commit comments

Comments
 (0)