def on_join(self, conn, event): nick = conn.get_nickname() joiner = get_nick(event.source()) if joiner == nick: logging.info('%s joined %s', decode(nick), self.channel) elif len(self.channels[encode(self.channel)].users()) == 1: if not self.opfirst: return elif self.deop: mode = '+o-o+v %s %s %s' % (joiner, nick, nick) else: mode = '+o %s' % joiner conn.mode(encode(self.channel), mode)
def on_pubmsg(self, conn, event): if not self.script: return nick = decode(conn.get_nickname()) target = decode(event.target()) source= decode(get_nick(event.source())) message = decode(event.arguments()[0]) message = strip_unprintable(message) # Can be replaced with string.Template.safe_substitute, but requires 2.4 match = re.sub(r'(?<!\$)\$nick', nick, self.match or '') match = re.sub(r'\$\$nick', '$nick', match) try: match = re.compile(match) except re.error, e: logging.error('Problem with match expression: %s', e) return
def on_invite(self, conn, event): if decode(event.arguments()[0]) == self.channel: nick = decode(get_nick(event.source())) logging.info('Joining %s due to invite from %s', self.channel, nick) conn.join(encode(self.channel))
def on_privmsg(self, conn, event): nick = decode(conn.get_nickname()) source = decode(get_nick(event.source())) if source != nick: self.on_pubmsg(conn, event)
def on_join(self, conn, event): if get_nick(event.source()) == conn.get_nickname(): logging.info('%s joined %s', decode(conn.get_nickname()), self.channel)