updates
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled

This commit is contained in:
emdee@spm.plastiras.org 2024-02-25 03:11:22 +00:00
parent cbac502cbf
commit ffceffdc4b
5 changed files with 167 additions and 4 deletions

View File

@ -84,8 +84,9 @@ Others include:
* <https://github.com/TokTok/py-toxcore-c> Cython bindings. * <https://github.com/TokTok/py-toxcore-c> Cython bindings.
Incomplete and not really actively supported. Maybe it will get Incomplete and not really actively supported. Maybe it will get
worked on in the future, but TokTok seems to be working on worked on in the future, but TokTok seems to be working on
java, go, etc. bindings instead. Based on a homebrew generator written java, go, etc. bindings instead. The code is based on a homebrew generator written
in undocumented, uncommented code in a language almost nobody knows, or has. in undocumented, uncommented code in a language almost nobody knows, or has
by an anonymous team that is not open to suggestions.
No support for NGC groups; no significant tests. No support for NGC groups; no significant tests.
* <https://github.com/oxij/PyTox> * <https://github.com/oxij/PyTox>
@ -93,7 +94,9 @@ Others include:
by Wei-Ning Huang <aitjcize@gmail.com>. by Wei-Ning Huang <aitjcize@gmail.com>.
Hardcore C wrapping which is not easy to keep up to date. Hardcore C wrapping which is not easy to keep up to date.
No support for NGC but good tests. Abandonned. No support for NGC but good tests. Abandonned.
This was the basis for the TokTok/py-toxcore-c code until recently. This was the basis for the TokTok/py-toxcore-c code until recently,
and a version is on the 0.2.0 branch of
[TokTok/py-toxcore-c](https://github.com/TokTok/py-toxcore-c)
To our point of view, the ability of CTYPEs to follow code in the To our point of view, the ability of CTYPEs to follow code in the
debugger is a crucial advantage. debugger is a crucial advantage.
@ -107,7 +110,7 @@ does hostname lookups before calling Tox (like toxygen does). Otherwise,
do not use it for anonymous communication unless you have a firewall in place. do not use it for anonymous communication unless you have a firewall in place.
The Tox project does not follow semantic versioning of its main structures The Tox project does not follow semantic versioning of its main structures
so the project may break the underlying ctypes wrapper at any time; or setters so the project may break the underlying ctypes wrapper at any time;
it's not possible to use Tox version numbers to tell what the API will be. it's not possible to use Tox version numbers to tell what the API will be.
In which case you'll have to go into the tox.py file in In which case you'll have to go into the tox.py file in
https://git.plastiras.org/emdee/toxygen_wrapper to fix it yourself. https://git.plastiras.org/emdee/toxygen_wrapper to fix it yourself.

116
docs/c-toxcore.missing Normal file
View File

@ -0,0 +1,116 @@
tox_callback_conference_connected
tox_callback_conference_invite
tox_callback_conference_message
tox_callback_conference_peer_list_changed
tox_callback_conference_peer_name
tox_callback_conference_title
tox_callback_group_custom_private_packet
tox_conference_by_id
tox_conference_by_uid
tox_conference_delete
tox_conference_get_chatlist
tox_conference_get_chatlist_size
tox_conference_get_id
tox_conference_get_title
tox_conference_get_title_size
tox_conference_get_type
tox_conference_get_uid
tox_conference_id_size
tox_conference_invite
tox_conference_join
tox_conference_new
tox_conference_offline_peer_count
tox_conference_offline_peer_get_last_active
tox_conference_offline_peer_get_name
tox_conference_offline_peer_get_name_size
tox_conference_offline_peer_get_public_key
tox_conference_peer_count
tox_conference_peer_get_name
tox_conference_peer_get_name_size
tox_conference_peer_get_public_key
tox_conference_peer_number_is_ours
tox_conference_send_message
tox_conference_set_max_offline
tox_conference_set_title
tox_conference_uid_size
tox_file_seek
tox_get_salt
tox_group_send_custom_private_packet
tox_is_data_encrypted
tox_options_get_dht_announcements_enabled
tox_options_get_end_port
tox_options_get_experimental_groups_persistence
tox_options_get_experimental_thread_safety
tox_options_get_hole_punching_enabled
tox_options_get_ipv6_enabled
tox_options_get_local_discovery_enabled
tox_options_get_log_callback
tox_options_get_log_user_data
tox_options_get_operating_system
tox_options_get_proxy_host
tox_options_get_proxy_port
tox_options_get_proxy_type
tox_options_get_savedata_data
tox_options_get_savedata_length
tox_options_get_savedata_type
tox_options_get_start_port
tox_options_get_tcp_port
tox_options_get_udp_enabled
tox_options_set_dht_announcements_enabled
tox_options_set_end_port
tox_options_set_experimental_groups_persistence
tox_options_set_experimental_thread_safety
tox_options_set_hole_punching_enabled
tox_options_set_ipv6_enabled
tox_options_set_local_discovery_enabled
tox_options_set_log_callback
tox_options_set_log_user_data
tox_options_set_operating_system
tox_options_set_proxy_host
tox_options_set_proxy_port
tox_options_set_proxy_type
tox_options_set_savedata_data
tox_options_set_savedata_length
tox_options_set_savedata_type
tox_options_set_start_port
tox_options_set_tcp_port
tox_options_set_udp_enabled
tox_pass_decrypt
tox_pass_encrypt
tox_pass_encryption_extra_length
tox_pass_key_decrypt
tox_pass_key_derive
tox_pass_key_derive_with_salt
tox_pass_key_encrypt
tox_pass_key_free
tox_pass_key_length
tox_pass_salt_length
tox_version_is_compatible
toxav_add_av_groupchat
toxav_answer
toxav_audio_iterate
toxav_audio_iteration_interval
toxav_audio_send_frame
toxav_audio_set_bit_rate
toxav_call
toxav_call_control
toxav_callback_audio_bit_rate
toxav_callback_audio_receive_frame
toxav_callback_call
toxav_callback_call_state
toxav_callback_video_bit_rate
toxav_callback_video_receive_frame
toxav_get_tox
toxav_group_send_audio
toxav_groupchat_av_enabled
toxav_groupchat_disable_av
toxav_groupchat_enable_av
toxav_iterate
toxav_iteration_interval
toxav_join_av_groupchat
toxav_kill
toxav_new
toxav_video_iterate
toxav_video_iteration_interval
toxav_video_send_frame
toxav_video_set_bit_rate

View File

@ -888,7 +888,11 @@ class ToxSuite(unittest.TestCase, WrapperMixin):
t:group_is_connected t:group_is_connected
t:group_leave t:group_leave
t:group_mod_set_role t:group_mod_set_role
t:group_get_topic_lock
""" """
# group_mod_set_role
iGrp = self.otox_test_groups(self.bob) iGrp = self.otox_test_groups(self.bob)
LOG.info(f"test_groups iGrp={iGrp}") LOG.info(f"test_groups iGrp={iGrp}")
if iGrp >= 0: if iGrp >= 0:

View File

@ -523,9 +523,12 @@ class WrapperMixin():
assert otox.group_get_name_size(iGrp) == len(group_name) assert otox.group_get_name_size(iGrp) == len(group_name)
sPk = otox.group_self_get_public_key(iGrp) sPk = otox.group_self_get_public_key(iGrp)
i = otox.group_get_password_size(iGrp)
assert otox.group_get_password_size(iGrp) >= 0 assert otox.group_get_password_size(iGrp) >= 0
sP = otox.group_get_password(iGrp) sP = otox.group_get_password(iGrp)
assert len(sP) == i, sP
assert otox.group_get_privacy_state(iGrp) == privacy_state assert otox.group_get_privacy_state(iGrp) == privacy_state
i = otox.tox_group_get_topic_lock(iGrp)
assert otox.group_get_number_groups() > 0, "numg={otox.group_get_number_groups()}" assert otox.group_get_number_groups() > 0, "numg={otox.group_get_number_groups()}"
LOG.info(f"group pK={sPk} iGrp={iGrp} numg={otox.group_get_number_groups()}") LOG.info(f"group pK={sPk} iGrp={iGrp} numg={otox.group_get_number_groups()}")

View File

@ -2975,6 +2975,22 @@ s
raise ToxError(f"group_get_password err={error.value}") raise ToxError(f"group_get_password err={error.value}")
return str(bytearray(password[:size]), 'utf-8', errors='ignore') return str(bytearray(password[:size]), 'utf-8', errors='ignore')
def tox_group_get_topic_lock(self, group_number: int) -> int:
"""
"""
if group_number < 0:
raise ToxError(f"tox_group_ group_number < 0 {group_number}")
error = c_int()
LOG_DEBUG(f"tox.tox_group_get_topic_lock")
result = Tox.libtoxcore.tox_group_get_topic_lock(self._tox_pointer,
c_uint(group_number),
byref(error))
if error.value:
LOG_ERROR(f"tox_group_get_topic_lock err={error.value}")
raise ToxError(f"tox_group_get_topic_lock err={error.value}")
return int(result)
def callback_group_topic(self, callback: Optional[Callable], user_data: Optional[bytes] = None) -> None: def callback_group_topic(self, callback: Optional[Callable], user_data: Optional[bytes] = None) -> None:
""" """
Set the callback for the `group_topic` event. Pass NULL to unset. Set the callback for the `group_topic` event. Pass NULL to unset.
@ -2996,6 +3012,27 @@ s
except Exception as e: except Exception as e:
LOG_WARN(f" Exception {e}") LOG_WARN(f" Exception {e}")
def callback_group_topic_lock(self, callback: Optional[Callable], user_data: Optional[bytes] = None) -> None:
"""
Set the callback for the `group_topic` event. Pass NULL to unset.
This event is triggered when a peer changes the group topic.
"""
if user_data is not None:
assert isinstance(user_data, Array), type(user_data)
LOG_DEBUG(f"tox.callback_group_topic_lock")
if callback is None:
Tox.libtoxcore.tox_callback_group_topic_lock(self._tox_pointer, POINTER(None)())
self.group_topic_cb = None
return
c_callback = CFUNCTYPE(None, c_void_p, c_uint32, c_uint32, c_void_p)
self.group_topic_lock_cb = c_callback(callback)
try:
LOG_DEBUG(f"tox.callback_group_topic_lock")
Tox.libtoxcore.tox_callback_group_topic_lock(self._tox_pointer, self.group_topic_lock_cb)
except Exception as e:
LOG_WARN(f" Exception {e}")
def callback_group_privacy_state(self, callback: Optional[Callable], user_data: Optional[bytes] = None) -> None: def callback_group_privacy_state(self, callback: Optional[Callable], user_data: Optional[bytes] = None) -> None:
""" """
Set the callback for the `group_privacy_state` event. Pass NULL to unset. Set the callback for the `group_privacy_state` event. Pass NULL to unset.