# MISC STRING UTILITY ROUTINES to convert between DarkPlaces and IRC conventions
# convert mIRC color codes to DP color codes
# MISC STRING UTILITY ROUTINES to convert between DarkPlaces and IRC conventions
# convert mIRC color codes to DP color codes
our @color_irc2dp_table = (7, 0, 4, 2, 1, 1, 6, 1, 3, 2, 5, 5, 4, 6, 7, 7);
our @color_dp2irc_table = (-1, 4, 9, 8, 12, 11, 13, -1, -1, -1); # not accurate, but legible
our @color_dp2ansi_table = ("m", "1;31m", "1;32m", "1;33m", "1;34m", "1;36m", "1;35m", "m", "1m", "1m"); # not accurate, but legible
our @color_irc2dp_table = (7, 0, 4, 2, 1, 1, 6, 1, 3, 2, 5, 5, 4, 6, 7, 7);
our @color_dp2irc_table = (-1, 4, 9, 8, 12, 11, 13, -1, -1, -1); # not accurate, but legible
our @color_dp2ansi_table = ("m", "1;31m", "1;32m", "1;33m", "1;34m", "1;36m", "1;35m", "m", "1m", "1m"); # not accurate, but legible
- "\0", '#', '#', '#', '#', '.', '#', '#',
+ '', '#', '#', '#', '#', '.', '#', '#',
'#', 9, 10, '#', ' ', 13, '.', '.',
'[', ']', '0', '1', '2', '3', '4', '5',
'6', '7', '8', '9', '.', '<', '=', '>',
'#', 9, 10, '#', ' ', 13, '.', '.',
'[', ']', '0', '1', '2', '3', '4', '5',
'6', '7', '8', '9', '.', '<', '=', '>',
'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
'x', 'y', 'z', '{', '|', '}', '~', '<'
);
'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
'x', 'y', 'z', '{', '|', '}', '~', '<'
);
}
sub color_dp_transform(&$)
{
my ($block, $message) = @_;
}
sub color_dp_transform(&$)
{
my ($block, $message) = @_;
$message =~ s{(?:(\^\^)|\^x([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])|\^([0-9])|(.))(?=([0-9,]?))}{
defined $1 ? $block->(char => '^', $7) :
defined $2 ? $block->(rgb => [hex $2, hex $3, hex $4], $7) :
$message =~ s{(?:(\^\^)|\^x([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])|\^([0-9])|(.))(?=([0-9,]?))}{
defined $1 ? $block->(char => '^', $7) :
defined $2 ? $block->(rgb => [hex $2, hex $3, hex $4], $7) :
[ irc => q{:(([^! ]*)![^ ]*) JOIN (#.+)} => sub {
my ($hostmask, $nick, $chan) = @_;
[ irc => q{:(([^! ]*)![^ ]*) JOIN (#.+)} => sub {
my ($hostmask, $nick, $chan) = @_;
out irc => 0, "PRIVMSG Q :users $chan"; # get auths for all users
} else {
$store{quakenet_hosts}->{$nick} = $hostmask;
out irc => 0, "PRIVMSG Q :users $chan"; # get auths for all users
} else {
$store{quakenet_hosts}->{$nick} = $hostmask;
- # detect channel join message and note hostname length to get the maximum allowed line length
- [ irc => q{(:(?i:(??{$store{irc_nick}}))![^ ]* )(?i:JOIN) :(?i:(??{$config{irc_channel}}))} => sub {
- $store{irc_maxlen} = 510 - length($1);
- $store{irc_joined_channel} = 1;
- print "* detected maximum line length for channel messages: $store{irc_maxlen}\n";
- return 0;
- } ],
-
# chat: Xonotic server -> IRC channel
[ dp => q{\001(.*?)\^7: (.*)} => sub {
my ($nick, $message) = map { color_dp2irc $_ } @_;
# chat: Xonotic server -> IRC channel
[ dp => q{\001(.*?)\^7: (.*)} => sub {
my ($nick, $message) = map { color_dp2irc $_ } @_;
{
$store{irc_nick_requested} = $config{irc_nick};
out irc => 1, "NICK $config{irc_nick}", "USER $config{irc_user} localhost localhost :$store{dp_hostname}";
{
$store{irc_nick_requested} = $config{irc_nick};
out irc => 1, "NICK $config{irc_nick}", "USER $config{irc_user} localhost localhost :$store{dp_hostname}";