~ehmry/nim_tox

8b406af0ab2ef544d524ba7bc120e9925e74654e — Emery Hemingway 1 year, 11 months ago fb47a05
Make FileId an array[32,byte] alias
1 files changed, 4 insertions(+), 3 deletions(-)

M src/toxcore.nim
M src/toxcore.nim => src/toxcore.nim +4 -3
@@ 114,7 114,6 @@ toxArrayType(PublicKey, TOX_PUBLIC_KEY_SIZE)
toxArrayType(SecretKey, TOX_SECRET_KEY_SIZE)
toxArrayType(Address, TOX_ADDRESS_SIZE)
toxArrayType(Hash, TOX_HASH_LENGTH)
toxArrayType(FileId, TOX_FILE_ID_LENGTH)
toxArrayType(ConferenceId, TOX_CONFERENCE_ID_SIZE)
toxArrayType(ConferenceUid, TOX_CONFERENCE_UID_SIZE)



@@ 902,13 901,15 @@ type Tox_Err_File_Get = enum
    TOX_ERR_FILE_GET_FRIEND_NOT_FOUND,
    TOX_ERR_FILE_GET_NOT_FOUND

type FileId = array[TOX_FILE_ID_LENGTH, uint8]

proc id*(tox: Tox; friend: Friend; file: FileTransfer): FileId =
  proc file_get_file_id(
    core: Core; friend: Friend;
    file: FileTransfer; file_id: ptr uint8;
    error: ptr Tox_Err_File_Get): bool {.ctoxProc.}
  var err: Tox_Err_File_Get
  discard tox.core.file_get_file_id(friend, file, addr result.bytes[0], addr err)
  discard tox.core.file_get_file_id(friend, file, addr result[0], addr err)
  ctoxAssert(TOX_ERR_FILE_GET_OK, err)

type Tox_Err_File_Send = enum


@@ 926,7 927,7 @@ proc send*(tox: Tox; friend: Friend; kind: uint32; size: BiggestInt; id: FileId;
    filename_length: csize; error: ptr Tox_Err_File_Send): FileTransfer {.ctoxProc.}
  var err: Tox_Err_File_Send
  result = tox.core.file_send(
    friend, kind, size.uint64, unsafeAddr id.bytes[0], filename, filename.len, addr err)
    friend, kind, size.uint64, unsafeAddr id[0], filename, filename.len, addr err)
  ctoxAssert(TOX_ERR_FILE_SEND_OK, err)

type Tox_Err_File_Send_Chunk = enum