Clean up \leave room code

This commit is contained in:
moyamo 2016-01-06 16:33:28 +02:00
parent ed6affe1ec
commit 7ff39317cd
2 changed files with 7 additions and 14 deletions

View file

@ -78,6 +78,12 @@ class Group():
self._updateParticipant(number, flags, protocol_pb2.STATUS_NONE) self._updateParticipant(number, flags, protocol_pb2.STATUS_NONE)
del self.participants[number] 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): def changeNick(self, number, new_nick):
if self.participants[number] == new_nick: if self.participants[number] == new_nick:
return return

View file

@ -591,20 +591,7 @@ class Session(YowsupApp):
self.leaveGroup(room) self.leaveGroup(room)
# Delete Room on spectrum side # Delete Room on spectrum side
group = self.groups[room] group = self.groups[room]
for jid in group.participants: group.leaveRoom()
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)
del self.groups[room] del self.groups[room]
def _requestLastSeen(self, buddy): def _requestLastSeen(self, buddy):