diff --git a/status/signals.nim b/status/signals.nim index c91ac5b..346843c 100644 --- a/status/signals.nim +++ b/status/signals.nim @@ -28,6 +28,7 @@ proc decode*(jsonSignal: JsonNode): Signal = of SignalType.HistoryRequestCompleted: HistoryRequestCompletedSignal.fromEvent(jsonSignal) of SignalType.HistoryRequestStarted: HistoryRequestStartedSignal.fromEvent(jsonSignal) of SignalType.HistoryRequestFailed: HistoryRequestFailedSignal.fromEvent(jsonSignal) + of SignalType.HistoryRequestBatchProcessed: HistoryRequestBatchProcessedSignal.fromEvent(jsonSignal) of SignalType.KeycardConnected: KeycardConnectedSignal.fromEvent(jsonSignal) else: Signal() diff --git a/status/signals/mailserver.nim b/status/signals/mailserver.nim index d51bc9e..372e25b 100644 --- a/status/signals/mailserver.nim +++ b/status/signals/mailserver.nim @@ -14,12 +14,22 @@ type MailserverRequestExpiredSignal* = ref object of Signal # TODO type HistoryRequestStartedSignal* = ref object of Signal + requestId*: string + numBatches*: int + +type HistoryRequestBatchProcessedSignal* = ref object of Signal + requestId*: string + batchIndex*: int + numBatches*: int + type HistoryRequestCompletedSignal* = ref object of Signal + requestId*: string + type HistoryRequestFailedSignal* = ref object of Signal + requestId*: string errorMessage*: string error*: bool - proc fromEvent*(T: type MailserverRequestCompletedSignal, jsonSignal: JsonNode): MailserverRequestCompletedSignal = result = MailserverRequestCompletedSignal() result.signalType = SignalType.MailserverRequestCompleted @@ -38,14 +48,25 @@ proc fromEvent*(T: type MailserverRequestExpiredSignal, jsonSignal: JsonNode): M proc fromEvent*(T: type HistoryRequestStartedSignal, jsonSignal: JsonNode): HistoryRequestStartedSignal = result = HistoryRequestStartedSignal() result.signalType = SignalType.HistoryRequestStarted + result.requestId = jsonSignal["event"]{"requestId"}.getStr() + result.numBatches = jsonSIgnal["event"]{"numBatches"}.getInt() + +proc fromEvent*(T: type HistoryRequestBatchProcessedSignal, jsonSignal: JsonNode): HistoryRequestBatchProcessedSignal = + result = HistoryRequestBatchProcessedSignal() + result.signalType = SignalType.HistoryRequestBatchProcessed + result.requestId = jsonSignal["event"]{"requestId"}.getStr() + result.batchIndex = jsonSIgnal["event"]{"batchIndex"}.getInt() + result.numBatches = jsonSIgnal["event"]{"numBatches"}.getInt() proc fromEvent*(T: type HistoryRequestCompletedSignal, jsonSignal: JsonNode): HistoryRequestCompletedSignal = result = HistoryRequestCompletedSignal() result.signalType = SignalType.HistoryRequestCompleted + result.requestId = jsonSignal["event"]{"requestId"}.getStr() proc fromEvent*(T: type HistoryRequestFailedSignal, jsonSignal: JsonNode): HistoryRequestFailedSignal = result = HistoryRequestFailedSignal() result.signalType = SignalType.HistoryRequestStarted + result.requestId = jsonSignal["event"]{"requestId"}.getStr() if jsonSignal["event"].kind != JNull: result.errorMessage = jsonSignal["event"]{"errorMessage"}.getStr() result.error = result.errorMessage != "" diff --git a/status/signals/signal_type.nim b/status/signals/signal_type.nim index c20bea5..ba550f5 100644 --- a/status/signals/signal_type.nim +++ b/status/signals/signal_type.nim @@ -25,6 +25,7 @@ type SignalType* {.pure.} = enum HistoryRequestStarted = "history.request.started" HistoryRequestCompleted = "history.request.completed" HistoryRequestFailed = "history.request.failed" + HistoryRequestBatchProcessed = "history.request.batch.processed" KeycardConnected = "keycard.connected" Unknown diff --git a/status/statusgo_backend/mailservers.nim b/status/statusgo_backend/mailservers.nim index 7e0bb95..579db59 100644 --- a/status/statusgo_backend/mailservers.nim +++ b/status/statusgo_backend/mailservers.nim @@ -25,7 +25,7 @@ proc delete*(peer: string) = proc requestAllHistoricMessages*(): string = result = callPrivateRPC("requestAllHistoricMessages".prefix, %*[]) - info "requestAllHistoricMessages", topics="mailserver-interaction", rpc_method="mailservers_requestAllHistoricMessages", result + info "requestAllHistoricMessages", topics="mailserver-interaction", rpc_method="mailservers_requestAllHistoricMessages" proc requestStoreMessages*(topics: seq[string], symKeyID: string, peer: string, numberOfMessages: int, fromTimestamp: int64 = 0, toTimestamp: int64 = 0, force: bool = false) = var toValue = times.toUnix(times.getTime()) diff --git a/vendor/status-go b/vendor/status-go index d35e0a3..7440c18 160000 --- a/vendor/status-go +++ b/vendor/status-go @@ -1 +1 @@ -Subproject commit d35e0a339ddfdee0e52e2f6d5859302c7ec54dc6 +Subproject commit 7440c184c0e8fbb3ad88803ae66c87a9c32bf962