ChannelStatus: Add supybot.plugins.ChannelStatus.topic.
parent
d99223d8f9
commit
3e5486d9aa
|
@ -57,6 +57,9 @@ conf.registerChannelValue(ChannelStatus, 'listed',
|
||||||
conf.registerChannelValue(ChannelStatus, 'nicks',
|
conf.registerChannelValue(ChannelStatus, 'nicks',
|
||||||
registry.Boolean(False, _("""Determines whether or not the list of users
|
registry.Boolean(False, _("""Determines whether or not the list of users
|
||||||
in this channel will be listed.""")))
|
in this channel will be listed.""")))
|
||||||
|
conf.registerChannelValue(ChannelStatus, 'topic',
|
||||||
|
registry.Boolean(False, _("""Determines whether or not the topic of this
|
||||||
|
channel will be displayed.""")))
|
||||||
|
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
||||||
|
|
|
@ -65,6 +65,8 @@ DEFAULT_TEMPLATES = {
|
||||||
'channelstatus/channel.html': PAGE_SKELETON % """\
|
'channelstatus/channel.html': PAGE_SKELETON % """\
|
||||||
<body class="purelisting">
|
<body class="purelisting">
|
||||||
<h1>%(channel)s@%(network)s</h1>
|
<h1>%(channel)s@%(network)s</h1>
|
||||||
|
<h2>Topic</h2>
|
||||||
|
%(topic)s
|
||||||
<h2>Users</h2>
|
<h2>Users</h2>
|
||||||
%(nicks)s
|
%(nicks)s
|
||||||
</body>""",
|
</body>""",
|
||||||
|
@ -104,18 +106,21 @@ class ChannelStatusCallback(httpserver.SupyHTTPServerCallback):
|
||||||
if not ircutils.isChannel(channel):
|
if not ircutils.isChannel(channel):
|
||||||
self._invalidChannel()
|
self._invalidChannel()
|
||||||
return
|
return
|
||||||
|
for irc in world.ircs:
|
||||||
|
if irc.network == network:
|
||||||
|
break
|
||||||
|
if irc.network != network or channel not in irc.state.channels:
|
||||||
|
self._invalidChannel()
|
||||||
|
return
|
||||||
|
state = irc.state.channels[channel]
|
||||||
replacements = {'channel': channel, 'network': network,
|
replacements = {'channel': channel, 'network': network,
|
||||||
'nicks': _('Private')}
|
'nicks': _('Private'), 'topic': _('Private')}
|
||||||
|
if self._plugin.registryValue('topic', channel):
|
||||||
|
replacements['topic'] = state.topic
|
||||||
if self._plugin.registryValue('nicks', channel):
|
if self._plugin.registryValue('nicks', channel):
|
||||||
for irc in world.ircs:
|
|
||||||
if irc.network == network:
|
|
||||||
break
|
|
||||||
if irc.network != network or channel not in irc.state.channels:
|
|
||||||
self._invalidChannel()
|
|
||||||
return
|
|
||||||
replacements['nicks'] = '<ul>' + \
|
replacements['nicks'] = '<ul>' + \
|
||||||
'\n'.join(sorted(['<li>%s</li>' % x
|
'\n'.join(sorted(['<li>%s</li>' % x
|
||||||
for x in irc.state.channels[channel].users])) + \
|
for x in state.users])) + \
|
||||||
'</ul>'
|
'</ul>'
|
||||||
template = httpserver.get_template('channelstatus/channel.html')
|
template = httpserver.get_template('channelstatus/channel.html')
|
||||||
self.wfile.write(template % replacements)
|
self.wfile.write(template % replacements)
|
||||||
|
|
Loading…
Reference in New Issue