Clean up \leave room code
This commit is contained in:
parent
ed6affe1ec
commit
7ff39317cd
6
group.py
6
group.py
|
@ -78,6 +78,12 @@ class Group():
|
|||
self._updateParticipant(number, flags, protocol_pb2.STATUS_NONE)
|
||||
del self.participants[number]
|
||||
|
||||
def leaveRoom(self):
|
||||
for number in self.participants:
|
||||
nick = self.participants[number]
|
||||
flags = protocol_pb2.PARTICIPANT_FLAG_ROOM_NOT_FOUND
|
||||
self._updateParticipant(number, flags, protocol_pb2.STATUS_NONE)
|
||||
|
||||
def changeNick(self, number, new_nick):
|
||||
if self.participants[number] == new_nick:
|
||||
return
|
||||
|
|
15
session.py
15
session.py
|
@ -591,20 +591,7 @@ class Session(YowsupApp):
|
|||
self.leaveGroup(room)
|
||||
# Delete Room on spectrum side
|
||||
group = self.groups[room]
|
||||
for jid in group.participants:
|
||||
buddy = jid.split("@")[0]
|
||||
try:
|
||||
nick = self.buddies[buddy].nick
|
||||
except KeyError:
|
||||
nick = buddy
|
||||
if nick == "":
|
||||
nick = buddy
|
||||
if buddy == self.legacyName:
|
||||
nick = group.nick
|
||||
flags = protocol_pb2.PARTICIPANT_FLAG_ROOM_NOT_FOUND
|
||||
self.backend.handleParticipantChanged(
|
||||
self.user, nick, self._shortenGroupId(room), flags,
|
||||
protocol_pb2.STATUS_NONE, buddy)
|
||||
group.leaveRoom()
|
||||
del self.groups[room]
|
||||
|
||||
def _requestLastSeen(self, buddy):
|
||||
|
|
Loading…
Reference in a new issue