.BANCHO. .FIX. Hide internal channels
This commit is contained in:
parent
4560e9d32b
commit
b3f50a206d
|
@ -117,7 +117,7 @@ def handle(tornadoRequest):
|
|||
|
||||
# Output channels info
|
||||
for key, value in glob.channels.channels.items():
|
||||
if value.publicRead == True:
|
||||
if value.publicRead == True and value.hidden == False:
|
||||
responseToken.enqueue(serverPackets.channelInfo(key))
|
||||
|
||||
# Send friends list
|
||||
|
|
|
@ -3,16 +3,9 @@ from objects import glob
|
|||
class channel:
|
||||
"""
|
||||
A chat channel
|
||||
|
||||
name -- channel name
|
||||
description -- channel description
|
||||
connectedUsers -- connected users IDs list
|
||||
publicRead -- bool
|
||||
publicWrite -- bool
|
||||
moderated -- bool
|
||||
"""
|
||||
|
||||
def __init__(self, __name, __description, __publicRead, __publicWrite, temp):
|
||||
def __init__(self, __name, __description, __publicRead, __publicWrite, temp, hidden):
|
||||
"""
|
||||
Create a new chat channel object
|
||||
|
||||
|
@ -20,7 +13,8 @@ class channel:
|
|||
__description -- channel description
|
||||
__publicRead -- bool, if true channel can be read by everyone, if false it can be read only by mods/admins
|
||||
__publicWrite -- bool, same as public read but relative to write permissions
|
||||
temp -- if True, channel will be deleted when there's no one in the channel. Optional. Default = False.
|
||||
temp -- if True, channel will be deleted when there's no one in the channel
|
||||
hidden -- if True, channel won't be shown in channels list
|
||||
"""
|
||||
|
||||
self.name = __name
|
||||
|
@ -30,6 +24,7 @@ class channel:
|
|||
self.moderated = False
|
||||
self.temp = temp
|
||||
self.connectedUsers = [999] # Fokabot is always connected to every channels (otherwise it doesn't show up in IRC users list)
|
||||
self.hidden = hidden
|
||||
|
||||
# Client name (#spectator/#multiplayer)
|
||||
self.clientName = self.name
|
||||
|
|
|
@ -28,7 +28,7 @@ class channelList:
|
|||
self.addChannel(i["name"], i["description"], publicRead, publicWrite)
|
||||
|
||||
|
||||
def addChannel(self, name, description, publicRead, publicWrite, temp = False):
|
||||
def addChannel(self, name, description, publicRead, publicWrite, temp = False, hidden = False):
|
||||
"""
|
||||
Add a channel object to channels dictionary
|
||||
|
||||
|
@ -37,21 +37,23 @@ class channelList:
|
|||
publicRead -- bool, if true channel can be read by everyone, if false it can be read only by mods/admins
|
||||
publicWrite -- bool, same as public read but relative to write permissions
|
||||
temp -- if True, channel will be deleted when there's no one in the channel. Optional. Default = False.
|
||||
hidden -- if True, channel will be hidden in channels list. Optional. Default = False.
|
||||
"""
|
||||
self.channels[name] = channel.channel(name, description, publicRead, publicWrite, temp)
|
||||
self.channels[name] = channel.channel(name, description, publicRead, publicWrite, temp, hidden)
|
||||
log.info("Created channel {}".format(name))
|
||||
|
||||
|
||||
def addTempChannel(self, name):
|
||||
"""
|
||||
Add a temporary channel (like #spectator or #multiplayer), gets deleted when there's no one in the channel
|
||||
and it's hidden in channels list
|
||||
|
||||
name -- channel name
|
||||
return -- True if channel was created, False if failed
|
||||
"""
|
||||
if name in self.channels:
|
||||
return False
|
||||
self.channels[name] = channel.channel(name, "Chat", True, True, True)
|
||||
self.channels[name] = channel.channel(name, "Chat", True, True, True, True)
|
||||
log.info("Created temp channel {}".format(name))
|
||||
|
||||
def removeChannel(self, name):
|
||||
|
|
Loading…
Reference in New Issue
Block a user