Merge pull request #670 from onionhammer/master
Added timestamp to TIRCEvent
This commit is contained in:
commit
aeca551f5b
2 changed files with 8 additions and 5 deletions
|
|
@ -401,8 +401,9 @@ proc nextAsync(s: PAsyncHTTPServer) =
|
||||||
var value = ""
|
var value = ""
|
||||||
i = header.parseUntil(key, ':')
|
i = header.parseUntil(key, ':')
|
||||||
inc(i) # skip :
|
inc(i) # skip :
|
||||||
i += header.skipWhiteSpace(i)
|
if i < header.len:
|
||||||
i += header.parseUntil(value, {'\c', '\L'}, i)
|
i += header.skipWhiteSpace(i)
|
||||||
|
i += header.parseUntil(value, {'\c', '\L'}, i)
|
||||||
s.headers[key] = value
|
s.headers[key] = value
|
||||||
else:
|
else:
|
||||||
s.client.close()
|
s.client.close()
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,7 @@ type
|
||||||
params*: seq[string] ## Parameters of the IRC message
|
params*: seq[string] ## Parameters of the IRC message
|
||||||
origin*: string ## The channel/user that this msg originated from
|
origin*: string ## The channel/user that this msg originated from
|
||||||
raw*: string ## Raw IRC message
|
raw*: string ## Raw IRC message
|
||||||
|
timestamp*: TTime ## UNIX epoch time the message was received
|
||||||
|
|
||||||
proc send*(irc: PIRC, message: string, sendImmediately = false) =
|
proc send*(irc: PIRC, message: string, sendImmediately = false) =
|
||||||
## Sends ``message`` as a raw command. It adds ``\c\L`` for you.
|
## 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
|
result = i == s.len and s.len > 0
|
||||||
|
|
||||||
proc parseMessage(msg: string): TIRCEvent =
|
proc parseMessage(msg: string): TIRCEvent =
|
||||||
result.typ = EvMsg
|
result.typ = EvMsg
|
||||||
result.cmd = MUnknown
|
result.cmd = MUnknown
|
||||||
result.raw = msg
|
result.raw = msg
|
||||||
|
result.timestamp = times.getTime()
|
||||||
var i = 0
|
var i = 0
|
||||||
# Process the prefix
|
# Process the prefix
|
||||||
if msg[i] == ':':
|
if msg[i] == ':':
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue