This commit is contained in:
emdee 2022-11-05 01:10:35 +00:00
parent 9144fa536f
commit 0b4eda648e
3 changed files with 53 additions and 38 deletions

View file

@ -1979,7 +1979,7 @@ class Tox:
raise ToxError("group_disconnect {error.value}")
return result
def group_leave(self, group_number, message=''):
def group_leave(self, group_number, message=None):
"""Leaves a group.
This function sends a parting packet containing a custom
@ -2000,7 +2000,7 @@ class Tox:
f = Tox.libtoxcore.tox_group_leave
f.restype = c_bool
result = f(self._tox_pointer, group_number, message,
len(message) if message is not None else 0, byref(error))
len(message) if message else 0, byref(error))
if error.value:
LOG_ERROR(f"group_leave {error.value}")
raise ToxError("group_leave {error.value}")
@ -2414,7 +2414,7 @@ class Tox:
if error.value == 1:
LOG_ERROR(f"tox_group_get_chat_id ERROR GROUP_STATE_QUERIES_GROUP_NOT_FOUND group_number={group_number}")
else:
LOG_ERROR(f"tox_group_get_chat_id group_number={group_number} {error.value}")
LOG_ERROR(f"tox_group_get_chat_id group_number={group_number} error={error.value}")
raise ToxError(f"tox_group_get_chat_id {error.value}")
#
# QObject::setParent: Cannot set parent, new parent is in a different thread
@ -2787,7 +2787,7 @@ class Tox:
raise ToxError(f"group_invite_friend {error.value} {s}")
return result
# API change
# API change - this no longer exists
# @staticmethod
# def group_self_peer_info_new():
# error = c_int()
@ -2796,7 +2796,8 @@ class Tox:
# result = f(byref(error))
# return result
def group_invite_accept(self, invite_data, friend_number, nick, password=None):
# status should be dropped
def group_invite_accept(self, invite_data, friend_number, nick, status='', password=None):
"""
Accept an invite to a group chat that the client previously received from a friend. The invite
is only valid while the inviter is present in the group.
@ -2814,10 +2815,10 @@ class Tox:
except:
nick = b''
try:
if password is None: password = b''
password = bytes(password, 'utf-8')
if password is not None:
password = bytes(password, 'utf-8')
except:
password = b''
password = None
invite_data = invite_data or b''
if False: # API change
@ -2836,7 +2837,7 @@ class Tox:
byref(error))
except Exception as e:
LOG_ERROR(f"group_invite_accept ERROR {e}")
raise
raise ToxError(f"group_invite_accept ERROR {e}")
if error.value:
# The invite data is not in the expected format.
LOG_ERROR(f"group_invite_accept {TOX_ERR_GROUP_INVITE_ACCEPT[error.value]}")

View file

@ -262,7 +262,7 @@ class ToxAV:
24000, or 48000.
"""
toxav_err_send_frame = c_int()
LOG_DEBUG(f"toxav_audio_send_frame")
LOG_TRACE(f"toxav_audio_send_frame")
assert sampling_rate in [8000, 12000, 16000, 24000, 48000]
result = self.libtoxav.toxav_audio_send_frame(self._toxav_pointer,
c_uint32(friend_number),
@ -305,7 +305,7 @@ class ToxAV:
:param v: V (Chroma) plane data.
"""
toxav_err_send_frame = c_int()
LOG_DEBUG(f"toxav_video_send_frame")
LOG_TRACE(f"toxav_video_send_frame")
result = self.libtoxav.toxav_video_send_frame(self._toxav_pointer, c_uint32(friend_number), c_uint16(width),
c_uint16(height), c_char_p(y), c_char_p(u), c_char_p(v),
byref(toxav_err_send_frame))