From cebf388513ed91bb0797f6fd167d467552b9f6a1 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Sat, 11 Sep 2004 16:23:56 +0000 Subject: [PATCH] Added a Channel.alert command. --- src/Channel.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/Channel.py b/src/Channel.py index ad9d4dc2c..001afd7b6 100755 --- a/src/Channel.py +++ b/src/Channel.py @@ -705,6 +705,28 @@ class Channel(callbacks.Privmsg): utils.sortBy(str.lower, L) irc.reply(utils.commaAndify(L)) + def alertOps(self, irc, channel, s, frm=None): + """Internal message for notifying all the #channel,ops in a channel of + a given situation.""" + capability = ircdb.makeChannelCapability(channel, 'op') + s = 'Alert to all %s ops: %s' % (channel, s) + if frm is not None: + s += ' (from %s)' % frm + for nick in irc.state.channels[channel].users: + hostmask = irc.state.nickToHostmask(nick) + if ircdb.checkCapability(hostmask, capability): + irc.reply(s, to=nick, private=True) + + def alert(self, irc, msg, args, channel): + """[] + + Sends to all the users in who have the ,op + capability. + """ + text = privmsgs.getArgs(args) + self.alertOps(irc, channel, text, frm=msg.nick) + alert = privmsgs.checkChannelCapability(alert, 'op') + Class = Channel