join group with different credentials
This commit is contained in:
parent
850c3b1ca3
commit
3272617403
@ -366,7 +366,7 @@ class App:
|
|||||||
widgets_factory = None
|
widgets_factory = None
|
||||||
widgets_factory_provider = Provider(lambda: widgets_factory)
|
widgets_factory_provider = Provider(lambda: widgets_factory)
|
||||||
self._groups_service = GroupsService(self._tox, self._contacts_manager, self._contacts_provider, self._ms,
|
self._groups_service = GroupsService(self._tox, self._contacts_manager, self._contacts_provider, self._ms,
|
||||||
widgets_factory_provider)
|
widgets_factory_provider, self._profile)
|
||||||
widgets_factory = WidgetsFactory(self._settings, self._profile, self._profile_manager, self._contacts_manager,
|
widgets_factory = WidgetsFactory(self._settings, self._profile, self._profile_manager, self._contacts_manager,
|
||||||
self._file_transfer_handler, self._smiley_loader, self._plugin_loader,
|
self._file_transfer_handler, self._smiley_loader, self._plugin_loader,
|
||||||
self._toxes, self._version, self._groups_service, history)
|
self._toxes, self._version, self._groups_service, history)
|
||||||
|
@ -6,12 +6,13 @@ import wrapper.toxcore_enums_and_consts as constants
|
|||||||
|
|
||||||
class GroupsService(tox_save.ToxSave):
|
class GroupsService(tox_save.ToxSave):
|
||||||
|
|
||||||
def __init__(self, tox, contacts_manager, contacts_provider, main_screen, widgets_factory_provider):
|
def __init__(self, tox, contacts_manager, contacts_provider, main_screen, widgets_factory_provider, profile):
|
||||||
super().__init__(tox)
|
super().__init__(tox)
|
||||||
self._contacts_manager = contacts_manager
|
self._contacts_manager = contacts_manager
|
||||||
self._contacts_provider = contacts_provider
|
self._contacts_provider = contacts_provider
|
||||||
self._peers_list_widget = main_screen.peers_list
|
self._peers_list_widget = main_screen.peers_list
|
||||||
self._widgets_factory_provider = widgets_factory_provider
|
self._widgets_factory_provider = widgets_factory_provider
|
||||||
|
self._profile = profile
|
||||||
self._peer_screen = None
|
self._peer_screen = None
|
||||||
|
|
||||||
def set_tox(self, tox):
|
def set_tox(self, tox):
|
||||||
@ -23,8 +24,8 @@ class GroupsService(tox_save.ToxSave):
|
|||||||
# Groups creation
|
# Groups creation
|
||||||
# -----------------------------------------------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
def create_new_gc(self, name, privacy_state):
|
def create_new_gc(self, name, privacy_state, nick, status):
|
||||||
group_number = self._tox.group_new(privacy_state, name.encode('utf-8'))
|
group_number = self._tox.group_new(privacy_state, name, nick, status)
|
||||||
if group_number == -1:
|
if group_number == -1:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -32,12 +33,12 @@ class GroupsService(tox_save.ToxSave):
|
|||||||
group = self._get_group_by_number(group_number)
|
group = self._get_group_by_number(group_number)
|
||||||
group.status = constants.TOX_USER_STATUS['NONE']
|
group.status = constants.TOX_USER_STATUS['NONE']
|
||||||
|
|
||||||
def join_gc_by_id(self, chat_id, password):
|
def join_gc_by_id(self, chat_id, password, nick, status):
|
||||||
group_number = self._tox.group_join(chat_id, password)
|
group_number = self._tox.group_join(chat_id, password, nick, status)
|
||||||
self._add_new_group_by_number(group_number)
|
self._add_new_group_by_number(group_number)
|
||||||
|
|
||||||
def join_gc_via_invite(self, invite_data, friend_number, password):
|
def join_gc_via_invite(self, invite_data, friend_number, nick, status, password):
|
||||||
group_number = self._tox.group_invite_accept(invite_data, friend_number, password)
|
group_number = self._tox.group_invite_accept(invite_data, friend_number, nick, status, password)
|
||||||
self._add_new_group_by_number(group_number)
|
self._add_new_group_by_number(group_number)
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------------------------------------------
|
||||||
@ -72,7 +73,7 @@ class GroupsService(tox_save.ToxSave):
|
|||||||
friend = self._get_friend_by_number(friend_number)
|
friend = self._get_friend_by_number(friend_number)
|
||||||
text = util_ui.tr('Friend {} invites you to group "{}". Accept?')
|
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')):
|
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)
|
self.join_gc_via_invite(invite_data, friend_number, self._profile.name, self._profile.status or 0, None)
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------------------------------------------
|
||||||
# Group info methods
|
# Group info methods
|
||||||
|
@ -3,72 +3,116 @@ import utils.util as util
|
|||||||
from ui.widgets import *
|
from ui.widgets import *
|
||||||
from wrapper.toxcore_enums_and_consts import *
|
from wrapper.toxcore_enums_and_consts import *
|
||||||
|
|
||||||
|
# TODO: move common logic to separate class
|
||||||
|
|
||||||
|
|
||||||
class CreateGroupScreen(CenteredWidget):
|
class CreateGroupScreen(CenteredWidget):
|
||||||
|
|
||||||
def __init__(self, groups_service):
|
def __init__(self, groups_service, profile):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._groups_service = groups_service
|
self._groups_service = groups_service
|
||||||
|
self._profile = profile
|
||||||
uic.loadUi(util.get_views_path('create_group_screen'), self)
|
uic.loadUi(util.get_views_path('create_group_screen'), self)
|
||||||
self.center()
|
self.center()
|
||||||
self._update_ui()
|
self._update_ui()
|
||||||
|
|
||||||
def _update_ui(self):
|
def _update_ui(self):
|
||||||
self._retranslate_ui()
|
self._retranslate_ui()
|
||||||
|
|
||||||
|
self.statusComboBox.setCurrentIndex(self._profile.status or 0)
|
||||||
|
self.nickLineEdit.setText(self._profile.name)
|
||||||
|
|
||||||
self.addGroupButton.clicked.connect(self._create_group)
|
self.addGroupButton.clicked.connect(self._create_group)
|
||||||
self.groupNameLineEdit.textChanged.connect(self._group_name_changed)
|
self.groupNameLineEdit.textChanged.connect(self._group_name_changed)
|
||||||
|
self.nickLineEdit.textChanged.connect(self._nick_changed)
|
||||||
|
|
||||||
def _retranslate_ui(self):
|
def _retranslate_ui(self):
|
||||||
self.setWindowTitle(util_ui.tr('Create new group chat'))
|
self.setWindowTitle(util_ui.tr('Create new group chat'))
|
||||||
self.groupNameLabel.setText(util_ui.tr('Group name:'))
|
self.groupNameLabel.setText(util_ui.tr('Group name:'))
|
||||||
self.groupTypeLabel.setText(util_ui.tr('Group type:'))
|
self.groupTypeLabel.setText(util_ui.tr('Group type:'))
|
||||||
|
self.nickLabel.setText(util_ui.tr('Nickname:'))
|
||||||
|
self.statusLabel.setText(util_ui.tr('Status:'))
|
||||||
|
self.nickLineEdit.setPlaceholderText(util_ui.tr('Your nick in chat'))
|
||||||
self.groupNameLineEdit.setPlaceholderText(util_ui.tr('Group\'s persistent name'))
|
self.groupNameLineEdit.setPlaceholderText(util_ui.tr('Group\'s persistent name'))
|
||||||
self.addGroupButton.setText(util_ui.tr('Create group'))
|
self.addGroupButton.setText(util_ui.tr('Create group'))
|
||||||
self.groupTypeComboBox.addItem(util_ui.tr('Public'))
|
self.groupTypeComboBox.addItem(util_ui.tr('Public'))
|
||||||
self.groupTypeComboBox.addItem(util_ui.tr('Private'))
|
self.groupTypeComboBox.addItem(util_ui.tr('Private'))
|
||||||
self.groupTypeComboBox.setCurrentIndex(1)
|
self.groupTypeComboBox.setCurrentIndex(1)
|
||||||
|
self.statusComboBox.addItem(util_ui.tr('Online'))
|
||||||
|
self.statusComboBox.addItem(util_ui.tr('Away'))
|
||||||
|
self.statusComboBox.addItem(util_ui.tr('Busy'))
|
||||||
|
|
||||||
def _create_group(self):
|
def _create_group(self):
|
||||||
name = self.groupNameLineEdit.text()
|
group_name = self.groupNameLineEdit.text()
|
||||||
privacy_state = self.groupTypeComboBox.currentIndex()
|
privacy_state = self.groupTypeComboBox.currentIndex()
|
||||||
self._groups_service.create_new_gc(name, privacy_state)
|
nick = self.nickLineEdit.text()
|
||||||
|
status = self.statusComboBox.currentIndex()
|
||||||
|
self._groups_service.create_new_gc(group_name, privacy_state, nick, status)
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
|
def _nick_changed(self):
|
||||||
|
self._update_button_state()
|
||||||
|
|
||||||
def _group_name_changed(self):
|
def _group_name_changed(self):
|
||||||
name = self.groupNameLineEdit.text()
|
self._update_button_state()
|
||||||
self.addGroupButton.setEnabled(bool(name.strip()))
|
|
||||||
|
def _update_button_state(self):
|
||||||
|
is_nick_set = bool(self.nickLineEdit.text())
|
||||||
|
is_group_name_set = bool(self.groupNameLineEdit.text())
|
||||||
|
self.addGroupButton.setEnabled(is_nick_set and is_group_name_set)
|
||||||
|
|
||||||
|
|
||||||
class JoinGroupScreen(CenteredWidget):
|
class JoinGroupScreen(CenteredWidget):
|
||||||
|
|
||||||
def __init__(self, groups_service):
|
def __init__(self, groups_service, profile):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._groups_service = groups_service
|
self._groups_service = groups_service
|
||||||
|
self._profile = profile
|
||||||
uic.loadUi(util.get_views_path('join_group_screen'), self)
|
uic.loadUi(util.get_views_path('join_group_screen'), self)
|
||||||
self.center()
|
self.center()
|
||||||
self._update_ui()
|
self._update_ui()
|
||||||
|
|
||||||
def _update_ui(self):
|
def _update_ui(self):
|
||||||
self._retranslate_ui()
|
self._retranslate_ui()
|
||||||
|
|
||||||
|
self.statusComboBox.setCurrentIndex(self._profile.status or 0)
|
||||||
|
self.nickLineEdit.setText(self._profile.name)
|
||||||
|
|
||||||
self.chatIdLineEdit.textChanged.connect(self._chat_id_changed)
|
self.chatIdLineEdit.textChanged.connect(self._chat_id_changed)
|
||||||
self.joinGroupButton.clicked.connect(self._join_group)
|
self.joinGroupButton.clicked.connect(self._join_group)
|
||||||
|
self.nickLineEdit.textChanged.connect(self._nick_changed)
|
||||||
|
|
||||||
def _retranslate_ui(self):
|
def _retranslate_ui(self):
|
||||||
self.setWindowTitle(util_ui.tr('Join public group chat'))
|
self.setWindowTitle(util_ui.tr('Join public group chat'))
|
||||||
self.chatIdLabel.setText(util_ui.tr('Group ID:'))
|
self.chatIdLabel.setText(util_ui.tr('Group ID:'))
|
||||||
self.passwordLabel.setText(util_ui.tr('Password:'))
|
self.passwordLabel.setText(util_ui.tr('Password:'))
|
||||||
|
self.nickLabel.setText(util_ui.tr('Nickname:'))
|
||||||
|
self.statusLabel.setText(util_ui.tr('Status:'))
|
||||||
self.chatIdLineEdit.setPlaceholderText(util_ui.tr('Group\'s chat ID'))
|
self.chatIdLineEdit.setPlaceholderText(util_ui.tr('Group\'s chat ID'))
|
||||||
|
self.nickLineEdit.setPlaceholderText(util_ui.tr('Your nick in chat'))
|
||||||
self.joinGroupButton.setText(util_ui.tr('Join group'))
|
self.joinGroupButton.setText(util_ui.tr('Join group'))
|
||||||
self.passwordLineEdit.setPlaceholderText(util_ui.tr('Optional password'))
|
self.passwordLineEdit.setPlaceholderText(util_ui.tr('Optional password'))
|
||||||
|
self.statusComboBox.addItem(util_ui.tr('Online'))
|
||||||
|
self.statusComboBox.addItem(util_ui.tr('Away'))
|
||||||
|
self.statusComboBox.addItem(util_ui.tr('Busy'))
|
||||||
|
|
||||||
def _chat_id_changed(self):
|
def _chat_id_changed(self):
|
||||||
|
self._update_button_state()
|
||||||
|
|
||||||
|
def _nick_changed(self):
|
||||||
|
self._update_button_state()
|
||||||
|
|
||||||
|
def _update_button_state(self):
|
||||||
chat_id = self._get_chat_id()
|
chat_id = self._get_chat_id()
|
||||||
self.joinGroupButton.setEnabled(len(chat_id) == TOX_GROUP_CHAT_ID_SIZE * 2)
|
is_nick_set = bool(self.nickLineEdit.text())
|
||||||
|
self.joinGroupButton.setEnabled(len(chat_id) == TOX_GROUP_CHAT_ID_SIZE * 2 and is_nick_set)
|
||||||
|
|
||||||
def _join_group(self):
|
def _join_group(self):
|
||||||
chat_id = self._get_chat_id()
|
chat_id = self._get_chat_id()
|
||||||
password = self.passwordLineEdit.text()
|
password = self.passwordLineEdit.text()
|
||||||
self._groups_service.join_gc_by_id(chat_id, password)
|
nick = self.nickLineEdit.text()
|
||||||
|
status = self.statusComboBox.currentIndex()
|
||||||
|
self._groups_service.join_gc_by_id(chat_id, password, nick, status)
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
def _get_chat_id(self):
|
def _get_chat_id(self):
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>639</width>
|
<width>640</width>
|
||||||
<height>199</height>
|
<height>300</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -19,9 +19,9 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>180</x>
|
<x>20</x>
|
||||||
<y>150</y>
|
<y>250</y>
|
||||||
<width>271</width>
|
<width>601</width>
|
||||||
<height>41</height>
|
<height>41</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -32,28 +32,28 @@
|
|||||||
<widget class="QLineEdit" name="groupNameLineEdit">
|
<widget class="QLineEdit" name="groupNameLineEdit">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>140</x>
|
<x>150</x>
|
||||||
<y>40</y>
|
<y>20</y>
|
||||||
<width>471</width>
|
<width>470</width>
|
||||||
<height>31</height>
|
<height>35</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QComboBox" name="groupTypeComboBox">
|
<widget class="QComboBox" name="groupTypeComboBox">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>140</x>
|
<x>150</x>
|
||||||
<y>100</y>
|
<y>80</y>
|
||||||
<width>471</width>
|
<width>470</width>
|
||||||
<height>41</height>
|
<height>35</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLabel" name="groupNameLabel">
|
<widget class="QLabel" name="groupNameLabel">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>20</x>
|
||||||
<y>40</y>
|
<y>20</y>
|
||||||
<width>121</width>
|
<width>121</width>
|
||||||
<height>31</height>
|
<height>31</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -65,8 +65,8 @@
|
|||||||
<widget class="QLabel" name="groupTypeLabel">
|
<widget class="QLabel" name="groupTypeLabel">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>20</x>
|
||||||
<y>100</y>
|
<y>80</y>
|
||||||
<width>121</width>
|
<width>121</width>
|
||||||
<height>31</height>
|
<height>31</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -75,6 +75,52 @@
|
|||||||
<string>TextLabel</string>
|
<string>TextLabel</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QLabel" name="statusLabel">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>200</y>
|
||||||
|
<width>111</width>
|
||||||
|
<height>17</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="nickLabel">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>150</y>
|
||||||
|
<width>111</width>
|
||||||
|
<height>17</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="nickLineEdit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>150</x>
|
||||||
|
<y>140</y>
|
||||||
|
<width>470</width>
|
||||||
|
<height>35</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QComboBox" name="statusComboBox">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>150</x>
|
||||||
|
<y>190</y>
|
||||||
|
<width>470</width>
|
||||||
|
<height>35</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
@ -6,10 +6,22 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>739</width>
|
<width>740</width>
|
||||||
<height>212</height>
|
<height>320</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>740</width>
|
||||||
|
<height>320</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>740</width>
|
||||||
|
<height>320</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
@ -17,7 +29,7 @@
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>30</x>
|
<x>30</x>
|
||||||
<y>40</y>
|
<y>30</y>
|
||||||
<width>67</width>
|
<width>67</width>
|
||||||
<height>17</height>
|
<height>17</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -30,7 +42,7 @@
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>30</x>
|
<x>30</x>
|
||||||
<y>100</y>
|
<y>90</y>
|
||||||
<width>67</width>
|
<width>67</width>
|
||||||
<height>17</height>
|
<height>17</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -45,9 +57,9 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>258</x>
|
<x>30</x>
|
||||||
<y>150</y>
|
<y>260</y>
|
||||||
<width>241</width>
|
<width>680</width>
|
||||||
<height>51</height>
|
<height>51</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -60,7 +72,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>190</x>
|
<x>190</x>
|
||||||
<y>20</y>
|
<y>20</y>
|
||||||
<width>431</width>
|
<width>520</width>
|
||||||
<height>41</height>
|
<height>41</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -69,8 +81,54 @@
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>190</x>
|
<x>190</x>
|
||||||
<y>90</y>
|
<y>80</y>
|
||||||
<width>431</width>
|
<width>520</width>
|
||||||
|
<height>41</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="nickLabel">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>150</y>
|
||||||
|
<width>67</width>
|
||||||
|
<height>17</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="statusLabel">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>210</y>
|
||||||
|
<width>67</width>
|
||||||
|
<height>17</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="nickLineEdit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>190</x>
|
||||||
|
<y>140</y>
|
||||||
|
<width>520</width>
|
||||||
|
<height>41</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QComboBox" name="statusComboBox">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>190</x>
|
||||||
|
<y>200</y>
|
||||||
|
<width>520</width>
|
||||||
<height>41</height>
|
<height>41</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -64,10 +64,10 @@ class WidgetsFactory:
|
|||||||
return StickerWindow(self._file_transfer_handler, self._contacts_manager)
|
return StickerWindow(self._file_transfer_handler, self._contacts_manager)
|
||||||
|
|
||||||
def create_group_screen_window(self):
|
def create_group_screen_window(self):
|
||||||
return CreateGroupScreen(self._groups_service)
|
return CreateGroupScreen(self._groups_service, self._profile)
|
||||||
|
|
||||||
def create_join_group_screen_window(self):
|
def create_join_group_screen_window(self):
|
||||||
return JoinGroupScreen(self._groups_service)
|
return JoinGroupScreen(self._groups_service, self._profile)
|
||||||
|
|
||||||
def create_search_screen(self, messages):
|
def create_search_screen(self, messages):
|
||||||
return SearchScreen(self._contacts_manager, self._history, messages, messages.parent())
|
return SearchScreen(self._contacts_manager, self._history, messages, messages.parent())
|
||||||
|
@ -29,7 +29,7 @@ class ToxOptions(Structure):
|
|||||||
class GroupChatSelfPeerInfo(Structure):
|
class GroupChatSelfPeerInfo(Structure):
|
||||||
_fields_ = [
|
_fields_ = [
|
||||||
('nick', c_char_p),
|
('nick', c_char_p),
|
||||||
('nick_length', c_uint16),
|
('nick_length', c_uint8),
|
||||||
('user_status', c_int)
|
('user_status', c_int)
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1533,7 +1533,7 @@ class Tox:
|
|||||||
# Group chat instance management
|
# Group chat instance management
|
||||||
# -----------------------------------------------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
def group_new(self, privacy_state, group_name):
|
def group_new(self, privacy_state, group_name, nick, status):
|
||||||
"""
|
"""
|
||||||
Creates a new group chat.
|
Creates a new group chat.
|
||||||
|
|
||||||
@ -1551,12 +1551,16 @@ class Tox:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
error = c_int()
|
error = c_int()
|
||||||
peer_info = self.group_chat_self_peer_info_new()
|
peer_info = self.group_self_peer_info_new()
|
||||||
result = Tox.libtoxcore.tox_group_new(self._tox_pointer, privacy_state, group_name,
|
nick = bytes(nick, 'utf-8')
|
||||||
|
peer_info.contents.nick = c_char_p(nick)
|
||||||
|
peer_info.contents.nick_length = len(nick)
|
||||||
|
peer_info.contents.user_status = status
|
||||||
|
result = Tox.libtoxcore.tox_group_new(self._tox_pointer, privacy_state, group_name.encode('utf-8'),
|
||||||
len(group_name), peer_info, byref(error))
|
len(group_name), peer_info, byref(error))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def group_join(self, chat_id, password):
|
def group_join(self, chat_id, password, nick, status):
|
||||||
"""
|
"""
|
||||||
Joins a group chat with specified Chat ID.
|
Joins a group chat with specified Chat ID.
|
||||||
|
|
||||||
@ -1571,7 +1575,11 @@ class Tox:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
error = c_int()
|
error = c_int()
|
||||||
peer_info = self.group_chat_self_peer_info_new()
|
peer_info = self.group_self_peer_info_new()
|
||||||
|
nick = bytes(nick, 'utf-8')
|
||||||
|
peer_info.contents.nick = c_char_p(nick)
|
||||||
|
peer_info.contents.nick_length = len(nick)
|
||||||
|
peer_info.contents.user_status = status
|
||||||
result = Tox.libtoxcore.tox_group_join(self._tox_pointer, string_to_bin(chat_id),
|
result = Tox.libtoxcore.tox_group_join(self._tox_pointer, string_to_bin(chat_id),
|
||||||
password,
|
password,
|
||||||
len(password) if password is not None else 0,
|
len(password) if password is not None else 0,
|
||||||
@ -2171,15 +2179,15 @@ class Tox:
|
|||||||
result = Tox.libtoxcore.tox_group_invite_friend(self._tox_pointer, group_number, friend_number, byref(error))
|
result = Tox.libtoxcore.tox_group_invite_friend(self._tox_pointer, group_number, friend_number, byref(error))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def group_chat_self_peer_info_new(self):
|
def group_self_peer_info_new(self):
|
||||||
error = c_int()
|
error = c_int()
|
||||||
f = Tox.libtoxcore.group_chat_self_peer_info_new
|
f = Tox.libtoxcore.tox_group_self_peer_info_new
|
||||||
f.restype = POINTER(GroupChatSelfPeerInfo)
|
f.restype = POINTER(GroupChatSelfPeerInfo)
|
||||||
result = f(self._tox_pointer, byref(error))
|
result = f(self._tox_pointer, byref(error))
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def group_invite_accept(self, invite_data, friend_number, password=None):
|
def group_invite_accept(self, invite_data, friend_number, nick, status, password=None):
|
||||||
"""
|
"""
|
||||||
Accept an invite to a group chat that the client previously received from a friend. The invite
|
Accept an invite to a group chat that the client previously received from a friend. The invite
|
||||||
is only valid while the inviter is present in the group.
|
is only valid while the inviter is present in the group.
|
||||||
@ -2192,7 +2200,11 @@ class Tox:
|
|||||||
error = c_int()
|
error = c_int()
|
||||||
f = Tox.libtoxcore.tox_group_invite_accept
|
f = Tox.libtoxcore.tox_group_invite_accept
|
||||||
f.restype = c_uint32
|
f.restype = c_uint32
|
||||||
peer_info = self.group_chat_self_peer_info_new()
|
peer_info = self.group_self_peer_info_new()
|
||||||
|
nick = bytes(nick, 'utf-8')
|
||||||
|
peer_info.contents.nick = c_char_p(nick)
|
||||||
|
peer_info.contents.nick_length = len(nick)
|
||||||
|
peer_info.contents.user_status = status
|
||||||
result = f(self._tox_pointer, friend_number, invite_data, len(invite_data), password,
|
result = f(self._tox_pointer, friend_number, invite_data, len(invite_data), password,
|
||||||
len(password) if password is not None else 0, peer_info, byref(error))
|
len(password) if password is not None else 0, peer_info, byref(error))
|
||||||
print('Invite accept. Result:', result, 'Error:', error.value)
|
print('Invite accept. Result:', result, 'Error:', error.value)
|
||||||
|
Loading…
Reference in New Issue
Block a user