diff --git a/ChangeLog b/ChangeLog index cfda961b3..345d9efc2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ + * Added conf.followIdentificationThroughNickChanges for having the + bot update user's identified hostmask when they change nicks. + + * Added conf.replyWhenNotAddressed, a configuration variable for + having the bot always attempt to parse a message as a command. + * Added Relay.command, a command for sending commands to the bot on a different network. diff --git a/src/conf.py b/src/conf.py index 476314d34..412e4b15d 100644 --- a/src/conf.py +++ b/src/conf.py @@ -159,6 +159,14 @@ replyWhenNotAddressed = False ### requireRegistration = False +### +# followIdentificationThroughNickChanges: By default the bot will simply +# unidentify someone when he changes +# his nick. Setting this to True will +# cause the bot to track such changes. +### +followIdentificationThroughNickChanges = False + ### # enablePipeSyntax: Supybot allows nested commands; generally, commands are # nested via [square brackets]. Supybot can also use a @@ -356,6 +364,7 @@ types = { 'detailedTracebacks': mybool, 'driverModule': mystr, 'showOnlySyntax': mybool, + 'followIdentificationThroughNickChanges': mybool } if os.name == 'nt': diff --git a/src/irclib.py b/src/irclib.py index 71223a4c8..b8545ad9b 100644 --- a/src/irclib.py +++ b/src/irclib.py @@ -592,6 +592,19 @@ class Irc(IrcCommandDispatcher): self.prefix = ircutils.joinHostmask(self.nick, user, domain) self.prefix = intern(self.prefix) log.info('Changing user 0 hostmask to %r' % self.prefix) + elif conf.followIdentificationThroughNickChanges: + try: + id = ircdb.users.getUserId(msg.prefix) + u = ircdb.users.getUser(id) + except KeyError: + return + if u.auth: + (_, user, host) = ircutils.splitHostmask(msg.prefix) + newhostmask = ircutils.joinHostmask(msg.args[0], user, host) + log.info('Following identification for %s: %s -> %s', + u.name, u.auth[1], newhostmask) + u.auth = (u.auth[0], newhostmask) + ircdb.users.setUser(id, u) def feedMsg(self, msg): """Called by the IrcDriver; feeds a message received."""