1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
# prefix.pl is in the public domain.
# Written by Thomas Morgan <tmorgan@pobox.com>
$add_ons .= '+prefix.pl' unless $add_ons =~ /\+prefix\.pl/;
$prefix = 'say ';
$cmdprefix = '/';
sub douserline {
local($line)=@_;
&dohooks("userline", $line);
if ($line =~ /^\@ssfe\@/) {
$ssfe=1;
$raw_mode=1;
$add_ons.="+ssfe";
&dostatus;
} elsif ($line =~ s/^$cmdprefix//) {
&dohooks("command", $line);
&docommand($line);
} elsif ($query) {
&dohooks("query", $line);
&msg($query, $line);
} else {
&dohooks("noslash", $line);
&docommand($line);
}
}
push(@hooks, "userline", "command", "query", "noslash");
sub hook_prefix {
$line = "$prefix$_[0]";
}
&addhook("noslash", "prefix");
sub cmd_prefix {
if ($args) {
eval(qq(\$prefix = $args));
} else {
&tell(qq(*** Prefix: "$prefix"));
}
}
&addcmd("prefix");
&addhelp("prefix", <<"EOH");
Usage: \cBPREFIX\cB ['<prefix>']
Changes the prefix for each line you type that doesn't start with /.
e.g. when you type /prefix 'say ' everything you type will be said on
the current channel (the default). /prefix ' ' will set it to the
null command (the same as 'say '). To emulate ircII's command_ mode,
use /prefix ''. If you invoke /prefix with no arguments, it will tell
you the current prefix (the current value of \$prefix, which is
$prefix).
EOH
sub cmd_cmdprefix {
if ($args) {
eval(qq(\$cmdprefix = $args));
} else {
&tell(qq(*** Command prefix: "$cmdprefix"));
}
}
&addcmd("cmdprefix");
&addhelp("cmdprefix", <<"EOH");
Usage: \cBCMDPREFIX\cB ['<prefix>']
Changes the prefix that determines whether each line you type is a
command or a message. For example, /cmdprefix '#' makes sirc
interpret every line starting with a `#' as a command. The default
is, of course, `/'. If /cmdprefix is invoked with no arguments, it
prints the current command prefix (the current value of \$cmdprefix,
which is $cmdprefix).
EOH
1;
|