This commit is contained in:
parent
cbac502cbf
commit
ffceffdc4b
5 changed files with 167 additions and 4 deletions
|
@ -888,7 +888,11 @@ class ToxSuite(unittest.TestCase, WrapperMixin):
|
|||
t:group_is_connected
|
||||
t:group_leave
|
||||
t:group_mod_set_role
|
||||
|
||||
t:group_get_topic_lock
|
||||
"""
|
||||
# group_mod_set_role
|
||||
|
||||
iGrp = self.otox_test_groups(self.bob)
|
||||
LOG.info(f"test_groups iGrp={iGrp}")
|
||||
if iGrp >= 0:
|
||||
|
|
|
@ -523,9 +523,12 @@ class WrapperMixin():
|
|||
assert otox.group_get_name_size(iGrp) == len(group_name)
|
||||
|
||||
sPk = otox.group_self_get_public_key(iGrp)
|
||||
i = otox.group_get_password_size(iGrp)
|
||||
assert otox.group_get_password_size(iGrp) >= 0
|
||||
sP = otox.group_get_password(iGrp)
|
||||
assert len(sP) == i, sP
|
||||
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()}"
|
||||
LOG.info(f"group pK={sPk} iGrp={iGrp} numg={otox.group_get_number_groups()}")
|
||||
|
|
|
@ -2975,6 +2975,22 @@ s
|
|||
raise ToxError(f"group_get_password err={error.value}")
|
||||
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:
|
||||
"""
|
||||
Set the callback for the `group_topic` event. Pass NULL to unset.
|
||||
|
@ -2996,6 +3012,27 @@ s
|
|||
except Exception as 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:
|
||||
"""
|
||||
Set the callback for the `group_privacy_state` event. Pass NULL to unset.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue