diff --git a/objects/channelList.py b/objects/channelList.py index 39da31a..b27b4df 100644 --- a/objects/channelList.py +++ b/objects/channelList.py @@ -2,6 +2,7 @@ from common.log import logUtils as log from constants import serverPackets from objects import channel from objects import glob +from helpers import chatHelper as chat class channelList: @@ -63,7 +64,12 @@ class channelList: if name not in self.channels: log.debug("{} is not in channels list".format(name)) return - glob.streams.broadcast("chat/{}".format(name), serverPackets.channelKicked(name)) + #glob.streams.broadcast("chat/{}".format(name), serverPackets.channelKicked(name)) + stream = glob.streams.getStream("chat/{}".format(name)) + if stream is not None: + for token in stream.clients: + if token in glob.tokens.tokens: + chat.partChannel(channel=name, token=glob.tokens.tokens[token], kick=True) glob.streams.dispose("chat/{}".format(name)) glob.streams.remove("chat/{}".format(name)) self.channels.pop(name) diff --git a/objects/match.py b/objects/match.py index bf3dada..809330d 100644 --- a/objects/match.py +++ b/objects/match.py @@ -355,6 +355,7 @@ class match: glob.streams.broadcast(self.streamName, serverPackets.matchComplete()) # Destroy playing stream + glob.streams.dispose(self.playingStreamName) glob.streams.remove(self.playingStreamName) # Console output diff --git a/objects/matchList.py b/objects/matchList.py index 3b6c2d7..8b49cc8 100644 --- a/objects/matchList.py +++ b/objects/matchList.py @@ -41,6 +41,8 @@ class matchList: # Remove match object and stream match = self.matches.pop(matchID) + glob.streams.dispose(match.streamName) + glob.streams.dispose(match.playingStreamName) glob.streams.remove(match.streamName) glob.streams.remove(match.playingStreamName) diff --git a/objects/streamList.py b/objects/streamList.py index 22f4fd2..0cd84f9 100644 --- a/objects/streamList.py +++ b/objects/streamList.py @@ -80,4 +80,15 @@ class streamList: """ if streamName not in self.streams: return - self.streams[streamName].dispose(*args, **kwargs) \ No newline at end of file + self.streams[streamName].dispose(*args, **kwargs) + + def getStream(self, streamName): + """ + Returns streamName's stream object or None if it doesn't exist + + :param streamName: + :return: + """ + if streamName in self.streams: + return self.streams[streamName] + return None \ No newline at end of file