www.pudn.com > coolchat.zip > chatnewmsg.pl


sub chatnewmsg 
{ 
     my $LastMsg = shift; 
      
     my($i,@msglines,$linenum,$lowid,$message,$postid,$state,$towho,$tails,$nickname,$color); 
 
     print "Content-type: text/html\nPragma: no-cache\n\n"; 
     $lowid = lc($UserData{'User'}); 
     if(open(MSG,"$chatdatadir/$UserData{'Room'}$MSG")) 
     { 
     	  @msglines = ; 
     	  $linenum = @msglines; 
     	  my $baseline = int($msglines[0]); 
          print qq| 
           
           
           
          |; 
          if($LastMsg <= 0) 
          { 
          	$LastMsg = $linenum + $baseline - $FirstMsgLine; 
          	$LastMsg = 0 if($LastMsg < 0); 
          } 
          my $k = $LastMsg; 
     	  for($i=$LastMsg-$baseline+1;$i<$linenum;$i++) 
     	  { 
     	  	$k++; 
 
		($postid,$private,$towho,$tails) = split(/:/,$msglines[$i],4); 
     	  	next if($UserData{$postid} eq "f"); 
     	  	next if(($private eq "1") && ($postid ne $lowid) && ($towho ne $lowid)  && ($UserData{'Group'} ne 99)); 
 
     	  	($state,$message,$nickname,$color,$usraction) = split(/:/,$tails,6); 
     	        print "\n"; 
     	       } 
     } 
} 
1;