Skip to content

Commit

Permalink
feat: Add support for groups, conferences, messages.
Browse files Browse the repository at this point in the history
This should now have a complete tox API.
  • Loading branch information
iphydf committed Feb 23, 2024
1 parent 632415c commit d7f837f
Show file tree
Hide file tree
Showing 16 changed files with 1,145 additions and 215 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
# - version: "3.10"
#
# steps:
# - uses: actions/checkout@v2
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v2
# with:
# python-version: ${{ matrix.version }}
Expand All @@ -41,7 +41,7 @@ jobs:
# runs-on: ubuntu-latest
#
# steps:
# - uses: actions/checkout@v2
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v2
# with:
# python-version: "3.7"
Expand All @@ -62,6 +62,6 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Build
run: docker build -t pytox .
10 changes: 8 additions & 2 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//third_party/python:build_defs.bzl", "pyx_library")
load("//third_party/python:build_defs.bzl", "mypy_test", "pyx_library")
load("//tools/project:build_defs.bzl", "project")

project(license = "gpl3-https")
Expand All @@ -10,12 +10,12 @@ pyx_library(
"pytox/**/*.pxd",
"pytox/**/*.pyx",
"pytox/**/*.py",
"pytox/**/*.pyi",
],
# TODO(iphydf): Remove.
exclude = ["**/*.gen.pyx"],
),
cdeps = ["//c-toxcore"],
copts = ["-Wno-missing-variable-declarations"],
cython_directives = {
"embedsignature": "True",
"embedsignature.format": "python",
Expand All @@ -24,3 +24,9 @@ pyx_library(
tags = ["no-cross"],
visibility = ["//visibility:public"],
)

mypy_test(
name = "mypy_test",
srcs = glob(["**/*.py"]),
path = ["py_toxcore_c"],
)
4 changes: 3 additions & 1 deletion pytox/toxav/toxav.pxd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# cython: language_level=3, linetrace=True
from libcpp cimport bool
from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, int16_t, int32_t
from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, int16_t, int32_t, int64_t
from libc.stdlib cimport malloc, free

cimport pytox.toxcore.tox as tox
Expand Down Expand Up @@ -78,11 +78,13 @@ cdef extern from "tox/toxav.h":
cdef bool toxav_answer(Toxav* self, uint32_t friend_number, uint32_t audio_bit_rate, uint32_t video_bit_rate, Toxav_Err_Answer* error)
cdef void toxav_callback_call_state(Toxav* self, toxav_call_state_cb* callback, void* user_data)
cdef bool toxav_call_control(Toxav* self, uint32_t friend_number, Toxav_Call_Control control, Toxav_Err_Call_Control* error)
cdef bool toxav_audio_set_bit_rate(Toxav* self, uint32_t friend_number, uint32_t bit_rate, Toxav_Err_Bit_Rate_Set* error)
cdef uint32_t toxav_audio_iteration_interval(const Toxav* self)
cdef void toxav_audio_iterate(Toxav* self)
cdef bool toxav_audio_send_frame(Toxav* self, uint32_t friend_number, const int16_t* pcm, size_t sample_count, uint8_t channels, uint32_t sampling_rate, Toxav_Err_Send_Frame* error)
cdef void toxav_callback_audio_bit_rate(Toxav* self, toxav_audio_bit_rate_cb* callback, void* user_data)
cdef void toxav_callback_audio_receive_frame(Toxav* self, toxav_audio_receive_frame_cb* callback, void* user_data)
cdef bool toxav_video_set_bit_rate(Toxav* self, uint32_t friend_number, uint32_t bit_rate, Toxav_Err_Bit_Rate_Set* error)
cdef uint32_t toxav_video_iteration_interval(const Toxav* self)
cdef void toxav_video_iterate(Toxav* self)
cdef bool toxav_video_send_frame(Toxav* self, uint32_t friend_number, uint16_t width, uint16_t height, const uint8_t* y, const uint8_t* u, const uint8_t* v, Toxav_Err_Send_Frame* error)
Expand Down
8 changes: 0 additions & 8 deletions pytox/toxav/toxav.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@ from typing import TypeVar
import enum
import pytox.common
T = TypeVar("T")
class Tox_Conference_Number: ...
class Tox_Conference_Peer_Number: ...
class Tox_File_Number: ...
class Tox_Friend_Message_Id: ...
class Tox_Friend_Number: ...
class Tox_Group_Message_Id: ...
class Tox_Group_Number: ...
class Tox_Group_Peer_Number: ...
class ApiException(pytox.common.ApiException): ...
class Toxav_Call_Control(enum.Enum): ...
class Toxav_Err_Answer(enum.Enum): ...
Expand Down
2 changes: 1 addition & 1 deletion pytox/toxav/toxav.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ cdef class Toxav_Ptr:
raise common.UseAfterFreeException()
return self._ptr

def __dealloc__(self) -> None:
def __del__(self) -> None:
self.__exit__(None, None, None)

def __enter__(self: T) -> T:
Expand Down
171 changes: 101 additions & 70 deletions pytox/toxcore/tox.pxd

Large diffs are not rendered by default.

220 changes: 153 additions & 67 deletions pytox/toxcore/tox.pyi

Large diffs are not rendered by default.

Loading

0 comments on commit d7f837f

Please sign in to comment.