group leave fix
This commit is contained in:
parent
735c88d5bf
commit
1ab59ee422
2 changed files with 5 additions and 4 deletions
|
@ -418,7 +418,7 @@ class Profile(basecontact.BaseContact, Singleton):
|
||||||
:param peer_id: if gc - peer id
|
:param peer_id: if gc - peer id
|
||||||
"""
|
"""
|
||||||
t = time.time()
|
t = time.time()
|
||||||
|
active = False
|
||||||
if num == self.get_active_number() and is_group != self.is_active_a_friend(): # add message to list
|
if num == self.get_active_number() and is_group != self.is_active_a_friend(): # add message to list
|
||||||
if not is_group:
|
if not is_group:
|
||||||
self.create_message_item(message, t, MESSAGE_OWNER['FRIEND'], message_type)
|
self.create_message_item(message, t, MESSAGE_OWNER['FRIEND'], message_type)
|
||||||
|
@ -426,6 +426,7 @@ class Profile(basecontact.BaseContact, Singleton):
|
||||||
self.create_message_item(message, t, MESSAGE_OWNER['FRIEND'], message_type, True,
|
self.create_message_item(message, t, MESSAGE_OWNER['FRIEND'], message_type, True,
|
||||||
self._tox.group_peer_get_name(num, peer_id))
|
self._tox.group_peer_get_name(num, peer_id))
|
||||||
self._messages.scrollToBottom()
|
self._messages.scrollToBottom()
|
||||||
|
active = True
|
||||||
if is_group:
|
if is_group:
|
||||||
friend_or_gc = self.get_gc_by_number(num)
|
friend_or_gc = self.get_gc_by_number(num)
|
||||||
friend_or_gc.append_message(GroupChatTextMessage(self._tox.group_peer_get_name(num, peer_id),
|
friend_or_gc.append_message(GroupChatTextMessage(self._tox.group_peer_get_name(num, peer_id),
|
||||||
|
@ -434,6 +435,7 @@ class Profile(basecontact.BaseContact, Singleton):
|
||||||
else:
|
else:
|
||||||
friend_or_gc = self.get_friend_by_number(num)
|
friend_or_gc = self.get_friend_by_number(num)
|
||||||
friend_or_gc.append_message(TextMessage(message, MESSAGE_OWNER['FRIEND'], time.time(), message_type))
|
friend_or_gc.append_message(TextMessage(message, MESSAGE_OWNER['FRIEND'], time.time(), message_type))
|
||||||
|
if not active:
|
||||||
friend_or_gc.inc_messages()
|
friend_or_gc.inc_messages()
|
||||||
if not friend_or_gc.visibility:
|
if not friend_or_gc.visibility:
|
||||||
self.update_filtration()
|
self.update_filtration()
|
||||||
|
@ -723,7 +725,7 @@ class Profile(basecontact.BaseContact, Singleton):
|
||||||
if not is_gc:
|
if not is_gc:
|
||||||
self._tox.friend_delete(friend.number)
|
self._tox.friend_delete(friend.number)
|
||||||
else:
|
else:
|
||||||
self._tox.group_leave(num, message.encode('utf-8') if message is not None else None)
|
self._tox.group_leave(friend.number, message.encode('utf-8') if message is not None else None)
|
||||||
del self._friends_and_gc[num]
|
del self._friends_and_gc[num]
|
||||||
self._screen.friends_list.takeItem(num)
|
self._screen.friends_list.takeItem(num)
|
||||||
if num == self._active_friend_or_gc: # active friend or gc was deleted
|
if num == self._active_friend_or_gc: # active friend or gc was deleted
|
||||||
|
|
|
@ -1609,7 +1609,6 @@ class Tox:
|
||||||
f.restype = c_bool
|
f.restype = c_bool
|
||||||
result = f(self._tox_pointer, groupnumber, message,
|
result = f(self._tox_pointer, groupnumber, message,
|
||||||
len(message) if message is not None else 0, byref(error))
|
len(message) if message is not None else 0, byref(error))
|
||||||
print('In group leave. Result:', result, 'Error:', error.value)
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue