gc invite - support of gc name added

This commit is contained in:
ingvar1995 2018-06-23 00:20:13 +03:00
parent 8809ef1f6e
commit b2ecf5314e
3 changed files with 8 additions and 6 deletions

View File

@ -49,10 +49,10 @@ class GroupsService(tox_save.ToxSave):
def invite_friend(self, friend_number, group_number):
self._tox.group_invite_friend(group_number, friend_number)
def process_group_invite(self, friend_number, invite_data):
def process_group_invite(self, friend_number, group_name, invite_data):
friend = self._get_friend(friend_number)
text = util_ui.tr('Friend {} invites you to group. Accept?')
if util_ui.question(text.format(friend.name), util_ui.tr('Group invite')):
text = util_ui.tr('Friend {} invites you to group "{}". Accept?')
if util_ui.question(text.format(friend.name, group_name), util_ui.tr('Group invite')):
self.join_gc_via_invite(invite_data, friend_number, None)
# -----------------------------------------------------------------------------------------------------------------

View File

@ -382,9 +382,10 @@ def group_message(window, tray, tox, messenger, settings, profile):
def group_invite(groups_service):
def wrapped(tox, friend_number, invite_data, length, user_data):
def wrapped(tox, friend_number, invite_data, length, group_name, group_name_length, user_data):
group_name = bytes(group_name[:group_name_length])
invoke_in_main_thread(groups_service.process_group_invite,
friend_number,
friend_number, str(group_name, 'utf-8'),
bytes(invite_data[:length]))
return wrapped

View File

@ -2199,7 +2199,8 @@ class Tox:
user_data - user data
"""
c_callback = CFUNCTYPE(None, c_void_p, c_uint32, POINTER(c_uint8), c_size_t, c_void_p)
c_callback = CFUNCTYPE(None, c_void_p, c_uint32, POINTER(c_uint8), c_size_t,
POINTER(c_uint8), c_size_t, c_void_p)
self.group_invite_cb = c_callback(callback)
Tox.libtoxcore.tox_callback_group_invite(self._tox_pointer, self.group_invite_cb, user_data)