Commit Graph

2768 Commits

Author SHA1 Message Date
James McCoy 97e71bd2cd Just create schedule.schedule/drivers.Twisted.poller without any guard
These module-level variables had historically been created such that reloading
the module wouldn't redefine the variable.  However, none of our code reloads
the modules and the guard to prevent redefining the variable was broken so it
would've been redefined anyway.

Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-05-22 22:38:44 -04:00
Valentin Lorentz 14609b3bb2 Add self as an argument to methos in src/dbi.py 2012-05-22 21:15:58 -04:00
Valentin Lorentz 1fe4cef61b Import os before using it. 2012-05-22 21:14:42 -04:00
James McCoy ca23cbb774 Merge branch 'maint/0.83.4' 2011-12-06 01:18:18 -05:00
James McCoy 998819da58 Bug fixes in src/ircmsgs.py
unbans did send the repr() of the ban list, and IrcMsg.__hash__ did try to hash a list.

Conflicts:

	src/version.py

Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2011-12-06 00:22:40 -05:00
James McCoy f6f9e654cb Only use ircmsg.whois's mask argument if it's non-empty.
Closes: Sf#3121298
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2011-12-06 00:08:01 -05:00
James McCoy 4ddfae427f Perform all received* IrcMsg tagging in one spot.
This also fixes a long-standing failing Misc test since it was relying on the
receivedAt tag.

Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2011-12-05 23:52:38 -05:00
James McCoy 360a2036ac Use socket.inet_aton for isIPV4 since Windows doesn't (always?) have inet_pton
Closes: Sf#3430008
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2011-12-05 22:48:09 -05:00
James McCoy 8b73f78b3e Merge branch 'maint/0.83.4'
Conflicts:
	plugins/Misc/plugin.py
	src/ircutils.py

Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2011-11-13 15:26:19 -05:00
James McCoy 4833976294 One last fix to umode filtering.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2011-11-13 15:10:16 -05:00
James McCoy d6336421e0 Fix IRC.do376's handling of supported state
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2011-11-07 05:58:48 -05:00
James McCoy 4232e40e26 Fix parsing of 004 message for supported umodes/chanmodes
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2011-11-07 05:58:27 -05:00
James McCoy 3bfda3cc7a Fix filtering of unsupported umodes
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2011-11-06 22:20:55 -05:00
James McCoy 92ff5f469a Merge branch 'check-umodes' into maint/0.83.4 2011-10-29 17:26:05 -04:00
James McCoy 02c0d0ce3c Merge branch 'check-umodes' 2011-10-29 17:25:57 -04:00
James McCoy b23480b915 irclib: Filter out unsupported umodes before sending them to the server
Closes: Sf#3075891
Signed-off-by: James McCoy <vega.james@gmail.com>
2011-10-29 17:22:42 -04:00
James McCoy c9e548bdd9 irclib: Add support for 004 messages from the server
At a minimum, the message gives us the server name, ircd version, supported
umodes, and supported channel modes.  Add the umodes and channel modes to
self.supported.

Some IRCds (e.g., hybrid and ircd-seven) have an extra arg which seems to be
the channel modes that require arguments.

Signed-off-by: James McCoy <vega.james@gmail.com>
2011-10-29 17:22:27 -04:00
Daniel Folkinshteyn 8f7c4bdf7f Fix banmask creation. Thanks Progval for the patch!
fixes https://sourceforge.net/tracker/?func=detail&aid=3088559&group_id=58965&atid=489447

incorporating patch https://sourceforge.net/tracker/?func=detail&aid=3163843&group_id=58965&atid=489449

Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2011-10-22 14:25:26 -04:00
Daniel Folkinshteyn df5391dcf7 Socket driver: implement ssl connection support.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2011-10-22 14:09:06 -04:00
James Vega 4661acb3a3 Honor supybot-test's timeout option and document the units
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2011-08-22 14:07:39 -04:00
James Vega 543e78828b Add utils.net.isIPV4, with utils.net.isIP checking v4 or v6
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2011-06-06 21:44:15 -04:00
James Vega 26a458b9ec Merge branch 'maint/0.83.4' 2010-09-20 19:46:18 -04:00
James Vega 0fd6a84632 Use self.error() instead of raise for BooleanRequiredFalseOnWindows.
Closes: Sf#3070285
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2010-09-20 18:34:07 -04:00
James Vega 0abe22f5d1 Merge branch 'maint/0.83.4' 2010-09-08 23:50:35 -04:00
James Vega b0575cec88 Handle changes to fnmatch.translate in Python 2.6
Define utils.python.glob2re based on the Python version being used.
Use glob2re in Todo and Note plugins.

Closes: Sf#3059292
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2010-09-08 23:31:01 -04:00
James Vega e7ef97e529 Ensure channel-specific reply.whenNotAddressed works.
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
(cherry picked from commit 166f32dcb0)
2010-08-24 19:52:59 -04:00
James Vega 8d5e4ba624 Twisted: Send all available ircmsgs and reduce delay between checks
All ircmsgs that takeMsg will return should be processed each time
checkIrcForMsgs is called since there may be multiple available in the
fastqueue.

Reduced the time between calls of checkIrcForMsgs so the delay between
normally queued ircmsgs stays close to the configured throttleTime.

Closes: Sf#3018148
(cherry picked from commit adc5d62bbf)
2010-08-24 19:49:54 -04:00
James Vega ff760d1c69 Socket: Ensure driver is flagged as disconnected after a socket error.
Users were occasionally hitting a situation where the socket had errored,
causing a reconnect, but the socket wasn't closed nor the driver marked as
disconnected.  This resulted in run() continuing to try and use the driver,
which would cause another error, schedule another reconnect, log an error, ad
infinitum.

Closes: Sf#2965530

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
(cherry picked from commit a278d17f2b)
2010-08-24 19:49:38 -04:00
James Vega a6857ce9bf utils/web.py: Only try catching socket.sslerror if built with SSL support
Closes: Sf#2998820

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
(cherry picked from commit f03a3f6c85)
2010-08-24 19:49:30 -04:00
James Vega fa199022e1 Make registry.Regexp.error mimic registry.Value.error
Regexp.error can't directly call Value.error because it's providing extra
information, so it needs to build the InvalidRegistryValue exception itself
and raise it.

Closes: Sf#2985241

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
(cherry picked from commit ef8bd817e8)
2010-08-24 19:44:31 -04:00
James Vega 8d94ff743c Include hostmasks in JOIN, PART, QUIT logs.
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
(cherry picked from commit 4a9596608a)
2010-08-24 19:44:10 -04:00
James Vega e13d3d6943 Decode/encode as 'string_escape' when (de)serializing the registry.
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2010-08-24 19:43:24 -04:00
James Vega 455b5631bc Update plugins to ignore all non-ACTION CTCP messages.
Also update commands.urlSnarfer to do the same, which allows us to revert
"Don't bother snarfing URLs from non-Action CTCP messages."

This reverts commit 3282e3407e.

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
(cherry picked from commit 288d7c6e02)
2010-08-24 19:42:11 -04:00
James Vega 2a18d07a2e Default to strict RFC compliance.
It's better to force people to use an RFC nick and change it after they
connect than to let non-RFC nicks get used and not be able to connect to the
network.

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
(cherry picked from commit 07e283f450)
2010-08-24 19:26:13 -04:00
James Vega 9ddf07ce97 Allow Banmask.makeBanmask to work when dynamic.channel is None.
This gives back the ability to generate a banmask based on the global banmask
settings instead of per-channel settings.

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
(cherry picked from commit 8a98653d3b)
2010-08-24 19:23:25 -04:00
James Vega f0852a9e45 utils.web: Provide access to the raw httpUrlRe/urlRe strings
Using the compiled regexps for a PluginRegexp method's __doc__ doesn't work.

Closes Sourceforge #2879862

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
(cherry picked from commit 25fc2de643)
2010-08-24 19:14:58 -04:00
James Vega 3e984c71d0 Clarify databases.types.cdb.maximumModifications' help and use a proper type.
The code expects a float between 0 and 1 inclusive but was simply using
registry.Float.  registry.Probability matches the behavior we want.

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
(cherry picked from commit e9a896c736)
2010-08-24 19:12:44 -04:00
James Vega 5a0f96fc8e Reply with an error when getBanmask doesn't have a valid channel.
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
(cherry picked from commit 459bc616b1)
2010-08-24 19:12:21 -04:00
James Vega bdf9e8836b Ensure getBanmask has a channel variable as per makeBanmask's requirement
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
(cherry picked from commit 260570bd4f)
2010-08-24 19:12:09 -04:00
Ricky Zhou 6299ef5c22 Account for negative times in timeElapsed.
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
(cherry picked from commit aa2337791a)
2010-08-24 19:02:16 -04:00
James Vega 024a77af48 Updated to 0.83.4.1+git.
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
(cherry picked from commit 332a614eef)
2010-08-24 18:59:46 -04:00
James Vega 166f32dcb0 Ensure channel-specific reply.whenNotAddressed works.
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2010-07-26 19:48:37 -04:00
James Vega c10d964604 Elide ignored replies from nested command output.
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2010-06-24 00:33:04 -04:00
James Vega adc5d62bbf Twisted: Send all available ircmsgs and reduce delay between checks
All ircmsgs that takeMsg will return should be processed each time
checkIrcForMsgs is called since there may be multiple available in the
fastqueue.

Reduced the time between calls of checkIrcForMsgs so the delay between
normally queued ircmsgs stays close to the configured throttleTime.

Closes: Sf#3018148
2010-06-18 20:33:43 -04:00
James Vega a278d17f2b Socket: Ensure driver is flagged as disconnected after a socket error.
Users were occasionally hitting a situation where the socket had errored,
causing a reconnect, but the socket wasn't closed nor the driver marked as
disconnected.  This resulted in run() continuing to try and use the driver,
which would cause another error, schedule another reconnect, log an error, ad
infinitum.

Closes: Sf#2965530

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2010-05-24 23:36:29 -04:00
James Vega f03a3f6c85 utils/web.py: Only try catching socket.sslerror if built with SSL support
Closes: Sf#2998820

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2010-05-24 15:44:25 -04:00
Jeremy Fincher 6135a88741 Updates and tweaks to some ircutils functions. 2010-05-18 12:48:36 -05:00
Štěpán Němec 6520d1f282 Topic plugin: Add persistence support.
Topics now persist between restarts.

Rationale: Useful when reloading/restarting; previously the topics would
be just forgotten. Don't use database, as that would be an unnecessary
overkill and in any case not needed.

(Also, remove the unused `re' module import.)

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2010-05-11 18:22:37 -04:00
Daniel Folkinshteyn 51eac7da5b add standardsubstitute vars 'utc' and 'gmt' which output current time in UTC.
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2010-04-11 17:01:11 -04:00
Daniel Folkinshteyn 2c9f325cf4 fix some time display issues in standardsubstitute:
first, use explicit time.strftime() instead of time.ctime, since ctime() leaves an extra space between month and date, if date is
single-digit.

second, use stftime('%Z') for timezone, old code was a bug which always displayed the daylight saving timezone name, even when it wasn't
in effect. time.daylight is not a dst flag, it is a flag for whether a dst timezone is /defined/, not if it is in effect.

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2010-04-11 17:00:50 -04:00
James Vega ef8bd817e8 Make registry.Regexp.error mimic registry.Value.error
Regexp.error can't directly call Value.error because it's providing extra
information, so it needs to build the InvalidRegistryValue exception itself
and raise it.

Closes: Sf#2985241

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2010-04-11 10:15:39 -04:00
James Vega 4a9596608a Include hostmasks in JOIN, PART, QUIT logs.
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2010-02-28 21:17:35 -05:00
James Vega 0540513387 Decode/encode as 'string_escape' when (de)serializing the registry.
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2010-01-30 23:03:35 -05:00
James Vega 288d7c6e02 Update plugins to ignore all non-ACTION CTCP messages.
Also update commands.urlSnarfer to do the same, which allows us to revert
"Don't bother snarfing URLs from non-Action CTCP messages."

This reverts commit 3282e3407e.

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2010-01-28 08:14:44 -05:00
Jeremy Fincher 5f9d2bc4ce We had an issue with a command flooder, so we've tightened command flood detection to detect things on a per-host basis, rather than a per-user@host basis. 2009-12-28 12:26:33 -06:00
Jeremy Fincher b774268498 Added network to debug "Incoming message" log. 2009-12-28 12:17:27 -06:00
James Vega 07e283f450 Default to strict RFC compliance.
It's better to force people to use an RFC nick and change it after they
connect than to let non-RFC nicks get used and not be able to connect to the
network.

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-11-18 20:02:53 -05:00
James Vega 8a98653d3b Allow Banmask.makeBanmask to work when dynamic.channel is None.
This gives back the ability to generate a banmask based on the global banmask
settings instead of per-channel settings.

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-11-01 10:26:08 -05:00
James Vega 56ba12aa4b Add support for UltimateIRCd's ! (protected) user mode.
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-10-23 19:20:02 -04:00
James Vega 035a9f2459 Add registry.TemplatedString for config variables which use string.Template 2009-10-15 22:17:36 -04:00
James Vega 25fc2de643 utils.web: Provide access to the raw httpUrlRe/urlRe strings
Using the compiled regexps for a PluginRegexp method's __doc__ doesn't work.

Closes Sourceforge #2879862

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-10-15 22:16:38 -04:00
James Vega f7cedae9ad Update ircutils.standardSubstitute to use string.Template
In the process, deprecate utils.str.perlVariableSubstitute.

Since string.Template doesn't support callable values though, we also
sub-class IrcDict and override __getitem__ to call the value if it is
callable.

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-10-15 22:16:29 -04:00
James Vega c5896ff6cb utils.web: Import urllib's urlencode into our namespace.
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-09-29 19:54:07 -04:00
James Vega 56fbbe9f36 commands.py: Explain the odd userHostmask check in getOtherUser
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-09-23 18:29:49 -04:00
James Vega de79e679f4 Add a data kwarg to getUrl(Fd) a la urllib2.Request.
This allows plugins to easily make POST requests using our getUrl(Fd)
functions.

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-09-16 01:17:33 -04:00
James Vega e9a896c736 Clarify databases.types.cdb.maximumModifications' help and use a proper type.
The code expects a float between 0 and 1 inclusive but was simply using
registry.Float.  registry.Probability matches the behavior we want.

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-09-11 18:09:38 -04:00
James Vega 459bc616b1 Reply with an error when getBanmask doesn't have a valid channel.
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-09-02 07:40:33 -04:00
James Vega 260570bd4f Ensure getBanmask has a channel variable as per makeBanmask's requirement
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-09-01 23:29:42 -04:00
James Vega eff20402ac Change canonize => normalize
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-08-27 16:41:34 -04:00
Štěpán Němec a66034f852 Fix some typos/wordings.
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-08-26 16:34:12 -04:00
Štěpán Němec 53cac5b078 callbacks.py: Remove duplicated getRealIrc() definition
NestedCommandsIrcProxy inherits the method from ReplyIrcProxy.
(Also fix some typos.)

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-08-20 11:23:12 -04:00
Štěpán Němec 2fa0f6dedc commands.py: Sort the items of the wrappers dictionary
(just to make it readable)

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-08-20 11:20:48 -04:00
Ricky Zhou aa2337791a Account for negative times in timeElapsed.
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-07-20 16:07:51 -04:00
Jeremy Fincher 43129239d6 Added Seen.since, which lets a user see messages which were sent since the last time he parted a channel. 2009-07-01 15:40:58 -05:00
Jeremy Fincher b9d6277e30 Added supybot.abuse.flood.command.invalid.notify, a configuration variable determining whether the bot will notify infractors of their ignoring. 2009-06-09 10:40:05 -05:00
James Vega 332a614eef Updated to 0.83.4.1+git.
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-05-25 13:38:22 -04:00
James Vega 27a4ef0ed3 Updated to 0.83.4.1.
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-05-25 13:38:12 -04:00
James Vega 54dda880d4 Add a pluginCommands kwarg to Commands.listCommands.
Plugins which implement their own listCommands method should pass their
non-typically discoverable commands to Commands.listCommands via this
mechanism.  This means that the de-duplication of commands is performed in one
spot instead of having each plugin implement it on their on in their
listCommands method.

This reverts commits 0ce829af6215b97e725f4d6d580d1151950be869 and
09fb0e6fc974445a3414fb03a94625f8538d4570.

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-05-22 18:52:15 -04:00
Ricky Zhou fa3a2dd23b Allow nItems to take longs as well.
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-05-19 00:58:07 -04:00
James Vega 3535f6a702 Updated to 0.83.4+git.
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-05-18 03:49:52 -04:00
James Vega f32c886692 Updated to 0.83.4.
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-05-18 03:49:42 -04:00
James Vega 0d98118247 Allow getCommandHelp to be told whether to use simpleSyntax.
Use this to force Misc.help to ignore simpleSyntax since the user has
explicitly asked for the help.

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-05-18 03:12:54 -04:00
James Vega 0615846ab3 Fix getCommandHelp's use of dynamic.msg
Default chan to None so we can still retrieve a config value if dynamic.msg
isn't valid (e.g., when running supybot-plugin-doc).

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-04-28 08:14:46 -04:00
James Vega b3d97ea03e callbacks: Only use dynamic.msg if it's not None in getCommandHelp
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-04-28 00:33:03 -04:00
James Vega 84ca6f2ae3 callbacks: Update PluginRegexp docstring to reference (un)addressedRegexps
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-04-09 10:53:02 -04:00
James Vega bb759259b8 Remove useless comments and fix a SyntaxError
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-04-03 10:04:39 -04:00
Jeremy Fincher dd4bc64e32 Changed a few caches to use CacheDict to ensure no without-bound growth on caches. 2009-04-02 11:45:00 -05:00
Jeremy Fincher 757991afc9 Added basic CacheDict with simple test. 2009-04-02 11:28:57 -05:00
James Vega 6b6861f884 Don't specify globals as a kwarg; only in 2.5+
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-03-22 13:47:42 -04:00
James Vega 58d308b54d Fix perlReToReplacer when \ is used in the replacement
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-03-12 17:17:20 -04:00
James Vega e00e161a73 Comments can't follow line continuations
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-03-12 17:16:56 -04:00
Jeremy Fincher 278da67295 Merge branch 'master' of ssh://jemfinch@supybot.git.sourceforge.net/gitroot/supybot 2009-03-12 14:05:36 -05:00
Jeremy Fincher fa9a9cb04d Ensured logging of error messages with unrecognized numeric codes. Fixes SR #1859821, but nothing can rectify freenode's idiocy completely. 2009-03-12 14:04:55 -05:00
James Vega 7c8d85ac8e Merge branch 'master' of git+ssh://supybot.git.sourceforge.net/gitroot/supybot 2009-03-12 15:01:46 -04:00
Jeremy Fincher bc70ab8aad Fixes SR #2233215. 2009-03-12 13:54:05 -05:00
James Vega 6986fc7abe Do not store the install directory in directories.plugins
We automatically determine the directory anyway, so there's no need to clutter
the config file with it.  Instead, simply include the directory when we
perform the search for the plugin.

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-03-12 14:50:46 -04:00
James Vega ecd2c63650 Make universalImport support 'from ModuleA import ModuleB'
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-03-11 15:55:08 -04:00
Jeremy Fincher a86b4694d7 Added utils.python.universalImport to make the previous idiom cleaner. 2009-03-11 14:05:53 -04:00
James Vega 46a4076988 Add .gitignore
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-02-27 14:17:31 -05:00
James Vega 0c42ea111a Fix our RE parsing to handle multiple backslashes before the separator
This also adds support for using brace pairs ({}, [], (), <>) as the
separators for m//.
2009-03-11 13:37:27 -04:00