group - privacy state added

This commit is contained in:
ingvar1995 2018-07-23 00:50:53 +03:00
parent 20f36e06ad
commit 27d24ecaf4
3 changed files with 15 additions and 3 deletions

View File

@ -8,9 +8,10 @@ from common.tox_save import ToxSave
class GroupChat(contact.Contact, ToxSave):
def __init__(self, tox, profile_manager, message_getter, number, name, status_message, widget, tox_id):
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._peers = []
self._add_self_to_gc()
@ -24,6 +25,15 @@ class GroupChat(contact.Contact, ToxSave):
def get_context_menu_generator(self):
return GroupMenuGenerator(self)
# -----------------------------------------------------------------------------------------------------------------
# Properties
# -----------------------------------------------------------------------------------------------------------------
def get_is_private(self):
return self._is_private
is_private = property(get_is_private)
# -----------------------------------------------------------------------------------------------------------------
# Peers methods
# -----------------------------------------------------------------------------------------------------------------

View File

@ -1,5 +1,6 @@
from contacts.group_chat import GroupChat
from common.tox_save import ToxSave
import wrapper.toxcore_enums_and_consts as constants
class GroupFactory(ToxSave):
@ -27,8 +28,9 @@ class GroupFactory(ToxSave):
name = alias or self._tox.group_get_name(group_number) or tox_id
status_message = self._tox.group_get_topic(group_number)
message_getter = self._db.messages_getter(tox_id)
is_private = self._tox.group_get_privacy_state() == constants.TOX_GROUP_PRIVACY_STATE['PRIVATE']
group = GroupChat(self._tox, self._profile_manager, message_getter, group_number, name, status_message,
item, tox_id)
item, tox_id, is_private)
group.set_alias(alias)
return group

View File

@ -489,7 +489,7 @@ def group_moderation(groups_service, contacts_provider, contacts_manager, messen
elif event_type == TOX_GROUP_MOD_EVENT['MODERATOR']:
update_peer_role(group, mod_peer_id, peer_id, TOX_GROUP_ROLE['MODERATOR'])
groups_service.generate_peers_list()
invoke_in_main_thread(groups_service.generate_peers_list)
return wrapped