diff --git a/ChannelStatus/config.py b/ChannelStatus/config.py index 1f5db32..faceee5 100644 --- a/ChannelStatus/config.py +++ b/ChannelStatus/config.py @@ -57,6 +57,9 @@ conf.registerChannelValue(ChannelStatus, 'listed', conf.registerChannelValue(ChannelStatus, 'nicks', registry.Boolean(False, _("""Determines whether or not the list of users 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: diff --git a/ChannelStatus/plugin.py b/ChannelStatus/plugin.py index 842ba04..664d1ba 100644 --- a/ChannelStatus/plugin.py +++ b/ChannelStatus/plugin.py @@ -65,6 +65,8 @@ DEFAULT_TEMPLATES = { 'channelstatus/channel.html': PAGE_SKELETON % """\

%(channel)s@%(network)s

+

Topic

+ %(topic)s

Users

%(nicks)s """, @@ -104,18 +106,21 @@ class ChannelStatusCallback(httpserver.SupyHTTPServerCallback): if not ircutils.isChannel(channel): self._invalidChannel() 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, - 'nicks': _('Private')} + 'nicks': _('Private'), 'topic': _('Private')} + if self._plugin.registryValue('topic', channel): + replacements['topic'] = state.topic 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'] = '' template = httpserver.get_template('channelstatus/channel.html') self.wfile.write(template % replacements)