refactor: remove history request
This commit is contained in:
parent
a20686324e
commit
c6b76f063d
|
@ -18,8 +18,6 @@ type
|
||||||
|
|
||||||
MailserverAvailableArgs* = ref object of Args
|
MailserverAvailableArgs* = ref object of Args
|
||||||
|
|
||||||
RequestMessagesTaskArg = ref object of QObjectTaskArg
|
|
||||||
|
|
||||||
RequestMoreMessagesTaskArg = ref object of QObjectTaskArg
|
RequestMoreMessagesTaskArg = ref object of QObjectTaskArg
|
||||||
chatId*: string
|
chatId*: string
|
||||||
|
|
||||||
|
@ -31,15 +29,6 @@ type
|
||||||
const SIGNAL_ACTIVE_MAILSERVER_CHANGED* = "activeMailserverChanged"
|
const SIGNAL_ACTIVE_MAILSERVER_CHANGED* = "activeMailserverChanged"
|
||||||
const SIGNAL_MAILSERVER_AVAILABLE* = "mailserverAvailable"
|
const SIGNAL_MAILSERVER_AVAILABLE* = "mailserverAvailable"
|
||||||
|
|
||||||
const requestMessagesTask: Task = proc(argEncoded: string) {.gcsafe, nimcall.} =
|
|
||||||
let arg = decode[RequestMessagesTaskArg](argEncoded)
|
|
||||||
try:
|
|
||||||
info "Requesting message history"
|
|
||||||
discard status_mailservers.requestAllHistoricMessages()
|
|
||||||
except Exception as e:
|
|
||||||
warn "Disconnecting active mailserver due to error", errDescription=e.msg
|
|
||||||
discard status_mailservers.disconnectActiveMailserver()
|
|
||||||
|
|
||||||
const requestMoreMessagesTask: Task = proc(argEncoded: string) {.gcsafe, nimcall.} =
|
const requestMoreMessagesTask: Task = proc(argEncoded: string) {.gcsafe, nimcall.} =
|
||||||
let arg = decode[RequestMoreMessagesTaskArg](argEncoded)
|
let arg = decode[RequestMoreMessagesTaskArg](argEncoded)
|
||||||
try:
|
try:
|
||||||
|
@ -92,13 +81,6 @@ QtObject:
|
||||||
self.initMailservers()
|
self.initMailservers()
|
||||||
self.fetchMailservers()
|
self.fetchMailservers()
|
||||||
|
|
||||||
proc requestMessages(self: Service) =
|
|
||||||
let arg = RequestMessagesTaskArg(
|
|
||||||
tptr: cast[ByteAddress](requestMessagesTask),
|
|
||||||
vptr: cast[ByteAddress](self.vptr)
|
|
||||||
)
|
|
||||||
self.threadpool.start(arg)
|
|
||||||
|
|
||||||
proc requestMoreMessages*(self: Service, chatId: string) =
|
proc requestMoreMessages*(self: Service, chatId: string) =
|
||||||
let arg = RequestMoreMessagesTaskArg(
|
let arg = RequestMoreMessagesTaskArg(
|
||||||
tptr: cast[ByteAddress](requestMoreMessagesTask),
|
tptr: cast[ByteAddress](requestMoreMessagesTask),
|
||||||
|
@ -126,7 +108,6 @@ QtObject:
|
||||||
|
|
||||||
self.events.on(SignalType.MailserverAvailable.event) do(e: Args):
|
self.events.on(SignalType.MailserverAvailable.event) do(e: Args):
|
||||||
info "mailserver available"
|
info "mailserver available"
|
||||||
self.requestMessages()
|
|
||||||
let data = MailserverAvailableArgs()
|
let data = MailserverAvailableArgs()
|
||||||
self.events.emit(SIGNAL_MAILSERVER_AVAILABLE, data)
|
self.events.emit(SIGNAL_MAILSERVER_AVAILABLE, data)
|
||||||
|
|
||||||
|
|
|
@ -20,11 +20,6 @@ proc saveMailserver*(id: string, name: string, enode: string, fleet: string):
|
||||||
proc getMailservers*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
proc getMailservers*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
result = core.callPrivateRPC("mailservers_getMailservers")
|
result = core.callPrivateRPC("mailservers_getMailservers")
|
||||||
|
|
||||||
proc requestAllHistoricMessages*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
|
||||||
let payload = %* []
|
|
||||||
result = core.callPrivateRPC("requestAllHistoricMessages".prefix, payload)
|
|
||||||
info "requestAllHistoricMessages", topics="mailserver-interaction", rpc_method="mailservers_requestAllHistoricMessages"
|
|
||||||
|
|
||||||
proc syncChatFromSyncedFrom*(chatId: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
proc syncChatFromSyncedFrom*(chatId: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
let payload = %*[chatId]
|
let payload = %*[chatId]
|
||||||
result = core.callPrivateRPC("syncChatFromSyncedFrom".prefix, payload)
|
result = core.callPrivateRPC("syncChatFromSyncedFrom".prefix, payload)
|
||||||
|
|
Loading…
Reference in New Issue