move signalcallback to status module

This commit is contained in:
Iuri Matias 2020-05-11 16:58:59 -04:00
parent 4e04d61057
commit 01182c8aee
2 changed files with 12 additions and 12 deletions

View File

@ -6,15 +6,6 @@ import status
import libstatus
import json
var signalHandler: SignalCallback = proc(p0: cstring): void =
setupForeignThreadGc()
var jsonSignal = ($p0).parseJson
if $jsonSignal["type"].getStr == "messages.new":
echo $p0
tearDownForeignThreadGc()
proc mainProc() =
# From QT docs:
# For any GUI application using Qt, there is precisely one QApplication object,
@ -30,7 +21,7 @@ proc mainProc() =
var engine = newQQmlApplicationEngine()
defer: engine.delete()
status.setSignalHandler(signalHandler)
status.setSignalHandler()
status.setupNewAccount()
discard status.addPeer("enode://2c8de3cbb27a3d30cbb5b3e003bc722b126f5aef82e2052aaef032ca94e0c7ad219e533ba88c70585ebd802de206693255335b100307645ab5170e88620d2a81@47.244.221.14:443")

View File

@ -6,13 +6,22 @@ const datadir = "./data/"
const keystoredir = "./data/keystore/"
const nobackupdir = "./noBackup/"
var signalHandler: SignalCallback = proc(p0: cstring): void =
setupForeignThreadGc()
var jsonSignal = ($p0).parseJson
if $jsonSignal["type"].getStr == "messages.new":
echo $p0
tearDownForeignThreadGc()
proc recreateDir(dirname: string) =
if existsDir(dirname):
removeDir(dirname)
createDir(dirname)
proc setSignalHandler*(something: SignalCallback) =
libstatus.setSignalEventCallback(something)
proc setSignalHandler*() =
libstatus.setSignalEventCallback(signalHandler)
proc queryAccounts*(): string =
var payload = %* {