From 111e2611f0fe37fa1e69ba4a5ba080f2c5b57848 Mon Sep 17 00:00:00 2001 From: Stephen L Johnson Date: Tue, 8 Feb 2000 19:04:32 +0000 Subject: [PATCH] added time-to-live paramter to status() method --- src/lib/Spong/Status.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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; -- 2.30.2