move signalcallback to status module
This commit is contained in:
parent
4e04d61057
commit
01182c8aee
|
@ -6,15 +6,6 @@ import status
|
||||||
import libstatus
|
import libstatus
|
||||||
import json
|
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() =
|
proc mainProc() =
|
||||||
# From QT docs:
|
# From QT docs:
|
||||||
# For any GUI application using Qt, there is precisely one QApplication object,
|
# For any GUI application using Qt, there is precisely one QApplication object,
|
||||||
|
@ -30,7 +21,7 @@ proc mainProc() =
|
||||||
var engine = newQQmlApplicationEngine()
|
var engine = newQQmlApplicationEngine()
|
||||||
defer: engine.delete()
|
defer: engine.delete()
|
||||||
|
|
||||||
status.setSignalHandler(signalHandler)
|
status.setSignalHandler()
|
||||||
|
|
||||||
status.setupNewAccount()
|
status.setupNewAccount()
|
||||||
discard status.addPeer("enode://2c8de3cbb27a3d30cbb5b3e003bc722b126f5aef82e2052aaef032ca94e0c7ad219e533ba88c70585ebd802de206693255335b100307645ab5170e88620d2a81@47.244.221.14:443")
|
discard status.addPeer("enode://2c8de3cbb27a3d30cbb5b3e003bc722b126f5aef82e2052aaef032ca94e0c7ad219e533ba88c70585ebd802de206693255335b100307645ab5170e88620d2a81@47.244.221.14:443")
|
||||||
|
|
|
@ -6,13 +6,22 @@ const datadir = "./data/"
|
||||||
const keystoredir = "./data/keystore/"
|
const keystoredir = "./data/keystore/"
|
||||||
const nobackupdir = "./noBackup/"
|
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) =
|
proc recreateDir(dirname: string) =
|
||||||
if existsDir(dirname):
|
if existsDir(dirname):
|
||||||
removeDir(dirname)
|
removeDir(dirname)
|
||||||
createDir(dirname)
|
createDir(dirname)
|
||||||
|
|
||||||
proc setSignalHandler*(something: SignalCallback) =
|
proc setSignalHandler*() =
|
||||||
libstatus.setSignalEventCallback(something)
|
libstatus.setSignalEventCallback(signalHandler)
|
||||||
|
|
||||||
proc queryAccounts*(): string =
|
proc queryAccounts*(): string =
|
||||||
var payload = %* {
|
var payload = %* {
|
||||||
|
|
Loading…
Reference in New Issue