~ehmry/nim_tox

b1b869b5f9fa2d4ec827be94d9a401cfc2e12ea3 — Emery Hemingway 2 years ago 40f503b
close/isClosed
1 files changed, 6 insertions(+), 3 deletions(-)

M src/toxcore.nim
M src/toxcore.nim => src/toxcore.nim +6 -3
@@ 401,11 401,14 @@ proc newTox*(): Tox =
  result = Tox(core: new(nil, addr err))
  ctoxAssert(TOX_ERR_NEW_OK, err)

proc close*(tox: Tox) =
proc close*(tox: Tox) {.tags: [IOEffect].} =
  ## Shutdown and destroy a Tox instance.
  proc kill(core: Core) {.ctoxProc.}
  tox.core.kill()
  reset tox.core
  if not tox.core.pointer.isNil:
    tox.core.kill()
    reset tox.core

func isClosed*(tox: Tox): bool = tox.core.pointer.isNil

proc saveData*(tox: Tox): string =
  ## Retrieve save data of `tox` instance.