Fix tourney chat channels get deleted when there's nobody in the channel
This commit is contained in:
parent
310bc1d3b3
commit
fc989a2705
|
@ -53,6 +53,20 @@ class channelList:
|
|||
self.channels[name] = channel.channel(name, "Chat", True, True, True, True)
|
||||
log.info("Created temp channel {}".format(name))
|
||||
|
||||
def addHiddenChannel(self, name):
|
||||
"""
|
||||
Add a hidden channel. It's like a normal channel and must be deleted manually,
|
||||
but it's not shown in channels list.
|
||||
|
||||
:param name: channel name
|
||||
:return: True if the channel was created, otherwise False
|
||||
"""
|
||||
if name in self.channels:
|
||||
return False
|
||||
glob.streams.add("chat/{}".format(name))
|
||||
self.channels[name] = channel.channel(name, "Chat", True, True, False, True)
|
||||
log.info("Created hidden channel {}".format(name))
|
||||
|
||||
def removeChannel(self, name):
|
||||
"""
|
||||
Removes a channel from channels list
|
||||
|
|
|
@ -68,7 +68,7 @@ class match:
|
|||
glob.streams.add(self.playingStreamName)
|
||||
|
||||
# Create #multiplayer channel
|
||||
glob.channels.addTempChannel("#multi_{}".format(self.matchID))
|
||||
glob.channels.addHiddenChannel("#multi_{}".format(self.matchID))
|
||||
log.info("MPROOM{}: {} match created!".format(self.matchID, "Tourney" if self.isTourney else "Normal"))
|
||||
|
||||
def getMatchData(self, censored = False):
|
||||
|
|
|
@ -47,6 +47,9 @@ class matchList:
|
|||
continue
|
||||
_match.userLeft(_token, disposeMatch=False) # don't dispose the match twice when we remove all players
|
||||
|
||||
# Delete chat channel
|
||||
glob.channels.removeChannel("#multi_{}".format(_match.matchID))
|
||||
|
||||
# Send matchDisposed packet before disposing streams
|
||||
glob.streams.broadcast(_match.streamName, serverPackets.disposeMatch(_match.matchID))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user