From 630af0ed6c0af69c7df2e45aef7a87722a3c00c0 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 6 Apr 2013 13:14:47 +0200 Subject: tagging ychat-perl-legacy --- 0.4.2/push.pl | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 0.4.2/push.pl (limited to '0.4.2/push.pl') diff --git a/0.4.2/push.pl b/0.4.2/push.pl new file mode 100644 index 0000000..5ae82c5 --- /dev/null +++ b/0.4.2/push.pl @@ -0,0 +1,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 + +############################# +##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
"; + &read_file("data/user/memos/$alias"); + my $memos = ; + 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); ; $curpos = tell(MSGFILE)) { + print $_ ; + } + $times++; + if ($times > 14) { # Nach 15 Sekunden + print "\n"; # Ping zum Browser senden + $times = 0; # Sekundenzahl auf 0 zurücksetzen + $online = "true" if (-e "data/online/users/$alias"); + if ($online eq "false") { + print "Aus technischen Gründen bitte auf Weiterchatten klicken."; + exit; + } + $online = "false" + } + sleep 1; + seek(MSGFILE, $curpos, 0); # Position wiederherstellen +} + -- cgit v1.2.3