From: Stephen L Johnson Date: Tue, 8 Feb 2000 19:04:32 +0000 (+0000) Subject: added time-to-live paramter to status() method X-Git-Tag: spong-2_7-alpha5~95 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=111e2611f0fe37fa1e69ba4a5ba080f2c5b57848;p=spong.git added time-to-live paramter to status() method --- diff --git a/src/lib/Spong/Status.pm b/src/lib/Spong/Status.pm index f0822bd..1333090 100755 --- a/src/lib/Spong/Status.pm +++ b/src/lib/Spong/Status.pm @@ -9,7 +9,7 @@ # rather then a string. # # methods -# status( SERVERADDR, HOST, SERVICE, COLOR, SUMMARY, MESSAGE ) +# status( SERVERADDR, HOST, SERVICE, COLOR, SUMMARY, MESSAGE, [TTL] ) package Spong::Status; @@ -25,8 +25,9 @@ use IO::Socket; $VERSION = 0.01; sub status { - my( $addr, $host, $cat, $color, $summary, $message ) = @_; - my( $sock, $ok ); + my( $addr, $host, $cat, $color, $summary, $message, $ttl ) = @_; + my( $sock, $ok, $ts ); + if ( defined $ttl ) { $ts = time() . ":$ttl"; } else { $ts = time(); } $sock = IO::Socket::INET->new( PeerAddr => $addr, PeerPort => $main::SPONG_UPDATE_PORT, @@ -46,7 +47,7 @@ sub status { alarm(30); $sock->autoflush(1); - $sock->print("status $host $cat $color " . time(). " $summary\n"); + $sock->print("status $host $cat $color $ts $summary\n"); $sock->print("$message\n"); undef $sock;