From 10d13d5032bd1109207a9feb9f487ad5d7e102de Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Sat, 1 Dec 2012 16:38:33 +0000 Subject: [PATCH] Fixed IRC test. --- lib/pure/irc.nim | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/pure/irc.nim b/lib/pure/irc.nim index 11808ca33c..8916681f7e 100644 --- a/lib/pure/irc.nim +++ b/lib/pure/irc.nim @@ -281,8 +281,8 @@ proc processLine(irc: PIRC, line: string): TIRCEvent = result.typ = EvDisconnected return - #if result.cmd == MPing: - # irc.send("PONG " & result.params[0]) + if result.cmd == MPing: + irc.send("PONG " & result.params[0]) if result.cmd == MPong: irc.lag = epochTime() - parseFloat(result.params[result.params.high]) irc.lastPong = epochTime() @@ -300,9 +300,9 @@ proc processLine(irc: PIRC, line: string): TIRCEvent = proc processOther(irc: PIRC, ev: var TIRCEvent): bool = result = false - #if epochTime() - irc.lastPing >= 20.0: - # irc.lastPing = epochTime() - # irc.send("PING :" & formatFloat(irc.lastPing), true) + if epochTime() - irc.lastPing >= 20.0: + irc.lastPing = epochTime() + irc.send("PING :" & formatFloat(irc.lastPing), true) if epochTime() - irc.lastPong >= 120.0 and irc.lastPong != -1.0: irc.close() @@ -463,6 +463,8 @@ when isMainModule: var event: TIRCEvent if client.poll(event): case event.typ + of EvConnected: + nil of EvDisconnected: break of EvMsg: