From b2ecf5314e45777c00cbe3ff25f8d64762cdc60c Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Sat, 23 Jun 2018 00:20:13 +0300 Subject: [PATCH] gc invite - support of gc name added --- toxygen/groups/groups_service.py | 6 +++--- toxygen/middleware/callbacks.py | 5 +++-- toxygen/wrapper/tox.py | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/toxygen/groups/groups_service.py b/toxygen/groups/groups_service.py index 454efda..83f6a4e 100644 --- a/toxygen/groups/groups_service.py +++ b/toxygen/groups/groups_service.py @@ -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) # ----------------------------------------------------------------------------------------------------------------- diff --git a/toxygen/middleware/callbacks.py b/toxygen/middleware/callbacks.py index 6855adc..41a5717 100644 --- a/toxygen/middleware/callbacks.py +++ b/toxygen/middleware/callbacks.py @@ -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 diff --git a/toxygen/wrapper/tox.py b/toxygen/wrapper/tox.py index b4c401c..96e7fd5 100644 --- a/toxygen/wrapper/tox.py +++ b/toxygen/wrapper/tox.py @@ -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)