diff options
author | Dominik Picheta <dominikpicheta@googlemail.com> | 2013-11-17 14:47:05 -0800 |
---|---|---|
committer | Dominik Picheta <dominikpicheta@googlemail.com> | 2013-11-17 14:47:05 -0800 |
commit | aeca551f5b9bc5ee3a33690fd445ded97675f0d5 (patch) | |
tree | 7bff32e5499da255bd90214a114d380026d5b764 | |
parent | a068aaed3c5ddaf05a104f3f2d0f512bab2861c6 (diff) | |
parent | 1a6742e651f65ed2d2b2584b7c6c634a485b9cac (diff) | |
download | Nim-aeca551f5b9bc5ee3a33690fd445ded97675f0d5.tar.gz |
Merge pull request #670 from onionhammer/master
Added timestamp to TIRCEvent
-rw-r--r-- | lib/pure/httpserver.nim | 5 | ||||
-rw-r--r-- | lib/pure/irc.nim | 8 |
2 files changed, 8 insertions, 5 deletions
diff --git a/lib/pure/httpserver.nim b/lib/pure/httpserver.nim index 043e713a6..901fdc779 100644 --- a/lib/pure/httpserver.nim +++ b/lib/pure/httpserver.nim @@ -401,8 +401,9 @@ proc nextAsync(s: PAsyncHTTPServer) = var value = "" i = header.parseUntil(key, ':') inc(i) # skip : - i += header.skipWhiteSpace(i) - i += header.parseUntil(value, {'\c', '\L'}, i) + if i < header.len: + i += header.skipWhiteSpace(i) + i += header.parseUntil(value, {'\c', '\L'}, i) s.headers[key] = value else: s.client.close() diff --git a/lib/pure/irc.nim b/lib/pure/irc.nim index 74ad7e26a..ee85d9c69 100644 --- a/lib/pure/irc.nim +++ b/lib/pure/irc.nim @@ -98,6 +98,7 @@ type params*: seq[string] ## Parameters of the IRC message origin*: string ## The channel/user that this msg originated from raw*: string ## Raw IRC message + timestamp*: TTime ## UNIX epoch time the message was received proc send*(irc: PIRC, message: string, sendImmediately = false) = ## Sends ``message`` as a raw command. It adds ``\c\L`` for you. @@ -160,9 +161,10 @@ proc isNumber(s: string): bool = result = i == s.len and s.len > 0 proc parseMessage(msg: string): TIRCEvent = - result.typ = EvMsg - result.cmd = MUnknown - result.raw = msg + result.typ = EvMsg + result.cmd = MUnknown + result.raw = msg + result.timestamp = times.getTime() var i = 0 # Process the prefix if msg[i] == ':': |