# Display the lag to server in STATUS_USER1 (somewhere in the statusline). # Most of the time you will/should see nothing. If you see [Lag?] there # is a check in progress, if you see [Lag ] that is the number of # seconds you're lagged. You can control the minimum amount of lag shown # with /minlag , /minlag 0 shows lag time always after checks. # Default is 4. # Lag Indicator/PONG Flood Protection # (by Robey & Vassago, based on some ideas and scripting from BeeF.) # Ripped from Death (modified Phoenix) script # Extensively modified by Wizzu, 3-Jan-1996 # Changed a lot of times, last 14-Mar-1996 and then 20-Aug-1996 # Serial number.. So we don't overwrite anything else when installing if (![$SERIAL_NO]) {^assign SERIAL_NO 3344} alias minlag { if ([$0]!=[]) { if ([$0]>60) { xecho -level crap ### Maximum allowed minlag is 60 seconds. ^assign minlag 60 } { ^assign minlag $0 } xecho -level crap ### Minimum shown lag to server set to $minlag seconds. } { xecho -level crap ### Minimum shown lag to server is $minlag seconds. } } alias clearautoping { ^assign -serverlag ^assign -autoping_active if ([$old_status_user1]!=[]) {^set status_user1 $old_status_user1;^assign -old_status_user1} {^set -status_user1} } alias addlagcount { if ([$autoping_active]) { @ serverlag = [${serverlag + 1}] ^set status_user1 [Lag? $serverlag] timer 1 addlagcount } { ^assign -serverlag } } alias autoping { if ([$0]==[ON]) { ^assign autoping ON xecho -level crap ### Server lag checking turned on. ${K}autoping OFF to turn off. } { if ([$0]==[OFF]) { ^assign -autoping xecho -level crap ### Server lag checking turned off. ${K}autoping ON to turn on. } { if (([$autoping]!=[])&&([$S]!=[])) { if ([$autoping_active]==[]) { if ([$[4]status_user]!=[[Lag]) { ^assign old_status_user1 $status_user1 } { ^assign -old_status_user1 } } if (![$autoping_active]) { if ([$0]!=[]) { ^assign autoping_active $0 } { ^assign autoping_active 1 } if (([$autoping_active]==[1])||!([$minlag])) { ^set status_user1 [Lag?] } { timer $minlag eval if ([$autoping_active]) {^set status_user1 [Lag?]} } #timer 1 if ([$autoping_active]) {addlagcount} quote PING $time() $S } { if (([$0]!=[$autoping_active])&&([$autoping_active]!=[1])&&([$0])) { xecho -level crap ### $Z Lagged over a minute from server. clearautoping } } } } } } on ^raw_irc "%.% PONG *" { if (match($0 $myservers())) { if ([$autoping_active]!=[]) { ^assign lagtime ${time()-mid(1 999 $3)} if ([$lagtime]>=[$minlag]) { ^set status_user1 [Lag $lagtime] ^timer 15 clearautoping } { if ([$autoping_active]==[1]) { ^set status_user1 [Lag $lagtime] ^timer 3 clearautoping } { clearautoping } } ^assign autoping_active 0 } } } alias ap autoping alias cap clearautoping alias apon autopingon alias apoff autopingoff alias autopingon autoping ON alias autopingoff autoping OFF # Install; run every minute eval on #^timer ${SERIAL_NO+1} * autoping $$0 autoping ON # Default minimum lag to show: 4 seconds if ([$minlag]==[]) {minlag 4}