Fixed IRC test.
This commit is contained in:
parent
336da8f44e
commit
10d13d5032
1 changed files with 7 additions and 5 deletions
|
|
@ -281,8 +281,8 @@ proc processLine(irc: PIRC, line: string): TIRCEvent =
|
||||||
result.typ = EvDisconnected
|
result.typ = EvDisconnected
|
||||||
return
|
return
|
||||||
|
|
||||||
#if result.cmd == MPing:
|
if result.cmd == MPing:
|
||||||
# irc.send("PONG " & result.params[0])
|
irc.send("PONG " & result.params[0])
|
||||||
if result.cmd == MPong:
|
if result.cmd == MPong:
|
||||||
irc.lag = epochTime() - parseFloat(result.params[result.params.high])
|
irc.lag = epochTime() - parseFloat(result.params[result.params.high])
|
||||||
irc.lastPong = epochTime()
|
irc.lastPong = epochTime()
|
||||||
|
|
@ -300,9 +300,9 @@ proc processLine(irc: PIRC, line: string): TIRCEvent =
|
||||||
|
|
||||||
proc processOther(irc: PIRC, ev: var TIRCEvent): bool =
|
proc processOther(irc: PIRC, ev: var TIRCEvent): bool =
|
||||||
result = false
|
result = false
|
||||||
#if epochTime() - irc.lastPing >= 20.0:
|
if epochTime() - irc.lastPing >= 20.0:
|
||||||
# irc.lastPing = epochTime()
|
irc.lastPing = epochTime()
|
||||||
# irc.send("PING :" & formatFloat(irc.lastPing), true)
|
irc.send("PING :" & formatFloat(irc.lastPing), true)
|
||||||
|
|
||||||
if epochTime() - irc.lastPong >= 120.0 and irc.lastPong != -1.0:
|
if epochTime() - irc.lastPong >= 120.0 and irc.lastPong != -1.0:
|
||||||
irc.close()
|
irc.close()
|
||||||
|
|
@ -463,6 +463,8 @@ when isMainModule:
|
||||||
var event: TIRCEvent
|
var event: TIRCEvent
|
||||||
if client.poll(event):
|
if client.poll(event):
|
||||||
case event.typ
|
case event.typ
|
||||||
|
of EvConnected:
|
||||||
|
nil
|
||||||
of EvDisconnected:
|
of EvDisconnected:
|
||||||
break
|
break
|
||||||
of EvMsg:
|
of EvMsg:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue