.BANCHO. .FIX. Hide internal channels

This commit is contained in:
Nyo 2016-07-15 11:46:44 +02:00
parent 4560e9d32b
commit b3f50a206d
4 changed files with 11 additions and 14 deletions

View File

@ -117,7 +117,7 @@ def handle(tornadoRequest):
# Output channels info # Output channels info
for key, value in glob.channels.channels.items(): 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)) responseToken.enqueue(serverPackets.channelInfo(key))
# Send friends list # Send friends list

View File

@ -3,16 +3,9 @@ from objects import glob
class channel: class channel:
""" """
A chat 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 Create a new chat channel object
@ -20,7 +13,8 @@ class channel:
__description -- channel description __description -- channel description
__publicRead -- bool, if true channel can be read by everyone, if false it can be read only by mods/admins __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 __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 self.name = __name
@ -30,6 +24,7 @@ class channel:
self.moderated = False self.moderated = False
self.temp = temp self.temp = temp
self.connectedUsers = [999] # Fokabot is always connected to every channels (otherwise it doesn't show up in IRC users list) 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) # Client name (#spectator/#multiplayer)
self.clientName = self.name self.clientName = self.name

View File

@ -28,7 +28,7 @@ class channelList:
self.addChannel(i["name"], i["description"], publicRead, publicWrite) 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 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 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 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. 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)) log.info("Created channel {}".format(name))
def addTempChannel(self, name): def addTempChannel(self, name):
""" """
Add a temporary channel (like #spectator or #multiplayer), gets deleted when there's no one in the channel 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 name -- channel name
return -- True if channel was created, False if failed return -- True if channel was created, False if failed
""" """
if name in self.channels: if name in self.channels:
return False 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)) log.info("Created temp channel {}".format(name))
def removeChannel(self, name): def removeChannel(self, name):

View File

@ -1 +1 @@
1.6.3 1.6.4