summaryrefslogtreecommitdiff
path: root/0.4.1/push.pl
blob: 5ae82c52676a40f74e400409e2deb72f16d85a6e (plain)
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
#!/usr/bin/perl -w

# yChat - Copyright by Paul C. Bütow

use CGI;
CGI->compile(':all');
$q = new CGI;

$| = 1; # Cache von Perl ausschalten

print
 $q->header;	 # HTML-Header erzeugen

require config;

&secure_checkid($alias);

########################################
##ANFANG DER ZU STREAMENDEN HTML-DATEI##
########################################

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>
END

#############################
##BEGRÜSSUNGSTEXT SCHREIBEN##
#############################

my $msgfile;

 print
   $q->font( { -size=>1,
               -color=>"ffffff",
               -face=>"arial"},
   	       "$title - Created & Copyright by Paul C. Bütow $tmp\n");

 if (-f "data/user/memos/$alias") {  # Nach Memonachrichten checken!
  print "\n<br>";
  &read_file("data/user/memos/$alias");
   my $memos = <DATEI>;
  close DATEI;
  print $memos;
  unlink("data/user/memos/$alias");
 }
 my $msgfile = "data/msgs/$alias";
 &write_file_new($msgfile);
  print DATEI $q->br;
 close DATEI;
 print $q->br;
 open (MSGFILE, $msgfile);

###############################
##ENDLOSSCHLEIFE FÜR DEN PUSH##
###############################

my ($times,$online) = (0,"false");
for (;;) {
 for ($curpos = tell(MSGFILE); <MSGFILE>; $curpos = tell(MSGFILE)) {
  print $_ ;
 }
 $times++;
 if ($times > 14) {			# Nach 15 Sekunden
  print "\n<!--PING//-->";		# Ping zum Browser senden
  $times = 0;				# Sekundenzahl auf 0 zurücksetzen
  $online = "true" if (-e "data/online/users/$alias");
  if ($online eq "false") {
    print "<font size=2 color=red>Aus technischen Gründen bitte auf <a href=\"push.pl?alias=$alias&room=$room&var=clear_screen&tmpid=$tmpid\">Weiterchatten</a> klicken.</font>";
    exit;
  }
  $online = "false"
 }
 sleep 1;
 seek(MSGFILE, $curpos, 0); 		# Position wiederherstellen
}