sub stream {
unlink "data/online/rooms/$loginplace/$alias";
&secure_checkid($alias, $tmpid);
my $pid = $$;
$SIG{'CHLD'} = 'IGNORE';
++$|;
print qq[\n
\n\n\n\n];
&check_online;
print "$title - Letzte Änderung $datum\n; Der Chat wird geladen...\n
";
sleep 1;
print "Hallo $alias, mit dem Befehl /menu kannst du das Chat-Menü aufrufen!
";
sleep 1;
print "Du befindest dich im Raum $room: " . get_theme($room) . "
\n";
print "\n";
if (-f "data/user/memos/$alias") {
open MEMOS, ";
close MEMOS;
my $memos;
foreach $_ (@memos) {
$memos .= $_;
}
print $memos;
unlink "data/user/memos/$alias";
}
my ($change_room,
$startime,
$flooding,
@ignore,
@flood);
OPENMSGFILE:
$change_room = 0;
$startime = time;
$flooding = 0;
unless (-f "data/online/rstat/$room") {
open DATEI, ">data/online/rstat/$room";
print DATEI "0\n\n$alias<;1\n";
close DATEI;
}
open DATEI, ">data/online/users/$alias";
print DATEI time;
close DATEI;
open DATEI, ">data/online/rooms/$room/$alias";
print DATEI time;
close DATEI;
if (-e "data/msgs/$room") {
open MSGFILE, "data/online/pids/$room/$pid";
print PID time;
close PID;
}
else {
sleep 1;
goto OPENMSGFILE;
}
&sendmsgs;
while (-f "data/online/users/$alias") {
local $SIG{'USR1'} = \&sendmsgs;
goto OPENMSGFILE if $change_room == 1;
unlink "data/online/rooms/$loginplace/$alias"
if (-f "data/online/rooms/$loginplace/$alias");
sleep 15;
print "\n";
}
sub sendmsgs {
for ($curpos = tell MSGFILE; defined($_ = ); $curpos = tell MSGFILE) {
my($address, $stamp, $command, $action, $message, $from) = split(/<;/, $_, 7);
if ($address =~ /$\!/ or $address eq $alias) {
if ($stamp > $startime) {
if ($command eq 'col') {
($col, $secol) = split(/;/, $action, 3);
}
elsif ($command eq 'cr') {
unlink "data/online/pids/$room/$pid";
$room = $action;
close MSGFILE;
$change_room = 1;
}
elsif ($command eq 'ig') {
my @temp;
my $add2list = 1;
foreach $_ (@ignore) {
if ($action ne $_) {
push @temp, $_;
}
else {
$add2list = 0;
}
}
if ($add2list == 1) {
push @ignore, $action;
print "$action wird nun ignoriert!
\n";
&post_prv_extra($action, "Du wirst nun von $alias ignoriert!");
}
else {
@ignore = @temp;
print "$action wird nun nicht mehr ignoriert!
\n";
&post_prv_extra($action, "Du wirst nun von $alias nicht mehr ignoriert!");
}
}
elsif ($command eq 'igl') {
my $ignored;
foreach $_ (@ignore) {
$ignored .= "$_ ";
}
if ($#ignore == -1) {
print "Momentan wird keine Person von dir ignoriert!
\n";
}
else {
print "Folgende Personen werden von dir ignoriert: $ignored!
\n";
}
}
elsif ($command eq 'quit') {
print "\n";
last;
}
elsif ($change_room != 1) {
my $ignored = 0;
foreach $_ (@ignore) {
if ($_ eq $from) {
$ignored = 1;
last;
}
}
if ($ignored != 1) {
print "$message\n";
}
else {
$address =~ s/!//;
&post_prv_extra($from, "Du wirst von $alias ignoriert!") if $address eq $alias;
}
}
push @flood, $address . $command . $action . $message . $from;
if ($flood[0] eq $flood[1] and $flood[0] eq $flood[2] and $flood[0] eq $flood[3]) {
print "$from flutet den Chat !
\n";
if ($from eq $alias and $flooding++ and $flooding >= 4) {
&post($room, q[] . ×tring . " Das System katapultiert $alias> wegen Fluten des Chats nach draussen ... ", $alias);
print "\n";
&rm_alias($alias, $room);
}
}
else {
$flooding = 0;
}
shift @flood if $#flood > 2;
}
}
}
seek MSGFILE, $curpos, 0;
}
unlink "data/online/pids/$room/$pid";
}
sub post_prv_extra {
my($alias, $message) = @_;
my $helpid = fork;
if ($helpid == 0) {
&post_prv($alias, $message);
exit 0;
}
}
1;