diff --git a/CHANGELOG b/CHANGELOG deleted file mode 100644 index 88c09a79e..000000000 --- a/CHANGELOG +++ /dev/null @@ -1,209 +0,0 @@ - * Implemented the FreeBSD module for searching ports. - * Implemented the Unix module for *nix-specific stuff. - * Implemented a few more commands for the Http module. - * Changed names of modules to follow a standard convention. - * Implemented @morehelp system. - * Gave modules a .public attribute to determine if they should - be in @list. - * Made threaded callbacks nestable :) - * Removed 'commands' attribute/complication from irclib.Irc. - -2002-Sep-03 Jeremy Fincher - - * Version 0.60.0 - * Fixed TONS and TONS and TONS of bugs. - * Included sample.conf, to show what a config file should look like. - * Data for supybot/data has been separated out into its own package to - decrease upload/download times. - * A new Anagrams module has been added, as has a new Notes module. - * All classes are new-style classes now. - * I wrote a new reload function that both works more efficiently (no - need to keep a cache of old objects anymore), more consistently (I can - use new-style classes now), and in less code (it's much simpler the way - it works). This is a big gain. - * I've written the beginnings of a ChannelStats class that handles the - "seen" command, and later will collect information about different - messages (how many JOINs, TOPICs, QUITs, etc.) and different stats like - how many characters, words, messages sent to a channel in toto. - * COMMAND NESTING R0X0RS!!! - * Improved the telnet REPL slightly, a better login, printing, etc. - * Improved the command-line version of the bot. - * Added several new commands: xor, cfactive, version, crypt, - timecommand, last, nslookup, - -2002-Aug-27 Jeremy Fincher - - * Version 0.5 -- We're at least halfway to 1.0 :) - * Again, fixed TONS AND TONS AND TONS of bugs. - * callbacks.Privmsg.reply is no longer implemented via an exception; - subclasses can now self.reply more than once. - * Minor API change in callbacks.Privmsg.getArgs; getArgsLastOptional - has been removed in favor of the more-flexible optional keyword arg to - getArgs. - * Added several commands: exec, (un)setdefaultcapability, (un)settrace, - calc (in FunCommands) - * Added cdb library for constant databases that'll be independent of - platform. - * Added an asyncore-based interpreter via a socket that lets you telnet - into the bot and execute code in the bot process. Very useful for when - I break things and need to reload but can't talk to the bot anymore :) - * plugins.Forums is *really* useful :) - * plugins.Http is getting useful :) - * TONS of bugs fixed! - * callbacks.Privmsg now has a "threaded" attribute that you can set if - you want your subclass to spawn a new thread for every command. - -2002-Aug-21 Jeremy Fincher - - * Version 0.37.0 -- enough bugs to warrant a new minor release :) - * Fixed ***TONS*** of bugs. - * Added LICENSE to the top of all .py files written by me. - * Added plugins/parter.py, which automatically parts a channel on JOIN. - Useful for networks where, to determine who's a bot, they send everyone - to a channel such as #botsmustgo and akill those who don't leave. - * Added plugins/http.py, which hasn't been tested because I don't have - threads on this Python install. - * Made FunCommands.port work in reverse, too. That's why the size of - this tarball is significantly increased. - * Added plugins/moobot.py, a duplication of some of the functionality - of moobot, another bot written in Python. - * Made ircutils.nick class, to support irc-case-insensitive comparison - of nicks (and hashing) automatically. - * Added unit testing framework for classes subclassing - callbacks.Privmsg. - -2002-Aug-07 Jeremy Fincher - - * Version 0.36.3 (this header forgotten in the real release) - * Ok, fine. I'm using List Comprehensions now. Happy? - * Changed conf.makeClass to use imp instead of exec. - * Changed traceback logging over to a modified text form of cgitb. - * Added "find" to FactoidsCommands. - * Added "capabilities" and "auth" and "unauth" to UserCommands. - * Lots of little bugfixes. - - -2002-Jul-31 Jeremy Fincher - - * Version 0.36.2 - * A whole lotta bug fixes, in general. - * Fixed bug in FunCommands.timefun. - * Added 'reconfig' command to OwnerCommands, to configuration changes - can be enacted without restarting the bot. - * Added 'protected' to the default turned-off capabilities in an - IrcChannel. - * Fixed callbacks.ChannelEnforcer so it wouldn't enforce MODES against - the sender of the MODE itself). - * Fixed username to make it lookup the hostmask of a nick given to it. - * Fixed bug in sections command, and moved it to privmsgs.UserCommands - since it's referenced by OwnerCommands.unload. - * Fixed what I hope is the LAST bug in the help command. - * Added users/channels default arguments to ircdb.checkIgnored and - ircdb.checkCapability so they don't *have* to rely on global state. - * Added CTCP SOURCE command. - - -2002-Jul-31 Jeremy Fincher - - * Version 0.36. - * Added makeFactoids.py and dumpFactoids.py to the tools/ subdirectory - to facilitate the transfer of the bot from one Python installation to - another. - * Added Logger, a per-channel logger that logs rather similar to mIRC's - channel format. - * Fixed bug in RawLogger -- it was filtering away all messages from - ever being sent to the network. - * Added a factoids plugin. - * Added __eq__ and __hash__ methods to ircmsgs.IrcMsg so it can be - compared for equality and used in hash tables. As a side note, I also - changed .args to be a tuple rather than a list. - * Added 'sections' command to FunCommands, to see what Privmsg-derived - classes are hanging about in the bot. - * Added 'unload' command to OwnerCommands, to remove a callback in a - running Irc instance. - * Added 'load' command to OwnerCommands, allowing owners to dynamically - load a module that wasn't previously loaded and insert it into a - running Irc instance. - * Made UserCommands.addhostmask require that the hostmask not already - be an identifier for any other user. - * Fixed bug in help command (again :)) - - -2002-Jul-30 Jeremy Fincher - - * Version 0.35. - * Started moving some stuff out to the plugins/ subdirectory. Haven't - yet developed an adequate interface for plugin modules, though -- I'm - not entirely sure that it's needed. - * Began writing tests. At least I know the format of the test *data*, - I just haven't quite developed the framework in which to execute it :) - * Wrote ctcp.Ctcp, an example of PrivmsgRegexp use and a module to - respond to CTCP commands. - * Changed callbacks.PrivmsgRegexp to be much easier to use. - * Fixed bug in ircdb -- channels needed to have a !op capability by - default, otherwise everyone can do anything requiring op capabilities. - Found several of these type of bugs; had to revert to the old config - style (using a dictionary for capabilities instead of a list) in order - to resolve them. - * Generalized exception propogation mechanism so any exception in - conf.deadlyExceptions would be propogated, not just asyncore.ExitNow. - * Added command-line parsing and the ability to specify a configuration - file as an option. - * Added ircmsgs.IrcMsg.__len__, so calculating the (probable) length of - an IRC message doesn't require making a string of it first. - * Added code to make the Irc object ping the server every - conf.pingInterval seconds. I've always found that having the bot ping - the server leads to a more robust bot (easier detection of bad network - or a dropped connection). - * Made AsyncoreDriver capable of reconnecting. - * Moved AsynchatDriver to asyncoreDrivers.py, renamed some things, and - redesigned it so there's always an asyncore polling driver and the - individual asyncore drivers don't poll. The code is much simpler and - clearer this way. - * Fixed bug in ircutils.separateModes (tried to pop arguments on modes - that didn't take an argument.) - * Renamed the "unixstats" command in FunCommands to "progstats". - * Fixed bug in callbacks.Privmsg.help. - * Removed ircdb.checkPrivmsgCapability. - - -2002-Jul-29 Jeremy Fincher - - * Version 0.34. - * Changed FunCommands.cputime to FunCommands.cpustats. - * Moved bot.upkeep to world.upkeep (superReload can't reload __main__, - so having it in world allows it to be reloaded.) - * Added timestamp to debug message printing in irclib. - * Changed IrcMsg .{nick,user,host} to simple attributes. - * Added OwnerCommands.{set, unset} to set and unset temporary runtime - variables. As an example of their use, look at bot.upkeep. - * Added conf.timestampFormat, so timestamps can be universally of the - same form. - * Added FunCommands.netstats. - * Added callbacks.RootWarner, to warn people when they join a channel - as root. - * Added callbacks.ChannelEnforcer, to enforce certain capabilities on - channel. - * added ircdb.checkCapabilties and ircdb.checkPrivmsgCapabilities, - which check for any capability in a list of capabilities. - * added privmsgs.ChannelCommands.{voice,halfop} - * added ircdb.IrcChannel.checkBan - * Fixed bug in IrcUser.__init__ - - -2002-Jul-27 Jeremy Fincher - - * Version 0.33 (third release). - * Bot now exits cleanly on @quit. - * Renamed former 'irccontrol' module to the much more appropriate name - 'ircdb', which is also much easier to type and read. - * Changed slightly the config format for conf/users and conf/channels. - * Added a new command in ChannelCommands, 'setdefaultcapability', to - set the default capability response for a channel. - * Rewrote ircdb.checkCapability because the old version was buggy. - Hopefully this one isn't. - * Added callbacks.Privmsg.reply and .error, to make things a bit in - client code. Major caveat, though: you can't blindly "except:" any - longer. You *must* stick a "except self.reserved: raise" in there. - "except Exception, e:" should still work, since the classes raised - don't inherit from Exception. diff --git a/TODO b/TODO deleted file mode 100644 index 8b075c67a..000000000 --- a/TODO +++ /dev/null @@ -1,12 +0,0 @@ -Write tests (both unit tests and regression tests on the whole shebang). - -- Ugh. I don't want to have to do this. - -Continue to document a bit more. Perhaps use doctest on ircutils and ircmsgs. - -- Let me know what isn't instantly understandable, and I'll recode or write - documentation so it *is* instantly understandable. - -Write DCC stuff. - -Write the following callbacks: - -- News - -- Debian diff --git a/plugins/FunDB.py b/plugins/FunDB.py index 0099abe1f..e23cee309 100755 --- a/plugins/FunDB.py +++ b/plugins/FunDB.py @@ -235,7 +235,10 @@ class FunDB(callbacks.Privmsg): irc.queueMsg(ircmsgs.action(channel, '%s (#%s)' % (lart, id))) def addlart(self, irc, msg, args): - """""" + """ + + The target of the lart is represented with '$who'. + """ lart = privmsgs.getArgs(args) if lart.find('$who') == -1: irc.error(msg, 'There must be an $who in the lart somewhere.') diff --git a/plugins/Notes.py b/plugins/Notes.py index d357827f7..061ae0e56 100644 --- a/plugins/Notes.py +++ b/plugins/Notes.py @@ -119,7 +119,11 @@ class Notes(callbacks.Privmsg): if ircutils.isChannel(msg.args[0]): public = 1 else: - public = 0 + public = 0 + debug.printf(senderID) + debug.printf(recipID) + debug.printf(public) + debug.printf(note) self.cursor.execute("""INSERT INTO notes VALUES (NULL, %s, %s, %s, %s, %s, %s)""", senderID, recipID, int(time.time()), diff --git a/plugins/Topic.py b/plugins/Topic.py index 9f92543f7..c54d226ec 100644 --- a/plugins/Topic.py +++ b/plugins/Topic.py @@ -56,8 +56,9 @@ class Topic(callbacks.Privmsg): def addtopic(self, irc, msg, args): "[] (if not sent in the channel itself) " channel = privmsgs.getChannel(msg, args) + capability = ircdb.makeChannelCapability(channel, 'topic') topic = privmsgs.getArgs(args) - if ircdb.checkCapability(msg.prefix, 'topic'): + if ircdb.checkCapability(msg.prefix, capability): if topic.find(self.topicSeparator) != -1: s = 'You can\'t have %s in your topic' % self.topicSeparator irc.error(msg, s) @@ -72,28 +73,30 @@ class Topic(callbacks.Privmsg): newTopic = formattedTopic irc.queueMsg(ircmsgs.topic(channel, newTopic)) else: - irc.error(msg, conf.replyNoCapability % 'topic') + irc.error(msg, conf.replyNoCapability % capability) def shuffletopic(self, irc, msg, args): "[] (if not sent in the channel itself)" channel = privmsgs.getChannel(msg, args) - if ircdb.checkCapability(msg.prefix, 'topic'): + capability = ircdb.makeChannelCapability(channel, 'topic') + if ircdb.checkCapability(msg.prefix, capability): topics = irc.state.getTopic(channel).split(self.topicSeparator) random.shuffle(topics) newtopic = self.topicSeparator.join(topics) irc.queueMsg(ircmsgs.topic(channel, newtopic)) else: - irc.error(msg, conf.replyNoCapability % 'topic') + irc.error(msg, conf.replyNoCapability % capability) def removetopic(self, irc, msg, args): "[] (if not sent in the channel itself) " channel = privmsgs.getChannel(msg, args) + capability = ircdb.makeChannelCapability(channel, 'topic') try: number = int(privmsgs.getArgs(args)) except ValueError: irc.error(msg, 'The argument must be a number.') return - if ircdb.checkCapability(msg.prefix, 'topic'): + if ircdb.checkCapability(msg.prefix, capability): topics = irc.state.getTopic(channel).split(self.topicSeparator) topic = topics.pop(number) debug.printf(topic) @@ -105,7 +108,7 @@ class Topic(callbacks.Privmsg): newTopic = self.topicSeparator.join(topics) irc.queueMsg(ircmsgs.topic(channel, newTopic)) else: - irc.error(msg, conf.replyNoCapability % 'topic') + irc.error(msg, conf.replyNoCapability % capability) Class = Topic diff --git a/src/ircdb.py b/src/ircdb.py index b0f5529d7..2af5de710 100644 --- a/src/ircdb.py +++ b/src/ircdb.py @@ -483,4 +483,13 @@ def checkCapabilities(hostmask, capabilities, requireAll=False): else: return False +def getUser(irc, s): + if ircutils.isHostmask(s): + return users.getUserName(s) + else: + if users.hasUser(s): + return s + else: + return users.getUserName(irc.state.nickToHostmask(s)) + # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: