feat: trigger a signal for chronicles logs (#31)

This commit is contained in:
RichΛrd 2021-09-15 15:45:17 -04:00 committed by GitHub
parent aa48e0a8f4
commit 99b85d2063
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 5 deletions

View File

@ -1,7 +1,7 @@
import json, json_serialization, strutils
import signals/[base, community, discovery_summary, envelope, expired, mailserver, messages, signal_type, stats, wallet, whisper_filter]
import signals/[base, chronicles_logs, community, discovery_summary, envelope, expired, mailserver, messages, signal_type, stats, wallet, whisper_filter]
export base, community, discovery_summary, envelope, expired, mailserver, messages, signal_type, stats, wallet, whisper_filter
export base, chronicles_logs, community, discovery_summary, envelope, expired, mailserver, messages, signal_type, stats, wallet, whisper_filter
proc decode*(jsonSignal: JsonNode): Signal =
let signalString = jsonSignal{"type"}.getStr
@ -23,4 +23,5 @@ proc decode*(jsonSignal: JsonNode): Signal =
of SignalType.MailserverRequestExpired: MailserverRequestExpiredSignal.fromEvent(jsonSignal)
of SignalType.CommunityFound: CommunitySignal.fromEvent(jsonSignal)
of SignalType.Stats: StatsSignal.fromEvent(jsonSignal)
of SignalType.ChroniclesLogs: ChroniclesLogsSignal.fromEvent(jsonSignal)
else: Signal()

View File

@ -0,0 +1,12 @@
import json
import base
import signal_type
type ChroniclesLogsSignal* = ref object of Signal
content*: string
proc fromEvent*(T: type ChroniclesLogsSignal, jsonSignal: JsonNode): ChroniclesLogsSignal =
result = ChroniclesLogsSignal()
result.signalType = SignalType.ChroniclesLogs
if jsonSignal["event"].kind != JNull:
result.content = jsonSignal["event"].getStr()

View File

@ -20,6 +20,7 @@ type SignalType* {.pure.} = enum
WhisperFilterAdded = "whisper.filter.added"
CommunityFound = "community.found"
Stats = "stats"
ChroniclesLogs = "chronicles-log"
Unknown
proc event*(self:SignalType):string =

@ -1 +1 @@
Subproject commit fc3f2d3755e035387ebcf20d87a45eb9dcefadbb
Subproject commit ea0368cc303b6ed59792a7c2556285adf310e455

@ -1 +1 @@
Subproject commit 1dccd4b2ef14c5e3ce30ad3f3a0962e0b98da6a3
Subproject commit fe8a82ca76150b60a950d5aa4e5baa382441ada4

@ -1 +1 @@
Subproject commit 474bdbf49cf1634ba504888ad1a1927a2703bd3f
Subproject commit f9a1121b8733eb75e624ab59f8d79e707f15f76f