bans - wrapper

This commit is contained in:
ingvar1995 2018-08-05 16:33:51 +03:00
parent 33052f8a98
commit 37541db07d
3 changed files with 23 additions and 11 deletions

View File

@ -11,16 +11,13 @@ class GroupChat(contact.Contact, ToxSave):
def __init__(self, tox, profile_manager, message_getter, number, name, status_message, widget, tox_id, is_private):
super().__init__(profile_manager, message_getter, number, name, status_message, widget, tox_id)
ToxSave.__init__(self, tox)
self._is_private = is_private
self._password = None
self._password = str()
self._peers_limit = 512
self._peers = []
self._add_self_to_gc()
def set_topic(self, topic):
self._tox.group_set_topic(self._number, topic.encode('utf-8'))
super().set_status_message(topic)
def remove_invalid_unsent_files(self):
pass

View File

@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
from ctypes import c_char_p, Structure, c_bool, byref, c_int, c_size_t, POINTER, c_uint16, c_void_p, c_uint64
from ctypes import create_string_buffer, ArgumentError, CFUNCTYPE, c_uint32, sizeof, c_uint8
from ctypes import *
from wrapper.toxcore_enums_and_consts import *
from wrapper.toxav import ToxAV
from wrapper.libtox import LibToxCore
@ -109,7 +108,6 @@ class Tox:
self.group_invite_cb = None
self.group_custom_packet_cb = None
self.group_private_message_cb = None
self.group_private_message_cb = None
self.group_message_cb = None
self.group_password_cb = None
self.group_peer_limit_cb = None
@ -2393,7 +2391,7 @@ class Tox:
result = Tox.libtoxcore.tox_group_mod_set_role(self._tox_pointer, group_number, peer_id, role, byref(error))
return result
def group_mod_remove_peer(self, group_number, peer_id, set_ban):
def group_mod_remove_peer(self, group_number, peer_id):
"""
Kick/ban a peer.
@ -2403,14 +2401,20 @@ class Tox:
:param group_number: The group number of the group the ban is intended for.
:param peer_id: The ID of the peer who will be kicked and/or added to the ban list.
:param set_ban: Set to true if a ban shall be set on the peer's IP address.
:return True on success.
"""
error = c_int()
result = Tox.libtoxcore.tox_group_mod_remove_peer(self._tox_pointer, group_number, peer_id,
set_ban, byref(error))
byref(error))
return result
def group_mod_ban_peer(self, group_number, peer_id, ban_type):
error = c_int()
result = Tox.libtoxcore.tox_group_mod_ban_peer(self._tox_pointer, group_number, peer_id,
ban_type, byref(error))
return result
def group_mod_remove_ban(self, group_number, ban_id):

View File

@ -911,6 +911,17 @@ TOX_ERR_GROUP_BAN_QUERY = {
'TOX_ERR_GROUP_BAN_QUERY_BAD_ID': 2,
}
TOX_GROUP_BAN_TYPE = {
'TOX_GROUP_BAN_TYPE_IP_PORT': 0,
'TOX_GROUP_BAN_TYPE_PUBLIC_KEY': 1,
'TOX_GROUP_BAN_TYPE_NICK': 2
}
TOX_PUBLIC_KEY_SIZE = 32
TOX_ADDRESS_SIZE = TOX_PUBLIC_KEY_SIZE + 6