… | |
… | |
2 | |
2 | |
3 | # miscellaneous commands |
3 | # miscellaneous commands |
4 | |
4 | |
5 | sub rename_to($$$) { |
5 | sub rename_to($$$) { |
6 | my ($ob, $from, $to) = @_; |
6 | my ($ob, $from, $to) = @_; |
7 | |
|
|
8 | warn "<$ob|$from|$to>\n";#d# |
|
|
9 | |
7 | |
10 | $to =~ /^[a-zA-Z0-9.,=#\/%$!^]*$/ |
8 | $to =~ /^[a-zA-Z0-9.,=#\/%$!^]*$/ |
11 | or return $ob->message ("rename: name must consist only of letters, digits, spaces and a few other things."); |
9 | or return $ob->message ("rename: name must consist only of letters, digits, spaces and a few other things."); |
12 | |
10 | |
13 | 127 >= length $to |
11 | 127 >= length $to |
… | |
… | |
39 | } |
37 | } |
40 | |
38 | |
41 | cf::register_command rename => 0, sub { |
39 | cf::register_command rename => 0, sub { |
42 | my ($ob, $arg) = @_; |
40 | my ($ob, $arg) = @_; |
43 | |
41 | |
44 | warn "<<<$arg>>>\n";#d# |
|
|
45 | |
|
|
46 | if ($arg =~ /^\s* (?: <([^>]+)> \s+)? to \s+ <([^>]+)> \s*$/x) { |
42 | if ($arg =~ /^\s* (?: <([^>]+)> \s+)? to \s+ <([^>]+)> \s*$/x) { |
47 | # compatibility syntax |
43 | # compatibility syntax |
48 | rename_to $ob, $1, $2; |
44 | rename_to $ob, $1, $2; |
49 | } elsif ($arg =~ / |
45 | } elsif ($arg =~ / |
50 | ^\s* |
46 | ^\s* |