From 7a176eead3e2a11b0193896b120429b674e99e45 Mon Sep 17 00:00:00 2001 From: James Vega Date: Thu, 30 Dec 2004 05:38:34 +0000 Subject: [PATCH] Revert the non-PRIVMSG changes until after the release --- plugins/Seen.py | 80 ++++++++----------------------------------------- 1 file changed, 13 insertions(+), 67 deletions(-) diff --git a/plugins/Seen.py b/plugins/Seen.py index 882ab97f3..1e8923c9b 100644 --- a/plugins/Seen.py +++ b/plugins/Seen.py @@ -65,8 +65,6 @@ class IrcStringAndIntDict(utils.InsensitivePreservingDict): else: return ircutils.toLower(x) -ANY = '' - class SeenDB(plugins.ChannelUserDB): IdDict = IrcStringAndIntDict def serialize(self, v): @@ -129,68 +127,25 @@ class Seen(callbacks.Privmsg): said = ircmsgs.prettyPrint(msg) channel = plugins.getChannel(msg.args[0]) self.db.update(channel, msg.nick, said) - self.db.update(ANY + channel, msg.nick, said) - try: - id = ircdb.users.getUserId(msg.prefix) - self.db.update(channel, id, said) - self.db.update(ANY + channel, id, said) - except KeyError: - pass # Not in the database. - - # non-PRIVMSG which have a channel association - def doNonPrivmsgWithChannel(self, irc, msg): - if irc.isChannel(msg.args[0]): - said = ircmsgs.prettyPrint(msg) - channel = ANY + plugins.getChannel(msg.args[0]) - self.db.update(channel, msg.nick, said) try: id = ircdb.users.getUserId(msg.prefix) self.db.update(channel, id, said) except KeyError: pass # Not in the database. - doJoin = doNonPrivmsgWithChannel - doKick = doNonPrivmsgWithChannel - doMode = doNonPrivmsgWithChannel - doPart = doNonPrivmsgWithChannel - doTopic = doNonPrivmsgWithChannel - doNotice = doNonPrivmsgWithChannel - # non-PRIVMSG which don't have a channel association - def doNonPrivmsg(self, irc, msg): - said = ircmsgs.prettyPrint(msg) - self.db.update(ANY, msg.nick, said) - try: - id = ircdb.users.getUserId(msg.prefix) - self.db.update(ANY, id, said) - except KeyError: - pass # Not in the database. - doNick = doNonPrivmsg - doQuit = doNonPrivmsg - - def seen(self, irc, msg, args, channel, optlist, name): - """[] [--any] + def seen(self, irc, msg, args, channel, name): + """[] Returns the last time was seen and what was last seen - saying. * can be used as a wildcard in the nick. If --any is - specified, also search for non-PRIVMSG activity. is only - necessary if the message isn't sent on the channel itself. + saying. is only necessary if the message isn't sent on the + channel itself. """ - any = False - for (opt, _) in optlist: - if opt == 'any': - any = True try: results = [] if '*' in name: - if not any: - results = self.db.seenWildcard(channel, name) - else: - results = self.db.seenWildcard(ANY + channel, name) + results = self.db.seenWildcard(channel, name) else: - if not any: - results = [[name, self.db.seen(channel, name)]] - else: - results = [[name, self.db.seen(ANY + channel, name)]] + results = [[name, self.db.seen(channel, name)]] if len(results) == 1: (nick, info) = results[0] (when, said) = info @@ -209,9 +164,7 @@ class Seen(callbacks.Privmsg): irc.reply('I haven\'t seen anyone matching %s.' % name) except KeyError: irc.reply('I have not seen %s.' % name) - # Have to use 'something' instead of 'nick' because * isn't necessarily a - # valid character in a nick - seen = wrap(seen, ['channeldb', getopts({'any': ''}), 'something']) + seen = wrap(seen, ['channeldb', 'nick']) def last(self, irc, msg, args, channel): """[] @@ -227,31 +180,24 @@ class Seen(callbacks.Privmsg): irc.reply('I have never seen anyone.') last = wrap(last, ['channeldb']) - def user(self, irc, msg, args, channel, optlist, user): - """[] [--any] + + def user(self, irc, msg, args, channel, user): + """[] Returns the last time was seen and what was last seen saying. This looks up in the user seen database, which means - that it could be any nick recognized as user that was seen. If - --any is specified, also search for non-PRIVMSG activity by . + that it could be any nick recognized as user that was seen. is only necessary if the message isn't sent in the channel itself. """ - any = False - for (opt, arg) in optlist: - if opt == 'any': - any = True try: - if not any: - (when, said) = self.db.seen(channel, user.id) - else: - (when, said) = self.db.seen(ANY + channel, user.id) + (when, said) = self.db.seen(channel, user.id) irc.reply('%s was last seen in %s %s ago saying: %s' % (user.name, channel, utils.timeElapsed(time.time()-when), said)) except KeyError: irc.reply('I have not seen %s.' % user.name) - user = wrap(user, ['channeldb', getopts({'any': ''}), 'otherUser']) + user = wrap(user, ['channeldb', 'otherUser']) Class = Seen