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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
#!/usr/bin/perl -w
# yChat - Copyright by Paul C. Bütow
use CGI;
CGI->compile(':all');
$q = new CGI;
print
$q->header;
require config;
$alias = $q->param("alias");
$tmpid = $q->param("tmpid");
&secure_checkid($alias);
$room = $q->param("room");
my $pid = $$;
$| = 1;
print <<END;
<html>
<head>
<script language="JavaScript">
<!--
// Scroll-Routine von Anklepper (http://www.anklepper.de)
// speziell für yChat (http://www.yChat.de), Copyright 2000
scrolling = true;
moves_steps = 4; // Schrittgröße
moves_interval = 4; // Schrittgeschwindigkeit
function moves()
{
if( scrolling != false )
window.scrollBy( 0, moves_steps );
window.setTimeout( "moves()", moves_interval );
}
moves();
//-->
</script>
</head>
<body bgcolor=000000 link=FFFFFF alink=FFFFEF vlink=FFFFEF>
<font size=1 color=ffffff face=arial>$title - Created & Copyright by Paul C. Bütow [PID: $pid]</font><br>
END
my $msgfile;
if (-f "data/user/memos/$alias") {
open(MEMOS,"<data/user/memos/$alias");
my $memos = <MEMOS>;
close MEMOS;
print $memos;
unlink("data/user/memos/$alias");
}
my $startime,$change_room,@pids;
$SIG{INT} = \&sendmsgs;
OPENMSGFILE:
$change_room = 0;
$startime = time;
if (-e "data/msgs/$room") {
open(MSGFILE,"<data/msgs/$room");
open(PID,">>data/online/pids/$room");
print PID $pid."\n";
close PID;
} else {
sleep 1;
goto OPENMSGFILE;
}
&sendmsgs;
while (-e "data/online/users/$alias") {
goto OPENMSGFILE if ($change_room == 1);
sleep 15;
print "<!--PING//-->\n";
}
sub sendmsgs {
for ($curpos = tell(MSGFILE); <MSGFILE>; $curpos = tell(MSGFILE)) {
my ($address, $stamp, $command, $action, $message) = split(/<;/, $_);
if ($address eq "!" || $address eq $alias) {
if ($stamp > $startime) {
if ($command eq "cr") {
&closepid;
$room = $action;
close MSGFILE;
$change_room = 1;
}
print "$message<br>\n" if ($change_room != 1);
}
}
}
seek(MSGFILE, $curpos, 0);
}
sub closepid {
@pids = undef;
open(PID,"<data/online/pids/$room");
@pids = <PID>;
close PID;
my @newpids = undef;
foreach(@pids) {
push @newpids,$_ if ($pid ne $_."\n");
}
open(PID,">data/online/pids/$room");
print PID @newpids;
close PID;
}
&closepid;
|